Routines |
Prev: BE52 | Up: Map | Next: BEB2 |
Used by the routines at routine06, routine09, creature_cast_spell, lightning_spell, dark_power_spell, INTERO, routine23, routine25 and routine77.
|
||||
get_random | BE94 | PUSH HL | preserve HL and DE | |
BE95 | PUSH DE | |||
get_random_0 | BE96 | LD A,R | copy value of R register into E | |
BE98 | LD E,A | |||
BE99 | LD HL,$E0B5 | set HL to address of map_object_table+$96 | ||
BE9C | LD D,$00 | add byte in E | ||
BE9E | ADD HL,DE | load byte from resulting address into E | ||
BE9F | LD A,(HL) | |||
BEA0 | LD E,A | |||
BEA1 | LD A,R | add value of R register | ||
BEA3 | ADD A,E | |||
BEA4 | LD HL,$5C76 | add value of SEED system variable | ||
BEA7 | ADD A,(HL) | |||
BEA8 | AND $0F | select lower four bits | ||
BEAA | CP $0A | jump back to get_random_0 if A is greater than 9 | ||
BEAC | JP P,get_random_0 | |||
BEAF | POP DE | restore DE and HL | ||
BEB0 | POP HL | |||
BEB1 | RET |
Prev: BE52 | Up: Map | Next: BEB2 |