| Routines

29643: Add to the lines total and print it

Used by the routines at 24348, 29716 and 62910. Adds to the lines total and prints the new total. Also sets MR WACKER on his way to expel ERIC if the new total is 10000 lines or more.
Input
A | Number of lines to add/10
29643 | PUSH DE |
29644 | PUSH HL |
29645 | LD E,A | DE=number of lines to add
29646 | LD D,0
29648 | LD HL,(32743) | HL=current lines total (divided by 10)
29651 | LD BC,64536 | BC=-1000
29654 | ADD HL,BC | Does ERIC have less than 10000 lines?
29655 | JR NC,29660 | Jump if so
29657 | ADD HL,DE | Add lines to ERIC's total
29658 | JR 29669 |
29660 | ADD HL,DE | Add lines to ERIC's total
29661 | JR NC,29669 | Jump if ERIC still has less than 10000 lines
29663 | PUSH HL |
29664 | CALL 62770 | Set MR WACKER on his way to expel ERIC
29667 | AND A | Clear the carry flag ready for subtraction
29668 | POP HL |
29669 | SBC HL,BC | Now HL=new lines total
29671 | LD (32743),HL | Store the new lines total at 32743
29674 | EX DE,HL | Transfer the new lines total to DE
29675 | LD HL,20932 | HL=display file address for printing the lines total
29678 | JP 29637 | Print the new lines total