Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Note: b, c, h, and l are all 8-bit values which can be combined into 16-bit values.
- ; RNGlo is address 0xFF94; RNGhi is address 0xFF95.
- ; On hard reset, RNGlo is set to 0x37. RNGhi is set to 0x0d.
- ; Load hl and bc with current RNG values
- ld a,(RNGlo)
- ld l,a
- ld c,a
- ld a,(RNGhi)
- ld h,a
- ld b,a
- ; multiply RNG by 3
- add hl,hl
- add hl,bc
- ; Store the new value into RNGhi.
- ld a,h
- ld (RNGhi),a
- ; Add the new hi and lo bytes together, and store it in RNGlo.
- add a,c
- ld (RNGlo),a
- ; Return the new value of RNGlo in register A.
- ret
Advertisement
Add Comment
Please, Sign In to add comment