/smdt

Sega Megadrive/Genesis terminal emulator, telnet and IRC client

Primary LanguageCMIT LicenseMIT

SMD Terminal emulator, Telnet and IRC client v0.30+

A terminal emulator, telnet and IRC client for the Sega Mega Drive/Genesis with support for keyboards and RS-232 communication.
Screenshot of the telnet client Screenshot of the IRC client Screenshot of the terminal emulator showing nano Screenshot of a debugging utility to inspect streams Screenshot of the telnet client in 80 column + 8 colour mode Screenshot of the terminal emulator

Table of Contents

Disclaimer

Warning

Do note that the MD is a 5 volt system! That means you should take care to not connect any random serial device directly to the MD (Such as a PC).
Use a "voltage translator" such as the max3232 between your MD and remote device to translate the voltage levels.
Make sure you understand my ramble down under the "Device" section to hook up external devices correctly!
I (smds) will not take any responsibilities for any failure to read and understand the above warning.


Thanks to

b1tsh1ft3r - Testing, improvement ideas and RetroLink/xPico support
RKT - For creating a 4x8 extended ASCII font tileset
Stef - For creating SGDK
Sik - For creating the website Plutiedev with valuable information regarding the MD

Building SMDTC from source

This part needs to be expanded, for now it assumes you are familiar with SGDK and how to use it.

To build SMDTC from source you will need SGDK version 1.80 (newer versions untested but will probably work as SMDTC mostly only uses macros and basic functions from SGDK)
The SGDK library must be rebuilt with the flags HALT_Z80_ON_IO and HALT_Z80_ON_DMA set to 0 in config.h to make sure the z80 CPU is never getting its bus back.

Running SMDTC

SMDTC is made to run on the original Mega Drive / Genesis hardware;
Easiest way to run SMDTC on your system is by transferring the binary file smdt_vX.YY.Z.bin to a flashcart.

You can also run SMDTC in a Mega Drive / Genesis emulator and easily check it out; Do mind that most emulators do not provide any way to actually connect any external serial devices, so no network support is possible while running in an emulator.

I highly recommend the emulator BlastEm since it supports the Sega Saturn keyboard.
Other emulators may have issues running SMDTC and it is unlikely they will have any keyboard support.

Required hardware

  1. A PS/2 keyboard or a Sega Saturn keyboard (not strictly required but preferred).
  2. A 5 volt RS-232 serial connection or an xPico/xPort module.
  3. A Mega Drive or Genesis and a way to run roms on it.

RetroLink network cartridge as an alternative network adapter is being worked on.

Devices

SMDTC has a device manager which can autodetect if a device is present and where it is plugged in.
Device detection is only done on bootup, no plug & play support (yet).

A total of 2 PS/2 devices and 1 UART device can potentially be connected to a single MD controller port. However, beware the power draw may exceed what the MD can supply!

When a keyboard is connected and detected a 'K' icon will be visible in the status bar.
A fallback joypad device will be activated if SMDTC fails to find a keyboard or when a keyboard is plugged into PORT 2, allowing the use of a regular joypad.

All detected devices can be viewed in the "Connected devices" list (Quick menu -> Mega Drive settings -> Connected devices)

Note

SMDTC is limited when it comes to detecting the presence of a serial connection on the built in UART.
By default SMDTC will listen for incoming connections and attempt to find serial devices on PORT 2 UART.
This setting can be changed in the "Select serial port" menu (Quick menu -> Mega Drive settings -> Select serial port)
Do not forget to save your changes! (Quick menu -> Reset -> Save config to sram)


List of autodetected devices

PS/2 Keyboard.
Sega Saturn keyboard.
Sega 3/6 button joypad.
xPico module connected to built in UART (May require you to set the correct serial port as described above)
RetroLink network adapter cartridge (Currently being worked on, support may be iffy)

How to wire up a PS/2 keyboard

For PS/2 devices (a keyboard or mouse) SMDTC has two ways to connect one:

Example keyboard wiring (1):
MD port pin 1 = PS/2 clock pin 5
MD port pin 2 = PS/2 data pin 1
MD port pin 5 = PS/2 VCC pin 4
MD port pin 8 = PS/2 GND pin 3

Example keyboard wiring (2):
MD port pin 3 = PS/2 clock pin 5
MD port pin 4 = PS/2 data pin 1
MD port pin 5 = PS/2 VCC pin 4
MD port pin 8 = PS/2 GND pin 3

See the pin configuration lists below for pinouts of the MD controller ports and PS/2 keyboard.

Pin configuration of the MD controller ports

MD port pin 1 = PS/2 device 1 clock (CLK1)
MD port pin 2 = PS/2 device 1 data (DATA1)
MD port pin 3 = PS/2 device 2 clock (CLK2)
MD port pin 4 = PS/2 device 2 data (DATA2)
MD port pin 5 = VCC (+5V)
MD port pin 6 = Serial TX
MD port pin 7 = Reserved (CP3)
MD port pin 8 = GND
MD port pin 9 = Serial RX

PS/2 pin reference

PS/2 pin 1 = Data
PS/2 pin 3 = GND
PS/2 pin 4 = VCC
PS/2 pin 5 = Clock

MD UART pin reference

MD port pin 5 = VCC
MD port pin 6 = TX
MD port pin 8 = GND
MD port pin 9 = RX

Connected device list

P1:0 = Port 1 @ pin 1+2
P1:1 = Port 1 @ pin 3+4
P1:S = Port 1 UART
P1:D = Port 1 Parallel+UART Mode
P2:0 = Port 2 @ pin 1+2
P2:1 = Port 2 @ pin 3+4
P2:S = Port 2 UART
P2:D = Port 2 Parallel+UART Mode
P3:0 = Port 3 @ pin 1+2
P3:1 = Port 3 @ pin 3+4
P3:S = Port 3 UART
P3:D = Port 3 Parallel+UART Mode

Shortcuts

Quick menu

Right windows key OR F8 = Open the Quick menu
Enter = Enter submenu and activate a choice
Escape = Back out of current menu
Up cursor = Move selector up
Down cursor = Move selector down

IRC client

F1 = Channel 1 tab
F2 = Channel 2 tab
F3 = Channel 3 tab
F4 = Channel 4 tab
F5 = Channel 5 tab
F6 = Channel 6 tab
Left arrow key = Switch to previous channel
Right arrow key = Switch to next channel
Tab = Toggle channel user list
Numpad 4 = Scroll left
Numpad 6 = Scroll right

Telnet client

F1 = Scroll left
F2 = Scroll right

Terminal emulator

Type help for a list of all available built in commands.

History queue:
Up arrow = Go back in history of entered command strings.
Down arrow = Go forward in history or clear command string if at the last entered command string.