Code Monkey home page Code Monkey logo

bootlib's Introduction

Hai,

The directory you just opened contains our 'bootlib' and a minimal
example that uses it. 'bootlib' is a tiny library written in x86
assembly which should provide you just enough functionality to let
you make your own bootable program without too much trouble.

If you're using some form of Linux (x86 or x86_64), you should
be able to use the example makefile:
This makefile lets you use 'make' to compile your bootable image,
and 'make test' to run it in the Qemu emulator (if installed).

This file contains some hints on how to use things such as VGA
output and keyboard input. You'll probably need a lot more
information than what's given here, but this should give you a
good start.

Have fun!

Maarten de Vries and Mara Bos


[Booting your image]

The file that comes out of the compiler should be a Multiboot ELF
image, which can be loaded by a bootloader such as GRUB.

If you want to run your program natively on your computer from your
harddrive, you should configure your bootloader to add an option
for your boot image. For example, if you're using Ubuntu with GRUB2:
Put the image in a convenient place (such as /boot/) and add the
following to /etc/grub.d/40_custom: (and run: sudo update-grub2)

submenu "Custom boot images" {
	menuentry "My Awesome Program" {
		multiboot /boot/myawesomeprogram
	}
}

It is also fun to try to get your program running without a
bootloader. Reading your a file from a harddrive with a file system
can get pretty tough in assembly, but reading your image from a
fixed position on a floppy should be pretty easy.


[VGA output]

Code is included that will set all VGA registers to get the graphics
card into 16 color 25*80 text mode. If you want a different mode,
you'll have to find out the values for all those registers yourself.

In text mode, each block on the screen (of 8 by 16 pixels) will match
two bytes in the the VGA memory (which starts at 0xB8000, also
available as the symbol 'vga_memory'): one for the character itself
(in ASCII), and one for the colour (four bits background, four bits
foreground).

It is possible to overwrite the default font, so you can display other
kind of (8*16 pixel tiled) graphics. Code for this is not included.


[Keyboard input]

Any input from the keyboard fires IRQ1 (if enabled). After the IRQ
fired, the keyboard controller might not be ready to give you the
scancode yet. You'll have to wait for the 'ready bit' to turn on:
  Read a byte from 0x64 (inb $0x64, %al), and repeat
  until the least signifigant bit is one.
Then, you can read the scancode (byte) from 0x60 (inb $0x60, %al).

For a overview of scancodes, see
  http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html


[License]

See the 'LICENSE' file.

bootlib's People

Contributors

m-ou-se avatar de-vri-es avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.