Jump to content
Lee Stewart

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

Recommended Posts

Post #1 has been updated with all of the files for the latest build, fbForth 2.0:12. I will update my website later this week.

 

I fixed a couple of bugs:

  • The trigonometric functions in the Floating Point Library returned erroneous results after I hooked the Forth ISR as the system default (in build 9, I believe),
  • DOT (used to plot a pixel in Bitmap mode) ignored half of the color palette you could set with DCOLOR .

The latest FBLOCKS has only cosmetic changes—mainly, new binary images for four of the menu options that depend on the build with which they were BSAVEd.

 

Let me know if you find any bugs or need assistance with anything.

 

...lee

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

User defined stacks for FbForth

 

So after you found my 2-! bug everything worked fine.

So as a thank you here is a version that works on FbForth.

\ STACKS.FTH    for FbForth     B Fox 2019

\ primitives
: CELLS   1 SLA ;
: 2/      1 SRA ; 
: CELL+   2+ ;
: CELL-   2- ;
: [email protected] ( adr -- n1 n2 )   DUP 2+ @ SWAP @ ;

: LIFO: ( #items -- )  \ "last in first out" creates a stack
         <BUILDS
            CELLS DUP , ( # of bytes in the stack)
                  DUP , ( max items on stack )
            ALLOT   0 , ( safety cell ? )
         DOES>
;

: [email protected]   ( addr -- addr' n )  CELL+ DUP @ ;
: STACK-SIZE  ( 'stack -- n ) @ ;
: STACK-DEPTH ( stack-addr -- n ) [email protected] - 2/ ABS ;

  : 2+!  ( addr -- ) DUP @ 2+ SWAP ! ;
  : 2-!  ( addr -- ) DUP @ 2- SWAP ! ;

: PUSH  ( n stack-adr - )
        [email protected] CELL- DUP 0= ABORT" User stack full"
        OVER 2-! + ! ;

: POP   ( stack-adr -- n )
        DUP [email protected] = ABORT" User stack empty"
        [email protected] OVER 2+! + @ ;

\ test code ...................
DECIMAL
  10 LIFO: Q

  99 Q PUSH  100 Q PUSH   101 Q PUSH

   Q STACK-DEPTH .

  Q POP . Q POP . Q POP .
  Q POP

 

Edited by TheBF
Dupicate definition
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 11/17/2019 at 12:14 AM, Lee Stewart said:

Post #1 has been updated with all of the files for the latest build, fbForth 2.0:12. I will update my website later this week.

 

I realize that I have done absolutely nothing to my website (see my signature below) since at least the middle of November—probably even further back than that! And—I probably won’t get to it for a while yet. but I will eventually get to it, I promise. I definitely do not want to disappoint all y’all champing at the bit to have up-to-date Forthy things to peruse there!

 

...lee

  • Like 4

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...