Close

Assembler Syntax

A project log for Assembler for SuperconBadge

An Assembler for the Supercon 6 Badge - been done. But *ON* the badge?

michael-mllerMichael Möller 06/02/2023 at 14:500 Comments

My first initial assembler syntax was more extensive, before I realized just how small the RAM really is. Keeping the code size of the first (bootstrap) version small implies limited syntax and functionality. Initial design:

GIGO: There will be very little error checking. You input invalid syntax, the assembler will loop, break, crash, go to never-never-land.

Whitespace discarded, ";" start a comment until EndOfLine. Lowercase converted to uppercase.

Keyword mnemonics are all 3 characters (the official keyword/arguments are slighty adapted: OR becomes ORR, BSET becomes BST etc.)  All arguments keywords are two characters.

$x is a global/permament label defenition, first on line. ~n is a temp label, only for backward jumps, and intended to be redefined.

# preceeds a hex constant, % preceeds a decimal number

Additional keywords: ORG to advance program counter, NIB, (BYT, ASC, too?) to create RT R0,N lookup tables, (HEX with a 3 digit hex as an instruction until I do the real mnemonics) END ends 1st pass assembly.

Arguments: R0,R1...R9, RS (the special IO register reference in bit manipulation), PL, PM, PH, JL for the jump/call registers, and IN, OT for the I/O.
CS,CC,ZS,ZC for the SKP (Skip) instruction field.
@_xx for a RAM address (8bit) and @RxRy are for the indexed memory addressing. (Symbols for data locations is undecided, requires a DEF pseudo instruction) The "_" in _xx is radix prefix, # or %.
&_xx for top 8 bits of a 12bit program location for the MOV PC instruction. MOV PC,&symbol is also allowed, of course. ^_xx or ^symbol takes the middle nibble. Any other reference takes the lowest 4 bit. 

Discussions