User:Zeroman/Write to WRAM using the item pack: Difference between revisions

From Glitch City Wiki
Jump to navigation Jump to search
Content added Content deleted
(Created page with " == Functions == === Write to memory == === Reset the value and address === This is used to reset the address and value you wanna write (to). It resets the address and value to DFFF and FF, respectively. == The item bag == As items: item 1: 4F (0x59), x255 item 2: item 0x6B, x255 item 3: Carbos (0x26), x(first byte of address) item 4: X Accuracy (0x2E), x(second byte of address) item 5: Lemonade (0x3E), x(value) item 6: Item 0x77, x201 item 7: Carbos (0x26), x211 item...")
 
(reverted my mistake, added more information.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
This setup requires two glitch items: 4F (0x59) for both {{RBY}} and item 0x6B for {{RB}} or (what better item for {{Y}})?

== Functions ==
== Functions ==


Line 10: Line 10:
== The item bag ==
== The item bag ==
As items:
As items:
item 1: 4F (0x59), x255
*item 1: 4F (0x59), x255
item 2: item 0x6B, x255
*item 2: item 0x6B, x255
item 3: Carbos (0x26), x(first byte of address)
*item 3: Carbos (0x26), x(first byte of address)
item 4: X Accuracy (0x2E), x(second byte of address)
*item 4: X Accuracy (0x2E), x(second byte of address)
item 5: Lemonade (0x3E), x(value)
*item 5: Lemonade (0x3E), x(value)
item 6: Item 0x77, x201
*item 6: Item 0x77, x201
item 7: Carbos (0x26), x211
*item 7: Carbos (0x26), x211
item 8: X Accuracy (0x2E), x255
*item 8: X Accuracy (0x2E), x255
item 9: Lemonade (0x3E), x255
*item 9: Lemonade (0x3E), x255
item 10: Item 0x77, x201
*item 10: TM01 (0xC9), x(any, but preferably 99)
END OF LIST
END OF LIST


Line 29: Line 29:
jp D32A
jp D32A


At D322 (load the value of register a into register hl; "write value you want to write to address you want to write to."):
At D322:
* ld h, $DF
* ld h, $DF
* ld l, $FF
* ld l, $FF
Line 36: Line 36:
* ret
* ret


At D32A:
At D32A (reset function):
* ld h, $D3
* ld h, $D3
* ld l, $22
* ld l, $22
Line 46: Line 46:
* ld (hl), a
* ld (hl), a
* ld h, $D3
* ld h, $D3
* ld l, $23
* ld l, $24
* ld a, $FF
* ld a, $FF
* ld (hl), a
* ret
* ret


As HEX bytes:
As HEX bytes:

At $DA65/$DA64:
* C3 22 D3

At $CD35 ({{RB}} only):
* C3 2A D3

Latest revision as of 18:45, 8 January 2024

This setup requires two glitch items: 4F (0x59) for both Pokémon Red, Blue, and Yellow and item 0x6B for Pokémon Red and Blue or (what better item for Pokémon Yellow)?

Functions

= Write to memory

Reset the value and address

This is used to reset the address and value you wanna write (to). It resets the address and value to DFFF and FF, respectively.

The item bag

As items:

  • item 1: 4F (0x59), x255
  • item 2: item 0x6B, x255
  • item 3: Carbos (0x26), x(first byte of address)
  • item 4: X Accuracy (0x2E), x(second byte of address)
  • item 5: Lemonade (0x3E), x(value)
  • item 6: Item 0x77, x201
  • item 7: Carbos (0x26), x211
  • item 8: X Accuracy (0x2E), x255
  • item 9: Lemonade (0x3E), x255
  • item 10: TM01 (0xC9), x(any, but preferably 99)

END OF LIST

As ASM instructions: At DA65: jp D322

At CD35: jp D32A

At D322 (load the value of register a into register hl; "write value you want to write to address you want to write to."):

  • ld h, $DF
  • ld l, $FF
  • ld a, $FF
  • ld (hl), a
  • ret

At D32A (reset function):

  • ld h, $D3
  • ld l, $22
  • ld a, $DF
  • ld (hl), a
  • ld h, $D3
  • ld l, $23
  • ld a, $FF
  • ld (hl), a
  • ld h, $D3
  • ld l, $24
  • ld a, $FF
  • ret

As HEX bytes:

At $DA65/$DA64:

  • C3 22 D3

At $CD35 (Pokémon Red and Blue only):

  • C3 2A D3