Professional Documents
Culture Documents
Asm OS
Asm OS
jge ... label: mov ax, 10 mylabel: db 'Message here', 0 foo: db 0 mov byte al, [foo] bx, 1000h ax, [bx] ax, 50 label
first OS: asm BITS 16 start: mov add mov mov ax, ax, ss, sp, 07C0h 288 ax 4096 ; Set up 4K stack space after this bootloader ; (4096 + 512) / 16 bytes per paragraph
mov ax, 07C0h mov ds, ax mov si, text_string call print_string jmp $
; Put string position into SI ; Call our string-printing routine ; Jump here - infinite loop!
text_string db 'This is my cool new OS!', 0 print_string: mov ah, 0Eh .repeat: lodsb cmp al, 0 je .done int 10h jmp .repeat .done: ret ; Routine: output string in SI to screen ; int 10h 'print char' function ; Get character from string ; If char is zero, end of string ; Otherwise, print it
Buils OS: nasm -f bin -o myfirst.bin myfirst.asm Disk images: dd status=noxfer conv=notrunc if=myfirst.bin of=myfirst.flp Emulator: qemu -fda myfirst.flp cdiso: mkisofs -o myfirst.iso -b myfirst.flp cdiso/