OK, folks, this is a work-in-progress, but as it is, it is functional and (as far as I can tell) correct.
It’s written in Excel (huh, really?), with a mix of worksheet functions, keyboard macros, and VBA code.
I built a dictionary of all documented Kenbak-1 opcodes, in octal and as mnemonics.
The main event is the first tab, named Encoder.
The second tab, Decoder, was a quick disassembler, useful for analyzing code dumps from elsewhere.
Also attached are two Kenbak docs, including the original coding sheet.
In the Encoder tab, hitting ctrl-Q pops up an entry form, with Label, Address, and Instruction fields.
The address defaults to 3 initially, to preload the PC register. And the focus in in the Instruction foeld.
Start typing an instruction, say you want to enter “LOAD A, CONSTANT”; as soon as you type the “L”, the combo box fills in “LOAD A, CONSTANT”. If you wanted “LOAD B …”, either type a little farther, or use the down-arrow to walk the (alphabetical) list of instructions. Click on the Insert button or double-Enter to insert the instruction (first byte only) at the current address. The address will automatically increment for the next step. If the instruction requires a second byte for a constant, address, etc., enter that as either a numeric (octal!) constant, or as a label. Before entering the line, you may also type a label in the Label field.
The Encoder emulates (sort of) a two-pass assembler. In the first pass, the programmer’s code is entered, taking up as many bytes as necessary as it grows, but labels are only entered as placeholder. In the second pass, the placeholders are resolved and filled in with the actual addresses. In this model, whenever you enter a name in the label field, it is added to the dictionary, along with its sequential address. The column next to the instructions, that is building the octal opcodes, immediately references the dictionary and the numeric address updates in real time. The label dictionary is actually a tail appended to the instruction dictionary (in the All Codes tab), so it’s all the same process.
Before starting to enter a program, hit ctrl-E to erase any pre-existing labels. As the new program is entered, the dictionary is extended again, for the new codes.
When you’re satisfied with the program as displayed, hit ctrl-W to write the code to a condensed block of octal bytes, ready to copy and paste into the Kenbak-1 JS Emulator’s Memory Loader page. Per Jim’s request, I added a similar block in hex, below the 16 lines of octal strings.
To the right, there are two columns labelled “Octal Addr” and “Code”. These are 256 row columns with the address and code bytes stacked up, useful if printed out (hint: use “set Print Area”) f0or hand entry into the Kenbak. And,to the right of those, the same data in hex…
As attached, the program contains Frank’s Hello World! Program, with the addition of writing the character to the output port as well as to serial using SYSEX. This runs fine in the JS Emulator, and if you slow the exectution down or use the single-step function, you can see each ASCII byte in the data LEDs.
Dave
Thanks, Jim! It was a fun project.
Now, I need to add an RS-232 port or other means so I can reprogram the Atmega and stream in Kenbak code…
A couple notes on the assembler:
The shaded areas in the Encoder tab are pretty much keep-out zones.
They contain spreadsheet formulas that don’t change.
The clear, white area in columns C & D are where the code builds, and you can almost as easily enter stuff manually, especially in D. Useful for storing strings, instead of through the form.
Dave
--
You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/altair-duino/168583cb-8f2e-4a85-8ee5-3fdb7d8ec8c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.