Prev: DCA1 Up: Map Next: DD4D
DD38: Get Sprite ID?
Used by the routines at Handler_Bullets, F352 and Handler_Projectiles.
Input
BC Screen co-ordinates
Output
A Sprite ID
HL Buffer address of the sprite
Creates an offset in HL using B.
GetSpriteID DD38 LD H,$00 H=00.
DD3A LD L,B L=B.
Creates an offset in DE using C.
DD3B LD D,H D=00.
DD3C LD E,C E=C.
Position Y * 20 to find the row + position X to find the column.
DD3D ADD HL,HL HL*=20+DE.
DD3E ADD HL,HL
DD3F ADD HL,HL
DD40 ADD HL,HL
DD41 ADD HL,HL
DD42 ADD HL,DE
The game buffer begins at 6800-6AFF which is 0300 screen locations (20x18).
DD43 LD A,H H+=68.
DD44 ADD A,$68
DD46 LD H,A
Fetch the sprite ID from this location.
DD47 LD A,(HL) A=*HL.
Never return with FF instead use 00.
DD48 CP $FF Return if A is not equal to FF.
DD4A RET NZ
DD4B XOR A A=00.
DD4C RET Return.
Prev: DCA1 Up: Map Next: DD4D