Prev: B1E0 Up: Map Next: B275
B1F4: 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 B1F4 LD HL,$B4A8 Point HL at the table of names.
B1F7 LD A,($A260) Fetch the level.
B1FA ADD A,A Double it, as there are two parts for each level.
B1FB LD B,A Keep the doubled level in B, one part per level.
B1FC JR Z,PrintOutlawName_Found Jump to PrintOutlawName_Found if this is the first level.
PrintOutlawName_Skip B1FE BIT 7,(HL) Test whether this is the last character of a part.
B200 INC HL Move on to the next character.
B201 JR Z,PrintOutlawName_Skip Loop back until the end of the part.
B203 DJNZ PrintOutlawName_Skip Loop back until the right parts have been reached.
PrintOutlawName_Found B205 PUSH HL Copy HL to IY (using the stack).
B206 POP IY
Print the first part.
B208 LD DE,$4083 Point DE at 4083 (in the screen buffer).
B20B CALL PrintOutlawName_Part Call PrintOutlawName_Part to print it.
Print the second part.
B20E LD DE,$40A3 Point DE at 40A3 (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 B211 PUSH IY Copy IY to HL (using the stack).
B213 POP HL
B214 XOR A Set the number of characters to zero.
PrintOutlawName_Count B215 BIT 7,(HL) Jump to PrintOutlawName_Centre if this is the last character.
B217 JR NZ,PrintOutlawName_Centre
B219 INC HL Move on to the next character.
B21A INC A Add one to the number of characters.
B21B JR PrintOutlawName_Count Go back to check the next character.
PrintOutlawName_Centre B21D PUSH AF Stash the number of characters, less one, on the stack.
B21E CPL Invert it.
B21F AND %00000001 Keep bit 0.
B221 LD ($A213),A Store it, which is one if there is an odd number of characters.
B224 POP AF Retrieve the number of characters.
B225 SRL A Halve it.
B227 NEG Negate it.
B229 ADD A,E Add the horizontal position of the screen address.
B22A LD E,A Move to the left by half the length.
Print the next character.
PrintOutlawName_Character B22B LD A,(IY+$00) Fetch the character.
B22E AND %01111111 Remove the terminator.
B230 CALL ConvertCharacter Convert the character to the number of its tile.
B233 LD L,A Copy the number into L.
B234 LD H,$00 Clear H.
B236 ADD HL,HL Multiply it by eight.
B237 ADD HL,HL
B238 ADD HL,HL
B239 LD BC,$8EA8 Point BC at Font.
B23C ADD HL,BC Find the pixels of the character.
B23D EX DE,HL Swap the pixels into DE and the screen address into HL.
B23E LD A,($A213) Fetch the flag.
B241 AND A Jump to PrintOutlawName_Aligned if there is an even number of characters.
B242 JR Z,PrintOutlawName_Aligned
There is an odd number of characters, so shift each character four pixels to the right across two cells.
B244 LD B,$FC Point B at the table which shifts a byte by four pixels.
B246 LD A,$08 Set the number of rows to eight.
PrintOutlawName_ShiftedRow B248 EX AF,AF' Keep the number of rows in the alternate accumulator.
B249 LD A,(DE) Fetch a row of pixels.
B24A INC DE Move on to the next row.
B24B LD C,A Use them as an index into the table.
B24C LD A,(BC) Fetch the left part of the shifted byte.
B24D OR (HL) Combine it with the screen.
B24E LD (HL),A Write it to the screen.
B24F INC L Move across to the next cell.
B250 INC B Point B at the other half of the table.
B251 LD A,(BC) Fetch the right part of the shifted byte.
B252 DEC B Point B back at the first half of the table.
B253 OR (HL) Combine it with the screen.
B254 LD (HL),A Write it to the screen.
B255 DEC L Move back to the first cell.
B256 INC H Move down a pixel row.
B257 EX AF,AF' Fetch the number of rows.
B258 DEC A Count down the rows.
B259 JR NZ,PrintOutlawName_ShiftedRow Loop back until all eight rows have been drawn.
PrintOutlawName_Next B25B LD A,H Fetch the high byte of the screen address.
B25C SUB $08 Move back up to the top of the character.
B25E LD H,A Keep the high byte of the screen address.
B25F INC L Move across to the next cell.
B260 INC IY Move on to the next character.
B262 EX DE,HL Swap the screen address into DE.
B263 BIT 7,(IY-$01) Test whether this was the last character.
B267 RET NZ Return if it was.
B268 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 B26A LD B,$08 Set the number of rows to eight.
PrintOutlawName_AlignedRow B26C LD A,(DE) Fetch a row of pixels.
B26D INC DE Move on to the next row.
B26E OR (HL) Combine it with the screen.
B26F LD (HL),A Write it to the screen.
B270 INC H Move down a pixel row.
B271 DJNZ PrintOutlawName_AlignedRow Loop back until all eight rows have been drawn.
B273 JR PrintOutlawName_Next Go back to finish the character.
Prev: B1E0 Up: Map Next: B275