Announcement

Collapse
No announcement yet.

usercommand macro and bank0

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • usercommand macro and bank0

    I have a query about the bank selected when a usercommand macro is called
    it appears that bank0 is not guaranteed .

    I have these vars

    Code:
    button_set    VAR word bank0             ;1 BIT PER BUTTON    make it a word to have up to 16 buttons  
     button_flg    VAR word bank0            ;1 BIT PER BUTTON    make it a word to have up to 16 buttons  
     button_action VAR word bank0      ;1 BIT PER BUTTON    make it a word to have up to 16 buttons 0 = flash outline 1= flash text 
     button_rpt    VAR word bank0      ;1 BIT PER BUTTON    make it a word to have up to 16 buttons 0 = no rpt 1= rpt  (rpt returns state=4 when triggered)

    and this macro

    Code:
      
    MAKEBUTTON?CCCC  macro X0in ,Y0in ,Button ,Szin     ;sqr button no text
    k=Button*3   ; SHOULD REALLY ELIMINATE THESE MAGIC NUMBERS
    j=Button*2    ;1 WORD  PER BUTTON
    i=Button*6    ;3 WORDS PER BUTTON
        RST?RP    ;   without this    problems occur 
        if Button <8    bcf _button_action ,Button
        bcf _button_rpt ,Button
        bcf _button_set ,Button
        bcf _button_flg  ,Button
        else
        bcf _button_flg+1 ,Button-8
        bcf _button_action+1 ,Button-8
        bcf _button_rpt+1 ,Button-8
        bcf _button_set+1 ,Button-8
        endif
        MOVE?CW  Szin ,_button_xsize+ j
        MOVE?CW  Szin ,_button_ysize+ j
        MOVE?CB  0  , _BUTTON_STATE + Button
        MOVE?CW  0  ,button_count +i
        MOVE?CW  X0in ,button_X  +i
        MOVE?CW  Y0in ,button_Y  +i
        MOVE?CW  0, _button_Tsize + j 
        movlw   0
        CHK?RP   _button_Taddr
        movwf   _button_Taddr +k 
        movwf   _button_Taddr +k+1
        movwf   _button_Taddr +k+2
        
        RST?RP   
      endm
    a RST?RP fixes the problem


    question is , am I just masking a mistake somewhere else or is bank0 not explicitly set in the usercommand code insertion

    I kind of guessing that inline asm code may not have been expected for usercommand
Working...
X