Prev: 8576 Up: Map Next: 869B
867A: Print Character
Used by the routine at 8576.
Input
A ASCII value of character to print
Prints using the standard ZX Spectrum CHARSET.
PrintChar 867A PUSH AF Push AF, BC, DE and HL on the stack.
867B PUSH BC
867C PUSH DE
867D PUSH HL
867E SUB $20 Create offset for the font graphic data look-up. For example;
Letter ASCII Value SUB $20 * 8 CHARSET + offset
"A" $41 $21 $108 $3E08
"Q" $51 $31 $188 $3E88
"a" $61 $41 $208 $3F08
8680 LD L,A
8681 LD H,$00
8683 ADD HL,HL
8684 ADD HL,HL
8685 ADD HL,HL
8686 LD DE,$3D00 Calculate font graphic data address using CHARSET + offset.
8689 ADD HL,DE
868A EX DE,HL Store the result in DE, restore the screen location to HL.
868B POP HL
868C PUSH HL
868D LD B,$08 Set a counter for $08 lines.
PrintChar_Loop 868F LD A,(DE) Fetch the font byte and copy it to the screen.
8690 LD (HL),A
8691 INC DE Move onto the next font data byte.
8692 INC H Move the screen pointer down one row.
8693 DJNZ PrintChar_Loop Decrease counter by one and loop back to PrintChar_Loop until counter is zero.
8695 POP HL Restore HL, DE, BC and AF off the stack.
8696 POP DE
8697 POP BC
8698 POP AF
8699 INC L Move the screen pointer across one column, ready for printing the next character.
869A RET Return.
Prev: 8576 Up: Map Next: 869B