Tali Forth for the 65c02

Topics relating to various Forth models on the 6502, 65816, and related microprocessors and microcontrollers.
scotws
Posts: 576
Joined: 07 Jan 2013
Location: Just outside Berlin, Germany
Contact:

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by scotws »

JimBoyd wrote:
The third what?
Jhanas are said to be stages of concentration during Buddhist mediation (https://tricycle.org/magazine/jhanas-pe ... entration/). I'll let you know if I ever get there, but you might not want to hold your breath. :D
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by Dr Jefyll »

( Wow! If you get there, will you be able to let us know?? :shock: )
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by JimBoyd »

scotws wrote:
JimBoyd wrote:
The third what?
Jhanas are said to be stages of concentration during Buddhist mediation (https://tricycle.org/magazine/jhanas-pe ... entration/). I'll let you know if I ever get there, but you might not want to hold your breath. :D
Oh. I'm not Buddhist, I'm a Christian. I don't know much about Buddhism.
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by JimBoyd »

Dr Jefyll wrote:
( Wow! If you get there, will you be able to let us know?? :shock: )
Does the third level require a vow of silence?
scotws
Posts: 576
Joined: 07 Jan 2013
Location: Just outside Berlin, Germany
Contact:

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by scotws »

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 ...
scotws
Posts: 576
Joined: 07 Jan 2013
Location: Just outside Berlin, Germany
Contact:

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by scotws »

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.
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by JimBoyd »

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.
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.
whartung
Posts: 1004
Joined: 13 Dec 2003

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by whartung »

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.
Is there a link to the PDF? or the AsciiDoc? There's nothing obvious on github.
handyandy
Posts: 113
Joined: 14 Sep 2015
Location: Virginia USA

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by handyandy »

Found it here: https://github.com/scotws/TaliForth2/tree/master/docs
See manual.pdf near the bottom.

Cheers,
Andy
scotws
Posts: 576
Joined: 07 Jan 2013
Location: Just outside Berlin, Germany
Contact:

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by scotws »

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.
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.
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).
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by SamCoVT »

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.
The current examples are for text, using a very simple (line replacement) editor that was just recently added to Tali, but I do plan on adding some extra tutorial information on how to store binary values in blocks as well.
whartung
Posts: 1004
Joined: 13 Dec 2003

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by whartung »

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.
When I clicked on the Ascii Doc files, it looks like GitHub just rendered them in to HTML automagically.
scotws
Posts: 576
Joined: 07 Jan 2013
Location: Just outside Berlin, Germany
Contact:

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by scotws »

Jim, Sam has just added a section to the manual about binary data and blocks: https://github.com/scotws/TaliForth2/bl ... ith-blocks
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by JimBoyd »

I'm puzzled by a note in the document
Quote:
Many Forths now use the words cs-pick and cs-roll instead of the branch variants
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
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 )
;
CS-ROLL
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
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: Introducing Tali Forth for the 65c02 (ALPHA)

Post by JimBoyd »

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.

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 ;
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.

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 ;
Post Reply