| Alien (BUGFIX 1.7) | Routines |
| Prev: 39741 | Up: Map | Next: 39830 |
|
Advances AlienXPhase (0->1->2->3->0), loads the corresponding sprite frame pointer from the table at AlienXPhase+2, then LDIRs 6 bytes x 63 rows of sprite data to the display file at col 7, char-row 1, pixel-row 0, handling ZX Spectrum interleaved scan-line addressing at each row boundary.
|
||||
| 39764 | LD HL,39741 | HL -> AlienXPhase | ||
| 39767 | LD A,(HL) | |||
| 39768 | INC A | |||
| 39769 | AND 3 | cycle frame index 0->1->2->3->0 | ||
| 39771 | LD (HL),A | store new frame index | ||
| 39772 | LD E,A | |||
| 39773 | LD D,0 | |||
| 39775 | INC HL | HL -> frame pointer table | ||
| 39776 | ADD HL,DE | |||
| 39777 | ADD HL,DE | HL -> table[frame] (2 bytes/entry) | ||
| 39778 | LD E,(HL) | |||
| 39779 | INC HL | |||
| 39780 | LD D,(HL) | DE = sprite frame data ptr | ||
| 39781 | LD HL,18439 | HL = display file col 7, char-row 1, pixel-row 0 | ||
| 39784 | EX DE,HL | DE = screen dst, HL = sprite src | ||
| 39785 | LD B,63 | 63 pixel rows per frame | ||
| 39787 | LD C,0 | |||
| 39789 | PUSH BC | save row counter | ||
| 39790 | LD B,C | BC = 6: one 6-byte sprite row | ||
| 39791 | LD C,6 | |||
| 39793 | LDIR | copy it to the screen | ||
| 39795 | EX DE,HL | HL = screen dst, DE = sprite src | ||
| 39796 | LD A,H | finished pixel row 7 of this char row? | ||
| 39797 | AND 7 | |||
| 39799 | CP 7 | |||
| 39801 | JR Z,39806 | yes: char-row / third stepping below | ||
| 39803 | INC H | no: next pixel row is one display bank up | ||
| 39804 | JR 39821 | |||
|
ZX Spectrum display-file scan-line stepping: H&7 = 7 means we finished a character row. If L < $E0 (224) add -1760 (= -7*256+32) to drop to pixel-row 0 of the next character row in the same third; otherwise (last char row of the third) add 32, whose carry into H lands on row 0 of the next third. Then subtract 6 from HL to step back past the LDIR'd bytes.
|
||||
| 39806 | LD A,L | |||
| 39807 | CP 224 | L >= $E0: last char-row of this screen third? | ||
| 39809 | JR NC,39817 | yes: next third | ||
| 39811 | LD BC,63776 | no: -1760 (= -7*256+32) drops to pixel-row 0 | ||
| 39814 | ADD HL,BC | of the next char row in the same third | ||
| 39815 | JR 39821 | |||
| 39817 | LD BC,32 | yes: +32 carries into H, landing on | ||
| 39820 | ADD HL,BC | row 0 of the next screen third | ||
| 39821 | LD BC,65530 | BC = -6: rewind HL past the 6 LDIR'd bytes | ||
| 39824 | ADD HL,BC | |||
| 39825 | EX DE,HL | DE = screen dst, HL = sprite src | ||
| 39826 | POP BC | |||
| 39827 | DJNZ 39789 | next row | ||
| 39829 | RET | |||
| Prev: 39741 | Up: Map | Next: 39830 |