Prev: B77B Up: Map Next: B7F9
B7BA: Print a graphic on screen
Used by the routines at B84B and E36D.
Input
HL The address of the graphic
A The frame number
D The y co-ordinate
E The x co-ordinate
C The attribute to use
B7BA PUSH AF Push the main registers.
B7BB PUSH HL
B7BC PUSH BC
B7BD PUSH DE
B7BE EX DE,HL Swap DE and HL.
B7BF PUSH HL Remember HL.
B7C0 LD D,$58 Point D at the attributes buffer.
B7C2 LD E,L Point E to the low byte of the graphics address.
B7C3 LD L,H Put the high byte in HL.
B7C4 LD H,$00
B7C6 ADD HL,HL Multiply by 16.
B7C7 ADD HL,HL
B7C8 ADD HL,HL
B7C9 ADD HL,HL
B7CA ADD HL,HL
B7CB ADD HL,DE Add the remaining portion to get an attribute address.
B7CC LD (HL),C Set the attribute.
B7CD POP HL Restore HL.
B7CE LD L,H Start at row 0.
B7CF LD D,$00
B7D1 LD H,D Put the current row in H.
B7D2 PUSH DE Remember DE.
B7D3 ADD HL,HL Multiply HL by 16 to get a suitable offset.
B7D4 ADD HL,HL
B7D5 ADD HL,HL
B7D6 ADD HL,HL
B7D7 LD DE,$81F8 Add the base address of the screen offsets table. (81F8)
B7DA ADD HL,DE
B7DB LD E,(HL) Put the actual address in DE.
B7DC INC HL
B7DD LD D,(HL)
B7DE EX DE,HL Swap DE and HL.
B7DF POP DE Restore DE.
B7E0 ADD HL,DE Add the row and column offset.
B7E1 EX DE,HL Swap DE and HL.
B7E2 LD L,A Put the frame ID in HL.
B7E3 LD H,$00
B7E5 ADD HL,HL Multiply it by 8 to get a suitable offset.
B7E6 ADD HL,HL
B7E7 ADD HL,HL
B7E8 LD BC,$DFDC Add a specific offset. This offset is modified by code elsewhere.
B7EB ADD HL,BC
Draw an 8x8 UDG block.
B7EC LD B,$08 8 rows to draw.
B7EE LD A,(HL) Get the graphic data.
B7EF LD (DE),A Put it on screen.
B7F0 INC HL Move to the next graphic data.
B7F1 INC D Move to the next row.
B7F2 DJNZ $B7EE Loop while there are more rows to draw.
All drawing done.
B7F4 POP DE Restore the main registers and return.
B7F5 POP BC
B7F6 POP HL
B7F7 POP AF
B7F8 RET
Prev: B77B Up: Map Next: B7F9