6502 Assembly monochrome demo

As if learning Intel x86 Assembly wasn’t weird enough, I have decided to learn some basic 6502 Assembly. This CPU was used in the NES and the Apple 2 computers. I found an Easy 6502 emulator that runs entirely within a web page. The only form of output is the pixels in a window that represent memory addresses on a fictional computer. I made a very cool demo. Below is my source code.

;this part draws vertical stripes
lda #$0
tax
tay
loop_stripe_vertical:
sta $200,x
inx
eor #$1
iny
cpy #$0
bne loop_stripe_vertical

;this part makes a checkerboard
lda #$0
tax
tay
loop_checkerboard:
sta $380,x
inx
eor #$1

iny
cpy #$20
bne color_keep_checker

pha ;push A to the stack
lda #$0 ;load A with zero
tay ;transfer A to Y
pla ;pull original A back from stack
eor #$1

color_keep_checker:
cpx #$0
bne loop_checkerboard

;this part draws horizontal stripes
lda #$0
tax
tay
loop_stripe_horizontal:
sta $500,x
inx
;eor #$1

iny
cpy #$20
bne color_keep

pha ;push A to the stack
lda #$0 ;load A with zero
tay ;transfer A to Y
pla ;pull original A back from stack
eor #$1

color_keep:
cpx #$0
bne loop_stripe_horizontal

When assembled and run, the result looks like this. Small routines that draw stripes and a checkerboard based on the way this specific emulator works.

This example, while extremely cool, is limited in its usefulness compared to a program that runs on a PC with a way of outputting text to a terminal. If I find the right kind of emulator, I would like to figure out how to rewrite some of my Intel Assembly programs into 6502 Assembly. Honestly, the languages are different but the math is still the same once I find the correct name of the instruction to do what I want. I am following this reference.

http://www.6502.org/tutorials/6502opcodes.html

Comments

Please leave me any comments or questions you have! I will update posts if necessary based on user feedback!