RosettaCodeData/Task/Pinstripe-Display/6502-Assembly/pinstripe-display.6502
2023-07-01 13:44:08 -04:00

112 lines
1.3 KiB
Text

define color $00
define looptemp $01
lda #1
sta color
loop_1wide:
lda color
and #$01
; this takes advantage of the fact that Easy6502 maps black to 0 and white to 1.
; Thus if we clear all but bit 0 the color will be either black or white, alternating infinitely regardless of the actual value
; of the color variable.
sta $0200,x
inc color
inx
bne loop_1wide
loop_2wide:
lda color
and #$01
sta $0300,x
inx
sta $0300,x
inc color
inx
bne loop_2wide
lda #1
sta color
lda #0
tax
tay
sta looptemp ;reset regs
loop_3wide:
lda color
and #$01
sta $0400,x
inc looptemp
inx
sta $0400,x
inc looptemp
inx
sta $0400,x
inc looptemp
inc color
inx
lda looptemp
cmp #$1e
bne loop_3wide
lda color ;loop overhead
and #$01
sta $0400,x ;can't fit all of this stripe.
;two columns will have to do.
inx
lda color
and #$01
sta $0400,x
inx
lda #1
sta color
lda #0
sta looptemp ;reset color and looptemp
iny
cpy #$08 ;check secondary loop counter
bne loop_3wide
lda #1
sta color
lda #0
tax
tay
sta looptemp
loop_4wide:
lda color
and #$01
sta $0500,x
inx
inc looptemp
sta $0500,x
inx
inc looptemp
sta $0500,x
inx
inc looptemp
sta $0500,x
inc color
inc looptemp
inx
lda looptemp
cmp #$20
bne loop_4wide
lda #0
sta looptemp
lda #1
sta color
iny
cpy #$8
bcc loop_4wide
brk ;program end