Sixty four instructions becomes seventy
The six settled back on the twenty fourth, built now. RCAL and RRET are a call that puts nothing back. CALL restores A, B and Data Pointers 0 through 2, which costs ten bytes of Stack and is why a subroutine here can only hand anything back through Q, DP3 or memory. RCAL costs two and restores nothing, which is what a short leaf routine wants and is unsafe in exactly the way the name says. They are a pair because the frames are different sizes: returning from one through the other walks the Stack to somewhere that was never a return address. That was the user's correction to the original proposal, which had a raw call and no raw return. DPUA and DPDA offset a Data Pointer by A; DPUW and DPDW by A and B together, most significant first. DPUP and DPDN take a byte written into the program, so moving a pointer by something just worked out meant storing it and loading it back. Down as well as up on symmetry grounds, which was also the user's call - the argument against it came from counting uses in a corpus written under the constraint. The opcodes sit where they belong: 0x16 and 0x1E immediately below CALL and RET, and 0x4E through 0x51 at the end of the Data Pointer family. All six fit shapes that already existed, so instructiontable.py needed only set membership and both machine side copies of the table regenerated from it unchanged. Checked at every level it exists at: the emulator runs them, the host assembler encodes them, the monitor disassembles all six with the right lengths, and the assembler that runs on the machine builds a program using them byte for byte identically to the host - and that program runs. The recorded test measures what the two calls COST as well as what they put back, because an RCAL that quietly did what CALL does would still return to the right place. It does not survive that: returned through RRET, it hangs. docs.sh can read a two word number now. The count of instructions taking a Data Pointer went past twenty, and the pattern only allowed one word, so the check would have reported that the manual had stopped saying it rather than that the number was wrong. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
00d896e3e7
commit
af0360128b
@@ -36,9 +36,11 @@ Instruction instruction_set[] = {
|
||||
{0x1B, "BNA"},
|
||||
{0x1C, "BNB"},
|
||||
{0x1D, "BNC"},
|
||||
{0x16, "RCAL"},
|
||||
{0x17, "CALL"},
|
||||
{0x18, "SWI"},
|
||||
{0x19, "RETI"},
|
||||
{0x1E, "RRET"},
|
||||
{0x1F, "RET"},
|
||||
// Register Operations:
|
||||
{0x20, "RSTA"},
|
||||
@@ -77,6 +79,10 @@ Instruction instruction_set[] = {
|
||||
{0x4B, "STD"},
|
||||
{0x4C, "MVSD"},
|
||||
{0x4D, "MVDS"},
|
||||
{0x4E, "DPUA"},
|
||||
{0x4F, "DPDA"},
|
||||
{0x50, "DPUW"},
|
||||
{0x51, "DPDW"},
|
||||
// Output Operations:
|
||||
{0xD0, "OUTQ"},
|
||||
{0xD1, "OUTA"},
|
||||
@@ -123,6 +129,10 @@ int dataPointerOperands(uint8_t opcode) {
|
||||
case 0x49: // DPDN
|
||||
case 0x4C: // MVSD
|
||||
case 0x4D: // MVDS
|
||||
case 0x4E: // DPUA
|
||||
case 0x4F: // DPDA
|
||||
case 0x50: // DPUW
|
||||
case 0x51: // DPDW
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user