Monitor: a line assembler
a <address>, then instructions until a line that is just a dot. The syntax is the assembler's own: a selector rides on the mnemonic as LDA.0 or LDD.0.1, and leaving one off means Data Pointer 0 exactly as it does in a source file, so nothing learned at the monitor has to be unlearned when writing a program. Case is folded, since the assembler does not care either. Numbers are hexadecimal and bare. A source file writes 0x2000 or 0d16 because it has both and must say which; a monitor has one and says so once, in the manual, rather than on every line. It reads the same table the disassembler does, searched the other way round, which is the point of it being a table rather than two lists: what a writes, d reads back, and neither can drift from the other or from the assembler both were generated from. Instruction lengths come from the shared shape table too, so the cursor cannot get out of step with what was written. THE WHOLE LINE IS UNDERSTOOD BEFORE ANYTHING IS WRITTEN. Emitting the opcode first and discovering a missing operand afterwards leaves half an instruction in memory, which the next line usually covers up and the last line of a session does not. Written that way first and fixed. What cannot be written is a label, and that is the whole difference between this and the assembler proper: a label is a promise to fill an address in later, and later is what a line at a time does not have. The recorded test now types in a complete program - a string poked into Data Memory, instructions assembled into Program Memory, and the result run - and includes a lower case mnemonic, both selector forms, an instruction that does not exist and one missing its value, so the refusals sit beside the successes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c23adb2836
commit
3b800a69e8
@@ -3,11 +3,11 @@ CosmOS
|
||||
> two stops, and what the registers were at each
|
||||
break at 200E
|
||||
A 11 B 22 Q 00 status 00
|
||||
DP0 1030 DP1 05EF DP2 039A DP3 2000 SP FFFF
|
||||
DP0 1030 DP1 0661 DP2 039A DP3 2000 SP FFFF
|
||||
press a key
|
||||
break at 2023
|
||||
A 44 B 55 Q 00 status 00
|
||||
DP0 1000 DP1 05EF DP2 039A DP3 2000 SP FFF5
|
||||
DP0 1000 DP1 0661 DP2 039A DP3 2000 SP FFF5
|
||||
press a key
|
||||
carried on to the end
|
||||
finished
|
||||
|
||||
@@ -8,7 +8,7 @@ finished
|
||||
cd
|
||||
the console has been handed back
|
||||
finished
|
||||
> > x examine, d disassemble, s set, b bank, g go, exit leaves
|
||||
> > x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves
|
||||
* bank 00
|
||||
* FE00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
FE10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
CosmOS
|
||||
> x examine, d disassemble, s set, b bank, g go, exit leaves
|
||||
> x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves
|
||||
* b <program|data|number>
|
||||
* there is no such bank
|
||||
* loaded, starting at 2000
|
||||
@@ -46,6 +46,20 @@ finished
|
||||
800A 00 ADD
|
||||
800B 00 ADD
|
||||
800C 00 ADD
|
||||
* bank 01
|
||||
* * bank 00
|
||||
* 8200: 8204: 8206: 8208: 820B: no such instruction
|
||||
820B: that one needs a value after it
|
||||
820B: 820D: * 8200 47 00 81 00 SETD.0 8100
|
||||
8204 18 10 SWI 10
|
||||
8206 42 02 LDA.2
|
||||
8208 4A 00 01 LDD.0.1
|
||||
820B 18 12 SWI 12
|
||||
820D 00 ADD
|
||||
820E 00 ADD
|
||||
820F 00 ADD
|
||||
* hello, typed
|
||||
finished
|
||||
* > greet.sbx 210
|
||||
hello.sbx 52
|
||||
Life.sbx 1411
|
||||
|
||||
@@ -15,6 +15,20 @@ s 8000 26 48 D1 00 26 0A D1 00 18 12
|
||||
d 8000
|
||||
g 8000
|
||||
d 8000
|
||||
b data
|
||||
s 8100 68 65 6C 6C 6F 2C 20 74 79 70 65 64 0A 00
|
||||
b program
|
||||
a 8200
|
||||
SETD.0 8100
|
||||
SWI 10
|
||||
lda.2
|
||||
LDD.0.1
|
||||
frobnicate
|
||||
INIA
|
||||
SWI 12
|
||||
.
|
||||
d 8200
|
||||
g 8200
|
||||
exit
|
||||
dir
|
||||
exit
|
||||
|
||||
@@ -225,6 +225,12 @@ cosmosRun | CosmOS/Source/cosmos.asm | run | cosmosRun
|
||||
# It also asks to write into bank 2, the controller's own table, which is published read
|
||||
# only. That used to stop the machine, and the recorded output of this test contained the
|
||||
# crash without anybody noticing, which is what blessing a result without reading it buys.
|
||||
#
|
||||
# It ends with a whole program typed in: a string poked into Data Memory, instructions
|
||||
# assembled into Program Memory, and the result run - which prints something no assembler
|
||||
# ever saw. The mnemonics deliberately include a lower case one, both selector forms, an
|
||||
# instruction that does not exist and one missing its value, so that the refusals are
|
||||
# recorded next to the successes and a failed line is shown writing nothing.
|
||||
cosmosMonitor | CosmOS/Source/cosmos.asm | run | cosmosMonitor.in | - | disks/cosmos.img
|
||||
# The original hello.asm, brought over as an application. It is not much of a program,
|
||||
# but it is the one that talks to the hardware directly: it writes to port 0x00 instead
|
||||
|
||||
Reference in New Issue
Block a user