Prev: 39741 Up: Map Next: 39830
39764: BlitAlienFrame
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
39790 LD B,C
39791 LD C,6
39793 LDIR
39795 EX DE,HL
39796 LD A,H
39797 AND 7
39799 CP 7
39801 JR Z,39806
39803 INC H
39804 JR 39821
ZX Spectrum display-file scan-line bank wrap: H&7 = 7 means we finished a character row. If L < 0xE0 (224) add -1760 to jump to the next screen third; otherwise add 32 to advance to the next character row within the same third. Then subtract 6 from HL to step back past the LDIR'd bytes.
39806 LD A,L
39807 CP 224 L >= 0xE0: last char-row of this screen third?
39809 JR NC,39817 yes: next third
39811 LD BC,63776 BC = -1760: wrap to next column in next third
39814 ADD HL,BC
39815 JR 39821
39817 LD BC,32 BC = 32: advance to next character row
39820 ADD HL,BC
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