Sherlock: annotated disassembly

Routines

Prev: F15A Up: Map Next: F1A8
F198: Script helper: succeed by chance (n in 100)
RUN F198 / n: refuses unless a random number from 1 to 99 (D29D) is at most n.
Used by: RUN at E9A7; RUN at E9B5; RUN at E9C3; RUN at E9CF; RUN at ED4F; RUN at ED6A; RUN at ED71; RUN at EDE1; RUN at EDF0; RUN at EDFC; RUN at EE03; RUN at F01C; RUN at F02A; RUN at F034; RUN at F03B; RUN at F0AA; RUN at F0EE.
Input
$A034 n
Output
F NZ when a random number from 1 to 99 is not above n; otherwise $DC15
F198 DEFB $07,$00 Action record header: flags $07; byte 1 $00
F19A CALL $D29D Call the routine "A random number from 1 to 100" (D29D) - A random number, 1-99
F19D LD B,A Copy A into B
F19E LD A,($A034) n
F1A1 CP B Is n below it?
F1A2 JP C,$DC15 Yes: refuse
F1A5 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - No: succeed
F1A7 RET Return to the caller
Prev: F15A Up: Map Next: F1A8