cmp16 pseudoop

This commit is contained in:
Joshua Bell 2018-02-06 10:06:44 -08:00
parent d09aa8705d
commit 956c41c069
2 changed files with 164 additions and 326 deletions

View File

@ -1443,10 +1443,7 @@ L9AAF: lda L9C7A,x
sta L9C75 sta L9C75
lda L9C77 lda L9C77
bmi L9AF7 bmi L9AF7
lda L9C7A cmp16 L9C7A, #$230
cmp #$30
lda L9C7B
sbc #$02
bcs L9AFE bcs L9AFE
jsr L9DFA jsr L9DFA
jmp L9B0E jmp L9B0E
@ -1462,15 +1459,9 @@ L9B03: jsr L9DB8
sta L9C75 sta L9C75
L9B0E: lda L9C79 L9B0E: lda L9C79
bmi L9B31 bmi L9B31
lda L9C78 cmp16 L9C78, #$0D
cmp #$0D
lda L9C79
sbc #$00
bcc L9B31 bcc L9B31
lda L9C7C cmp16 L9C7C, #$C0
cmp #$C0
lda L9C7D
sbc #$00
bcs L9B38 bcs L9B38
jsr L9E07 jsr L9E07
jmp L9B48 jmp L9B48
@ -1898,46 +1889,25 @@ start: ldy #0
copy16 icon_ptrs,x, $06 copy16 icon_ptrs,x, $06
jsr calc_icon_poly jsr calc_icon_poly
lda poly::v0::ycoord cmp16 poly::v0::ycoord, rect::y2
cmp rect::y2
lda poly::v0::ycoord+1
sbc rect::y2+1
bpl done bpl done
lda poly::v5::ycoord cmp16 poly::v5::ycoord, rect::y1
cmp rect::y1
lda poly::v5::ycoord+1
sbc rect::y1+1
bmi done bmi done
lda poly::v5::xcoord cmp16 poly::v5::xcoord, rect::x2
cmp rect::x2
lda poly::v5::xcoord+1
sbc rect::x2+1
bpl done bpl done
lda poly::v4::xcoord cmp16 poly::v4::xcoord, rect::x1
cmp rect::x1
lda poly::v4::xcoord+1
sbc rect::x1+1
bmi done bmi done
lda poly::v7::ycoord cmp16 poly::v7::ycoord, rect::y2
cmp rect::y2
lda poly::v7::ycoord+1
sbc rect::y2+1
bmi L9F8F bmi L9F8F
lda poly::v7::xcoord cmp16 poly::v7::xcoord, rect::x2
cmp rect::x2
lda poly::v7::xcoord+1
sbc rect::x2+1
bpl done bpl done
lda poly::v2::xcoord cmp16 poly::v2::xcoord, rect::x1
cmp rect::x1
lda poly::v2::xcoord+1
sbc rect::x1+1
bpl L9F8F bpl L9F8F
done: lda #0 done: lda #0
@ -2760,10 +2730,7 @@ LA674: lda poly::v4::xcoord,x
sta setportbits_params2::cliprect::x2,x sta setportbits_params2::cliprect::x2,x
dex dex
bpl LA674 bpl LA674
lda LA62B cmp16 LA62B, #$22F
cmp #$2F
lda LA62C
sbc #$02
bmi LA69C bmi LA69C
lda #$2E lda #$2E
sta LA62B sta LA62B
@ -2960,42 +2927,24 @@ LA846: jsr pop_zp_addrs
adc LA6C4 adc LA6C4
sta LA6C4 sta LA6C4
add16 LA6C5, grafport4::viewloc::ycoord, LA6C5 add16 LA6C5, grafport4::viewloc::ycoord, LA6C5
lda setportbits_params2::cliprect::x2 cmp16 setportbits_params2::cliprect::x2, LA6C3
cmp LA6C3
lda setportbits_params2::cliprect::x2+1
sbc LA6C4
bmi LA8B7 bmi LA8B7
add16 LA6C3, #1, setportbits_params2::cliprect::x2 add16 LA6C3, #1, setportbits_params2::cliprect::x2
jmp LA8D4 jmp LA8D4
LA8B7: lda grafport4::viewloc::xcoord LA8B7: cmp16 grafport4::viewloc::xcoord, setportbits_params2::cliprect::x1
cmp setportbits_params2::cliprect::x1
lda grafport4::viewloc::xcoord+1
sbc setportbits_params2::cliprect::x1+1
bmi LA8D4 bmi LA8D4
lda grafport4::viewloc::xcoord copy16 grafport4::viewloc::xcoord, setportbits_params2::cliprect::x2
sta setportbits_params2::cliprect::x2
lda grafport4::viewloc::xcoord+1
sta setportbits_params2::cliprect::x2+1
jmp LA6FA jmp LA6FA
LA8D4: lda grafport4::viewloc::ycoord LA8D4: cmp16 grafport4::viewloc::ycoord, setportbits_params2::cliprect::y1
cmp setportbits_params2::cliprect::y1
lda grafport4::viewloc::ycoord+1
sbc setportbits_params2::cliprect::y1+1
bmi LA8F6 bmi LA8F6
lda grafport4::viewloc::ycoord copy16 grafport4::viewloc::ycoord, setportbits_params2::cliprect::y2
sta setportbits_params2::cliprect::y2
lda grafport4::viewloc::ycoord+1
sta setportbits_params2::cliprect::y2+1
lda #1 lda #1
sta L9F93 sta L9F93
jmp LA6FA jmp LA6FA
LA8F6: lda LA6C5 LA8F6: cmp16 LA6C5, setportbits_params2::cliprect::y2
cmp setportbits_params2::cliprect::y2
lda LA6C6
sbc setportbits_params2::cliprect::y2+1
bpl LA923 bpl LA923
lda LA6C5 lda LA6C5
clc clc
@ -5978,10 +5927,7 @@ L415B: sta active_window_id
lda ($06),y lda ($06),y
sbc grafport2::viewloc::ycoord+1 sbc grafport2::viewloc::ycoord+1
sta L4243 sta L4243
lda L4242 cmp16 L4242, #$0F
cmp #$0F
lda L4243
sbc #$00
bpl L41CB bpl L41CB
jsr L6E8A jsr L6E8A
ldx #$0B ldx #$0B
@ -9646,15 +9592,9 @@ L602A: lda event_params_coords,x
sta L60CF,x sta L60CF,x
dex dex
bpl L602A bpl L602A
lda event_params_xcoord cmp16 event_params_xcoord, $E234
cmp $E234
lda event_params_xcoord+1
sbc $E235
bpl L6068 bpl L6068
lda event_params_xcoord cmp16 event_params_xcoord, rect_E230
cmp rect_E230
lda event_params_xcoord+1
sbc $E231
bmi L6054 bmi L6054
bit L60D3 bit L60D3
bpl L6068 bpl L6068
@ -9666,15 +9606,9 @@ L6054: copy16 event_params_xcoord, rect_E230
L6068: copy16 event_params_xcoord, $E234 L6068: copy16 event_params_xcoord, $E234
lda #$00 lda #$00
sta L60D3 sta L60D3
L6079: lda event_params_ycoord L6079: cmp16 event_params_ycoord, $E236
cmp $E236
lda event_params_ycoord+1
sbc $E237
bpl L60AE bpl L60AE
lda event_params_ycoord cmp16 event_params_ycoord, $E232
cmp $E232
lda event_params_ycoord+1
sbc $E233
bmi L609A bmi L609A
bit L60D4 bit L60D4
bpl L60AE bpl L60AE
@ -9976,10 +9910,7 @@ L638C: jsr L650F
lda grafport2::cliprect::y1+1 lda grafport2::cliprect::y1+1
sbc #$00 sbc #$00
sta L63EB sta L63EB
lda L63EA cmp16 L63EA, L7B61
cmp L7B61
lda L63EB
sbc L7B62
bmi L63C1 bmi L63C1
ldax L63EA ldax L63EA
jmp L63C7 jmp L63C7
@ -10000,10 +9931,7 @@ L63EC: jsr L650F
jsr L644C jsr L644C
sta L6448 sta L6448
add16_8 grafport2::cliprect::y2, L6448, L644A add16_8 grafport2::cliprect::y2, L6448, L644A
lda L644A cmp16 L644A, L7B65
cmp L7B65
lda L644B
sbc L7B66
bpl L6421 bpl L6421
ldax L644A ldax L644A
jmp L6427 jmp L6427
@ -10033,10 +9961,7 @@ L644C: tya
L6451: jsr L650F L6451: jsr L650F
stax L64AC stax L64AC
sub16 grafport2::cliprect::x1, L64AC, L64AE sub16 grafport2::cliprect::x1, L64AC, L64AE
lda L64AE cmp16 L64AE, L7B5F
cmp L7B5F
lda L64AF
sbc L7B60
bmi L6484 bmi L6484
ldax L64AE ldax L64AE
jmp L648A jmp L648A
@ -10055,10 +9980,7 @@ L64AF: .byte 0
L64B0: jsr L650F L64B0: jsr L650F
stax L650B stax L650B
add16 grafport2::cliprect::x2, L650B, L650D add16 grafport2::cliprect::x2, L650B, L650D
lda L650D cmp16 L650D, L7B63
cmp L7B63
lda L650E
sbc L7B64
bpl L64E3 bpl L64E3
ldax L650D ldax L650D
jmp L64E9 jmp L64E9
@ -10134,10 +10056,7 @@ L656D: lda active_window_id
bpl L65D0 bpl L65D0
lda #$00 lda #$00
beq L65EB beq L65EB
L65D0: lda grafport2::cliprect::x2 L65D0: cmp16 grafport2::cliprect::x2, L7B63
cmp L7B63
lda grafport2::cliprect::x2+1
sbc L7B64
bmi L65E2 bmi L65E2
tya tya
jmp L65EE jmp L65EE
@ -10181,10 +10100,7 @@ L6604: lda active_window_id
bpl L6669 bpl L6669
lda #$00 lda #$00
beq L668A beq L668A
L6669: lda grafport2::cliprect::y2 L6669: cmp16 grafport2::cliprect::y2, L7B65
cmp L7B65
lda grafport2::cliprect::y2+1
sbc L7B66
bmi L667B bmi L667B
tya tya
jmp L668D jmp L668D
@ -10488,15 +10404,9 @@ L6994: lda event_params_coords,x
sta L6A39,x sta L6A39,x
dex dex
bpl L6994 bpl L6994
lda event_params_xcoord cmp16 event_params_xcoord, $E234
cmp $E234
lda event_params_xcoord+1
sbc $E235
bpl L69D2 bpl L69D2
lda event_params_xcoord cmp16 event_params_xcoord, rect_E230
cmp rect_E230
lda event_params_xcoord+1
sbc $E231
bmi L69BE bmi L69BE
bit L6A3D bit L6A3D
bpl L69D2 bpl L69D2
@ -10508,15 +10418,9 @@ L69BE: copy16 event_params_xcoord, rect_E230
L69D2: copy16 event_params_xcoord, $E234 L69D2: copy16 event_params_xcoord, $E234
lda #$00 lda #$00
sta L6A3D sta L6A3D
L69E3: lda event_params_ycoord L69E3: cmp16 event_params_ycoord, $E236
cmp $E236
lda event_params_ycoord+1
sbc $E237
bpl L6A18 bpl L6A18
lda event_params_ycoord cmp16 event_params_ycoord, $E232
cmp $E232
lda event_params_ycoord+1
sbc $E233
bmi L6A04 bmi L6A04
bit L6A3E bit L6A3E
bpl L6A18 bpl L6A18
@ -10914,15 +10818,9 @@ L6DC0: jsr L6E52
L6DC9: lda active_window_id L6DC9: lda active_window_id
sta getwinport_params2::window_id sta getwinport_params2::window_id
jsr L44F2 jsr L44F2
lda L7B5F cmp16 L7B5F, grafport2::cliprect::x1
cmp grafport2::cliprect::x1
lda L7B60
sbc grafport2::cliprect::x1+1
bmi L6DFE bmi L6DFE
lda grafport2::cliprect::x2 cmp16 grafport2::cliprect::x2, L7B63
cmp L7B63
lda grafport2::cliprect::x2+1
sbc L7B64
bmi L6DFE bmi L6DFE
lda #$02 lda #$02
sta event_params sta event_params
@ -10937,15 +10835,9 @@ L6DFE: lda #$02
sta event_params+1 sta event_params+1
jsr L6E48 jsr L6E48
jsr L656D jsr L656D
L6E0E: lda L7B61 L6E0E: cmp16 L7B61, grafport2::cliprect::y1
cmp grafport2::cliprect::y1
lda L7B62
sbc grafport2::cliprect::y1+1
bmi L6E38 bmi L6E38
lda grafport2::cliprect::y2 cmp16 grafport2::cliprect::y2, L7B65
cmp L7B65
lda grafport2::cliprect::y2+1
sbc L7B66
bmi L6E38 bmi L6E38
lda #$01 lda #$01
sta event_params sta event_params
@ -11270,10 +11162,7 @@ L710A: lsr L72A9
lda L72A9 lda L72A9
sbc #$00 sbc #$00
sta L72A9 sta L72A9
lda L72A8 cmp16 L72A8, L70C1
cmp L70C1
lda L72A9
sbc L70C2
bcs L7169 bcs L7169
L7147: lda $EC2E L7147: lda $EC2E
jsr L8B19 jsr L8B19
@ -11889,15 +11778,9 @@ L76C4: jsr L7B6B
lda L7B66 lda L7B66
sbc #$00 sbc #$00
sta L7B66 sta L7B66
lda L7B63 cmp16 L7B63, #$AA
cmp #$AA
lda L7B64
sbc #$00
bmi L7705 bmi L7705
lda L7B63 cmp16 L7B63, #$1C2
cmp #$C2
lda L7B64
sbc #$01
bpl L770C bpl L770C
ldax L7B63 ldax L7B63
jmp L7710 jmp L7710
@ -11913,15 +11796,9 @@ L7710: ldy #$20
txa txa
iny iny
sta ($06),y sta ($06),y
lda L7B65 cmp16 L7B65, #$32
cmp #$32
lda L7B66
sbc #$00
bmi L7739 bmi L7739
lda L7B65 cmp16 L7B65, #$6C
cmp #$6C
lda L7B66
sbc #$00
bpl L7740 bpl L7740
ldax L7B65 ldax L7B65
jmp L7744 jmp L7744
@ -12242,10 +12119,7 @@ L7AEA: sta str_6_spaces,x
ldx #$00 ldx #$00
L7AF9: lda #$00 L7AF9: lda #$00
sta L7B5D sta L7B5D
L7AFE: lda L7B5B L7AFE: cmp16 L7B5B, L7B53,x
cmp L7B53,x
lda L7B5C
sbc L7B54,x
bpl L7B31 bpl L7B31
lda L7B5D lda L7B5D
bne L7B1A bne L7B1A
@ -12399,15 +12273,9 @@ L7C56: lda ($06),y
bmi L7C88 bmi L7C88
bit L7B68 bit L7B68
bmi L7CCE bmi L7CCE
lda L7B67 cmp16 L7B67, L7B5F
cmp L7B5F
lda L7B68
sbc L7B60
bmi L7CCE bmi L7CCE
lda L7B67 cmp16 L7B67, L7B63
cmp L7B63
lda L7B68
sbc L7B64
bpl L7CBF bpl L7CBF
jmp L7CDA jmp L7CDA
@ -12415,46 +12283,25 @@ L7C88: bit L7B68
bmi L7CA3 bmi L7CA3
bit L7B64 bit L7B64
bmi L7CDA bmi L7CDA
lda L7B67 cmp16 L7B67, L7B63
cmp L7B63
lda L7B68
sbc L7B64
bmi L7CDA bmi L7CDA
jmp L7CBF jmp L7CBF
L7CA3: lda L7B67 L7CA3: cmp16 L7B67, L7B5F
cmp L7B5F
lda L7B68
sbc L7B60
bmi L7CCE bmi L7CCE
lda L7B67 cmp16 L7B67, L7B63
cmp L7B63
lda L7B68
sbc L7B64
bmi L7CDA bmi L7CDA
L7CBF: lda L7B67 L7CBF: copy16 L7B67, L7B63
sta L7B63
lda L7B68
sta L7B64
jmp L7CDA jmp L7CDA
L7CCE: lda L7B67 L7CCE: copy16 L7B67, L7B5F
sta L7B5F
lda L7B68
sta L7B60
L7CDA: bit L7B62 L7CDA: bit L7B62
bmi L7D03 bmi L7D03
bit L7B6A bit L7B6A
bmi L7D49 bmi L7D49
lda L7B69 cmp16 L7B69, L7B61
cmp L7B61
lda L7B6A
sbc L7B62
bmi L7D49 bmi L7D49
lda L7B69 cmp16 L7B69, L7B65
cmp L7B65
lda L7B6A
sbc L7B66
bpl L7D3A bpl L7D3A
jmp L7D55 jmp L7D55
@ -12462,33 +12309,18 @@ L7D03: bit L7B6A
bmi L7D1E bmi L7D1E
bit L7B66 bit L7B66
bmi L7D55 bmi L7D55
lda L7B69 cmp16 L7B69, L7B65
cmp L7B65
lda L7B6A
sbc L7B66
bmi L7D55 bmi L7D55
jmp L7D3A jmp L7D3A
L7D1E: lda L7B69 L7D1E: cmp16 L7B69, L7B61
cmp L7B61
lda L7B6A
sbc L7B62
bmi L7D49 bmi L7D49
lda L7B69 cmp16 L7B69, L7B65
cmp L7B65
lda L7B6A
sbc L7B66
bmi L7D55 bmi L7D55
L7D3A: lda L7B69 L7D3A: copy16 L7B69, L7B65
sta L7B65
lda L7B6A
sta L7B66
jmp L7D55 jmp L7D55
L7D49: lda L7B69 L7D49: copy16 L7B69, L7B61
sta L7B61
lda L7B6A
sta L7B62
L7D55: inc L7D5B L7D55: inc L7D5B
jmp L7BEF jmp L7BEF
@ -12993,10 +12825,7 @@ L81AC: lda pointC::ycoord
sta pointC::ycoord sta pointC::ycoord
bcc L81BB bcc L81BB
inc pointC::ycoord+1 inc pointC::ycoord+1
L81BB: lda point9::ycoord L81BB: cmp16 point9::ycoord, grafport2::cliprect::y2
cmp grafport2::cliprect::y2
lda point9::ycoord+1
sbc grafport2::cliprect::y2+1
bmi L81D9 bmi L81D9
lda point9::ycoord lda point9::ycoord
clc clc
@ -13012,10 +12841,7 @@ L81D9: lda point9::ycoord
sta point9::ycoord sta point9::ycoord
bcc L81E8 bcc L81E8
inc point9::ycoord+1 inc point9::ycoord+1
L81E8: lda point9::ycoord L81E8: cmp16 point9::ycoord, grafport2::cliprect::y1
cmp grafport2::cliprect::y1
lda point9::ycoord+1
sbc grafport2::cliprect::y1+1
bpl L81F7 bpl L81F7
rts rts
@ -13077,10 +12903,7 @@ L827A: sta text_buffer2::data-1,x
ldx #$00 ldx #$00
L828C: lda #$00 L828C: lda #$00
sta L8274 sta L8274
L8291: lda L8272 L8291: cmp16 L8272, L826A,x
cmp L826A,x
lda L8273
sbc L826B,x
bpl L82C3 bpl L82C3
lda L8274 lda L8274
bne L82AD bne L82AD
@ -16117,10 +15940,7 @@ L9BC9: yax_call JT_MLI_RELAY, GET_FILE_INFO, file_info_params3
jmp L9BC9 jmp L9BC9
L9BDA: sub16 file_info_params3::aux_type, file_info_params3::blocks_used, L9BFF L9BDA: sub16 file_info_params3::aux_type, file_info_params3::blocks_used, L9BFF
lda L9BFF cmp16 L9BFF, LA2EF
cmp LA2EF
lda L9C00
sbc LA2F0
bcs L9BFE bcs L9BFE
jmp L9185 jmp L9185
@ -16186,10 +16006,7 @@ L9C70: yax_call JT_MLI_RELAY, GET_FILE_INFO, file_info_params3
L9C95: sub16 file_info_params3::aux_type, file_info_params3::blocks_used, L9CD4 L9C95: sub16 file_info_params3::aux_type, file_info_params3::blocks_used, L9CD4
add16 L9CD4, L9CD8, L9CD4 add16 L9CD4, L9CD8, L9CD4
lda L9CD4 cmp16 L9CD4, file_info_params2::blocks_used
cmp file_info_params2::blocks_used
lda L9CD5
sbc file_info_params2::blocks_used+1
bcs L9CCC bcs L9CCC
sec sec
bcs L9CCD bcs L9CCD
@ -19062,10 +18879,7 @@ LB9B8: MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params
LB9D8: jsr LBD3B LB9D8: jsr LBD3B
stax $06 stax $06
lda $D20D cmp16 $D20D, $06
cmp $06
lda $D20E
sbc $06+1
bcs LB9EE bcs LB9EE
jmp LBA83 jmp LBA83
@ -19083,10 +18897,7 @@ LB9D8: jsr LBD3B
sta ptr+2 sta ptr+2
LBA10: MGTK_RELAY_CALL MGTK::TextWidth, ptr LBA10: MGTK_RELAY_CALL MGTK::TextWidth, ptr
add16 $09, LBB09, $09 add16 $09, LBB09, $09
lda $09 cmp16 $09, $D20D
cmp $D20D
lda $0A
sbc $D20E
bcc LBA42 bcc LBA42
dec $08 dec $08
lda $08 lda $08
@ -19141,10 +18952,7 @@ LBA7C: dey
sta textlen sta textlen
: MGTK_RELAY_CALL MGTK::TextWidth, params : MGTK_RELAY_CALL MGTK::TextWidth, params
add16 result, point6::xcoord, result add16 result, point6::xcoord, result
lda result cmp16 result, $D20D
cmp $D20D
lda result+1
sbc $D20E
bcc LBABF bcc LBABF
dec textlen dec textlen
lda textlen lda textlen
@ -19527,10 +19335,7 @@ LBDDF: lda LD909
ldx #$00 ldx #$00
LBDFE: lda #$00 LBDFE: lda #$00
sta LBE61 sta LBE61
LBE03: lda LBE5F LBE03: cmp16 LBE5F, LBE57,x
cmp LBE57,x
lda LBE5F+1
sbc LBE57+1,x
bpl LBE35 bpl LBE35
lda LBE61 lda LBE61
bne LBE1F bne LBE1F

View File

@ -171,3 +171,36 @@
sta arg2+1 sta arg2+1
.endif .endif
.endmacro .endmacro
.macro cmp16 arg1, arg2, arg3
.if (.match ({arg2}, x) .or .match ({arg2}, y))
;; indexed variant (arg2 is x or y)
lda arg1,arg2
cmp arg3
lda arg1+1,arg2
sbc arg3+1
.elseif (.match ({arg3}, x) .or .match ({arg3}, y))
;; indexed variant (arg3 is x or y)
lda arg1
cmp arg2,arg3
lda arg1+1
sbc arg2+1,arg3
.elseif (.match (.mid (0, 1, {arg1}), #))
;; immediate variant (arg1 is #nnnn)
lda #<(.right (.tcount ({arg1})-1, {arg1}))
cmp arg2
lda #>(.right (.tcount ({arg1})-1, {arg1}))
sbc arg2+1
.elseif (.match (.mid (0, 1, {arg2}), #))
;; immediate variant (arg2 is #nnnn)
lda arg1
cmp #<(.right (.tcount ({arg2})-1, {arg2}))
lda arg1+1
sbc #>(.right (.tcount ({arg2})-1, {arg2}))
.else
lda arg1
cmp arg2
lda arg1+1
sbc arg2+1
.endif
.endmacro