2021-06-21 15:57:02 +00:00
|
|
|
; utility functions for common cases
|
|
|
|
; (from the caller's perspective, these have the side effect of setting Y,
|
|
|
|
; since the modify routine will 'save' and 'restore' the value we're setting here)
|
|
|
|
modify3
|
|
|
|
ldy #$03
|
|
|
|
!byte $2C
|
|
|
|
; /!\ execution falls through here
|
|
|
|
modify2
|
|
|
|
ldy #$02
|
|
|
|
!byte $2C
|
|
|
|
; /!\ execution falls through here
|
2021-06-21 14:33:16 +00:00
|
|
|
modify1
|
|
|
|
ldy #$01
|
|
|
|
; /!\ execution falls through here
|
2017-01-08 03:35:35 +00:00
|
|
|
;-------------------------------
|
|
|
|
; modify subroutine
|
|
|
|
; in: A = starting address (high byte)
|
|
|
|
; X = starting address (low byte)
|
|
|
|
; Y = string length
|
|
|
|
; stack = string to set
|
|
|
|
; out $BASEPAGE buffer changed
|
|
|
|
; $gPatchCount++
|
|
|
|
; $modsrc zero page clobbered
|
|
|
|
; $moddest zero page clobbered
|
|
|
|
; stack set to return to
|
|
|
|
; code after string
|
2021-06-12 04:50:09 +00:00
|
|
|
; A,X,Y preserved
|
2017-12-26 23:28:56 +00:00
|
|
|
; oVerflow bit clear
|
|
|
|
; all other flags clobbered
|
2017-01-08 03:35:35 +00:00
|
|
|
;-------------------------------
|
|
|
|
modify
|
2021-06-12 04:50:09 +00:00
|
|
|
sty mod_tmp_y
|
2017-01-08 03:35:35 +00:00
|
|
|
sta gDisplayBytes
|
|
|
|
clc
|
|
|
|
adc #BASEPAGE
|
|
|
|
sta moddest+1
|
|
|
|
stx moddest
|
|
|
|
stx gDisplayBytes+1
|
|
|
|
pla
|
|
|
|
sta modsrc
|
|
|
|
pla
|
|
|
|
sta modsrc+1
|
|
|
|
tax
|
|
|
|
tya
|
|
|
|
clc
|
|
|
|
adc modsrc
|
2021-04-20 04:27:11 +00:00
|
|
|
bcc +
|
2017-01-08 03:35:35 +00:00
|
|
|
inx
|
2021-04-20 04:27:11 +00:00
|
|
|
+ sta tmp
|
2017-01-08 03:35:35 +00:00
|
|
|
txa
|
|
|
|
pha
|
|
|
|
lda tmp
|
|
|
|
pha
|
|
|
|
sty modtmp
|
|
|
|
bit gMode
|
2021-06-13 02:07:26 +00:00
|
|
|
bpl @exitnomod ; verify mode -> no modify
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr PrintByID
|
2021-06-13 02:07:26 +00:00
|
|
|
!byte s_modify
|
2017-01-08 03:35:35 +00:00
|
|
|
ldy #0
|
2021-04-20 04:27:11 +00:00
|
|
|
- lda (moddest), y
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr PrintByte
|
|
|
|
iny
|
|
|
|
cpy modtmp
|
2021-04-20 04:27:11 +00:00
|
|
|
bne -
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr PrintByID
|
2021-06-13 02:07:26 +00:00
|
|
|
!byte s_modifyto
|
2017-01-08 03:35:35 +00:00
|
|
|
ldy #0
|
2021-04-20 04:27:11 +00:00
|
|
|
- iny
|
|
|
|
lda (modsrc), y
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr PrintByte
|
|
|
|
cpy modtmp
|
2021-04-20 04:27:11 +00:00
|
|
|
bne -
|
2017-01-08 03:35:35 +00:00
|
|
|
lda #$8D
|
|
|
|
jsr PrintA
|
2017-11-09 05:47:12 +00:00
|
|
|
bvc +
|
2021-04-20 04:27:11 +00:00
|
|
|
- sta (moddest), y
|
|
|
|
+ lda (modsrc), y
|
2017-11-09 05:47:12 +00:00
|
|
|
dey
|
2021-04-20 04:27:11 +00:00
|
|
|
bpl -
|
|
|
|
@exit
|
2017-01-08 03:35:35 +00:00
|
|
|
inc gPatchCount
|
2021-04-20 04:27:11 +00:00
|
|
|
@exitnomod
|
2018-01-12 15:47:25 +00:00
|
|
|
lda gDisplayBytes
|
|
|
|
ldx moddest
|
2021-06-12 04:50:09 +00:00
|
|
|
mod_tmp_y=*+1
|
|
|
|
ldy #$FD ; SMC
|
2017-12-26 23:28:56 +00:00
|
|
|
clv
|
2017-01-08 03:35:35 +00:00
|
|
|
rts
|