Prev: 46971 Up: Map Next: 47097
47034: Draw Sprite Block To Screen
Used by the routines at Controller_Tile and 58153.
Input
DE Screen Buffer Co-ordinates
HL Sprite data
A Sprite ID
C Sprite attribute value
DrawSprite 47034 PUSH AF Stash AF, HL, BC and DE on the stack.
47035 PUSH HL
47036 PUSH BC
47037 PUSH DE
47038 EX DE,HL Exchange the DE and HL registers.
47039 PUSH HL Stash HL on the stack.
47040 LD D,88 D=88.
47042 LD E,L E=L.
47043 LD L,H L=H.
47044 LD H,0 H=0.
47046 ADD HL,HL HL=(HL*32)+DE.
47047 ADD HL,HL
47048 ADD HL,HL
47049 ADD HL,HL
47050 ADD HL,HL
47051 ADD HL,DE
47052 LD (HL),C Write C to *HL.
47053 POP HL Restore HL from the stack.
47054 LD L,H L=H.
47055 LD D,0 D=0.
47057 LD H,D H=D.
47058 PUSH DE Stash DE on the stack.
47059 ADD HL,HL HL*=16.
47060 ADD HL,HL
47061 ADD HL,HL
47062 ADD HL,HL
47063 LD DE,33272 HL+=ScreenBuffer_Locations.
47066 ADD HL,DE
47067 LD E,(HL) E=*HL.
47068 INC HL Increment HL by one.
47069 LD D,(HL) D=*HL.
47070 EX DE,HL Switch the DE and HL registers.
47071 POP DE Restore DE from the stack.
47072 ADD HL,DE HL+=DE.
47073 EX DE,HL Switch the DE and HL registers.
47074 LD L,A Create an offset in HL.
47075 LD H,0
47077 ADD HL,HL HL*=8.
47078 ADD HL,HL
47079 ADD HL,HL
This is modified from 47218.
47080 LD BC,57308 HL+=Font.
47083 ADD HL,BC
47084 LD B,8 B=8 (counter).
DrawSprite_Loop 47086 LD A,(HL) Copy a byte from *HL and write it to *DE.
47087 LD (DE),A
47088 INC HL Increment HL by one.
47089 INC D Increment D by one.
47090 DJNZ DrawSprite_Loop Decrease counter by one and loop back to DrawSprite_Loop until counter is zero.
47092 POP DE Restore DE, BC, HL and AF from the stack.
47093 POP BC
47094 POP HL
47095 POP AF
47096 RET Return.
Prev: 46971 Up: Map Next: 47097