Open zomgugoff opened 3 months ago
Armm - I probably never got to implementing the arrow keys in the code. (PR's are welcomed 😄 )
Arrow keys will need to be mapped to ASCII codes - so an alternative may be to send the appropriate ascii code by using CTRL+x. Where (A-Z) will mapped to ascci codes 0 to 26
You may find some of the CTRL+.. keys will work (If I recall right, the keys CTRL+H, CTRL+J, CTRL+K, CTRL+M might work - i guess it might depend on whats echoed' back)
The CTRL combos you mentioned are apparently used by Synchronet, so I can't confirm they work. Unfortunately, I'm what might be called an 'entry-level Python scrub' - I don't speak C. I'm definately a hardware guy.
Fair enough - although I might say, if this Web Developer can design hardware, well - just saying... 😉
Nontheless, arrow keys would still need to be converted to an ASCII code or ASCII code sequence.
The TERM program has been tweaked by me, but its not my application. It was developed 'Oduvaldo Pavan Junior' . I tweaked it a bit to work with the serial interfaces for the RC2014 platform. (https://github.com/ducasp/MSX-Development/tree/master/UNAPI/TELNET)
There does appear to be mapping of the arrow keys, to ESC codes:
#define CURSOR_UP "\x1b[A"
#define CURSOR_DOWN "\x1b[B"
#define CURSOR_FORWARD "\x1b[C"
#define CURSOR_BACKWARD "\x1b[D"
ucTxData = Inkey();
// A key has been hit?
if (ucTxData) {
...
} else if (ucTxData == 28) // right?
TxUnsafeData(CURSOR_FORWARD, 3);
else if (ucTxData == 29) // left?
TxUnsafeData(CURSOR_BACKWARD, 3);
else if (ucTxData == 30) // up?
TxUnsafeData(CURSOR_UP, 3);
else if (ucTxData == 31) // down?
TxUnsafeData(CURSOR_DOWN, 3);
else
// Send the byte directly
TxByte(ucTxData);
\x1b means the ASCII code $1B - which is the ESCAPE character. So I assume its not compatible with your BBSs
Please note, Sorry, but I have not tested or tried to confirm specifically though
The code in the repo you linked appears to be very different in the Telnet.c/.h files where the arrow key codes are defined and checked. Also, there is no ansi_codes.h file at all.
I did some testing connecting to a DOSBox session running Telix on a PC. Arrow keys are working when sent from DOSBox - the cursor moves around in term.com. But the other way, nothing is changing. But, watching the spinning cursor on a Synchronet BBS, pressing or holding the arrow keys causes the character to change to the next in the sequence, but not trigger an 'unknown command'.
Hitting F1 to start a download, then cancelling causes the ANSI codes to stop working properly. The spinning curosr starts drawing as sets of characters on the screen. Pressing the arrow keys while this is happening with the Japanese ROM, I was able to see 3 distinct characters drawn. Up and down drew up and down arrow glyphs, left caused something that looked like a Japanese character but I couldn't find it in the character tables, and right was indistinguishable from the spinning cursor characters.
I would hazzard to guess that the bytes are malformed, or the ANSI codes are not actually being sent, and instead, the MSX-native codes are being sent. Maybe termination? If I could find a terminal that could provide binary output from the incoming connection, I would be able to tell what exactly is being sent. Trying ASCII download mode on Telix provided a file but I couldn't find any control codes in the output with a hex editor.
The code in the repo you linked appears to be very different in the Telnet.c/.h files where the arrow key codes are defined and checked. Also, there is no ansi_codes.h file at all.
Its been a while, thing might have drifted, or I may have sourced from other places and just 'worked' around issues. This application probably needs a lot more attention than i am currently in a position to commit to.
I would hazzard to guess that the bytes are malformed, or the ANSI codes are not actually being sent, and instead, the MSX-native codes are being sent.
Very possible something like that. From what i see in the code, the current solution is sending <ESC>A
, <ESC>B
, <ESC>C
and <ESC>D
for the arrow keys. Once the correct codes are identified, perhaps all we need to do is change those strings. Hopefully its as simple as that
The actual escape sequences as they are listed in ansi_codes.h are the same as I found in the Telnet.h on the repo, but they are defined differently.
const char ucCursor_Up[] = "\x1b[A";
const char ucCursor_Down[] = "\x1b[B";
const char ucCursor_Forward[] = "\x1b[C";
const char ucCursor_Backward[] = "\x1b[D";
Based on what I looked up, I wouldn't think it would matter if the codes are defined as you have them, or as I'm seeing on that repo. But, I don't know all of the rules for C. There are probably several reasons why the codes could be transmitted incorrectly.
Hmm. I need to look closer
But I may be missing the square bracket character .
It makes more sense thinking about it. ANSI sequences are usually escape char then square bracket , then the code sequence
On Sat, Sep 7, 2024, 10:36 AM zomgugoff @.***> wrote:
The actual escape sequences as they are listed in ansi_codes.h are the same as I found in the Telnet.h on the repo, but they are defined differently.
const char ucCursor_Up[] = "\x1b[A"; const char ucCursor_Down[] = "\x1b[B"; const char ucCursor_Forward[] = "\x1b[C"; const char ucCursor_Backward[] = "\x1b[D";
Based on what I looked up, I wouldn't think it would matter if the codes are defined as you have them, or as I'm seeing on that repo. But, I don't know all of the rules for C. There are probably several reasons why the codes could be transmitted incorrectly.
— Reply to this email directly, view it on GitHub https://github.com/vipoo/yellow-msx-series-for-rc2014/issues/13#issuecomment-2334970206, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADIL7S5CBHDFEPST2L54PLZVJDBVAVCNFSM6AAAAABM2SU3QKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUHE3TAMRQGY . You are receiving this because you commented.Message ID: @.***>
#define CURSOR_FORWARD "\x1b[C"
It's there.
Oh right - then I am still currently at a loss -- as that should translate to
Arrow keys do not seem to work on BBSs I've connected to using term.com. I wonder if the codes it's sending are not what Synchronet or Mystic is expecting.