Week 02 of 6502!

Hey guys, and welcome back to my SPO600 blog.
In this class, we took a deeper dive into 6502 Assembler. This time, we learnt some directives.

Directives are instructions that set behavior for how the compiler processes input.
Here's a few examples.

define
This directive is a very simple text replacement, which stores a given value into any word you provide to it.
For example, 'define WHITE $01' makes it so that any time you mention 'WHITE', it gets substituted with $01. This is really useful if some particular values are hard to remember. In this case, $01 refers to the white color, which is definitely easy to forget.

DCB
DCB (define constant byte) stores a value in memory, at the very end of the memory.
Once that value is declared, it can be called from the main code using LDA.
The value must be either a quoted string or a numeric expression that evaluates to an integer between 128 to 255.

I was interested to see the parallels between 6502 directives and C++ directives, as I've used those a lot for past courses. Just like how 'define' is a 6502 directive, you can use '#define' in C++ to achieve the same thing!

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)