;;; ============================================================ ;;; Franklin ACE 2X00 ROM V6.0 Disassembly ;;; ;;; First $1000 bytes of U2 ROM (usually banked in $C000-$CFFF) ;;; ;;; Build with CC65's ca65 assembler ;;; ============================================================ .setcpu "65C02" .include "opcodes.inc" .feature string_escapes ;;; ============================================================ ;;; Patches ;;; Set to 1 to include preliminary fixes for: ;;; * MouseText mode failing to exist on $18 output. ;;; * MouseText displaying if $40-$5F sent to COUT. INCLUDE_PATCHES = 0 ;;; ============================================================ ;;; Equates ;;; Zero Page WNDLFT := $20 WNDWDTH := $21 WNDTOP := $22 WNDBTM := $23 CH := $24 CV := $25 BASL := $28 BASH := $29 BAS2L := $2A BAS2H := $2B INVFLG := $32 CSWL := $36 CSWH := $37 KSWL := $38 KSWH := $39 A1L := $3C A1H := $3D A2L := $3E A2H := $3F A4L := $42 A4H := $43 RNDL := $4E RNDH := $4F ;;; Page 3 Vectors XFERVEC := $3ED L03F0 := $3F0 ; ??? L03FE := $3FE ; ??? ;;; Screen Holes SAVEA := $4F8 SAVEX := $578 SAVEY := $478 OLDCH := $47B MODE := $4FB ;; Bit 7 = Escape Mode ;; Bit 6 = MouseText active ;; Bit 5 = ??? set when "normal" ;; Bit 4 = ??? set when "normal" ;; Bit 3 = ??? unused ??? ;; Bit 2 = ??? unused ??? ;; Bit 1 = ??? used for ??? ;; Bit 0 = ??? used for ??? M_ESC = %10000000 M_MOUSE = %01000000 M_NORMAL= %00110000 M_INACTIVE = $FF ; When firmware is inactive OURCH := $57B OURCV := $5FB CHAR := $67B XCOORD := $6FB TEMP1 := $77B ; Unused OLDBASL := $77B TEMP2 := $7FB OLDBASH := $7FB ;;; I/O Soft Switches KBD := $C000 CLR80COL:= $C000 SET80COL:= $C001 RDMAINRAM := $C002 RDCARDRAM := $C003 WRMAINRAM := $C004 WRCARDRAM := $C005 ALTZPOFF:= $C008 ALTZPON := $C009 CLR80VID:= $C00C SET80VID:= $C00D CLRALTCHAR := $C00E SETALTCHAR := $C00F KBDSTRB := $C010 RDLCBNK2:= $C011 RDLCRAM := $C012 RDRAMRD := $C013 RDRAMWRT:= $C014 RDCXROM := $C015 RDALTZP := $C016 RDC3ROM := $C017 RD80COL := $C018 RDVBL := $C019 RDTEXT := $C01A RDPAGE2 := $C01C ALTCHARSET := $C01E RD80VID := $C01F TXTPAGE1:= $C054 TXTPAGE2:= $C055 RD63 := $C063 PTRIG := $C070 ROMIN := $C081 ROMIN2 := $C082 LCBANK2 := $C083 LCBANK1 := $C08B ;;; Documented Firmware Entry Points C3KeyIn := $C305 C3COut1 := $C307 AUXMOVE := $C311 XFER := $C314 CLRROM := $CFFF ;;; Monitor ROM BELLB := $FBE2 SETWND := $FB4B SETKBD := $FE89 SETVID := $FE93 MON_VTAB:= $FC22 VTABZ := $FC24 CLREOP := $FC42 HOME := $FC58 CLREOL := $FC9C CLREOLZ := $FC9E COUT := $FDED COUT1 := $FDF0 MON_SAVE:= $FF4A ;;; ============================================================ .org $C000 ;;; ============================================================ ;;; Page $C0 - Unused (garbage data?) ;;; ============================================================ .res $100, 0 ;;; ============================================================ ;;; Page $C1 - Parallel Port Firmware ;;; ============================================================ .scope pageC1 LC100: bra LC111 LC102: bra LC107 LC104: nop sec ; $Cn05 = $38 Pascal 1.1 sig nop LC107: clc ; $Cn07 = $18 Pascal 1.1 sig clv bra LC114 ;; Signature bytes .byte $01 ; Pascal 1.1 signature .byte $31 ; $31 = Super Serial Card (!) ;; Pascal 1.1 Firmware Protocol Table .byte .lobyte(LC12B) .byte .lobyte(LC133) .byte .lobyte(LC136) .byte .lobyte(LC13E) LC111: bit LC135 LC114: jsr LC1D6 pha phx phy sta $0679 bvc LC122 jsr $C806 LC122: jsr $C83C ply plx pla LC128: jmp $C5FA LC12B: jsr LC1D6 jsr $C897 bra LC128 LC133: ldx #$03 LC135: rts LC136: jsr LC1D6 jsr $C89D bra LC128 LC13E: jsr LC1D6 jsr $C8A5 bra LC128 LC146: lda #$00 bit RDALTZP bpl LC14F ora #$80 LC14F: bit RDRAMRD bpl LC156 ora #$40 LC156: bit RDRAMWRT bpl LC15D ora #$20 LC15D: bit RDLCBNK2 bpl LC164 ora #$10 LC164: bit RDLCRAM bpl LC16B ora #$08 LC16B: bit RD80COL bpl LC177 bit RDPAGE2 bpl LC177 ora #$04 LC177: rts LC178: phx asl a asl a bcc LC180 sta RDCARDRAM LC180: asl a bcc LC186 sta WRCARDRAM LC186: asl a bcc LC193 asl a bcc LC18F ldx #$03 .byte $2C LC18F: ldx #$01 bra LC19B LC193: asl a bcc LC199 ldx #$0B .byte $2C LC199: ldx #$09 LC19B: bit $C080,x bit $C080,x asl a bcc LC1A7 sta TXTPAGE2 LC1A7: plx rts LC1A9: bit #$04 beq LC1B0 sta TXTPAGE1 LC1B0: sta RDMAINRAM sta WRMAINRAM bit ROMIN rts brk brk brk brk brk brk brk LC1C1: brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk jsr LC128 jsr COUT1 LC1D6: php sei pha lda #$C1 sta $07F8 sta $C0BA sta $C0B8 sta CLRROM pla plp rts brk brk brk brk brk brk brk brk LC1F2: plx bit CLRROM rti LC1F7: jmp LC146 LC1FA: jmp LC178 LC1FD: jmp LC1A9 .endscope ;;; ============================================================ ;;; Page $C2 - Serial Port Firmware ;;; ============================================================ .scope pageC2 bit $C5A7 bra LC211 sec ; $Cn05 = $38 Pascal 1.1 sig .byte OPC_BCC ; never taken clc ; $Cn07 = $18 Pascal 1.1 sig clv bra LC211 ;; Signature bytes .byte $01 ; Pascal 1.1 signature .byte $31 ; $31 = Super Serial Card ;; Pascal 1.1 Firmware Protocol Table .byte .lobyte(LC214) .byte .lobyte(LC217) .byte .lobyte(LC21A) .byte .lobyte(LC21D) LC211: jmp $C500 LC214: jmp $C51F LC217: jmp $C528 LC21A: jmp $C530 LC21D: jmp $C538 ;; ??? LC220: lda $077C and #$F1 sta $077C sec lda RDVBL bmi @l2 sta PTRIG lda #$08 tsb $077C clc bit $067C bpl @l1 lda #$20 tsb $077C lda $07FC and #$02 beq @l1 tsb $077C stz $067C @l1: bit RD63 bmi @l2 lda #$04 tsb $077C @l2: lda RDCXROM ora RDC3ROM bmi @l3 jmp @l12 @l3: sta $067C lda RDCXROM sta $C048 ; ??? bpl @l7 txa bpl @l5 lda $067D cmp $047C bne @l4 lda $077D cmp $057C beq @l11 @l4: inc $047C bne @l11 inc $057C bra @l11 @l5: lda $047D cmp $047C bne @l6 lda $057D cmp $057C beq @l11 @l6: sec lda $047C sbc #$01 sta $047C lda $057C sbc #$00 sta $057C bra @l11 @l7: tya bmi @l9 lda $06FD cmp $04FC bne @l8 lda $07FD cmp $05FC beq @l11 @l8: inc $04FC bne @l11 inc $05FC bra @l11 @l9: lda $04FD cmp $04FC bne @l10 lda $05FD cmp $05FC beq @l11 @l10: sec lda $04FC sbc #$01 sta $04FC lda $05FC sbc #$00 sta $05FC @l11: clc @l12: bcs @l13 lda $077C and $07FC beq @l13 sec @l13: rts ;; ??? ldx $EB lda $0342,x .byte $8D .byte $12 .endscope ;;; ============================================================ ;;; Page $C3 - Enhanced 80 Column Firmware ;;; ============================================================ ;; Init LC300: bit SETV ; V = init bra MainEntry ;; Input .assert * = C3KeyIn, error, "Entry point mismatch" LC305: sec ; $Cn05 = $38 Pascal 1.1 sig .byte OPC_BCC ; never taken; skip next byte ;; Output .assert * = C3COut1, error, "Entry point mismatch" LC307: clc ; $Cn07 = $18 Pascal 1.1 sig clv bra MainEntry ;; Signature bytes .byte $01 ; Pascal 1.1 signature .byte $88 ; $88 = 80 Column Card ;; Pascal 1.1 Firmware Protocol Table .byte LC305 stx KSWH lda #