Prev: 76F9 Up: Map Next: 778B
7700: Make a teacher give lines
Used by the routines at 77AC, 78AA, 7CA0 and F41F. Prints the lines message (e.g. '100 LINES ERIC') in a bubble above the teacher's head, and shortly afterwards prints the reprimand message (e.g. 'NOW FIND A SEAT') in the same bubble.
Input
A Lines recipient's character number (0xA7-0xA9, 0xAC)
B Reprimand message identifier (0x00-0x0F)
DE Teacher's coordinates
7700 PUSH BC
7701 PUSH AF
7702 CALL $74AF Is the lines-giving teacher fully on-screen?
7705 JR NC,$770A Jump if so
7707 POP AF
7708 POP BC
7709 RET Otherwise return without having given lines
The teacher is on-screen, so it's time to prepare the lines bubble for display. First, write the lines recipient's name into the lines bubble graphic buffer.
770A POP AF
770B PUSH DE Save the attribute file address of the lines bubble
770C PUSH AF Save the character number of the lines recipient
770D CALL $7600 Write the recipient's name into the lines bubble graphic buffer
Next, determine how many lines should be given.
7710 CALL $61A1 A=random number
7713 AND $0E Set DE equal to the number of lines (divided by 10): 10, 20, 30, 40, 50, 60, 70 or 80
7715 ADD A,$02
7717 LD E,A
7718 ADD A,A
7719 ADD A,A
771A ADD A,E
771B LD E,A
771C LD D,$00
Add to the lines total or the score depending on who's getting lines.
771E POP AF Restore the lines recipient's character number to A
771F CP $A7 Is BOY WANDER the lines recipient?
7721 JR Z,$7742 Jump if so
7723 PUSH DE Store the number of lines
7724 CP $AC Is ERIC the lines recipient?
7726 JR Z,$7734 Jump if so
7728 LD HL,($7FC4) Add to the score if ANGELFACE or EINSTEIN was the lines recipient
772B ADD HL,DE
772C LD ($7FC4),HL
772F LD DE,$51BC
7732 JR $773E
7734 LD HL,($7FC6) HL=number of lines ERIC has
7737 ADD HL,DE Add the lines being given
7738 LD ($7FC6),HL Store the new lines total
773B LD DE,$51DC Set DE to the appropriate display file address for the lines total
773E CALL $76C8 Print the new lines total
7741 POP DE DE=number of lines being given
Now write the number of lines being given into the lines bubble graphic buffer, and copy the lines bubble graphic to the screen.
7742 CALL $76E0 Write the number of lines into the lines bubble graphic buffer
7745 POP DE Restore the attribute file address to DE and save it again
7746 PUSH DE
7747 LD HL,$EB00 Point HL at the lines bubble graphic buffer at EB00
774A CALL $7519 Copy the lines bubble graphic to the screen
Time for the first lines-giving sound effect.
774D LD A,($EB00) A=lines bubble graphic attribute byte
7750 LD DE,$2800 DE=sound effect duration parameter
7753 RRCA The border colour will be the same as the PAPER colour of the lines bubble
7754 RRCA
7755 RRCA
7756 AND $07
7758 OUT ($FE),A Play the first lines-giving sound effect
775A XOR $10
775C LD B,$14
775E DJNZ $775E
7760 DEC E
7761 JR NZ,$7758
7763 DEC D
7764 JR NZ,$7758
Now that the lines have been dished out, the teacher should explain why.
7766 POP DE Restore the attribute file address to DE
7767 POP BC Restore the reprimand message identifier (0x00-0x0F) to B
7768 PUSH DE Save the attribute file address
7769 PUSH AF Save the border colour
776A LD A,B A=reprimand message identifier (0x00-0x0F)
776B CALL $75CC Print the reprimand message
776E POP AF Restore the border colour to A
Time for the second lines-giving sound effect. This entry point is used by the routine at F955.
776F LD DE,$1400 DE=sound effect duration parameter
7772 OUT ($FE),A Play the second lines-giving sound effect
7774 XOR $10
7776 LD B,$32
7778 DJNZ $7778
777A DEC E
777B JR NZ,$7772
777D DEC D
777E JR NZ,$7772
7780 LD A,$01 Set the border colour back to blue
7782 OUT ($FE),A
7784 POP DE Restore the attribute file address to DE
7785 LD HL,$EA00 Point HL at the buffer containing the area of the screen overwritten by the lines bubble
7788 JP $7519 Restore the area of the screen that was overwritten
Prev: 76F9 Up: Map Next: 778B