diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-12-29 18:56:21 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-12-29 18:56:21 -0800 |
commit | 796f3b70f264a13a48f8b0247a997f074e5995c3 (patch) | |
tree | 840ec9eabaf0af5f0dcdd8af8cf9e96eecf82d5f | |
parent | c1b1d1f4e67b0badfef3473121220d34a5b4b418 (diff) | |
download | mu-796f3b70f264a13a48f8b0247a997f074e5995c3.tar.gz |
7461
-rw-r--r-- | baremetal/boot.bochsrc | 4 | ||||
-rw-r--r-- | baremetal/boot.hex | 2 | ||||
-rw-r--r-- | baremetal/ex1.hex | 2 | ||||
-rw-r--r-- | baremetal/ex1.subx | 9 | ||||
-rw-r--r-- | baremetal/ex2.hex | 2 | ||||
-rw-r--r-- | baremetal/ex3.hex | 2 | ||||
-rwxr-xr-x | translate_subx_baremetal | 6 |
7 files changed, 14 insertions, 13 deletions
diff --git a/baremetal/boot.bochsrc b/baremetal/boot.bochsrc index 521e22d9..b018d7f2 100644 --- a/baremetal/boot.bochsrc +++ b/baremetal/boot.bochsrc @@ -1,5 +1,5 @@ -# Configuration for the Bochs x86 CPU emulator to run the output of apps/boot.hex -# See apps/boot.hex for more details. +# Configuration for the Bochs x86 CPU emulator to run the output of baremetal/boot.hex +# See baremetal/boot.hex for more details. ata0-master: type=disk, path="disk.img", mode=flat, cylinders=20, heads=16, spt=63 # 10MB, 512 bytes per sector boot: disk diff --git a/baremetal/boot.hex b/baremetal/boot.hex index cae8b456..1675b167 100644 --- a/baremetal/boot.hex +++ b/baremetal/boot.hex @@ -17,7 +17,7 @@ # 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. diff --git a/baremetal/ex1.hex b/baremetal/ex1.hex index 238823e9..8dadf0e2 100644 --- a/baremetal/ex1.hex +++ b/baremetal/ex1.hex @@ -11,7 +11,7 @@ # 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 # main: (address 0x8800) e9 fb ff ff ff # jump to address 0x8800 diff --git a/baremetal/ex1.subx b/baremetal/ex1.subx index 196b4104..9507bad3 100644 --- a/baremetal/ex1.subx +++ b/baremetal/ex1.subx @@ -3,13 +3,8 @@ # On an emulator the window may get bigger to accomodate the higher-resolution # graphics mode. # -# 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 -# Load the program on the disk image: -# ./translate_subx_baremetal baremetal/ex1.subx # emits a.bin -# apps/hex < baremetal/boot.hex > boot.bin -# cat boot.bin a.bin > disk.bin -# dd if=disk.bin of=disk.img conv=notrunc +# To build a disk image: +# ./translate_subx_baremetal baremetal/ex2.subx # emits disk.img # To run: # qemu-system-i386 disk.img # Or: diff --git a/baremetal/ex2.hex b/baremetal/ex2.hex index 4ab558d8..46ff3a7a 100644 --- a/baremetal/ex2.hex +++ b/baremetal/ex2.hex @@ -8,7 +8,7 @@ # 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 # main: (address 0x8800) diff --git a/baremetal/ex3.hex b/baremetal/ex3.hex index 79fe8cf8..6c6300ea 100644 --- a/baremetal/ex3.hex +++ b/baremetal/ex3.hex @@ -8,7 +8,7 @@ # 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 # main: (address 0x8800) diff --git a/translate_subx_baremetal b/translate_subx_baremetal index 4ba5f81c..855aee2a 100755 --- a/translate_subx_baremetal +++ b/translate_subx_baremetal @@ -24,3 +24,9 @@ cat a.dquotes |apps/pack > a.pack cat a.pack |apps/survey_baremetal > a.survey cat a.survey |apps/hex > a.bin + +# Create disk.img containing baremetal/boot.hex and a.bin +dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB +apps/hex < baremetal/boot.hex > boot.bin +cat boot.bin a.bin > disk.bin +dd if=disk.bin of=disk.img conv=notrunc |