6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 9:31 pm

All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: Mon Oct 28, 2024 2:45 pm 
Offline

Joined: Tue Sep 26, 2023 11:09 am
Posts: 109
Struggling to get google to help me here. Is anyone aware of a vim-like editor implemented in 6502 assembly? (I just read that the original vim 'stevie' started on an Atari ST, a 68000 I guess?).

Taliforth has a simple line-oriented `ed` and a block editor but I haven't been able to find something with basic cursor movement and insert/overwrite behavior. I could no doubt write something extending 'ed' but i'm sure others have been there before me.

Thanks,
Patrick


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 28, 2024 3:33 pm 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Over in the land of Acorn there is EDIT (or *EDIT) and also an in-house predecessor E (or E40 or E80)

See the thread
"Edit" Source Code
which includes links to source and binaries.
Code:
 here's E for you to try. Unfortunately I can't now remember all of the command set, and unlike edit there's no help. < is load, > is save, /:;@ as laid out on a BBC/S3 keyboard give you the cursor movement diamond; I think 'i' must be insert.

Edit: there is documentation further downthread.


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 28, 2024 4:25 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
pdragon wrote:
Struggling to get google to help me here. Is anyone aware of a vim-like editor implemented in 6502 assembly?

I’ve not heard of one.  Such a thing would be an ambitious programming project, to say the least—vim is more like a mini-operating system than a mere text editor.  :shock:  Even in a higher-level language, it would be a formidable challenge.

Quote:
(I just read that the original vim 'stevie' started on an Atari ST, a 68000 I guess?).

Correct on the 68000.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 28, 2024 4:36 pm 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
BigDumbDinosaur wrote:
pdragon wrote:
Struggling to get google to help me here. Is anyone aware of a vim-like editor implemented in 6502 assembly?

I’ve not heard of one.  Such a thing would be an ambitious programming project, to say the least—vim is more like a mini-operating system than a mere text editor.  :shock:  Even in a higher-level language, it would be a formidable challenge.


Just about any modestly complex editor is pretty ambitious, vim, emacs, Visual Studio, Atom, VS Code, etc. all have their own high level command processing language you can use to automate various tasks.

The core line editing is a bit tricky to handle to say the least, I was trying to get some basic GNU Readline like functionality for Lemon, and even that was driving me nuts.

Hence my gripe about escape sequences... >_<

Edit:
Here's the github of Lemon, where I started some work on ANSI handling and a editline functionality. After reviewing some stuff about the escape sequences (see above gripe) I realized this code could probably be rethought out.

Anyhow, hope this helps: https://github.com/Kelmar/Lemon


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 28, 2024 5:38 pm 
Offline

Joined: Tue Sep 26, 2023 11:09 am
Posts: 109
for sure, i'm imagining <1% of vim: navigating a cursor up/down/left/right x n, insert/delete characters, perhaps search


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 28, 2024 8:00 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
Many years back (like over 3 decades ago) I ported STeVIe to a Transputer based Unix system as it was all C and we had a C compiler for it... I liked it back then. Very simple and easy to use (I was already a VI enthusiast by then anyway) however to port that I had to go down the route of porting, actually writing from scratch as there really wasn't any open source then, all the support like Termcap, then man, more, troff and so on, then MicroEmacs as others were Emacsians ... I lost track of what I wrote but it was the bulk of a usable Unix user-land system for what it was at the time. Sadly, never thought to keep any of it as we never did back then and now it's all lost to landfill somewhere )-:

I did make a start to write a VI like thing for the 6502, but in C - quickly gave up as I had no immediate need, but I did port another editor I wrote to it. The other editor is a nano-like editor - about 1500 lines of C and compiles to about 15KB of 6502 code with cc65. It was an integral part of my Basic interpreter but I was able to make it standalone enough to work.

I ported that editor to my BCPL system - about the same lines of code, but compiles to about 7KB of bytecode.

I still yearn for a VI like thing for my 6502/65816 board though... Maybe one day!

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 29, 2024 3:00 am 
Offline

Joined: Wed Jan 03, 2007 3:53 pm
Posts: 64
Location: Sunny So Cal
I wrote this many years ago, though it's really a shell on another editor that takes vi-like key sequences. I suppose I should look around for where the source went, but you can still play with it.

http://www.floodgap.com/retrotech/cbm/svicc/

_________________
Machine room: http://www.floodgap.com/etc/machines.html


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 29, 2024 2:38 pm 
Offline

Joined: Sun May 13, 2018 5:49 pm
Posts: 255
If you're open to a Forth version, there is Samuel Falvo's VIBE editor in TaliForth's "forth_examples" folder that has vi-ish keybindings. The downside is that it redraws the entire screen so it's rather slow if used over a serial link. I also wrote a full screen editor for Forth screens available here: https://github.com/SamCoVT/ForthSoftware as editor.fs
That version doesn't redraw the entire screen (unless you ask with CTRL-L). Both of those are for editing Forth screens, though, which may not be what you are looking for.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 29, 2024 5:01 pm 
Offline

Joined: Mon Sep 17, 2018 2:39 am
Posts: 138
Hi!
pdragon wrote:
Struggling to get google to help me here. Is anyone aware of a vim-like editor implemented in 6502 assembly? (I just read that the original vim 'stevie' started on an Atari ST, a 68000 I guess?).


Have you seen VI65? From https://singularcrew.hu/vi65/

Source code is at: https://sourceforge.net/p/vi65/code/HEAD/tree/trunk/

If you don't need VI compatibility, there are a lot of simple text editors, my own FastBasic IDE has a small integrated editor.

Have Fun!


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 29, 2024 5:07 pm 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
wow - good find!

Edit: binary size is something between 4k and 8k, depending on platform and display format. Pretty compact!


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 29, 2024 6:39 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
Yuri wrote:
Just about any modestly complex editor is pretty ambitious, vim, emacs, Visual Studio, Atom, VS Code, etc. all have their own high level command processing language you can use to automate various tasks.

The core line editing is a bit tricky to handle to say the least, I was trying to get some basic GNU Readline like functionality for Lemon, and even that was driving me nuts.

Hence my gripe about escape sequences... >_<

In a practical text editor, the functions that interact with the “console” should have no direct relationship to the functions that manipulate the text being edited.

Your editor should be able to “talk” to any console by use of a separate driver that knows how to run the display, as well as how to decode what is coming from the keyboard.  That driver would accept a set of commands that your editor would emit to control the display, such as scroll up, delete a line, position the cursor, etc.  Similarly, your driver would emit ASCII bytes for QWERTY characters typed on the console, along with editor-specific codes that would indicate use of the control keys, e.g., backspace, delete, cursor movement, etc.

With the driver handling the interface between the editor and console, your editor can be focused on the mechanics of text entry.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 29, 2024 7:26 pm 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
BigDumbDinosaur wrote:
...
Your editor should be able to “talk” to any console by use of a separate driver that knows how to run the display, as well as how to decode what is coming from the keyboard. 
...


Correct, but you have to start with a driver of some sort if you don't have one. If you look at the code I was working on, I was working towards trying to keep the ANSI escape stuff isolated from the editor; distilling down the "key presses" into more or less single "command" bytes indicated by the carry flag in the 6502. The idea being that I might want to interface with a PS/2 or custom keyboard later on.

E.g.:
Convert: <esc>[0 ==> KEY_HOME

The actual editor portion then figures out what to do with KEY_HOME, and has little care that the sequence was an ANSI escape or a direct key press on a keyboard.

This will get refined later down the road as I keep working on this of course.

That being said things can get complex regardless of it being ANSI or not depending on how much you need to update the display.

Wozmon for example leaves the characters on my terminal when I hit backspace. (Guessing it did this on the Apple I as well, but I wouldn't know for sure)
If I wanted to "erase" the character I'd have to actually start adding some code to blank that character out, one way or another.

Adding a character in the middle of the line? Now you need to shift multiple characters around; adds up quick.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 7:17 pm 
Offline

Joined: Tue Sep 26, 2023 11:09 am
Posts: 109
Nice! Thanks for the suggestions.


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 02, 2024 9:11 am 
Offline

Joined: Wed Jan 01, 2003 6:32 pm
Posts: 34
You might want to look at my EDIT.COM (https://github.com/Dietrich-L/CPM-65/bl ... L/EDIT.ASM)
The Editor operates with single keystroke Control keys and uses only cursor control commands for the screen output on the terminal. Only basic editing commands are available.
The source code can be adapted to most systems.

Dietrich

_________________
My system: Elektor Junior Computer, GitHub https://github.com/Dietrich-L


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 02, 2024 10:12 am 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
And open source too- great!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC


Who is online

Users browsing this forum: kenames99 and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: