![]() |
Routines |
| Prev: DB59 | Up: Map | Next: DBF7 |
|
Used by the routine at ParseATime.
Starts a number with the first number cleared, then reads the separator that follows.
|
||||
| StartParsedNumber | DB84 | XOR A | Clear the first number. | |
| DB85 | LD ($DB64),A | |||
|
This entry point is used by the routine at TestComma.
|
||||
| StartParsedNumber_ClearSecondThird | DB88 | XOR A | Clear the second number and the third number. | |
| DB89 | LD ($DB65),A | |||
| DB8C | LD ($DB66),A | |||
| DB8F | LD A,(HL) | Jump ahead to StartParsedNumber_TestLetterD if the character is not 'S'. | ||
| DB90 | CP $53 | |||
| DB92 | JR NZ,StartParsedNumber_TestLetterD | |||
| DB94 | LD A,B | Store the count as the second number. | ||
| DB95 | LD ($DB65),A | |||
| StartParsedNumber_Combine | DB98 | JR StartParsedNumber_StepPastCharacter | Jump ahead to StartParsedNumber_StepPastCharacter to combine the number. | |
|
The character 'D' stores the count as the third number.
|
||||
| StartParsedNumber_TestLetterD | DB9A | CP $44 | Jump ahead to StartParsedNumber_TestSlash if the character is not 'D'. | |
| DB9C | JR NZ,StartParsedNumber_TestSlash | |||
| DB9E | LD A,B | Store the count as the third number and jump to StartParsedNumber_Combine. | ||
| DB9F | LD ($DB66),A | |||
| DBA2 | JR StartParsedNumber_Combine | |||
|
A slash stores the count as the second number.
|
||||
| StartParsedNumber_TestSlash | DBA4 | CP $2F | Jump to ParseATime_SignalNothingMatched if the character is not '/'. | |
| DBA6 | JR NZ,ParseATime_SignalNothingMatched | |||
| DBA8 | LD A,B | Store the count as the second number. | ||
| DBA9 | LD ($DB65),A | |||
| DBAC | INC HL | Jump ahead to StartParsedNumber_StepPastCharacter if the next character is '-'. | ||
| DBAD | LD A,(HL) | |||
| DBAE | CP $2D | |||
| DBB0 | JR Z,StartParsedNumber_StepPastCharacter | |||
| DBB2 | CALL TestDigit | Jump to ParseATime_SignalNothingMatched if this character is not a digit. | ||
| DBB5 | JR C,ParseATime_SignalNothingMatched | |||
| DBB7 | CALL ParseInputNumber | Read the next number, store it as the third number and continue at StartParsedNumber_CombineNumbers. | ||
| DBBA | LD ($DB66),A | |||
| DBBD | JR StartParsedNumber_CombineNumbers | |||
|
Steps past this character before the three numbers are combined.
|
||||
| StartParsedNumber_StepPastCharacter | DBBF | INC HL | Step to the next character. | |
|
This entry point is used by the routine at TestComma.
|
||||
| StartParsedNumber_CombineNumbers | DBC0 | PUSH HL | Save the input pointer, load the first number into HL and double it. | |
| DBC1 | LD A,($DB64) | |||
| DBC4 | LD L,A | |||
| DBC5 | LD H,$00 | |||
| DBC7 | ADD HL,HL | |||
| DBC8 | ADD HL,HL | Multiply HL by ten. | ||
| DBC9 | LD E,L | |||
| DBCA | LD D,H | |||
| DBCB | ADD HL,HL | |||
| DBCC | ADD HL,HL | |||
| DBCD | ADD HL,DE | |||
| DBCE | LD A,($DB65) | Add the second number and double the total. | ||
| DBD1 | LD E,A | |||
| DBD2 | LD D,$00 | |||
| DBD4 | ADD HL,DE | |||
| DBD5 | ADD HL,HL | |||
| DBD6 | ADD HL,HL | Multiply HL by six. | ||
| DBD7 | LD E,L | |||
| DBD8 | LD D,H | |||
| DBD9 | ADD HL,HL | |||
| DBDA | ADD HL,DE | |||
| DBDB | LD A,($DB66) | Add the third number and swap it with the saved input pointer. | ||
| DBDE | LD E,A | |||
| DBDF | LD D,$00 | |||
| DBE1 | ADD HL,DE | |||
| DBE2 | EX (SP),HL | |||
| DBE3 | POP BC | Fail through ParseATime_SignalNothingMatched if the value is 4000 or more. | ||
| DBE4 | LD A,B | |||
| DBE5 | CP $40 | |||
| DBE7 | JP NC,ParseATime_SignalNothingMatched | |||
| DBEA | SLA C | Move bit 7 of C into B and set bit 7 of C. | ||
| DBEC | RL B | |||
| DBEE | SRL C | |||
| DBF0 | SET 7,C | |||
| DBF2 | SET 7,B | Set bit 7 of B and continue at ParseATime_0. | ||
| DBF4 | JP ParseATime_0 | |||
| Prev: DB59 | Up: Map | Next: DBF7 |