Jump to content
IGNORED

vi99


TheBF

Recommended Posts

I had been threatening to try this for some time so it was time to get off the pot. 

 

Are there any people here that use vi regularly?

I only used it when I had touch up a script on a UNIX system now and then, but I know some people love it or the improved version vim. 

 

This is a dumbed down preliminary version of a vi replica with a few differences because there is no O/S under it

Rather, I use Forth as the command shell and as a safe place to bomb to, when there's an error.

 

WARNING:  This is only a 40 column editor. It can load files with 80 column records but it doesn't edit them and will mess them up if you try.

I ignored the screen shuttling for 80 columns to get something going quicker and to see if it was practical my own projects. 

40 columns is used for the Wycove Forth editor but it uses 1K block files. 

 

vi is an interesting project for Forth because it is an interpreter controlled system. I re-purpose the Forth interpreter for the job.

This means that vi commands that take a leading numeric argument, need a space after the number and then the command. 

So far I only implemented G  (go to line#) 

 

For better or worse vi99 starts at line 0.  If that's a bad thing let me know and I will change it.

Also to distinguish between command and insert mode I change the text color. Green command mode. Gray insert mode. 

 

Anyway I would appreciate someone else besides me beating it up.

vi99 needs the Editor/Assembler cartridge. 

The zip file has the two binary files and a pdf with instructions for the supported functions.

 

Cut/copy/paste is on the agenda and then a search/replace function. (I can dream a little can't I?) :)

 

vi99.zip

  • Like 9
Link to comment
Share on other sites

Seems to work pretty true to VI, but not the later ease of use features found in VIM.

 

Getting used to the command mode, vs insert mode, vs up case, lower case requires some thought, all though the green / white combo is very effect for letting you know what mode you are in.

 

All and all - really kewl - great job! - tested under classic99.

  • Like 3
Link to comment
Share on other sites

Thanks very much for giving it a spin.

Yes VIM might be a stretch although I do have 8K RAM left. :)

 

I looked it up and VI for i386 was 160Kbytes! 

So for a 16 bit machine that might come in at 80Kbytes or so?

I am doing a bit better with ~13K. (which includes the text labels)  ;) 

 

I am working on getting a copy paste thing going. That will make it somewhat useable.

Not sure how hard to pursue the 80 records on 40 column screen thing.

We shall see...

 

  • Like 1
Link to comment
Share on other sites

18 minutes ago, mizapf said:

I've always been dreaming of a vi for MDOS; it's on my list of projects, but on a very low priority.

 

Yes, and I'm using vim in Linux every day. As I sometimes say, I'm done editing with vi when your super-editor XY is still loading its splash screen.

What does it take to emulate the platform that runs MDOS? 

Is that GENEVE?

Might be able to port this project to give you a partial vi that fits in a smaller footprint.

Link to comment
Share on other sites

The interesting thing would be to use the memory management of GeneveOS to allow for large files to be edited. I'd be interested in the underlying data structures (gap buffer, rope etc.).

 

(Usage of terms: I call the whole OS of the Geneve the GeneveOS, while MDOS is the command line interface for GeneveOS, that is, the shell with its prompt and white letters on blue background. But we don't have a fixed terminology here.)

  • Like 2
Link to comment
Share on other sites

6 hours ago, mizapf said:

The interesting thing would be to use the memory management of GeneveOS to allow for large files to be edited. I'd be interested in the underlying data structures (gap buffer, rope etc.).

 

(Usage of terms: I call the whole OS of the Geneve the GeneveOS, while MDOS is the command line interface for GeneveOS, that is, the shell with its prompt and white letters on blue background. But we don't have a fixed terminology here.)

Yes that's always the challenge with text editors.

vi99 is a bit naïve at the moment. I cheated.

The file data is held as a list of byte counted strings.

The VDP screen RAM is the editing buffer.

So the editing all takes place on the screen in VDP RAM.

The data RAM updates the edited line when you hit enter or <Esc>. :) 

But it is actually just a line by line editor. No line wrapping in this version.

 

It would be quite slow I think on a 64K data segment because of the insertion/deletion without a gap buffer. 

I have plans to make a 64K SAMS segment and see what happens. That could be a disaster. ;)

 

I have considered making a huge gap buffer the size of the screen and save it all back to RAM at some points in the editing.

Might work.

 

 

  • Like 2
Link to comment
Share on other sites

VI99  1.0 

It ain't really vi yet but it can edit files and it has room to grow. 

It's less than 15K bytes as is.

 

Changes:

  • added a yy (yank) command *DIFFERENT*
    • Since there is no highlight function I made yy a bit different that vi or vim. 
    • Lines are placed onto a line stack in VDP RAM. (Max 200 lines)
       
  • added a p command to insert line buffer contents back into buffer
    • hold the p key to put the entire buffer back
    • Beeps when line stack is empty
       
  • Improved seek to line time by 2X with a short ASM word.
  • Fixed deleteln which was erasing past end of buffer (yuk)
  • Fixed default cursor shape for 40 column mode 
  • Exposed COLD command which reboots the entire program
  • Added short help message on opening page
  • G command now starts at line 1, not line zero
     
  • And... last but not least ... added an ls command (alias of dir)  :)
     

image.png.4d8e00a77f4dd3877e6de786fc892d45.png

 

Removed faulty version.  Look down a few posts for the updated version

 

 

 

Edited by TheBF
Removed bad zip file
  • Like 3
Link to comment
Share on other sites

9 hours ago, dhe said:

Thank you again @dhe.

 

This cheat sheet is a lot simpler to read and is showing me a lot of commands that are quite simple to add.

Not sure how many are useful but it gives me somethings to add to this project.

I didn't actually start out wanting to write a vi clone but that's what it turned into.

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Version one of vi99 was built with my faulty E/A5 builder so it would never work on real iron.

I rebuilt with the corrected lib file and it was still flakey on hardware.

I had tried to make a smaller disk library but it is not field tested and was un-reliable.

 

This new version reverts back to my tested handle-based file library and works on my stock console.

It is still only 40 columns so of limited use to normal people, but I have plans to get this thing 

working with 80 column files on the 40 column screen. 

 

 

 

 

VI99-1.2.zip

  • Like 3
Link to comment
Share on other sites

3 hours ago, Vorticon said:

In other works only abnormal people should apply. Good to know 😁

Are you planning for F18A support for 80 columns or just side-scrolling in the 40 column screen? 

Probably correct. :)  Most people don't want a 40 column editor. ?? I could go that way like Wycove Forth but all my code is formatted for 80 columns now. 

 

I can recompile it with 80cols if you want a version like that. It "should" just work. :) 

I won't have time this week but I will try next weekend.

  • Like 2
Link to comment
Share on other sites

On 9/17/2022 at 6:37 AM, Vorticon said:

In other works only abnormal people should apply. Good to know 😁

Are you planning for F18A support for 80 columns or just side-scrolling in the 40 column screen? 

Hi @Vorticon 

I got home earlier than expected so I compiled a version using my 80 column code. 

I can't test this on hardware so let me know if it works ok on a real F18a

 

 

vi9980.zip

  • Like 3
Link to comment
Share on other sites

39 minutes ago, TheBF said:

Hi @Vorticon 

I got home earlier than expected so I compiled a version using my 80 column code. 

I can't test this on hardware so let me know if it works ok on a real F18a

 

 

vi9980.zip 11.13 kB · 0 downloads

Thanks! I am currently out of town for the next couple of weeks, but will give it a shot when I get back.

 

  • Like 2
Link to comment
Share on other sites

5 hours ago, GDMike said:

Sorry, just saw this...I'll give it a whirl as soon as I can get a break too. So crazy busy rt now. 

No worries. I will just keep on making bugs. 

 

(IF debugging is removing bugs, then programming must be where we make bugs)  :) 

  • Haha 1
Link to comment
Share on other sites

I really like the fact, that you are also building in commands like ls.

 

But, I had some problems getting vi99manpage to load initially.

 

As you can see from the listing, the filename comes back as VI99MANPAG - but, that won't load, I had to give it VI99MANPAGE.

 

I think setting expectations would be very helpful, like:

Commands - must be all lower case.

Device Names - like dskX - must be ----

File Names - should be the size they are on disk, and the same case, or does case matter - of course some of this might be Classic99 dependent, and I am using Files in a Directory format.

 

image.png.4e7bfea90b8a9430a8c2ea6917986e04.png

 

 

Link to comment
Share on other sites

Looks like I have trouble counting. 

 

VI99MANPAGE is 11 chars!   :)  I'll get my dunce hat out.

You can use TIDIR and make the file name what ever you want or load it and w dsk1.ti99man  OR whatever you prefer.

 

Commands - must be all lower case.     ok

Device Names - like dskX - must be --- file paths in V1.2 are converted to UPPER case so entering them either case should work now. 

 

File Names - should be the size they are on disk, and the same case, or does case matter - of course some of this might be Classic99 dependent, and I am using Files in a Directory format.

I think Classic99 does a conversion to upper case on file names all the time.

 

 

  • Like 1
Link to comment
Share on other sites

Taking @dhe 's  coaching, I have corrected the error of my ways.

 

V 1.3 addresses the following:

  • corrected the operation of dd and yy. I had to play with vim to understand their operation.
    • dd   deletes lines to copy buffer
    • yy   COPIES lines to copy buffer
      • Neither command can take numeric parameters. (That's for the next version)
         
  • p command now pastes all lines in the copy buffer to the screen. It's not real fast but it works. 
    • The copy buffer is deleted if you edit the file with A,a i or o commands. (I think that is correct operation) 
  • help command now gets the file VIMANPAGE from the disk that vi99 was loaded from. 
    • Keep VIMANPAGE with the editor binaries and it should work 
      • vi99 remembers the DSK# from where it loaded when it starts up
         
  • clear   command has been added to the vi99 shell 
  • bye    is now lower case 
  • Source code for the editor and all the library files is in the zip file for the terminally curious 
     

I think it's better. ??  Needs testing.

Once I get numeric parameters into the editing loop it will look/feel more like a proper sub-set of vi.

Not bad for a 16K binary IMHO. 

 

VI99-1.3.zip

Edited by TheBF
typo
  • Like 4
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, dhe said:

SAD TIMES!

 

LOAD.
 
vi
idanis<esc>yyp
 
locks solid on classic99.
One time it gave me a really kewl light show!

I just replicated it.  Looks like it's something to do with the top line.

OK. Back to the pit.

 

EDIT  1st clue: Does not exhibit the bug when a file is loaded. 

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