flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > Hello word

Author
Thread Post new topic Reply to topic
arcangel



Joined: 19 Aug 2009
Posts: 39
arcangel 23 Dec 2009, 20:48
Hi, I'm analizing a little program "Hello word"

With the debugger I can see this:

Image

With a hex editor I can see this one:

Image

How can I relate what I see with the hex editor with the instructions that I see in the debuger? Question

For example: The header MENUETO1 = 4D 45 4E 55 45 54 30 31

I'd like to make a little menuetos / kolibrios emulator. Twisted Evil

Thanks very much Mr. Green
Post 23 Dec 2009, 20:48
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 23 Dec 2009, 21:12
They are the same except the hex editor groups it differently...
Post 23 Dec 2009, 21:12
View user's profile Send private message Reply with quote
arcangel



Joined: 19 Aug 2009
Posts: 39
arcangel 24 Dec 2009, 15:44
I try to explain it with an example:

Image

The program tries to simulate to OS, but I don´t know how to interpret the opcodes.

Can you help me, please?

Thanks so much

Ángel
Post 24 Dec 2009, 15:44
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 24 Dec 2009, 15:48
You have to decode the binary opcodes. Quite tricky to do in x86. Use the Intel manuals as your guide. Especially see manual 2B Appendices A & B for instruction formats and encoding details.
Post 24 Dec 2009, 15:48
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 26 Dec 2009, 18:26
You are trying it in PHP? What if you need to simulate graphical stuff. Do you plan on some simple PNG images or SVG-graphics + JS?
Post 26 Dec 2009, 18:26
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav 26 Dec 2009, 19:58
arcangel wrote:
...
The program tries to simulate to OS, but I don´t know how to interpret the opcodes.

Can you help me, please?
It's called an emulator, or virtual machine - interpret every machine opcode to simulate execution of the program on it.
Is that what you're trying to do?

If yes, you're in for a long, long effort.

For opcode encoding and naming you can look at http://sandpile.org/ia32/index.htm

The meaning of them can be found in Intel's specs, easy to google.

Just in case, even for 16bit subset of x86 it can take many years to make an emulator capable of running meaningful programs. The best thing mine runs after 4 years of intermittent development is only a tetris game.
Post 26 Dec 2009, 19:58
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 27 Dec 2009, 13:58
Actually for decoding we have our own (MazeGen from the board) effort up and running at http://ref.x86asm.net/index.html
Post 27 Dec 2009, 13:58
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav 27 Dec 2009, 14:29
It's somewhat chaotic for my liking - for encoding it's not as clear as sandpile, for meaning it's not as descriptive as Intel docs.
Maybe it's just needs getting used to.
And, what is x86reference.xml good for?
Post 27 Dec 2009, 14:29
View user's profile Send private message Visit poster's website Reply with quote
arcangel



Joined: 19 Aug 2009
Posts: 39
arcangel 27 Dec 2009, 20:44
Quote:
You are trying it in PHP? What if you need to simulate graphical stuff. Do you plan on some simple PNG images or SVG-graphics + JS?

I use PHP for undestanding the program code. The emulator will be written in C.

Quote:
It's called an emulator, or virtual machine - interpret every machine opcode to simulate execution of the program on it.
Is that what you're trying to do?
Yes

Thanks

Ángel
Post 27 Dec 2009, 20:44
View user's profile Send private message Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 30 Dec 2009, 10:41
I don't exactly see why you want to create a virtual machine. If I was you, I'd first try to run menuet application natively. For each system call (int instruction) your framework will get a signal (in case of Unix systems) which you can handle to simulate menuetOS.

It's only a fuzzy idea, and I don't know whether it works, but I'd start in this direction.
Post 30 Dec 2009, 10:41
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 30 Dec 2009, 17:14
There already one available that works like Endre posted called KlbrInWin and MeOSEmul
See here: http://board.kolibrios.org/viewtopic.php?f=23&t=1273
Post 30 Dec 2009, 17:14
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.