6502 Math Lab (Week 3 Lab)

Hello everybody, and welcome to the third lab of SPO600.

After studying 6502 directives last class, specifically DCB, we're going to use it this lab in our very first creative piece of work using 6502.

The objective in this lab is to create a graphic animation using the 6502 emulator colors. We're given four options to achieve this:

  1. Bouncing Graphic
  2. Numeric Display
  3. Pong
  4. Kaleidoscope

I've decided to go with the bouncing graphic.

To achieve my design, I copied the code example to display a ball on the screen. This code sample uses DCB to pre-define all the locations and load them into the a register.

define WIDTH 4 ; width of graphic define HEIGHT 4 ; height of graphic lda #$25 ; create a pointer at $10 sta $10 ; which points to where lda #$02 ; the graphic should be drawn sta $11 lda #$00 ; number of rows we've drawn sta $12 ; is stored in $12 ldx #$00 ; index for data ldy #$00 ; index for screen column draw: lda data,x sta ($10),y inx iny cpy #WIDTH bne draw inc $12 ; increment row counter lda #HEIGHT ; are we done yet? cmp $12 beq done ; ...exit if we are lda $10 ; load pointer clc adc #$20 ; add 32 to drop one row sta $10 lda $11 ; carry to high byte if needed adc #$00 sta $11 ldy #$00 beq draw done: brk ; stop when finished data: dcb 00,03,03,00 dcb 07,00,00,07 dcb 07,00,00,07 dcb 00,03,03,00

Comments

Popular posts from this blog

The Difference of SVE2 (Project Stage 3)

So I examined another open-source project... (Project Stage 2)

The World of Open Source! (Week 1 Lab)