Prev: F5F4 Up: Map Next: F662
F60A: Print Character
Input
A Character to print
Print_Character F60A PUSH AF Stash the character and IX on the stack.
F60B PUSH IX
F60D EXX Switch to the shadow registers.
F60E LD L,A HL=the character code*08.
F60F LD H,$00
F611 ADD HL,HL
F612 ADD HL,HL
F613 ADD HL,HL
F614 LD DE,($5C36) HL=*CHARS+HL.
F618 ADD HL,DE
F619 LD DE,($5C84) Advance *DF_CC and leave DE on the cell just claimed.
F61D INC DE
F61E LD ($5C84),DE
F622 DEC DE
Copy the eight pixel rows into the screen buffer.
F623 LD B,$08 Set the pixel-row counter to 08.
Print_Character_Target F625 LD A,(HL) Copy one pixel row and move down one screen line.
F626 LD (DE),A
F627 INC D
F628 INC HL
F629 DJNZ Print_Character_Target Decrease the row counter and loop back to Print_Character_Target until all 08 rows are written.
Write *ATTR_T into the matching attribute cell.
F62B LD BC,($5C88) Decrease the print column in *S_POSN.
F62F DEC C
F630 LD ($5C88),BC
F634 EX DE,HL Point HL at the matching attribute cell.
F635 DEC H
F636 LD A,H
F637 RRCA
F638 RRCA
F639 RRCA
F63A AND %00000011 Keep only bits 0-1 of the display-file high byte.
F63C OR %01011000 Set the attribute-file bit.
F63E LD H,A Merge the attribute-file high byte.
F63F LD A,($5C91) Jump to Print_Character_Continue if *MASK_T is set.
F642 OR A
F643 JR NZ,Print_Character_Continue
F645 LD A,($5C8F) Write *ATTR_T to that attribute cell.
F648 LD (HL),A
F649 EXX Switch back.
F64A POP IX Restore IX and the character from the stack.
F64C POP AF
F64D RET Return.
Print_Character_Continue F64E PUSH HL Merge the existing attribute through the mask.
F64F AND (HL)
F650 LD (HL),A
F651 LD HL,$5C8F Keep the paper bits from *ATTR_T.
F654 LD A,($5C91)
F657 XOR %11111111 Invert the mask.
F659 AND (HL) Merge the ink bits and write the attribute.
F65A POP HL
F65B OR (HL)
F65C LD (HL),A
F65D EXX Switch back.
F65E POP IX Restore IX and the character from the stack.
F660 POP AF
F661 RET Return.
View the equivalent code in Booty.
Prev: F5F4 Up: Map Next: F662