BASTERM Serial Terminal in BASIC (BASLOAD)

Post Reply
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

BASTERM Serial Terminal in BASIC (BASLOAD)

Post by voidstar »

A very bare-bones Serial Card terminal written using BASLOAD (not even a flashing cursor!). Be like the very early 1980s, late 1970s experience.

The BASLOAD.PRG defaults to the IO7 LOW Serial jumper that most of the cards will be set to. That is, this is using the actual serial (RS232) side of the card (which needs a cable and WiModem232 or similar), not using the higher speed network part of the code.

F1 to toggle local echo, F2/F3 to adjust baud rate.

This should work "out of the box" for most people. I set the defaults to be suitable for
particlesbbs.dyndns.org:6400
citadel64.thejlab.com:6400
(and other Commodore-based BBS's)

These Commodore based BBS use PETSCII color codes, so you can use this BASTERM and still get a bit of color during the connection. However, still has a practical limited of 2400 baud in this BASIC interpreted implementation (VTERM in C I have going up to 57600 in ASCII-only mode, ROMTERM with ANSI emulation needs 4800 during screen scrolling).

To adjust settings, see the top of the BASLOAD .BASL file if using a different port (and use the built-in ROM BASLOAD command to recompile to tokenized BASIC). For example, if prefer to typically connect to more IBM/ASCII systems, may startup using ISO-mode CHR$($8F) instead of PETSCII-mode.

Mainly a rough example to show how easy it is to interface with the serial card.
Attachments
basterm_citadel64_menu.jpg
basterm_citadel64_menu.jpg (79.69 KiB) Viewed 2839 times
basterm_citadel64.jpg
basterm_citadel64.jpg (89.47 KiB) Viewed 2839 times
BASTERMV1.BASL.TXT
(3.96 KiB) Downloaded 141 times
BASTERM.PRG
(1.3 KiB) Downloaded 128 times
Last edited by voidstar on Wed Jun 26, 2024 3:55 pm, edited 1 time in total.
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by voidstar »

Here is a VERSION2 with a few more features.

This version:
- F1 is now a HELP reminder (new keys to toggle ISO vs PETSCII mode, and clear the screen locally)
- On startup, will ask for IO port (instead of hard-coded)
- Replaced (serial) input handling with machine code to do a system call (but doesn't really improve performance; could do 4800 baud when not scrolling screen, but overall still limited to 2400 baud)

The original version is simpler and might be a better baseline example just to see the flow of things, so keeping that one in the original post as a reference.
Attachments
BASTERMV2.PRG
(2.31 KiB) Downloaded 126 times
BASTERMV2.BASL.TXT
(7.11 KiB) Downloaded 134 times
User avatar
schristis
Posts: 65
Joined: Sat Apr 08, 2023 6:28 am

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by schristis »

I remember the VT320 serial terminals at the library in the 80s and 90s, with their amber text monitors. All computers have, or should have, a serial terminal. It's such a basic feature that's often underrated.

I'm still waiting for my serial cable to be delivered by mail so I can use it on the X16 and also with my network card. I also use PuTTY in Windows to connect to my VGA32 (ESP32), which is set up as a serial terminal.

This is a nice program that the X16 should have. For my own use (as BASTERM in BASIC), I personalized it by changing the color, modifying the menu a bit, and adding a non-blinking cursor. Now, I'm waiting to test it with my ESP32 serial terminal.

Best regards Shaun
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by voidstar »

He (Peri) clarified in one of the comment responses that he "un-nulled it" since he thinks he inadvertently used a null-modem cable (they often aren't clearly marked, I started using a label-maker to mark them). And that was my experience as well, a regular serial cable was what worked.


In VTERM (which I did in C for the X16), I had a nice color-flashing cursor. But to reach a stable 57600, I had to ditch that. Even if the job of packing individual bits into a byte is delegated to hardware (PIA/VIA or UART), there is still only so much the local processor can do until dropped characters happen (even with flow control). Personally it's why I wouldn't just leave the local terminal software (ROMTERM or whatever) at the highest baud setting - yes that will get you throttled to the highest speed that the BBS or remote connection can do, but that might end up faster than the terminal software can process the bytes (again, even with flow control enabled - as I'm often suspect that the flow control is ever implemented correctly, but also just that eventually there is still a breaking point to those little buffers; especially in the case of the local processor having to do complex terminal-emulation handling).

And schristis is right, serial communication has been a kind of "staple capability" of computer systems since SAGE c. 1958. I did a video of using the Color Computer for both "pure bit banged" and UART-assisted serial communication - it took several years into the CoCo systems life to understand it well enough, for a terminal program (Twilight) to be implemented so efficiently that it could bit-bang at 9600 baud (i.e. "native" capability and not dependent on a UART).
https://www.youtube.com/watch?v=iD3fVowBuMk

We may still get there with the 6522 and user-port on the X16. Kevin has shown it doing serial-communication for a printer, and interacting with a modem is a similar principle.
Last edited by voidstar on Sat Jul 20, 2024 6:45 pm, edited 1 time in total.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by TomXP411 »

voidstar wrote: Fri Jul 19, 2024 4:46 am He (Peri) clarified in one of the comment responses that he "un-nulled it" since he thinks he inadvertently used a null-modem cable (they often aren't clearly marked, I started using a label-maker to mark them). And that was my experience as well, a regular serial cable was what worked.
OOOh.... I watch them early enough that I don't get the comments. I'll go back and modify my reply.
User avatar
schristis
Posts: 65
Joined: Sat Apr 08, 2023 6:28 am

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by schristis »

Did any1 FAX Peri lol.....
I Watched your video, liked & subscribed...

Yes, for my own use, I put in 2 lines of BASIC to have a courser...
I wont put it here.

I'll leave a link here, to general discussion...
so if you want to look at it you can...

Just 2 short lines of BASIC....

viewtopic.php?t=7858
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by voidstar »

Neat! Yea that's exactly why I tried to keep the earlier version simple - so people could expand or add features over time (like a status bar at the bottom, maybe even a scroll back buffer). It's still limited what features we can do in BASIC even at 8MHz, but it's neat now that we can start talking to the outside world.

I think we could do a simple file transfer deal. Even if not compressed. That was the charm of the old days - you could start a task (like a file transfer) and then go grab a coffee or ponder about other things, read the newspaper or a novel, etc. Now everyone is operating like a highly pipelined processor, doing so many things at once, we rarely get time to just ponder and think :| I see my daughter running two videos at 1.5X and a podcast - I can't multitask like that. I'm just an old-gen model single processor brain :P
User avatar
ahenry3068
Posts: 1136
Joined: Tue Apr 04, 2023 9:57 pm

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by ahenry3068 »

voidstar wrote: Sat Jul 20, 2024 7:06 pm Neat! Yea that's exactly why I tried to keep the earlier version simple - so people could expand or add features over time (like a status bar at the bottom, maybe even a scroll back buffer). It's still limited what features we can do in BASIC even at 8MHz, but it's neat now that we can start talking to the outside world.

I think we could do a simple file transfer deal. Even if not compressed. That was the charm of the old days - you could start a task (like a file transfer) and then go grab a coffee or ponder about other things, read the newspaper or a novel, etc. Now everyone is operating like a highly pipelined processor, doing so many things at once, we rarely get time to just ponder and think :| I see my daughter running two videos at 1.5X and a podcast - I can't multitask like that. I'm just an old-gen model single processor brain :P
Eventually I think we need xmodem &/or zmodem capability. Not sure I'm ready to implement that myself yet but I have been looking at the xmodem & zmodem specifications, Neither appears to be that complex a protocol....
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by voidstar »

Here is an alternative to Version1 (V1A) that adds support for the WiFi ESP32 ports (9FE0 by default).

You can do BeyondCompare with the original version to mull over the subtle differences (just a few additions really).

It's a little more complicated to use -
1) you have to set the terminal to the internally configured baud rate in the ESP32 firmware (ZiModem), and if you've never used it or haven't used it in awhile you might not remember what that is. In worse case, try each baud rate and issue "AT" a couple times and see if OK responds when you eventually hit the pre-configured baud rate. In my case I had saved the settings when the modem was at 115200 so I always know I have to F3 over to that baud rate first. If you get "garbage characters" at least things are working, just not yet at the stored baud rate.
2) then you have to type "atb2400" to dial the baud rate back down to 2400. Without flow control, that's the best this BASIC terminal is going to do across WiFi. I even tried 4800 and 3600, and just issuing "ATI" shows lost characters already.
3) Then set the terminal baud rate back to 2400 (F3 a few times)

You can then save those settings and set this BASLOAD code to always start at 2400, so you don't have to do the above all the time. On other WiModems, you can adjust settings to say whether DTR is required or not (AT&C usually, or related to that - maybe C1 or C0) but most modems normally do require that to be set (like ZiModem in this ESP32).
Attachments
BASTERMV1A.BASL.TXT
(4.09 KiB) Downloaded 128 times
User avatar
schristis
Posts: 65
Joined: Sat Apr 08, 2023 6:28 am

Re: BASTERM Serial Terminal in BASIC (BASLOAD)

Post by schristis »

I'm Just playing with this BASTERM
I've added a status bar.... Tyring to give it a more of ... Well... Terminal look...

I put it in General discussion again

Best Regards
Shaun
Post Reply