Skip to content

Instantly share code, notes, and snippets.

@smalinux
Last active March 27, 2020 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smalinux/e7e92515f175bfbd9568b6b4ca7d341e to your computer and use it in GitHub Desktop.
Save smalinux/e7e92515f175bfbd9568b6b4ca7d341e to your computer and use it in GitHub Desktop.
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
[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