Routines |
Prev: 74AC | Up: Map | Next: 7514 |
Used by the routines at 7700 and F955. Returns with the carry flag set if the teacher whose coordinates are in DE is off-screen. Otherwise calculates the position of the lines bubble and copies the area of the screen that would be overwritten by the bubble to the buffer at EA00, and returns with DE holding the attribute file address for the top-left corner of the lines bubble.
|
||||||||
74AF | LD A,($7F00) | A=leftmost column of the skool on screen (0-64) | ||||||
74B2 | LD B,A | Copy this to B | ||||||
74B3 | LD A,E | A=teacher's x-coordinate | ||||||
74B4 | AND $F8 | |||||||
74B6 | SUB B | Is the teacher off-screen to the left? | ||||||
74B7 | RET C | Return with the carry flag set if so | ||||||
74B8 | CP $20 | Is the teacher off-screen to the right? | ||||||
74BA | CCF | |||||||
74BB | RET C | Return with the carry flag set if so | ||||||
The teacher is on screen. First, save the attribute bytes of the area of the screen that will be overwritten by the lines bubble.
|
||||||||
74BC | LD E,A | E=teacher's screen x-coordinate (0-31) | ||||||
74BD | LD A,D | A=teacher's y-coordinate (152-169) | ||||||
74BE | SUB $9B | A=teacher's screen y-coordinate (0-14) | ||||||
74C0 | JR NC,$74C3 | |||||||
74C2 | XOR A | |||||||
74C3 | RRCA | Set DE to the attribute file address of the top left corner of the lines bubble | ||||||
74C4 | RRCA | |||||||
74C5 | RRCA | |||||||
74C6 | LD D,A | |||||||
74C7 | AND $E0 | |||||||
74C9 | ADD A,E | |||||||
74CA | LD E,A | |||||||
74CB | LD A,D | |||||||
74CC | AND $03 | |||||||
74CE | ADD A,$58 | |||||||
74D0 | LD D,A | |||||||
74D1 | PUSH HL | |||||||
74D2 | PUSH DE | |||||||
74D3 | LD HL,$EA00 | The buffer at EA00 will store the area of the screen overwritten by the lines bubble | ||||||
74D6 | EX DE,HL | DE=EA00, HL=attribute file address | ||||||
74D7 | LD BC,$0008 | Copy the 24 attribute bytes that will be overwritten by the lines bubble from the screen to EA00 | ||||||
74DA | LDIR | |||||||
74DC | LD C,$18 | |||||||
74DE | ADD HL,BC | |||||||
74DF | LD C,$08 | |||||||
74E1 | LDIR | |||||||
74E3 | LD C,$18 | |||||||
74E5 | ADD HL,BC | |||||||
74E6 | LD C,$08 | |||||||
74E8 | LDIR | |||||||
Next, save the display file bytes of the area of the screen that will be overwritten by the lines bubble.
|
||||||||
74EA | POP HL | Restore the attribute file address of the top-left corner of the lines bubble to HL | ||||||
74EB | PUSH HL | |||||||
74EC | LD A,H | Get the display file address of the top-left corner of the lines bubble in HL | ||||||
74ED | SUB $50 | |||||||
74EF | ADD A,A | |||||||
74F0 | ADD A,A | |||||||
74F1 | ADD A,A | |||||||
74F2 | LD H,A | |||||||
74F3 | LD BC,$0003 | A lines bubble has 3 rows... | ||||||
74F6 | LD A,$08 | ...and 8 columns; copy the 192 display file bytes that will be overwritten by the lines bubble from the screen to EA18 | ||||||
74F8 | PUSH BC | |||||||
74F9 | PUSH HL | |||||||
74FA | LD C,$08 | |||||||
74FC | LDIR | |||||||
74FE | POP HL | |||||||
74FF | INC H | |||||||
7500 | DEC A | |||||||
7501 | JR NZ,$74F9 | |||||||
7503 | LD A,L | |||||||
7504 | ADD A,$20 | |||||||
7506 | LD L,A | |||||||
7507 | JR C,$750D | |||||||
7509 | LD A,H | |||||||
750A | SUB $08 | |||||||
750C | LD H,A | |||||||
750D | POP BC | |||||||
750E | DEC C | |||||||
750F | JR NZ,$74F6 | |||||||
7511 | POP DE | Restore the attribute file address of the top-left corner of the lines bubble to DE | ||||||
7512 | POP HL | |||||||
7513 | RET | Return with the carry flag reset |
Prev: 74AC | Up: Map | Next: 7514 |