, . :
xchg bx, bx
mov ax, 7c0h
mov ds, ax
, :
xchg bx, bx
mov ax, 7c0h
mov es, ax ; Int 10h/ah=13h takes string address in ES:BP
. sector_2, , , NASM. , .
, - :
nasm -f bin boot.asm -o boot.img
, -f bin, .
ORG, NASM org 0h . 0. , (512 ) . , 0x7c0, , 0 7c00h. : (7c0h < 4) +0 ( 0 - /org ), 7c00h.
, , 900h: 0h. FAR CALL call 900h:0000. .
, ? , NASM , 512 : 0 (900h: 0000h). .
NDISASM , 512 , :
00000000 B80009 mov ax,0x900
00000003 8EC0 mov es,ax
00000005 BD1A02 mov bp,0x21a
00000008 B413 mov ah,0x13
:
ndisasm -e 512 -b16 boot.img
boot.img - . -e 512 , 512 . , :
mov bp,0x21a
0x21a hello. , 0x21a 538 , 0 (900h: 0000h). , NASM, , ( ), 0, . , ( ) , (vstart) reset 0. , , ,
section stage2, vstart=0h
, :
dw 0aa55h ; Define MAGIC number at byte 512
;;;;;;;;;;;;;;;;;;;;;;;;
section stage2, vstart=0h ; Section name can be anything of your choosing
sector_2:
mov ax, 900h
mov es, ax
mov bp, hello
, NDISASM, :
00000000 B80009 mov ax,0x900
00000003 8EC0 mov es,ax
00000005 BD1A00 mov bp,0x1a ; Notice hello offset is 0x1a not 0x21a
@Jester org 0h, ( ), ORG. , , NASM , . ! "" . NASM `SECTION reset ( 0).
ORG SECTION NASM. SECTION VSTART 7.1.3. bin