From faf088b397505771d44ab5a8fea00e5f47cd58cd Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 21 Sep 2020 19:52:53 -0400 Subject: [PATCH] Move AVR assembler from B650 to B50 And move its doc to doc/asm.txt --- blk/001 | 6 ++--- blk/{660 => 050} | 0 blk/{661 => 051} | 0 blk/{662 => 052} | 0 blk/{663 => 053} | 0 blk/{664 => 054} | 0 blk/{665 => 055} | 0 blk/{666 => 056} | 0 blk/{667 => 057} | 0 blk/{668 => 058} | 0 blk/{669 => 059} | 0 blk/{670 => 060} | 0 blk/{671 => 061} | 0 blk/{672 => 062} | 0 doc/asm.txt | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 15 files changed, 68 insertions(+), 3 deletions(-) rename blk/{660 => 050} (100%) rename blk/{661 => 051} (100%) rename blk/{662 => 052} (100%) rename blk/{663 => 053} (100%) rename blk/{664 => 054} (100%) rename blk/{665 => 055} (100%) rename blk/{666 => 056} (100%) rename blk/{667 => 057} (100%) rename blk/{668 => 058} (100%) rename blk/{669 => 059} (100%) rename blk/{670 => 060} (100%) rename blk/{671 => 061} (100%) rename blk/{672 => 062} (100%) diff --git a/blk/001 b/blk/001 index 495f2a9..7a7b3b9 100644 --- a/blk/001 +++ b/blk/001 @@ -1,13 +1,13 @@ MASTER INDEX 005 Z80 assembler 030 8086 assembler -50-99 unused +050 AVR assembler 70-99 unused 100 Block editor 120 Visual Editor 160-259 unused 260 Cross compilation 280 Z80 boot code 350 Core words 410 PS/2 keyboard subsystem 420 SD Card subsystem 440-519 unused 520 Fonts -550-649 unused -650 AVR assembler 690 AVR SPI programmer +550-689 unused +690 AVR SPI programmer 700-799 unused 800 8086 boot code diff --git a/blk/660 b/blk/050 similarity index 100% rename from blk/660 rename to blk/050 diff --git a/blk/661 b/blk/051 similarity index 100% rename from blk/661 rename to blk/051 diff --git a/blk/662 b/blk/052 similarity index 100% rename from blk/662 rename to blk/052 diff --git a/blk/663 b/blk/053 similarity index 100% rename from blk/663 rename to blk/053 diff --git a/blk/664 b/blk/054 similarity index 100% rename from blk/664 rename to blk/054 diff --git a/blk/665 b/blk/055 similarity index 100% rename from blk/665 rename to blk/055 diff --git a/blk/666 b/blk/056 similarity index 100% rename from blk/666 rename to blk/056 diff --git a/blk/667 b/blk/057 similarity index 100% rename from blk/667 rename to blk/057 diff --git a/blk/668 b/blk/058 similarity index 100% rename from blk/668 rename to blk/058 diff --git a/blk/669 b/blk/059 similarity index 100% rename from blk/669 rename to blk/059 diff --git a/blk/670 b/blk/060 similarity index 100% rename from blk/670 rename to blk/060 diff --git a/blk/671 b/blk/061 similarity index 100% rename from blk/671 rename to blk/061 diff --git a/blk/672 b/blk/062 similarity index 100% rename from blk/672 rename to blk/062 diff --git a/doc/asm.txt b/doc/asm.txt index 4e089b3..f6cf7ee 100644 --- a/doc/asm.txt +++ b/doc/asm.txt @@ -159,3 +159,68 @@ For jumps, it's special. 's' is SHORT, 'n' is NEAR, 'f' is FAR. # 8086 Instructions list TODO + +# AVR assembler + +Load with "50 LOAD". As with the Z80 assembler, it is incom- +plete. + +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. + +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 ) + +# AVR instructions list + +OPRd (B53) +ASR COM DEC INC LAC LAS LAT LSR NEG POP PUSH +ROR SWAP XCH + +OPRdRr (B54) +ADC ADD AND CP CPC CPSE EOR MOV MUL OR SBC +SUB + +OPRdA (B54) +IN OUT + +OPRdK (B55) +ANDI CPI LDI ORI SBCI SBR SUBI + +OPAb (B55) +CBI SBI SBIC SBIS + +OPNA (B56) +BREAK CL[C,H,I,N,S,T,V,Z] SE[C,H,I,N,S,T,V,Z] EIJMP ICALL +EICALL IJMP NOP RET RETI SLEEP WDR + +OPb (B57) +BCLR BSET + +OPRdb (B57) +BLD BST SBRC SBRS + +Special (B57,B60) +CLR TST LSL LD ST + +Flow (B58) +RJMP RCALL +BR[BC,BS,CC,CS,EQ,NE,GE,HC,HS,ID,IE,LO,LT,MI,PL,SH,TC,TS,VC,VS] + +Flow macros (B61) +LBL! LBL, SKIP, TO, FLBL, FLBL! BEGIN, AGAIN? AGAIN, IF, THEN,