The mneumonics are a bit different as each instruction will have its own letter. For example 'add' and 'and' both begin with 'a', so 'and' became B (both).
If an instruction can take either a register or an immediate value as source, this is specified in the mneumonic. Such as AR (add register) and AN (add number).
Some instructions are only one character long, such as 'int' = I, 'inc' = H (higher), and 'push ax' = PA.
Segmentation is limited to specific combinations (es:bx, fs:si, gs:di), and are always done with the al register.
It is also possible to use "macros" which are functions the OS calls, such as the random function which returns a random number in al, by using WR.
Labels are specified by placing dots in the start and end of the name. Only the last dot is written when doing jumps.
The assembler directly translates the Pikoasm code into machine code in two stages.
The first stage directly translates the code into machine code, and during the second stage the jmp lenghts are calculated and inserted into the machine code.
Here is an example program that prints all the 8-bit ascii chars:
Code: Select all
MN AX 0E00
.LOOP.
I 10
H AL
CN AL 00
JN LOOP.
Ee
The above program would translate to (in "normal" assembly):
Code: Select all
mov ax, 0xe00
loop:
int 10h
inc al
cmp al, 0h
jne loop
ret