7460 - baremetal backend for SubX

This commit is contained in:
Kartik Agaram 2020-12-29 17:34:43 -08:00
parent 3618118c8d
commit c1b1d1f4e6
4 changed files with 263 additions and 2178 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

23
baremetal/ex1.subx Normal file
View File

@ -0,0 +1,23 @@
# The simplest possible program: just an infinite loop.
# All is well if your computer clears screen and hangs without restarting.
# 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 run:
# qemu-system-i386 disk.img
# Or:
# bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.img
== code
$loop:
e9/jump $loop/disp32
# vim:ft=subx

26
translate_subx_baremetal Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
# Translate given SubX files to 'baremetal'. The output isn't an ELF binary
# and won't run directly on Linux or the emulator. It's intended to be
# combined with some boot sectors into a bootable disk image.
set -e
./build
cat $* |apps/braces > a.braces
cat a.braces |apps/calls > a.calls
cat a.calls |apps/sigils > a.sigils
cat a.sigils |apps/tests > a.tests
# no assort since baremetal SubX doesn't have segments yet
cat a.tests |apps/dquotes > a.dquotes
cat a.dquotes |apps/pack > a.pack
cat a.pack |apps/survey_baremetal > a.survey
cat a.survey |apps/hex > a.bin