From 101193a78c59e53a36490c193ed3f0160a178cbd Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 28 Jun 2020 06:57:59 -0400 Subject: [PATCH] avra: begin writing docs --- blk/201 | 4 ++-- blk/650 | 15 +++++++++++++++ blk/651 | 9 +++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 blk/651 diff --git a/blk/201 b/blk/201 index f7582bf..c895e02 100644 --- a/blk/201 +++ b/blk/201 @@ -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.) diff --git a/blk/650 b/blk/650 index 31f722d..d8ef94c 100644 --- a/blk/650 +++ b/blk/650 @@ -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.) diff --git a/blk/651 b/blk/651 new file mode 100644 index 0000000..76f5678 --- /dev/null +++ b/blk/651 @@ -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 )