Assembler for 16 bit SHRIMP.
Enter shrimpas FILE to assemble FILE into a binary output file named
out.bin.
Optionally, pass the --ascii flag after the filename to output ASCII text
into out.bin instead of raw binary.
The assembler defines the following register names:
r0-r15: Registers 0x0-0xFrz: Register 0x0 (zero register)sp: Register 0xF (stack pointer)
The following opcodes are accepted:
addsubumul(unsigned)smul(signed)udiv(unsigned)sdiv(signed)shaumod(unsigned)smod(signed)andorxornotshlrolshrrorjmpcallretretiintmovldstldflgstflg
Flags are appended to the opcode, but prefixed with a decimal. An example would be:
call.nz labelThe assembler defines the following directives:
.ORIGIN: x: Usexas the origin address (0x0by default).WORD: x: Place the wordxat the current location.ZWORDS: x: Place a block ofxzero words at the current location
Everything is case insensitive. This includes labels, directives, instructions, etc.
Label names can be up to 15 characters long. They must start with either an underscore or alphabetic character and may then contain any underscore or alphanumeric character.
Labels cannot occur on the same line as anything else. This means that the following is invalid:
label: .word: 0xFFThough the following is valid:
label:
.word: 0xFFNumbers are accepted in the following formats:
- Decimal:
abc...where a is not zero - Octal:
0abc... - Hexadecimal:
0xabc...or0Xabc...
Behavior is undefined for numbers of invalid format.