[Coladam] ADAM FDC Source Code Project

John Turner gimechip at live.com
Thu Mar 29 17:43:40 CEST 2012


When I first mentioned that I wanted to create a replacement FDC for the Adam, I received mostly positive and some negative comments to my email. One such comment was that I should focus my efforts on something that would be much more rewarding. This got my attention :-) After scouring the net and finding source code listings for the Master 6801, Printer and Tape Drive, I decided that it would likely be beneficial to the Adam community to have a source code listing for the Coleco Disk Drive. So, yesterday, I began a project to disassemble the 6801 FDC Source Code. To start with, I disassembled the RESET Vector code (where the 6801 begins execution upon power up or reset.) I am including that source code with this message. I will continue the project until I have completely disassembled the EPROM, which is a dump from one of my Adam Floppy Disk Drives which is a 2732 (U10) labelled: "AD 31, REV. A, 09-27-84" The source code is not yet commented/annotated as I must finish the disassembly before trying to figure out what is going on and thus be able to accurately comment the code.

If anyone has other versions of the Coleco Disk ROM or other ROMs that need disassembly, feel free to email me the ROM image and I'll work on those too. Just tell me what it is from, how it is labelled, etc. I am really interested in ANY Adam Floppy Disk Controller ROMs other than the one I am currently working on. If anyone would like to join the effort, or perhaps make it a community project, then let's try to find someone to coordinate the project and we'll go from there. I would say this could be a lot of fun, but then someone would no doubt say "you need to get a life..." in which case, I would agree... :-) I do...

Here is the code thus far:

; Coleco ADAM Floppy Disk Controller 6801 Source Code ;
; From EPROM 2732 (U10), labelled: "AD 31, REV. A, 09-27-84" ;
; Disassembly by: John @ GIMEchip.com, 28 March 2012 (Happy 23rd Birthday to my son John Eric) ;
; RESET Vector enters here. ;
; Disassembly continues from 0xFA6E to end of ROM. 0xFF94 - 0xFFEE appear to be unused and are ;
; filled with 0xFF. 0xFFEF also contains 0xFF, but this is used as an RTI for the following Interrupt Vectors ;
; which do not appear to be used by the FDC hardware: TOF, OCF, ICF, IRQ1*/IS3*, SWI. ;
; 0xFFF0 - 0xFFFF are the Interrupt Vectors, and contain the following entry addresses: ;
; 0xFFF0    0xF801    SCI Vector
; 0xFFF2    0xFFEF     TOF Vector
; 0xFFF4    0xFFEF    OCF Vector
; 0xFFF6    0xFFEF    ICF Vector
; 0xFFF8    0xFFEF    IRQ1* (or IS3*) Vector
; 0xFFFA    0xFFEF    SWI Vector
; 0xFFFC    0xFE0C    NMI Vector
; 0xFFFE    0xFA6E    RESET Vector
;
; Enter here upon Power Up or RESET ;
;
LFA6E:
    sei
    lds    #$00E8
    ldaa    #$7A
    staa    X0000
    ldaa    #$FF
    staa    X0005
    ldaa    #$15
    staa    X0001
    ldaa    #$04
    staa    X0010
    ldaa    #$1B
    staa    X0011
    ldaa    #$FF
    staa    X0014
    ldaa    #$10
    staa    X0002
    ldx    #$00FF
LFA91:
    clr    $00,x
    dex
    cpx    #$0080
    bcc    LFA91
    dec    X0089
    inc    X00AB
    ldaa    X0002
    anda    #$80
    clc
    rola
    rola
    oraa    #$04
    staa    X0098
    ldx    #$FAB2
    stx    X00A0
    jmp    LFC78
;
LFAB2:
    ldx    #$0800
    ldab    $00,x
    ldx    #$FAB2
    stx    X00A0
    ldaa    X00AC
    beq    LFADA
    ldaa    #$40
    bita    X0008
    beq    LFADA
    ldaa    X0008
    ldd    X0009
    addd    #$3E80
    std    X000B
    dec    X00AC
    bne    LFADA
    ldaa    X0002
    anda    #$9F
    staa    X0002
LFADA:
    ldaa    X009E
    bne    LFB21
    ldab    #$04
    stab    X0095
    ldab    X0002
    bitb    #$01
    beq    LFAFE
    ldaa    #$03
    staa    X0094
    ldaa    #$FF
    staa    X0089
    ldaa    #$01
    staa    X00AB
    ldaa    X0002
    anda    #$9F
    staa    X0002
    bra    LFB1D
;
LFAFE:
    ldaa    #$00
    ldab    X0094
    cmpb    #$03
    bcs    LFB1D
    cmpb    #$05
    beq    LFB1D
    psha
    pshb
    ldaa    X0002
    oraa    #$50
    staa    X0002
    jsr    LFDD8
    pulb
    pula
    cmpb    #$05
    beq    LFB1D
    staa    X0094
LFB1D:
    ldaa    X009E
    beq    LFAB2
LFB21:
    cmpa    #$FF
    beq    LFB91
    ldab    X0084
    beq    LFB2E
    clr    X009E
    bra    LFAB2
;
LFB2E:
    sei
    ldaa    X0002
    bita    #$01
    beq    LFB38
    jmp    LFC78
;
LFB38:
    jsr    LFDB5
    ldx    #$00B4
LFB3E:
    dex
    bne    LFB3E
    tst    X00AB
    beq    LFB4C
    jsr    LFCA8
    clr    X00AB
LFB4C:
    ldaa    X009F
    cmpa    #$0C
    bne    LFB7C
    ldx    X0080
    cpx    #$53CA
    bne    LFB5B
    bra    LFB76
;
LFB5B:
    cpx    #$CEFA
    bne    LFB7C
    jsr    LFE27
    clr    X00A5
    ldaa    #$FF
    ldab    #$FF
    std    X0085
    std    X0087
    staa    X0089
    std    X0080
    std    X0080
    staa    X0080
LFB76:
    clr    X009E
    jmp    LFC51
;
LFB7C:
    jsr    LFC86
    bcc    LFB84
    jmp    LFC69
;
LFB84:
    ldaa    X009F
    cmpa    #$0B
    beq    LFB9A
    cmpa    #$0C
    beq    LFC00
    jmp    LFC51
;
LFB91:
    jsr    LFDB5
    jsr    LFCA8
    jmp    LFA6E
;
LFB9A:
    ldaa    X0002
    bita    #$01
    beq    LFBA3
    jmp    LFC55
;
LFBA3:
    jsr    LFDB5
    ldaa    #$05
    staa    X00AA
LFBAA:
    ldd    #$6C00
    std    X00A2
    ldaa    X00A5
    jsr    LFCCC
    bne    LFBD4
    ldaa    X00A6
    jsr    LFDF7
    jsr    LFD12
    tsta
    bne    LFBD4
    ldd    #$6E00
    std    X00A2
    ldaa    X00A5
    ldaa    X00A6
    inca
    jsr    LFDF7
    jsr    LFD12
    tsta
    beq    LFBF2
LFBD4:
    ldab    X00AA
    decb
    stab    X00AA
    bne    LFBED
    deca
    beq    LFBE7
    deca
    beq    LFBE7
    deca
    beq    LFBEA
    jmp    LFC55
LFBE7:
    jmp    LFC69
LFBEA:
    jmp    LFC65
;
LFBED:
    jsr    LFCA8
    bra    LFBAA
;
LFBF2:
    ldd    X0080
    std    X0085
    ldd    X0082
    std    X0087
    ldaa    X0084
    staa    X0089
    bra    LFC51
;
LFC00:
    ldaa    X0002
    bita    #$01
    bne    LFC55
    ldaa    #$FF
    staa    X0089
    jsr    LFDB5
    ldaa    #$05
    staa    X00AA
LFC11:
    ldd    #$7C00
    std    X00A2
    ldaa    X00A5
    jsr    LFCCC
    bne    LFC39
    ldaa    X00A6
    jsr    LFDF7
    jsr    LFD67
    tsta
    bne    LFC39
    ldd    #$7E00
    std    X00A2
    ldaa    X00A6
    inca
    jsr    LFDF7
    jsr    LFD67
    tsta
    beq    LFC51
LFC39:
    ldab    X00AA
    decb
    stab    X00AA
    bne    LFC4C
    cmpa    #$04
    beq    LFC55
    cmpa    #$03
    bne    LFC69
    ldaa    #$05
    bra    LFC6B
;
LFC4C:
    jsr    LFCA8
    bra    LFC11
;
LFC51:
    ldaa    #$00
    bra    LFC6B
;
LFC55:
    ldd    X0080
    std    X0085
    ldd    X0082
    std    X0087
    ldaa    X0084
    staa    X0089
    ldaa    #$03
    bra    LFC6B
;
LFC65:
    ldaa    #$01
    bra    LFC6B
;
LFC69:
    ldaa    #$02
LFC6B:
    staa    X0094
    bra    LFC71
;
    db    $97, $95
;
LFC71:
    clr    X009E
    ldaa    #$1B
    staa    X0011
LFC78:
    jsr    LFDD8
    ldaa    #$1B
    staa    X0011
    clra
    staa    X0099
    cli
    jmp    LFAB2
;
LFC86:
    pshb
    psha
    ldaa    #$70
    staa    X0002
    ldab    X0080
    ldaa    X0081
    lsrd
    lsrd
    stab    X00A5
    cmpb    #$28
    bcc    LFCA1
    ldab    X0080
    andb    #$03
    aslb
    incb
    stab    X00A6
    sec
LFCA1:
    tpa
    eora    #$01
    tap
    pula
    pulb
    rts
;
LFCA8:
    ldaa    X0002
    bita    #$01
    bne    LFCC3
    ldx    #$FCC3
    stx    X00A0
    ldx    #$1800
    ldaa    #$06
    staa    $00,x
    ldaa    #$01
LFCBC:
    bita    X0002
    beq    LFCBC
    jsr    LFDEB
LFCC3:
    ldx    #$3800
    clra
    staa    $00,x
    staa    X00A8
    rts
;
LFCCC:
    ldab    X0002
    bitb    #$01
    bne    LFD0F
    cmpa    #$28
    bcc    LFD0F
    ldx    #$FCF4
    stx    X00A0
    ldx    #$7800
    staa    $00,x
    staa    X00A8
    ldx    #$1800
    ldab    #$16
    stab    $00,x
    ldaa    #$01
LFCEB:
    bita    X0002
    beq    LFCEB
    jsr    LFDEB
    bra    LFD0F
;
LFCF4:

;
    ldaa    X00A8
    ldx    #$3800
    staa    $00,x
    cmpa    #$12
    bcc    LFD07
    ldaa    X0002
    anda    #$FD
    staa    X0002
    bra    LFD0D
;
LFD07:
    ldaa    X0002
    oraa    #$02
    staa    X0002
LFD0D:
    clra
    rts

;
LFD0F:
    ldaa    #$01
    rts
;
LFD12:
    staa    X00A7
    cmpa    #$09
    bcc    LFD45
    ldaa    #$02
    staa    X00A9
    ldx    #$5800
    ldaa    X00A7
    staa    $00,x
    ldx    #$FD49
    stx    X00A0
    ldx    #$1800
    ldaa    #$84
    staa    $00,x
    ldx    X00A2
LFD31:
    ldab    X0002
    bitb    #$05
    beq    LFD31
    ldaa    $00,x
    inx
    bitb    #$01
    beq    LFD31
    jsr    LFDEB
    ldaa    #$04
    bra    LFD66
;
LFD45:
    ldaa    #$01
    bra    LFD66
;
LFD49:
    ldab    X00A4
    ldaa    #$03
    bitb    #$0C
    beq    LFD58
    dec    X00A9
    bne    LFD1C
    bra    LFD66
;
LFD58:
    ldaa    #$02
    bitb    #$10
    beq    LFD65
    dec    X00A9
    bne    LFD1C
    bra    LFD66
;
LFD65:
    clra
LFD66:
    rts
;
LFD67:
    staa    X00A7
    cmpa    #$09
    bcc    LFD9A
    ldaa    #$02
    staa    X00A9
    ldaa    X00A7
    ldx    #$5800
    staa    $00,x
    ldx    #$FD9E
    stx    X00A0
    ldaa    #$A4
    ldx    #$1800
    staa    $00,x
    ldx    X00A2
LFD86:
    ldab    X0002
    bitb    #$05
    beq    LFD86
    ldaa    $00,x
    inx
    bitb    #$01
    beq    LFD86
    jsr    LFDEB
    ldaa    #$04
    bra    LFDB4
;
LFD9A:
    ldaa    #$01
    bra    LFDB4
;
LFD9E:
    ldab    X00A4
    ldaa    #$02
    bitb    #$14
    beq    LFDAD
    dec    X00A9
    bne    LFD71
    bra    LFDB4
;
LFDAD:
    ldaa    #$03
    bitb    #$40
    bne    LFDB4
    clra
;
LFDB4:
    rts
;
LFDB5:
    psha
    pshx
    ldaa    X0002
    bita    #$20
    bne    LFDCC
    oraa    #$70
    staa    X0002
    ldaa    #$02
LFDC3:
    ldx    #$9C40
LFDC6:
    dex
    bne    LFDC6
    deca
    bne    LFDC3
LFDCC:
    pulx
    pula
    rts
;
LFDCF:
;
    psha
    ldaa    X0002
    anda    #$9F
    staa    X0002
    pula
    rts
;
LFDD8:
    ldaa    X0008
    ldd    X0009
    addd    #$3E80
    std    X000B
    ldaa    #$FA
    staa    X00AC
    rts
;
LFDE6:
    ldaa    #$03
    staa    X0094
;
LFDEB:
    ldx    #$1800
    ldaa    #$D0
    staa    $00,x
    ldaa    #$01
    staa    X00AB
    rts
;
LFDF7:
    pshx
    pshb
    tab
    decb
    ldx    #$FE04
    abx
    ldaa    $00,x
    pulb
    pulx
    rts
;
LFE04:
    nop
    tap
LFE06:
    db    $03
LFE07:
    inx
    asld
LFE09:
    db    $02
LFE0A:
    tpa
    lsrd
LFE0C:
    ldx    #$0800
    ldaa    $00,x
    tsx
    ldab    #$05
    abx
    ldd    X00A0
    staa    $00,x
    inx
    stab    $00,x
    ldx    #$0800
LFE1F:
    brn    LFE1F
    ldaa    $00,x
    staa    X00A4
    rti
;
LFE26:
    rti
;
LFE27:
    ldaa    X0002
    bita    #$01
    beq    LFE30
    jmp    LFF8F
;
LFE30:
    jsr    LFCA8
    ldaa    #$27
    staa    X00E9
    ldx    #$FE4C
    stx    X00A0
    ldx    #$7800
    ldaa    X00E9
    staa    $00,x
    ldx    #$1800
    ldaa    #$16
    staa    $00,x
LFE4A:
    bra    LFE4A
;
LFE4C:
    ldaa    #$0A
    staa    X00EB
    ldaa    #$70
    staa    X0002
    ldaa    #$01
    staa    X00EA
    ldx    #$FF68
    stx    X00A0
    ldaa    X00E9
    cmpa    #$12
    bcc    LFE6D
    ldaa    X0002
    anda    #$FD
    staa    X0002
    ldaa    #$F0
    bra    LFE75
;
LFE6D:
    ldaa    X0002
    oraa    #$02
    staa    X0002
    ldaa    #$F0
LFE75:
    ldx    #$1800
    staa    $00,x
    ldx    #$7800
    ldab    #$64
LFE7F:
    ldaa    #$04
LFE81:
    bita    X0002
    beq    LFE81
    ldaa    #$4E
    staa    $00,x
    decb
    bne    LFE7F
LFE8C:
    ldab    #$0C
LFE8E:
    ldaa    #$04
LFE90:
    bita    X0002
    beq    LFE90
    ldaa    #$00
    staa    $00,x
    decb
    bne    LFE8E
    ldab    #$03
LFE9D:
    ldaa    #$04
LFE9F:
    bita    X0002
    beq    LFE9F
    ldaa    #$F5
    staa    $00,x
    decb
    bne    LFE9D
    ldaa    #$04
LFEAC:
    bita    X0002
    beq    LFEAC
    ldaa    #$FE
    staa    $00,x
    ldaa    #$04
LFEB6:
    bita    X0002
    beq    LFEB6
    ldaa    X00E9
    staa    $00,x
    ldaa    #$04
LFEC0:
    bita    X0002
    beq    LFEC0
    clra
    staa    $00,x
    ldaa    #$04
LFEC9:
    bita    X0002
    beq    LFEC9
    ldaa    X00EA
    staa    $00,x
    inca
    staa    X00EA
    ldaa    #$04
LFED6:
    bita    X0002
    beq    LFED6
    ldaa    #$02
    staa    $00,x
    ldaa    #$04
LFEE0:
    bita    X0002
    beq    LFEE0
    ldaa    #$F7
    staa    $00,x
    ldab    #$16
LFEEA:
    ldaa    #$04
LFEEC:
    bita    X0002
    beq    LFEEC
    ldaa    #$4E
    staa    $00,x
    decb
    bne    LFEEA
    ldab    #$0C
LFEF9:
    ldaa    #$04
LFEFB:
    bita    X0002
    beq    LFEFB
    ldaa    #$00
    staa    $00,x
    decb
    bne    LFEF9
    ldab    #$03
LFF08:
    ldaa    #$04
LFF0A:
    bita    X0002
    beq    LFF0A
    ldaa    #$F5
    staa    $00,x
    decb
    bne    LFF08
    ldaa    #$04
LFF17:
    bita    X0002
    beq    LFF17
    ldaa    #$FB
    staa    $00,x
    clrb
LFF20:
    ldaa    #$04
LFF22:
    bita    X0002
    beq    LFF22
    ldaa    #$E5
    staa    $00,x
    decb
    bne    LFF20
LFF2D:
    ldaa    #$04
LFF2F:
    bita    X0002
    beq    LFF2F
    ldaa    #$E5
    staa    $00,x
    decb
    bne    LFF2D
    ldaa    #$04
LFF3C:
    bita    X0002
    beq    LFF3C
    ldaa    #$F7
    staa    $00,x
    ldab    #$64
LFF46:
    ldaa    #$04
LFF48:
    bita    X0002
    beq    LFF48
    ldaa    #$4E
    staa    $00,x
    decb
    bne    LFF46
    ldaa    X00EA
    cmpa    #$09
    beq    LFF5C
    jmp    LFE8C
;
LFF5C:
    ldab    #$4E
LFF5E:
    ldaa    X0002
    bita    #$04
    beq    LFF5E
    stab    $00,x
    bra    LFF5E
;
LFF68:
    ldx    #$0800
    ldab    $00,x
    bitb    #$01
    bne    LFF68
    ldaa    X00A4
    bita    #$04
    beq    LFF7F
    dec    X00EB
    beq    LFF7F
    jmp    LFE50
;
LFF7F:
    dec    X00E9
    ldaa    X00E9
    cmpa    #$FF
    beq    LFF8B
    jmp    LFE37
;
LFF8B:
    jsr    LFCA8
    rts
;
LFF8F:
    ldaa    #$10
    staa    X0002
    rts
;
; The following code simply serves to fill the unused space from 0xFF94 to 0xFFEE with 0xFF ;
LFF94:
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
    stx    XFFFF
;
LFFEF:
    rti        ; This is for TOF, OCF, ICF, IRQ1*/IS3*, SWI which are unused by the
            ; FDC hardware.
; ** Interrupt Vectors **
;
LFFF0    db    $F8, $01        SCI Vector
LFFF2    db    $FF, $EF         TOF Vector
LFFF4    db    $FF, $EF        OCF Vector
LFFF6    db    $FF, $EF        ICF Vector
LFFF8    db    $FF, $EF        IRQ1* (or IS3*) Vector
LFFFA    db    $FF, $EF        SWI Vector
LFFFC    db    $FE, $0C        NMI Vector
LFFFE    db    $FA, $6E        RESET Vector


Let me know what you think about the project, good or bad... JOHN
 		 	   		  


More information about the Coladam mailing list