![]() |
Routines |
| Prev: DAE8 | Up: Map | Next: DB56 |
|
Used by the routine at TestCommonWord.
Reads hours, an optional ":" and minutes into B/C, then an "A" or "P" plus "M" suffix. "A" sets bit 6 of B; "P" sets bit 6 of C for PM.
|
||||
| ParseATime | DAEF | CALL ParseInputNumber | Call ParseInputNumber to start from an empty length. | |
| DAF2 | LD B,A | Jump ahead to ParseATime_CheckHours if this byte is 3A. | ||
| DAF3 | LD A,(HL) | |||
| DAF4 | CP $3A | |||
| DAF6 | JR Z,ParseATime_CheckHours | |||
| DAF8 | CP $41 | Jump ahead to ParseATime_CheckHours when the input character is A. | ||
| DAFA | JR Z,ParseATime_CheckHours | |||
| DAFC | CP $50 | Jump ahead to ParseATime_CheckHours when the input character is P. | ||
| DAFE | JR Z,ParseATime_CheckHours | |||
| DB00 | CALL TestFullStop_TestReturnsCharacterSentence | Jump ahead to StartParsedNumber unless the character is a full stop, a comma or a space. | ||
| DB03 | JR NZ,StartParsedNumber | |||
| ParseATime_CheckHours | DB05 | LD A,B | Jump ahead to ParseATime_SignalNothingMatched if the count is at least 3C. | |
| DB06 | CP $3C | |||
| DB08 | JR NC,ParseATime_SignalNothingMatched | |||
| DB0A | SET 7,B | Set bit 7 of the count. | ||
| DB0C | LD C,$00 | Start the number at zero, read the input character, and parse it. | ||
| DB0E | LD A,(HL) | |||
| DB0F | CALL TestFullStop_TestReturnsCharacterSentence | |||
| DB12 | JR Z,TestComma_0 | Go to TestComma_0 if the character is a full stop, a comma or a space. | ||
| ParseATime_ReadMinutes | DB14 | CP $3A | Jump ahead to ParseATime_CheckSuffix if the character is not 3A. | |
| DB16 | JR NZ,ParseATime_CheckSuffix | |||
| DB18 | INC HL | Step to the next character and call ParseInputNumber to read a number. | ||
| DB19 | CALL ParseInputNumber | |||
| DB1C | LD C,A | Jump ahead to ParseATime_SignalNothingMatched if the number is at least 3C. | ||
| DB1D | CP $3C | |||
| DB1F | JR NC,ParseATime_SignalNothingMatched | |||
| ParseATime_CheckSuffix | DB21 | LD A,(HL) | Jump ahead to TestComma_0 if the character is a full stop, a comma or a space. | |
| DB22 | CALL TestFullStop_TestReturnsCharacterSentence | |||
| DB25 | JR Z,TestComma_0 | |||
| DB27 | CP $41 | Jump ahead to ParseATime_AMPM if the character is not 41. | ||
| DB29 | JR NZ,ParseATime_AMPM | |||
| DB2B | SET 6,B | Set bit 6 of the count. | ||
| DB2D | INC HL | Step to the next input character and continue at ParseATime_CheckM. | ||
| DB2E | JR ParseATime_CheckM | |||
|
Accept "AM" or "PM": "A" has already set bit 6 of B, and "P" sets bit 6 of C for PM; both then require "M".
|
||||
| ParseATime_AMPM | DB30 | CP $50 | Jump ahead to ParseATime_SignalNothingMatched if the character is not 50. | |
| DB32 | JR NZ,ParseATime_SignalNothingMatched | |||
| DB34 | SET 6,C | Set bit 6 of C for PM and step to the next character. | ||
| DB36 | INC HL | |||
| ParseATime_CheckM | DB37 | LD A,(HL) | Jump ahead to ParseATime_SignalNothingMatched if this byte is not 4D. | |
| DB38 | CP $4D | |||
| DB3A | JR NZ,ParseATime_SignalNothingMatched | |||
| ParseATime_TestStepEntry | DB3C | INC HL | Step to the next entry. | |
|
This entry point is used by the routine at StartParsedNumber.
|
||||
| ParseATime_0 | DB3D | LD A,(HL) | Jump back to ParseATime_TestStepEntry if this byte is 2E. | |
| DB3E | CP $2E | |||
| DB40 | JR Z,ParseATime_TestStepEntry | |||
| DB42 | CALL TestComma | Jump ahead to TestComma_0 if the character is a comma or a space. | ||
| DB45 | JR Z,TestComma_0 | |||
| DB47 | CP $0D | Jump to TestComma_TestStepOneByte if the player pressed "ENTER". | ||
| DB49 | JR Z,TestComma_TestStepOneByte | |||
| DB4B | CP $22 | Jump ahead to TestComma_TestStepOneByte if the character is 22. | ||
| DB4D | JR Z,TestComma_TestStepOneByte | |||
|
This entry point is used by the routine at StartParsedNumber.
|
||||
| ParseATime_SignalNothingMatched | DB4F | XOR A | Set the zero flag. | |
| DB50 | LD A,$D0 | Leave D0 as the result. | ||
| DB52 | LD BC,$0000 | Clear BC (no time was given). | ||
| DB55 | RET | Return. | ||
| Prev: DAE8 | Up: Map | Next: DB56 |