Prev: 50045 Up: Map Next: 50197
50056: Print Character
Used by the routines at PrintDateBar, 49660, 49737, 49777, 49850 and 49942.
Input
A Character to print
HL Screen buffer address
PrintCharacter 50056 PUSH AF Stash AF, BC, DE and HL on the stack.
50057 PUSH BC
50058 PUSH DE
50059 PUSH HL
50060 LD L,A Load the character into HL.
50061 LD H,0
50063 ADD HL,HL Multiply by 8 (each font character is 8 bytes of data).
50064 ADD HL,HL
50065 ADD HL,HL
50066 LD DE,15360 DE+=15360 (CHARSET-256).
50069 ADD HL,DE
50070 EX DE,HL
50071 POP HL Restore the screen buffer address from the stack.
50072 PUSH HL But stash a copy of it back on the stack.
50073 LD B,8 Set a counter in B for 8 bytes of the font data.
PrintCharacter_0 50075 LD A,(DE) A=*DE.
50076 PUSH BC Stash BC and AF on the stack.
50077 PUSH AF
50078 DEC C Decrease C by one.
50079 INC C Increment C by one.
50080 LD B,255 B=255.
50082 JR Z,PrintCharacter_2 Jump to PrintCharacter_2 if C is zero.
PrintCharacter_1 50084 SRL A Shift A right.
50086 SRL B Shift B right.
50088 DEC C Decrease C by one.
50089 JR NZ,PrintCharacter_1 Jump to PrintCharacter_1 if C is not zero.
PrintCharacter_2 50091 LD C,A C=A.
50092 LD A,B A=B.
50093 CPL Invert the bits in A.
50094 AND (HL) Merge the bits from *HL.
50095 OR C Set the bits from C.
50096 LD (HL),A Write A to *HL.
50097 POP AF Restore AF and BC from the stack.
50098 POP BC
50099 DEC C Decrease C by one.
50100 INC C Increment C by one.
50101 JR Z,PrintCharacter_4 Jump to PrintCharacter_4 if C is equal to C.
50103 PUSH BC Stash BC and AF on the stack.
50104 PUSH AF
50105 LD A,8 A=8.
50107 SUB C A-=C.
50108 LD C,A C=A.
50109 POP AF Restore AF from the stack.
50110 LD B,255 B=255.
PrintCharacter_3 50112 SLA A Shift A left (with carry).
50114 SLA B Shift B left (with carry).
50116 DEC C Decrease C by one.
50117 JR NZ,PrintCharacter_3 Jump to PrintCharacter_3 if C is not equal to C.
50119 LD C,A C=A.
50120 LD A,B A=B.
50121 CPL Invert the bits in A.
50122 INC HL Increment HL by one.
50123 AND (HL) Merge the bits from *HL.
50124 OR C Set the bits from C.
50125 LD (HL),A Write A to *HL.
50126 DEC HL Decrease HL by one.
50127 POP BC Restore BC from the stack.
PrintCharacter_4 50128 INC DE Increment DE by one.
50129 INC H Increment H by one.
50130 DJNZ PrintCharacter_0 Decrease counter by one and loop back to PrintCharacter_0 until counter is zero.
50132 POP HL Restore HL, DE and BC from the stack.
50133 POP DE
50134 POP BC
50135 LD A,C A=C.
50136 ADD A,7 A+=7.
50138 CP 8 Compare A with 8.
50140 JR C,PrintCharacter_5 Jump to PrintCharacter_5 if A is less than 8.
50142 SUB 8 A-=8.
50144 INC L Increment L by one.
PrintCharacter_5 50145 LD C,A C=A.
50146 POP AF Restore AF from the stack.
50147 RET Return.
This entry point is used by the routine at 49942.
PrintCharacter_6 50148 LD A,(40968) A=*40968.
50151 AND A Set flags.
50152 RET Z Return if L is equal to A.
50153 PUSH HL Stash HL, DE and BC on the stack.
50154 PUSH DE
50155 PUSH BC
50156 LD HL,16384 HL=16384.
50159 LD B,8 B=8.
PrintCharacter_7 50161 PUSH BC Stash BC and HL on the stack.
50162 PUSH HL
50163 CALL PrintCharacter_8 Call PrintCharacter_8.
50166 POP HL Restore HL from the stack.
50167 INC H Increment H by one.
50168 POP BC Restore BC from the stack.
50169 DJNZ PrintCharacter_7 Decrease counter by one and loop back to PrintCharacter_7 until counter is zero.
50171 LD A,4 A=4.
50173 OUT (251),A OUT 251
50175 POP BC Restore BC, DE and HL from the stack.
50176 POP DE
50177 POP HL
50178 RET Return.
PrintCharacter_8 50179 LD A,B A=B.
50180 CP 3 Compare A with 3.
50182 SBC A,A A-=A.
50183 AND %00000010 Keep only bits 1.
50185 OUT (251),A OUT 251
50187 LD D,A D=A.
PrintCharacter_9 50188 IN A,(251) A=byte from port 251.
50190 ADD A,A A+=A.
50191 RET M Return if A is lower than 3.
50192 JR NC,PrintCharacter_9 Jump to PrintCharacter_9 if A is greater than or equal to 3.
50194 JP 3858 Jump to COPY_LINE#0F12.
Prev: 50045 Up: Map Next: 50197