Tali Forth for the 65c02
Re: Introducing Tali Forth for the 65c02 (ALPHA)
JimBoyd wrote:
The third what?
Re: Introducing Tali Forth for the 65c02 (ALPHA)
( Wow! If you get there, will you be able to let us know??
)
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Introducing Tali Forth for the 65c02 (ALPHA)
scotws wrote:
JimBoyd wrote:
The third what?
Re: Introducing Tali Forth for the 65c02 (ALPHA)
Dr Jefyll wrote:
( Wow! If you get there, will you be able to let us know??
)
Re: Introducing Tali Forth for the 65c02 (ALPHA)
Sorry, didn't want to trigger a whole discussion. The message was "Forth hard, brain hurts, need underflow checks." Next time will stick to Star Trek references ... though I think Vulcans probably use Haskell, not Forth ...
Re: Introducing Tali Forth for the 65c02 (ALPHA)
So Sam has not only added the block code (and the wordlist stuff, by the way) to Tali, but also a tutorial on how to use blocks. I am going to come out and say it is the best on the web on this subject, with drawings, examples and everything. In the PDF version, it starts at page 53. The AsciiDoc source translates best to HTML, though because of the way GitHub works you'd have to download the file first.
I hadn't heard of ditaa before - http://ditaa.sourceforge.net/ - now we need to replace my crude ASCII art in the rest of the manual with real pictures.
I hadn't heard of ditaa before - http://ditaa.sourceforge.net/ - now we need to replace my crude ASCII art in the rest of the manual with real pictures.
Re: Introducing Tali Forth for the 65c02 (ALPHA)
scotws wrote:
So Sam has not only added the block code (and the wordlist stuff, by the way) to Tali, but also a tutorial on how to use blocks.
I use some blocks for virtual memory when building a new Forth kernel.
Re: Introducing Tali Forth for the 65c02 (ALPHA)
scotws wrote:
So Sam has not only added the block code (and the wordlist stuff, by the way) to Tali, but also a tutorial on how to use blocks. I am going to come out and say it is the best on the web on this subject, with drawings, examples and everything. In the PDF version, it starts at page 53. The AsciiDoc source translates best to HTML, though because of the way GitHub works you'd have to download the file first.
I hadn't heard of ditaa before - http://ditaa.sourceforge.net/ - now we need to replace my crude ASCII art in the rest of the manual with real pictures.
I hadn't heard of ditaa before - http://ditaa.sourceforge.net/ - now we need to replace my crude ASCII art in the rest of the manual with real pictures.
Re: Introducing Tali Forth for the 65c02 (ALPHA)
Found it here: https://github.com/scotws/TaliForth2/tree/master/docs
See manual.pdf near the bottom.
Cheers,
Andy
See manual.pdf near the bottom.
Cheers,
Andy
Re: Introducing Tali Forth for the 65c02 (ALPHA)
Sorry there, yes, a link would have been helpful. I've fallen in love with AsciiDoc, you can just write it with vim, manage it with git and there are few things that it can't do one way or another. The only problem is that the tools to convert it to GitHub Markup (.md files) are complicated and the result is poor. Not yet, but Tali is still BETA and we're getting the last basic building blocks in place. I'm sure we'll get to the clever stuff at some point. Any suggestions for anything to do with blocks would be most welcome!
At the moment, I've just added the first crude version of the assembler, and we're still missing the the block editor (we have a simple ed clone, which was fun to write in 65c02 assembler BTW).
JimBoyd wrote:
How to use blocks for more than source code for example? Maybe a database or any kind of data?
I use some blocks for virtual memory when building a new Forth kernel.
I use some blocks for virtual memory when building a new Forth kernel.
At the moment, I've just added the first crude version of the assembler, and we're still missing the the block editor (we have a simple ed clone, which was fun to write in 65c02 assembler BTW).
Re: Introducing Tali Forth for the 65c02 (ALPHA)
JimBoyd wrote:
How to use blocks for more than source code for example? Maybe a database or any kind of data?
I use some blocks for virtual memory when building a new Forth kernel.
I use some blocks for virtual memory when building a new Forth kernel.
Re: Introducing Tali Forth for the 65c02 (ALPHA)
scotws wrote:
Sorry there, yes, a link would have been helpful. I've fallen in love with AsciiDoc, you can just write it with vim, manage it with git and there are few things that it can't do one way or another. The only problem is that the tools to convert it to GitHub Markup (.md files) are complicated and the result is poor.
Re: Introducing Tali Forth for the 65c02 (ALPHA)
Jim, Sam has just added a section to the manual about binary data and blocks: https://github.com/scotws/TaliForth2/bl ... ith-blocks
Re: Introducing Tali Forth for the 65c02 (ALPHA)
I'm puzzled by a note in the document
It is my understanding that CS-PICK and CS-ROLL do not replace the branch primitives ( called ?BRANCH and BRANCH in the Forth-83 standard ) or the high level control flow words but rather augment them.
CS-PICK
CS-ROLL
Quote:
Many Forths now use the words cs-pick and cs-roll instead of the branch variants
CS-PICK
Quote:
Rationale:
The intent is to copy a dest on the control-flow stack so that it can be resolved more than once. For example:
\ Conditionally transfer control to beginning of
\ loop. This is similar in spirit to C's "continue"
\ statement.
: ?REPEAT ( dest -- dest ) \ Compilation
( flag -- ) \ Execution
0 CS-PICK POSTPONE UNTIL
; IMMEDIATE
: XX ( -- ) \ Example use of ?REPEAT
BEGIN
...
flag ?REPEAT ( Go back to BEGIN if flag is false )
...
flag ?REPEAT ( Go back to BEGIN if flag is false )
...
flag UNTIL ( Go back to BEGIN if flag is false )
;
The intent is to copy a dest on the control-flow stack so that it can be resolved more than once. For example:
\ Conditionally transfer control to beginning of
\ loop. This is similar in spirit to C's "continue"
\ statement.
: ?REPEAT ( dest -- dest ) \ Compilation
( flag -- ) \ Execution
0 CS-PICK POSTPONE UNTIL
; IMMEDIATE
: XX ( -- ) \ Example use of ?REPEAT
BEGIN
...
flag ?REPEAT ( Go back to BEGIN if flag is false )
...
flag ?REPEAT ( Go back to BEGIN if flag is false )
...
flag UNTIL ( Go back to BEGIN if flag is false )
;
Quote:
Rationale:
The intent is to modify the order in which the origs and dests on the control-flow stack are to be resolved by subsequent control-flow words. For example, WHILE could be implemented in terms of IF and CS-ROLL, as follows:
: WHILE ( dest -- orig dest )
POSTPONE IF 1 CS-ROLL
; IMMEDIATE
The intent is to modify the order in which the origs and dests on the control-flow stack are to be resolved by subsequent control-flow words. For example, WHILE could be implemented in terms of IF and CS-ROLL, as follows:
: WHILE ( dest -- orig dest )
POSTPONE IF 1 CS-ROLL
; IMMEDIATE
Re: Introducing Tali Forth for the 65c02 (ALPHA)
I use blocks for both source code and virtual memory when building a new Forth kernel.
In Fleet Forth, block numbers $5000 and above access the Commodore 64 Ram Expansion Unit ( REU ) so there is no conflict with source code and virtual memory. Here is my code to use blocks $5000 and up for virtual memory.
RAM is a word that adds $5000 to the number on the stack ( the block number in this case ) to access the ram blocks in the REU.
For those who don't know, the REU is a device to add external ram to the C64 and C128 computers. It had multiple banks and used a control register in the I/O area to set up the transfer using DMA to transfer memory contents between the C64's ram and the external ram. The one I had with my C64 had 512K of ram.
Note that @-T and !-T are built with C@-T and C!-T respectively to avoid problems at block boundaries.
In my metacompiler's META vocabulary, some of the memory access words are redefined for metacompilation.
In Fleet Forth, block numbers $5000 and above access the Commodore 64 Ram Expansion Unit ( REU ) so there is no conflict with source code and virtual memory. Here is my code to use blocks $5000 and up for virtual memory.
Code: Select all
SCR# B
// VIRTUAL MEMORY ACCESS
HEX
VARIABLE DP-T
VARIABLE (ORIGIN)
: ORIGIN ( ADR -- )
DUP (ORIGIN) ! DP-T ! ;
: THERE ( -- VADR ) DP-T @ ;
: ALLOT-T ( N -- ) DP-T +! ;
: >VIRTUAL ( VADR -- ADR )
0 B/BUF UM/MOD RAM BLOCK + ;
: C@-T ( VADR -- B )
>VIRTUAL C@ ;
: C!-T ( B VADR -- )
>VIRTUAL C! UPDATE ;
SCR# C
// VIRTUAL MEMORY ACCESS CONTINUED
HEX
: @-T ( VADR -- N )
DUP C@-T SWAP 1+ C@-T
100 * + ;
: !-T ( N VADR -- )
SWAP 0 100 UM/MOD
ROT TUCK 1+ C!-T C!-T ;
: C,-T ( B -- )
THERE 1 ALLOT-T C!-T ;
: ,-T ( N -- )
THERE 2 ALLOT-T !-T ;
: CMOVE>V ( ADR VADR CNT -- )
BOUNDS
?DO COUNT I C!-T LOOP
DROP ;
For those who don't know, the REU is a device to add external ram to the C64 and C128 computers. It had multiple banks and used a control register in the I/O area to set up the transfer using DMA to transfer memory contents between the C64's ram and the external ram. The one I had with my C64 had 512K of ram.
Note that @-T and !-T are built with C@-T and C!-T respectively to avoid problems at block boundaries.
In my metacompiler's META vocabulary, some of the memory access words are redefined for metacompilation.
Code: Select all
SCR# 2E
// META DEFINITIONS CONTINUED
HEX
META DEFINITIONS
: HERE THERE ;
: ALLOT ALLOT-T ;
: C@ C@-T ;
: @ @-T ;
: C! C!-T ;
: ! !-T ;
: C, C,-T ;
: , ,-T ;