External communication with the X16 (UART, NIC, FlashAir?!)

Chat about anything CX16 related that doesn't fit elsewhere
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

External communication with the X16 (UART, NIC, FlashAir?!)

Post by voidstar »

Many of us are still waiting for a hardware solution to communicate remotely with an X16. This is one of those thing where (at least in my opinion) it is harder for an emulator to be used to help develop. So it is great more folks are getting their hands on hardware, to start tinkering with ideas for peripherals.

External communication isn't just about web-surfing on an 8-bit, such as with an on-system web browser or hosting a server. Personally I don't see the need to even try to render any portion of a modern web page in 640x400. Rather, the interest here is for two main motivations:

(1) As a way to more easily "push" new software onto the system or do updates on versions of existing software. As lazy as it sounds, shuffling files manually across an SD card isn't fun (and it's also arguably error prone as each time removing/inserting the SD card is wear and tear on the equipment; but also a small things like you lose your CWD when you remove the SD).

(2) The joy of using an 8-bit for as a client to IRC and visiting the BBS'ing experience. There are a few "authentic" original BBSs still hosted on their original systems - many BBS's are really just a special form of telnet that happen to use ANSI codes and accommodate 80x25 screens.

NOTE: while a classic 8-bit, or the X16 itself, could host a BBS - it would probably be limited to one or very few users at the same time -- that's generally how you can tell if you are connecting to an "authentic" BBS: if you get a "busy" signal or it says some user is already connected. And as silly as a limitation as that sounds, philosophically I think it is a defining aspect of pre-internet era - that of limited resources, forcing for those who couldn't get a connection to go do something else (and that is also why BBS's had daily usage limits for users in minutes - so they couldn't hog the whole system for the entire day; a concept that I wish certain social media sites would adopt; I was a BBS SysOp for many years).

NOTE: One of my favorite still-active BBS's is aBSiNTHE BBS (which is ran on an Amiga and is quite a custom piece of software). One quaint thing about it is as you log off, you have an option to add a paragraph or portion to a story. We did things like that in middle school, we'd pass a journal around and people add a sentence or two, and (usually) you end up with a comical story. It's a special aspect that only a BBS can offer, as modern 24/7 social media has no concept of "logging off" or ending your session for the day.


Anyhow, some notes in where we're at on external communication capability:

#1) Onboard user-port: VIA #2 now has a NMI option. This should be more feasible to port over the RS232 code, such as what is located here: (or the rs232_userport.s)
https://github.com/mist64/ccgmsterm/blo ... 2_up9600.s

The X16 Technical Reference notes on the VIA port-mapped addresses is described here:
https://github.com/X16Community/x16-doc ... ramming.md

While it won't be the most glorious high speed connection, the point is that it is very minimalistic: no additional hardware and should be able to communicate across using just 3-wires. And you can communicate with other ancient systems, including even PDP-8's and Altair's.


#2) Expansion board UART: This will come eventually. In a nutshell, UARTs offer "hardware accelerated" buffering, even if just a few bytes it makes a big difference in offloading the CPU to handle other things while TX/RX'ing serial data. The original IBM PC 5150 had no onboard serial solution, it depended on the IBM serial card with an 8250, achieving only up to 9600 baud.


#3) NIC solution: Onboard TCP/IP will be a challenge. There is an ip65 github repo (associated with cc65), but looks like it hasn't been touched since 2012.
https://cc65.github.io/ip65/

Note that M. Brutman has made a suite of TCP/IP client utilities for 16-bit x86, most fitting within 64K. While it is x86 code, point is that it shows an 8-bit up to the task. He's still active and might be a good source of ideas and info on implementing this on a resource-limited system:
https://www.brutman.com/mTCP/
These are great tools for on-system telnet, ftp (client and server), sync'ing time across internet (SNTP), etc.

But obviously that needs some hardware support to go with it, and the mTCP suite does depend on routines from both MS-DOS (ilke for file i/o) and a 3COM driver.






#4) I've started experimenting with the Toshiba FlashAir WiFi SD card on the X16.

I don't yet recommend it. First note: Avoid the 8GB (W-02) version, I can't find any firmware update software for that. That version did let me read the SD card files over WiFi (from its own built in browser-interface), but not write (and only using a limited web interface). Per the article below, the newer W-03 and W-04 models can be firmware updated for more seamless file-explorer type access:

https://mattshub.com/blogs/blog/flashair-sd-card

I'm waiting for my 16GB FlashAir W-04 to show up. Another issue with the W-02 8GB version was it used 8.3 length filenames - so hopefully that won't be the case on the W-04 version. (i.e. maybe it was an assumption that the web interface on the W-02 had, but across a proper file explorer long names will be supported? TBD).


I'm going to skip the EZ SHARE SD card, as so far I haven't seen any review that suggest it has a file explorer type interface. But I'll report more on the FlashAir once I'm able to test it further. These devices use the power off SD pins to host their own WiFi SSD. Toshiba and other companies have stopped making them for now, so they can be hard to find.




Eventually an expansion card with a UART will be more widely available, but will still require its own software API (maybe a ROM slot can be reserved for that API once the h/w becomes more formalized - that's essentially how the Deluxe RS232 on the ColorComputer worked, it had some onboard ROM API to help software do TX/RX of bytes, using a 16450 UART I think).
Last edited by voidstar on Sat Jan 20, 2024 8:07 am, edited 1 time in total.
DragWx
Posts: 342
Joined: Tue Mar 07, 2023 9:07 pm

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by DragWx »

I think MIDI would be a great UART-related capability to add to the X16, if you'd like to add that to the list. :D

Plus, MIDI has a kind of eccentricity to it that would play well with our kind of eccentricity. :P
BruceRMcF
Posts: 224
Joined: Sat Jan 07, 2023 10:33 pm

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by BruceRMcF »

I'd note as well that the spare pins from VIA#1 being on a header also allows a "slotless" UART using an SPI UART chip like the MAX3100. It also has an 8-deep FIFO for input, allowing for higher baud rates. You need a +5v/GND power tap, but that is available on the nearby Controller #3/#4 header.

It would be possible to have one providing an +5v TTL UART header for a USB/UART cable, for plugging into a laptop, one providing a +/-12V RS-232C port for the longer run to a desktop somewhere in the house/apt, and one with a WiFi net connection with an MCU (eg, ESP32) running a UART/Internet bridge, and none of the three options would require using a slot.
mgkaiser
Posts: 60
Joined: Sat Dec 02, 2023 6:49 pm

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by mgkaiser »

There are numerous ethernet boards with SPI interfaces. Most have internal buffering. Most are under $15. It should be easy to drive SPI from the shift register on VIA2. Send some commands to the board to tell it what port to listen on and packets will "appear" in the buffer and an interrupt will trigger. Read the data out of the buffer, continue. Just so long as you empty the buffer fast enough so the TCP handshake doesn't fail it will work. So basically the NIC is a small board with the SPI ethernet adapter attached, maybe some level shifters, and a header that matches the header for VIA2 so you can attach a ribbon cable to it.
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by voidstar »

For reference, some ISR and VIA handling routines notes for the X16 is available here:

viewtopic.php?t=6890

I won't get time to look more into this until later in the year (maybe summer), just due to a few other projects I need to concentrate on for a while. But something that can interface with existing WiModem232 type devices (9-pin serial) would be fantastic!

Most here are well familiar with all this. But here is a video I did about serial communication across a couple other 1980 systems:
https://www.youtube.com/watch?v=iD3fVowBuMk


Updating files on the SD will still require some kind of client software on the X16 system (on the CoCo system they have a "DriveWire" solution where you use a null modem cable to essentially remote connect to that 8-bit sytem). An RS232 solution lets you use existing terminal software, that would have xmodem/ymodem protocols, etc. Otherwise you need to dev your own new file-data exchange protocol.


There is a lot of interest in doing this cross-communication from a modern day laptop (such as do your dev in emulator, then sling the result over to h/w). Though my interest is still some form of interoperability with older systems. Note that FujiNet is a project interested in that goal of being able to have a form of "networked experience" across vintage systems. The earliest microcomputer example of this (of heterogeneous systems doing gameplay over RS232) that I've found is the game COMMBAT (a play on "Communication" and "Combat"), by Scott Adams Adventure c. 1982 (it is described in this publication: https://archive.org/details/adventure-i ... 2/mode/2up ) It is a tape-based game that has multi-player across a few systems. It's not a particularly great game, but it shows the concept (of a piece of software maintaining the game-state, while also maintaining the Tx/Rx of data to keep that state in sync across two different types of systems - an Apple and TRS-80 in that case).
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by TomXP411 »

I've also done some SPI code with my 65C02 developer board, and it worked pretty well going to an Arduino. It might be worth getting back to that, in order to flesh those ideas out further.

In the end, I think we're going to get Kevin's UART card, built in to the motherboard on the Gen-2 systems. So my efforts will be focused on working with the 16550, once I have one in hand to test with.

My personal goals involve developing an ANSI terminal and a BBS interface to this forum. I also want to build a simple file server, to make it easy to move files back and forth between the X16 and a PC.

All of that should be pretty easy to do with an ESP based "WiFi modem" and UART, although we can use any byte-oriented interface, as long as we adequately abstract the transfer layer (ie: send_byte() and read_byte() fuctions.)
User avatar
ahenry3068
Posts: 1136
Joined: Tue Apr 04, 2023 9:57 pm

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by ahenry3068 »

TomXP411 wrote: Sun Jan 21, 2024 12:49 am
My personal goals involve developing an ANSI terminal and a BBS interface to this forum. I also want to build a simple file server, to make it easy to move files back and forth between the X16 and a PC.
I've been thinking of this myself. Are you planning on doing true ANSI emulation on the X16, or sending PETSCII Type control codes from the server side to the X16 ? ...

An actual ANSI/vt100 terminal would be really useful for Random BBS's or Telnet servers. But for this Forum and Native file download it might be better to send control characters the X16 already understands.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by TomXP411 »

ahenry3068 wrote: Sun Jan 21, 2024 1:59 am
TomXP411 wrote: Sun Jan 21, 2024 12:49 am
My personal goals involve developing an ANSI terminal and a BBS interface to this forum. I also want to build a simple file server, to make it easy to move files back and forth between the X16 and a PC.
I've been thinking of this myself. Are you planning on doing true ANSI emulation on the X16, or sending PETSCII Type control codes from the server side to the X16 ? ...

An actual ANSI/vt100 terminal would be really useful for Random BBS's or Telnet servers. But for this Forum and Native file download it might be better to send control characters the X16 already understands.
It will be ANSI all the way. PETSCII has some limitations, and there are several control sequences that simply don't exist in PETSCII - specifically, there is no PETSCII sequence for direct cursor movement or for saving and restoring the cursor to the saved position.

Sticking with ANSI also means that people can call in with other systems: Amiga, Atari ST, TRS-80, Apple II. I'm not picky. =)
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by voidstar »

Quick note, I've now tried the FlashAir W-04.

The W-04 version DOES have WebDAV support, which means you can use Windows File Explorer to navigate the SD folder over WiFi - but it is still read-only. You can copy files off in bulk, but not add files.

There are some notes here how the W-02 and W-03 version might be able to support an upload/write mode:
https://mattshub.com/blogs/blog/flashair-sd-card
(after some custom config files and manual IP setup)

And this site (near the very bottom) has an interesting photo the inside of one of these FlashAir WiFi cards. Pretty neat tech for 2015.
https://hackaday.io/project/5558-revers ... fi-sd-card

Have a W-03 on the way to try out.
Last edited by voidstar on Sat Feb 10, 2024 9:50 am, edited 2 times in total.
fishhack66
Posts: 2
Joined: Sun Jan 07, 2024 12:36 pm

Re: External communication with the X16 (UART, NIC, FlashAir?!)

Post by fishhack66 »

DragWx wrote: Sat Jan 20, 2024 5:22 am I think MIDI would be a great UART-related capability to add to the X16, if you'd like to add that to the list. :D

Plus, MIDI has a kind of eccentricity to it that would play well with our kind of eccentricity. :P
I second that emotion. :)
Post Reply