Back to Skool Routines
21664: Clear screen, select input device etc. (2)
Continues from 21425.
21664 CALL 29154 Wait for a keypress, and collect its ASCII code in A
21667 JR Z,21664
21669 OR 32 Convert to lower case
21671 CP 99 Was "c" (Cursor) pressed?
21673 JR Z,21705 Jump if so
21675 CP 110 Was "n" (None) pressed?
21677 JR Z,21705 Jump if so
21679 CP 107 Was "k" (Kempston) pressed?
21681 JR NZ,21690 Jump if not
21683 LD A,1 Set 32748 to 1: using Kempston
21685 LD (32748),A
21688 JR 21705
21690 CP 105 Was "i" (Int2) pressed?
21692 JR NZ,21664 Jump back to wait for another keypress if not
21694 LD HL,21494 Copy the 10-byte table at 21494 into the keypress table at 58624 if Int2 is being used (see below)
21697 LD DE,58624
21700 LD BC,10
21703 LDIR
The 10 bytes copied into the keypress table at 58624 (replacing the entries for keys 0-9) if Int2 is being used are as follows:
Address Contents Meaning
21494 104 Fire
21495 80 Left (fast)
21496 82 Right (fast)
21497 86 Down (fast)
21498 84 Up (fast)
21499 104 Fire
21500 80 Left (fast)
21501 82 Right (fast)
21502 86 Down (fast)
21503 84 Up (fast)
The input method has been established. Now prepare the screen for the cast of characters.
21705 LD HL,46849 Draw a line (the catwalk) across the screen, and set byte 1 of each character's buffer (which holds the character's x-coordinate) to a number between 1 and 32 (so that they are off-screen: the column of the play area at the far left of the screen, stored at 32767, was set to 128 earlier on)
21708 LD DE,18560
21711 LD B,32
21713 LD A,255
21715 LD (HL),B
21716 LD (DE),A
21717 INC H
21718 INC E
21719 DJNZ 21715
21721 LD HL,53762 Set byte 2 of ERIC's character buffer (which holds his y-coordinate) to 8; this will be the y-coordinate of the characters as they proceed along the catwalk
21724 LD (HL),8
21726 LD A,248 Print "THE CHARACTERS"
21728 LD HL,16448
21731 CALL 20668
21734 CALL 21152 Display the main characters and let the user change their names
21737 LD HL,20650 Do the POKEs specified by the table at 20650
21740 CALL 21408
21743 JP 63189 Start the game