Prev: 7400 Up: Map Next: 748A
7414: Make a teacher give lines
Used by the routines at 7596, 7D3E and F02F. 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 (0xCE-0xD2)
B Reprimand message number
H Teacher's character number (0xC8-0xCC)
7414 PUSH AF Save the lines recipient's character number briefly
7415 CALL $7400 Collect in DE the coordinates of the teacher's head
7418 POP AF Restore the lines recipient's character number to A
7419 ADD A,$4D A=0x1B, 0x1C, 0x1D, 0x1E or 0x1F (message number for the lines recipient's name)
741B LD ($7F8A),A Place it into 7F8A (the first byte of message 0x05, which is used as a submessage of message 0x0D: '[12]0 LINES^[5]')
741E SUB $16 Compute the attribute byte to be used for the lines message: 0x0F (blue background) for BOY WANDER; 0x17 (red background) for ANGELFACE or EINSTEIN; 0x1F (magenta background) for HAYLEY or ERIC
7420 RRA
7421 ADD A,A
7422 ADD A,A
7423 ADD A,A
7424 DEC A
7425 LD C,A Copy the lines message attribute byte to C
7426 NOP
7427 NOP
7428 NOP
7429 PUSH BC
742A CALL $6A8C Save the area of screen that will be overwritten by the lines message
742D POP BC
742E RET C Return if the teacher giving lines is off-screen
742F CALL $6291 A=random number
7432 AND $0E Set L=10, 20, 30, 40, 50, 60, 70 or 80 (number of lines divided by 10)
7434 ADD A,$02
7436 LD L,A
7437 ADD A,A
7438 ADD A,A
7439 ADD A,L
743A LD L,A
743B LD A,C A=attribute byte for the lines message
743C PUSH BC
743D CP $0F Is the teacher giving lines to BOY WANDER?
743F JR Z,$744E Jump if so
7441 CP $1F
7443 LD A,L A=number of lines divided by 10
7444 JR Z,$744B Jump if the teacher is giving lines to ERIC or HAYLEY
7446 CALL $73B5 Add EINSTEIN's or ANGELFACE's lines to the score and print the score
7449 JR $744E
744B CALL $73CB Add lines and print the new lines total
744E PUSH DE
744F EX DE,HL
7450 LD D,$00 DE=number of lines divided by 10
7452 CALL $6BB4 Generate the ASCII codes for the decimal digits of the number in DE
7455 POP DE Restore the attribute file address for the top left corner of the lines message box to DE
7456 POP BC Restore the lines reprimand number to B. and the attribute byte for the lines message to C
7457 PUSH BC Save them again
7458 PUSH DE
7459 LD A,$0D Message 0x0D: '[12]0 LINES^[5]'
745B CALL $6B46 Print the lines message
The lines message (e.g. '100 LINES ERIC') has been printed. Now for the accompanying sound effect.
745E LD A,($E428) A=attribute byte for the lines message
7461 LD DE,$2800 Set the duration parameter for the beep
7464 RRCA The border colour for the beep will be the same as the PAPER colour of the lines message box
7465 RRCA
7466 RRCA
7467 AND $07
7469 PUSH AF
746A LD BC,$1410 B=0x14 (pitch), C=0x10 (no alternating colours)
746D CALL $748C Beep
7470 POP AF A=PAPER colour of the lines message
7471 POP DE Restore the attribute file address for the top left corner of the lines message box to DE
7472 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 74C8 (with A=0x06, B=0x0E, C=0x46) and F4CC (with A=0x02, B=0x62, C=0x32).
7473 PUSH DE
7474 PUSH AF
7475 LD A,B A=0x0E, 0x62, or a reprimand message number
7476 CALL $6B46 Print the message
7479 POP AF A=border colour to use during the beep
747A LD DE,$1400 Set the duration parameter for the beep
747D LD BC,$3210 B=0x32 (pitch), C=0x10 (no alternating colours)
7480 CALL $748C Beep
7483 POP DE Restore the attribute file address for the top left corner of the message box to DE
7484 LD HL,$E328 The part of the screen overwritten by the message box was stored in the buffer at E328
7487 JP $6AE4 Restore the area of the screen overwritten by the message box
Prev: 7400 Up: Map Next: 748A