Skip to content

Latest commit

 

History

History
86 lines (74 loc) · 1.63 KB

README.md

File metadata and controls

86 lines (74 loc) · 1.63 KB

Operating System

Simple boot sector written in x86_64 Assembly. Reads from disk and prints string.

Required packages

  • make (For makefile)
  • nasm (For compiling binary)
  • qemu (For emulation)
  • cdrtools (For generating ISO)

Cloning and execution

Clone repository

git clone https://github.com/manankarnik/operating-system.git

Change directory

cd operating-system

Compile binary

Uses nasm to compile to bin

make

Emulate

Uses qemu-system-x86_64 to emulate boot sector

make run

Generate ISO

ISO can be attached to virtualbox (not tested on hardware)

make iso

Delete generated files

Removes all iso and bin files generated by make

make clean

Functions

print

Prints a string using int 0x10. Move the string defined by db to si register.

  • 0x0a: Line Feed (New line)
  • 0x0d: Carriage Return
  • 0: Terminates string
mov     si, STR
call    print
STR:	db "Hello World!", 0x0a, 0x0d, 0

print_hex

Prints hexadecimal value. Move either a hexadecimal or memory address to dx register.

mov     dx, 0x1234
call    print_hex

read_disk

Reads sectors from disk.

  • al: Number of sectors to read
  • cl: Sector to be read
mov	al, 2
mov	cl, 2
call	read_disk

test_A20_line

Tests whether A20 line is enabled. Returns value to ax.

  • 0: Disabled
  • 1: Enabled
call	test_A20_line
mov	dx, ax    
call	print_hex

References