about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-01 22:41:13 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-03-01 22:41:13 -0800
commitce64fef18f4b0adc1e48a8d73f489fd410aea765 (patch)
tree91d5feb1b4cbeadbf10ec061a659ba7286f74c16
parentcfeb71c898f066197d55264dca9120b9ff9f60b6 (diff)
downloadmu-ce64fef18f4b0adc1e48a8d73f489fd410aea765.tar.gz
7835
-rw-r--r--baremetal/boot.hex19
-rwxr-xr-xtranslate_subx_baremetal2
-rwxr-xr-xtranslate_subx_baremetal_emulated2
3 files changed, 18 insertions, 5 deletions
diff --git a/baremetal/boot.hex b/baremetal/boot.hex
index 6a14017d..6fa874c2 100644
--- a/baremetal/boot.hex
+++ b/baremetal/boot.hex
@@ -143,6 +143,20 @@
   cd 13  # int 13h, BIOS disk service
   0f 82 9b 00  # jump-if-carry disk_error [label]
 
+  # load two more tracks of disk into addresses [0x27400, 0x37000)
+  b4 02  # ah <- 2  # read sectors from disk
+  # dl comes conveniently initialized at boot time with the index of the device being booted
+  b5 00  # ch <- 0  # cylinder 0
+  b6 02  # dh <- 2  # track 0
+  b1 01  # cl <- 1  # first sector, 1-based
+  b0 7e  # al <- 126  # number of sectors to read = 2*63
+  # address to write sectors to = es:bx = 0x17800
+  bb 80 17  # bx <- 0x1780 [label]
+  8e c3  # es <- bx
+  bb 00 00  # bx <- 0
+  cd 13  # int 13h, BIOS disk service
+  0f 82 9b 00  # jump-if-carry disk_error [label]
+
   # reset es
   bb 00 00  # bx <- 0
   8e c3  # es <- bx
@@ -172,9 +186,8 @@
   ea 00 7d 08 00  # far jump to initialize_32bit_mode after setting cs to the record at offset 8 in the gdt (gdt_code) [label]
 
 # padding
-# 76:
-                  00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+# 8e:
+                                          00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/translate_subx_baremetal b/translate_subx_baremetal
index f2d4274d..0a1f9dd2 100755
--- a/translate_subx_baremetal
+++ b/translate_subx_baremetal
@@ -39,7 +39,7 @@ apps/hex < baremetal/boot.hex  > boot.bin
 cat boot.bin a.bin > disk.bin
 dd if=disk.bin of=disk.img conv=notrunc
 
-if [ `stat --printf="%s" disk.bin` -ge 129024 ]  # 4 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
+if [ `stat --printf="%s" disk.bin` -ge 193536 ]  # 6 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
 then
   echo "disk.bin won't all be loaded on boot"
   exit 1
diff --git a/translate_subx_baremetal_emulated b/translate_subx_baremetal_emulated
index 881fcef1..63dd69dd 100755
--- a/translate_subx_baremetal_emulated
+++ b/translate_subx_baremetal_emulated
@@ -33,7 +33,7 @@ dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
 cat boot.bin a.bin > disk.bin
 dd if=disk.bin of=disk.img conv=notrunc
 
-if [ `stat --printf="%s" disk.bin` -ge 129024 ]  # 4 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
+if [ `stat --printf="%s" disk.bin` -ge 193536 ]  # 6 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
 then
   echo "disk.bin won't all be loaded on boot"
   exit 1