![]() |
Routines |
| Prev: 6DCC | Up: Map | Next: 6E4F |
|
Used by the routine at START.
Prints the prompt, then takes keys into INPUT_LINE until a carriage return: letters, space, quote, comma and full stop are kept and echoed, backspace steps back, and anything else is ignored. The cursor lives only in registers -- HL walks the line and B counts the room left in it, 128 to start -- so there is no variable in memory that says how much has been typed.
That is what makes putting a whole command in from outside possible but not quite trivial: stop at READ_LINE_0, just after HL and B are set, write the text into the line, move HL and B past it, and press ENTER. The reader then files the return after the text exactly as if the rest had been typed.
|
||||||||
| READ_LINE | 6DD6 | LD HL,$0BB8 | Patience: GET_KEY waits this long before typing WAIT itself | |||||
| 6DD9 | LD (PATIENCE),HL | |||||||
| 6DDC | LD A,$01 | Flags read by the printing code while a line is being typed | ||||||
| 6DDE | LD (INPUT_STYLE),A | |||||||
| 6DE1 | LD (DOING_IT),A | |||||||
| 6DE4 | LD A,$3E | The prompt: "> " | ||||||
| 6DE6 | CALL PRINT_CHAR | |||||||
| 6DE9 | LD A,$20 | |||||||
| 6DEB | CALL PRINT_CHAR | |||||||
| 6DEE | LD HL,INPUT_LINE | HL = the start of INPUT_LINE, B = room for 128 characters | ||||||
| 6DF1 | LD B,$80 | |||||||
| READ_LINE_0 | 6DF3 | LD C,$00 | Nothing typed yet on this line | |||||
|
This entry point is used by the routine at REPEAT_LAST.
|
||||||||
| READ_LINE_KEY | 6DF5 | CALL GET_KEY | Wait for a key | |||||
| 6DF8 | BIT 7,B | @ on an empty line: do the last command again | ||||||
| 6DFA | JR Z,READ_LINE_1 | |||||||
| 6DFC | CP $40 | |||||||
| 6DFE | JP Z,REPEAT_LAST | |||||||
| READ_LINE_1 | 6E01 | BIT 0,C | The first key of a line may be a one-key move (ONE_KEY_MOVES) | |||||
| 6E03 | CALL Z,ONE_KEY_MOVES | |||||||
| 6E06 | LD C,$01 | |||||||
| 6E08 | CP $18 | $18 clears the line and starts again | ||||||
| 6E0A | JR NZ,READ_LINE_2 | |||||||
| 6E0C | CALL RUB_OUT_LINE | |||||||
| 6E0F | JR READ_LINE_0 | |||||||
| READ_LINE_2 | 6E11 | CP $08 | Backspace, unless the line is empty: step back one | |||||
| 6E13 | JR NZ,READ_LINE_3 | |||||||
| 6E15 | BIT 7,B | |||||||
| 6E17 | JR NZ,READ_LINE_KEY | |||||||
| 6E19 | LD A,$08 | |||||||
| 6E1B | CALL PRINT_CHAR | |||||||
| 6E1E | INC B | |||||||
| 6E1F | DEC HL | |||||||
| 6E20 | JR READ_LINE_KEY | |||||||
| READ_LINE_3 | 6E22 | CP $40 | Letters, quote, space, return, full stop and comma are kept; anything else is ignored | |||||
| 6E24 | JR NC,READ_LINE_4 | |||||||
| 6E26 | CP $22 | |||||||
| 6E28 | JR Z,READ_LINE_4 | |||||||
| 6E2A | CP $20 | |||||||
| 6E2C | JR Z,READ_LINE_4 | |||||||
| 6E2E | CP $0D | |||||||
| 6E30 | JR Z,READ_LINE_4 | |||||||
| 6E32 | CP $2E | |||||||
| 6E34 | JR Z,READ_LINE_4 | |||||||
| 6E36 | CP $2C | |||||||
| 6E38 | JR NZ,READ_LINE_KEY | |||||||
| READ_LINE_4 | 6E3A | LD (CAPITAL_NEXT),A | Remember the last key | |||||
| 6E3D | DEC B | If there is room, echo it and put it in the line | ||||||
| 6E3E | INC B | |||||||
| 6E3F | JR Z,READ_LINE_5 | |||||||
| 6E41 | CALL PRINT_CHAR | |||||||
| 6E44 | LD (HL),A | |||||||
| 6E45 | INC HL | |||||||
| 6E46 | DEC B | |||||||
| READ_LINE_5 | 6E47 | CP $0D | Until return: then NZ, a line has been read | |||||
| 6E49 | JP NZ,READ_LINE_KEY | |||||||
| 6E4C | OR $01 | |||||||
| 6E4E | RET | |||||||
| Prev: 6DCC | Up: Map | Next: 6E4F |