minasm is designed by osminee in 2020. It's more like serious assembly language, however it has weird notation and lack of basic operations.
minasm machine have unbounded memory of unsigned integers. The processor has four registers: A Register (AR), B Register (BR), C Register (CR) and Operation Register (OR). AR, BR and CR are used to store data and for subroutines. Operation Register (OR) also stores data, but it can only be accessed by
COP instruction. OR is used basically for conditional jumps. minasm has also registry called Instruction Pointer (IP), however it cannot be changed via instructions (except jump commands, which are the only way to change the value of IP).
Let's demonstrate the basics of minasm on this simple program:
` example program ` COP OR 6 ADD (1) -1 JNZ (0) TER
First, all comments are removed (marked with
`<comment>`). First instruction,
COP OR 6 is like
MOV instruction in x86 assembly: it COPies second argument to first one. So
COP OR 6 copies value 6 to the Operation Register (OR).
The second one,
ADD (1) -1 ADDs second argument to first. In this example it adds value
-1 to address
1 in hexadecimal, so it actually subtracts
1 from this address (parenthesis are used to denote that this number is physical address). Also, if you notice, this points to
COP 6 OR, because
COP takes 1 byte, as well as
OR. Index of first value is 0, so 0+1=1.
JNZ (0). It jumps to specified byte if OR value is not zero. In this example, we initialize OR with value
6, so this condition would be satisfied and it would jump to byte 0.
Last command is
TER. It exits from program.
So basically this initializes Operation Register with value
6. Then it subtracts
1 from location
1 (pointing to
6), so it becomes 5. Then it checks if value in OR is not zero. If yes, then it goes to the beginning of the code. Else, it terminates the program.
Here are all instructions.
||Jumps to specified byte in program and continues execution of program from that byte|
|JZ (Jump if Zero)||
||Checks the value in OR: if it's zero, jump to specified byte; else, continue execution of program normally|
|JNZ (Jump if Not Zero)||
||Same as |
||Calls a subroutine (subprogram) with number |
|DAT (DATa) (deprecated)||
||Variation of |
Subroutines are built-in functions that are used to shorten code.