Prev: DB84 Up: Map Next: DC6C
DBF7: Parse An Input Number
Used by the routines at ParseATime, TestComma and StartParsedNumber.
Reads decimal digits from the input and returns the number they make in A.
ParseInputNumber DBF7 PUSH BC Count 00.
DBF8 LD C,$00
ParseInputNumber_DigitLoop DBFA LD A,(HL) Jump to ParseInputNumber_ReturnValue if this character is not a digit.
DBFB CALL TestDigit
DBFE JR C,ParseInputNumber_ReturnValue
DC00 SUB $30 Reduce the total by 30.
DC02 LD B,A
DC03 RLC C
DC05 LD A,C
DC06 RLC C
DC08 RLC C Fold this digit into the number and go back to ParseInputNumber_DigitLoop for the next one.
DC0A ADD A,C
DC0B ADD A,B
DC0C LD C,A
DC0D INC HL
DC0E JR ParseInputNumber_DigitLoop
Return.
ParseInputNumber_ReturnValue DC10 LD A,C Read the low byte of the count.
DC11 POP BC Restore BC from the stack.
DC12 RET Return.
DC13 DEFB $00 Length of the dictionary word. Written by FindTokenDictionaryEntry_SignalStepFailed and read by DA1A and MatchDictionaryWord.
DC14 DEFB $00 Longest match accepted so far. Cleared by D9DE, updated by MatchDictionaryWord_RememberLength, and read by SkipSpaces_CheckSavedLength, DA83 and MatchDictionaryWord_AcceptLength.
ParseInputNumber_ReturnZero DC15 XOR A Clear A and HL.
DC16 LD L,A
DC17 LD H,A
DC18 RET Return.
DC19 DEFB $1B,$20,$40,$28,$00,$00,$00 Display record read by ProcessDisplayRecord: flags 1B value 20 parameters 40 28 00 00 00.
Run by CA64 after the display record at DC19.
DC20 CALL CheckCharacterID Return if the character check did not match.
DC23 RET NZ
DC24 LD A,($A034) Call FindObjectByFieldOne to find an object by field one.
DC27 CALL FindObjectByFieldOne
DC2A LD A,(IX+$02) Jump to ParseInputNumber_ReportSuccess if the location is zero.
DC2D AND A
DC2E JR Z,ParseInputNumber_ReportSuccess
DC30 LD B,A Keep the location in B, save the character attribute and take 01.
DC31 LD A,($A00A)
DC34 PUSH AF
DC35 LD A,$01
DC37 LD ($D0DC),A Record the location token processing flag.
Compare current character.
DC3A CALL CompareCurrentCharacter Call CompareCurrentCharacter to read the character the command is about.
DC3D LD A,($A00A) Read the character attribute.
DC40 CALL ProcessObjectDisplayWithCheck
DC43 POP BC
Compare current character.
DC44 CALL CompareCurrentCharacter Call CompareCurrentCharacter to read the character the command is about.
DC47 XOR A Start from zero.
Record the result in the location token processing flag at LocationTokenProcessingFlag, then mark success for the script.
DC48 LD ($D0DC),A Store it in the location token processing flag.
ParseInputNumber_ReportSuccess DC4B OR %00000001 Reset the zero flag.
DC4D RET Return.
Reached through the display record at DC57, dispatched by DispatchLookedUpHandlerThird.
DC4E LD A,($A034) Call FindObjectByFieldOne to find an object by field one.
DC51 CALL FindObjectByFieldOne
DC54 JP ReadScheduleEntryFromCurrentCharacter Go to ReadScheduleEntryFromCurrentCharacter to read the schedule entry from the current character.
DC57 DEFB $4B,$20,$4E,$DC Display record read by ProcessDisplayRecord: flags 4B value 20 handler DC4E.
Run by CA64 after the display record at DC57.
DC5B LD A,(IX+$00) Read the character id from this record.
DC5E LD ($A033),A Store it as the saved character.
DC61 XOR A Start from zero.
DC62 LD ($A00F),A Clear the display mode.
DC65 DEC A Count down one.
DC66 LD ($A034),A Store FF as the room display parameter.
DC69 JP MatchedCharacterRoom Go to MatchedCharacterRoom to read the matched character's room.
Prev: DB84 Up: Map Next: DC6C