Fast sequential RAM writer
Posted by: jfb1337
Date: 2019-04-15 10:50:54
This will only work on English R/B.
The items required in the PC:
There are some glitch items, but they are all properly terminated, and tossable
Lemonade x218 (hex:DA)
Repel x128 (hex:80)
Awakening x0 (hex:00)
2F (hex:57) x4 (hex:04)
Thunderstone x160 (hex:A0)
H# (hex:C3) x122 (hex:7A)
TM05 x116 (hex:74)
TM13 x123 (hex:7B)
TM05 x116 (hex:74)
TM13 x35 (hex:23)
$ (hex:79) x4 (hex:04)
TM05 x116 (hex:74)
TM13 x240 (hex:F0)
TM48 x167 (hex:A7)
Fire Stone x251 (hex:FB)
#### (hex:76) x240 (hex:F0)
TM48 x47 (hex:2F)
Poké Ball x135 (hex:87)
TM08 x135 (hex:87)
Super Repel x1 (hex:01)
Burn Heal x135 (hex:87)
Super Repel x3 (hex:03)
TM03 x33 (hex:21)
Poké Ball x135 (hex:87)
Super Repel x5 (hex:05)
$ (hex:79) x18 (hex:12)
Super Potion x14 (hex:0E)
#j. (hex:00) x24 (hex:18)
TM07 x245 (hex:F5)
TM03 x55 (hex:37)
TM05 x123 (hex:7B)
TM13 x241 (hex:F1)
TM30 x15 (hex:0F)
Poké Ball x198 (hex:C6)
TM46 x48 (hex:30)
Ultra Ball x198 (hex:C6)
11F (hex:60) x34 (hex:22)
TM01 x[Any qty]
Corresponding ASM code:
ld a, $da
ld e, $80
ld c, 0
ld d, a
inc b ; filler
.draw
ld hl, $c3a0
ld a, d
call .writehex
ld a, e
call .writehex
inc hl
ld a, c
inc b ; filler
call .writehex
.wait
ldh a, ($fff8) ; hJoypadInput
and a
jr nz, .wait
halt
ldh a, ($fff8)
cpl ; so we can do jr c instead of jr nc (the latter is a key item)
Inc b ; filler
add a,a ;
ret nc ; if down pressed
add a,a
jr c, .no_up
inc c
.no_up
add a,a
jr c, .no_left
sla c
inc b ; filler
.no_left
add a,a
jr c, .no_right
ld a, c
ld (de), a
inc de
ld c, 0
.no_right
jr .draw
.writehex
push af
swap a
call .writedigit
pop af
.writedigit
and a, $0f
Inc b
add a, $f6
jr nc, .no_add
add a, $60
.no_add
ldi (hl), a
ret
Raw bytes:
3eda1e800e00570421a0c37acd74d57bcd74d5237904cd74d5f0f8a720fb76f0f82f0487d08738010c873803cb21048738057912130e0018cff5cb37cd7bd5f1e60f04c6f63002c66022c9
This will edit from DA80 (PC data) onwards; if you'd like to change this, just change the quantities of the first two items accordingly.
To set this up, you'll need to write the above items to the PC. To do do, first create each item and deposit in the PC. For items that there are more than one stack of, deposit 99 of them.
Then, use the following script to set all PC quantities to 0:
Carbos x213 (hex:D5)
X Accuracy x60 (hex:3C)
Awakening x50
Lemonade x0
Water Stone x35
Ice Heal x32
TM51 (hex:FB) x4
TM01x[Any qty]
ld h, $D5
ld l, $3C
ld c, 50
ld a, 0
.loop
ld (hli), a
inc hl
dec c
jr nz, .loop
inc b
ret
Then, toss items from the PC until all the quantities are correct.
Finally, you can use the following code to jump to the PC items:
Carbos x213 (hex:D5)
X Accuracy x59 (hex:3B)
TM33 x[Any qty]
ld h, $D5
ld l, $3B
jp hl
This will start the writer. In the top left of the screen, you will see the address you are currently writing to, followed by the byte you are writing.
Controls are:
- Up: Increment the current byte
- Left: Shift the current byte left (i.e. double it)
- Right: Save the current byte, and increment the address
- Down: Exit the writer. The address currently displayed on the screen will not be modified.
Using up and left can allow you to enter any byte in at most 16 inputs, by converting it to binary. If you make a mistake, pressing left 8 times will set the current byte to 0.