[Coco] 6809 disassembly help wanted

Sean Conner sean at conman.org
Fri Nov 21 15:53:21 EST 2025


It was thus said that the Great Allen Huffman via Coco once stated:
> I am looking for help in disassembling this code. Jerry “Super Basic”
> Stratton helped get me started with a perl script he wrote the decodes
> 6809 op codes.  He also suggested I could POKE them into memory and use a
> CoCo disassembler. I don’t have one, but I figured out how to use EDTASM’s
> Z-BUG so sorta do it, and updated the code Mr. Stratton provided until I
> got something that would compile into the same byte code.

  The array mb_sec34_1 is fine; Jerry's disassembly is wrong.  I ran the
array through a disassembler I wrote [1] and got a cleaner result which
translates to (and using documented Radio Shack values) [2]:

address equ     $D1
sector  equ     $D3

        org     $2600
        fdb     'OS'
        lda     #13
        sta     sector
        ldd     #$3800  ; load address
loop    std     address
        inc     sector
        ldx     #DCOPC
        ldd     #$0200  ; read drive 0
        std     DCOPC,x
        lda     #33     ; track 33
        ldb     sector
        std     DCTRK,x
        ldd     address
        std     DCBPT,x
        jsr     [DSKCON] ; disk I/O
        tst     DCSTA,x ; error?
        bne     error   ; handle via DECB
        inca            ; point to next page
        cmpa    #$3D    ; stop address = $3D00
        blo     loop
        jmp     $3900   ; jump to loaded code
error   jmp     $D709   ; return IO error to BASIC

  It looks like the code assumes that [DSKCON] will return an updated
address in D to save a few instructions.  Other than that, this is straight
forward.  I haven't disassembled the other array yet.

  -spc

[1]	Using code from <https://github.com/spc476/mc6809>, which is an
	MC6809 emulator as a library.

[2]	Here's the raw disassembly:

2600 4F          - CLRA                     ; -0100 
2601 53          - COMB                     ; -aa01 
2602 86   0D     - LDA   #0D                ; -aa0- 
2604 97   D3     - STA   D3                 ; -aa0- 
2606 CC   3800   - LDD   #3800              ; -aa0- 
2609 DD   D1     - STD   D1                 ; -aa0- 
260B 0C   D3     - INC   D3                 ; -aaa- 
260D 8E   00EA   - LDX   #00EA              ; -aa0- 
2610 CC   0200   - LDD   #0200              ; -aa0- 
2613 ED   84     - STD   ,X                 ; -aa0- 
2615 86   21     - LDA   #21                ; -aa0- 
2617 D6   D3     - LDB   D3                 ; -aa0- 
2619 ED   02     - STD   2,X                ; -aa0- 
261B DC   D1     - LDD   D1                 ; -aa0- 
261D ED   04     - STD   4,X                ; -aa0- 
261F AD   9FC004 - JSR   [C004]             ; ----- 
2623 6D   06     - TST   6,X                ; -aa0- 
2625 26   08     - BNE   262F               ; ----- forwards 
2627 4C          - INCA                     ; -aaa- 
2628 81   3D     - CMPA  #3D                ; uaaaa 
262A 25   DD     - BLO   2609               ; ----- backwards unsigned
262C 7E   3900   - JMP   3900               ; ----- 
262F 7E   D709   - JMP   D709               ; ----- 


More information about the Coco mailing list