Routines
| Prev: A9B7 | Up: Map | Next: AA71 |
AA14: Send one character to the screen layer
|
Letters become lower case; a space at the start of a line is dropped; carriage returns, quote marks and full stops get special handling (the rest: a full stop or quote mark makes the next letter a capital, and A851 makes them all capitals).
How it works:
1. A capital letter becomes lower case; everything else is passed on as it is.
2. A space at the start of a line is dropped ($A025 is zero until the first real character of the line).
3. A carriage return starts a new line. A quote mark gets a space put in front of it. A quote mark or a full stop sets $A026, so the next letter will be a capital.
4. A lower-case letter becomes a capital if the all-capitals flag A851 is set or $A026 is set; $A026 is cleared as it is used.
5. Pass the character to the screen layer (C1E1).
|
||||||||
| AA14 | CP $41 | Compare A with $41 - Capital letters become small ones | ||||||
| AA16 | JR C,$AA1E | If A is below $41, skip ahead to AA1E | ||||||
| AA18 | CP $5B | Compare A with $5B | ||||||
| AA1A | JR NC,$AA1E | If A is $5B or more, skip ahead to AA1E | ||||||
| AA1C | OR $20 | Set bit 5 of A | ||||||
| AA1E | PUSH AF | Save AF on the stack | ||||||
| AA1F | LD A,($A025) | Read $A025 in "Game variables" into A - $A025 = 0 at the start of a line: a leading space is dropped | ||||||
| AA22 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||
| AA23 | JR NZ,$AA2A | If A is not zero, skip ahead to AA2A | ||||||
| AA25 | POP AF | Restore AF from the stack | ||||||
| AA26 | CP $20 | Compare A with $20 | ||||||
| AA28 | RET Z | If A equals $20, return | ||||||
| AA29 | PUSH AF | Save AF on the stack | ||||||
| AA2A | LD A,$01 | Load A with $01 | ||||||
| AA2C | LD ($A025),A | Store A in $A025 in "Game variables" | ||||||
| AA2F | POP AF | Restore AF from the stack | ||||||
| AA30 | PUSH AF | Save AF on the stack | ||||||
| AA31 | CP $0D | Compare A with $0D - A carriage return starts a new line | ||||||
| AA33 | JR NZ,$AA3B | If A differs from $0D, skip ahead to AA3B | ||||||
| AA35 | XOR A | Clear A to zero (and the carry flag) | ||||||
| AA36 | LD ($A025),A | Store A in $A025 in "Game variables" | ||||||
| AA39 | JR $AA6D | Jump on to AA6D | ||||||
| AA3B | CP $22 | Compare A with $22 - A quote mark gets a space before it, | ||||||
| AA3D | JR NZ,$AA46 | If A differs from $22, skip ahead to AA46 | ||||||
| AA3F | LD A,$20 | Load A with $20 | ||||||
| AA41 | CALL $C1E1 | Call the routine "Print gatekeeper: check two flags, then dispatch" (C1E1) | ||||||
| AA44 | JR $AA4A | Skip ahead to AA4A | ||||||
| AA46 | CP $2E | Compare A with $2E - and it, like a full stop, makes the next letter a capital ($A026) | ||||||
| AA48 | JR NZ,$AA51 | If A differs from $2E, skip ahead to AA51 | ||||||
| AA4A | LD A,$01 | Load A with $01 | ||||||
| AA4C | LD ($A026),A | Store A in $A026 in "Game variables" | ||||||
| AA4F | JR $AA6D | Skip ahead to AA6D | ||||||
| AA51 | CP $61 | Compare A with $61 - A letter: a capital if A851 (all capitals, code $1B) or $A026 says so | ||||||
| AA53 | JR C,$AA6D | If A is below $61, skip ahead to AA6D | ||||||
| AA55 | CP $7B | Compare A with $7B - A letter below $7B... | ||||||
| AA57 | JR NC,$AA6D | If A is $7B or more, skip ahead to AA6D | ||||||
| AA59 | LD A,($A851) | Read "Code $1B: the all-capitals flag (read at AA59)" (A851) into A - ...is capitalised if the capital flag A851 is set, or $A026 (set after a full stop and by some word flags)... | ||||||
| AA5C | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||
| AA5D | JR NZ,$AA65 | If A is not zero, skip ahead to AA65 | ||||||
| AA5F | LD A,($A026) | Read $A026 in "Game variables" into A | ||||||
| AA62 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||
| AA63 | JR Z,$AA6D | If A is zero, skip ahead to AA6D | ||||||
| AA65 | XOR A | Clear A to zero (and the carry flag) - ...clearing $A026, | ||||||
| AA66 | LD ($A026),A | Store A in $A026 in "Game variables" | ||||||
| AA69 | POP AF | Restore AF from the stack - ...and its case bit is dropped (AND $5F) | ||||||
| AA6A | AND $5F | Keep only bits 0, 1, 2, 3, 4, 6 of A (mask $5F) | ||||||
| AA6C | PUSH AF | Save AF on the stack | ||||||
| AA6D | POP AF | Restore AF from the stack | ||||||
| AA6E | JP $C1E1 | Out through the screen layer (C1E1) | ||||||
| Prev: A9B7 | Up: Map | Next: AA71 |