Prev: 56196 Up: Map Next: 56428
56311: 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 56311 PUSH BC Count 0.
56312 LD C,0
ParseInputNumber_DigitLoop 56314 LD A,(HL) Jump to ParseInputNumber_ReturnValue if this character is not a digit.
56315 CALL TestDigit
56318 JR C,ParseInputNumber_ReturnValue
56320 SUB 48 Reduce the total by 48.
56322 LD B,A
56323 RLC C
56325 LD A,C
56326 RLC C
56328 RLC C Fold this digit into the number and go back to ParseInputNumber_DigitLoop for the next one.
56330 ADD A,C
56331 ADD A,B
56332 LD C,A
56333 INC HL
56334 JR ParseInputNumber_DigitLoop
Return.
ParseInputNumber_ReturnValue 56336 LD A,C Read the low byte of the count.
56337 POP BC Restore BC from the stack.
56338 RET Return.
56339 DEFB 0 Length of the dictionary word. Written by FindTokenDictionaryEntry_SignalStepFailed and read by 55834 and MatchDictionaryWord.
56340 DEFB 0 Longest match accepted so far. Cleared by 55774, updated by MatchDictionaryWord_RememberLength, and read by SkipSpaces_CheckSavedLength, 55939 and MatchDictionaryWord_AcceptLength.
ParseInputNumber_ReturnZero 56341 XOR A Clear A and HL.
56342 LD L,A
56343 LD H,A
56344 RET Return.
56345 DEFB 27,32,64,40,0,0,0 Display record read by ProcessDisplayRecord: flags 27 value 32 parameters 64 40 0 0 0.
Run by 51812 after the display record at 56345.
56352 CALL CheckCharacterID Return if the character check did not match.
56355 RET NZ
56356 LD A,(41012) Call FindObjectByFieldOne to find an object by field one.
56359 CALL FindObjectByFieldOne
56362 LD A,(IX+2) Jump to ParseInputNumber_ReportSuccess if the location is zero.
56365 AND A
56366 JR Z,ParseInputNumber_ReportSuccess
56368 LD B,A Keep the location in B, save the character attribute and take 1.
56369 LD A,(40970)
56372 PUSH AF
56373 LD A,1
56375 LD (53468),A Record the location token processing flag.
Compare current character.
56378 CALL CompareCurrentCharacter Call CompareCurrentCharacter to read the character the command is about.
56381 LD A,(40970) Read the character attribute.
56384 CALL ProcessObjectDisplayWithCheck
56387 POP BC
Compare current character.
56388 CALL CompareCurrentCharacter Call CompareCurrentCharacter to read the character the command is about.
56391 XOR A Start from zero.
Record the result in the location token processing flag at LocationTokenProcessingFlag, then mark success for the script.
56392 LD (53468),A Store it in the location token processing flag.
ParseInputNumber_ReportSuccess 56395 OR %00000001 Reset the zero flag.
56397 RET Return.
Reached through the display record at 56407, dispatched by DispatchLookedUpHandlerThird.
56398 LD A,(41012) Call FindObjectByFieldOne to find an object by field one.
56401 CALL FindObjectByFieldOne
56404 JP ReadScheduleEntryFromCurrentCharacter Go to ReadScheduleEntryFromCurrentCharacter to read the schedule entry from the current character.
56407 DEFB 75,32,78,220 Display record read by ProcessDisplayRecord: flags 75 value 32 handler 56398.
Run by 51812 after the display record at 56407.
56411 LD A,(IX+0) Read the character id from this record.
56414 LD (41011),A Store it as the saved character.
56417 XOR A Start from zero.
56418 LD (40975),A Clear the display mode.
56421 DEC A Count down one.
56422 LD (41012),A Store 255 as the room display parameter.
56425 JP MatchedCharacterRoom Go to MatchedCharacterRoom to read the matched character's room.
Prev: 56196 Up: Map Next: 56428