From ee3407bf1cd67cf242fab283691f209c908ed880 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 16 May 2020 09:51:02 -0400 Subject: [PATCH] avra: first steps --- blk/001 | 2 +- blk/650 | 1 + blk/660 | 1 + blk/661 | 8 ++++++++ blk/662 | 10 ++++++++++ blk/663 | 10 ++++++++++ blk/664 | 7 +++++++ emul/avra.sh | 2 ++ emul/zasm.sh | 2 +- 9 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 blk/650 create mode 100644 blk/660 create mode 100644 blk/661 create mode 100644 blk/662 create mode 100644 blk/663 create mode 100644 blk/664 create mode 100755 emul/avra.sh diff --git a/blk/001 b/blk/001 index 202fd2b..a3fa89b 100644 --- a/blk/001 +++ b/blk/001 @@ -9,7 +9,7 @@ MASTER INDEX 490 TRS-80 Recipe 520 Fonts 550 TI-84+ Recipe 580 RC2014 Recipe 620 Sega Master System Recipe - +650 AVR assembler diff --git a/blk/650 b/blk/650 new file mode 100644 index 0000000..31f722d --- /dev/null +++ b/blk/650 @@ -0,0 +1 @@ +AVR assembler diff --git a/blk/660 b/blk/660 new file mode 100644 index 0000000..a127da9 --- /dev/null +++ b/blk/660 @@ -0,0 +1 @@ +1 5 LOADR+ diff --git a/blk/661 b/blk/661 new file mode 100644 index 0000000..18d4775 --- /dev/null +++ b/blk/661 @@ -0,0 +1,8 @@ +VARIABLE ORG +: SPLITB + 256 /MOD SWAP +; +: PC H@ ORG @ ; +( A, spits an assembled byte, A,, spits an assembled word + Both increase PC. To debug, change C, to .X ) +: A, C, ; : A,, SPLITB A, A, ; diff --git a/blk/662 b/blk/662 new file mode 100644 index 0000000..32e32e6 --- /dev/null +++ b/blk/662 @@ -0,0 +1,10 @@ +( 0000 000d dddd 0000 ) +: OPRd CREATE , DOES> @ SWAP 4 LSHIFT OR A,, ; +0b1001010000000101 OPRd ASR, 0b1001010000000000 OPRd COM, +0b1001010000001010 OPRd DEC, 0b1001010000000011 OPRd INC, +0b1001001000000110 OPRd LAC, 0b1001001000000101 OPRd LAS, +0b1001001000000111 OPRd LAT, +0b1001010000000110 OPRd LSR, 0b1001010000000001 OPRd NEG, +0b1001000000001111 OPRd POP, 0b1001001000001111 OPRd PUSH, +0b1001010000000111 OPRd ROR, 0b1001010000000010 OPRd SWAP, +0b1001001000000100 OPRd XCH, diff --git a/blk/663 b/blk/663 new file mode 100644 index 0000000..5907a51 --- /dev/null +++ b/blk/663 @@ -0,0 +1,10 @@ +( 0000 00rd dddd rrrr ) +: OPRdRr CREATE C, DOES> C@ ( rd rr op ) + OVER 0x10 AND 3 RSHIFT OR ( rd rr op' ) + 2 PICK 0x10 AND 4 RSHIFT OR ( rd rr op' ) + 8 LSHIFT OR 0xff0f AND ( rd op' ) + SWAP 0xf AND 4 LSHIFT OR A,, ; +0x1c OPRdRr ADC, 0x0c OPRdRr ADD, 0x20 OPRdRr AND, +0x14 OPRdRr CP, 0x04 OPRdRr CPC, 0x10 OPRdRr CPSE, +0x24 OPRdRr EOR, 0x2c OPRdRr MOV, 0x9c OPRdRr MUL, +0x28 OPRdRr OR, 0x08 OPRdRr SBC, 0x18 OPRdRr SUB, diff --git a/blk/664 b/blk/664 new file mode 100644 index 0000000..ceda372 --- /dev/null +++ b/blk/664 @@ -0,0 +1,7 @@ +( 0000 KKKK dddd KKKK ) +: OPRdK CREATE C, DOES> C@ ( rd K op ) + OVER 0xf0 AND 4 RSHIFT OR ( rd K op' ) + ROT 5 LSHIFT ROT 0x0f AND OR ( op' rdK ) A, A, ; +0x70 OPRdK ANDI, 0x30 OPRdK CPI, 0x0e OPRdK LDI, +0x60 OPRdK ORI, 0x40 OPRdK SBCI, 0x60 OPRdK SBR, +0x50 OPRdK SUBI, diff --git a/emul/avra.sh b/emul/avra.sh new file mode 100755 index 0000000..fa3cb13 --- /dev/null +++ b/emul/avra.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo -e "660 LOAD H@ 256 /MOD 2 PC! 2 PC! \n$(cat -)\nH@ 256 /MOD 2 PC! 2 PC! " | ./stage diff --git a/emul/zasm.sh b/emul/zasm.sh index 8a3903c..6ff130c 100755 --- a/emul/zasm.sh +++ b/emul/zasm.sh @@ -1,2 +1,2 @@ #!/bin/sh -echo "212 LOAD H@ 256 /MOD 2 PC! 2 PC! $(cat -) H@ 256 /MOD 2 PC! 2 PC!" | ./stage +echo -e "212 LOAD\nH@ 256 /MOD 2 PC! 2 PC!\n$(cat -)\nH@ 256 /MOD 2 PC! 2 PC! " | ./stage