Jump to content
TheBF

Camel99 Forth Information goes here

Recommended Posts

ED99 SAMS Library Option for faster editor performance

 

The published source code for ED99 uses the DSK1.SAMSFTH library file which allows SAMS card access written in Forth.

There is a native code version of the same functionality called DSK1.SAMS.  You can improve the SAMS speed by about 40% by using this library.

 

Open the source code for ED99 in an editor and look and the NEEDS lines at the top the file.

Change the line  FROM DSK1.SAMSFTH   -to-   FROM DSK1.SAMS

 

When you recompile ED99 you will find that memory purges, file loads and saves are faster and scrolling line by line is faster as well.

 

Classic99 QI399.025 2020-06-20 12_06_39 PM.png

  • Like 1

Share this post


Link to post
Share on other sites

ED99  V1.0

 

I am finally modestly content with the ED99 editor.  Here is ZIP file with the whole thing wrapped up as an EA5 program. (Thanks Tursi for that amazing emulator)

I also uploaded a video showing ED99 in operation so people can get a quick start on how to use it.

 

Features I like:

  • Cut and Paste to a line clipboard
  • DIR and CAT commands available at command line
  • Holds 10 files simultaneously.  (needs 1M SAMS card)  

(Not mentioned in the video but the Forth DSK1.TOOLS is buried inside the editor so you actually have a working Forth development system here) :) 

 

Also DSK1.ED99DOC now also has the BYE command documented. No need to turn off the machine)

 

 

Things to add:  

  • Expand the max file size beyond 511 lines
    •  Might have to change the internal data organization
  • And some UNDO capability
  • File MERGE command
  • File COPY command
  • File PRINT command via RS232. (background is the goal) 

ED99.DSK.zip

  • Thanks 1

Share this post


Link to post
Share on other sites

I have to admit that it looks pretty slick and lightning fast to boot! I love the feature of having multiple files open and the ability to copy and paste from one file to the other. Extremely handy feature, although a block copy/paste function would probably be even more practical. And the fact that the Forth command line is accessible with disk directories and such adds to the usefulness. 

Wish list:

  • Files larger than 511 lines
  • 80 columns support with the F18A
  • Printing to PIO (I like my old trusty dot-matrix parallel printer :) )

It seems that lately we're having a renaissance in editors with Supernotes, Stevie and now ED99!

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you. This is the first big application I have released to the community beyond the Forth system itself so I am a little shy.

 

I noticed the "outbreak" of editors too. Maybe it's another virus circulating. :) 

 

Ok I am with you on all those features.  I can expand the exit window have more lines as well with a few tweeks if that has value to you.

  • Files larger than 511 lines   
    • I made a prototype that gave me 1000 lines. 
    • I am wasting tons of space using a record based internal structure which bugs me. I am looking at alternatives.
  • 80 columns support with the F18A 
    • It current runs in 80 columns out of the box but I have to preload my 80 column library first. I will make a version with that)
  • Printing to PIO (I like my old trusty dot-matrix parallel printer :) )
    • Cool!  I can make a PRINT command that takes the TI-99 device string as a parameter so you should be able to "print" to any legal TI-99 device.
    •  Ultimately I want PRINT to run as a separate task. That requires that I write my own drivers (PIO is pretty trivial) since the DSRs don't behave well in a cooperative environment.
  • BLOCK copy/paste
    • I have that on a todo list down the road.  I will need to provide an inverted char set which I can do simply enough, and select a keystroke to "mark" a section and a keystroke to copy the section to clipboard. (DOS used to use ENTER to end the marking process so that will do)
    •  Then I need a command key to paste the entire clipboard rather that just one line. Control P sounds like a mnemonic choice.  I can add control P pretty quickly.

I will keep noodling on this and post an update when I am happy with the results.

  • Like 4

Share this post


Link to post
Share on other sites

Lol.

I knew I could get a PASTEALL function going pretty quickly but it was easier than I thought. :)

Here is the code:

: PASTEALL
        BEGIN
          CLIPBOARD?
        WHILE
          INSRT-LINE CLIP2LINE
          SPINNER
        REPEAT
        LIST UPDATED ;

 

  • Like 2

Share this post


Link to post
Share on other sites

Like alot what I’m seeing. Congrats on the hard work on this. Having such a powerful system underneath does open quite a lot of interesting opportunities.

 

Looking forward seeing how this further develops. 👌

  • Like 2

Share this post


Link to post
Share on other sites
Posted (edited)

The weirdest bug

 

Last month I went through my VDP routines to make them compliant with advice from Tursi that hitting the VDP ports in any way with Interrupts on was a no/no.

I was still randomly getting an error every now and again in the debugger but I couldn't pin-point when it would happen.

I opened up the heat map for a different reason yesterday and I saw this line running slowly through the entire memory map!

When the line hit the VDP port addresses that green comet flew through the heatmap. :) 

 

I traced it to the code that runs when a Forth variable runs.  The cursor variable was being repeatedly read in the input loop.

CODE: DOVAR   ( -- addr) \ Executor that executes a "VARIABLE"
      *SP     DECT,    \ make room in TOS
       R4 *SP MOV,     \ mov TOS register to stack
       R8  R4 MOV,     \ put contents of PFA in TOS
      NEXT,
 END-CODE

I still do not know why it did it.  I moved the code to another place in the source code so see what would happen...

The line  went away but I am still seeing: Warning: PC >A072 reading VDP with LIMI 2 

It is still happening at address >A072 but a different piece of code is there now.

 

More sleuthing to do.

It's tough when you use homemade tools. :) 

HEATMAP_WEIRDBUG.png

Edited by TheBF
typo
  • Like 2

Share this post


Link to post
Share on other sites

Searching for Text

 

Just like GDMike I need a search routine for ED99.  I had done some work to create a new Forth2012 word but it was clunky. It used a pre-defined buffer for the input string which is really not cool.

I think I have something better now. 

The hard core part is COMPARE and in Camel99 Forth it is build onto top of an Assembler word from the original Camel Forth called S=.


 CODE S=  ( Caddr1 Caddr2 cnt1 -- n )
    R2 POP,                   \ adrs2 -> R2
    R1 POP,                   \ adrs1 -> R1
    TOS R0 MOV,               \ cnt -> R0
    TOS CLR,                  \ clear output flag (0 means a match)
    NE IF,                    \ if count<>0 do search
       BEGIN,
         R1 *+ R2 *+ CMPB,    \ compare & auto increment
          NE IF,              \ mismatch found,
              LT IF, TOS DEC, \ $1<$2
              ELSE,  TOS INC, \ $1>$2
              ENDIF,
              NEXT,           \ Return to Forth
          ENDIF,
          R0 DEC,             \ decr. loop counter
       EQ UNTIL,              \ loop while R0 > 0
   ENDIF,
   NEXT,                      \ Return to Forth
   ENDCODE

It's very low overhead to make S= function like ANS Forth COMPARE

: COMPARE ( addr n addr2 n2 -- -1|0|1) ROT MIN S= ;

. I borrowed an idea from the late Neil Baud with 3RD and 4TH.  These routines work like PICK but are much faster. In fact on the 9900 they are the same two instructions as OVER.  

CODE 4TH ( a b c d -- a b c d a )  \ same speed as OVER
           TOS PUSH,
           6 (SP) TOS MOV,
           NEXT,            
           ENDCODE

Armed with that fire power I now have a proper SEARCH for the system.

\ search.fth  for Camel99 Forth     Brian Fox  26Jun2020
 ( c-addr1 u1 c-addr2 u2 -- c-addr3 u3 flag )
\ Search the string specified by c-addr1 u1 for the string specified by c-addr2
\ u2. If flag is true, a match was found at c-addr3 with u3 characters remaining
\ If flag is false there was no match and c-addr3 is c-addr1 and u3 is u1.
\

\ NEEDS DUMP   FROM DSK1.TOOLS  \ debug only
NEEDS 3RD     FROM DSK1.3RD4TH  \ CODE like OVER but for 3rd and 4th items
NEEDS COMPARE FROM DSK1.COMPARE

\ MARKER /SEARCH

( 2OVER is macro for more speed)
: 2OVER    ( d d2 -- d d2 d) POSTPONE 4TH  POSTPONE 4TH ; IMMEDIATE
: 4DUP     (  d d2  --  d d2 d d2) 2OVER 2OVER ;
: 2NIP     ( a b c d -- c d ) 2SWAP 2DROP ;

: SEARCH  ( string1 len1 string2 len2-- string3 len)
          2SWAP (  -- caddr2 u2 caddr1 u1 )
          BEGIN
             DUP ( test u1 )
          WHILE
             4DUP COMPARE
             0= IF 2NIP
                   TRUE
                   EXIT       \  jump to ';'
              THEN
             1 /STRING        \ remove 1st char
          REPEAT ;

 

  • Like 2

Share this post


Link to post
Share on other sites

Wow! I thought I caught a mistake in the code for S= , but no, there was that NEXT, !  I have got to remember that device. I must have some Forth Assembler in fbForth that could use that.

 

Similarly, your use of EXIT in SEARCH , for which I could probably use ;S in fbForth, but would have to check to see whether I could really get away with it.

 

Nicely done!

 

...lee

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

It breaks the the rule of structured programming for of one entry and one exit point, but it does give you some efficiency when it works out. :)

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, TheBF said:

It breaks the rule of structured programming for of one entry and one exit point, but it does give you some efficiency when it works out. :)

 

In that spirit, I would simply do R0 1 LI, instead of NEXT, inside the loop. Takes longer, I am sure, but honors the rule.

 

...lee

  • Like 2

Share this post


Link to post
Share on other sites

I take your point. It bugs me to do a register adjustment, to force a jump,  that then just ends up running NEXT. :( 

In a commercial project I would be obedient but here...

 

Maybe we can just keep this between us. :) 

  • Like 2
  • Haha 1

Share this post


Link to post
Share on other sites

ED99-40 column Beta Release

40 column multi-file editor

 

Changes:

Fixed problem: SAMS card was not initialized on startup. Worked on Classic99 failed on real hardware.

 

Clipboard no longer uses VDP RAM. The upper end of SAMS memory is used so 511 lines can be copied.

Fixed the ed99config file to use DSK1. to find the font to load.

Four font files have been included with the release.

 

Feature Additions

  •  FCNT 4 (break) will stop file loading.  The partial file will be in SAMS memory. Use PURGE if you don't want to keep it
  •  FCNT 4 (break) will stop file save. The partial file will be written to disk.
  •  CTRL A will copy entire file to clipboard.
  •  CTRL P will paste entire file to the END of the current file. (Insert can be too slow at this time)
  •  Number of lines in clipboard is displayed on lower right side of editing window
  •  PRINT command prints the active file to any DSR enabled device. 
    • Examples:  PRINT PIO, PRINT RS232.BA=9600 

Limitations

File size is still limited to 511 lines

Inserting to the top of a large file is still slow due to the simple internal data structure.

 

Future

80 Column version will have these features added and tested.

Single level undo/redo 

 

 

 

 

 





 

ED9940.DSK.zip

  • Like 2

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