Real mode assembly I: Difference between revisions

no edit summary
[unchecked revision][unchecked revision]
m (Move warning to the top of the page)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1:
{{Tone}}
{{FirstPerson}}
{{Rating|1You}}
{{Warning|Please see the [[Real Mode OS Warning]] page before continuing.}}
{{Rating|1}}
 
''In this tutorial we will assemble a small 16-bit [[assembly|assembly language]] kernel with [[NASM]] and boot it.''
Line 26 ⟶ 27:
Here you go, go wild.
 
<sourcesyntaxhighlight lang="asm">
org 0x7C00 ; add 0x7C00 to label addresses
bits 16 ; tell the assembler we want 16 bit code
Line 182 ⟶ 183:
times 510-($-$$) db 0
dw 0AA55h ; some BIOSes require this signature
</syntaxhighlight>
</source>
 
To assemble on Windows:
 
<sourcesyntaxhighlight lang="dosbat">
nasm kernel.asm -f bin -o kernel.bin
partcopy kernel.bin 0 200 -f0
</syntaxhighlight>
</source>
 
Or on Linux:
<sourcesyntaxhighlight lang="bash">
nasm kernel.asm -f bin -o kernel.bin
dd if=kernel.bin of=/dev/sda
</syntaxhighlight>
</source>
 
Those commands assemble your kernel binary and write them to the first disk (sda might be your system disk, so use sdb, sdc etc. according to your configuration. USB-sticks also appear as one of the "sd" devices). Go ahead and test out your operating system now!
Line 206 ⟶ 207:
'''EDIT on December 12 2008: I've written a second part to this tutorial at [[Real mode assembly II]]. This and future parts will have less code to copy and paste and more theory!'''
 
[[Category:Assembly]]
[[Category:Real mode assembly]]
<- none | [[Real mode assembly II]] ->