Tuesday | 21 MAY 2024
[ previous ]
[ next ]

6502 - Notes 01

Date: 2022-06-06

Dipping my toes in assembly!


Going to try following this along and see how it goes.

The first section is quite straightforward.

The author has a javascript assembler and program runner which is really cool. JS and the browser is powerful enough to run the 6502 chip which is pretty cool to me.

The first thing I learned was the symbols. The # symbol is used to refer to literal numbers. The $ is used to refer to hex values. This means you can do something like #15 which means the number 15 but also #$10 which is the hex of 15.

There is also the LD{R} which means load some register and it takes a numerical value either as a decimal or as a hex value. ST{R} means to assign some memory location the value in a register.

LDA #$0F
STA $0200

This means put 15 in register A. Then set the memory location 512 to 15. The screen is mapped in memory and so changing the values in this address range would cause the screen to change. This is how we draw pixels.

I tried passing a raw number, #512 to the ST command but that seems to be an error. I can only use hex numbers.

Playing around with addresses, the screen starts at 512 or $0200 and goes 32 bits across to $021F.

LDA #$0F
STA $021F
STA $023F
STA $025F
STA $027F

This prints out 1 pixel on 4 lines. I need to learn looping. Trying to figure out the screen size is a bit of a pain manually.