Turbo Pascal for CP/M and TDOS

I just finished making a CP/M (TDOS) data pack for Don in Canada containing Turbo Pascal 3.0. It was a little project getting it from the Internet into an emulator and then over to a real Adam. The steps involved were:

  1. Find and download the software software (Duh)
  2. Arc all the software using PKARC
    At the time of this post I am waiting for a new Compact Flash adapter otherwise I would have used the method described in the Making Tapes and Disks post to get the files on to a tape. But since I can’t at this moment I instead copied the archive to the Adam using Hyperterm on my XP system, a null modem cable, the serial port and QuickTerm on the Adam in TDOS. Once I had it on the Adam I could continue:
  3. Unarc the archive in TDOS
  4. Use the PDTINS.COM file to setup the terminal for Turbo Pascal. The Adam uses a Heath 19 emulation in TDOS but I learned that the Lear Adam 25 works on the adam too

After this I took a freshly formatted CP/M tape and copied the files to tape from the CF on the Adam.

Downloads

Importing Files Into TDOS

Look here for a better (and much faster) way to do this.

I am in the process of import hundreds of files into TDOS (CP/M replacement) that is installed on a Compact Flash that I use on my Adam via the CF / IDE adapter. This process involves many steps:

  1. Copying disk images to 3 1/2″ floppy and moving them to an older 286 I have
  2. Creating actual 5 1/4″ floppies from these images using DCOPY
  3. Copying the files from floppy to the hard drive on the 286 using 22DISK
  4. Archiving the files using PKARC
  5. Copying the Archives back to 3 1/2″ and then to thumb drive on my Win 7 machine
  6. Uploading the files via Kermit batch mode on the PC using Tera Term or Hyper Term to the Adam using 7 Quick Term and a null modem cable

This is a very tedious process. I could eliminate most of the processed by using the AdamEm emulator and a an image of the Compact Flash but to access the CF image you need to run the windows version of AdamEM and it runs at actual Coleco Adam speed, and archiving files at real speed is VERY slow. So this is actually faster. I did learn that I can use a program I have Marcel de Kogel that will copy files from PC to tape images and then using TDOS’s Eos/Tdos file conversion program I can eliminate the file transferring via Kermit – so this has increased the speed tremendously. If you have any suggestions on speeding things up let me know.

Getting Software on to a Minimal Adam System Part 2

Understanding the Adam Link Modem and Eve Serial ports

When the Adam was introduced by Coleco there was also available the 300 baud Adam Link Modem. This modem was installed in the second expansion slot and allowed the Adam to access bulletin boards and information services using a regular phone line. The modem only operated at 300 baud when the standard of the day was 1200 baud and soon after 2400 baud.

To fix this issue many serial expansion ports were released by third party manufacturers that could access higher speeds and allowed you to plug in faster modems. These expansion ports are hard to come by now but if you do run across one you may wish to get it. The standard for the time was the Eve serial board and this is the one I have an will be discussing along with the Adam Link Modem. I will not be giving specific code in this article, just pseudo-code. I will show real code in future articles.

Adam Link Modem (aka 8251)

The Adam Link modem is a combination of serial port and modem in one and there are designs online that will allow you to convert it to a serial port if you want. The main chip is an Intel 8251 PCI. This chip technically can handle speeds up to 64K baud but is limited by the crystal in the modem to a maximum of 1200 baud with modifications. Communicating with 8521 and to the modem is accomplished through two ports, the data port 5Eh and the status port 5Fh.

Eve Serial Port (aka 2651)

The Eve serial port is a full function port that allows you to plug a modem or other serial device into and can be used to speeds up to 19.2K baud though in actuality it works best at 9600 baud or less do to a lack of a hardware buffer. The main chip is a National Semiconductor 2651. Communicating with the 2651 PCI is accomplished through four ports, the data port 44h, the status port 45h, the modem port 46h and the control port 37h.

Initializing

To initialize communications we need to output commands and data to either the 8251 ro the 2651 to get it set up. We are going to assume we are using 300 baud with both but you can use faster speeds 2651 later if you want. So to initialize the port we would do the following:

8251:

; Get the 8251’s attention

Send 80h to port 05Fh
Send 80h to port 05Fh
Send 04h to port 05Fh

; Set up the baud, clock rate, number of bits, parity and stop bits

Send 04Fh to port 05Fh

; Set serial lines RXE, TXE and RTS to make sure modem is hung up

Send 25h to 05Fh

2651:

; Set the mode to 8 bits, no parity, 1 stop bit, 16x asynch

Send value 4Eh to port 46h

; Set 300 baud (for other baud rates use: 35h = 300,
; 37h = 1200, 3Ah = 2400, 3Eh = 9600, 3Fh = 19.2)

Send value 35h to port 46h

; Reset the flags RTS, DTR and enable R/T

Send 37h to port 47h

; Clear any incoming characters

Get byte form port 47h
Get byte form port 47h

Send a character:

8251:

; Keep reading status port till high bit is clear

Loop:
Read status port 5Fh
Jump to Loop if bit 7 is not clear
Send character out port 5Eh

2651:

; Keep reading status port till low bit is clear

Loop:
Read status port 45h
Jump to Loop if bit 0 is not clear
Send character out port 44h

Read a character:

8251:

; Get character if there is one

Read status port 5Fh
Return if bit 6 is clear
Read character from port 5Eh

2651:

; Get character if there is one

Read status port 45h
Return if bit 1 is clear
Read character from port 44h

 

Getting Software on to a Minimal Adam System Part 1

Hello everyone. I would like to apologize that it has been awhile since I last posted, life gets in the way. I am going to start posting more often now that things have settled down.

This post starts a series that will look at getting software into a bare minimum Coleco Adam with just a data drive, an Adam Link modem and either, Smart Basic, Smart Logo or CP/M on data tape. The reason I want to do this is to help you understand what you can do with this system without adding new hardware or spending a lot of money on software.

We will look specifically at adding software to the Adam using this bare configuration. I selected this configuration because this is how I started out and I see a lot of systems selling that have this basic settings. I will also explore how to do it without an Adam Link modem using just the joystick ports and a EVE serial port if you happen to have one.

As I post these articles feel free to ask questions and if you have a different minimum setup let me know. The articles will be in the following order over the next few weeks:

  1. Understanding the Adam Link Modem and Eve Serial ports
  2. Using CP/M (or TDOS)
  3. Using Smart Basic
  4. Using Smart Logo
  5. Using the Joystick Port
  6. Transferring Files to the Adam

Transferring files from MyZ80 (CP/M) emulator on PC to an Adam Part 1

If you are like me you you probably only have a Digital Tape Drive (or 2) on your Adam and getting software into it is close to impossible. The options available are:

  1. purchase software used on eBay (or other source)
  2. type code in yourself
  3. get an expensive used floppy drive
  4. buy an IDE adapter (more on this in a future post)
  5. “download” it from another computer using CP/M (or other software)

I am going to go into detail on option #5 using CP/M as this is the easiest and cheapest in the long run. To do this you will need the following:

  • a 300 baud AdamLink modem
  • a phone cable
  • a null phone adapter (some modems allow a direct connect, those that require a dial tone need a null phone adapter)
  • a pc with a modem on com1: that is capable of running 16 / 32 bit programs (not window 7 64 bit)
  • hyperterminal or other program to setup the modem
  • a copy of MyZ80, a CP/M emulator for the PC, a modified copy of PIP.com and a copy of UNLOAD.com
  • CP/M for  the Adam

On The PC:

To get started you need to download, extract and familiarize yourself with MyZ80, the CP/M emulator (click here to download). If you use CP/M on the Adam then this will be easy to do. MyZ80 uses CP/M 3.0 not 2.2 like the Adam but the differences are minimal. Once you are familiar with MyZ80 download PIP, extract pip.com and import it into MyZ80. Also download UNLOAD, extract and import it into MyZ80.

This copy of pip has been modified to allow you to send and receive files with handshaking using the IN: and OUT: devices.  If you are curious how this was done here is the source code.

In my next post I will show you how to:

  1. write a program to setup the modem
  2. modify a copy of PIP on the Adam so that it will work with the modem

 

Answer: A simple program to answer the phone

The following program is designed to setup the AdamLink modem in CP/M to answer the phone. Once you call the Adam with a remote computer, pressing any key on the Adam will complete the connection and allow you to then exit to CP/M and use other programs to send / receive files from the remote. I wrote this to replace the need for using AdamLink software to setup the UART and answer the phone.

; Setup AdamLink and then answer the phone


        .org    0100H

; Setup UART for 8N1 300 baud
        ld      a,080H       ; Get UART's attention
        out     (05FH),a
        out     (05FH),a
        ld      a,040H
        out     (05FH),a
        ld      a,0CH        ; 8 bits, no parity is assumed since we are not setting it
        or      03H          ; 64x clock rate, 300 baud
        or      040H         ; 1 stop bit
        out     (05FH),a     ; Now setup UART

        ld      de,Title     ; Send prompt
        ld      c,9
        call    5
        ld      c,1          ; Go wait for a key to be pressed so we know to answer the phone
        call    5
        cp      3            ; Ctrl-C?
        jp      Z,0          ; Yes, exit

        ld      a,025H       ; RXE(4h) + TXE(1H) + RTS(20H) to hang up phone
        out     (05FH),a

        ld      a,07H        ; RXE(4h) + TXE(1H) + DTR(2H) set - toggle RTS to answer
        out     (05FH),a
        ld      a,027H       ; RXE(4h) + TXE(1H) + DTR(2H) + RTS(20H) set - grab phone line and enable carrier
        out     (05FH),a

; Display modem info till ^C pressed

ModIn:
       call        KeyIn        ; Get Key if any
       jr          Z,NoKey      ; No Key jump
       cp          3            ; Ctrl-C?
       jp          Z,0          ; Yes, exit
NoKey:
       in          a,(05FH)     ; Read status
       rra                      ; Rotate RXREADY into CF
       rra
       jr          NC,ModIn     ; Wait for a byte
       in          a,(05EH)     ; Get character
       ld          e,a          ; Display what we received
       ld          c,2
       call        5
       jr          ModIn        ; do more

KeyIn:
       ld          c,0bH        ; Check if character available
       call        5
       cp          0
       jp          Z,KeyInExit  ; No Key
       ld          c,1          ; Get actual key in A
       call        5
       ld          c,a
       or          1            ; Clear Z flag
       ld          a,c
KeyInExit:
       ret

Title:
.db   "Answer 1.0",13,10
.db   13,10
.db   "Press any key to answer,",13,10
.db   "CTRL+C to exit"
.db   "$"

Null Phone Adapters for Sale

IMG_4031I am currently selling adapters that I have built that allow you to connect two computers together via modem’s without the need for any phone service. These are very simple to use:

  1. Plug phone cables into the adapter from the 2 computer’s modems
  2. Plug 9volt battery into adapter

From here you would just use the terminal programs (or BBS programs) you have on the 2 computers to get them to talk to each other.

To purchase one via eBay click here.

IMG_4029If you want a more permanent solution than the 9 volt battery you can replace it with a DC adapter, red is positive (+), black is negative. I have tested it with voltages from 4.5 volts up to 12 volts though I recommend sticking with 9 volt.

If you want to build one yourself you can look at this webpage for the details on how it works (http://www.jagshouse.com/modem.html). Parts wise you will end up spending about the same as I am selling them for.

To purchase one via eBay click here.

 

https://www.youtube.com/watch?v=i7zkYPUPjdU

Direct connect Adam to PC via Adam Link Modem

This is relatively easy to do. This web page (http://www.jagshouse.com/modem.html) describes how to create a simple circuit to simulate a phone line. Once you have this you can plug the Adam Link modem into it and it into a PC. On the PC start HyperTerminal (or other terminal program).

To connect:

  1. On Adam set modem parameters using AdamLink to 8 characters, 1 stop bit, no parity
  2. On PC type ATE1X1 then enter to the modem. This will enable modem commands being echoed to screen and tells modem to ignore lack of dial tone
  3. On PC type ATDT123456789 then enter to dial modem, a long number gives you a few extra seconds to get to the Adam
  4. On Adam select Answer then select Online

Once you have connect the connection will remain if you reset the Adam to load CP/M or SmartBasic

CP/M PIP Mods

The following modifications to CP/M’s PIP will allow you to send and receive text files using the Adam Link modem:

At the CP/M prompt type DDT PIP.COM

Once loaded type S103

Type in the following data for each address starting at 103 (do not type in the address (ie 103:)):

103: C3 104: 15 105: 01 106: C3 107: 0A
108: 01 109: 00 10A: F5 10B: DB 10C: 5F
10D: 1F 10E: 30 10F: FB 110: 79 111: D3
112: 5E 113: F1 114: C9 115: F5 116: DB
117: 5F 118: 1F 119: 1F 11A: 30 11B: FA
11C: DB 11D: 5E 11E: 32 11F: 09 120: 01
121: F1 122: C9

Type CTRL+Z to exit modify and then type G0 and enter to exit DDT

At CP/M prompt type SAVE 62 PIP.COM

Once the save is complete you can now use CP/M to send and receive files via the Adam Link modem.

To do this follow these steps:

Once you have a modem connection via Adam Link software, remove the DDP and put in your CP/M DDP and reset system (Adam Link modem will remain connected).

Once your are in CP/M:

  1. To send a text file use:
    PIP out:=filename[e]
  2. To receive a text file use:
    PIP filename=inp:[e]Once the DDP has stopped moving and PIP is showing a cursor send the text file from the remote system. After the text file is done type CTRL+Z on remote system and PIP will save the file.

You can eliminate the [e] if you do not want the transfer being echoed to the screen.

Here is the source code for the modifications to PIP

       .org        0103H
Inp:
       jp          ModIn
Out:
       jp          ModOut

CharIn:                 ; Data storage
.db    0

; Send character in C out to modem
ModOut:
       push        af
ModOutLoop:
       in          a,(05FH)
       rra
       jr          NC,ModOutLoop
       ld          a,c
       out         (05EH),a
       pop         af
       ret

; Wait for byte from modem and store it in 0109H and return
ModIn:
       push        af
ModInLoop:
       in          a,(05FH)    ; Read status
       rra                     ; Rotate RXREADY into CF
       rra
       jr          NC,ModInLoop
       in          a,(05EH)    ; Get character
       ld          (CharIn),a
       pop         af
       ret