Prev: 46784 Up: Map Next: 46873
46837: Splice numeric data A as a string into a string at HL
Used by the routines at 38024, 40489, 42938, 43000, 45522 and 46463.
Input
A Numeric value to put into string
HL Address of string to modify
46837 PUSH HL Store HL (address of string to modify)
46838 LD HL,23430 Point HL at destination location for ASCII string
46841 LD B,0 Load numeric value into BC...
46843 LD C,A ...
46844 CALL 47797 Convert numeric value BC to ASCII string at address in HL (23430)
46847 LD HL,23432 Point HL at third digit in converted five-digit string
46850 LD C,2 Load C with 2 (as we can have up to two leading zeroes on a three-digit number)
46852 LD A,(HL) Load ASCII character at HL into A
46853 CP 48 If character is not a zero ("0")...
46855 JR NZ,46863 ...then skip ahead to 46863
46857 LD (HL),32 Replace the zero character with a space (i.e. remove leading zeroes from number)
46859 INC HL Advance to next character in string
46860 DEC C Decrease C (number of remaining digits to process)
46861 JR NZ,46852 Loop back to 46852 if there are still digits to process
46863 POP DE Restore pointer to "numeric text" (originally in HL at start of this routine) into DE
46864 LD HL,23432 Point HL at string just created
46867 LD BC,3 Splice ASCII string number just generated into "numeric data" text
46870 LDIR ...
46872 RET Return
Prev: 46784 Up: Map Next: 46873