Shop OBEX P1 Docs P2 Docs Learn Events
Hub stack bug — Parallax Forums

Hub stack bug

I have discovered and issue with the PUSHA,PUSHB,POPA,POPB instrcutions
Data pushed to stack is masked to 8 bits.
Data popped from stack is invalid.

Test program output
PTRA initial value
00008000
Data "pushed" onto hub stack
FEEDFACE
00C0FFEE
PTRA value after 2 "pushes"
00008008
Hub contents PTRA[-2] to PTRA[2]
000000CE
000000EE
00000000
00000000
00000000
"popped" values from hub stack
00000000
00000000

Comments

  • cgraceycgracey Posts: 14,208
    Thanks! I will fix this tonight.
  • cgraceycgracey Posts: 14,208
    edited 2015-09-29 07:37
    Ozpropdev,

    Thanks for noticing this. This looks like just an assembler problem. I forgot to change the offsets from 4 to 1 when I went back to scaled PTRx offsets. There was also some op-code problem, since I last moved the RDxxxx/WRxxxx instructions around. These PUSHA/PUSHB/POPA/POPB instructions exist in a little table of their own, since they are aliases to the main instructions, so they're often getting orphaned when I make changes.

    In the file below is a new PNut.exe. You'll need to rename from PNut.txt to PNut.exe:

    PNut.zip

    Can you please see if this solves the problem?
    PNut.zip 322.4K
  • Chip
    My code doesn't start now?

    Even this code doesn't work
    dat		orgh	1
    
    		setb	outb,#0
    		setb	dirb,#0
    
    here		jmp	@here
    
  • cgraceycgracey Posts: 14,208
    ozpropdev wrote: »
    Chip
    My code doesn't start now?

    Even this code doesn't work
    dat		orgh	1
    
    		setb	outb,#0
    		setb	dirb,#0
    
    here		jmp	@here
    

    I'm sorry. I think the problem is that the assembler has changed in other ways to accommodate some things in the new FPGA release that I'm about to post. It should be ready in about 1/2 hour.
  • cgraceycgracey Posts: 14,208
    edited 2015-09-29 09:53
    Ozpropdev,

    I posted a link to the new files at the start of the 'Prop2 FPGA files!!!" thread.
  • Thanks Chip!
    Loaded new image and new Pnut.
    Modified code for syntax changes.
    All looking good at this end. :)
    Cheers
    Brian
  • cgraceycgracey Posts: 14,208
    ozpropdev wrote: »
    Thanks Chip!
    Loaded new image and new Pnut.
    Modified code for syntax changes.
    All looking good at this end. :)
    Cheers
    Brian

    Super!

    Do the PUSHA/PUSHB/POPA/POPB instructions work correctly now?

    I could have tested them here, but it seemed there was a 99% chance that the assembler had just been not up-to-date on their encodings in the first release.
  • cgracey wrote: »
    ozpropdev wrote: »
    Thanks Chip!
    Loaded new image and new Pnut.
    Modified code for syntax changes.
    All looking good at this end. :)
    Cheers
    Brian

    Super!

    Do the PUSHA/PUSHB/POPA/POPB instructions work correctly now?

    I could have tested them here, but it seemed there was a 99% chance that the assembler had just been not up-to-date on their encodings in the first release.

    Stack stuff is looking good. Test results return correct values.
    Thanks!

  • cgraceycgracey Posts: 14,208
    Okay. I'm relieved. Thank you.
  • Just curious, how are you guys testing this output? Are there already serial objects written that were borrowed from Prop1?
  • T Chap wrote: »
    Just curious, how are you guys testing this output? Are there already serial objects written that were borrowed from Prop1?

    Yes, it's outputting to serial (@115200). Check out @ozpropdev's attachment. He's got a few lines of setup and two helper procedures. That's it!

    (note: with Chip's latest FPGA change, the code will not work. before you use it for your own tests, make sure to fix the "rep" code.)
Sign In or Register to comment.