This commit is contained in:
Joshua Bell 2018-02-25 13:47:06 -08:00
parent b7476c6b81
commit 7c0e47922a
7 changed files with 84 additions and 102 deletions

View File

@ -120,7 +120,7 @@ start: lda #$80
php
sei
sta ALTZPOFF
lda $C082
lda ROMIN2
jsr MLI
call: .byte 0
params: .addr 0

View File

@ -111,13 +111,12 @@ L0902: jsr prompt_input_loop
L090C: lda $D57D
jsr set_port_from_window_id
L0912: MGTK_RELAY_CALL MGTK::SetPenMode, $D200
MGTK_RELAY_CALL MGTK::SetPenMode, $D200
ldy #$11
L091D: ldax #$AE6E
ldax #$AE6E
jsr MGTK_RELAY
L0924: ldax #$B2C6
ldax #$B2C6
ldy #$01
L092B := * + 1
jsr draw_dialog_label
lda L09D7
jsr L12C1
@ -125,24 +124,19 @@ L092B := * + 1
bne L0942
jsr set_cursor_watch
lda L09D7
L093F := * + 2
jsr L126F
bcs L099B
L0942: lda $D57D
jsr set_port_from_window_id
ldy #$07
lda #$00
L094D := * + 1
ldx #$D2
L0950 := * + 2
jsr MGTK_RELAY
MGTK_RELAY_CALL MGTK::PaintRect, $AE6E
axy_call draw_dialog_label, $01, $B373
addr_call L1900, $D443
ldx #$43
L096D := * + 1
ldy #$D4
L096F := * + 1
lda L09D7
jsr L1307
pha
@ -160,7 +154,6 @@ L0980: cmp #$2B
L098C: jsr L191B
ldax #$B388
L0994 := * + 1
ldy #$06
jsr draw_dialog_label
jmp L09B8
@ -177,7 +170,6 @@ L099B: pha
L09AC: jsr L191B
axy_call draw_dialog_label, $06, $B2DE
L09B8: jsr prompt_input_loop
L09BC := * + 1
bmi L09B8
bne L09C2
jmp L090C
@ -199,7 +191,7 @@ L09D9: lda #$00
jsr set_port_from_window_id
addr_call draw_dialog_title, $B319
ldax #$B32A
L09F2: ldy #$01
ldy #$01
jsr draw_dialog_label
jsr L0D31
lda #$FF
@ -241,7 +233,7 @@ L0A74: jsr bell
L0A7A: lda $D443
beq L0A74
L0A7F: cmp #$10
cmp #$10
bcs L0A74
jsr set_cursor_pointer
lda $D57D
@ -372,9 +364,8 @@ L0BE6: MGTK_RELAY_CALL MGTK::SetPenMode, $D202
MGTK_RELAY_CALL MGTK::PaintRect, $AE20
ldy #$11
ldax #$AE20
L0C00 := * + 2
jsr MGTK_RELAY
L0C01: lda #$00
lda #$00
L0C03: rts
L0C04: sta L0C1E
@ -391,7 +382,6 @@ L0C0F: lda L0C1E
L0C1E: .byte 0
L0C1F: .byte 0
L0C20: ldy #$27
L0C23 := * + 1
sty $D888
ldy #$00
sty $D889
@ -469,7 +459,6 @@ L0CF6: return #$FF
lda $D887
clc
adc #$01
L0D00 := * + 1
cmp $D890
bcc L0D06
lda #$00
@ -1611,7 +1600,7 @@ L1917: dey
rts
L191B: sta ALTZPOFF
lda $C082
lda ROMIN2
jsr BELL1
sta ALTZPON
lda LCBANK1

View File

@ -592,7 +592,7 @@ L953F: MGTK_RELAY_CALL MGTK::GetEvent, $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D6F8
cmp #$80
cmp #MGTK::inrect_inside
beq L957C
lda L95BF
beq L9584
@ -630,7 +630,7 @@ L95C5: MGTK_RELAY_CALL MGTK::GetEvent, $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D700
cmp #$80
cmp #MGTK::inrect_inside
beq L9602
lda L9645
beq L960A
@ -688,7 +688,7 @@ L9683: lda $D665
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D6F8
cmp #$80
cmp #MGTK::inrect_inside
bne L96C8
MGTK_RELAY_CALL MGTK::SetPenMode, $D202
MGTK_RELAY_CALL MGTK::PaintRect, $D6F8
@ -698,7 +698,7 @@ L9683: lda $D665
L96C7: rts
L96C8: MGTK_RELAY_CALL MGTK::InRect, $D700
cmp #$80
cmp #MGTK::inrect_inside
bne L96EF
MGTK_RELAY_CALL MGTK::SetPenMode, $D202
MGTK_RELAY_CALL MGTK::PaintRect, $D700
@ -1524,11 +1524,10 @@ L9DC9: sty L9DDD
php
sei
sta ALTZPOFF
sta $C082
sta ROMIN2
jsr MLI
L9DDD: .byte 0
L9DDE: .byte 0
L9DDF: .byte 0
L9DDE: .addr 0
sta ALTZPON
tax
lda LCBANK1
@ -1555,8 +1554,7 @@ L9E05: stax L9E1B
ldx $D3EE
L9E17: lda $D3EE,x
.byte $9D
L9E1B: .byte $34
L9E1C: .byte $12
L9E1B: .addr $1234
dex
bpl L9E17
sta ALTZPON
@ -1571,8 +1569,7 @@ L9E2A: stax L9E40
ldx $D3AD
L9E3C: lda $D3AD,x
.byte $9D
L9E40: .byte $34
L9E41: .byte $12
L9E40: .addr $1234
dex
bpl L9E3C
sta ALTZPON
@ -1581,8 +1578,7 @@ L9E41: .byte $12
rts
asl a
L9E50: .byte 0
L9E51: .byte 0
L9E50: .word 0
.byte 0
.byte 0
.byte 0

View File

@ -123,11 +123,11 @@ L5151: lda $D5B7
bit L51AE
bmi L5183
MGTK_RELAY_CALL MGTK::InRect, $DA9E
cmp #$80
cmp #MGTK::inrect_inside
bne L5196
beq L5190
L5183: MGTK_RELAY_CALL MGTK::InRect, $DAAA
cmp #$80
cmp #MGTK::inrect_inside
bne L5196
L5190: jsr L55E0
jmp L5199
@ -163,7 +163,7 @@ L51D2: lda $D5B7
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D9E0
cmp #$80
cmp #MGTK::inrect_inside
beq L5200
jmp L5239
@ -188,7 +188,7 @@ L5216: lda $D5B7
jmp L5308
L5239: MGTK_RELAY_CALL MGTK::InRect, $D9F0
cmp #$80
cmp #MGTK::inrect_inside
beq L5249
jmp L526B
@ -202,7 +202,7 @@ L5249: bit L5105
L5268: jmp L5308
L526B: MGTK_RELAY_CALL MGTK::InRect, $D9D0
cmp #$80
cmp #MGTK::inrect_inside
beq L527B
jmp L529D
@ -216,7 +216,7 @@ L527B: bit L5105
L529A: jmp L5308
L529D: MGTK_RELAY_CALL MGTK::InRect, $D9D8
cmp #$80
cmp #MGTK::inrect_inside
beq L52AD
jmp L52CD
@ -229,7 +229,7 @@ L52AD: MGTK_RELAY_CALL MGTK::SetPenMode, $D202
L52CA: jmp L5308
L52CD: MGTK_RELAY_CALL MGTK::InRect, $D9E8
cmp #$80
cmp #MGTK::inrect_inside
beq L52DD
jmp L52FA
@ -271,13 +271,7 @@ L5340: rts
L5341: lda $D5F1
sta $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
lda $D20F
clc
adc $D60F
sta $D20F
lda $D210
adc $D610
sta $D210
add16 $D20F, $D60F, $D20F
lsr16 $D20F
lsr16 $D20F
lsr16 $D20F
@ -633,14 +627,14 @@ L56F6: lda #$00
sta L577B
L56FB: MGTK_RELAY_CALL MGTK::GetEvent, $D208
lda $D208
cmp #$02
cmp #MGTK::event_kind_button_up
beq L575E
lda $D5B7
sta $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D9D8
cmp #$80
cmp #MGTK::inrect_inside
beq L5738
lda L577B
beq L5740
@ -671,14 +665,14 @@ L577C: lda #$00
sta L5801
L5781: MGTK_RELAY_CALL MGTK::GetEvent, $D208
lda $D208
cmp #$02
cmp #MGTK::event_kind_button_up
beq L57E4
lda $D5B7
sta $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D9D0
cmp #$80
cmp #MGTK::inrect_inside
beq L57BE
lda L5801
beq L57C6
@ -709,14 +703,14 @@ L5802: lda #$00
sta L5887
L5807: MGTK_RELAY_CALL MGTK::GetEvent, $D208
lda $D208
cmp #$02
cmp #MGTK::event_kind_button_up
beq L586A
lda $D5B7
sta $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D9E8
cmp #$80
cmp #MGTK::inrect_inside
beq L5844
lda L5887
beq L584C
@ -747,14 +741,14 @@ L5888: lda #$00
sta L590D
L588D: MGTK_RELAY_CALL MGTK::GetEvent, $D208
lda $D208
cmp #$02
cmp #MGTK::event_kind_button_up
beq L58F0
lda $D5B7
sta $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D9E0
cmp #$80
cmp #MGTK::inrect_inside
beq L58CA
lda L590D
beq L58D2
@ -785,14 +779,14 @@ L590E: lda #$00
sta L5993
L5913: MGTK_RELAY_CALL MGTK::GetEvent, $D208
lda $D208
cmp #$02
cmp #MGTK::event_kind_button_up
beq L5976
lda $D5B7
sta $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $D9F0
cmp #$80
cmp #MGTK::inrect_inside
beq L5950
lda L5993
beq L5958
@ -827,8 +821,7 @@ L5994: sty L59A8
lda ROMIN2
jsr MLI
L59A8: .byte 0
L59A9: .byte 0
L59AA: .byte 0
L59A9: .addr 0
sta ALTZPON
tax
lda LCBANK1
@ -2083,12 +2076,12 @@ L66C9: addr_call L5DED, $D484
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $DA9E
cmp #$80
cmp #MGTK::inrect_inside
beq L6719
bit L5104
bpl L6718
MGTK_RELAY_CALL MGTK::InRect, $DAAA
cmp #$80
cmp #MGTK::inrect_inside
bne L6718
jmp L6D1E
@ -2115,13 +2108,7 @@ L672F: jsr L6E45
lda $D484
sta $08
L6751: MGTK_RELAY_CALL MGTK::TextWidth, $0006
lda $09
clc
adc L684D
sta $09
lda $0A
adc L684E
sta $0A
add16 $09, L684D, $09
lda $09
cmp $D20D
lda $0A
@ -2171,13 +2158,7 @@ L67C4: copy16 #$D402, $06
lda $D402
sta $08
L67D1: MGTK_RELAY_CALL MGTK::TextWidth, $0006
lda $09
clc
adc $DAA6
sta $09
lda $0A
adc $DAA7
sta $0A
add16 $09, $DAA6, $09
lda $09
cmp $D20D
lda $0A
@ -2225,8 +2206,7 @@ L6846: jsr L6D27
jsr L6EA3
rts
L684D: .byte 0
L684E: .byte 0
L684D: .word 0
lda $D5B7
sta $D208
MGTK_RELAY_CALL MGTK::ScreenToWindow, $D208
@ -2234,12 +2214,12 @@ L684E: .byte 0
jsr L62C8
MGTK_RELAY_CALL MGTK::MoveTo, $D20D
MGTK_RELAY_CALL MGTK::InRect, $DAAA
cmp #$80
cmp #MGTK::inrect_inside
beq L6890
bit L5104
bpl L688F
MGTK_RELAY_CALL MGTK::InRect, $DA9E
cmp #$80
cmp #MGTK::inrect_inside
bne L688F
jmp L6D21
@ -2266,13 +2246,7 @@ L68A6: jsr L6E72
lda $D484
sta $08
L68C8: MGTK_RELAY_CALL MGTK::TextWidth, $0006
lda $09
clc
adc L69C4
sta $09
lda $0A
adc L69C5
sta $0A
add16 $09, L69C4, $09
lda $09
cmp $D20D
lda $0A
@ -2322,13 +2296,7 @@ L693B: copy16 #$D443, $06
lda $D443
sta $08
L6948: MGTK_RELAY_CALL MGTK::TextWidth, $0006
lda $09
clc
adc $DAB2
sta $09
lda $0A
adc $DAB3
sta $0A
add16 $09, $DAB2, $09
lda $09
cmp $D20D
lda $0A
@ -2376,8 +2344,7 @@ L69BD: jsr L6D27
jsr L6E9F
rts
L69C4: .byte 0
L69C5: .byte 0
L69C4: .word 0
sta L6A17
lda $D402
clc

View File

@ -219,8 +219,7 @@ L7198: addr_call L647C, path_buf1
lda #0
sta $D8EC
jsr L55BA
L71C0: copy16 #path_buf0, $6
copy16 #path_buf0, $6
copy16 #path_buf1, $8
ldx $50AA
txs
@ -244,7 +243,7 @@ L71D8: MGTK_RELAY_CALL MGTK::CloseWindow, winfo15
L71F9: lda #1
sta path_buf2
lda #' '
L7200: sta $D485
sta $D485
jsr L6D27
ldx L709B
L7209: lda L709B+1,x

View File

@ -334,27 +334,27 @@ L73A9: .byte 0
L73AA: .byte 0
MGTK_RELAY_CALL MGTK::InRect, $D966
cmp #$80
cmp #MGTK::inrect_inside
bne L73BB
jmp L73FE
L73BB: MGTK_RELAY_CALL MGTK::InRect, $D96E
cmp #$80
cmp #MGTK::inrect_inside
bne L73CB
jmp L7413
L73CB: MGTK_RELAY_CALL MGTK::InRect, $D976
cmp #$80
cmp #MGTK::inrect_inside
bne L73DB
jmp L7428
L73DB: MGTK_RELAY_CALL MGTK::InRect, $D97E
cmp #$80
cmp #MGTK::inrect_inside
bne L73EB
jmp L743D
L73EB: MGTK_RELAY_CALL MGTK::InRect, $D986
cmp #$80
cmp #MGTK::inrect_inside
bne L73FB
jmp L7452

View File

@ -154,6 +154,32 @@ $text =~ s/
(hex(substr($3,1)) + 1 == hex(substr($6,1)))
? "add16 $1, #\$$5$2, $3" : $&/egx;
$text =~ s/
\b lda \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ clc \n
\s+ adc \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sta \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ lda \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ adc \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sta \s+ ([L\$][0-9A-F]{2,4}) \b
/(hex(substr($1,1)) + 1 == hex(substr($4,1))) &&
(hex(substr($2,1)) + 1 == hex(substr($5,1))) &&
(hex(substr($3,1)) + 1 == hex(substr($6,1)))
? "add16 $1, $2, $3" : $&/egx;
$text =~ s/
\b lda \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sec \n
\s+ sbc \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sta \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ lda \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sbc \s+ ([L\$][0-9A-F]{2,4}) \n
\s+ sta \s+ ([L\$][0-9A-F]{2,4}) \b
/(hex(substr($1,1)) + 1 == hex(substr($4,1))) &&
(hex(substr($2,1)) + 1 == hex(substr($5,1))) &&
(hex(substr($3,1)) + 1 == hex(substr($6,1)))
? "sub16 $1, $2, $3" : $&/egx;
$text =~ s/
\b lda \s+ ( (?: [L\$][0-9A-F]{2,4} ) | (?: \#\$[0-9A-F]{2} ) ) \n
\s+ rts \b
@ -163,4 +189,9 @@ $text =~ s/
\b brk \b
/.byte 0/gx;
$text =~ s/
\b ( MGTK_RELAY_CALL \s+ MGTK::InRect, .* \n
\s+ ) cmp \s+ \#\$80 \b
/$1cmp #MGTK::inrect_inside/gx;
print $text;