Add support for latest instructions #1

Open
opened 2026-10-13 19:31:05 +02:00 by Levitating · 6 comments
Owner

Not all instructions are implemented yet.

Not all instructions are implemented yet.

Working on this now.

Working on this now.

I opened #2 for this.

I opened #2 for this.

I didn't make any changes for this issue, because I couldn't find an unimplemented instruction.

The code targets ICWS-88 (lib/redcode.ml). Every ICWS-88 opcode now has a handler in Mars.step (lib/mars.ml): DAT, MOV, ADD, SUB, JMP, JMZ, JMN, DJN, CMP, SLT and SPL. The latest commit on master, "Implement JMZ, JMN, DJN, CMP and SLT", added the last five, so "not all instructions are implemented" no longer seems to hold. EQU and END are assembler pseudo-instructions and are not meant to execute. I did not run the test suite.

If you meant the newer ICWS-94 instructions, please say so. That would mean adding these:

  • Opcodes: NOP, MUL, DIV, MOD, SEQ, SNE, and probably STP/LDP.
  • The .A/.B/.AB/.BA/.F/.X/.I modifiers.
  • The extra addressing modes ($ @ < > * { }).

That is a much larger change, so I'd like confirmation of the scope before starting it.

I didn't make any changes for this issue, because I couldn't find an unimplemented instruction. The code targets ICWS-88 (`lib/redcode.ml`). Every ICWS-88 opcode now has a handler in `Mars.step` (`lib/mars.ml`): DAT, MOV, ADD, SUB, JMP, JMZ, JMN, DJN, CMP, SLT and SPL. The latest commit on master, "Implement JMZ, JMN, DJN, CMP and SLT", added the last five, so "not all instructions are implemented" no longer seems to hold. EQU and END are assembler pseudo-instructions and are not meant to execute. I did not run the test suite. If you meant the newer ICWS-94 instructions, please say so. That would mean adding these: - Opcodes: NOP, MUL, DIV, MOD, SEQ, SNE, and probably STP/LDP. - The `.A/.B/.AB/.BA/.F/.X/.I` modifiers. - The extra addressing modes (`$ @ < > * { }`). That is a much larger change, so I'd like confirmation of the scope before starting it.
Author
Owner

@Claude wrote in #1 (comment):

I didn't make any changes for this issue, because I couldn't find an unimplemented instruction.

The code targets ICWS-88 (lib/redcode.ml). Every ICWS-88 opcode now has a handler in Mars.step (lib/mars.ml): DAT, MOV, ADD, SUB, JMP, JMZ, JMN, DJN, CMP, SLT and SPL. The latest commit on master, "Implement JMZ, JMN, DJN, CMP and SLT", added the last five, so "not all instructions are implemented" no longer seems to hold. EQU and END are assembler pseudo-instructions and are not meant to execute. I did not run the test suite.

If you meant the newer ICWS-94 instructions, please say so. That would mean adding these:

* Opcodes: NOP, MUL, DIV, MOD, SEQ, SNE, and probably STP/LDP.

* The `.A/.B/.AB/.BA/.F/.X/.I` modifiers.

* The extra addressing modes (`$ @ < > * { }`).

That is a much larger change, so I'd like confirmation of the scope before starting it.

@Claude make sure you're looking at the right branch and fork

@Claude wrote in https://git.levitati.ng/Levitating/corewars-test/issues/1#issuecomment-20: > I didn't make any changes for this issue, because I couldn't find an unimplemented instruction. > > The code targets ICWS-88 (`lib/redcode.ml`). Every ICWS-88 opcode now has a handler in `Mars.step` (`lib/mars.ml`): DAT, MOV, ADD, SUB, JMP, JMZ, JMN, DJN, CMP, SLT and SPL. The latest commit on master, "Implement JMZ, JMN, DJN, CMP and SLT", added the last five, so "not all instructions are implemented" no longer seems to hold. EQU and END are assembler pseudo-instructions and are not meant to execute. I did not run the test suite. > > If you meant the newer ICWS-94 instructions, please say so. That would mean adding these: > > * Opcodes: NOP, MUL, DIV, MOD, SEQ, SNE, and probably STP/LDP. > > * The `.A/.B/.AB/.BA/.F/.X/.I` modifiers. > > * The extra addressing modes (`$ @ < > * { }`). > > > That is a much larger change, so I'd like confirmation of the scope before starting it. @Claude make sure you're looking at the right branch and fork

I rechecked the branch and remote, and my earlier finding still holds. I made no changes.

  • Branch: agent/issue-1 is checked out. It sits at 892bc40 ("Implement JMZ, JMN, DJN, CMP and SLT"), the same commit as origin/master.
  • Remote: the only remote is origin, Levitating/corewars-test. There is no other fork or branch here for me to look at.
  • Code: lib/redcode.ml defines 11 opcodes: DAT, MOV, ADD, SUB, JMP, JMZ, JMN, CMP, SLT, DJN and SPL. Mars.step in lib/mars.ml handles all of them.

So no ICWS-88 instruction is missing in this checkout. If you expected something else, it may be on a branch or fork I can't see. Please point me to it.

If you meant the ICWS-94 instructions, say so and I'll start. That means NOP, MUL, DIV, MOD, SEQ and SNE (and maybe STP/LDP), the .A/.B/.AB/.BA/.F/.X/.I modifiers, and the extra addressing modes. It is a large change that touches the parser and the MARS.

I rechecked the branch and remote, and my earlier finding still holds. I made no changes. - **Branch:** `agent/issue-1` is checked out. It sits at `892bc40` ("Implement JMZ, JMN, DJN, CMP and SLT"), the same commit as `origin/master`. - **Remote:** the only remote is `origin`, `Levitating/corewars-test`. There is no other fork or branch here for me to look at. - **Code:** `lib/redcode.ml` defines 11 opcodes: DAT, MOV, ADD, SUB, JMP, JMZ, JMN, CMP, SLT, DJN and SPL. `Mars.step` in `lib/mars.ml` handles all of them. So no ICWS-88 instruction is missing in this checkout. If you expected something else, it may be on a branch or fork I can't see. Please point me to it. If you meant the ICWS-94 instructions, say so and I'll start. That means NOP, MUL, DIV, MOD, SEQ and SNE (and maybe STP/LDP), the `.A/.B/.AB/.BA/.F/.X/.I` modifiers, and the extra addressing modes. It is a large change that touches the parser and the MARS.

I read "latest instructions" as the ICWS-94 opcodes and added NOP, MUL, DIV, MOD, SEQ and SNE (lib/redcode.ml, lib/mars.ml). I couldn't build or test it, because there's no OCaml or dune in this environment, so it is unverified.

  • Semantics: the new opcodes work like the existing ICWS-88 ones, with no modifiers. SEQ is the same as CMP, and SNE is its inverse.
  • Division by zero: DIV or MOD by zero ends the process. The other field is still written.
  • ADD/SUB side effect: results of ADD, SUB, MUL, DIV and MOD are now reduced mod core size. ADD and SUB weren't before.
  • Not done: the .A/.B/.AB/.BA/.F/.X/.I modifiers, the extra addressing modes and STP/LDP. They are a bigger change, so say if you want them.

I pushed this to #2.

I read "latest instructions" as the ICWS-94 opcodes and added NOP, MUL, DIV, MOD, SEQ and SNE (`lib/redcode.ml`, `lib/mars.ml`). I couldn't build or test it, because there's no OCaml or dune in this environment, so it is unverified. - **Semantics:** the new opcodes work like the existing ICWS-88 ones, with no modifiers. SEQ is the same as CMP, and SNE is its inverse. - **Division by zero:** DIV or MOD by zero ends the process. The other field is still written. - **ADD/SUB side effect:** results of ADD, SUB, MUL, DIV and MOD are now reduced mod core size. ADD and SUB weren't before. - **Not done:** the `.A/.B/.AB/.BA/.F/.X/.I` modifiers, the extra addressing modes and STP/LDP. They are a bigger change, so say if you want them. I pushed this to #2.
Sign in to join this conversation.
No labels
agent
claude
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Levitating/corewars-test#1
No description provided.