disasm; and include tentative patches

This commit is contained in:
Joshua Bell 2021-11-09 18:17:23 -08:00
parent 73710c55b2
commit f753ad98d2
2 changed files with 108 additions and 42 deletions

View File

@ -8,6 +8,11 @@
.include "opcodes.inc" .include "opcodes.inc"
.feature string_escapes .feature string_escapes
;;; Set to 1 to include preliminary fixes for:
;;; * MouseText mode failing to exist on $18 output.
;;; * CH not working to set horizontal cursor position.
INCLUDE_PATCHES = 0
;;; Zero Page ;;; Zero Page
WNDLFT := $20 WNDLFT := $20
@ -57,6 +62,7 @@ MODE := $4FB
M_ESC = %10000000 M_ESC = %10000000
M_MOUSE = %01000000 M_MOUSE = %01000000
M_NORMAL= %00110000 M_NORMAL= %00110000
M_INACTIVE = $FF ; When firmware is inactive
OURCH := $57B OURCH := $57B
OURCV := $5FB OURCV := $5FB
@ -206,7 +212,11 @@ l1: php
;; NOTE: In ACE 500 ROM, the below is patched to ;; NOTE: In ACE 500 ROM, the below is patched to
;; address the CH/OURCH issue. ;; address the CH/OURCH issue.
.if !INCLUDE_PATCHES
lda OURCH lda OURCH
.else
jsr Patch1
.endif
sta CH sta CH
l2: plp l2: plp
@ -249,7 +259,11 @@ l8: bra l10
l9: lda SAVEA l9: lda SAVEA
l10: ldx SAVEX l10: ldx SAVEX
ldy CH ldy CH
.if !INCLUDE_PATCHES
sty OURCH sty OURCH
.else
jsr Patch2
.endif
ldy SAVEY ldy SAVEY
SETV: rts ; has V flag set SETV: rts ; has V flag set
@ -269,6 +283,7 @@ EscapeMode:
;;; ============================================================ ;;; ============================================================
.assert * = $C3DC, error, "Potential entry point moved"
;; ??? ;; ???
bit CLRROM bit CLRROM
jmp LCEE7 jmp LCEE7
@ -284,6 +299,7 @@ EscapeMode:
;;; ============================================================ ;;; ============================================================
.assert * = $C3E8, error, "Potential entry point moved"
;; ??? ;; ???
bit CLRROM bit CLRROM
jmp LCE18 jmp LCE18
@ -615,7 +631,7 @@ LC877: jsr LC850
LC8B1: sta CHAR LC8B1: sta CHAR
LC8B4: jsr CheckPauseListing LC8B4: jsr CheckPauseListing
lda MODE lda MODE
and #$03 ; test low 3 bits and #$03 ; test low 2 bits
beq @l1 beq @l1
jmp LCA11 jmp LCA11
@ -832,7 +848,7 @@ DoQuit:
ldx #0 ldx #0
jsr LCA80 jsr LCA80
lda #$FF lda #M_INACTIVE
sta MODE ; set all mode bits (???) sta MODE ; set all mode bits (???)
lda #$98 lda #$98
@ -848,7 +864,12 @@ DoCtrlCaret:
bra SetModeBits bra SetModeBits
DoDisableMouseText: DoDisableMouseText:
lda #M_MOUSE ; clear bit BUG: Should be ~M_MOUSE .if !INCLUDE_PATCHES
lda #M_MOUSE ; BUG! Should be ~M_MOUSE
.else
lda #.lobyte(~M_MOUSE)
.endif
PreserveModeBits: PreserveModeBits:
and MODE and MODE
bra StoreMode bra StoreMode
@ -1081,7 +1102,11 @@ PascalInit:
jsr LC800 jsr LC800
LCB47: jsr LCBC7 LCB47: jsr LCBC7
LCB4A: ldx CH LCB4A: ldx CH
.if !INCLUDE_PATCHES
stx OURCH stx OURCH
.else
jsr Patch3
.endif
ldx #$00 ldx #$00
rts rts
@ -1160,7 +1185,7 @@ LCBBD: sta SET80COL
rts rts
LCBC7: lda MODE ; all mode bits set? LCBC7: lda MODE ; all mode bits set?
cmp #$FF cmp #M_INACTIVE
beq LCBEA beq LCBEA
and #M_ESC ; escape mode? and #M_ESC ; escape mode?
beq LCBEA beq LCBEA
@ -1750,6 +1775,33 @@ LCFB7: sta RDCARDRAM
bne :- bne :-
LCFE4: jmp LCF67 LCFE4: jmp LCF67
;;; ============================================================
.if INCLUDE_PATCHES
Patch1:
lda CH
cmp XCOORD
bne :+
lda OURCH
: rts
Patch2:
sty OURCH
sty XCOORD
rts
Patch3:
stx OURCH
stx XCOORD
rts
.endif
;;; ============================================================ ;;; ============================================================
.res $D000 - *, 0 .res $D000 - *, 0
;;; ============================================================
.assert * = $D000, error, "Length changed"

View File

@ -7,6 +7,10 @@
.include "opcodes.inc" .include "opcodes.inc"
.feature string_escapes .feature string_escapes
;;; Set to 1 to include preliminary fixes for:
;;; * MouseText mode failing to exist on $18 output.
INCLUDE_PATCHES = 0
;;; Zero Page ;;; Zero Page
WNDLFT := $20 WNDLFT := $20
@ -58,6 +62,7 @@ MODE := $4FB
M_ESC = %10000000 M_ESC = %10000000
M_MOUSE = %01000000 M_MOUSE = %01000000
M_NORMAL= %00110000 M_NORMAL= %00110000
M_INACTIVE = $FF ; When firmware is inactive
OURCH := $57B OURCH := $57B
OURCV := $5FB OURCV := $5FB
@ -154,7 +159,7 @@ LC307: clc
;; XFER ;; XFER
.assert * = XFER, error, "Entry point mismatch" .assert * = XFER, error, "Entry point mismatch"
jsr extra_DoBankC5 jsr extra_DoBankC5
jmp LCC03 jmp $CC03 ; ???
;;; ============================================================ ;;; ============================================================
;;; Pascal Entry Points ;;; Pascal Entry Points
@ -178,7 +183,7 @@ JPSTAT: jsr ClearROM
JumpAuxMove: JumpAuxMove:
jsr extra_DoBankC5 jsr extra_DoBankC5
jmp LCC06 jmp $CC06
;;; ============================================================ ;;; ============================================================
;;; Main Entry Points ;;; Main Entry Points
@ -272,7 +277,7 @@ SETV: rts
brk brk
brk brk
jsr extra_DoBankC5 jsr extra_DoBankC5
jmp LCC00 jmp $CC00
LC3E2: plx LC3E2: plx
bit CLRROM bit CLRROM
@ -322,7 +327,7 @@ LC41C: jsr DoBankC5
LC420: .byte $03 LC420: .byte $03
jsr LC806 jsr LC806
bcc LC429 bcc LC429
jmp LC838 jmp $C838
LC429: jmp LC825 LC429: jmp LC825
@ -1008,7 +1013,7 @@ LC806: lda #<LC305
lda #<LC307 lda #<LC307
sta CSWL sta CSWL
stx CSWH stx CSWH
LC814: lda #$30 ; ??? LC814: lda #M_NORMAL
sta MODE sta MODE
jsr LCBD7 jsr LCBD7
jsr LCE33 jsr LCE33
@ -1023,15 +1028,15 @@ LC82B: jsr LCCB8
jsr LCCFB jsr LCCFB
cmp #$06 cmp #$06
bcc LC840 bcc LC840
.byte $29 and #$7F
LC838: bbr7 $8D,$C8B6 sta CHAR
LC83B: asl $09 ora #$80
bra $C7BF ; bad disasm? bra LC843
.byte $03
LC840: sta CHAR LC840: sta CHAR
pha LC843: pha
jsr LCBF8 jsr LCBF8
LC847: pla pla
rts rts
;;; ============================================================ ;;; ============================================================
@ -1210,10 +1215,8 @@ LC941: ldy #$00
bra @l1 bra @l1
@l2: dey @l2: dey
sty CH sty CH
.byte $8E ; bad disasm stx SAVEX
sei lda #$8D ; return
ora $A9
.byte $8D
LC95B: rts LC95B: rts
;;; ============================================================ ;;; ============================================================
@ -1253,16 +1256,14 @@ LC96F: jsr LC822
bra LC96F bra LC96F
@l4: ldy WNDWDTH @l4: ldy WNDWDTH
dey @l5: dey
cpy CH cpy CH
beq @l3 beq @l3
dey dey
.byte $20 ; bad disasm jsr LC9A8
tay
cmp #$C8
.byte $20
iny iny
dec $F180 jsr LCEC8
bra @l5
;;; ============================================================ ;;; ============================================================
@ -1339,11 +1340,13 @@ DoQuit:
jsr Do40Col jsr Do40Col
jsr DoSETVID jsr DoSETVID
jsr DoSETKBD jsr DoSETKBD
lda #$17 lda #23
ldx #$00 ldx #0
jsr LCAA1 jsr LCAA1
lda #$FF
lda #M_INACTIVE
sta MODE sta MODE
lda #$98 lda #$98
rts rts
@ -1351,19 +1354,25 @@ DoQuit:
;;; Adusting MODE Bits ;;; Adusting MODE Bits
DoCtrlCaret: DoCtrlCaret:
lda #$FC lda #$FC ; clear mode bits %xxxxxx00
jsr PreserveModeBits jsr PreserveModeBits
lda #$32 lda #$32 ; set mode bits %xx11xx1x
bra SetModeBits bra SetModeBits
DoDisableMouseText: DoDisableMouseText:
.if !INCLUDE_PATCHES
lda #M_MOUSE ; BUG! Should be ~M_MOUSE lda #M_MOUSE ; BUG! Should be ~M_MOUSE
.else
lda #.lobyte(~M_MOUSE)
.endif
PreserveModeBits: PreserveModeBits:
and MODE and MODE
bra StoreMode bra StoreMode
DoEnableMouseText: DoEnableMouseText:
lda #M_MOUSE lda #M_MOUSE
SetModeBits: SetModeBits:
ora MODE ora MODE
StoreMode: StoreMode:
@ -1646,7 +1655,7 @@ LCBD7: sta SET80COL
rts rts
LCBE1: lda MODE LCBE1: lda MODE
cmp #$FF cmp #M_INACTIVE
beq LCC04 beq LCC04
and #$80 and #$80
beq LCC04 beq LCC04
@ -1655,19 +1664,16 @@ LCBE1: lda MODE
and #$80 and #$80
eor #$AB eor #$AB
bra LCC13 bra LCC13
LCBF8: lda MODE
and #$80
beq LCC04
.byte $AD
LCC00: .byte $7B
tsb $80
LCC03: .byte $0F
LCC04: .byte $20
.byte $BB
;;; ============================================================ ;;; ============================================================
LCC06: dec $8049 LCBF8: lda MODE
and #M_ESC
beq LCC04
lda OLDCH
bra LCC13
LCC04: jsr LCEBB
eor #$80
cmp #$40 cmp #$40
bcc LCC13 bcc LCC13
cmp #$60 cmp #$60
@ -2112,3 +2118,11 @@ LCED2:
.byte "\r" .byte "\r"
.byte "\x1F" .byte "\x1F"
.byte "\r;E" .byte "\r;E"
;;; ============================================================
.res $D000 - *, 0
;;; ============================================================
.assert * = $D000, error, "Length changed"