Prev: 7C33 Up: Map Next: 7C82
7C46: Draw item
This draws the required item at the specified screen address.
Used by the routine at draw_all_items.
Input
A Item index (type: item_t).
HL Screen address of item.
draw_item 7C46 PUSH HL Save screen address of item
7C47 EX AF,AF' Bank item index
Wipe the item's screen area.
7C48 LD B,$02 2 bytes / pixels wide
7C4A LD C,$10 16 pixels high
7C4C CALL screen_wipe Wipe the screen area pointed to by HL
Bail if no item.
7C4F POP HL Retrieve screen address
7C50 EX AF,AF' Retrieve item index
7C51 CP $FF Is the item index item_NONE? ($FF)
7C53 RET Z Return if so
Set screen attributes.
7C54 PUSH HL Save screen address again
7C55 LD H,$5A Set H to $5A which points HL at the attribute for the equivalent screen address
7C57 PUSH AF Save item index
7C58 LD BC,$DD69 Get the attribute byte for this item
7C5B ADD A,C
7C5C LD C,A
7C5D JR NC,draw_item_0
7C5F INC B
draw_item_0 7C60 LD A,(BC)
7C61 LD (HL),A Write two attribute bytes
7C62 INC L
7C63 LD (HL),A
Move to next attribute row.
7C64 DEC L Move HL back for the next row
7C65 SET 5,L Move HL to the next attribute row
7C67 LD (HL),A Write two attribute bytes
7C68 INC L
7C69 LD (HL),A
7C6A POP AF Retrieve item index
Plot bitmap.
7C6B ADD A,A Point HL at the definition for this item
7C6C LD C,A
7C6D ADD A,A
7C6E ADD A,C
7C6F LD C,A
7C70 LD B,$00
7C72 LD HL,$DD7D
7C75 ADD HL,BC
7C76 LD B,(HL) Fetch width
7C77 INC HL
7C78 LD C,(HL) Fetch height
7C79 INC HL
7C7A LD E,(HL) Fetch sprite data pointer
7C7B INC HL
7C7C LD D,(HL)
7C7D POP HL Retrieve screen address saved at 7C54
7C7E CALL plot_bitmap Plot the bitmap without masking
7C81 RET Return
Prev: 7C33 Up: Map Next: 7C82