Abstract: Original Blog: Reproduced please indicate the source: Http://www.cnblogs.com/zxouxuewei
First load the startup code:
; Hello-os; Tab=4ORG 0x7c00; Specify the program loading address; Standard FAT12 format floppy disk-specific code stand FAT12 format floppy code JMP Entry; program jump instruction DB 0xeb, 0x4e, 0x90 db "HELLOIPL"; Boot sector name (8 bytes) DW 512; Each sector (sector) size (must be 512 bytes) DB 1; Cluster (cluster) size (must be 1 sectors), DW 1; Fat start position (typically the first sector) DB 2; Number of fat (must be 2) DW 224; root directory size (typically 224 items) DW 2880; The disk size (must be 2880 sector 1440*1024/512) DB 0xf0; The disk type (must be 0xf0) DW 9; The length of fat (must?? 9 sector) DW 18; A track has several sectors (must be) DW 2; Number of heads (required?? 2) DD 0; Do not use partitions, must be 0 DD 2880; Rewrite the disk size DB 0,0,0x29; meaning unknown (fixed) DD 0xFFFFFFFF; (may be) volume label number DB "Hello-os"; The name of the disk (must be 11 words, the blank fill box) DB "FAT12"; Disk format name (required?? 8 words, insufficient blanks) RESB 18; Empty 18 bytes first; Program Body Entry:mov ax,0; Initialize the accumulator register MOVSs,ax; The stack register is initially 0 MOV sp,0x7c00; The stack pointer register is assigned a value of 0X7C00
mov ds,ax; Data segment Register Clear 0 mov es,ax; add segment register clear 0 mov si,msg; add msg address into SI register Putloop:mov AL,[SI]; ADD si,1; Give Si plus 1 CMP al,0 JE fin MOV ah,0x0e; display a text MOV bx,15; specify character color INT 0x10; Call the video card bios JMP putloopfin:hlt; Let the CPU stop, wait for the Make JMP fin; Infinite loop msg: db 0x0a, 0x0a; line break two db "Hello, World" db 0x0a, newline db 0 resb 0x7dfe-$; complete 0x00 until 0x001fe DB 0x5 5, 0xaa
Assembly language advanced and makefile advanced---the next day