Hello, World -- Operating System

boot0.S

/*
 * Copyright (C) 2020 Aiden Leong
 * License: bsd-2-clause
 */
    .code16
    .global _start
_start:
   
    movw %cs, %ax
    movw %ax, %ds
    movw %ax, %es
    movw %ax, %ss
    xorw %sp, %sp

    movw $msg, %si

print_msg:
    lodsb
    andb %al, %al
    jz loop
    movb $0xe, %ah
    movw $7, %bx
    int $0x10
    jmp print_msg

loop:
    xorw    %ax, %ax
    int    $0x16
    int    $0x19
    ljmp    $0xf000,$0xfff0
    
msg:
    .ascii  "Hello, AIOS! \n"
    .byte   0

    .org    510
    .word   0xAA55


Makefile:

boot0.img: boot0.s
	ld --oformat binary -o boot0.img -Ttext 0x7C00 boot0.s
boot0.s: boot0.S
	as boot0.S -o boot0.s

clean:
	rm boot0.s boot0.img
Publish At: Author:Aiden Leong

Read more posts by this author

comments powered by Disqus