View Single Post
  #87    
Old May 23rd, 2008, 12:54 AM
Darthatron's Avatar
Darthatron
巨大なトロール。
Community Supporter Tier 2
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 22
Gender: Male
Nature: Modest
Quote:
Originally Posted by interdpth View Post
I'd like to point out, that while your little HEX module is handing it's easily replaceable.
For dealing with hex values
&H
that reverse hex is just declaring the proper variable
dim byte1 as byte'Handles 1 byte
byte1=&H0C
viewing with a hex editor you'll see 0x
dim integer1 as integer'Handles 2 bytes
integer1=&HFF04
viewing with a hexeditor
04 FF

and the one I guess that reversehex is mainly used for

the long

dim long1 as long'4 bytes usually for a pointer
long1=&h8123456
in a hex editor
56 34 12 08
Get it now?

Readhex is simply reduced to
dim byte1 as byte
open filepath for binary as #1
get #1, offset+1,byte1
or
seek #1, offset+1
get #1, ,byte1
close #1
for integers

just change the byte to integer

for long just change integer or byte to long

to write data to a rom use put instead of get

and to extract the address from a long
just take the 8 off so
offset-&h8000000

make sure if you're pointing a pointer into a rom make sure to add the &H8000000


simple.

And not bloated.
Simple for you and I, but not for people who don't understand Visual Basic, or who are only just learning, this is for those people. Thanks for the lesson though, I had no idea each Variant was meant to hold a different amount of data...
__________________
あなた は しきしゃ です
わたし は ばか です
Reply With Quote