Anyone Know Executable Format???

Blitz3D Forums/Blitz3D Programming/Anyone Know Executable Format???

mk2y10(Posted 2007) [#1]
I wish to find the formate of a executable for Windows XP. I want to know how the commands are givin to the computer (like Strings,Ints,Bytes) and a list of the commands, if someone knows them. Mainly what i'm trying to do is create simple programs that i can try and play around with and see if i can add to the power of BB. My Computers already a wreck. :) Thanks


Who was John Galt?(Posted 2007) [#2]
Websearch 'MS COFF', then learn assembly language (there are decent FASM tutorials on the NET), then all you need to undertand is how the final byte code (machine code) relates to the assembly language... its not far off.

http://en.wikipedia.org/wiki/COFF

http://flatassembler.net/docs.php

http://courses.ece.uiuc.edu/ece390/resources/opcodes.html


Defoc8(Posted 2007) [#3]
you might want to hunt down docs on the PE format,
but unless you know your low level coding...its going to
break your head ;)


Kev(Posted 2007) [#4]
this generates the .exe although it does little, you would require the use of assembly language for it to be usable.

http://www.blitzbasic.com/codearcs/codearcs.php?code=1116

kev


mk2y10(Posted 2007) [#5]
Is there a way to like get a list of just bytes and commands because I have no Idea how this works because i'm only 16. But I do understand that the commnds and paramiters are diffrent, like bytes, ints, strings. One thing i need is a program that is striped down to the basics. One that I could look over and see how the commands are used. Then I'll try to convert the commands into a Text Doc so I can get a better Idea. I looked on Google and found nothin. Thanks for the web pages, I can see now that the exicutibles needs a header,yeah great ;), and there are alot of functions nedded. But it starting to become more clearer. Thanks!


Yan(Posted 2007) [#6]
PE-COFF Spec


b32(Posted 2007) [#7]
These numbers are machine code. The first number is a command, and the following numbers are the parameters.
I thought that on old PC's, these commands were 1 byte long.
But last time I worked with them was on C64, so erm .. I'm not sure how they work today.

Usually, people write in assembler, where each machine code instruction is represented by a 'mnemonic'. That is usually a 3-letter combination, such as 'MOV', that makes it easier to work with than with, say, '184'. But they are in fact the same.
For the PC, converting from ASM into machine code is easy, because it only needs to replace the instructions with the numbers they represent.

If you want to try this, do the following:
(1) Start->Run->type "CMD" and press Enter
(2) type "echo ################################################################# >test.dat" (+enter)
(3) type "debug test.dat" (+enter)
(4) type "a" (+enter)
(5) type the following program
mov ax, 13
int 10
mov ax, a000
mov es, ax
mov cx, ffff
in al, 40
rep stosb
in al, 60
dec al
jnz 010a
mov ax, 3
int 10
ret
--> press enter again here
(6) Then, type 'd 100' (+enter) .. means 'dump'
The program above will now be shown as a set of (hex) numbers, these are the actual bytes of the .exe file.
(7) Type 'w' + enter .. means 'write'
(8) Type 'q' + enter .. quit
(9) Type 'ren test.dat test.exe'
(10) Type 'test' to run the program
If all went well, the screen is now filled with alternating colors.

For more info about assember/machine code, try this page:
http://mirror.href.com/thestarman/asm/index.html

The example above came from this page:
http://www.everything2.com/index.pl?node_id=592466
http://www.everything2.com/index.pl?node_id=1160812


Who was John Galt?(Posted 2007) [#8]
Nice example, B32.

Try the beginners Flat assembler tutorials. Once you've got assembly under your cap you're really not far off from your goal.

The opcodes html document I linked will tell you the machine codes for the various assembly instructions, but no point looking at that until you have assembly down.


mk2y10(Posted 2007) [#9]
Oh, Ok. I understand how to create GFX modes and I will experiment with that. Thanks!!!


Buggy(Posted 2007) [#10]
What about creating Mac and Linux executables?