Prev: D7F6 Up: Map Next: D9A9
D986: Routine at D986
Used by the routines at PrintSprite and PrintSprite_Mirrored.
D986 EXX Switch to the shadow registers.
D987 PUSH HL Stash HL on the stack.
D988 LD A,B A=B.
D989 RRCA Rotate A left three positions (bits 5 to 7 are now in positions 0 to 2).
D98C LD L,A L=A.
D98D AND %00000111 Keep only bits 0-2.
D98F ADD A,$68 A+=68.
D991 LD H,A H=A.
D992 LD A,L A=L.
D993 AND %11111000 Keep only bits 3-7.
D995 ADD A,C A+=C.
D996 LD L,A L=A.
D997 LD A,($D214) A=*D214.
D99A CP $E6 Jump to D9A5 if A is lower than E6.
D99C JR C,$D9A5
D99E CP $EF Jump to D9A5 if A is higher than EF.
D9A0 JR NC,$D9A5
D9A2 LD A,($D408) Write *D408 to *HL.
D9A5 LD (HL),A
D9A6 POP HL Restore HL from the stack.
D9A7 EXX Switch back to the normal registers.
D9A8 RET Return.
Prev: D7F6 Up: Map Next: D9A9