Prev: 34667 Up: Map Next: 34850
34761: Print Proper Character
Used by the routines at 34459 and ScrollLine.
Input
A ASCII value
C Bit offset
HL Target screen location
Prints using the custom font.
PrintPropChar 34761 PUSH AF Push AF, BC, DE and HL on the stack.
34762 PUSH BC
34763 PUSH DE
34764 PUSH HL
Calculate font graphic address, some examples would be;
Letter ASCII * 8 Sum Font Graphic Address
"!" 033 264 (033 * 8) + $8722 34858
"A" 065 520 (065 * 8) + $8722 35114
"a" 097 776 (097 * 8) + $8722 35370
34765 LD L,A Store the offset for the font graphic data look-up in HL.
34766 LD H,0
Calculate font graphic data address.
34768 ADD HL,HL HL=(HL * 8) + 34594
34769 ADD HL,HL
34770 ADD HL,HL
34771 LD DE,34594
34774 ADD HL,DE
34775 EX DE,HL Store the result in DE, restore the screen location to HL.
34776 POP HL
34777 PUSH HL
34778 LD B,8 Set a counter for $08 lines.
PrintPropChar_Loop 34780 LD A,(DE) A=byte of font graphic data
34781 PUSH BC Stash the counter on the stack temporarily.
34782 DEC C
34783 INC C
34784 LD B,255 B=255 as a mask.
34786 JR Z,PrintPropChar_SkipShift
PrintPropChar_Shift 34788 SRL A Shift the font graphic data left.
34790 SRL B Shift the mask data left.
34792 DEC C Decrease C by one.
34793 JR NZ,PrintPropChar_Shift Loop back to PrintPropChar_Shift until we've shifted by the number of bits specified in C.
PrintPropChar_SkipShift 34795 LD C,A Stash the font graphic data in C.
34796 LD A,B A=invert the shifted mask.
34797 CPL
34798 AND (HL) Merge the mask with the existing data in the screen buffer.
34799 OR C OR the font graphic data.
34800 LD (HL),A Copy the processed font graphic data to the screen.
34801 POP BC Restore the counter off the stack.
34802 DEC C
34803 INC C
34804 JR Z,PrintPropChar_1
34806 PUSH BC
34807 LD A,8
34809 SUB C
34810 LD C,A
34811 LD A,(DE)
34812 LD B,255
PrintPropChar_0 34814 SLA A
34816 SLA B
34818 DEC C
34819 JR NZ,PrintPropChar_0
34821 LD C,A
34822 LD A,B
34823 CPL
34824 INC HL
34825 AND (HL)
34826 OR C
34827 LD (HL),A
34828 DEC HL
34829 POP BC
PrintPropChar_1 34830 INC DE
34831 INC H
34832 DJNZ PrintPropChar_Loop Decrease counter by one and loop back to PrintPropChar_Loop until counter is zero.
34834 POP HL Restore HL, DE and BC off the stack.
34835 POP DE
34836 POP BC
34837 LD A,C
34838 ADD A,6
34840 CP 8
34842 JR C,PrintPropChar_2
34844 SUB 8
34846 INC L
PrintPropChar_2 34847 LD C,A
34848 POP AF Restore AF off the stack.
34849 RET Return.
Prev: 34667 Up: Map Next: 34850