From ecca70c7f3f47d75180ef966b341ae9b401ebd15 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 1 May 2020 20:05:15 -0400 Subject: [PATCH] Add layer of indirection to EMIT This would allow things like temporary giving control to the *CL line on the TRS-80. For example... A very far fetched example. Not at all the only *raison d'etre* of the layer... --- blk/081 | 18 +++++++++--------- blk/143 | 4 ++-- blk/213 | 4 ++-- blk/352 | 2 +- blk/355 | 17 +++++++++++++++++ blk/356 | 16 ---------------- blk/359 | 30 +++++++++++++++--------------- blk/360 | 33 +++++++++++++++++---------------- blk/405 | 8 ++++---- blk/442 | 4 +++- blk/453 | 2 +- blk/457 | 4 ++-- blk/464 | 2 +- blk/465 | 2 +- blk/493 | 2 +- emul/forth.bin | Bin 5777 -> 5838 bytes emul/xcomp.fs | 2 +- 17 files changed, 77 insertions(+), 73 deletions(-) create mode 100644 blk/355 diff --git a/blk/081 b/blk/081 index 83b8219..3ff548d 100644 --- a/blk/081 +++ b/blk/081 @@ -1,16 +1,16 @@ (cont.) -RAMSTART INITIAL_SP +53 readln's variables -+02 CURRENT +55 adev's variables -+04 HERE +57 blk's variables -+06 C ) + ACIA_MEM 2+ LD(nn)HL, + THEN, + THEN, + THEN, + DE POPqq, + HL POPqq, + AF POPqq, + EI, + RETI, + + + diff --git a/blk/356 b/blk/356 index 7dae0f2..e69de29 100644 --- a/blk/356 +++ b/blk/356 @@ -1,16 +0,0 @@ - IFZ, ( end of buffer reached? ) - ( yes ) - ( +4 == ACIA( ) - ACIA_MEM 4 + LDHL(nn), - ( +2 == ACIAW> ) - ACIA_MEM 2+ LD(nn)HL, - THEN, - THEN, - THEN, - DE POPqq, - HL POPqq, - AF POPqq, - EI, - RETI, - - diff --git a/blk/359 b/blk/359 index ec8e5c9..4e8634c 100644 --- a/blk/359 +++ b/blk/359 @@ -1,16 +1,16 @@ -: ACIA$ - H@ DUP DUP ACIA( ! ACIAR> ! - 1+ ACIAW> ! ( write index starts one position later ) - ACIABUFSZ ALLOT - H@ ACIA) ! -( setup ACIA - CR7 (1) - Receive Interrupt enabled - CR6:5 (00) - RTS low, transmit interrupt disabled. - CR4:2 (101) - 8 bits + 1 stop bit - CR1:0 (10) - Counter divide: 64 ) - 0b10010110 ACIA_CTL PC! -( setup interrupt ) - 0xc3 0x4e RAM+ C! ( c3==JP, 4e==INTJUMP ) - ['] ~ACIA 0x4f RAM+ ! - (im1) +: KEY + ( inc then fetch ) + ACIAR> @ 1+ DUP ACIA) @ = IF + DROP ACIA( @ + THEN + ( As long as R> == W>-1, it means that buffer is empty ) + BEGIN DUP ACIAW> @ = NOT UNTIL + ACIAR> ! + ACIAR> @ C@ +; +: (emit) + ( As long at CTL bit 1 is low, we are transmitting. wait ) + BEGIN ACIA_CTL PC@ 0x02 AND UNTIL + ( The way is clear, go! ) + ACIA_IO PC! ; diff --git a/blk/360 b/blk/360 index 6be060e..f2d8b25 100644 --- a/blk/360 +++ b/blk/360 @@ -1,16 +1,17 @@ -: KEY - ( inc then fetch ) - ACIAR> @ 1+ DUP ACIA) @ = IF - DROP ACIA( @ - THEN - ( As long as R> == W>-1, it means that buffer is empty ) - BEGIN DUP ACIAW> @ = NOT UNTIL - ACIAR> ! - ACIAR> @ C@ -; -: EMIT - ( As long at CTL bit 1 is low, we are transmitting. wait ) - BEGIN ACIA_CTL PC@ 0x02 AND UNTIL - ( The way is clear, go! ) - ACIA_IO PC! -; +: ACIA$ + H@ DUP DUP ACIA( ! ACIAR> ! + 1+ ACIAW> ! ( write index starts one position later ) + ACIABUFSZ ALLOT + H@ ACIA) ! +( setup ACIA + CR7 (1) - Receive Interrupt enabled + CR6:5 (00) - RTS low, transmit interrupt disabled. + CR4:2 (101) - 8 bits + 1 stop bit + CR1:0 (10) - Counter divide: 64 ) + 0b10010110 ACIA_CTL PC! +( setup interrupt ) + 0xc3 0x4e RAM+ C! ( c3==JP, 4e==INTJUMP ) + ['] ~ACIA 0x4f RAM+ ! + ['] (emit) 0x53 RAM+ ! ( 53==EMITPTR ) + (im1) ; + diff --git a/blk/405 b/blk/405 index 57614bf..7a3264c 100644 --- a/blk/405 +++ b/blk/405 @@ -1,15 +1,15 @@ : BOOT 0x02 RAM+ CURRENT* ! LIT< (parse) (find) DROP (parse*) ! - ( 2e == SYSTEM SCRATCHPAD ) - CURRENT @ 0x2e RAM+ ! + CURRENT @ 0x2e RAM+ ! ( 2e == BOOT C< PTR) 0 0x08 RAM+ ! ( 08 == C<* override ) + LIT< (emit) (find) DROP 0x53 RAM+ ! ( 53 == EMITPTR ) + 0 0x55 RAM+ ! ( 55 == EMITPTR override ) ( 0c == C<* ) LIT< (boot<) (find) DROP 0x0c RAM+ ! ( boot< always has a char waiting. 06 == C 0 RDLNMEM+ ; ( points to INBUF ) diff --git a/blk/457 b/blk/457 index 0526a6b..47ccec0 100644 --- a/blk/457 +++ b/blk/457 @@ -1,7 +1,7 @@ ( Initializes the readln subsystem ) : RDLN$ - ( 53 == rdln's memory ) - H@ 0x53 RAM+ ! + ( 57 == rdln's memory ) + H@ 0x57 RAM+ ! ( 2 for IN>, plus 2 for extra bytes after buffer: 1 for the last typed 0x0a and one for the following NULL. ) INBUFSZ 4 + ALLOT diff --git a/blk/464 b/blk/464 index 8eb9c4e..b239bce 100644 --- a/blk/464 +++ b/blk/464 @@ -1,4 +1,4 @@ -: BLKMEM+ 0x57 RAM+ @ + ; +: BLKMEM+ 0x59 RAM+ @ + ; ( n -- Fetches block n and write it to BLK( ) : BLK@* 0 BLKMEM+ ; ( n -- Write back BLK( to storage at block n ) diff --git a/blk/465 b/blk/465 index ca5cfa0..2ba2b0a 100644 --- a/blk/465 +++ b/blk/465 @@ -1,5 +1,5 @@ : BLK$ - H@ 0x57 RAM+ ! + H@ 0x59 RAM+ ! ( 1024 for the block, 8 for variables ) 1032 ALLOT ( LOAD detects end of block with ASCII EOT. This is why diff --git a/blk/493 b/blk/493 index b264dbb..b3d2717 100644 --- a/blk/493 +++ b/blk/493 @@ -4,7 +4,7 @@ CODE KEY L A LDrr, H 0 LDrn, HL PUSHqq, ;CODE -CODE EMIT +CODE (emit) BC POPqq, ( c == @DSP arg ) chkPS, A 0x02 LDrn, ( @DSP ) diff --git a/emul/forth.bin b/emul/forth.bin index 3f040bcd04865ae3b4a976d41df75a4c21800ecc..cc418131a3f2f2c17c2888ba5b4af701bd293593 100644 GIT binary patch delta 1803 zcmZ8hO>7fa5T5<9<6ZAQukCfxByD3NV{B-Gn$l4IQoQ+rHI75ElNPn8g-}vN>R2Ha zKSFg&p!8C!RS&3Y)LwExNF3PC>^dBJSo_U4 zGvCacpLe-qp+mX%E!?{c01LMjEzr^qsSiIsK9z=6-%TM71^7XB#H<{LVcrt3gp2%8 zU|+|VfiVccS)l+jRQ&}|;a52%ofW161^CUe;QcKicrX(!`k!*(Z zMLTD@@R$qpRi$r3QnkPyP~bdTdvF{?un{fp?a#;H0;>sY91)P`*&iQxLzvFLELoM zcUn*GYH&|i^m9FQIzw3fgxF5P#tEyRuIT-Pc2NPDVb`#Kp)RTB(rd8RQfih3sq*CU z(o{ML4eY7rnfNh33s!Xgm)_Of$+Ges-ZjFg<{4|~K(W0QzF>L&DqCNPun`}2tAJ@@ zpa42qkQ)fPlIlvm2RuoyOSu6Zle)`pF$)U&dsUFoG43i;r%K1t416rY7Fj!-nwUHq zFHKCvk4=11I*JKUsMN%XbQ}rDVB&;~=zYG-ehjbW{=ByQMrbnfe^fO1Y{=wq7)_Bx zXbcC}g4^}~Ee1bqyjJN79_Y*E2m1#%>Dc!;yiK)}u3|mxe2;<2X5~K&5>j5~B6wn2 zL*0T=b+xJErDNmi5ctvhnNbr~4M%j40`Vg!(=o(Xjga)rIPCLsAgLmgRdSJC$HJs0 zkB*l{-KLOE50j;eWm0hiWO%~2g*UXV=rvr<0FcfPTf-Jmq>$v`aIG3iUJ1WcX$yZ4 zrlET3++xoRieLdoDyB=Bq?4|9C5+G zM!;3kR@=e}cpQ!+4H=K%Ls56*t&z7k?-%%eeYu@`i2Mh ze~$BZi~TH&$m4GEv>ltH^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 + ! ," CURRENT @ HERE ! " -," : EMIT 0 PC! ; " +," : (emit) 0 PC! ; CURRENT @ 83 RAM+ ! " ," : KEY 0 PC@ ; " 422 470 XPACKR ," ' KEY 12 RAM+ ! "