avra: begin writing docs

This commit is contained in:
Virgil Dupras 2020-06-28 06:57:59 -04:00
parent 440ea43a88
commit 101193a78c
3 changed files with 26 additions and 2 deletions

View File

@ -3,7 +3,7 @@ Forth words, opcode assembly is a bit different than with a
typical assembler. For example, what would traditionally be
"ld a, b" would become "A B LDrr,".
The "argtype" prefix after each mnemonic is needed because the
The "argtype" suffix after each mnemonic is needed because the
assembler doesn't auto-detect the op's form based on arguments.
It has to be explicitly specified. "r" is for 8-bit registers,
"d" for 16-bit ones, "i" for immediate, "c" is for conditions.
@ -12,5 +12,5 @@ bit ops can affect SP, others, AF. If you use the wrong argu-
ment on the wrong op, you will affect the wrong register.
Mnemonics having only a single form, such as PUSH and POP,
don't have argtype prefixes.
don't have argtype suffixes.
(cont.)

15
blk/650
View File

@ -1 +1,16 @@
AVR assembler
This assembler works very much like Z80 assembler (B200) so
refer to this documentation first. Here, we document specifici-
ties.
All mnemonics in AVR have a single signature. Therefore, we
don't need any "argtype" suffixes.
Registers are referred to with consts R0-R31. There is
X, Y, Z, X+, Y+, Z+, X-, Y-, Z- for appropriate ops (LD, ST).
XL, XH, YL, YH, ZL, ZH are simple aliases to R26-R31.
Branching works differently. Instead of expecting a byte to be
written after the naked op, branching words expect a displace-
ment argument. (cont.)

9
blk/651 Normal file
View File

@ -0,0 +1,9 @@
This is because there's bitwise ORing involved in the creation
of the final opcode, which makes z80a's approach impractical.
This makes labelling a bit different too. Instead of expecting
label words after the naked branching op, we rather have label
words expecting branching wordref as an argument. Examples:
L2 ' BRTS FLBL! ( branch forward to L2 )
L1 ' RJMP LBL, ( branch backward to L1 )