Prev: 34627 Up: Map Next: 34733
34697: Splice numeric data A as a string into a string at HL
Used by the routines at 30533, 30583, 30643 and 33657.
A Numeric value to put into string
HL Address of string to modify
34697 PUSH HL Store HL (address of string to modify)
34698 LD HL,23464 Point HL at destination location for ASCII string
34701 LD B,0 Load numeric value into BC...
34703 LD C,A ...
34704 CALL 35591 Convert numeric value BC to ASCII string at address in HL (23464)
34707 LD HL,23466 Point HL at third digit in converted five-digit string
34710 LD C,2 Load C with 2 (as we can have up to two leading zeroes on a three-digit number)
34712 LD A,(HL) Load ASCII character at HL into A
34713 CP 48 If character is not a zero ("0")...
34715 JR NZ,34723 ...then skip ahead to 34723
34717 LD (HL),32 Replace the zero character with a space (i.e. remove leading zeroes from number)
34719 INC HL Advance to next character in string
34720 DEC C Decrease C (number of remaining digits to process)
34721 JR NZ,34712 Loop back to 34712 if there are still digits to process
34723 POP DE Restore pointer to "numeric text" (originally in HL at start of this routine) into DE
34724 LD HL,23466 Point HL at string just created
34727 LD BC,3 Splice ASCII string number just generated into "numeric data" text
34730 LDIR ...
34732 RET Return
Prev: 34627 Up: Map Next: 34733