Shop OBEX P1 Docs P2 Docs Learn Events
RESOLVED: Jump table not working PASM — Parallax Forums

RESOLVED: Jump table not working PASM

WurlitzerWurlitzer Posts: 237
edited 2009-09-01 12:16 in Propeller 1
As usual I work on a problem for an hour, post then find it. The jmp #tmp1 needs to be jmp tmp1

I have used the following format for jump tables before without issue but I must be missing the forest for the trees on this one.

If in my MainLoop I do a JMP #x1 everything down stream in this cog works fine and the cogs depending on this cog also work fine.

If, however I do a JMP #NoteCommandMsg it appears that no data gets sent to the hub for subsequent processing.

Setting ChannelNum to 1 would seem to point me to "x1" in the jump table yet something is not working.
NoteCommandMsg 

                         mov ChannelNum, #1
                         mov  tmp1, ChannelNum
                         cmp  ChannelNum, #13 wc, wz, nr
                    if_a jmp  #MainLoop
                         add  tmp1, #ManualNumTbl
                         nop
                         jmp  #tmp1                                                  

ManualNumTbl             jmp  #MainLoop       '0
x1                       jmp  #Pedal_1_Update  '1
                         jmp  #Acc_1_Update    '2
                         jmp  #Solo_1_Update   '3
                         jmp  #MainLoop      '4
                         jmp  #MainLoop      '5
                         jmp  #MainLoop      '6
                         jmp  #MainLoop      '7
                         jmp  #MainLoop      '8
                         jmp  #MainLoop      '9
                         jmp  #MainLoop      '10                         
                         jmp  #Pedal_2_Update '11
                         jmp  #Acc_2_Update   '12
                         jmp  #Solo_2_Update  '13 


Post Edited (Wurlitzer) : 8/31/2009 4:17:30 PM GMT

Comments

  • JonnyMacJonnyMac Posts: 9,198
    edited 2009-08-31 16:23
    I use min and max to "fix" the index for a jump table.

    setled                  mov     tmp1, color                     ' get color
                            min     tmp1, #0                        ' force color to legal range
                            max     tmp1, #4                        '   (0 or 4 = off)
                            add     tmp1, #jmpcolor                 ' add to jump table
                            nop
                            jmp     tmp1                            ' jump to color mode
    
    jmpcolor                jmp     #ledoff
                            jmp     #ledred
                            jmp     #ledgreen
                            jmp     #ledyellow
                            jmp     #ledoff
    
  • WurlitzerWurlitzer Posts: 237
    edited 2009-09-01 12:16
    Thanks Jonny, good tip. I'll incorporate that into my jump table routines as a standard.
Sign In or Register to comment.