; 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 modify1 ldy #$01 ; /!\ execution falls through here ;------------------------------- ; 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 ; A,X,Y preserved ; oVerflow bit clear ; all other flags clobbered ;------------------------------- modify sty mod_tmp_y 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 bcc + inx + sta tmp txa pha lda tmp pha sty modtmp bit gMode bpl @exitnomod ; verify mode -> no modify jsr PrintByID !byte s_modify ldy #0 - lda (moddest), y jsr PrintByte iny cpy modtmp bne - jsr PrintByID !byte s_modifyto ldy #0 - iny lda (modsrc), y jsr PrintByte cpy modtmp bne - lda #$8D jsr PrintA bvc + - sta (moddest), y + lda (modsrc), y dey bpl - @exit inc gPatchCount @exitnomod lda gDisplayBytes ldx moddest mod_tmp_y=*+1 ldy #$FD ; SMC clv rts