Prev: 27418 Up: Map Next: 27461
27419: Write a line of text into a graphic buffer
Used by the routines at 20665 and 27462. Writes a line of text into a graphic buffer (at 23296 or 58408) and centres it.
Input
DE Message address
HL Buffer address
27419 LD (54795),DE Save the message address in bytes 11 and 12 of the character buffer in page 214
This entry point is used by the routine at 27462 to write the second line of text into the message box graphic buffer at 58408.
27423 PUSH HL Copy the buffer address to HL'
27424 EXX
27425 POP HL
27426 LD BC,0 B=0 (during startup) or 64, C=0 (this instruction is set to LD BC,16384 before the game starts; see 21408)
27429 LD (HL),C Create 64 (or 256) empty pixel columns in the buffer
27430 INC HL
27431 DJNZ 27429
27433 DEC HL
27434 EXX
27435 LD H,214 We are using the character buffer in page 214 to process the message
27437 LD C,255 The message box is 255 (during startup) or 64 pixels wide (this instruction is set to LD C,64 before the game starts; see 21408)
27439 CALL 26318 A=ASCII code of the next character in the message
27442 CP 3 Is the ASCII code 0, 1 or 2 (end of line)?
27444 JR C,27451 Jump if so to centre the text
27446 CALL 27110 Slide the bitmap for CHR$(A) into the buffer
27449 JR 27439 Jump back to do the next character
27451 SRL C Now C=half the number of unused pixel columns left in the buffer
27453 RET Z Return if this is zero (the buffer is full)
27454 CALL 27124 Create C empty pixel columns in the buffer, thus centring the message
27457 DEC C
27458 JR NZ,27454
27460 RET
Prev: 27418 Up: Map Next: 27461