This is support for the Ferranti F100-L. The syntax used for naken_asm has been modernized a little bit. It should support all the old syntax if this is really desired, but it's recommended not to use that.
add - add ads - add and store result to memory and - and cal - call subroutine clr - clear bits cmp - compare halt - halt icz - increment and jump not zero jbc - jump bit cleared jbs - jump bit set jcs - jump bit cleared, then set bit jsc - jump bit set, then clear bit jmp - jump always lda - load accumulator neq - xor rtc - return from subroutine but discard cr rtn - return from subroutine and restore cr set - set bit sjm - switch jump sla - shift left arithmetic sle - rotate bits left sll - shift left logical sra - shift right arithmetic sre - rotate bits right srl - shift right logical sto - store accumulator sub - subtract sbs - subtract and store result into memory
nop - no operation clrm - clear m flag clrc - clear carry flag setm - set m flag setc - set carry flag jnz address - jump not zero jne address - jump not equal (same as jnz) jz address - jump zero je address - jump equal (same as jz) jnc address - jump no carry jc address - jump carry jn address - jump negative jp address - jump positive
This chip has some really awkward syntax according to the docs used to create the assembler.
For example, the add instruction has these formats:
ADD N
ADD ,D
ADD /P
ADD /P+
ADD /P-
ADD .W
Where N, W, and P are addresses and D is an immediate value. So to load data from address 0x7000, the code would be:
add .0x7000
Or if address 100 has the value 0x1000, the instruction:
add /100+
Would use the address that is stored at location 100, which in this case is 0x1000. So it would load whatever is in address 0x1000 and add it to the accumulator. Then it would increment the value in address 100 so it would now be 0x1001.
The problem with the "add /100+" syntax is the tokenizer would separate this into "add", "/", "100", "+". To parse it, when the assembler see's "/" it knows it's the /P format and then calls evaluate_expression() to in case there is any math to do. Like if it was add /1000+10+ the assembler should do 1000+10 first. The + at the end unfortunately confuses the evaluate_expression() code. So I made it so the address there will be parsed as a single token only. I added extra syntax to make it possible to use this addressing mode though:
ADD /P can be done with ADD [P]
ADD /P+ can be done with ADD [P]+
ADD /P- can be done with ADD [P]-
There's also this format to make the source code easier to read:
ADD ,D can be done with ADD #D
For full width addresses:
ADD .W can be done with ADD long W
It was tempting to make the ADD N and ADD .W work assemble with the same code. The assembler can detect if the address can be done with 11 bit or 15 bit and pick the better instruction. What could be addeded later is:
ADD &address
Which would pick the better instruction length. If the address can be determined (not a forward reference to a label) and it can be done in 11 bits, then it will pick the 16 bit opcode. If not it will pick 32 bit.
Also, the syntax in the docs don't have commas between operands which is also confusing eval_expression(). For now commas need to be used to use this assembler.
To make life easier, there are also some aliases in naken_asm:
setm = set #5, cr or set m, cr
setc = set #4, cr or set c, cr
clrm = clr #5, cr or clr m, cr
clrc = clr #4, cr or clr c, cr