Commit 8c7312d
fix: Restore Z-Machine opcode validation for Zork I compatibility
Fixes critical regression where interpreter incorrectly rejected opcode 0x15
(sub instruction), causing Zork I and other commercial games to fail with
"Invalid Long form opcode 0x15" errors.
Changes:
- Updated src/instruction.rs validation from 0x01-0x14 to 0x01-0x1C
- Added comprehensive opcode documentation (0x14=add, 0x15=sub, etc.)
- Updated unit tests to reflect correct validation ranges
- Documented opcode validation architecture in ARCHITECTURE.md
- Confirmed fix with successful Zork I testing
Root cause: Commit d7dec5c implemented overly restrictive validation that
rejected fundamental Z-Machine arithmetic operations (sub, mul, div, mod).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 4427e2c commit 8c7312d
3 files changed
+84
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
389 | 439 | | |
390 | 440 | | |
391 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
173 | 175 | | |
174 | | - | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
696 | 698 | | |
697 | 699 | | |
698 | 700 | | |
699 | | - | |
700 | | - | |
| 701 | + | |
| 702 | + | |
701 | 703 | | |
702 | | - | |
| 704 | + | |
703 | 705 | | |
704 | 706 | | |
705 | 707 | | |
| |||
708 | 710 | | |
709 | 711 | | |
710 | 712 | | |
711 | | - | |
712 | | - | |
| 713 | + | |
| 714 | + | |
713 | 715 | | |
714 | 716 | | |
715 | 717 | | |
716 | 718 | | |
717 | | - | |
| 719 | + | |
718 | 720 | | |
719 | 721 | | |
720 | 722 | | |
| |||
735 | 737 | | |
736 | 738 | | |
737 | 739 | | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
738 | 759 | | |
739 | 760 | | |
0 commit comments