passport/src/modify.a

73 lines
1.6 KiB
Plaintext
Raw Normal View History

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
2018-01-12 15:47:25 +00:00
; A,X preserved
; Y clobbered
; oVerflow bit clear
; all other flags clobbered
2017-01-08 03:35:35 +00:00
;-------------------------------
modify
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-04-20 04:27:11 +00:00
bpl @exitnomod ; verify mode -> no modify
2017-01-08 03:35:35 +00:00
lda #s_modify
jsr PrintByID
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
lda #s_modifyto
jsr PrintByID
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
bvc +
2021-04-20 04:27:11 +00:00
- sta (moddest), y
+ lda (modsrc), y
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
clv
2017-01-08 03:35:35 +00:00
rts