about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-07-05 17:53:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-07-05 17:53:57 -0700
commitf32caac6dfc86ce22587f0fe30901645f444bb23 (patch)
treedc2950a3b4b6a8e805268fd3ca22bc0b978c605b
parentac1d702cdc1817c7ba1ca9d463888687e2ad3b6d (diff)
downloadmu-f32caac6dfc86ce22587f0fe30901645f444bb23.tar.gz
grow code region yet again
We need a cleaner way to do this.
-rw-r--r--boot.subx14
-rwxr-xr-xtranslate_subx2
-rwxr-xr-xtranslate_subx_emulated2
3 files changed, 16 insertions, 2 deletions
diff --git a/boot.subx b/boot.subx
index 6e622a03..afabc193 100644
--- a/boot.subx
+++ b/boot.subx
@@ -150,6 +150,20 @@
   cd/syscall 0x13/imm8/bios-disk-services
   0f 82/jump-if-carry disk_error/disp16
 
+  # load two more tracks of disk into addresses [0x66400, 0x76000)
+  b4/copy-to-ah 2/imm8/read-drive
+  # dl comes conveniently initialized at boot time with the index of the device being booted
+  b5/copy-to-ch 0/imm8/cylinder
+  b6/copy-to-dh 0xc/imm8/head                 # <====
+  b1/copy-to-cl 1/imm8/sector  # 1-based
+  b0/copy-to-al 0x7e/imm8/num-sectors  # 2*63 = 126
+  # address to write sectors to = es:bx = 0x56800, contiguous with boot segment
+  bb/copy-to-bx 0x6640/imm16                  # <====
+  8e/->seg 3/mod/direct 3/rm32/bx 0/r32/es
+  bb/copy-to-bx 0/imm16
+  cd/syscall 0x13/imm8/bios-disk-services
+  0f 82/jump-if-carry disk_error/disp16
+
   # reset es
   bb/copy-to-bx 0/imm16
   8e/->seg 3/mod/direct 3/rm32/bx 0/r32/es
diff --git a/translate_subx b/translate_subx
index f52e964d..1d4565c4 100755
--- a/translate_subx
+++ b/translate_subx
@@ -35,7 +35,7 @@ cat a.survey    |linux/hex                                      > a.bin
 dd if=/dev/zero of=code.img count=20160  # 20*16*63 512-byte sectors = almost 10MB
 dd if=a.bin of=code.img conv=notrunc
 
-if [ `stat --printf="%s" a.bin` -ge 387072 ]  # 12 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
+if [ `stat --printf="%s" a.bin` -ge 451584 ]  # 14 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
 then
   echo "a.bin won't all be loaded on boot"
   exit 1
diff --git a/translate_subx_emulated b/translate_subx_emulated
index e6955032..a101c336 100755
--- a/translate_subx_emulated
+++ b/translate_subx_emulated
@@ -39,7 +39,7 @@ cat a.survey      |linux/bootstrap/bootstrap run linux/hex
 dd if=/dev/zero of=code.img count=20160  # 20*16*63 512-byte sectors = almost 10MB
 dd if=a.bin of=code.img conv=notrunc
 
-if [ `stat --printf="%s" a.bin` -ge 387072 ]  # 12 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
+if [ `stat --printf="%s" a.bin` -ge 451584 ]  # 14 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
 then
   echo "a.bin won't all be loaded on boot"
   exit 1