Jump to content
Sign in to follow this  
Stefan

New productivity upload: X16 Edit - a text editor

Recommended Posts

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

Tested with emulator version r38. Run with the following command:

  • x16emu -sdcard sdcard.img -prg X16EDIT-x.x.x.PRG -run

where x.x.x is the program version.

You can also run the program with the "Try it now" button. There is, however, no attached disk in the online emulator, and consequently you cannot save or open files. Also, some of the Ctrl+key sequences are not working in the online emulator. To fully test the program you still need to download and run it locally.

Please read the attached file romnotes.pdf if you want to try the ROM version.

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

Released under GNU General Public License v 3 or later.

 

 

 

logo.png

 

romnotes.pdf

 

 

 

manual.pdf


 

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

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.

 

  • Like 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

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?

Edited by evlthecat

Share this post


Link to post
Share on other sites

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.

  • Thanks 1

Share this post


Link to post
Share on other sites
Posted (edited)
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.

Edited by BruceMcF

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites
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.

  • Thanks 1

Share this post


Link to post
Share on other sites

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.

 

  • Like 3

Share this post


Link to post
Share on other sites

I've now made a pull request to include support in the emulator for Delete, Insert, End, PgUp and PgDn keys.

I've also updated X16 Edit to support those keys. This code works only if run in the current master branch of the emulator and Kernal, i.e. what will become R39.

  • Like 1

Share this post


Link to post
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.

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

Please review our Terms of Use