Lab 02 - Math Lab
Lab 02 - Math Lab This lab helped me understand boundary checking to control the direction of a moving graphic. Managing pixel placement and position updates is crucial to ensure the graphic behaves as expected, bouncing off the edges of the bitmapped screen in both directions. Below is the original code that served as the foundation for this task: ; Zero-page variables define XPOS $20 define YPOS $21 START: ; Set up the width and height elements of the data structure LDA #$05 STA $12 ; IMAGE WIDTH STA $13 ; IMAGE HEIGHT ; Set initial position X=Y=0 LDA #$00 STA XPOS STA YPOS ; Main loop for diagonal animation MAINLOOP: ; Set pointer to the image ; Use G_O or G_X as desired ; The syntax #<LABEL returns the low byte of LABEL ; The syntax #>LABEL returns the high byte of LABEL LDA #<G_O STA $10 LDA #>G_O STA $11 ; Place the image on the screen LDA #$10 ; Address in zeropage of the data structure LDX XPOS ; X positio...