[Coco] lbsr and rts

Lothan lothan at newsguy.com
Wed Sep 16 14:45:13 EDT 2009

If I'm reading this right, that block of code translates to:

L010A JSR <$1E
 LSR <$9D

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

More information about the Coco mailing list