Prev: 30457 Up: Map Next: 30603
30464: Make a teacher give lines
Used by the routines at 30636, 30890, 31904 and 62495. 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 (167-169, 172)
B Reprimand message identifier (0-15)
DE Teacher's coordinates
30464 PUSH BC
30465 PUSH AF
30466 CALL 29871 Is the lines-giving teacher fully on-screen?
30469 JR NC,30474 Jump if so
30471 POP AF
30472 POP BC
30473 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.
30474 POP AF
30475 PUSH DE Save the attribute file address of the lines bubble
30476 PUSH AF Save the character number of the lines recipient
30477 CALL 30208 Write the recipient's name into the lines bubble graphic buffer
Next, determine how many lines should be given.
30480 CALL 24993 A=random number
30483 AND 14 Set DE equal to the number of lines (divided by 10): 10, 20, 30, 40, 50, 60, 70 or 80
30485 ADD A,2
30487 LD E,A
30488 ADD A,A
30489 ADD A,A
30490 ADD A,E
30491 LD E,A
30492 LD D,0
Add to the lines total or the score depending on who's getting lines.
30494 POP AF Restore the lines recipient's character number to A
30495 CP 167 Is BOY WANDER the lines recipient?
30497 JR Z,30530 Jump if so
30499 PUSH DE Store the number of lines
30500 CP 172 Is ERIC the lines recipient?
30502 JR Z,30516 Jump if so
30504 LD HL,(32708) Add to the score if ANGELFACE or EINSTEIN was the lines recipient
30507 ADD HL,DE
30508 LD (32708),HL
30511 LD DE,20924
30514 JR 30526
30516 LD HL,(32710) HL=number of lines ERIC has
30519 ADD HL,DE Add the lines being given
30520 LD (32710),HL Store the new lines total
30523 LD DE,20956 Set DE to the appropriate display file address for the lines total
30526 CALL 30408 Print the new lines total
30529 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.
30530 CALL 30432 Write the number of lines into the lines bubble graphic buffer
30533 POP DE Restore the attribute file address to DE and save it again
30534 PUSH DE
30535 LD HL,60160 Point HL at the lines bubble graphic buffer at 60160
30538 CALL 29977 Copy the lines bubble graphic to the screen
Time for the first lines-giving sound effect.
30541 LD A,(60160) A=lines bubble graphic attribute byte
30544 LD DE,10240 DE=sound effect duration parameter
30547 RRCA The border colour will be the same as the PAPER colour of the lines bubble
30548 RRCA
30549 RRCA
30550 AND 7
30552 OUT (254),A Play the first lines-giving sound effect
30554 XOR 16
30556 LD B,20
30558 DJNZ 30558
30560 DEC E
30561 JR NZ,30552
30563 DEC D
30564 JR NZ,30552
Now that the lines have been dished out, the teacher should explain why.
30566 POP DE Restore the attribute file address to DE
30567 POP BC Restore the reprimand message identifier (0-15) to B
30568 PUSH DE Save the attribute file address
30569 PUSH AF Save the border colour
30570 LD A,B A=reprimand message identifier (0-15)
30571 CALL 30156 Print the reprimand message
30574 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 63829.
30575 LD DE,5120 DE=sound effect duration parameter
30578 OUT (254),A Play the second lines-giving sound effect
30580 XOR 16
30582 LD B,50
30584 DJNZ 30584
30586 DEC E
30587 JR NZ,30578
30589 DEC D
30590 JR NZ,30578
30592 LD A,1 Set the border colour back to blue
30594 OUT (254),A
30596 POP DE Restore the attribute file address to DE
30597 LD HL,59904 Point HL at the buffer containing the area of the screen overwritten by the lines bubble
30600 JP 29977 Restore the area of the screen that was overwritten
Prev: 30457 Up: Map Next: 30603