[Coco] lbsr and rts
L. Curtis Boyle
curtisboyle at sasktel.net
Wed Sep 16 16:15:01 EDT 2009
The Nitros9 project, at least at one time, had a disassembly of
basic09 that would help you greatly. I think (going on very faint
memory here) that those may have been jsr function code style calls,
where the RTS address on the stack would point to the 'non-sensical'
byte so that the called routine would use that byte as either a
parameter, or a table lookup offset, or two bytes as a value/address
of some sort.
Sent from my iPhone
L. Curtis Boyle
On Sep 16, 2009, at 12:45 PM, Lothan <lothan at newsguy.com> wrote:
> If I'm reading this right, that block of code translates to:
>
> L010A JSR <$1E
> LSR <$9D
> EXG D,Y
>
> What's funny here is that L010D is pointing to the $9D in the LSR
> instruction. If we ignore that, the block at L010D is:
>
> L010D JSR <$1E
> FCB $02 #invalid instruction
>
> And the block at L013A is just as goofy:
>
> L013A JSR <$2A
> NEG <$00
> FCB $72 # invalid instruction
> FCB $02 # invalid instruction
>
> Either way, neither of those two blocks seem to be valid code. This
> may indicate the block at L08F8 isn't decoded correctly.
>
> Can you send me the bin you're looking at it so I can disassemble it
> and try to make heads/tails out of it?
>
> --------------------------------------------------
> From: "Wayne Campbell" <asa.rand at yahoo.com>
> Sent: Wednesday, September 16, 2009 1:46 PM
> To: <coco at maltedmedia.com>
> Subject: [Coco] lbsr and rts
>
>> I have found, in the assembly code generated by disasm, that there
>> are labels in the declarations (all those fcb's) that are being
>> addressed in the code using lbsr op codes. Yet, there is no rts
>> instruction anywhere in those fcb's. Can someone explain how this
>> works? An example is:
>>
>> * The L010A label is addressed twice in the program code.
>> L010A fcb $9D
>> fcb $1E
>> fcb $04
>> * The L010D label is addressed ten times in the program code.
>> L010D fcb $9D
>> fcb $1E
>> fcb $02
>>
>> this series continues until:
>>
>> L013A fcb $9D
>> fcb $2A *
>> fcb $00
>> fcb $00
>> fcb $72 r
>> fcb $02
>>
>> In the code, the following statements address these labels:
>>
>> Both occurrences of the L010A label, and one of the L010D labels,
>> occur in this routine:
>> L08F8 ldx $02,s
>> lda #$80
>> lbsr L010A
>> bne L090F
>> lbsr L010D
>> beq L0915
>> leax $03,x
>> lda #$20
>> lbsr L010A
>> beq L0915
>>
>> I just don't understand.
>>
>> Wayne
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list