![]() |
Routines |
| Prev: D898 | Up: Map | Next: D95C |
|
Used by the routine at ReadCommandLine.
Reads a command line. Prints a prompt and stores the text at 5B00.
|
||||
| ReadCommandLine_CommandLinePrints | D8AD | LD A,$3E | Print character 3E through Print_Character. | |
| D8AF | CALL Print_Character | |||
| D8B2 | LD A,$20 | Take a space and print it through Print_Character. | ||
| D8B4 | CALL Print_Character | |||
| D8B7 | LD HL,$5B00 | Take the line buffer. | ||
| D8BA | LD B,$80 | |||
| ReadCommandLine_Loop | D8BC | LD A,$01 | Mark the command line as started. | |
| D8BE | LD ($D897),A | |||
| D8C1 | LD C,$00 | |||
|
This entry point is used by the routine at IgnoreInputUntilGameHasStarted.
|
||||
| ReadCommandLine_CompareLocationData | D8C3 | CALL WaitForKeyWithTimeout | Go to IgnoreInputUntilGameHasStarted_InputPrintCharacter if WaitForKeyWithTimeout returns zero. | |
| D8C6 | JP Z,IgnoreInputUntilGameHasStarted_InputPrintCharacter | |||
| D8C9 | BIT 7,B | Jump ahead to ReadCommandLine_TestMarkerClear if bit 7 is clear. | ||
| D8CB | JR Z,ReadCommandLine_TestMarkerClear | |||
| D8CD | CP $40 | Jump ahead to IgnoreInputUntilGameHasStarted if the command is 40. | ||
| D8CF | JP Z,IgnoreInputUntilGameHasStarted | |||
| ReadCommandLine_TestMarkerClear | D8D2 | BIT 0,C | Call MapCursorKeys if bit 0 of C is clear. | |
| D8D4 | CALL Z,MapCursorKeys | |||
| D8D7 | LD C,$01 | Jump ahead to ReadCommandLine_TestBackspacePrintedBackspace if the input is not 18. | ||
| D8D9 | CP $18 | |||
| D8DB | JR NZ,ReadCommandLine_TestBackspacePrintedBackspace | |||
| D8DD | CALL DeleteInputCharacter | Delete the last input character and go back to ReadCommandLine_Loop. | ||
| D8E0 | JR ReadCommandLine_Loop | |||
|
A backspace is printed as a backspace unless the top bit of the count is set.
|
||||
| ReadCommandLine_TestBackspacePrintedBackspace | D8E2 | CP $08 | Jump ahead to ReadCommandLine_TestQuotationMarkToggles if the command is not 08. | |
| D8E4 | JR NZ,ReadCommandLine_TestQuotationMarkToggles | |||
| D8E6 | BIT 7,B | Jump back to ReadCommandLine_CompareLocationData while bit 7 is present. | ||
| D8E8 | JR NZ,ReadCommandLine_CompareLocationData | |||
| D8EA | LD A,$08 | Print character 08 through Print_Character. | ||
| D8EC | CALL Print_Character | |||
| D8EF | INC B | Jump back to ReadCommandLine_CompareLocationData while this byte is not 22. | ||
| D8F0 | DEC HL | |||
| D8F1 | LD A,(HL) | |||
| D8F2 | CP $22 | |||
| D8F4 | JR NZ,ReadCommandLine_CompareLocationData | |||
| D8F6 | LD A,($D897) | Toggle the quotation-mark flag at D897. | ||
| D8F9 | XOR $01 | |||
| D8FB | LD ($D897),A | |||
| D8FE | JR ReadCommandLine_CompareLocationData | Read the next key from ReadCommandLine_CompareLocationData. | ||
|
A quotation mark toggles the typing marker. A key at or above 40 is stored as typed.
|
||||
| ReadCommandLine_TestQuotationMarkToggles | D900 | CP $40 | Jump ahead to ReadCommandLine_TestCountHasReached if the key is at least 40. | |
| D902 | JR NC,ReadCommandLine_TestCountHasReached | |||
| D904 | CP $22 | Jump ahead to ReadCommandLine_TestBlankFullStop unless the key is a double quote (22). | ||
| D906 | JR NZ,ReadCommandLine_TestBlankFullStop | |||
| D908 | LD A,($D897) | Toggle the quotation-mark flag at D897. | ||
| D90B | XOR $01 | |||
| D90D | LD ($D897),A | |||
| D910 | CALL NZ,TestFullStop | Call TestFullStop to add a full stop when the quotation marker turns on. | ||
| D913 | LD A,$22 | Take a quotation mark and jump ahead to ReadCommandLine_TestCountHasReached. | ||
| D915 | JR ReadCommandLine_TestCountHasReached | |||
|
A blank or a full stop ends this input, and a carriage return ends the line.
|
||||
| ReadCommandLine_TestBlankFullStop | D917 | CP $20 | Jump to ReadCommandLine_TestCountHasReached if the player pressed "SPACE". | |
| D919 | JR Z,ReadCommandLine_TestCountHasReached | |||
| D91B | CP $0D | Jump to ReadCommandLine_CommandMarkerLeave if the player pressed "ENTER". | ||
| D91D | JR Z,ReadCommandLine_CommandMarkerLeave | |||
| D91F | CP $2E | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 2E. | ||
| D921 | JR Z,ReadCommandLine_TestCountHasReached | |||
| D923 | CP $2C | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 2C. | ||
| D925 | JR Z,ReadCommandLine_TestCountHasReached | |||
| D927 | CP $2F | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 2F. | ||
| D929 | JR Z,ReadCommandLine_TestCountHasReached | |||
| D92B | CP $60 | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 60. | ||
| D92D | JR Z,ReadCommandLine_TestCountHasReached | |||
| D92F | CP $2D | Jump ahead to ReadCommandLine_TestCountHasReached if the input is 2D. | ||
| D931 | JR Z,ReadCommandLine_TestCountHasReached | |||
| D933 | CP $3A | Go to ReadCommandLine_TestCountHasReached when the input is a colon. | ||
| D935 | JR Z,ReadCommandLine_TestCountHasReached | |||
| D937 | CALL TestDigit | Call TestDigit and jump to ReadCommandLine_CompareLocationData if the character is not a digit. | ||
| D93A | JR C,ReadCommandLine_CompareLocationData | |||
| ReadCommandLine_TestCountHasReached | D93C | DEC B | Jump to ReadCommandLine_CommandLinePrints_0 if the count has reached zero. | |
| D93D | INC B | |||
| D93E | JR Z,ReadCommandLine_CommandLinePrints_0 | |||
| D940 | LD (HL),A | Store the character in the line buffer and print it through Print_Character. | ||
| D941 | CALL Print_Character | |||
| D944 | INC HL | Step to the next entry and count down one. | ||
| D945 | DEC B | |||
| ReadCommandLine_CommandLinePrints_0 | D946 | 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 | D949 | LD A,($D897) | Call LeaveQuoteResult if the quotation mark flag at D897 is zero. | |
| D94C | AND A | |||
| D94D | CALL Z,LeaveQuoteResult | |||
| D950 | CALL TestFullStop | Call TestFullStop to test for a sentence stop. | ||
| D953 | LD A,$0D | Take a new line and store it at the line buffer, then call Print_Character to print character. | ||
| D955 | LD (HL),A | |||
| D956 | CALL Print_Character | |||
| D959 | OR %00000001 | Reset the zero flag. | ||
| D95B | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: D898 | Up: Map | Next: D95C |