diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-12-26 13:22:28 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-12-26 13:30:04 -0800 |
commit | d8eacb3893a310f6f0ca5ef7ad9a7653fc7a8c67 (patch) | |
tree | e6d73bbc988e894e4f6b6b585dde7b9c08e2c819 | |
parent | 2fcf7e24d14bad5c66071ba0c7c313e480987e50 (diff) | |
download | mu-d8eacb3893a310f6f0ca5ef7ad9a7653fc7a8c67.tar.gz |
7403 - baremetal/ for apps without a kernel
-rw-r--r-- | baremetal/README.md | 2 | ||||
-rw-r--r-- | baremetal/boot.bochsrc (renamed from apps/boot.bochsrc) | 0 | ||||
-rw-r--r-- | baremetal/boot0.hex (renamed from apps/boot.hex) | 12 | ||||
-rw-r--r-- | baremetal/bos/3-1.hex (renamed from apps/bos/3-1.hex) | 4 | ||||
-rw-r--r-- | baremetal/bos/3-2.hex (renamed from apps/bos/3-2.hex) | 4 | ||||
-rw-r--r-- | baremetal/bos/32bit.hex (renamed from apps/bos/32bit.hex) | 4 | ||||
-rw-r--r-- | baremetal/bos/4.asm (renamed from apps/bos/4.asm) | 0 | ||||
-rw-r--r-- | baremetal/bos/4.xxd (renamed from apps/bos/4.xxd) | 0 | ||||
-rw-r--r-- | baremetal/bos/README.md (renamed from apps/bos/README.md) | 0 | ||||
-rw-r--r-- | baremetal/bos/bochsrc (renamed from apps/bos/bochsrc) | 0 | ||||
-rw-r--r-- | baremetal/bos/print-mem-real-mode.hex (renamed from apps/bos/print-mem-real-mode.hex) | 2 |
11 files changed, 16 insertions, 12 deletions
diff --git a/baremetal/README.md b/baremetal/README.md new file mode 100644 index 00000000..af45760c --- /dev/null +++ b/baremetal/README.md @@ -0,0 +1,2 @@ +Some apps written in SubX and Mu. Where the rest of this repo relies on a few +Linux syscalls, the apps in this subdirectory interface directly with hardware. diff --git a/apps/boot.bochsrc b/baremetal/boot.bochsrc index 521e22d9..521e22d9 100644 --- a/apps/boot.bochsrc +++ b/baremetal/boot.bochsrc diff --git a/apps/boot.hex b/baremetal/boot0.hex index 8b11dbab..793b2b9f 100644 --- a/apps/boot.hex +++ b/baremetal/boot0.hex @@ -1,8 +1,10 @@ -# Bootable image that: +# A minimal bootable image that: # - loads more sectors past the first boot sector (using BIOS primitives) # - switches to 32-bit mode (giving up access to BIOS primitives) # - sets up a handler for keyboard events -# - as an example program, prints alphabets to the top-left position on screen (by writing to memory-mapped VGA memory) as they're typed +# - as an example program, prints '1' to the top-left position on screen (by writing to memory-mapped VGA memory) when the '1' key is typed +# +# When it's ready to accept keys, it prints 'H' to the top-left of the screen. # # If the initial load fails, it prints 'D' to the top-left of the screen and # halts. @@ -10,12 +12,12 @@ # To convert to a disk image, first prepare a realistically sized disk image: # dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB # Now fill in sectors: -# ./bootstrap run apps/hex < apps/boot.hex > boot.bin +# ./bootstrap run apps/hex < baremetal/boot0.hex > boot.bin # dd if=boot.bin of=disk.img conv=notrunc # To run: # qemu-system-i386 disk.img # Or: -# bochs -f apps/boot.bochsrc # boot.bochsrc loads disk.img +# bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.img # # Since we start out in 16-bit mode, we need instructions SubX doesn't # support. @@ -264,7 +266,7 @@ e9 fb ff ff ff # loop forever 55 aa ## sector 2 -# not loaded on boot; loaded by load_disk +# loaded by load_disk, not automatically on boot # offset 200 (address 0x7e00): interrupt descriptor table # 32 entries * 8 bytes each = 256 bytes (0x100) diff --git a/apps/bos/3-1.hex b/baremetal/bos/3-1.hex index 75e10c1f..bf4ef208 100644 --- a/apps/bos/3-1.hex +++ b/baremetal/bos/3-1.hex @@ -3,11 +3,11 @@ # 16-bit real mode. # # To convert to a disk image: -# ./bootstrap run apps/hex < apps/bos/3-1.hex > boot.bin +# ./bootstrap run apps/hex < baremetal/bos/3-1.hex > boot.bin # To run: # qemu-system-i386 boot.bin # Or: -# bochs -f apps/bos/bochsrc # bochsrc loads boot.bin +# bochs -f baremetal/bos/bochsrc # bochsrc loads boot.bin # # Expected output inside emulator: # Booting from floppy... diff --git a/apps/bos/3-2.hex b/baremetal/bos/3-2.hex index a52d2a88..85792e26 100644 --- a/apps/bos/3-2.hex +++ b/baremetal/bos/3-2.hex @@ -3,11 +3,11 @@ # 16-bit real mode. # # To convert to a disk image: -# ./bootstrap run apps/hex < apps/bos/3-2.hex > boot.bin +# ./bootstrap run apps/hex < baremetal/bos/3-2.hex > boot.bin # To run: # qemu-system-i386 boot.bin # Or: -# bochs -f apps/bos/bochsrc # bochsrc loads boot.bin +# bochs -f baremetal/bos/bochsrc # bochsrc loads boot.bin # # Expected output inside emulator: # Hello diff --git a/apps/bos/32bit.hex b/baremetal/bos/32bit.hex index e8b1f21a..5a85aa36 100644 --- a/apps/bos/32bit.hex +++ b/baremetal/bos/32bit.hex @@ -2,11 +2,11 @@ # Must have exactly 512 bytes. # # To convert to a disk image: -# ./bootstrap run apps/hex < apps/bos/32bit.hex > boot.bin +# ./bootstrap run apps/hex < baremetal/bos/32bit.hex > boot.bin # To run: # qemu-system-i386 boot.bin # Or: -# bochs -f apps/bos/bochsrc # bochsrc loads boot.bin +# bochs -f baremetal/bos/bochsrc # bochsrc loads boot.bin # # Expected output inside emulator: # H diff --git a/apps/bos/4.asm b/baremetal/bos/4.asm index 71c51d97..71c51d97 100644 --- a/apps/bos/4.asm +++ b/baremetal/bos/4.asm diff --git a/apps/bos/4.xxd b/baremetal/bos/4.xxd index be677134..be677134 100644 --- a/apps/bos/4.xxd +++ b/baremetal/bos/4.xxd diff --git a/apps/bos/README.md b/baremetal/bos/README.md index 989ebf44..989ebf44 100644 --- a/apps/bos/README.md +++ b/baremetal/bos/README.md diff --git a/apps/bos/bochsrc b/baremetal/bos/bochsrc index de225b4c..de225b4c 100644 --- a/apps/bos/bochsrc +++ b/baremetal/bos/bochsrc diff --git a/apps/bos/print-mem-real-mode.hex b/baremetal/bos/print-mem-real-mode.hex index 5e41d5b3..3610308c 100644 --- a/apps/bos/print-mem-real-mode.hex +++ b/baremetal/bos/print-mem-real-mode.hex @@ -1,7 +1,7 @@ # Experiment: write to video RAM from 16-bit real mode. And it works. # # To convert to a disk image: -# ./bootstrap run apps/hex < apps/bos/print-mem-real-mode.hex > boot.bin +# ./bootstrap run apps/hex < baremetal/bos/print-mem-real-mode.hex > boot.bin # To run: # qemu-system-i386 boot.bin # Or: |