about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-12-21 00:04:38 -0800
committerKartik Agaram <vc@akkartik.com>2020-12-21 00:04:38 -0800
commit946dfe7ffb4bbf1e0f3f85b3560c9f9395b708e0 (patch)
tree25d477f430e7e0c4313ffbad1a1cec13b9d10e5e
parent6ac16fd1ae275fb4042ab4aa85df3ccc86f3e615 (diff)
downloadmu-946dfe7ffb4bbf1e0f3f85b3560c9f9395b708e0.tar.gz
7370
Use a more realistically sized disk image. Now we can read the second sector.
-rw-r--r--apps/boot.bochsrc4
-rw-r--r--apps/boot.hex11
2 files changed, 8 insertions, 7 deletions
diff --git a/apps/boot.bochsrc b/apps/boot.bochsrc
index 6643905c..521e22d9 100644
--- a/apps/boot.bochsrc
+++ b/apps/boot.bochsrc
@@ -1,8 +1,6 @@
 # Configuration for the Bochs x86 CPU emulator to run the output of apps/boot.hex
 # See apps/boot.hex for more details.
 
-# You'll probably want to adjust the disk geometry below when you update
-# boot.hex and alter the size of boot.bin.
-ata0-master: type=disk, path="boot.bin", mode=flat, cylinders=1, heads=1, spt=1
+ata0-master: type=disk, path="disk.img", mode=flat, cylinders=20, heads=16, spt=63  # 10MB, 512 bytes per sector
 boot: disk
 log: -
diff --git a/apps/boot.hex b/apps/boot.hex
index a95c1de7..ec65898d 100644
--- a/apps/boot.hex
+++ b/apps/boot.hex
@@ -6,12 +6,15 @@
 # If the initial load fails, it prints 'D' to the top-left of the screen and
 # halts.
 #
-# To convert to a disk image:
+# 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
+#   dd if=boot.bin of=disk.img conv=notrunc
 # To run:
-#   qemu-system-i386 boot.bin
+#   qemu-system-i386 disk.img
 # Or:
-#   bochs -f apps/boot.bochsrc  # boot.bochsrc loads boot.bin
+#   bochs -f apps/boot.bochsrc  # boot.bochsrc loads disk.img
 #
 # Since we start out in 16-bit mode, we need instructions SubX doesn't
 # support.
@@ -37,7 +40,7 @@
   b2 80  # dl <- 80  # hdd 0
   b5 00  # ch <- 0  # cylinder 0
   b6 00  # dh <- 0  # track 0
-  b1 01  # cl <- 1  # sector 0 (first sector, 1-based)
+  b1 02  # cl <- 2  # second sector, 1-based
   b0 01  # al <- 1  # number of sectors to read
   # address to write sectors to = es:bx = 0x7e00, contiguous with boot segment
   bb 00 00  # bx <- 0