Prev: FB5A Up: Map Next: FB8E
FB5B: Print String
Input
BC Screen co-ordinate
HL Pointer to string data
PrintString FB5B LD A,(HL) Fetch the character.
FB5C AND %01111111 Keep only bits 0-6.
FB5E PUSH HL Stash HL on the stack.
FB5F SUB $20 A-=20.
FB61 LD H,$00 Create an offset using HL.
FB63 LD L,A
FB64 ADD HL,HL HL*=08.
FB65 ADD HL,HL
FB66 ADD HL,HL
FB67 LD A,H H+=3D.
FB68 ADD A,$3D
FB6A LD H,A
FB6B LD A,B A=B.
FB6C AND %11111000 Keep only bits 3-7.
FB6E ADD A,$6B A+=6B.
FB70 LD D,A D=A.
FB71 LD A,B A=B.
FB72 AND %00000111 Keep only bits 0-2.
FB74 RRCA RRCA.
FB75 RRCA
FB76 RRCA
FB77 ADD A,C A+=C.
FB78 LD E,A E=A.
FB79 PUSH BC Stash BC on the stack.
FB7A LD B,$08 B=08.
PrintString_Loop FB7C LD A,(HL) A=*HL.
FB7D SRL A Shift A right.
FB7F OR (HL) Set the bits from *HL.
FB80 LD (DE),A Write A to *DE.
FB81 INC HL Increment HL by one.
FB82 INC D Increment D by one.
FB83 DJNZ PrintString_Loop Decrease counter by one and loop back to PrintString_Loop until counter is zero.
FB85 POP BC Restore BC from the stack.
FB86 INC C Increment C by one.
FB87 POP HL Restore HL from the stack.
FB88 BIT 7,(HL) Return if bit 7 of *HL is set.
FB8A RET NZ
FB8B INC HL Increment HL by one.
FB8C JR PrintString Jump to PrintString.
Prev: FB5A Up: Map Next: FB8E