TOS Arno Puder 1
Demo Kernel /* tos/kernel/main.c */ #include <kernel.h> WINDOW window_top = {0, 0, 80, 12, 0, 0, ' '}; WINDOW window_bottom = {0, 12, 80, 13, 0, 0, ' '}; void kernel_main() { for (int x = 0; x < 80 * 25 * 2; x++) { poke_b(0xb8000 + x, 0); } output_string(&window_top, "Hello World!"); output_string(&window_bottom, "TOS is fun!\n"); output_string(&window_bottom, "-----------"); while (1); } 2
TOS under Bochs 3
Internal parts of a 3 ½ ‑ inch floppy disk 1. A hole that indicates a high-capacity disk. 2. The hub that engages with the drive motor. 3. A shutter that protects the surface when removed from the drive. 4. The plastic housing. 5. A polyester sheet reducing friction against the disk media as it rotates within the housing. 6. The magnetic coated plastic disk. 7. A schematic representation of one sector of data on the disk; the tracks and sectors are not visible on actual disks. 8. The write protection tab (unlabeled) is upper left. 4 https://en.wikipedia.org/wiki/Floppy_disk
USB Floppy Drive 5 http://a.co/3jvn7M5
Running TOS on Real Hardware • How to make TOS run on real hardware? • Recap: Makefile will create tos.img that contains the TOS kernel. – Makefile will create image/disk_image that contains a FAT formatted floppy disk image. – .bochsrc refers to disk_image via the floppya parameter. – • Inspecting disk_image : # Size of disk_image is 1.44 MB ls -l image/disk_image # disk_image is a FAT-formatted image file image/disk_image # Create a mount point and mount disk_image sudo mkdir /mnt/tos sudo mount image/disk_image /mnt/tos df # Shows tos.img and stage2.bin ls –l /mnt/tos # Un-mount disk_image sudo umount /mnt/tos df 6
Creating a Boot Floppy • Requires a physical floppy disk (e.g., USB-connected floppy disk) and a floppy. • File disk_image needs to be transferred to the floppy disk. This cannot be done with the regular cp command! (why?) • Ubuntu: – Use dd (disk dump): dd if=image/disk_image of=/dev/fd0 • Windows: – rawrite (http://www.chrysocome.net/rawwrite) • Once disk_image is transferred for the first time, it is possible to mount the floppy disk and just copy tos.img . • The floppy can then used on an IBM PC compatible computer that has a (USB) floppy drive. • Note: might change in BIOS settings to allow booting from floppy! 7
Recommend
More recommend