Importing Files into TDOS (and CP/M)

A few months ago I wrote an article on how to import files into TDOS using a terminal program and a null modem connector. Since then I have developed an easier way of doing it. It involves using WRDISK and the process described in Importing Files.

Once you have the files you want in a tape image* you can use EOS/TDOS.COM to import the file from the tape image into TDOS. If you are using CP/M you can use the CP/M utility ADAM.COM to do the same.

*I prefer a tape image because there is 256K available versus the default 160K in a disk image

Making Tapes and Disks from Images

If you are like me eventually you are going to want to copy images to real media to use on your Adam, or copy real media to images for archiving or emulator use. There are a number of ways to do this.

Note: I have included all the programs and files needed at the end of this article

1. Disk and DCOPY

If you have a disk drive you can use an older PC with a double density 5 1/4″ drive*, MS-DOS and DCOPY to make an Adam disk from a disk image. DCOPY can create a disk image from an Adam formatted disk or create a disk from an Adam disk image.

*To make sure that your 5 1/4″ drive can do double density you can use the program TESTFDC which will test the capabilities of you drive and tell you what it can and can’t do. You can also use the MS-DOS command FORMAT ?: /1 /8 where ? is the drive letter (A or B). This will format a disk so that it is ready to use with DCOPY, if the format fails then odds are your drive can not do the lower capacities.

Creating an image

To create an image from a disk, insert the disk in your floppy drive, we will assume, it is drive B, then at the dos prompt type:

C:>dcopy b: /t:40 /s:8 /h:1 filename.ext

Where filename.ext is the name of the image you wish to create.

Creating a disk

To create a disk from an image, insert a blank disk in your floppy drive, we will assume, it is drive B, then at the dos prompt type the following:

C:>format b: /1 /8
C:>dcopy filename.ext /t:40 /s:8 /h:1 b:

Where filename.ext is the name of the image you wish to write to disk.

2. Compact Flash and TDOS

This method will let you create not only disk but tape images. The steps are a little more involved but not too difficult. To do this you will need:

  1. The AdamEm ADAM emulator that supports the Compact Flash (CF)
  2. HDD Raw Copy tool that allows your to read and write images to and from CF
  3. A CF Image that has TDOS
  4. The IDE disk image
  5. A blank 64 MB or larger CF
  6. Blank disk and tape media images
  7. A PC that has a CF adapter
  8. The Dragon’s Lair tape and disk images

If you do not have the emulator installed, unzip it to its own folder. You will also want to also unzip the HDD Raw Copy tool, the IDE disk image, blank media images, Dragon’s Lair images and the TDOS CF image into this folder.

Now open up the adamem.cfg file in the folder using NotePad and edit it to look like this:

-video 2 -da ide.dsk -idea tdos4-59.img -db diskette.dsk -ta datapack.ddp

This tells the emulator to use 320×240 video mode (-video 2), assign the image ide.dsk to disk drive A (-da) and to use the CF image tdos.img (-idea). We are also assigning drive B to a blank diskette image (-db) and tape drive A to a blank data pack image (-ta). You can substitute the filenames of real images if you are going to be making real media from the images.

A quick word on drive letters, numbers. There is no real consistency in how software on the Adam refers to the various drives. In Smart Basic and other software D1 and D2 refer to tapes, D3 and D4 refer to disk drives. In CP/M it depends on your system configuration, if you have disk drives then the disk drives are A and B then the tapes are C and D. If you do not have disk drives then the tapes are A and B. Many other programs refer to the tapes as A & B then the disks as C & D. TDOS lets you define the drives when you configure it. The TDOS image that is linked below is setup so that A,B,C and D are hard drives, E,F,G and H are disk drives, I and J are tape drives and K is a RAM disk. So in the above configuration shown for adamem.cfg the drives are assigned to these images:

E: = ide.dsk (The IDE boot disk)
F: = diskette.dsk (the blank disk)
I: = datapack.ddp (the blank tape)

Now double click on the AdamEm.exe file. It will either open directly into TDOS:

and put you at the A0> prompt or it will open up in the Hard Disk menu.

If  you are in the Hard Disk menu press Wildcard to get into TDOS (F7 on the PC keyboard).

Creating an disk or tape

The following may seem confusing but it has a certain logic to it:

To create a real tape or disk we first need to create a virtual image of a tape or disk image.

In other words, we need to take the image we have, attach it to the emulator configuration so that TDOS sees it as a disk or tape, then create a TDOS image of that media. Then we can copy the TDOS image to Compact Flash, put the CF into the ADAM and use TDOS to create real media out of the image.

So let us say we want want to make a copy of Dragon’s Lair on real media. I have included both the disk and tape image* so you can try both. To begin with, edit the adamem.cfg file so that it looks like this:

-video 2 -da ide.dsk -idea tdos4-59.img -db draglair.dsk -ta draglair.ddp

*Note you should use an old, unneeded game tape for this as they have a game pack directory versus a data pack directory.

After you have updated the .cfg file start AdamEm. First we will create a TDOS disk image of the Dragon’s Lair disk image using image20.com:

A0> image20 F:160 D:dragdisk

After entering the command you will be presented with a screen telling you to insert the media and press Return. Since we are using the emulated media we only need to press Return. Now the screen will just sit there, believe me it is working, we just don’t have real tape drives or disk drives to let us know this. Eventually it will say Image Written Successfully and return you to the A0> prompt. A quick explanation of the image20 command. The first parameter F:160 is the source drive, in this case drive F is the disk drive assigned to the -db image and the number 160 is the number of tracks to copy. The D:dragdisk is the drive and file we want to save the image on. If you do a dir d: you will see the image. To do a tape we would use the following command:

A0> image20 I:256 D:dragtape

I:256 is the drive I assigned to the first tape drive and 256 is the number of tracks to copy. When it completed we could do a dir d: to see the results.

Now that we have the images in TDOS we can close the emulator and exit back to Windows. Insert a blank Compact Flash card into the adapter. If Windows asks about formatting the drive tell it cancel or no. Now start the HDD Raw Copy Tool. You will be presented with a screen similar to this:

First we need to select the source, so double click on the line that says FILE and use the dialog box to select the image (TDOS4-59.img) we were working on and then click Continue. Now we need to select the Compact Flash we are writing to:

and then click Continue again. We will then see this screen:

at which point we will click Start. You may be prompted about overwriting the CF and such, just follow the prompts till it says it is done.

Now that we are done putting it on the Compact Flash, remove it from the slot and use Sneaker-Net to plug the CF card into the IDE CF adapter on your Adam and then boot it using either the IDE tape or IDE disk. After you are in TDOS, insert a blank tape or disk into either Tape drive 1 or Disk drive 1. Now at the A0> prompt type the following for a tape image:

A0> clone21 d:dragtape i:

When it is done you will have a data pack with Dragon’s Lair on it. To make a disk use:

A0> clone21 d:dragdisk f:

Creating an image from tape or disk

You can use the above method to make images of your tapes or disks, though you will probably want to use the DCOPY method for disks if you have a PC with a 5 1/4″ drive. To use the above just reverse the process so that you start out making TDOS images of the real media onto the CF on the Adam and then Sneaker-Netting the CF to the PC and using the process to make images of the TDOS images using the blank media images supplied.

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.

Coleco Adam CP/M Promotion Program

Do you have a Coleco Adam with just a Data Drive? Do you want to use it for more than just a few games or Smart Basic? If so then you should explore the world of CP/M! This operating system is available for the Adam computer along with literally tens of thousands of software programs.

To help promote the use of CP/M, Retro System Rescue (our store) is giving it away for free in a tape exchange program! Click here for details.

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   "$"

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: