Prev: B09F Up: Map Next: B197
B0E6: Draws Sprites To The Shadow Buffer
Used by the routines at Draw_Characters_CurrentRoom, EFC7 and F177.
WriteSprite_ShadowBuffer B0E6 EXX Switch to the shadow registers.
B0E7 LD E,(IY+$23) E=*IY+23.
B0EA LD D,(IY+$28) D=*IY+28.
B0ED LD ($A83B),SP Write SP to Temp_StackPointer_Storage.
B0F1 LD H,(IY+$00) H=*IY+00.
B0F4 LD L,$00 L=00.
B0F6 SRL H
B0F8 RR L
B0FA ADD HL,DE
B0FB LD SP,HL
B0FC LD A,(IY+$05) B=*IY+05.
B0FF LD B,A
B100 AND %00000111 Keep only bits 0-2.
Self-modifying code.
B102 LD ($B189),A Write A to B189.
B105 INC A
B106 LD ($B129),A
B109 LD ($B145),A
B10C LD A,B
B10D AND %11111000 Keep only bits 3-7.
B10F RRCA
B110 RRCA
B111 RRCA
Self-modifying code.
B112 LD ($B17B),A Write A to B17B.
B115 ADD A,$02
B117 LD E,A
B118 LD C,$20
B11A LD L,(IY+$0A)
B11D LD H,$00
B11F ADD HL,HL
B120 ADD HL,HL
B121 ADD HL,HL
B122 ADD HL,HL
B123 ADD HL,HL
B124 LD D,$63
B126 ADD HL,DE
WriteSprite_ShadowBuffer_0 B127 POP DE
B128 LD B,$00
B12A DEC B
B12B JR Z,WriteSprite_ShadowBuffer_2
B12D SCF
B12E LD A,$FF
WriteSprite_ShadowBuffer_1 B130 RR E
B132 RR D
B134 RRA
B135 DJNZ WriteSprite_ShadowBuffer_1
B137 AND (HL)
B138 LD (HL),A
WriteSprite_ShadowBuffer_2 B139 DEC HL
B13A LD A,(HL)
B13B AND D
B13C LD (HL),A
B13D DEC HL
B13E LD A,(HL)
B13F AND E
B140 LD (HL),A
B141 INC HL
B142 INC HL
B143 POP DE
B144 LD B,$00
B146 DEC B
B147 JR Z,WriteSprite_ShadowBuffer_4
B149 XOR A
WriteSprite_ShadowBuffer_3 B14A SRL E
B14C RR D
B14E RRA
B14F DJNZ WriteSprite_ShadowBuffer_3
B151 OR (HL)
B152 LD (HL),A
WriteSprite_ShadowBuffer_4 B153 DEC HL
B154 LD A,(HL)
B155 OR D
B156 LD (HL),A
B157 DEC HL
B158 LD A,(HL)
B159 OR E
B15A LD (HL),A
B15B LD DE,$0022
B15E ADD HL,DE
B15F DEC C
B160 JP NZ,WriteSprite_ShadowBuffer_0
B163 LD A,(IY+$0A)
B166 AND %00000111 Keep only bits 0-2.
B168 JR Z,WriteSprite_ShadowBuffer_5
B16A LD B,$05
B16C JR WriteSprite_ShadowBuffer_6
Characters are 04 characters tall.
WriteSprite_ShadowBuffer_5 B16E LD B,$04 B=04 (counter).
WriteSprite_ShadowBuffer_6 B170 LD A,(IY+$0A) A=*IY+0A.
B173 AND %11111000 Keep only bits 3-7.
B175 LD H,$00 Create an offset in HL.
B177 LD L,A
B178 ADD HL,HL HL=FB00+(HL*04).
B179 ADD HL,HL
B17A LD DE,$FB00
B17D ADD HL,DE
B17E LD DE,$001E DE=001E.
Grab the characters attribute byte.
B181 LD C,(IY+$1E) C=*IY+1E.
WriteSprite_ShadowBuffer_7 B184 LD (HL),C Write the attribute byte to the attribute buffer (*HL).
B185 INC HL Increment HL by one.
B186 LD (HL),C Write the attribute byte to the attribute buffer (*HL).
B187 INC HL Increment HL by one.
This is modified from B102.
B188 LD A,$FF B=FF.
B18A OR A
B18B JR Z,WriteSprite_ShadowBuffer_8
B18D LD (HL),C
WriteSprite_ShadowBuffer_8 B18E ADD HL,DE
B18F DJNZ WriteSprite_ShadowBuffer_7
B191 EXX Switch to the normal registers.
B192 LD SP,($A83B) Restore SP from Temp_StackPointer_Storage.
B196 RET Return.
Prev: B09F Up: Map Next: B197