Prev: 54079 Up: Map Next: 54182
54099: Goldfish Game: Print Colour UDG
Prints one colour UDG at the current screen position. Identical clone of PrintColourCharacter; the non-colour version is PrintUDG.
Input
A Character to print
Point HL' at this character's pixels and DE' at the current screen cell.
GoldfishGame_PrintColourUDG 54099 EXX Switch to the shadow registers.
54100 LD E,A DE'=the character code*8.
54101 LD D,0
54103 SLA E
54105 RL D
54107 SLA E
54109 RL D
54111 SLA E
54113 RL D
54115 LD HL,(23606) HL'=*CHARS+DE'.
54118 ADD HL,DE
54119 LD DE,(23684) Advance *DF_CC and leave DE' on the cell just claimed.
54123 INC DE
54124 LD (23684),DE
54128 DEC DE
Copy the eight pixel rows into the screen buffer.
54129 LD B,8 B'=8.
PrintColourUDG_Loop 54131 LD A,(HL) Copy one pixel row and move down one screen line.
54132 LD (DE),A
54133 INC HL
54134 INC D
54135 DJNZ PrintColourUDG_Loop Decrease the row counter and loop back to PrintColourUDG_Loop until all 8 rows are written.
Write *ATTR_T into the matching attribute cell.
54137 LD BC,(23688) BC'=*S_POSN.
54141 LD HL,22528 HL'=22528.
54144 DEC C Advance the print column in *S_POSN.
54145 LD (23688),BC
54149 INC C
54150 LD A,33 HL'+=33-C' (0-based column).
54152 SUB C
54153 LD E,A
54154 LD D,0
54156 ADD HL,DE
54157 LD A,24 E'=24-B' (0-based row).
54159 SUB B
54160 LD E,A
54161 SLA E Multiply the row by 32 and add it to the attribute address.
54163 SLA E
54165 SLA E
54167 SLA E
54169 RL D
54171 SLA E
54173 RL D
54175 ADD HL,DE
54176 LD A,(23695) Write *ATTR_T to that attribute cell.
54179 LD (HL),A
54180 EXX Switch back to the normal registers.
54181 RET Return.
Prev: 54079 Up: Map Next: 54182