Jump to content

Photo

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

fbForth Forth TI Forth

1454 replies to this topic

#1451 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,544 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

    Moonsweeper

  • 480 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,544 posts
  • Location:Silver Run, Maryland

Posted Thu Feb 1, 2018 3:41 PM

Cool!

 

...lee



#1454 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 480 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,544 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







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