Fix Constant-YOP table, Type 18, truncation guards

Type 9 Constant-YOP: Implement exact constant table from docs.
  Index = (YY<<2)|CC, value = 1<<idx for BO=01, -(1<<idx)-1
  for BO=11.  Special case idx=15: -32768 / +32767.
  (was: simple cc with optional negate, completely wrong values)

Type 18: Fix DIS encoding to check for bit pattern 10 (was 01).
  Verified all 8 modes against assembler: ENA/DIS for
  AS, MM, BR, TI all correct.

Truncation guards: Use saved 'avail' from original op->size
  instead of checking op->size after it was set to 3.
  (was: always true, guards never triggered)
This commit is contained in:
Dr. Christian Giessen
2026-04-22 20:05:17 +00:00
parent 1c28f027b8
commit ae98262bb7
3 changed files with 37 additions and 10 deletions

View File

@@ -0,0 +1,17 @@
/*
* type18_test.dsp -- Verify Type 18 mode control encoding.
*/
.section/PM program0;
.global _start;
_start:
ena ar_sat;
dis ar_sat;
ena m_mode;
dis m_mode;
ena bit_rev;
dis bit_rev;
ena timer;
dis timer;
nop;
_halt:
jump _halt;