Prev: 45536 Up: Map Next: 45685
45556: Print Outlaw Name
Used by the routine at DrawTownPanel.
Prints the name of the outlaw who is wanted at the current level on the wanted poster. The name has two parts, printed on two lines. Each part is centred.
outlaw-name
Find the two parts of the name.
PrintOutlawName 45556 LD HL,46248 Point HL at the table of names.
45559 LD A,(41568) Fetch the level.
45562 ADD A,A Double it, as there are two parts for each level.
45563 LD B,A Keep the doubled level in B, one part per level.
45564 JR Z,PrintOutlawName_Found Jump to PrintOutlawName_Found if this is the first level.
PrintOutlawName_Skip 45566 BIT 7,(HL) Test whether this is the last character of a part.
45568 INC HL Move on to the next character.
45569 JR Z,PrintOutlawName_Skip Loop back until the end of the part.
45571 DJNZ PrintOutlawName_Skip Loop back until the right parts have been reached.
PrintOutlawName_Found 45573 PUSH HL Copy HL to IY (using the stack).
45574 POP IY
Print the first part.
45576 LD DE,16515 Point DE at 16515 (in the screen buffer).
45579 CALL PrintOutlawName_Part Call PrintOutlawName_Part to print it.
Print the second part.
45582 LD DE,16547 Point DE at 16547 (in the screen buffer).
Print a part of the name, centred on the screen address in DE. If the part has an even number of characters it is centred exactly, and otherwise it is half a character to the right, using a table which shifts a row of pixels right by four.
PrintOutlawName_Part 45585 PUSH IY Copy IY to HL (using the stack).
45587 POP HL
45588 XOR A Set the number of characters to zero.
PrintOutlawName_Count 45589 BIT 7,(HL) Jump to PrintOutlawName_Centre if this is the last character.
45591 JR NZ,PrintOutlawName_Centre
45593 INC HL Move on to the next character.
45594 INC A Add one to the number of characters.
45595 JR PrintOutlawName_Count Go back to check the next character.
PrintOutlawName_Centre 45597 PUSH AF Stash the number of characters, less one, on the stack.
45598 CPL Invert it.
45599 AND %00000001 Keep bit 0.
45601 LD (41491),A Store it, which is one if there is an odd number of characters.
45604 POP AF Retrieve the number of characters.
45605 SRL A Halve it.
45607 NEG Negate it.
45609 ADD A,E Add the horizontal position of the screen address.
45610 LD E,A Move to the left by half the length.
Print the next character.
PrintOutlawName_Character 45611 LD A,(IY+0) Fetch the character.
45614 AND %01111111 Remove the terminator.
45616 CALL ConvertCharacter Convert the character to the number of its tile.
45619 LD L,A Copy the number into L.
45620 LD H,0 Clear H.
45622 ADD HL,HL Multiply it by eight.
45623 ADD HL,HL
45624 ADD HL,HL
45625 LD BC,36520 Point BC at Font.
45628 ADD HL,BC Find the pixels of the character.
45629 EX DE,HL Swap the pixels into DE and the screen address into HL.
45630 LD A,(41491) Fetch the flag.
45633 AND A Jump to PrintOutlawName_Aligned if there is an even number of characters.
45634 JR Z,PrintOutlawName_Aligned
There is an odd number of characters, so shift each character four pixels to the right across two cells.
45636 LD B,252 Point B at the table which shifts a byte by four pixels.
45638 LD A,8 Set the number of rows to eight.
PrintOutlawName_ShiftedRow 45640 EX AF,AF' Keep the number of rows in the alternate accumulator.
45641 LD A,(DE) Fetch a row of pixels.
45642 INC DE Move on to the next row.
45643 LD C,A Use them as an index into the table.
45644 LD A,(BC) Fetch the left part of the shifted byte.
45645 OR (HL) Combine it with the screen.
45646 LD (HL),A Write it to the screen.
45647 INC L Move across to the next cell.
45648 INC B Point B at the other half of the table.
45649 LD A,(BC) Fetch the right part of the shifted byte.
45650 DEC B Point B back at the first half of the table.
45651 OR (HL) Combine it with the screen.
45652 LD (HL),A Write it to the screen.
45653 DEC L Move back to the first cell.
45654 INC H Move down a pixel row.
45655 EX AF,AF' Fetch the number of rows.
45656 DEC A Count down the rows.
45657 JR NZ,PrintOutlawName_ShiftedRow Loop back until all eight rows have been drawn.
PrintOutlawName_Next 45659 LD A,H Fetch the high byte of the screen address.
45660 SUB 8 Move back up to the top of the character.
45662 LD H,A Keep the high byte of the screen address.
45663 INC L Move across to the next cell.
45664 INC IY Move on to the next character.
45666 EX DE,HL Swap the screen address into DE.
45667 BIT 7,(IY-1) Test whether this was the last character.
45671 RET NZ Return if it was.
45672 JR PrintOutlawName_Character Go back for the next character.
There is an even number of characters, so copy each character to the screen.
PrintOutlawName_Aligned 45674 LD B,8 Set the number of rows to eight.
PrintOutlawName_AlignedRow 45676 LD A,(DE) Fetch a row of pixels.
45677 INC DE Move on to the next row.
45678 OR (HL) Combine it with the screen.
45679 LD (HL),A Write it to the screen.
45680 INC H Move down a pixel row.
45681 DJNZ PrintOutlawName_AlignedRow Loop back until all eight rows have been drawn.
45683 JR PrintOutlawName_Next Go back to finish the character.
Prev: 45536 Up: Map Next: 45685