From 6bff03a48b1734f4e7b5112797f0bc29f4ad0e36 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 22 May 2020 14:50:34 -0400 Subject: [PATCH] Move adev to core It's small enough to be worth it. --- blk/001 | 3 +-- blk/003 | 1 + blk/022 | 6 ++++++ blk/081 | 18 +++++++++--------- blk/140 | 10 ---------- blk/142 | 1 - blk/143 | 15 --------------- blk/144 | 11 ----------- blk/394 | 10 ++++++++++ blk/396 | 1 + emul/forth.bin | Bin 5929 -> 6044 bytes 11 files changed, 28 insertions(+), 48 deletions(-) create mode 100644 blk/022 delete mode 100644 blk/140 delete mode 100644 blk/142 delete mode 100644 blk/143 delete mode 100644 blk/144 diff --git a/blk/001 b/blk/001 index 33183c3..91bec59 100644 --- a/blk/001 +++ b/blk/001 @@ -2,8 +2,7 @@ MASTER INDEX 3 Usage 30 Dictionary 70 Implementation notes 100 Block editor -120 Linker 140 Addressed devices -150 Extra words +120 Linker 150 Extra words 200 Z80 assembler 260 Cross compilation 280 Z80 boot code 350 Core words 410 PS/2 keyboard subsystem 420 Bootstrap guide diff --git a/blk/003 b/blk/003 index aa19f53..65b86f4 100644 --- a/blk/003 +++ b/blk/003 @@ -14,3 +14,4 @@ Contents 8 Interpreter I/O 11 Signed-ness 14 Addressed devices 17 DOES> 18 Disk blocks 21 How blocks are organized +22 Addressed devices diff --git a/blk/022 b/blk/022 new file mode 100644 index 0000000..11984ed --- /dev/null +++ b/blk/022 @@ -0,0 +1,6 @@ +Addressed devices + +A@ and A! are the indirect versions of C@ and C!. Their target +word is controlled through A@* and A!* and by default point to +C@ and C*. There is also a AMOVE word that is the same as MOVE +but using A@ and A!. diff --git a/blk/081 b/blk/081 index c894fc6..336b546 100644 --- a/blk/081 +++ b/blk/081 @@ -1,13 +1,13 @@ RAMSTART FUTURE USES +3c BLK(* -+02 CURRENT +3e FUTURE USES -+04 HERE -+06 C +5f FUTURE USES ++02 CURRENT +3e A@* ++04 HERE +40 A!* ++06 C +32 IN(* +70 DRIVERS +34 BLK@* +80 RAMEND +36 BLK!* diff --git a/blk/140 b/blk/140 deleted file mode 100644 index 6fd042f..0000000 --- a/blk/140 +++ /dev/null @@ -1,10 +0,0 @@ -Addressed devices - -Abstractions to read and write to devices that allow addressed -access. At all times, we have one active "fetch" device and -one active "store" device, A@ and A!. - -Those words have the same signature as C@ and C!, and in fact, -initially default to proxy of those words. - -Load with "142 LOAD" diff --git a/blk/142 b/blk/142 deleted file mode 100644 index 8ed1836..0000000 --- a/blk/142 +++ /dev/null @@ -1 +0,0 @@ -1 2 LOADR+ diff --git a/blk/143 b/blk/143 deleted file mode 100644 index cbe4edb..0000000 --- a/blk/143 +++ /dev/null @@ -1,15 +0,0 @@ -: ADEVMEM+ 0x5d RAM+ @ + ; -: A@* 0 ADEVMEM+ ; -: A!* 2 ADEVMEM+ ; - -: ADEV$ - H@ 0x5d RAM+ ! - 4 ALLOT - ['] C@ A@* ! - ['] C! A!* ! -; - -: A@ A@* @ EXECUTE ; -: A! A!* @ EXECUTE ; - - diff --git a/blk/144 b/blk/144 deleted file mode 100644 index d633ed7..0000000 --- a/blk/144 +++ /dev/null @@ -1,11 +0,0 @@ -( Same as MOVE, but with A@ and A! ) -( src dst u -- ) -: AMOVE - ( u ) 0 DO - SWAP DUP I + A@ ( dst src x ) - ROT TUCK I + ( src dst x dst ) - A! ( src dst ) - LOOP - 2DROP -; - diff --git a/blk/394 b/blk/394 index db838a0..e3a1603 100644 --- a/blk/394 +++ b/blk/394 @@ -2,3 +2,13 @@ ( b1 b2 -- ) : LOADR 1+ SWAP DO I DUP . NL LOAD LOOP ; : LOADR+ BLK> @ + SWAP BLK> @ + SWAP LOADR ; +( Now, adev stuff ) +: A@* 0x3e RAM+ ; : A@ A@* @ EXECUTE ; +: A!* 0x40 RAM+ ; : A! A!* @ EXECUTE ; +( src dst u -- ) +: AMOVE + ( u ) 0 DO + SWAP DUP I + A@ ( dst src x ) + ROT TUCK I + ( src dst x dst ) + A! ( src dst ) + LOOP 2DROP ; diff --git a/blk/396 b/blk/396 index c03e900..9c708c6 100644 --- a/blk/396 +++ b/blk/396 @@ -8,6 +8,7 @@ 0 0x0a RAM+ ! ( NLPTR ) ( 0c == C<* ) ['] (boot<) 0x0c RAM+ ! + ['] C@ A@* ! ['] C! A!* ! ( boot< always has a char waiting. 06 == C=+VRofsS)xEYxEZi_5pe!>Xk zDQfY6B^@A=iXh1!FiBtkFjqbXR=)i#I~mNFSeU*sYcanR`N;T;4a8y-ZD4rye;Sh$ zgGO#*W}c?{qdWo`@5Ji+|hk6+!RD5idzE!