ACE500: Fkey handling and more disasm

This commit is contained in:
Joshua Bell 2021-11-26 18:58:21 -08:00
parent d624435d7f
commit a636e00e1c
2 changed files with 126 additions and 81 deletions

View File

@ -1760,6 +1760,7 @@ InitFKEYDefinitions:
@l3: sta WRMAINRAM @l3: sta WRMAINRAM
stz $0579 stz $0579
;; fall through
;;; ============================================================ ;;; ============================================================
;;; Unknown Monitor ROM Routine ;;; Unknown Monitor ROM Routine

View File

@ -83,6 +83,8 @@ OLDBASL := $77B
TEMP2 := $7FB TEMP2 := $7FB
OLDBASH := $7FB OLDBASH := $7FB
FKEYPTR := $479 ; Holds offset from Aux $200 to FKEY def
;;; I/O Soft Switches ;;; I/O Soft Switches
KBD := $C000 KBD := $C000
@ -633,7 +635,7 @@ LC3E2: plx
jmp LCE0D jmp LCE0D
jsr ClearROM jsr ClearROM
jmp LCDEC jmp InitFKEYDefinitions
LC3F4: jsr ClearROM LC3F4: jsr ClearROM
jmp LCCB2 jmp LCCB2
@ -992,7 +994,7 @@ LC62D: dec $27
LC683: pla LC683: pla
LC684: jsr pageC5::DoBankC5 LC684: jsr pageC5::DoBankC5
jsr LCE00 jsr $CE00
bra LC6EA bra LC6EA
@ -1101,13 +1103,16 @@ LC774: sta ALTZPON
bpl LC774 bpl LC774
LC781: jmp (L03F0) LC781: jmp (L03F0)
;;; ============================================================
LC784: sec LC784: sec
lda $C0AA lda $C0AA ; ???
tax tax
and #$0C and #$0C
eor #$04 eor #$04
beq LC7E4 beq LC7E4
lda $C0A9 lda $C0A9 ; ???
LC792: sta $04FA LC792: sta $04FA
ora #$00 ora #$00
bpl LC7E4 bpl LC7E4
@ -1120,30 +1125,30 @@ LC792: sta $04FA
lda $04FF lda $04FF
eor #$C2 eor #$C2
bne LC7E4 bne LC7E4
lda $C0A8 lda $C0A8 ; ???
ldx $057F ldx $057F
jsr LC7E5 jsr LC7E5
bpl LC7B8 bpl LC7B8
ldx #$00 ldx #$00
LC7B8: stx $057F LC7B8: stx $057F
bra LC7E3 bra LC7E3
LC7BD: .byte $2C
plx LC7BD:
LC7BF: tsb $50 bit $04FA
and ($2C,x) bvc LC7E3
plx bit $05FA
ora $70 bvs LC7E4
ora $1A10,x bpl LC7E3
lda KBD lda KBD
bit $C0B4 bit $C0B4 ; Softswitch for Fkeys ???
bmi LC7D3 bmi :+ ; leave high bit set for later
and #$7F and #$7F
LC7D3: bit KBDSTRB : bit KBDSTRB
ldx $05FF ldx $05FF
jsr LC7E5 jsr LC7E5
bne LC7E0 bne :+
ldx #$80 ldx #$80
LC7E0: stx $05FF : stx $05FF
LC7E3: clc LC7E3: clc
LC7E4: rts LC7E4: rts
@ -1153,6 +1158,8 @@ LC7E5: sta WRCARDRAM
inx inx
rts rts
;;; ============================================================
brk brk
brk brk
brk brk
@ -1166,7 +1173,9 @@ LC7E5: sta WRCARDRAM
brk brk
brk brk
brk brk
LC7FD: jmp LC792 LC7FD: jmp LC792
.endscope .endscope
pageC7_LC7FD := pageC7::LC7FD pageC7_LC7FD := pageC7::LC7FD
@ -1192,7 +1201,7 @@ LC806: lda #<LC305
LC814: lda #M_NORMAL LC814: lda #M_NORMAL
sta MODE sta MODE
jsr Enable80Col jsr Enable80Col
jsr LCE33 jsr DoSETWND
jmp DoHomeAndClear jmp DoHomeAndClear
;;; ============================================================ ;;; ============================================================
@ -1424,7 +1433,7 @@ Do40Col:
php php
jsr Disable80Col jsr Disable80Col
jsr LCAFA jsr LCAFA
jsr LCE33 jsr DoSETWND
plp plp
bpl LC95B bpl LC95B
jmp LCC68 jmp LCC68
@ -1527,7 +1536,7 @@ Do80Col:
php php
jsr Enable80Col jsr Enable80Col
jsr LCAFA jsr LCAFA
jsr LCE33 jsr DoSETWND
plp plp
bmi LC9EA bmi LC9EA
jmp LCC18 jmp LCC18
@ -1991,10 +2000,10 @@ LCCD7: jsr LCDA8
LCCDC: stz $0579 LCCDC: stz $0579
bra LCCBD bra LCCBD
LCCE1: phx LCCE1: phx
ldx $0479 ldx FKEYPTR
jsr LCE16 jsr ReadAuxRAM
lda $0200,x lda $0200,x
jsr LCE25 jsr ReadPreviousRAM
plx plx
cmp #$00 cmp #$00
beq LCCDC beq LCCDC
@ -2007,8 +2016,8 @@ LCCFB: bit $0579
jmp LCD85 jmp LCD85
LCD03: bit $05FA LCD03: bit $05FA
bvs LCD2F bvs HandleSpecialKeys
bpl LCD2F bpl HandleSpecialKeys
phx phx
ldx $06FF ldx $06FF
bit RDRAMRD bit RDRAMRD
@ -2029,65 +2038,82 @@ LCD23: stx $06FF
ora #$80 ora #$80
plp plp
bra LCD38 bra LCD38
LCD2F: lda KBD
;;; ============================================================
HandleSpecialKeys:
lda KBD
bit KBDSTRB bit KBDSTRB
bit $C0B4 bit $C0B4 ; Softswitch for Fkeys???
LCD38: bpl LCD41 LCD38: bpl LCD41
LCD3A: cmp #$06 LCD3A: cmp #$06
bcc LCD40 bcc LCD40
ora #$80 ora #$80
LCD40: rts LCD40: rts
;; Deal with special keys
LCD41: and #$7F LCD41: and #$7F
cmp #$01 cmp #$01 ; CLRL
bne LCD4B bne LCD4B
lda #$1A lda #$1A
bra LCD3A bra LCD3A
LCD4B: cmp #$03
LCD4B: cmp #$03 ; CLRS
bne LCD53 bne LCD53
lda #$0C lda #$0C
bra LCD3A bra LCD3A
LCD53: cmp #$04
LCD53: cmp #$04 ; HOME
bne LCD5B bne LCD5B
lda #$19 lda #$19
bra LCD3A bra LCD3A
LCD5B: cmp #$06
;; "Macro" keys
LCD5B: cmp #$06 ; RUN
bne LCD63 bne LCD63
lda #$2C lda #$2C ; Like F13
bra LCD73 bra LCD73
LCD63: cmp #$1F
LCD63: cmp #$1F ; LIST
bne LCD6B bne LCD6B
lda #$2D lda #$2D ; Like F4
bra LCD73 bra LCD73
LCD6B: cmp #$20
LCD6B: cmp #$20 ; F1
bcc LCD3A bcc LCD3A
cmp #$2C cmp #$2C ; F12+1
bcs LCD3A bcs LCD3A
LCD73: pha
LCD73: pha ; Handle Fkeys
jsr LCDA8 jsr LCDA8
beq LCD7C beq LCD7C
pla pla
bra LCD3A bra LCD3A
LCD7C: lda #$FF LCD7C: lda #$FF
sta $0579 sta $0579
pla pla
jsr LCDBE jsr FindFKEYDefnOffset
LCD85: jsr LCDA8 LCD85: jsr LCDA8
beq LCD91 beq LCD91
LCD8A: stz $0579 LCD8A: stz $0579
lda #$A0 lda #$A0
bra LCD3A bra LCD3A
LCD91: phx LCD91: phx
ldx $0479 ldx FKEYPTR
jsr LCE16 jsr ReadAuxRAM
lda $0200,x lda $0200,x
jsr LCE25 jsr ReadPreviousRAM
plx plx
inc $0479 inc FKEYPTR
cmp #$00 cmp #$00
beq LCD8A beq LCD8A
bra LCD3A bra LCD3A
LCDA8: jsr LCE16
;;; ============================================================
LCDA8: jsr ReadAuxRAM
lda #$00 lda #$00
phx phx
tax tax
@ -2096,59 +2122,75 @@ LCDB0: adc $0200,x
inx inx
bne LCDB0 bne LCDB0
plx plx
jsr LCE25 jsr ReadPreviousRAM
cmp $04F9 cmp $04F9
rts rts
LCDBE: phx ;;; ============================================================
;;; Given FKEY in A ($20...$2D), get definition offset
;;; (from Aux $200) into FKEYPTR
FindFKEYDefnOffset:
phx
phy phy
jsr LCE16 jsr ReadAuxRAM
sec sec
sbc #$20 sbc #$20 ; Map F1 to $00, etc
ldy #$00 ldy #$00
tax tax
beq LCDD7 beq @l4
LCDCB: lda $0200,y @l1: lda $0200,y
beq LCDD3 beq @l2
iny iny
bra LCDCB bra @l1
LCDD3: iny
LCDD4: dex @l2: iny
bne LCDCB @l3: dex
LCDD7: jsr LCE25 bne @l1
sty $0479 @l4: jsr ReadPreviousRAM
sty FKEYPTR
ply ply
plx plx
rts rts
eor ($55) ;;; ============================================================
lsr a:$0D ;;; Initialize FKEY definitions
jmp $5349
.byte $54 ;;; Copied to Aux $200 by `InitFKEYDefinitions`
ora $FF00 SpecialStrings:
LCDEC: sta WRCARDRAM .byte "RUN\r", 0
.byte "LIST\r", 0
.byte $FF
InitFKEYDefinitions:
sta WRCARDRAM
lda #$00 lda #$00
tax tax
LCDF2: sta $0200,x @l1: sta $0200,x
inx inx
cpx #$0C cpx #$0C
bcc LCDF2 bcc @l1
LCDFA: lda LCDD4,x @l2: lda SpecialStrings - 12,x
cmp #$FF cmp #$FF
.byte $F0 beq @l3
LCE00: asl $9D sta $0200,x
brk
.byte $02
inx inx
bra LCDFA bra @l2
sta WRMAINRAM
@l3: sta WRMAINRAM
stz $0579 stz $0579
;; fall through
LCE0D: jsr LCDA8 LCE0D: jsr LCDA8
sta $04F9 sta $04F9
jmp pageC5::DoBankC5 jmp pageC5::DoBankC5
LCE16: pha ;;; ============================================================
;;; Read from Aux (saving previous state)
ReadAuxRAM:
pha
lda RDRAMRD lda RDRAMRD
sta RDMAINRAM sta RDMAINRAM
sta OURCV sta OURCV
@ -2156,19 +2198,17 @@ LCE16: pha
pla pla
rts rts
LCE25: pha ;;; Restore previous read bank state
ReadPreviousRAM:
pha
sta RDMAINRAM sta RDMAINRAM
lda OURCV lda OURCV
bpl LCE31 bpl @l1
sta RDCARDRAM sta RDCARDRAM
LCE31: pla @l1: pla
rts rts
LCE33: lda #$00
bit RDTEXT
bmi DoSETWND
lda #$14
;;; ============================================================ ;;; ============================================================
;;; Load X,Y with address of a routine -1 (for `ROMCall`) ;;; Load X,Y with address of a routine -1 (for `ROMCall`)
@ -2180,7 +2220,11 @@ LCE33: lda #$00
;;; ============================================================ ;;; ============================================================
DoSETWND: DoSETWND:
LDXY SETWND lda #0 ; set cursor to row 0
bit RDTEXT ; unless graphics mode
bmi :+
lda #20 ; then use row 20
: LDXY SETWND
bra ROMCall bra ROMCall
;;; ============================================================ ;;; ============================================================