• Forum
  • Lounge
  • How do you statically insert a data byte

How do you statically insert a data byte in memory using x86 machine code?

Hello all!

I am trying to find out how I can statically insert a byte using x86 binary opcodes/machine code.

The x86 assembly equivalent can be done so using an assembler directive such as the following:

MSG db 'Hello', 7C00.

However, I need to know what the assembler does with the code, but do not have access to decompile now.

Basically, I want to make a 'Hello World' bootloader for x86 bare-bones, but instead of assembly I want to lower it another notch and write the 0s and 1s manually in to a file and place the file on an unformatted (no filesystem) 1.56 MB floppy disk and boot.

I know, I know, it's crazy and 1-1 mapping to assembly code, but I dare to do this, and I will not stop until I am done. :D
Last edited on
It wouldn't be that hard. Just find an x86 mapping out there. Pretty sure they're easy enough to find.
I have no idea what you're asking but I think you want to write assembly code directly in hexadecimal. If so, just find an x86 instruction reference online (of which there are many) and a good hex editor (of which there are almost none) and start writing (although it'll be in hex, not binary). Since x86 bootloaders are just flat binaries, you can just write code without worrying about putting it in any particular order. The most annoying thing will be updating memory addresses of your functions and variables every time you insert or delete code. Also, remember the file has to be exactly 512 bytes long and the last two bytes have to be 0x55 0xAA in that order (or the word 0xaa55).
Last edited on
You can use DOS utility debug,
Topic archived. No new replies allowed.