Instructions I
Take apart an instruction string.
Potentially useful functions:
string-contains?string-splitsubstringstring-replacestring-append
Optional:
- Package: match-string
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+1orM&D. - Jump comparison:
JMP,JLEetc.
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:
DM=M+1;JMPA=D-1M=0D;JLE0;JMP
Write two more examples that you make up.
Coding
Turn your examples in check-expects.