Editing a ROM with Visual Basic

Eye wunna go
HOME

First, you have to have Visual Basic. When you're editing a ROM,
speak in terms of Hex, ya know. Where ever you want to put a
value, add 1 to the location. Let's say you want to change that value
of the Location: "18653" to "A3", you'd put:
Put #1, 18654, A3

Butt you can't do the code like that, A3 needs to be a variable.
You might want to make the Location a variable also. You might
also mant to tell Visual Basic where you are making the changes.

Here's a little Visual Basic ROM Hacking Example:


DIM VV AS Byte
DIM VG AS Byte

Open txtROM.Text For Binary As #1
VV = &HA3
VG = &H33

Put #1, &H1FA0, VV
Put #1, &H1FA1, VG
Close #1



That code set the Location: 1F9F to the value of "A3" and the Location 1FA0 to 33.
OH!  Don't forget to DIM your variables as Bytes
You could also use the locations as variables:

DIM VV AS Byte
DIM VG AS Byte

Open txtROM.Text For Binary As #1
LV = &H1FA0
LG = &H1FA1
VV = &HA3
VG = &H33

Put #1, LV, VV
Put #1, LG, VG
Close #1



Code with explainations:   (yes, the explainations work in VB)

'Dim the variables to Bytes so your program corverts the values to ROM style:
DIM VV AS Byte
DIM VG AS Byte

'Open up the ROM
Open txtROM.Text For Binary As #1
'Set the Values and Locations as Variables
LV = &H1FA0
LG = &H1FA1
VV = &HA3
VG = &H33

'Write to the ROM
'---Put #1, location, variable
Put #1, LV, VV
Put #1, LG, VG
'---Close the ROM
Close #1



In this code, we're taking whatever is inside a text box named "txtROM" and using that as
the location of the ROM (where the ROM is, and what it's name is).
Let's do it a different way:

DIM VV AS Byte
DIM VG AS Byte

Open "C:\NES\Games\Zelda.Nes" For Binary As #1
LV = &H1FA0
LG = &H1FA1
VV = &HA3
VG = &H33

Put #1, LV, VV
Put #1, LG, VG
Close #1



Now if you want to READ from the ROM, you
can do all of this, butt putt GET instead of PUT.
Just mess around with it, that's what programming
is all about.

Eye hope this all makes sence to you, good luck...