program walk-through
This commit is contained in:
parent
dee594874a
commit
65658e9942
@ -16,3 +16,21 @@
|
|||||||
110 RTS ; Return To Stack
|
110 RTS ; Return To Stack
|
||||||
120 .END ; Program End Macro
|
120 .END ; Program End Macro
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
**Line 60:** Sets the 6502 to "binary" mode. the subsequent ADC command will then produce binary rather than BCD results. Basically, this just insures that we're in binary mode, just in case something previously has set us to decimal mode.
|
||||||
|
|
||||||
|
**Line 70:** The 6502 only has one "add" instruction, called ADC (Add With Carry). Since this instruction does carry operations, we need to make sure the carry bit is cleared first, in order to get a proper result.
|
||||||
|
|
||||||
|
**Line 80:** LDA can take either the value from an address location (signified with a '$', as in '$CB'), or it can take values passed to it immediately. That is done with the '#'. These values will be decimal, unless otherwise notated.
|
||||||
|
|
||||||
|
**Line 90:** The immediate value 2 will be added to the value stored in the Accumulator, and the result will overwrite the Accumulator. The carry bit will be set appropriately.
|
||||||
|
|
||||||
|
**Line 100:** The value in the accumulator will be stored at the specified address location. In this case, the decimal value 4 (which is now in the Accumulator) will be stored at address location $CB.
|
||||||
|
|
||||||
|
**Line 110:** This just basically resets the stack pointer.
|
||||||
|
|
||||||
|
**Line 120:** This is a macro provided by the assembler software. In this case, it would either be Atari Assembler, or OSS Mac/65.
|
||||||
|
|
||||||
|
Once assembled, you could use something like "Daves Debugger Tool" (DDT), to step through the program and inspect memory location $CB when the execution is complete.
|
||||||
|
|
||||||
|
For a very thorough walk-through of this little program, you can [check out my video](https://rumble.com/v2in18e-atari-assembler-adding-2-2-the-winston-smith-demo.html?playlist_id=XhDRTzaWoOM).
|
Loading…
Reference in New Issue
Block a user