Skip to content
/ bootOS Public
forked from nanochess/bootOS

bootOS is a monolithic operating system in 512 bytes of x86 machine code. The docs aren't guaranteed to be up-to-date

License

Notifications You must be signed in to change notification settings

jakiki6/bootOS

 
 

Repository files navigation

 _                   _     ____    _____ 
| |                 | |   / __ \  / ____|
| |__    ___    ___ | |_ | |  | || (___  
| '_ \  / _ \  / _ \| __|| |  | | \___ \ 
| |_) || (_) || (_) | |_ | |__| | ____) |
|_.__/  \___/  \___/ \__||\____/ |_____/    

bootOS operating system in 512 bytes (boot sector)
by Oscar Toledo G. Jul/22/2019
fork by Jakob Kirsch Jan/19/2020

http://nanochess.org
https://github.com/nanochess/bootOS

Note: Commit 0cbeecb917e4e5008351c2adedafffd13c0e83ae is the result of 117 commits (My original fork was on https://edugit.org/jakobkir/bootOS).

If you want to assemble it, you must download the Netwide Assembler
(nasm) from www.nasm.us

Use this command line for an empty image:

  nasm -f bin os.asm -l os.lst -o os.img

        
What is bootOS:

  bootOS is a monolithic operating system that fits in
  one boot sector. It's able to load, execute, and save
  programs. Also keeps a filesystem. It can work with
  any type of data storage.

  It relocates itself at 0000:7a00 and requires further
  768 bytes of memory starting at 0000:7700.

  This operating system runs programs as boot sectors
  at 0000:7c00. 

  It needs at least an 80386 CPU to work properly with all commands.
  If you only want the kernel to work, you should have at least an 80186 CPU.

  It provides the following services:

     int 0x20   Exit to operating system.
     int 0x21   Input key and show in screen.
                Entry: none
                Output: AL = ASCII key pressed.
                Affects: AH/BX/BP.
     int 0x22   Output character to screen.
                Entry: AL = Character.
                Output: none.
                Affects: AH/BX/BP.
     int 0x23   Load file.
                Entry: DS:BX = Filename terminated with zero.
                       ES:DI = Point to source data (512 bytes)
                Output: Carry flag = 0 = Found, 1 = Not found.
                Affects: All registers (including ES).
     int 0x24   Save file.
                Entry: DS:BX = Filename terminated with zero.
                       ES:DI = Point to data target (512 bytes)
                Output: Carry flag = 0 = Successful. 1 = Error.
                Affects: All registers (including ES).
     int 0x25   Delete file.
                Entry: DS:BX = Filename terminated with zero.
                Affects: All registers (including ES).
     int 0x26	Input line and save it to 0x7780.
		Entry: AL = promt character
		Affects: AX/BX/DX/BP/SI/DI

Filesystem organization:

  Each entry in the directory is 16 bytes wide, and
  contains the ASCII name of the file finished with a
  zero byte. A sector has a capacity of 512 bytes, it
  means only 32 files can be kept in one section.
  Each section has a size of 256 sectors.
  Since it works with LBA the disk can keep up to 2TB of data.
  
  Deleting a file is a matter of zeroing a whole entry.

  Each file is one sector long. Its location in the
  disk is derived from its position in the directory.

Starting bootOS kernel:

  Just enter "make runkvm".

Installing bootOS to an usb stick:

  Just enter "sudo make install M=/path/to/usb".

Installing bootOS with installer:

  Just enter "make installer" and "sudo make install". When you have booted the installer, you
  have to enter your drive's id. You can find the id under https://en.wikipedia.org/wiki/INT_13H#List_of_INT_13h_services.
  Note: Your boot drive has the id 80 or 00 if you are using a floppy disk. The installation should output the error code 0x00.
  Error code 0x01:
	Drive not readable. Is your usb stick plugged in?
  Error code 0x02:
	Drive is not writeable. Is it the CD ROM or something other?
  Error code 0x03:
	Source and target are the same drive.
  Error code 0x04:
	Already installed. Eject the CD/USB

Installing bootOS from a CD:

  Just run "make cdimg" to make a CD image. Note: this feature is not longer maintained and may not work!

Build bootOS with software:

  Just enter "make software". This will compile all files in the software_src directory and build the image.
        
Full installation route:

  Enter "make clean && make software && make installer && sudo make install" for a installer USB stick.
  Enter "make clean && make software && sudo make install" for a live system USB stick.

bootOS commands:

  ls            Shows the directory's content.
  rm filename   Deletes the "filename" file.
  edit          Allows to enter up to 512 hexadecimal
                bytes to create another file.
        
                Notice the line size is 128 characters so
                you must break the input into chunks of
                4, 8 or 16 bytes.
        
                It also allows to copy the last executed
                program just press Enter when the '<' prompt
                appears and type the new name.
  rl		Run last program
  sl		Save last program to disk

other external commands:

  disk		Change current disk. The disk number is stored at 0xffff in memory. Enter a disk number
		between 00 and ff behind the @. 80 is the first hard disk. 00 is the first floppy disk.
  push		Copy a program to 0xa000 from disk \
  pull		Copy a program to disk from 0xa000 / used for copying between disks and sections
  clear		Clear the screen.

For example: (Character + is Enter key)

  >edit+
  <bb 17 7c 8a 07 84 c0 74 0c 53 b4 0e bb 0f 00 cd+
  <10 5b 43 eb ee cd 20 48 65 6c 6c 6f 2c 20 77 6f+
  <72 6c 64 0d 0a 00+
  <+
  *hello+
  >dir+
  hello
  >hello+
  Hello, world
  >


bootOS programs: (Oh yes! we have software support)
        
  bricks        https://github.com/nanochess/bricks
  fbird         https://github.com/nanochess/fbird
  Pillman       https://github.com/nanochess/pillman
  invaders      https://github.com/nanochess/invaders
  bootBASIC     https://github.com/nanochess/bootBASIC
  bootRogue     https://github.com/nanochess/bootRogue
  Atomchess     https://github.com/nanochess/Toledo-Atomchess
                (requires minimum 286 processor)

Also our first 3rd party programs!!!

  bootSlide     https://github.com/XlogicX/BootSlide
                (requires minimum 286 processor)
  tetranglix    https://github.com/XlogicX/tetranglix
                (requires minimum 286 processor)
  snake         https://gitlab.com/pmikkelsen/asm_snake
                (requires minimum 286 processor)
  mine          https://gitlab.com/blevy/boot-sector-minesweeper
                (requires minimum Pentium II processor because rdtsc instruction)

These programs provide a boot sector version and a COM
file version. You need the boot sector version as the
programs are loaded at address 0000:7c00.
        
Enjoy it!


Special thanks to Jakub Kądziołka (NieDzejkob) for finding
some bugs and suggesting enhancements.


>> ATTENTION <<        

Would you like to learn 8086/8088 programming? Then you
must get my new book Programming Boot Sector Games including
a 8086/8088 crash course!

Now available from Lulu:

  Soft-cover
    http://www.lulu.com/shop/oscar-toledo-gutierrez/programming-boot-sector-games/paperback/product-24188564.html

  Hard-cover
    http://www.lulu.com/shop/oscar-toledo-gutierrez/programming-boot-sector-games/hardcover/product-24188530.html

  eBook
    https://nanochess.org/store.html

These are some of the example programs documented profusely
in the book:

  * Guess the number.
  * Tic-Tac-Toe game.
  * Text graphics.
  * Mandelbrot set.
  * F-Bird game.
  * Invaders game.
  * Pillman game.
  * Toledo Atomchess.
  * bootBASIC language.

After the success of my first book, if you need even
More Boot Sector Games then you must get this book!

  Soft-cover  http://www.lulu.com/shop/oscar-toledo-gutierrez/more-boot-sector-games/paperback/product-24462035.html

  Hard-cover  http://www.lulu.com/shop/oscar-toledo-gutierrez/more-boot-sector-games/hardcover/product-24462029.html

  * Follow the Lights
  * bootRogue
  * bricks
  * cubicDoom
  * bootOS

About

bootOS is a monolithic operating system in 512 bytes of x86 machine code. The docs aren't guaranteed to be up-to-date

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Assembly 78.6%
  • Python 14.2%
  • Makefile 6.6%
  • Shell 0.6%