Last active
March 27, 2020 17:01
-
-
Save smalinux/e7e92515f175bfbd9568b6b4ca7d341e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
# ./fasm/fasm boot.asm | |
nasm -f bin boot.asm -o boot.bin | |
run: | |
# bochs | |
qemu-system-x86_64 boot.bin | |
iso: | |
sudo mkfs.vfat -I /dev/sdb | |
sudo dd if=boot.bin of=/dev/sdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[org 0x7c00] | |
;;; General Setings | |
;; Set Video Mode ;;; | |
mov ah, 0 | |
mov al, 0x03 | |
int 0x10 | |
;;; Set Color Palette | |
mov ah, 0x0B | |
mov bh, 0 | |
mov bl, 0x04 | |
int 0x10 | |
;;; Write Text in Teletype Mode | |
mov ah, 0x0e | |
mov bx, welcome | |
call print_string | |
; mov bx, Msg | |
; call print_string | |
;;; THE END OS | |
jmp The_end | |
;;; Vars | |
welcome: db 'welcome to simOS', 0xA, 0xD, 0 | |
Msg: db 'My name is Sohaib (smalinux)', 0xA, 0xD, 0 | |
;;; Functions | |
;;; print_string function | |
; if (al == 0) | |
; break | |
; else | |
; continue | |
print_string: | |
mov al, [bx] | |
cmp al, 0 | |
je .ret | |
int 0x10 | |
add bx, 1 | |
jmp print_string | |
.ret: ret ; retrun 0 | |
;;; Magic Mumber | |
;;; jump forever ;;; | |
The_end: | |
jmp $ | |
times 510-($-$$) db 0 | |
dw 0xaa55 ;;; BIOS magic number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment