Prev: 29696 Up: Map Next: 29834
29716: Make a teacher give lines
Used by the routines at 30102, 32062 and 61487. Prints the lines message (e.g. '100 LINES ERIC') in a message box above the teacher's head, and shortly afterwards prints the reprimand message (e.g. 'NO CATAPULTS') in the same box.
Input
A Lines recipient's character number (206-210)
B Reprimand message number
H Teacher's character number (200-204)
29716 PUSH AF Save the lines recipient's character number briefly
29717 CALL 29696 Collect in DE the coordinates of the teacher's head
29720 POP AF Restore the lines recipient's character number to A
29721 ADD A,77 A=27, 28, 29, 30 or 31 (message number for the lines recipient's name)
29723 LD (32650),A Place it into 32650 (the first byte of message 5, which is used as a submessage of message 13: '[12]0 LINES^[5]')
29726 SUB 22 Compute the attribute byte to be used for the lines message: 15 (blue background) for BOY WANDER; 23 (red background) for ANGELFACE or EINSTEIN; 31 (magenta background) for HAYLEY or ERIC
29728 RRA
29729 ADD A,A
29730 ADD A,A
29731 ADD A,A
29732 DEC A
29733 LD C,A Copy the lines message attribute byte to C
29734 NOP
29735 NOP
29736 NOP
29737 PUSH BC
29738 CALL 27276 Save the area of screen that will be overwritten by the lines message
29741 POP BC
29742 RET C Return if the teacher giving lines is off-screen
29743 CALL 25233 A=random number
29746 AND 14 Set L=10, 20, 30, 40, 50, 60, 70 or 80 (number of lines divided by 10)
29748 ADD A,2
29750 LD L,A
29751 ADD A,A
29752 ADD A,A
29753 ADD A,L
29754 LD L,A
29755 LD A,C A=attribute byte for the lines message
29756 PUSH BC
29757 CP 15 Is the teacher giving lines to BOY WANDER?
29759 JR Z,29774 Jump if so
29761 CP 31
29763 LD A,L A=number of lines divided by 10
29764 JR Z,29771 Jump if the teacher is giving lines to ERIC or HAYLEY
29766 CALL 29621 Add EINSTEIN's or ANGELFACE's lines to the score and print the score
29769 JR 29774
29771 CALL 29643 Add lines and print the new lines total
29774 PUSH DE
29775 EX DE,HL
29776 LD D,0 DE=number of lines divided by 10
29778 CALL 27572 Generate the ASCII codes for the decimal digits of the number in DE
29781 POP DE Restore the attribute file address for the top left corner of the lines message box to DE
29782 POP BC Restore the lines reprimand number to B, and the attribute byte for the lines message to C
29783 PUSH BC Save them again
29784 PUSH DE
29785 LD A,13 Message 13: '[12]0 LINES^[5]'
29787 CALL 27462 Print the lines message
The lines message (e.g. '100 LINES ERIC') has been printed. Now for the accompanying sound effect.
29790 LD A,(58408) A=attribute byte for the lines message
29793 LD DE,10240 Set the duration parameter for the beep
29796 RRCA The border colour for the beep will be the same as the PAPER colour of the lines message box
29797 RRCA
29798 RRCA
29799 AND 7
29801 PUSH AF
29802 LD BC,5136 B=20 (pitch), C=16 (no alternating colours)
29805 CALL 29836 Beep
29808 POP AF A=PAPER colour of the lines message
29809 POP DE Restore the attribute file address for the top left corner of the lines message box to DE
29810 POP BC Restore the lines reprimand number to B, and the attribute byte for the lines message to C
This entry point is used by the routines at 29896 (with A=6, B=14, C=70) and 62668 (with A=2, B=98, C=50).
29811 PUSH DE
29812 PUSH AF
29813 LD A,B A=14, 98, or a reprimand message number
29814 CALL 27462 Print the message
29817 POP AF A=border colour to use during the beep
29818 LD DE,5120 Set the duration parameter for the beep
29821 LD BC,12816 B=50 (pitch), C=16 (no alternating colours)
29824 CALL 29836 Beep
29827 POP DE Restore the attribute file address for the top left corner of the message box to DE
29828 LD HL,58152 The part of the screen overwritten by the message box was stored in the buffer at 58152
29831 JP 27364 Restore the area of the screen overwritten by the message box
Prev: 29696 Up: Map Next: 29834