6502 matrix screensaver

2007-12-11 18:49:07

More 6502 silliness:


loop:
   lda $fe
   and #$1f
   tay
   tax
   lda matrix,y
   ;; clear the old postion
   sta $1
   tay
   lda $0
   jsr paint
   inc $1
   lda $1
   and #$1f
   sta matrix,y
   tay
   lda #5
   jsr paint
   jmp loop

paint:
   pha
   lda yl,y
   sta $2
   lda yh,y
   sta $3
   txa
   tay
   pla
   sta ($2),y
   rts

yh:
       dcb $02, $02, $02, $02, $02, $02, $02, $02
       dcb $03, $03, $03, $03, $03, $03, $03, $03
       dcb $04, $04, $04, $04, $04, $04, $04, $04
       dcb $05, $05, $05, $05, $05, $05, $05, $05
       ;; Y cord LSB
yl:
       dcb $00, $20, $40, $60, $80, $a0, $c0, $e0
       dcb $00, $20, $40, $60, $80, $a0, $c0, $e0
       dcb $00, $20, $40, $60, $80, $a0, $c0, $e0
       dcb $00, $20, $40, $60, $80, $a0, $c0, $e0

matrix:
   dcb $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
   dcb $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
   dcb $0,$0,$0,$0