Babystep1: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (Minor improvements and added Tone banner)
Line 1: Line 1:
__NOTOC__
__NOTOC__


{{Tone}}
{{Rating|1}}
{{Rating|1}}


Line 20: Line 21:
times 512-($-$$) db 0
times 512-($-$$) db 0
</source>
</source>
The CPU starts in real mode and the BIOS loads this code at address 0000:7c00. The "times 512..." stuff is NASM's way of saying fill up 512 bytes with zeros. And partcopy is going to expect that (200 in Hex = 512 in Decimal). Change it and you'll see Partcopy choke.
The CPU starts in real mode and the [[BIOS]] loads this code at address 0000:7c00. "times 512-($-$$) db 0" is NASM's way of saying fill up 512 bytes with zeros. And partcopy is going to expect that (200 in Hex = 512 in Decimal). Change it and you'll see partcopy choke.


Often, you will see a so-called boot signature (0xAA55) at the end. Older versions of [[BIOS|BIOSes]] looked for this in order to identify a boot sector on a disk. It is evidently unnecessary nowadays. If it's needed, the last line would be replaced with (or some version of it)
Often, you will see a boot signature (0xAA55) at the end. Older versions of BIOSes looked for this in order to identify a boot sector on a disk. It is evidently unnecessary nowadays. If it's needed, the last line would be replaced with (or some version of it):
<source lang="asm">
<source lang="asm">
; boot.asm
; boot.asm
Line 33: Line 34:
</source>
</source>


But the thing I'd really like to point out is how once you've booted, and the cursor is happily blinking on a blank screen, you might notice two things. One is that the floppy motor will turn off and the other is that you can press Ctrl-Alt-Del to reboot. The point is that interrupts (such as INT 0x09) as still being generated.
Once you've booted, and the cursor is happily blinking on a blank screen, you might notice two things. One is that the floppy motor will turn off and the other is that you can press Ctrl-Alt-Del to reboot. The point is that [[interrupts]] as still being generated.


For kicks try clearing the interrupts flag:
Try clearing the interrupts flag:
<source lang="asm">
<source lang="asm">
;boot.asm
;boot.asm
Line 53: Line 54:


==Creating disk image==
==Creating disk image==
The code is assembled in [[NASM]] and copied to floppy using partcopy,dd,or debug. Then you simply boot from the floppy.
The code is assembled in [[NASM]] and copied to floppy using partcopy, dd, or debug. Then you simply boot from the floppy.


===Windows===
===Windows===