Real mode assembly I: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(Added "use16" line. Fixed segments, so memory below the bootloader can be used)
(→‎So where's the code?: Fix some poor assembly)
Line 27: Line 27:
<source lang="asm">
<source lang="asm">
org 0x7C00 ; add 0x7C00 to label addresses
org 0x7C00 ; add 0x7C00 to label addresses
use16 ; tell the assembler we want 16 bit code
bits 16 ; tell the assembler we want 16 bit code


mov ax, 0 ; set up segments
mov ax, 0 ; set up segments
Line 33: Line 33:
mov es, ax
mov es, ax
mov ss, ax ; setup stack
mov ss, ax ; setup stack
mov sp, 0xFFF0 ; stack grows downwards from 0xFFF0
mov sp, 0x7C00 ; stack grows downwards from 0x7C00
mov si, welcome
mov si, welcome