Prev: 37604 Up: Map Next: 37676
37631: Expand Time Byte To ASCII
Time_Counter 37631 DEFB 240,216 Guessing at the length.
37633 DEFB 24,252
37635 DEFB 156,255
37637 DEFB 246,255
37639 DEFB 255,255 Terminator.
On entry HL contains the time as the LSB, e.g. for 30s HL will be 0030.
Process_Time 37641 PUSH HL Pushes HL, DE and BC onto the stack.
37642 PUSH DE
37643 PUSH BC
37644 LD DE,37631 Point to Time_Counter.
Process_Time_Loop 37647 LD A,(DE) Load the next byte pair from the address pointer into BC.
37648 LD C,A
37649 INC DE
37650 LD A,(DE)
37651 LD B,A
37652 INC DE Increase the address pointer by one and stash it on the stack for later.
37653 PUSH DE
37654 LD A,47 Store 47 in A.
Count "up" from ASCII "0" until the correct representation is reached.
Process_Time_Char 37656 INC A Increment A by one (so on the first pass A will now contain ASCII "0").
37657 LD D,H Copy the remaining time into DE.
37658 LD E,L
37659 ADD HL,BC Adds the remaining time to the 16-bit number held in BC.
37660 JR C,Process_Time_Char If the carry flag is set loop back to Process_Time_Char.
37662 EX DE,HL Swap the DE and HL registers.
37663 LD (IX+0),A Write the processed ASCII number character to the time print buffer.
37666 INC IX Increment IX by one to process the next character in the time buffer once looped around.
37668 POP DE Restore the byte pair address pointer from the stack.
37669 INC C Loop back to Process_Time_Loop until the terminator is reached (255+1 will set the zero flag).
37670 JR NZ,Process_Time_Loop
37672 POP BC Restores BC, DE and HL from the stack.
37673 POP DE
37674 POP HL
37675 RET Return.
Prev: 37604 Up: Map Next: 37676