Zophar's Message Domain

Go Back   Zophar's Message Domain > Emulation Talk > General Emulation

Reply
 
Thread Tools Display Modes
Old 08-19-2009, 07:17 PM   #1
Aphex19
Junior Member
 
Join Date: Jul 2009
Posts: 10
Default Another question about reading roms.

I'd like to thank you all for taking the time to help me.

I know that hex editors can see the raw machine instructions. I'd imagine originally, these instructions were all just simple "bits" of infomation in zeros and ones. This is then interpreted by a hex editor and viewed as hex.

My question is based on emulation. How do emulators see all the raw instructions (values or binary) from a rom instead of doing the more obvious thing of reading/streaming the text (from a rom file)? Does this effectively involve writing your methods of viewing the the values at memory addresses? If so, how do i load the rom into memory and then point to the correct address? In C++.

To put it simply, how does a CPU emulator load the raw machine code into memory so that the CPU emulator can then act accordingly for the instruction its given? Rarther than simply streaming the text from the file.

I hope someone gets what I mean, this is the only thing im having trouble getting my head around with emulation.

thanks
Aphex19 is offline   Reply With Quote
Old 08-20-2009, 12:49 AM   #2
Lenophis
Senior Member
 
Lenophis's Avatar
 
Join Date: Apr 2003
Posts: 1,386
Default

Quote:
Originally Posted by Aphex19 View Post
How do emulators see all the raw instructions (values or binary) from a rom instead of doing the more obvious thing of reading/streaming the text (from a rom file)?
There's one misconception, it's not in text.

The NES and SNES have what's called a reset vector, where the program will start. Think of it as the int main. From there it jumps where it needs to, and acts accordingly. I suggest you read some documents about this.
__________________
Lenophis is offline   Reply With Quote
Old 08-20-2009, 12:57 AM   #3
Aphex19
Junior Member
 
Join Date: Jul 2009
Posts: 10
Default

Quote:
Originally Posted by Lenophis View Post
There's one misconception, it's not in text.
Sorry, I wasnt very specific with my question. I was talking about viewing the contents of a rom file as text. Which of course, will be garbage becuase a pc processor wont know what to do so it just displays crap. Besides, a rom isnt meant to be used in that way anyway of course, the instrctions arnt for text streaming.

Ill take a look at the reset vector but im still wondering simply how to view the machine code of a file. As in, creating my own functions that will do that, not using some else's hex editor.

Infact, lets be more direct. How do i write a hex editor? any advice?
Aphex19 is offline   Reply With Quote
Old 08-28-2009, 08:08 PM   #4
toasterhed
Regular Member
 
toasterhed's Avatar
 
Join Date: Dec 2008
Posts: 89
Default

I recommend some reading also...

http://www.romhacking.net/start/#docs

Read the "The Art of ROMhacking" and "The Definitive Guide to ROM Hacking for Complete Beginners ".

You can't phrase your question correctly I'm afraid. But don't be discouraged. I wouldn't go trying to learn about the complexities of assembly just yet. Try a simpler project. Hack some text, graphics, play around a little with the easy stuff. Assembly is a beast! A horridly evil one! But, if you start with the basics you can work your way up.

That is of course, if we are talking NES/SNES. Which is what I mostly spend my time hacking, if at all. Depending on the ROM, it could be in a different coding language.
__________________
"The creation of something new is not accomplished by the intellect but by the play instinct acting from inner necessity. The creative mind plays with the objects it loves." - Carl Jung

toasterhed is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:01 PM.

Contact Us - Zophar's Domain - Archive - Top

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.