| Technician Ted | Routines | 
| Prev: 8177 | Up: Map | Next: 82D4 | 
| 
This routine is called between tape signals. It loads the buffer contents into memory, animates the onscreen graphics, and adjusts the timer.
 
 | ||||||||||
| 8277 | PUSH DE | Store the base of the animation queue for later | ||||||||
| 8278 | LD L,A | Store the low byte | ||||||||
| 8279 | XOR A | Clear this value as it is being dealt with | ||||||||
| 827A | LD (DE),A | |||||||||
| 827B | LD H,$80 | Run everything from 8000 - 80FF | ||||||||
| 827D | LD A,(HL) | Get the current speed hash | ||||||||
| 827E | INC HL | |||||||||
| 827F | ADD A,(HL) | Add on the speed value | ||||||||
| 8280 | DEC HL | |||||||||
| 8281 | LD (HL),A | Store the new hash | ||||||||
| 8282 | INC HL | Now point to the onscreen address | ||||||||
| 8283 | INC HL | |||||||||
| 8284 | PUSH BC | |||||||||
| 8285 | LD A,L | Are we dealing with the timer? | ||||||||
| 8286 | CP $67 | |||||||||
| 8288 | JR NZ,$82D4 | No, skip on to characters | ||||||||
| 
A timer tick has occurred. This happens every 1/10 of a second as defined in the speed byte at 8065
 | ||||||||||
| 828A | LD A,$03 | |||||||||
| 828C | DEC (HL) | Tick the time again | ||||||||
| 828D | JP Z,$8296 | |||||||||
| 8290 | LD BC,$0300 | 3 digits to update but no decrease | ||||||||
| 8293 | JP $829B | |||||||||
| 
At this point, a full second has elapsed so the display must be updated
 | ||||||||||
| 8296 | LD (HL),$0A | Put another ten ticks in | ||||||||
| 8298 | LD BC,$0308 | 3 digits to update and decrement by 1 | ||||||||
| 829B | INC HL | Get the timer units | ||||||||
| 829C | LD A,(HL) | |||||||||
| 829D | SUB C | Remove a second if need be | ||||||||
| 829E | LD (HL),A | Store it | ||||||||
| 829F | JR C,$82A5 | Do we need to wrap from 0 to 9? | ||||||||
| 82A1 | LD C,$00 | No, finished decrementing, don't change next digit | ||||||||
| 82A3 | JR $82A8 | |||||||||
| 82A5 | LD (HL),$48 | Store '9' here instead and decrement next digit | ||||||||
| 82A7 | NOP | |||||||||
| 82A8 | DJNZ $829B | Loop back to scan for next digit | ||||||||
| 82AA | LD DE,$3DFA | Point to the character set buffer | ||||||||
| 82AD | PUSH DE | |||||||||
| 82AE | BIT 3,C | Are we trying to decrement past 0? | ||||||||
| 82B0 | JR NZ,$82B4 | |||||||||
| 82B2 | JR $82B5 | |||||||||
| 82B4 | LD (HL),B | Trying to decrement timer past 0. Ignore it. This is a loading error. | ||||||||
| 
Redraw the timer
 | ||||||||||
| 82B5 | LD A,(HL) | Get the next offset | ||||||||
| 82B6 | EX (SP),HL | Pull in the character buffer | ||||||||
| 82B7 | ADD A,$80 | Set DE to the relevant character buffer offset | ||||||||
| 82B9 | LD E,A | |||||||||
| 82BA | LD B,$04 | Four pairs of lines to write | ||||||||
| 82BC | LD H,$50 | Set HL to the relevant screen position | ||||||||
| 82BE | LD A,(DE) | Pull out the line | ||||||||
| 82BF | LD (HL),A | Put it on screen | ||||||||
| 82C0 | INC E | Next line in buffer | ||||||||
| 82C1 | INC H | Next line on screen | ||||||||
| 82C2 | LD A,(DE) | Pull out next line | ||||||||
| 82C3 | LD (HL),A | Put it on screen | ||||||||
| 82C4 | INC E | Next line in buffer | ||||||||
| 82C5 | INC H | Next line on screen | ||||||||
| 82C6 | DJNZ $82BE | Loop round to do next pair of lines | ||||||||
| 82C8 | INC L | Next digit | ||||||||
| 82C9 | LD A,L | Get the character buffer offset back | ||||||||
| 82CA | EX (SP),HL | |||||||||
| 82CB | CP $FD | Done the last line of the last digit? | ||||||||
| 82CD | DEC HL | Point back to the start of the buffer | ||||||||
| 82CE | JR NZ,$82AE | Loop back round for another digit | ||||||||
| 82D0 | POP HL | Restore HL | ||||||||
| 82D1 | JP $8320 | Move forward | ||||||||
| Prev: 8177 | Up: Map | Next: 82D4 |