Kingston Crabfight Simulator
This is an assembly puzzler I made during a 6 hour game jam hosted by UMD Game Dev club. The theme is crabs.
There are 5 registers:
Deneral purpose accumulator. Default argument for some op codes as documented below.
Motor control. Your crab can only crawl sideways. M controls its movement. If it's positive, then it moves to the right and vice versa.
Note: movement is only actuated for every cycle after M register has been set positive.
MOV 1 M ; no movement NOP ; moves 1 to the right NOP ; moves 1 to the right MOV 0 M ; moves 1 to the right NOP ; stands still MOV -10 M ; stands still NOP ; moves 1 to the left
General purpose accumulator. I was gonna build other mechanics such as object detection but it got too complicated.
Stores rotation modulo 4. 0 is down, 1 is left, 2 is up, 3 is right.
Denotes position in code. Labels cannot be followed by other instructions(unlike zachtronics games).
MOV 10 A L: SUB 1 A JGZ L
MOV 1 A MOV R A
ADD 1 A ADD A A SUB 1 M
Negates value in register
No operation. Also known as noop
- JMP label
Point the instruction pointer to specified label.
Jump if A is 0
Jump if A is not 0
Jump if A > 0
Jump if A <> 0
Unconditional relative jump with immediate value or value from register.
JRO -1 ; jump to previous instruction JRO 1 ; jump to following instruction JRO A ; relative to jump the instruction stored in A
The first level can be solved using this code:
MOV -1 M L: JMP L
CTRL+RETURN to step through your code.
CTRL+C to stop debugger.