![]() |
Routines |
| Prev: 55448 | Up: Map | Next: 55644 |
|
Used by the routine at ReadCommandLine.
Reads a command line. Prints a prompt and stores the text at 23296.
|
||||
| ReadCommandLine_CommandLinePrints | 55469 | LD A,62 | Print character 62 through Print_Character. | |
| 55471 | CALL Print_Character | |||
| 55474 | LD A,32 | Take a space and print it through Print_Character. | ||
| 55476 | CALL Print_Character | |||
| 55479 | LD HL,23296 | Take the line buffer. | ||
| 55482 | LD B,128 | |||
| ReadCommandLine_Loop | 55484 | LD A,1 | Mark the command line as started. | |
| 55486 | LD (55447),A | |||
| 55489 | LD C,0 | |||
|
This entry point is used by the routine at IgnoreInputUntilGameHasStarted.
|
||||
| ReadCommandLine_CompareLocationData | 55491 | CALL WaitForKeyWithTimeout | Go to IgnoreInputUntilGameHasStarted_InputPrintCharacter if WaitForKeyWithTimeout returns zero. | |
| 55494 | JP Z,IgnoreInputUntilGameHasStarted_InputPrintCharacter | |||
| 55497 | BIT 7,B | Jump ahead to ReadCommandLine_TestMarkerClear if bit 7 is clear. | ||
| 55499 | JR Z,ReadCommandLine_TestMarkerClear | |||
| 55501 | CP 64 | Jump ahead to IgnoreInputUntilGameHasStarted if the command is 64. | ||
| 55503 | JP Z,IgnoreInputUntilGameHasStarted | |||
| ReadCommandLine_TestMarkerClear | 55506 | BIT 0,C | Call MapCursorKeys if bit 0 of C is clear. | |
| 55508 | CALL Z,MapCursorKeys | |||
| 55511 | LD C,1 | Jump ahead to ReadCommandLine_TestBackspacePrintedBackspace if the input is not 24. | ||
| 55513 | CP 24 | |||
| 55515 | JR NZ,ReadCommandLine_TestBackspacePrintedBackspace | |||
| 55517 | CALL DeleteInputCharacter | Delete the last input character and go back to ReadCommandLine_Loop. | ||
| 55520 | JR ReadCommandLine_Loop | |||
|
A backspace is printed as a backspace unless the top bit of the count is set.
|
||||
| ReadCommandLine_TestBackspacePrintedBackspace | 55522 | CP 8 | Jump ahead to ReadCommandLine_TestQuotationMarkToggles if the command is not 8. | |
| 55524 | JR NZ,ReadCommandLine_TestQuotationMarkToggles | |||
| 55526 | BIT 7,B | Jump back to ReadCommandLine_CompareLocationData while bit 7 is present. | ||
| 55528 | JR NZ,ReadCommandLine_CompareLocationData | |||
| 55530 | LD A,8 | Print character 8 through Print_Character. | ||
| 55532 | CALL Print_Character | |||
| 55535 | INC B | Jump back to ReadCommandLine_CompareLocationData while this byte is not 34. | ||
| 55536 | DEC HL | |||
| 55537 | LD A,(HL) | |||
| 55538 | CP 34 | |||
| 55540 | JR NZ,ReadCommandLine_CompareLocationData | |||
| 55542 | LD A,(55447) | Toggle the quotation-mark flag at 55447. | ||
| 55545 | XOR 1 | |||
| 55547 | LD (55447),A | |||
| 55550 | JR ReadCommandLine_CompareLocationData | Read the next key from ReadCommandLine_CompareLocationData. | ||
|
A quotation mark toggles the typing marker. A key at or above 64 is stored as typed.
|
||||
| ReadCommandLine_TestQuotationMarkToggles | 55552 | CP 64 | Jump ahead to ReadCommandLine_TestCountHasReached if the key is at least 64. | |
| 55554 | JR NC,ReadCommandLine_TestCountHasReached | |||
| 55556 | CP 34 | Jump ahead to ReadCommandLine_TestBlankFullStop unless the key is a double quote (34). | ||
| 55558 | JR NZ,ReadCommandLine_TestBlankFullStop | |||
| 55560 | LD A,(55447) | Toggle the quotation-mark flag at 55447. | ||
| 55563 | XOR 1 | |||
| 55565 | LD (55447),A | |||
| 55568 | CALL NZ,TestFullStop | Call TestFullStop to add a full stop when the quotation marker turns on. | ||
| 55571 | LD A,34 | Take a quotation mark and jump ahead to ReadCommandLine_TestCountHasReached. | ||
| 55573 | JR ReadCommandLine_TestCountHasReached | |||
|
A blank or a full stop ends this input, and a carriage return ends the line.
|
||||
| ReadCommandLine_TestBlankFullStop | 55575 | CP 32 | Jump to ReadCommandLine_TestCountHasReached if the player pressed "SPACE". | |
| 55577 | JR Z,ReadCommandLine_TestCountHasReached | |||
| 55579 | CP 13 | Jump to ReadCommandLine_CommandMarkerLeave if the player pressed "ENTER". | ||
| 55581 | JR Z,ReadCommandLine_CommandMarkerLeave | |||
| 55583 | CP 46 | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 46. | ||
| 55585 | JR Z,ReadCommandLine_TestCountHasReached | |||
| 55587 | CP 44 | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 44. | ||
| 55589 | JR Z,ReadCommandLine_TestCountHasReached | |||
| 55591 | CP 47 | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 47. | ||
| 55593 | JR Z,ReadCommandLine_TestCountHasReached | |||
| 55595 | CP 96 | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 96. | ||
| 55597 | JR Z,ReadCommandLine_TestCountHasReached | |||
| 55599 | CP 45 | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 45. | ||
| 55601 | JR Z,ReadCommandLine_TestCountHasReached | |||
| 55603 | CP 58 | Go to ReadCommandLine_TestCountHasReached when the input is a colon. | ||
| 55605 | JR Z,ReadCommandLine_TestCountHasReached | |||
| 55607 | CALL TestDigit | Call TestDigit and jump to ReadCommandLine_CompareLocationData if the character is not a digit. | ||
| 55610 | JR C,ReadCommandLine_CompareLocationData | |||
| ReadCommandLine_TestCountHasReached | 55612 | DEC B | Jump to ReadCommandLine_CommandLinePrints_0 if the count has reached zero. | |
| 55613 | INC B | |||
| 55614 | JR Z,ReadCommandLine_CommandLinePrints_0 | |||
| 55616 | LD (HL),A | Store the character in the line buffer and print it through Print_Character. | ||
| 55617 | CALL Print_Character | |||
| 55620 | INC HL | Step to the next entry and count down one. | ||
| 55621 | DEC B | |||
| ReadCommandLine_CommandLinePrints_0 | 55622 | JP ReadCommandLine_CompareLocationData | Return to ReadCommandLine_CompareLocationData for the next character of the command. | |
|
Read the command marker, then leave a carriage return.
|
||||
| ReadCommandLine_CommandMarkerLeave | 55625 | LD A,(55447) | Call LeaveQuoteResult if the quotation mark flag at 55447 is zero. | |
| 55628 | AND A | |||
| 55629 | CALL Z,LeaveQuoteResult | |||
| 55632 | CALL TestFullStop | Call TestFullStop to test for a sentence stop. | ||
| 55635 | LD A,13 | Take a new line and store it at the line buffer, then call Print_Character to print character. | ||
| 55637 | LD (HL),A | |||
| 55638 | CALL Print_Character | |||
| 55641 | OR %00000001 | Reset the zero flag. | ||
| 55643 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 55448 | Up: Map | Next: 55644 |