Prev: 41453 Up: Map Next: 41564
41460: Print Compressed String
Prints a compressed text string using a dictionary lookup.
Input
HL Messaging string ID
PrintCompressedString 41460 PUSH IX Stash IX, HL, DE, BC and AF on the stack.
41462 PUSH HL
41463 PUSH DE
41464 PUSH BC
41465 PUSH AF
41466 ADD HL,HL Double the messaging string ID held in HL.
41467 EX DE,HL Add the result to Table_MessagingOffsets.
41468 LD IX,51755
41472 ADD IX,DE
41474 LD L,(IX+0) Fetch the address from the string pointer table and store it in HL.
41477 LD H,(IX+1)
41480 LD DE,51433 HL+=Data_Strings.
41483 ADD HL,DE
41484 JR PrintCompressedString_4 Jump to PrintCompressedString_4.
PrintCompressedString_0 41486 CP 96 Jump to PrintCompressedString_1 if A is less than 96.
41488 JR C,PrintCompressedString_1
41490 CALL PrintCompressedString_5 Call PrintCompressedString_5.
41493 JR PrintCompressedString_3 Jump to PrintCompressedString_3.
PrintCompressedString_1 41495 ADD A,32 A+=32.
41497 CP 126 Jump to PrintCompressedString_2 if A is not equal to 126.
41499 JR NZ,PrintCompressedString_2
41501 LD A,13 A=13.
PrintCompressedString_2 41503 CALL PrintCharacter Call PrintCharacter.
PrintCompressedString_3 41506 INC HL Increment HL by one.
PrintCompressedString_4 41507 LD A,(HL) A=*HL.
41508 CP 95 Jump to PrintCompressedString_0 if A is not equal to 95.
41510 JR NZ,PrintCompressedString_0
41512 POP AF Restore AF, BC, DE, HL and IX from the stack.
41513 POP BC
41514 POP DE
41515 POP HL
41516 POP IX
41518 RET Return.
PrintCompressedString_5 41519 PUSH HL Stash HL, DE and BC on the stack.
41520 PUSH DE
41521 PUSH BC
41522 SUB 96 A-=96.
41524 LD L,A Create an offset in HL using A.
41525 LD H,0
41527 ADD HL,HL Double the offset held in HL.
41528 LD DE,51435 HL+=51435.
41531 ADD HL,DE
41532 LD B,2 B=2.
41534 JR PrintCompressedString_7 Jump to PrintCompressedString_7.
PrintCompressedString_6 41536 INC HL Increment HL by one.
PrintCompressedString_7 41537 LD A,(HL) A=*HL.
41538 CP 96 Jump to PrintCompressedString_8 if A is less than 96.
41540 JR C,PrintCompressedString_8
41542 CALL PrintCompressedString_5 Call PrintCompressedString_5.
41545 JR PrintCompressedString_10 Jump to PrintCompressedString_10.
PrintCompressedString_8 41547 ADD A,32 A+=32.
41549 CP 126 Jump to PrintCompressedString_9 if A is not equal to 126.
41551 JR NZ,PrintCompressedString_9
41553 LD A,13 A=13.
PrintCompressedString_9 41555 CALL PrintCharacter Call PrintCharacter.
PrintCompressedString_10 41558 DJNZ PrintCompressedString_6 Decrease counter by one and loop back to PrintCompressedString_6 until counter is zero.
41560 POP BC Restore BC, DE and HL from the stack.
41561 POP DE
41562 POP HL
41563 RET Return.
Prev: 41453 Up: Map Next: 41564