vim-like editor in 6502 assembly?
vim-like editor in 6502 assembly?
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
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
Re: vim-like editor in 6502 assembly?
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.
Edit: there is documentation further downthread.
See the thread
"Edit" Source Code
which includes links to source and binaries.
Code: Select all
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.
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: vim-like editor in 6502 assembly?
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.
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!
Re: vim-like editor in 6502 assembly?
BigDumbDinosaur wrote:
pdragon wrote:
Struggling to get google to help me here. Is anyone aware of a vim-like editor implemented in 6502 assembly?
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
Re: vim-like editor in 6502 assembly?
for sure, i'm imagining <1% of vim: navigating a cursor up/down/left/right x n, insert/delete characters, perhaps search
Re: vim-like editor in 6502 assembly?
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
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/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
-
6502inside
- Posts: 101
- Joined: 03 Jan 2007
- Location: Sunny So Cal
- Contact:
Re: vim-like editor in 6502 assembly?
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/
http://www.floodgap.com/retrotech/cbm/svicc/
Machine room: http://www.floodgap.com/etc/machines.html
Re: vim-like editor in 6502 assembly?
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.
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.
Re: vim-like editor in 6502 assembly?
Hi!
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!
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?).
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!
Re: vim-like editor in 6502 assembly?
wow - good find!
Edit: binary size is something between 4k and 8k, depending on platform and display format. Pretty compact!
Edit: binary size is something between 4k and 8k, depending on platform and display format. Pretty compact!
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: vim-like editor in 6502 assembly?
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... >_<
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!
Re: vim-like editor in 6502 assembly?
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.
...
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.
...
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.
Re: vim-like editor in 6502 assembly?
Nice! Thanks for the suggestions.
Re: vim-like editor in 6502 assembly?
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
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
Re: vim-like editor in 6502 assembly?
And open source too- great!