.text_start: movb $0x0e, %ah movb $'s', %al int $0x10 movb $'t', %al int $0x10 movb $'r', %al int $0x10 movb $'i', %al int $0x10 movb $'n', %al int $0x10 movb $'g', %al int $0x10 //get current video page movb $0x0f, %ah int $0x10 //get cursor pos movb $0x03, %ah int $0x10 //print str movw $0x07c0, %ax movw %ax, %es movw $0x1301, %ax //bh already set movb $0x07, %bl #attribute movw $str_len, %cx movw $str, %bp int $0x10cyrcle: jmp cyrcle.data str: .string "done" .set str_len, . - str
gcc bootsect.s -Cld bootsect.o -Ttext=0 -Tdata=50 -o bootsect -nostdlib --oformat binary./fitcha < bootsect > bootsect.img
#include <unistd.h>#include <stdio.h>#define IMG_SIZE 0x1000 /*2mb - img size*/void panic(char* msg){ fprintf(stderr,"%s",msg); exit(-1);}int main(){ char bufer[IMG_SIZE]; int i; for (i=0; i<IMG_SIZE; bufer[i++]=0); i=read(0, bufer, 510); if (i<1) panic("can't read boot_sect file\n"); bufer[510]=0x55; bufer[511]=0xaa; if (write(1,bufer,IMG_SIZE)!=IMG_SIZE) panic("can't write boot img\n"); return 0;}
printstr: push ax push bx push cx mov bx, dxbios_print: mov al, byte ptr [bx] cmp al, #0x24 ; Ende? je print_done mov ah, #0xe int 0x10 inc bx jmp bios_printprint_done: pop cx pop bx pop ax ret