Verify and fix gap types against assembler output

Assembler-verified and fixed:
- Type 12: XOP field corrected to bits10-8 (was bits11-9)
- Type 14: SF=4bits, XREG uses reg0[] not xop_shift[] (was 3-bit OOB)
- Type 16: XREG uses reg0[] (was xop_shift[], 4-bit index OOB)
- Type 19: I-reg field at bits3-2 (was bits1-0), now correct for jump(i2)
- Type 26: Push/Pop encoding is 10/11 not 01/10;
  PPP=bits6-5, LPP=bits4-3 (was bits6-4, bits3-2)
  All 6 variants verified: push/pop sts, loop, pc

Assembler-verified unchanged:
- Type 21/21a: MODIFY correct
- Type 23/24: DIVQ/DIVS correct
- Type 29: DM immediate modify read/write correct
- Type 32: Any Reg <-> DM read/write correct
- Type 34/35: IO/System register read/write correct
- Type 36: LJUMP 2-word correct
- Type 37: SETINT/CLRINT correct

Remaining note: Type 12 SF field may use a different mapping
than sf_names[] for combined shift+memory ops (ASHIFT encodes
as SF=2 not SF=4). Needs further investigation.
This commit is contained in:
Dr. Christian Giessen
2026-04-22 20:16:30 +00:00
parent 7c416c1b54
commit 9a82c4d522
6 changed files with 107 additions and 20 deletions

Binary file not shown.

View File

@@ -0,0 +1,83 @@
/*
* verify_gaps.dsp -- Assembler verification for structural-only types.
* Tests Types 12, 14, 16, 19, 21, 21a, 22, 23, 24, 26, 29, 32, 34, 35, 36, 37.
*/
.section/PM program0;
.global _start;
_start:
/* Setup */
i0 = 0x0100;
i4 = 0x0200;
m0 = 1;
m4 = 1;
l0 = 0;
l4 = 0;
ax0 = 0x1234;
si = 0x00FF;
/* Type 12: Shift + DM read */
sr = lshift si (hi), mx0 = dm(i0,m0);
/* Type 12: Shift + DM write */
sr = ashift si (hi), dm(i0,m0) = ax0;
/* Type 14: Shift + Dreg move */
sr = lshift si (hi), ax0 = mx0;
/* Type 16: Conditional shift */
if eq sr = lshift si (hi);
sr = lshift si (hi);
/* Type 19: Indirect jump */
i2 = _after_indirect;
jump (i2);
_after_indirect:
nop;
/* Type 21: MODIFY (reg) */
modify(i0,m0);
/* Type 21a: MODIFY (imm) */
modify(i0,5);
/* Type 23: DIVQ */
divq ax0;
/* Type 24: DIVS */
divs ay0, ax0;
/* Type 26: Push/Pop */
push sts;
pop sts;
push loop;
pop loop;
push pc;
pop pc;
/* Type 29: DM immediate modify */
ax0 = dm(i0,1);
dm(i0,1) = ax0;
/* Type 32: Any Reg <-> DM (postmodify) */
ar = dm(i0,m0);
dm(i0,m0) = ar;
/* Type 34: IO */
ax0 = io(0x00);
io(0x00) = ax0;
/* Type 35: System register */
ax0 = reg(0x00);
reg(0x00) = ax0;
/* Type 37: SETINT/CLRINT */
setint 3;
clrint 3;
/* Type 36: Long jump */
ljump _end;
_end:
nop;
_halt:
jump _halt;

Binary file not shown.

Binary file not shown.