Skip to content

fix: add appropriate A instruction value constraints#634

Open
mmatsumoto1026 wants to merge 1 commit intonand2tetris:mainfrom
mmatsumoto1026:fix/add-appropriate-A-instruction-value-constraints
Open

fix: add appropriate A instruction value constraints#634
mmatsumoto1026 wants to merge 1 commit intonand2tetris:mainfrom
mmatsumoto1026:fix/add-appropriate-A-instruction-value-constraints

Conversation

@mmatsumoto1026
Copy link
Copy Markdown
Contributor

@mmatsumoto1026 mmatsumoto1026 commented Mar 8, 2026

Closes: #631

This PR was opened to add appropriate A instruction value constraints so that web-ide's Assembler makes A instruction with invalid value disable to translate into binary machine code.

  • For @-1 instruction
    With referencing the Ohm-js documentation, aInstruction grammar in asm.ohm.js and asm.ohm are changed from decNumber to digit+.

  • For @32768 instruction
    In A function of asm.ts, too large invalid value of A instruction detected and then throw an error message which will be showed in StatusLine footer.

The code was tested locally as described in following.

  • Manually writing @-1, @32768 in the editor of web-ide's Assembler and confirm that the assembly code cause a syntax error, show the error message, and can not translate them into binary machine code.
  • The Assembler can appropriately translate valid Fill.asm code into binary, and then successfully load in CPU Emulator, and the Emulator can run the machine instruction codes with proper functionality, and without any error.
  • The Fill.asm can be sucessfully loaded on CPU Emulator's ROM directly in the web-ide, and the translated machine instructions fullfill the vehavior specification properly.

Unit tests are also added, which ensure the Ohm's grammar validation functionality and solving original issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assembler accepts @32768 and assembles to D&A

1 participant