Routines |
Prev: 49654 | Up: Map | Next: 49716 |
|
||||
This routine works out which area of the screen we are in. Here are a few examples of usage; A=34 HL=16384 A=34 (restored from E) AND 7 == A=2 BC=512 HL=16896 A=34 (restored from E) AND 56 == A=32 BC=32 BC=128 HL=17024
|
||||
Screen_Calc | 49667 | LD E,A | Stash the accumulator in E for later. | |
49668 | AND 192 | Mask off low bits d6-d7. | ||
49670 | JP Z,Screen_Top | If the result is now zero, jump to Screen_Top. | ||
49673 | CP 64 | If A is 64 then jump to Screen_Middle. | ||
49675 | JP Z,Screen_Middle | |||
Screen_Bottom | 49678 | LD HL,20480 | Sets HL to 20480 (the bottom of the screen buffer). | |
49681 | JP Screen_Calc_Minor | Jump to Screen_Calc_Minor. | ||
Screen_Middle | 49684 | LD HL,18432 | Sets HL to 18432 (the middle of the screen buffer). | |
49687 | JP Screen_Calc_Minor | Jump to Screen_Calc_Minor. | ||
Screen_Top | 49690 | LD HL,16384 | Sets HL to 16384 (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 | 49693 | LD A,E | Restore the accumulator from E. | |
49694 | AND 7 | Mask bits d0-d2. | ||
49696 | LD B,A | Push the accumulator into BC as the high-order byte (low is 0). | ||
49697 | LD C,0 | |||
49699 | ADD HL,BC | Adds BC to HL. | ||
49700 | LD A,E | Again, restore the accumulator from E. | ||
49701 | AND 56 | Mask bits d3-d5. | ||
49703 | LD C,A | Push the accumulator into BC as the low-order byte (high is 0). | ||
49704 | LD B,0 | |||
49706 | SLA C | * 2 * 2. | ||
49708 | RL B | |||
49710 | SLA C | |||
49712 | RL B | |||
49714 | ADD HL,BC | Adds BC to HL. | ||
49715 | RET | Return. |
Prev: 49654 | Up: Map | Next: 49716 |