Plain binary format spec
Plain binary format spec
Hi all,
The NASM compiler can generate plain binary format files e.g. for bootloader code. Does anyone have a link to the plain binary format specification?
The NASM compiler can generate plain binary format files e.g. for bootloader code. Does anyone have a link to the plain binary format specification?
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Plain binary format spec
Yeah, that about sums it up. That's why it's called a plain flat binary.
Re: Plain binary format spec
Thanks for your replies!
So, if I understand you write compiling
mov ah 0Eh
to plain binary would just be the binary representation of the mov instruction? Interesting.
Where might I find the binary representations of the intel instructions? (I glanced at the Intel manual but I couldn't seem to find it...)
So, if I understand you write compiling
mov ah 0Eh
to plain binary would just be the binary representation of the mov instruction? Interesting.
Where might I find the binary representations of the intel instructions? (I glanced at the Intel manual but I couldn't seem to find it...)
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Plain binary format spec
Intel manuals, volumes 2A and 2B - Instruction set reference.
Re: Plain binary format spec
In my tutorial I run a flat binary as a demo within a task in mulktitasking:
Result as a falt binary in the memory:
Code: Select all
[BITS 32]
start:
Mov [0x000b8000], byte 'T'
Mov [0x000b8002], byte 'e'
Mov [0x000b8004], byte 's'
Mov [0x000b8006], byte 't'
Ret
http://www.henkessoft.de/OS_Dev/OS_Dev2 ... ocId188270c6 05 00 80 0b 00 54 c6 05 02 80 0b 00 65 c6 05 04 80 0b 00 73 c6 05 06 80 0b 00 74 c3
http://www.henkessoft.de/OS_Dev/OS_Dev3.htm (OSDEV)
http://www.c-plusplus.de/forum/viewforu ... is-62.html
irc.euirc.net #PrettyOS
http://www.c-plusplus.de/forum/viewforu ... is-62.html
irc.euirc.net #PrettyOS
Re: Plain binary format spec
Are the binary codes for register names also in the intel instruction manual?
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Plain binary format spec
Every opcode is in the Intel manuals (2A and 2B). For example, it has tables showing the unique opcodes for each different variation of mov.
Re: Plain binary format spec
What I mean ito ask is, what is the 'name' in binary of, say, the AH register?
Re: Plain binary format spec
You could find that in the Intel manuals (2A and 2B).Every opcode is in the Intel manuals (2A and 2B)
Did you ever read that reference?????
Re: Plain binary format spec
That is not compiling, it is assembling. And yes, it would be 0xb40e. You can find this out yourself by looking at the intel manuals or (what I used) the debug program that comes with Windows.eeoam wrote:So, if I understand you write compiling
mov ah 0Eh
to plain binary would just be the binary representation of the mov instruction? Interesting.
If you are looking for why it is a certain opcode, look at the instruction format used in the i86 architecture (located in the Intel manuals posted earlier.)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: Plain binary format spec
I've downloaded Intel manual 2A and I am currently making my way through it. Unfortunately I have not yet been able to commit the 812 page document to memory.Quote:
Every opcode is in the Intel manuals (2A and 2B)
You could find that in the Intel manuals (2A and 2B).
Did you ever read that reference?????
By the by is there a way to obtain a hard copy of these documents? (I thought I saw a link to do so on the Intel site but I can't find it again.)
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Plain binary format spec
You don't need to memorise the entire thing. You use it as a reference when you want to know the opcode for an instruction.
The only reasons I can think of for doing that are:
The only reasons I can think of for doing that are:
- Debugging - you read what's at EIP and get the instruction
- Creating binary files by hand - rather than using assembly and an assembler, you use a hex editor to create a binary with the correct opcodes
- Understanding how assembly links to machine code
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: Plain binary format spec
The hard copy editions are free.. that includes shipping.
-
- Member
- Posts: 199
- Joined: Sat Jun 28, 2008 6:44 pm
Re: Plain binary format spec
For most places. I've heard of people in the UK and parts of the EU getting charged extra but it insignificant.Brynet-Inc wrote:The hard copy editions are free.. that includes shipping.