Jump to content

Photo

fbForth—TI Forth with File-based Block I/O [Post #1 UPDATED: 11/10/2017]

fbForth Forth TI Forth

1459 replies to this topic

#1451 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,728 posts
  • Location:Silver Run, Maryland

Posted Thu Jan 25, 2018 10:54 AM

I just received a paper copy of the fbForth manual. Much easier to digest!  Lee, thanks for all your work on this. The list of differences with Starting Forth is a gem: I wish I'd had that for TI FORTH in 1984 when some kind engineer gave me that book!

 
I especially enjoyed the chapter on division - T-division and F-division. The example (of the plotter line drawing) answered my question: what application determines if you choose one or the other?
 
Last weekend I spent some time in fbForth and TI FORTH. All of my hobby time has been on various FORTHs this year.
 
-Erik

 

Good to have another Forther on board!  :)

 

Thank you for your kind words.  It has certainly been fun (mostly) for me to do.  Regarding the appendix showing the differences between Starting Forth and fbForth, I cannot take credit for much more than editing it from the 1983 original TI Forth Manual.  I corrected errors I found and brought it in line with fbForth.

 

I can, however, take full credit for Chapter 18 in my book, fbForth 2.0: A File-Based Cartridge Implementation of TI Forth (see my website below).  I should say that Matthew Splett (jedimatt42) graciously assisted with editing and proofreading of the book.  If you are referring to §18.3 (reproduction of the 1983 Dr. Dobb’s Journal article) of the PDF before I published the book, all credit there, of course, goes to its author, Robert L. Smith.  I had tried repeatedly to obtain permission for reproducing the article, but, alas, had to settle for quoting and evaluating it in research-paper mode.

 

As you have no doubt observed, there are a handful of willing Forth accomplices here on this forum.  :grin:  Again, welcome aboard!

 

...lee



#1452 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 706 posts
  • Location:The Great White North

Posted Thu Feb 1, 2018 2:50 PM

To show how it could be done I ported this VDP sound list player to FB-Forth.

Works as expected.

TEXT substitutions could be made to improve size and speed.

\ TI sound list player using VDP RAM        CAMEL99 Forth V1.99
\ ========================================================
HEX
\ ----------------
\ FB-FORTH Translation Harness
: VARIABLE   0 VARIABLE ;
: VC!     VSBW ;
: VC@     VSBR ;

: JIFF    100 0 DO LOOP ;  ( ~1/60 sec)
: JIFFS    0 DO JIFF LOOP ;

: 2DUP      OVER OVER ;
: SND!      8400 C! ;
: BOUNDS    OVER + SWAP ;
\ ----------------

\ vdp memory manager words
VARIABLE VP

HEX 1000 VP !   \ start of free VDP RAM


: VHERE   ( -- addr) VP @ ;   \ FETCH the value in VDP pointer
: VALLOT  ( n -- )   VP +! ;  \ add n to the value in VDP pointer
: VC,     ( n -- )   VHERE VC!  1 VALLOT ;
: VCOUNT  ( vdp$adr -- vdpadr len ) DUP 1+ SWAP VC@ ; \ convert counted string to addr,len
: VCREATE ( <text> -- addr) VHERE CONSTANT ;

\ ========================================================
\ sound list player
HEX

: SILENT ( --)  9F SND!  BF SND!  DF SND! FF SND! ;  \ turn off all sounds

: VPLAY$ ( sound_string -- ) \ play 1 sound string from VDP memory
       VCOUNT                \ -- addr len
       2DUP + VC@  >R        \ get duration at end of string, Rpush
       BOUNDS                \ convert addr/len to end-addr. start-addr.
       DO  I VC@ SND! LOOP   \ feed bytes to sound chip
       R> JIFFS ;            \ use the delay from Rstack (JIFF=1/60)

: VPLAYLIST   ( addr -- )    \ play a TI sound list
         BEGIN DUP VC@ WHILE \ while the length is not 0
            DUP VPLAY$       \ play a single string
            VCOUNT + 1+      \ advance to the next sound string
         REPEAT
         SILENT
         DROP ;

: /END   0 VC, 0 VC, ;   \ end the list with 2 bytes

\ ========================================================
\ VDP sound lists
HEX
VCREATE MUNCHMAN
         08 VC, 85 VC, 2A VC, 90 VC, A6 VC, 08 VC, B0 VC, CC VC, 1F VC, 12 VC,
         08 VC, 85 VC, 2A VC, 90 VC, A4 VC, 1C VC, B0 VC, C9 VC, 0A VC, 12 VC,
/END

VCREATE PACMAN
         06 VC, 86 VC, 0D VC, 97 VC, AC VC, 1A VC, B7 VC, 08 VC,
         02 VC, 8F VC, 08 VC, 02 VC,
         02 VC, AB VC, 23 VC, 05 VC,
         02 VC, 86 VC, 0D VC, 04 VC,
         01 VC, BF VC, 03 VC,
         02 VC, 8E VC, 0B VC, 08 VC,
         02 VC, 8A VC, 0A VC, 02 VC,
         03 VC, AC VC, 1A VC, B7 VC, 08 VC,
/END

VCREATE NOKIA
         01 VC, 9F VC, 20 VC,
         03 VC, 90 VC, 85 VC, 05 VC, 09 VC,
         02 VC, 8F VC, 05 VC, 09 VC,
         02 VC, 87 VC, 09 VC, 12 VC,
         02 VC, 87 VC, 08 VC, 12 VC,
         02 VC, 85 VC, 06 VC, 09 VC,
         02 VC, 81 VC, 07 VC, 09 VC,
         02 VC, 8E VC, 0B VC, 12 VC,
         02 VC, 8A VC, 0A VC, 12 VC,
         02 VC, 81 VC, 07 VC, 09 VC,
         02 VC, 8F VC, 07 VC, 09 VC,
         02 VC, 8A VC, 0C VC, 12 VC,
         02 VC, 8A VC, 0A VC, 12 VC,
         02 VC, 8F VC, 07 VC, 24 VC,
         01 VC, 9F VC, 00 VC,
/END


#1453 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,728 posts
  • Location:Silver Run, Maryland

Posted Thu Feb 1, 2018 3:41 PM

Cool!

 

...lee



#1454 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 706 posts
  • Location:The Great White North

Posted Fri Feb 9, 2018 5:00 PM

CRU wordset in FB-Forth/TI-Forth observation/alternative.

 

I needed these words to play with the SAMS card interface.

When I looked at them it seemed like they could be factored differently making each word much simpler.

 

First I made a word to set R12 called CRU!.  I don't play with R12 except as a CRU base so it's safe.

This allowed me to strip away all the R12 setting in SBO, SBZ and TB.   For TB it means you can scan for a bit much faster.

 

I also noticed that the DOCS seem to all use the CRU address without multiplying by 2. So CRU! does not double the value.

 

Am I missing something Lee?

 

(When looking at the code remember CAMEL99 keeps TOS in a register so it looks a littler different than what you are used to.)

CROSS-ASSEMBLING

CODE: CRU! ( addr -- ) \ set the CRU base address for CRU words
\         TOS  TOS ADD,    \ multiply adr by 2  (removed. Most DOCS use real address)
         TOS R12 MOV,      \ load CRU adr to R12
         TOS POP,          \ refill TOS register
         NEXT,
         END-CODE

CODE: SBO ( -- )    \ you must set the CRU address first
         0 SBO,
         NEXT,
         END-CODE

CODE: SBZ ( -- )
         0 SBZ,
         NEXT,
         END-CODE

CODE: TB ( -- ? )
         TOS PUSH,  \ save current TOS register
         TOS CLR,
         0 TB,
         EQ IF,
            TOS SETO,
         ENDIF,
         NEXT,
         END-CODE


Edited by TheBF, Fri Feb 9, 2018 5:24 PM.


#1455 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,728 posts
  • Location:Silver Run, Maryland

Posted Fri Feb 9, 2018 7:56 PM

CRU wordset in FB-Forth/TI-Forth observation/alternative.

...

Am I missing something Lee?

 

Probably not.  I would much rather have made fbForth follow the E/A Manual, but I did not want to break TI Forth code.  See §11.3 of the fbForth 2.0 Manual for a detailed description and Appendix H for a vertical representation of the code.

 

...lee



#1456 GDMike OFFLINE  

GDMike

    Space Invader

  • 17 posts

Posted Mon Feb 19, 2018 9:55 PM

Off subject, so sorry! BUT im trying to add your "DIR" catalog routine into a defined word such as  : test dir dsk1. ; but its not working. TB forth does not like the . period OR the whole command? I dunno, I just want to call the routine during runtime, as in dir dsk1.  thanks!

- Mike (GD mike). It's for my editor im putting together, a great way to learn some forth!



#1457 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,728 posts
  • Location:Silver Run, Maryland

Posted Mon Feb 19, 2018 11:33 PM

Off subject, so sorry! BUT im trying to add your "DIR" catalog routine into a defined word such as  : test dir dsk1. ; but its not working. TB forth does not like the . period OR the whole command? I dunno, I just want to call the routine during runtime, as in dir dsk1.  thanks!

- Mike (GD mike). It's for my editor im putting together, a great way to learn some forth!

 

In this thread, no question about Forth and, especially, about fbForth is off subject/topic.

 

Regarding compiling DIR into the definition of another word:  DIR was written to expect the disk drive’s device name (“DSK1.”, “DSK2.”, ...) in the input stream.  What you want to do can probably be done, but not easily with the current definition of DIR .  Presuming you loaded the definition of DIR from FBLOCKS before you defined TEST (required), the interpreter choked on “DSK1.” because it did not find that word in the dictionary and then could not convert it to a number to compile as a literal that would get placed on the stack at runtime.  I would need to redefine DIR to expect the address of a string on the stack for this to work the same compiled into a definition as written on the command line.

 

What you want to do here can easily be done with CAT , however.  First, load the definition of CAT from FBLOCKS with

58 LOAD 

and then define TEST as

: TEST 1 CAT ; 

to catalog DSK1 when it is executed.  The interpreter will compile the ‘1’ as a literal that will get placed on the stack at runtime just before CAT is executed at runtime.

 

BTW, welcome aboard the Forth train—the more, the merrier!

 

...lee



#1458 GDMike OFFLINE  

GDMike

    Space Invader

  • 17 posts

Posted Tue Feb 20, 2018 1:39 AM

I couldn't find the page to load. It took me into floating point.. SO i went to DL TF again, thinking I may have the incorrect ver. SO the instructions i received say find the MODS folder and paste a couple of bin files, I do not have a MODs folder, Im using win 7

and classic 99 and it creates a config file on my desktop and that's seems to be all I can find - i never went through an install. - Ill go and find another classic99 package to run, maybe it will be there.


Edited by GDMike, Tue Feb 20, 2018 2:28 AM.


#1459 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,728 posts
  • Location:Silver Run, Maryland

Posted Tue Feb 20, 2018 7:56 AM

I couldn't find the page to load. It took me into floating point.. SO i went to DL TF again, thinking I may have the incorrect ver. SO the instructions i received say find the MODS folder and paste a couple of bin files, I do not have a MODs folder, Im using win 7

and classic 99 and it creates a config file on my desktop and that's seems to be all I can find - i never went through an install. - Ill go and find another classic99 package to run, maybe it will be there.

 

I was talking about fbForth’s system blocks file, FBLOCKS.  I mistakenly thought you were talking about working in fbForth and trying the same thing in TurboForth (with its system blocks file, BLOCKS).  Sorry about that.

 

Also, the MODS folder is a Classic99 sub-folder.  The current version of Classic99 (v399a) has the current versions of fbForth and TurboForth built in.  You can certainly load a version of TF or fbF into the MODS folder yourself, but you should not need to do that.

 

...lee



#1460 GDMike OFFLINE  

GDMike

    Space Invader

  • 17 posts

Posted Sat Mar 10, 2018 6:45 AM

Thanks, I was in the process of "Physically Moving" to another house. Now I'm settled and forgot what I was doing prior? Oh, Right. Building a Directory. thanks for that tip Mr. Stewart I see where I went wrong now. I guess I'm also waiting on a Nano PEB to come available to purchase too. But it doesn't stop the Forth Train!!







Also tagged with one or more of these keywords: fbForth, Forth, TI Forth

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users