Routines |
Prev: C1F6 | Up: Map | Next: C234 |
|
||||
This routine works out which area of the screen we are in. Here are a few examples of usage; A=22 HL=4000 A=22 (restored from E) AND 07 == A=02 BC=0200 HL=4200 A=22 (restored from E) AND 38 == A=20 BC=20 BC=80 HL=4280
|
||||
Screen_Calc | C203 | LD E,A | Stash the accumulator in E for later. | |
C204 | AND $C0 | Mask off low bits d6-d7. | ||
C206 | JP Z,Screen_Top | If the result is now zero, jump to Screen_Top. | ||
C209 | CP $40 | If A is 40 then jump to Screen_Middle. | ||
C20B | JP Z,Screen_Middle | |||
Screen_Bottom | C20E | LD HL,$5000 | Sets HL to 5000 (the bottom of the screen buffer). | |
C211 | JP Screen_Calc_Minor | Jump to Screen_Calc_Minor. | ||
Screen_Middle | C214 | LD HL,$4800 | Sets HL to 4800 (the middle of the screen buffer). | |
C217 | JP Screen_Calc_Minor | Jump to Screen_Calc_Minor. | ||
Screen_Top | C21A | LD HL,$4000 | Sets HL to 4000 (the top of the screen buffer) and continue on... | |
Now we have the base screen address; work out the exact address to return.
|
||||
Screen_Calc_Minor | C21D | LD A,E | Restore the accumulator from E. | |
C21E | AND $07 | Mask bits d0-d2. | ||
C220 | LD B,A | Push the accumulator into BC as the high-order byte (low is 00). | ||
C221 | LD C,$00 | |||
C223 | ADD HL,BC | Adds BC to HL. | ||
C224 | LD A,E | Again, restore the accumulator from E. | ||
C225 | AND $38 | Mask bits d3-d5. | ||
C227 | LD C,A | Push the accumulator into BC as the low-order byte (high is 00). | ||
C228 | LD B,$00 | |||
C22A | SLA C | * 2 * 2. | ||
C22C | RL B | |||
C22E | SLA C | |||
C230 | RL B | |||
C232 | ADD HL,BC | Adds BC to HL. | ||
C233 | RET | Return. |
Prev: C1F6 | Up: Map | Next: C234 |