Page 1 of 9

New productivity upload: X16 Edit - a text editor

Posted: Sat Aug 29, 2020 7:57 pm
by Stefan



X16 Edit - a text editor




View File






X16 Edit is a text editor for the Commander X16 platform.

Design goals:


  • Use plain text files


  • Store text buffer in banked RAM (512KB to 2 MB) 


  • Handle large text buffers efficiently


  • Simple modeless user interface inspired by GNU Nano


  • Implement basic editing functions well - refrain from making the program too feature-rich


  • Support both ISO and PETSCII modes


The current version of the program is made for X16 ROM version R41. Run with the following command:


  • x16emu -sdcard sdcard.img -prg X16EDIT-x.x.x.PRG -run, where x.x.x is the program version.


X16EDIT-HI.xxx.PRG is assembled to be loaded and run at memory address $6000.

To run ROM version you need to setup a custom ROM image. Please read the attached file romnotes.pdf to learn how to do that.

For instructions on how to use the editor, please read the attached manual.

Source files available at https://github.com/stefan-b-jakobsson/x16-edit

Released under GNU General Public License v 3 or later.

logo.png

manual.pdf

romnotes.pdf






 

New productivity upload: X16 Edit - a text editor

Posted: Tue Apr 06, 2021 2:55 pm
by ZeroByte

This is pretty awesome. One quick bug report: ^V does not do pageDn as documented in the online help - F8 works though.

Is there a plan to support the Home/End  and PgDn/PgUp keys? I use those like CRAZY whenever I'm coding (I imagine most ppl do).

I think having a real editor like this, an assembler, and a few basic tools such as sprite / sfx  editors would be hella-useful to have in the ROM of the system to encourage on-system development.

 


New productivity upload: X16 Edit - a text editor

Posted: Tue Apr 06, 2021 4:23 pm
by rje

I think there is a sprite editor laying around here somewhere...


New productivity upload: X16 Edit - a text editor

Posted: Tue Apr 06, 2021 5:15 pm
by Stefan


2 hours ago, ZeroByte said:




This is pretty awesome. One quick bug report: ^V does not do pageDn as documented in the online help - F8 works though.



Is there a plan to support the Home/End  and PgDn/PgUp keys? I use those like CRAZY whenever I'm coding (I imagine most ppl do).



I think having a real editor like this, an assembler, and a few basic tools such as sprite / sfx  editors would be hella-useful to have in the ROM of the system to encourage on-system development.



 



Thanks.

Ctrl+V works in the emulator for me. I'm using MacOS. I know that the emulator behaves a bit differently on Windows and Linux. We would need to know if it works on the real hardware before changing it.

END is supported for now by Shift+Home. This is because the Kernal ignores the END key.

It seems R39 will include support for custom PS/2 scan code handlers, that let you catch a scan code before it's processed by the Kernal. This could be used to enable support for the real END, PageUp and PageDown keys even though the Kernal ignores those keys.


New productivity upload: X16 Edit - a text editor

Posted: Tue Apr 06, 2021 5:56 pm
by evlthecat

Hello,

I am running the r38 x16 emulator on Debian Linux, and for both the stand alone program, and the rom embedded version, when I try to load a file using ctrl+R the application crashes and x16 reboots.  I only mention this

because when using cc64, and passing a file name to the editor it does open without a problem.

The x16edit version is the v0.3.5.

Have a great day!

UPDATE:

Never mind I am stupid.. F5 works Just fine.  I forgot ctrl+R is mapped to x16 reset.

Will ^R get disabled so it does not happen when editing?


New productivity upload: X16 Edit - a text editor

Posted: Tue Apr 06, 2021 7:04 pm
by Stefan

Hi @evlthecat.

You cannot change the behavior of Ctrl+R in the Windows and Linux emulators from within a program that runs in the emulator. You would need to change the emulator itself.

I hope that the real hardware will not have this problem.

Finding other suitable shortcuts not interfering with any existing Ctrl+key sequence in Windows or Linux is a bit hard. I'm already using most available Ctrl+key combinations! And we would move away farther from GNU Nano.

I don't know if it's a good solution, but it would be possible to support several modifier keys in parallel. That would make it possible to use, for instance, the Win key as an alternative to Ctrl.

Which of the other modifier keys (Alt/Win/AltGr) would have least interference with Windows/Linux and the Kernal? I'm not sure. That requires some research.


New productivity upload: X16 Edit - a text editor

Posted: Wed Apr 07, 2021 5:48 am
by BruceMcF


10 hours ago, Stefan said:




Hi @evlthecat.



You cannot change the behavior of Ctrl+R in the Windows and Linux emulators from within a program that runs in the emulator. You would need to change the emulator itself.



I hope that the real hardware will not have this problem.



Finding other suitable shortcuts not interfering with any existing Ctrl+key sequence in Windows or Linux is a bit hard. I'm already using most available Ctrl+key combinations! And we would move away farther from GNU Nano.



I don't know if it's a good solution, but it would be possible to support several modifier keys in parallel. That would make it possible to use, for instance, the Win key as an alternative to Ctrl.



Which of the other modifier keys (Alt/Win/AltGr) would have least interference with Windows/Linux and the Kernal? I'm not sure. That requires some research.



Another alternative is to support an unused and available meta key as a "sticky control", so the sequence <meta><char> has the effect of <control>+<char>. That is also handy if porting the editor later to headless operation where getting the meta key over the serial port is trickier.


New productivity upload: X16 Edit - a text editor

Posted: Wed Apr 07, 2021 12:32 pm
by ZeroByte

Doesn’t the system API give the ability to intercept these various hot keys and consume them in the application instead?

In the case of ^X obviously this isn’t necessary for the emulator, but it would be nice if it could do this for the printscreen/ pause-Brk  keys as those have X16 functionality planned if the custom key caps are any indication... Right now, both Linux and Windows use PrintScreen as a screenshot hot key, but the X16 seems geared to use that as 40/80 COL mode switch... I’d like it if the emu could override the screenshot function and consume the keystroke so the X16 can use that key as it appears on the X16 kbd.


New productivity upload: X16 Edit - a text editor

Posted: Wed Apr 07, 2021 2:36 pm
by Stefan


8 hours ago, BruceMcF said:




Another alternative is to support an unused and available meta key as a "sticky control", so the sequence <meta><char> has the effect of <control>+<char>. That is also handy if porting the editor later to headless operation where getting the meta key over the serial port is trickier.



X16 Edit supports that kind of function with the ESC key. You may press and release ESC and then any of the command keys.


New productivity upload: X16 Edit - a text editor

Posted: Fri Apr 09, 2021 12:31 pm
by Stefan

Some notes on my progress supporting END, PagUp and PagDn.

From the emulator source code, it's apparent that those keys are discarded. See file keyboard.c, function ps2_scancode_from_SDL_Scancode.

I made the following minimal change to that function, and recompiled the emulator:


case SDL_SCANCODE_END:



return 0x69 | EXTENDED_FLAG;


That emulates PS/2 scan code E069 when the END key is pressed.

The good news is that I could successfully detect the END key in X16 Edit.

Most probably, this will work on the real hardware out of the box.