I'm becoming an expert at 6502 Assembly
We're almost a month into SPO600, and 6502 Assembly concepts are really starting to become second nature for me.
In this lecture, Chris spoke about characters, strings, and system routines.
Characters are usually represented in binary as a number which corresponds to an entry in a character set table. The most common table is ASCII.
Strings are groups of characters terminated with zeroes, much like C.
There are several ROM (read-only memory) system routines for the 6502 emulator:
- SCINIT $ff81 - Initialize and clear the character display
- CHRIN $ffcf - Input one character from keyboard (returns A)
- CHROUT $ffdw - Outputs one character (A) to the screen at the current cursor position. Screen will wrap/scroll appropriately. Printable characters and cursor codes ($80/$81/$82/$83 for up/right/left/down) as well as RETURN ($0d) are accepted. Printable ASCII codes with the high bit set will be printed in reverse video.
- SCREEN $ffed - Returns the character screen size in the X and Y registers.
- PLOT $fff0 - gets (CARRY=1) or sets (CARRY=0) the cursor position
To use these routines, we need to copy the define directives.
CHROUT is particularly useful because it can be used to get automatic emulator window scrolling on new lines.I'm looking forward to see what Chris has in store for us this week regarding the lab! The animation exercise last week was a lot of fun.
Comments
Post a Comment