User:New16

From OSDev Wiki
Jump to: navigation, search

Opcode Programming

This article is a stub! This page or section is a stub. You can help the wiki by accurately contributing to it.

Any beginner should start here.

Befor starting assembly or high-level language programming you should know: The processor does only understand opcode. Simply consider this languages named above to be helpful, but they must be interpreted by so called compilers, linkers and assemblers to create the neccessary opcode.

So just grab an instance of "Intel® 64 and IA-32 Architectures Software Developer’s Manual", with the subtitle: "Combined Volumes: 1, 2A, 2B, 2C, 3A, 3B, 3C and 3D" (4618 pages in June 2016), and go on with this tutorial.

(Just type the title in the search at "intel.com" .)

Basics

You should read at least the following sections (I recommend this order.):

You might want to run the following code in an emulator. For windows user I recommend VirtualBox: Set up a new machine with "Typ: Other" and "Version: Other/Unknown (64-bit)" and make sure you find a floppy-controller under section "Storage".
You also need a hex-editor (f.e. "https://hexed.it/").
After editing and saveing the file, named: "something.img", you should close the hex-editor (-website).

First Programm

Type in the hex editor (without the leading zero and the "h" at the end):

0EBh, 0FEh
;now expand this file with zeros until you reached address 510 (01FEh)
0, 0, ...
;at address 510 (01FEh) insert:
0AAh
;at adress 511 (01FFh) insert:
055h

Add this file to you floppy controller in your emulator (f.e. VirtualBox).
Run your virtual machine.
And you will see: nothing. But you will be able to notice a massive CPU-usage.
It worked! Whatever you have done...

explanation

Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox