Prev: EF53 Up: Map Next: F036
EF6C: Part of DRAW_SPRITE: skip the bytes cut off at the left, then draw the rows
The drawing. The sprite pointer stays in HL, and the buffer pointer and the mode move to the alternate set, so the loop holds both without touching memory. Each sprite byte is inverted if the mode is $80 (the mask, inverted, is cover, so the zero bits the shift brings in mean nothing covered; it is inverted back as it is stored), rotated right by x mod 8 through the patched JR, and split: the part that stays in this column, with the last column's spill ORed in, is written; the part that spills is kept in E for the next. Mode $80 stores the byte as it is; modes 0 and 8 OR it in; mode 4 ORs it into page $DA and first clears the same bits from page $DB.
The three ANDs and the JR's displacement here are rewritten by DRAW_SPRITE before every sprite; the operands the listing shows are the tape's.
DRAW_SPRITE_ROWS EF6C INC DE Skip the bytes cut off (one fewer: the last of them
This entry point is used by the routine at DRAW_SPRITE_CLIP_LEFT.
DRAW_SPRITE_ROWS_0 EF6D DJNZ DRAW_SPRITE_ROWS primes the spill), and count that column
EF6F INC A }
This entry point is used by the routine at DRAW_SPRITE_SKIP_COLUMNS.
DRAW_SPRITE_ROWS_1 EF70 LD (WORK_WEIGHT),A The columns to draw
EF73 PUSH HL The buffer pointer and the mode to the alternate set; the rows; page $D9 to start with
EF74 EX DE,HL
EF75 PUSH BC
EF76 EXX
EF77 POP BC
EF78 POP HL
EF79 LD B,(IY+WORK_ANIMATION-V)
EF7C LD H,$D9
EF7E BIT 7,C Mode $80?
EF80 JR Z,DRAW_SPRITE_ROWS_6
EF82 LD B,$03 Yes: three rows of $FF, nothing covered, at the top of page $D9...
EF84 XOR A
DRAW_SPRITE_ROWS_2 EF85 ADD A,(IY+WORK_WEIGHT-V)
EF88 INC A
EF89 DJNZ DRAW_SPRITE_ROWS_2
EF8B LD B,A
EF8C LD HL,BUFFER_D900
DRAW_SPRITE_ROWS_3 EF8F LD (HL),$FF
EF91 INC HL
EF92 DJNZ DRAW_SPRITE_ROWS_3
EF94 LD H,A ...and three below the sprite's rows...
EF95 LD B,(IY+WORK_WEIGHT-V)
EF98 INC B
DRAW_SPRITE_ROWS_4 EF99 ADD A,(IY+SECOND_POINT_ROW-V)
EF9C DJNZ DRAW_SPRITE_ROWS_4
EF9E LD L,A
EF9F LD B,H
EFA0 LD A,H
EFA1 LD H,$D9
DRAW_SPRITE_ROWS_5 EFA3 LD (HL),$FF
EFA5 INC HL
EFA6 DJNZ DRAW_SPRITE_ROWS_5
EFA8 LD L,A ...and the sprite from the fourth row
EFA9 LD B,(IY+WORK_ANIMATION-V)
EFAC JR DRAW_SPRITE_ROWS_8
DRAW_SPRITE_ROWS_6 EFAE DEC H The other modes: page $D8, page $DA for mode 4, page $DB for mode 8
EFAF BIT 2,C
EFB1 JR Z,DRAW_SPRITE_ROWS_7
EFB3 LD H,$DA
DRAW_SPRITE_ROWS_7 EFB5 BIT 3,C
EFB7 JR Z,DRAW_SPRITE_ROWS_8
EFB9 LD H,$DB
DRAW_SPRITE_ROWS_8 EFBB PUSH HL Each row: E carries the spill from column to column; the first column only primes it if the sprite starts left of the region
EFBC EXX
EFBD PUSH HL
EFBE LD B,(IY+WORK_WEIGHT-V)
EFC1 LD E,$00
EFC3 BIT 4,C
EFC5 JR Z,DRAW_SPRITE_ROWS_9
EFC7 SET 5,C
DRAW_SPRITE_ROWS_9 EFC9 LD A,(HL) Each column: a sprite byte; mode $80 inverts the mask into cover
EFCA INC HL
EFCB BIT 7,C
EFCD JR Z,DRAW_SPRITE_ROWS_10
EFCF CPL
DRAW_SPRITE_ROWS_10 EFD0 JR DRAW_SPRITE_ROWS_11 Patched: jumps over 7 minus (x mod 8) of the RRCAs
DRAW_SPRITE_ROWS_11 EFD2 RRCA Rotate right by x mod 8
EFD3 RRCA
EFD4 RRCA
EFD5 RRCA
EFD6 RRCA
EFD7 RRCA
EFD8 RRCA
EFD9 BIT 3,C Mode 8, the image
EFDB JR NZ,DRAW_SPRITE_ROWS_13
EFDD BIT 7,C Mode $80?
EFDF JR Z,DRAW_SPRITE_ROWS_12
EFE1 LD D,A Yes: this column's part (the AND is patched) with the last one's spill, back into a mask
EFE2 AND $01
EFE4 OR E
EFE5 CPL
EFE6 EXX
EFE7 JR DRAW_SPRITE_ROWS_16
DRAW_SPRITE_ROWS_12 EFE9 CPL Modes 0 and 4: the mask becomes cover
DRAW_SPRITE_ROWS_13 EFEA LD D,A The whole byte kept for the spill; only that, the first time round when the first column is not written
EFEB BIT 5,C
EFED JR Z,DRAW_SPRITE_ROWS_14
EFEF RES 5,C
EFF1 JR DRAW_SPRITE_ROWS_17
DRAW_SPRITE_ROWS_14 EFF3 AND $01 This column's part (the AND is patched), with the last one's spill
EFF5 OR E
EFF6 EXX
EFF7 BIT 2,C Mode 4: clear this cover out of the image in page $DB
EFF9 JR Z,DRAW_SPRITE_ROWS_15
EFFB INC H
EFFC PUSH AF
EFFD CPL
EFFE AND (HL)
EFFF LD (HL),A
F000 POP AF
F001 DEC H
DRAW_SPRITE_ROWS_15 F002 OR (HL) OR it into the buffer (or, for mode $80, store it); the next column
DRAW_SPRITE_ROWS_16 F003 LD (HL),A
F004 INC L
F005 EXX
DRAW_SPRITE_ROWS_17 F006 LD A,D The spill for the next column (the AND is patched)
F007 AND $FF
F009 LD E,A
F00A DJNZ DRAW_SPRITE_ROWS_9
F00C POP HL The sprite's next row
F00D LD D,$00
F00F LD E,(IY+FOUND_RECORD-V)
F012 ADD HL,DE
F013 EXX
F014 BIT 6,C A spill column after the last?
F016 JR NZ,DRAW_SPRITE_ROWS_20
F018 CPL Write the spill into it the same way
F019 BIT 7,C
F01B JR NZ,DRAW_SPRITE_ROWS_19
F01D BIT 2,C
F01F JR Z,DRAW_SPRITE_ROWS_18
F021 INC H
F022 PUSH AF
F023 AND (HL)
F024 LD (HL),A
F025 POP AF
F026 DEC H
DRAW_SPRITE_ROWS_18 F027 CPL
F028 OR (HL)
DRAW_SPRITE_ROWS_19 F029 LD (HL),A
DRAW_SPRITE_ROWS_20 F02A POP HL The buffer's next row: one byte wider than the region
F02B LD A,L
F02C ADD A,(IY+DRAW_WIDTH-V)
F02F LD L,A
F030 INC L
F031 DJNZ DRAW_SPRITE_ROWS_8
F033 POP DE Done
F034 POP BC
F035 RET
Prev: EF53 Up: Map Next: F036