AViD My Current Project

Prototype AViD
Prototype AViD

I have mentioned on Facebook and on Atari Age that I am working on a way to plug a stock Adam into a PC and have the PC then act like an Adam Disk Drive (or other SmartNet device) with no additional hardware or software being necessary on the Adam. I have given this project a name, AViD (Adam Virtual Device) I am happy to say have reached a milestone in the project.

Some background on the Adam and how it communicates

AViD plugged into the USB -RS232 adapter and extra USB 5V power for keyboard
AViD plugged into the USB -RS232 adapter and extra USB 5V power for keyboard

The disk drives and the keyboard plug into the CPU and use a quasi – serial network called SmartNet. All devices communicate on a single shared transmit and receive wire at 62,500 baud 8 bits, 1 stop bit no parity. I know these details because of a single piece of paper I got in a large Adam collection I purchased The paper was from the electronics reseller Jameco which was included when you purchased a surplus Adam keyboard from them and it gives the specs and a very simple circuit diagram to interfacing with the keyboard. This shared wire and the unusual baud rate makes it very hard to connect it to a PC (or other system) where this baud rate is not supported and this may be why nothing like this has been tried before. Researching the internet I found a USB to RS232 adapter which supports this unusual baud rate. Using this adapter, the simple circuit diagram and some software I have written I have successfully connected an Adam keyboard to a Windows 7 PC and am able to communicate with it.

Houston we have lift-off

"Hello World" from the AViD plugged into the PC
“Hello World” from the AViD plugged into the PC

Now that I can read the keyboard the next step will be to switch the system and have a real Adam ask the PC for keystrokes. These can come from the keyboard or from a text file.

Down the road

Once I am totally confident in the PC “typing” to the Adam on the SmartNet the next step will be to have the PC act as a disk drive, responding to the Adam and sending and receiving data.

The sky’s the limit

Since all communication to the keyboard, disk drives, printer and  possibly digital drives goes through the SmartNet the PC can play many roles. One may be to intercept printer commands and then print to files on the PC.

How can you help?

If any of you happen to have any details on how the Adam communicates to the drives (or vice versa) or source code (EOS or OS7) that show how this is done I would be very happy if you could leave a reply here with that information or where  I can find it. I can always be reached on FaceBook too in the Coleco Adam page.

 

Warning Labels

completelabelIf you are restoring your Adam you may want to replace missing or worn out labels. Here is a pdf containing the top cover label that you can print out on a shipping label (Avery 5163). There are a few characters in the font that are not exact, but they are close enough not to matter considering the other option is a ugly label or none. You can trim the excess off the label, leave about 1/8″ all around the box.

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.

 

Simple Receive command for CP/M binary files

I have written a simple CP/M program that relocates it self below the TPA and then will receive a hex file (created with the PC program attached called 2hex.com (this is a16 bit program)) and when done it will exit to the command prompt where you can then use SAVE ?? filename.ext to save the transfered binary program (converted from the hex file sent). Replace the ?? with the size of the original binary file / 256 and rounded up (the number of pages it uses). This uses the same procedure as the post on the modified Pip program for receiving files (see this post).

Click here for the files: cpmrcv.zip

       .org        0100H
; Move code to 050H
       ld          de,050H
       ld          hl,RelocStart
       ld          bc,RelocEnd - RelocStart
       ldir                     ; Code copied
       jp          050H         ;Execute

RelocStart:
       .org        050H
       ld          hl,0100H     ; Where we are storing the data
HighNib:
       call        ByteRead
       ld          (hl),a       ; Save the byte
       inc         hl
       ld          bc,(Size)
       inc         bc
       ld          (Size),bc
       jr          HighNib      ; Do more bytes
Size:
.db 0,0

; **** Subroutines ****

; Get a byte from 2 Hex butes
ByteRead:
       push       de
       call       HexByte
       rlca
       rlca
       rlca
       rlca
       and   240               ;Clear lower
       ld         d,a
       call       HexByte
       or         d
       pop        de
       ret

; Convert hex in A to byte
HexByte:
       call       ModIn
       sub        48
       cp         10
       jr         C,HexByte1
       sub        7
HexByte1:
       ret

; Send character in A out to screen
ConOut:
       push        af
       push        bc
       push        de
       push        hl
       ld          e,a
       ld          c,2
       call        5
       pop         hl
       pop         de
       pop         bc
       pop         af
       ret

; Check if a byte is available and return
; it in A. NC set if no character
ModIn:
       in          a,(05FH)     ; Read status
       rra                      ; Rotate RXREADY into CF
       rra
       jr          NC,ModIn     ; Wait for a byte
       in          a,(05EH)     ; Get character
       cp          26           ; Is it CTRL +Z
       jr          NZ,ModInExit ; no
       jp          0H           ; Done - quit
ModInExit:
       call        ConOut       ; Display Modem Byte
       cp          48           ; Is it less than "0"
       jr          C,ModIn      ; Yes get another byte
       ret
RelocEnd: