The initial prototyping was done on linux with the goal of not requiring anything other than the linux kernel.
However it was pointed out to me that should a trusting trust attack be in the compiled kernel, there would be no way to even trust the binaries produced by these programs.
The only real problem is that the commented hex has to be manually validated [An insanely painful process] and each and every single platform has to perform the exact same tasks.
This program can be used to bootstrap any binary program in a trusted manner from commented hex0 input or as the most terrible text editor in existence.
** stage1
*** stage1_assembler-0.hex0
Using the stage0_monitor, you can produce the stage1_assembler-0 by either manually typing in the commented hex or if you make production:
cp roms/stage0_monitor rom
./bin/vm rom < stage1/stage1_assembler-0.hex0
Which produces 2 files of value:
tape_02 which is the source code that you just manually typed in [or piped]
With this tool in our toolkit, we now have everything we need to be moderately productive in creating commented Hex programs.
*** stage1_assembler-1.hex0
After being able to write arbitrary commented Hex programs, we soon discover that it is a massive pain in the ass to manually calculate displacement values.
So we upgrade our assembler to include single character labels, which will save us a bunch of pain.
After being written by SET, it can then be compiled via the stage1_assembler-0 using the following commands:
cp roms/stage1_assembler-0 rom
./bin/vm rom
The contents of tape_02 is now stage1_assembler-1, which supports single character labels.
This however is just a stopgap solution to the real problem of needing to support arbitrary labels but gives us enough to make the next step easier.
*** stage1_assembler-2.hex1
After being able to include single character labels in our commented Hex programs, we soon run into that rather small limit to the number of labels we can use.
So we upgrade our assembler to include 64 character labels and absolute address labels.
Afer being written by SET, it can then be compiled via the stage1_assembler-1 using the following commands:
cp roms/stage1_assembler-1 rom
./bin/vm rom
The contents of tape_02 is now stage1_assembler-2, which supports 64 character labels and absolute address labels.
Now if you are like me, at this point you are tired of having to remember the hex values for a bunch of assembly instructions and would prefer for software to handle that instead.
*** M0-macro.hex2
Because we don't know what relationship between hex and string is going to be most useful in the future, we are going to define only the single keyword: DEFINE
Which will replace all non-macro/strings that match it, but that of course requires us to also type the definitions, for that we created a definitions file:
High_level_prototypes/defs
Which you would want to prepend to any assembly program you write.
For those wishing to keep their definitions seperate from their code, cat High_level_prototypes/defs mycode.s > tape_01 will be sufficient.
However to keep this program as simple as possible: this program will not produce binaries, rather hex2 files that can be compiled to binary via stage1_assembler-2
After being written by SET, it can becompiled via the stage1_assembler-2 using the following commands:
cp roms/stage1_assembler-2 rom
./bin/vm rom
The contents of tape_02 is now the M0 macro assembler, which now does alot of useful functionality for us, however everything it produces needs to go through stage1_assembler-2 to become a working binary.