# Modem Emulator | burble.dn42
Modem Emulator

burble.dn42 / Retro42 / Modem Emulator

# Modem Emulator

No modem ? no problem.

> Dialup services may or may not be available depending on rebuild progress.

If you don’t have a physical modem you can still get that retro vibe by accessing dn42 using the modem emulator service. This service presents a series of TCP/IP ports that emulate a subset of the Hayes AT command set and which are speed limited to specific baud rates. The modem can dial directly to the fr-par1 shell service for that CLI experience, or get full dn42 access via a PPP session.

The service is intended to be used as a fake serial port in a retro VM or connected to directly using a serial terminal.

## Accessing the modem emulator service

- dialup.burble.dn42:(10000 + baud/100)

The modem emulator is accessed by connecting to dialup.burble.dn42 on ports corresponding to specific baud rates, as detailed in the table below.

Port | BAUD | Port | BAUD | Port | BAUD
--- | --- | --- | --- | --- | ---
10003 | 300 | 10012 | 1200 | 10024 | 2400
10048 | 4800 | 10096 | 9600 | 10144 | 14400
10192 | 19200 | 10288 | 28800 | 10336 | 33600
10560 | 56000 | 11150 | 115000 |  |

> Low baud rates give a great experience when using a serial terminal and the shell service but aren’t so much fun when using PPP. Conversely, using a serial terminal and higher baud rates is a bit dull and they are better suited to the PPP service.

The emulated modem is able to dial two services depending on the number used.

Dial Number | Service
--- | ---
54311 | fr-par1 shell server
4242 | PPP dialup service

## Dialling the fr-par1 shell server

Use a terminal emulator and dial 54311 to access the fr-par1 shell server.

Once the modem connects, use your burble.dn42 username and password to log in.

> You can set a burble.dn42 password using the services portal.

> Don’t forget to set a terminal type once you’ve logged in, e.g. `export TERM=vt102`

## Dialing the PPP server

- Dial 4242 to access the PPP server.
- Use username: dn42, password: dn42 to log in.
- Once you see the PPP initiation string, connect your PPP client.
- PPP authentication should not be required.

## Example shell session using socat and minicom

Example on how to connect to the shell server using socat and minicom at 2400 baud

    $ socat -d -d pty,rawer tcp:dialup.burble.dn42:10024 &
    ...
    ... socat[xxx] N PTY is /dev/pts/2
    ...
    $ minicom -D /dev/pts/2

Within minicom type ATDT54311 to dial the shell server.

    Welcome to minicom 2.8

    OPTIONS: I18n
    Port /dev/pts/2, 14:01:58

    Press CTRL-A Z for help on special keys

    ATDT54311
    CONNECT 2400
    Ubuntu 22.04.1 LTS
    shell-fr-par1 login:

You can now log in using your burble.dn42 username and password.

## Example PPP connection using QEMU and Windows XP

Add a virtual serial port to QEMU using `-chardev` and `-device`.

e.g. for windows XP connecting at 115k

    qemu-system-i386 -enable-kvm -cpu host -m 1024 -vga std -device AC97 -hda winxp.img -chardev socket,id=bdn42,port=11150,host=dialup.burble.dn42,server=off -device pci-serial,chardev=bdn42

Create a PPP dialup connection with username dn42 and password dn42, enable the option to prompt for username and password on connect.

Start the connection and when then chat box opens:

- Type ATDT4242 to dial the PPP service
- Log in using username dn42 / password dn42
- Hit continue when you see the PPP connect string

The following chat script provided by 04dco should provide automatic login for win95 onwards:

    ;
    ; This is a script file that automatically logs you in
    ; to establish a dn42 dial-up PPP connection.
    ;

    ; Main entry point to script
    ;
    proc main

       integer nTries = 3

       ; This is the login prompt and timeout values

       string szLogin = "modem-server Login: "
       integer nLoginTimeout = 5

       ; This is the password prompt and timeout values

       string szPW = "Password: "
       integer nPWTimeout = 5

       ; This is the prompt once your password is verified

       string szPrompt = "Last login: "

       ; Attempt to login at most 'nTries' times

       while 0 < nTries do

          ; Wait for the login prompt before entering
          ; the user ID, timeout after x seconds

          waitfor szLogin then DoLogin
            until nLoginTimeout

    TryAgain:
          transmit "^M"        ; ping
          nTries = nTries - 1

       endwhile

       goto BailOut

    DoLogin:
       ; Enter user ID

       transmit $USERID, raw
       transmit "^M"

       ; Wait for the password prompt

       waitfor szPW until nPWTimeout
       if FALSE == $SUCCESS then
          goto TryAgain
       endif

       ; Send the password

       transmit $PASSWORD, raw
       transmit "^M"

       ; Wait for the prompt

       waitfor szPrompt

       goto Done

    BailOut:
       ; Something isn't responding.  Halt the script
       ; and let the user handle it manually.

       set screen keyboard on
       halt

    Done:

    endproc

## Source code

The modem emulator is a small golang server and the source code is available on the burble.dn42 git server