Instructions I

Potentially useful functions:

  • string-contains?
  • string-split
  • substring
  • string-replace
  • string-append

Optional:

Goal

We want to be break a instruction string into three separate pieces: the destination, the operation, and the jump/comparison.

  • Destination: the register(s) where the result goes.
  • Operation: the computation performed by the ALU, like A+1 or M&D.
  • Jump comparison: JMP, JLE etc.

Your end goal is to take in an instruction string and produce a list of strings with three components: (list destination operation jump).

Warmup

Write examples of what should be produced in these situations:

  1. DM=M+1;JMP
  2. A=D-1
  3. M=0
  4. D;JLE
  5. 0;JMP

Write two more examples that you make up.

Coding

Turn your examples in check-expects.

Last modified October 29, 2024: Minor edit. (5716097)