Jump to content
IGNORED

TI professional computer (not ti-99) for now


Recommended Posts

Ok so if you want to be a real nerd... :)

Here is a line editor that lets you enter text into a block. You can change text in a block, only replace it with the 'P' command.

 

( line editor 1st block  )
DECIMAL 
: LINE  ( n -- ) C/L *  SCR @ BLOCK + ;
: ROW   ( l# -- l#') DUP LINE C/L -TRAILING TYPE  1+ ;
: .LINE   ( l# -- l#') DUP 2 .R  ." | " ROW CR ;
: 4LINES  ( l# -- l#') .LINE .LINE .LINE .LINE ;
: 16LINES ( -- )  0 4LINES 4LINES 4LINES 4LINES DROP ;
: LIST ( n -- ) SCR ! PAGE 0 0 AT ." SCR# " SCR ? CR 16LINES ;
: L    SCR @ LIST ;
: >>  ( -- )  1 SCR +!  L ;
: <<  ( -- )  SCR @ 1- 0 MAX  L  ;
: P   ( l# -- ) 1 PARSE ROT LINE SWAP MOVE UPDATE  L ;

 

 

You type all this in at the console and you have a dead simple editor.

 

make a new block file  LINEDIT.BLK 

 

OPEN LINEDIT.BLK 

1 LIST

 

Then you type it all over again using the P command like this:

 

0 P ( line editor 1st block  )

1 P DECIMAL 

2 P : LINE  ( n -- ) C/L *  SCR @ BLOCK + ;

 

and so on. 

 

Then type FLUSH  to write the block to disk.  Congrats! you have save your editor in a file. :) 

 

Then on block 2 add these lines using the P command 

( line editor 2nd block )
: DL  ( l# -- ) LINE C/L BLANK UPDATE L ;
: (CP)    ( L1 L2 -- ) LINE SWAP LINE SWAP C/L MOVE ;
: CP  ( L1 L2 -- ) (CP) UPDATE  L ;
: EB  ( blk --) BLOCK B/BUF BLANK UPDATE ;
: MV  ( L1 L2 -- ) OVER >R (CP) R> DL ;
: UNDO ( -- ) EMPTY-BUFFERS L ;

 

and flush. 

 

 

  • Like 2
Link to comment
Share on other sites

Oh here are the instructions

 

\ Line editor  commands
\ LIST ( scr# -- ) list scr# and set SCR variable 
\ L  ( -- )  Re-list currect block
\ >>  ( -- )  List next block
\ <<  ( -- )  List previous block
\ P   ( l# -- <text>) Put <text> into line# ( 5 P This goes to line 5 )
\ DL  ( l# -- ) Delete line#
\ CP  ( l1 l2 -- ) Copy line1 to line2
\ M   ( l1 l2 -- ) Move line1 to line2. erase line1
\ EB  ( blk# -- ) erase block

 

Edited by TheBF
RO command not applicable to F83
  • Like 2
Link to comment
Share on other sites

15 minutes ago, TheBF said:

Ok so if you want to be a real nerd... :)

Here is a line editor that lets you enter text into a block. You can change text in a block, only replace it with the 'P' command.

 

( line editor 1st block  )
DECIMAL 
: LINE  ( n -- ) C/L *  SCR @ BLOCK + ;
: ROW   ( l# -- l#') DUP LINE C/L -TRAILING TYPE  1+ ;
: .LINE   ( l# -- l#') DUP 2 .R  ." | " ROW CR ;
: 4LINES  ( l# -- l#') .LINE .LINE .LINE .LINE ;
: 16LINES ( -- )  0 4LINES 4LINES 4LINES 4LINES DROP ;
: LIST ( n -- ) SCR ! PAGE 0 0 AT ." SCR# " SCR ? CR 16LINES ;
: L    SCR @ LIST ;
: >>  ( -- )  1 SCR +!  L ;
: <<  ( -- )  SCR @ 1- 0 MAX  L  ;
: P   ( l# -- ) 1 PARSE ROT LINE SWAP MOVE UPDATE  L ;

 

 

You type all this in at the console and you have a dead simple editor.

 

make a new block file  LINEDIT.BLK 

 

OPEN LINEDIT.BLK 

1 LIST

 

Then you type it all over again using the P command like this:

 

0 P ( line editor 1st block  )

1 P DECIMAL 

2 P : LINE  ( n -- ) C/L *  SCR @ BLOCK + ;

 

and so on. 

 

Then type FLUSH  to write the block to disk.  Congrats! you have save your editor in a file. :) 

 

Then on block 2 add these lines using the P command 

( line editor 2nd block )
: DL  ( l# -- ) LINE C/L BLANK UPDATE L ;
: (CP)    ( L1 L2 -- ) LINE SWAP LINE SWAP C/L MOVE ;
: CP  ( L1 L2 -- ) (CP) UPDATE  L ;
: EB  ( blk --) BLOCK B/BUF BLANK UPDATE ;
: MV  ( L1 L2 -- ) OVER >R (CP) R> DL ;
: UNDO ( -- ) EMPTY-BUFFERS L ;

 

and flush. 

 

 

Of course I'm going to try this..

  • Like 1
Link to comment
Share on other sites

Posted (edited)

I typed in the first part 

I opened my file I created called editor.blk instead of line edit 

And I did 1 list

And the photo shows where it scrolled the screen after 1 list I think somewhere around 8 or 10 lines , and then I received an error

I know I got the typo when I type swap in this photo but this is the second time that I've locked up with this error..

 

I think it's happening when it hits the word "AT"

IMG_20240726_161351216_HDR.jpg

Edited by GDMike
Link to comment
Share on other sites

Posted (edited)

Should It scroll each time I press enter?

Yes I am thrilled!!

Yes I corrected my word because I didn't have a separator between the colon and the word to be defined. 

But that was easy enough for me...

Thank you!!!

I have an Editor...

Maybe now I can remove that get-id

Or just keep this one..

I just don't like the it keeps scrolling when you enter a line...

Id rather it scroll 2 lines then present the screen. 

Maybe I can fool around with it and make it do that I need to take out the page word.

 

Edited by GDMike
Link to comment
Share on other sites

Posted (edited)

all in all.. The word "AT" needs to be redefined. 

I noticed in the editor they mentioned IBM a couple of times. Maybe there trying to distinguish between modes.

I'll research that a little further..

In the meantime I dressed up my editor a little bit It doesn't scroll like we had it.

Removed page and added two cr's, carriage returns prior to reprinting the screen. 

And I added a help menu on exit of the load routine. 

Trust me I'll need it..

Thank you again Brian this is great It really helps me.

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

Way to go.  I just got back from my daughters place.  It's a humble thing, but you can put stuff in blocks and load it.

This is real old school Forth. :) 

It's great education to see how you can do this stuff will simple words.

 

BTW notice that LIST does not have a loop. It's all unrolled as words.  I stole that from a guy named Sam Falvo.

 

  • Like 2
Link to comment
Share on other sites

4 hours ago, GDMike said:

Should It scroll each time I press enter?

Yes I am thrilled!!

Yes I corrected my word because I didn't have a separator between the colon and the word to be defined. 

But that was easy enough for me...

Thank you!!!

I have an Editor...

Maybe now I can remove that get-id

Or just keep this one..

I just don't like the it keeps scrolling when you enter a line...

Id rather it scroll 2 lines then present the screen. 

Maybe I can fool around with it and make it do that I need to take out the page word.

 

 

So without using PAGE and 0 0 AT it is slow, but that's what it should do. 

With AT the screen writes in 1/2 a second after you "put" a line into the block. 

We need to make you an AT word that works.  I think we can do it with some system variables.  I will see what I can find. 

 

 

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

Posted (edited)

I stumbled across this 

https://wiki.forth-ev.de/doku.php/projects:sample1.blk

 

Screen 1 not modified     

 0 \ Load screen for HELP system 12:54JWB04/09/87 

 1                                                                 

 2 ONLY FORTH DEFINITIONS                                          

 3                                                                 

 4 \ These words require DEVICE=ANSI.SYS to be in you CONFIG.SYS  

 5 \ file and the the ANSI.SYS driver to be on your boot disk.     

 6                                                                 

 7 : ESC[ 27 EMIT ASCII [ EMIT ;                                 

 8 : CLS ESC[ ." 2J" ;                                          

 9 : BRIGHT ESC[ ." 1m" ;                                          

10 : NORMAL ESC[ ." 0m" ;                                          

11 : BLUE ESC[ ." 44m" ;                                         

12                                                                 

13 FROM HELP.BLK 1 LOAD ( loads the HELP system )               

14                                                                 

15                                                                 

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

9 hours ago, GDMike said:

I stumbled across this 

https://wiki.forth-ev.de/doku.php/projects:sample1.blk

 

Screen 1 not modified     

 0 \ Load screen for HELP system 12:54JWB04/09/87 

 1                                                                 

 2 ONLY FORTH DEFINITIONS                                          

 3                                                                 

 4 \ These words require DEVICE=ANSI.SYS to be in you CONFIG.SYS  

 5 \ file and the the ANSI.SYS driver to be on your boot disk.     

 6                                                                 

 7 : ESC[ 27 EMIT ASCII [ EMIT ;                                 

 8 : CLS ESC[ ." 2J" ;                                          

 9 : BRIGHT ESC[ ." 1m" ;                                          

10 : NORMAL ESC[ ." 0m" ;                                          

11 : BLUE ESC[ ." 44m" ;                                         

12                                                                 

13 FROM HELP.BLK 1 LOAD ( loads the HELP system )               

14                                                                 

15                                                                 

Cool.  now you know the basis of controlling an ANSI computer terminal.

 

Here is a full list of control codes including more colour codes.

 

https://gist.github.com/ConnerWill/d4b6c776b509add763e17f9f113fd25b

 

  • Like 2
Link to comment
Share on other sites

Do those colors work on your terminal?

If so then you have the ANSI.SYS loaded in the computer. 

 

This might work using the terminal codes 

 

: GOTOXY ( x y --) SWAP  ESC[  1-  .  ." ;"  1- .  ASCII H  EMIT ;

 

 

  • Like 1
Link to comment
Share on other sites

Posted (edited)
2 hours ago, TheBF said:

Do those colors work on your terminal?

If so then you have the ANSI.SYS loaded in the computer. 

 

This might work using the terminal codes 

 

: GOTOXY ( x y --) SWAP  ESC[  1-  .  ." ;"  1- .  ASCII H  EMIT ;

 

 

ESC[ is not defined

And ansi sys is not in this version of Dos.

So I defined it as : ESC[ 27 emit ASCII [ EMIT ;

And it didn't work as expected..

Just left a number on stack, this was one of the positions, and a letter H

 

Edited by GDMike
Link to comment
Share on other sites

Duh.... this makes sense..

Well I like using the BS or backspace word to solve my problem about moving around the screen but as long as I have a determined number to move to I'm okay with that. 

But I didn't like the word okay being presented at the end of the line, as the CR routine leaves the ok..

Which makes things kind of clumsy. 

I was looking for a way to make a clean backspace..

So I've been reading article after article on what I can find and I did find this which led me to the duh I never thought about 

 

Screenshot_20240729-123156.png

  • Like 1
Link to comment
Share on other sites

On 7/27/2024 at 5:49 PM, GDMike said:

I found a predefined word in f-83 

I can make something kinda outta backspace and the word spaces??

 

 

IMG_20240727_165033115.jpg

Not sure if you know this. You should not use (?DO) and (LOOP) in you own definitions. The brackets are "shorthand" for this word is for internal use only.   

The de-compiler shows them because (?DO) and (LOOP) are what is compiled when you use ?DO and LOOP in a definition. 

 

  • Like 1
Link to comment
Share on other sites

6 hours ago, TheBF said:

Not sure if you know this. You should not use (?DO) and (LOOP) in you own definitions. The brackets are "shorthand" for this word is for internal use only.   

The de-compiler shows them because (?DO) and (LOOP) are what is compiled when you use ?DO and LOOP in a definition. 

 

Yes I saw that when I did the "see do" 

But realized later the "do loop leave" is proper. 

But neither resolved my issue of removing the"ok" when this particular loop is completed. 

I do notice a CR is happening but I couldn't find out where it was in a definition for the backspace. 

 

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