Zeropage Addressing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; When Addressing Modes use 8-Bit in favour of 16-Bit encoded locations | |
; they are commonly called Zeropage addressing modes | |
; Example: Zeropage Indirect Indexed Addressing | |
; Fill the whole screen with Spaces. | |
ldx #$04 ; load X-Register via Immediate Addressing | |
sta $fb ; store into $fb via Zeropage Addressing | |
lda #$04 ; load Accumulator via Immediate Addressing | |
sta $fc ; store into $fc via Zeropage Addressing | |
lda #$20 ; load Y-Register Spacebar code via Immediate Addressing | |
loop sta ($fb),y ; store Accumulator value by Zeropage Indirect Indexed Addressing | |
iny ; increase Y by implied Addressing | |
bne loop ; branch to loop until 255 locations have been addressed via Relative Addressing | |
inc $fc ; Increase most significant Byte to point to next page in Screen RAM | |
dex ; decrease X-Register by implied Addressing | |
bne loop ; branch to Loop to continue filling the screen with Spaces via Relative Addressing | |
rts ; after four rounds we are done and return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Am I correct in assuming the chip registers are somehow reset to #$00 before the object code is run? Because your code seems to make this assumption. I was expecting, for instance, an
lda #$00
beforesta $fb
on line 8.