Jump to content
IGNORED

TurboForth


GDMike

Recommended Posts

Ok, great news.  The needle just moved in my cursor routine from it's 90 percent typing accuracy to a 95 percent accuracy. I'm just comparing my typing some stuff in basic/ forth against my routine to test for speed, error and repeat. I just kept in trying to find ways to improve upon what I started writing in the beginning. It wasn't very easy as im using 2 flags, and I think three delay loops. I'm not good enough at trying to grab clock timers and comparison things of that sort, but I stuck with what I already knew and pressed on. I was hung at the 90 percent mark where two keys hit at a fast rate would work/not work. I had to climb over that hill and get that to function each and every time or else quit.

I can't even remember all the craziness in loops and all, but I'm just about ready to press on. I'll do a vid on it tomorrow.

Link to comment
Share on other sites

So today I added my cursor routine into the rest of my application. The order of loads are as follows: SAMs memory manager, Sound driver, some basic routines and last my cursor.

Sounds simple. previously all those run well in that order, but after loading the cursor routine and starting it, I see that the cursor is flashing at half speed??

Why..so I changed the order of loads to load the cursor first then everything else. It fixed the problem, but I dunno why..no duplicate words or variables are included.. but it fixed my issue..wow, that was close. 

Edited by GDMike
  • Like 2
Link to comment
Share on other sites

On 10/7/2019 at 10:13 PM, GDMike said:

but it fixed my issue..wow, that was close. 

Please don't take this the wrong way but I started smiling when I read this.  (it's from my past experience)

My guess is that at some point you will find out why this happened while searching for a different bug. :)

I'm just sayin' ... 

 

But congrats on getting things working. 

 

I managed to get the beginnings of a editor working that loads a text file into disk blocks using the blocks as virtual memory rather than using SAMS.

A SAMS version will come next maybe.

 

The text file is loaded into a 32K block file that is organized as 128 byte records (8 records/block) and edited in the blocks. When you are done editing you save the file back to DV80. So you only need 1 block file that is re-used every time.  The downside is that erasing 32K bytes in a file is pretty slow on the  99. ( 9 seconds) AND  I have not yet written the line insert and line delete code but in a full 32K byte file that will be slow as well.  So this will probably not be as practical as I would like.  I am considering making it a "page" based editor where you can only insert and delete lines on a page, but provide a big copy and paste buffer including a page copy and past.  But in the end it's not an ideal way to do it.

 

I think I should make each line a double linked list. I have plenty of extra bytes in each record to do this. Then when you move lines around you just changed the list pointers.  That hard part is keeping those pointers accurate!  But every time you do a final save back to DV80 you make it all new again.  The downside will be file load/save times will be a bit worse and screen refreshes will be slower too.

 

So much code, so little time...

 

  • Like 1
Link to comment
Share on other sites

Would that time be worth it - if using a ramdisk instead of floppy? I'm thinking about when I get a ramdisk and how things may change on load/save times.

---

Lol, I never saw why my problem arose, but it's gone after I changed my sequence of routines to load.  

The issue, if it is one with TF is how often you have to stop and flush. It's way too often, but I'm sure the author had little choice as there isn't much ram to use, but I started to think, they made a SAMs manager, why not use part of SAMs for buffering if it was found on a system or at least a choice..but again, I'm still learning and maybe I NEED to figure out how to do that.. thx for your feedback

Link to comment
Share on other sites

18 hours ago, GDMike said:

<snip>

The issue, if it is one with TF is how often you have to stop and flush. It's way too often, but I'm sure the author had little choice as there isn't much ram to use, but I started to think, they made a SAMs manager, why not use part of SAMs for buffering if it was found on a system or at least a choice..but again, I'm still learning and maybe I NEED to figure out how to do that.. thx for your feedback

Do you mean that the system stops and does FLUSH automatically too often? If so increase the number of buffers.

If you are doing it manually then you should use UPDATE whenever you change a block in any way.

Then you only have to FLUSH when you leave the editor and return to Forth.

 

SAMS could be used quite easily.  You could rewrite the word BLOCK to SAMSBLOCK so that it behaves like ( block# -- address)  but is returning a block of memory in SAMS. That's all you would need to do to edit in SAMS.

 

BUT... you then need save those blocks out to disk when you are done.  This could be to BLOCK file, one to one save, or if you want to get fancy save them as DV80 files. Of course then you need a DV80 file loader to SAMS blocks.

 

I am doing the latter. Editing in BLOCKs and saving and loading DV80 files. (That was trickier than I thought it would be. I can send you code if you need it.)

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...

While I was at it I thought I would add this Turbo Forth version to the mix. Stacks 'R Us.

 

\ STACKS.FTH    for Turbo Forth   B Fox 2019

: LIFO: ( #items -- )  \ "last in first out" creates a stack
         CREATE
            CELLS DUP , ( # of cells in the stack)
                  DUP , ( items on stack )
            ALLOT   0 , ( extra cell )
;
: 2@ ( adr -- n1 n2 )   DUP 2+ @ SWAP @ ;
: CELL+@   ( addr -- addr' n )  CELL+ DUP @ ;
: CELL-    ( n -- n') 2- ;
: STACK-SIZE  ( 'stack -- n ) @ ;
: STACK-DEPTH ( stack-addr -- n ) 2@ - 2/ ABS ;

\ Generic Forth versions
 : 2+!  ( addr -- ) DUP @ 2+ SWAP ! ;
 : 2-!  ( addr -- ) DUP @ 2- SWAP ! ;

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

: POP   ( stack-adr -- n )
        DUP 2@ = ABORT" User stack empty"
        CELL+@ 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

 

  • Like 2
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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