Prev: 9F03 Up: Map Next: 9F40
9F13: Draw Actor Sprite Row
Does the same as DrawOldSpriteRow_Aligned, but for the sprite prepared by PrepDraw2_NoFetch (the new sprite).
Input
DE The address of the row of sprite data
HL The screen address
Output
DE The address of the next row of sprite data
HL The screen address of the row above
The entry point for a sprite which is aligned to a character cell. DrawActorSpriteRow_Shift jumps here when the shift is the one which does nothing.
DrawActorSpriteRow_Aligned 9F13 EX DE,HL DE=the row of sprite data, and HL=the address of the next row.
9F14 EX (SP),HL Fetch the screen address, and the address of the next row of sprite data is stored on the stack.
9F15 LD A,D Fetch the first byte of the row.
9F16 XOR (HL) Exclusive OR it onto the screen.
9F17 LD (HL),A Write the result to the screen.
9F18 INC L Move to the next byte on the screen.
9F19 LD A,E Fetch the second byte of the row.
9F1A XOR (HL) Exclusive OR it onto the screen.
9F1B LD (HL),A Write the result to the screen.
9F1C POP DE Fetch the address of the next row of sprite data.
9F1D DEC L Move back to the first byte on the screen.
9F1E JP ScreenPosition1PixelAbove Jump to ScreenPosition1PixelAbove to move up one pixel row.
This entry point is used by the routine at XORSpriteLoop.
The entry point for a sprite which is not aligned to a character cell.
DrawActorSpriteRow 9F21 EX DE,HL HL=the address of the sprite data, and DE=the screen address.
9F22 PUSH DE Stash the screen address on the stack.
9F23 LD D,(HL) Fetch the first byte of the row.
9F24 INC HL Move to the next byte of sprite data.
9F25 LD E,(HL) Fetch the second byte of the row.
9F26 INC HL Move on to the next row of sprite data.
9F27 EX DE,HL HL=the row of sprite data, and DE=the address of the next row.
9F28 XOR A A=00.
Self modifying code; the operand of this command is written by 9FB3. It jumps into the run of shifts below so that the row is moved the right number of pixels, or to DrawActorSpriteRow_Aligned for a sprite which does not need to be shifted.
DrawActorSpriteRow_Shift 9F29 JR DrawActorSpriteRow_Shift Jump to the first shift to do.
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
9F2B ADD HL,HL Shift HL left by one, moving the bit shifted out into A (seven times).
9F2C ADC A,A
9F2D ADD HL,HL
9F2E ADC A,A
9F2F ADD HL,HL
9F30 ADC A,A
9F31 ADD HL,HL
9F32 ADC A,A
9F33 ADD HL,HL
9F34 ADC A,A
9F35 ADD HL,HL
9F36 ADC A,A
9F37 ADD HL,HL
9F38 ADC A,A
9F39 EX DE,HL DE=the shifted row, and HL=the address of the next row of sprite data.
9F3A EX (SP),HL Fetch the screen address, and the address of the next row of sprite data is stored on the stack.
9F3B XOR (HL) Exclusive OR the first byte (in A) onto the screen.
9F3C LD (HL),A Write the result to the screen.
9F3D INC L Move to the next byte on the screen.
9F3E JR DrawSpriteRow_Write Jump to DrawSpriteRow_Write to XOR the other two bytes onto the screen.
Prev: 9F03 Up: Map Next: 9F40