![]() |
Routines |
| Prev: 56057 | Up: Map | Next: 56095 |
|
Generates a constantly changing value in the A register, using random addresses and bytes from ROM.
HL gets gradually incremented from 0. The ROM address and the byte stored there is returned in the A register to deliver a pseudo-random value.
|
||||
| 56070 | LD (56093),HL | Preserve HL register pair | ||
| 56073 | LD HL,(56091) | Retrieve address pointer | ||
| 56076 | INC HL | Increment pointer to next address in ROM | ||
| 56077 | LD A,H | Ensure high byte of pointer doesn't exceed 31 (keeps ROM address capped at 8191) | ||
| 56078 | AND 31 | |||
| 56080 | LD H,A | |||
| 56081 | LD A,(HL) | Pick a byte from this ROM address | ||
| 56082 | ADD A,H | Add both high & low byte address values | ||
| 56083 | ADD A,L | This gives the value variation if the ROM contains a lot of the same consecutive values | ||
| 56084 | LD (56091),HL | Store the ROM address pointer for next time | ||
| 56087 | LD HL,(56093) | Retrieve HL register pair | ||
| 56090 | RET | |||
|
Store for registers used in the above routine
|
||||
| 56091 | DEFW 0 | Store for incrementing ROM address pointer. Starts at 0 | ||
| 56093 | DEFW 0 | Temp store for HL register pair during the routine | ||
| Prev: 56057 | Up: Map | Next: 56095 |