Routines

26318: Return message character code in A


Used by routines at 26513, 27144 and 27419

H Page number of buffer being used to decode message

26318 2E10 LD L,16
26320 7E LD A,(HL)
26321 A7 AND A Are we working on a sub-submessage?
26322 2008 JR NZ,26332 Jump if so
26324 2E0E LD L,14
26326 7E LD A,(HL)
26327 A7 AND A Are we working on a submessage?
26328 2002 JR NZ,26332 Jump if so
26330 2E0C LD L,12 We're working on a top-level message
26332 56 LD D,(HL)
26333 2D DEC L
26334 5E LD E,(HL) DE=address of character in message
26335 1A LD A,(DE) Pick up the character
26336 13 INC DE Move pointer to next character
and store the address for later reference
26337 73 LD (HL),E
26338 2C INC L
26339 72 LD (HL),D
26340 A7 AND A Has the end of the (sub)(sub)message been reached?
26341 2009 JR NZ,26352 Jump if not
26343 3600 LD (HL),0 Signal: end of (sub)(sub)message
26345 2D DEC L L=11, 13 (submessage) or 15 (sub-submessage)
26346 CB55 BIT 2,L Has end of top-level message been reached?
26348 C8 RET Z Return if so
26349 2D DEC L Otherwise go up to submessage or top-level message
and jump back to deal with it
26350 18EC JR 26332
26352 D620 SUB 32
26354 FE60 CP 96
26356 3003 JR NC,26361 Jump with codes 1-31 or 128 onwards
26358 C620 ADD A,32
26360 C9 RET Return with standard ASCII code in A
26361 C620 ADD A,32
26363 FE03 CP 3
26365 D8 RET C Return with codes 0, 1 and 2 (end of line)
26366 5F LD E,A
26367 16FE LD D,254
26369 2C INC L
26370 1A LD A,(DE) A=LSB of address of (sub)(sub)message
26371 77 LD (HL),A Store it in the buffer
26372 2C INC L
26373 14 INC D
26374 1A LD A,(DE) A=MSB of address of (sub)(sub)message
26375 77 LD (HL),A Store it in the buffer
26376 18D2 JR 26332 Jump back to collect character code from this (sub)(sub)message