Emulatoren / Emulators More Progs... Spiele / Games Start Seite Page Counter
End of page Links Web stats CPC Muesum home Mail me

Datentransfer

Einer der häufigsten Fragen ist die wie man Programme zwischen einem IBM PC und einem C-PC transferiert. Die Anleitung des Emulators CPC-EMU ist hier eine gute Quelle, ansonsten in der obigen Newsgroup mal die FAQ durchlesen.

Documentation

The most Question i get is how to transfer Data's or Games betwwen an IBM PC and an C-PC. In the Dokumentation of CPC-EMU is a long Chapter about that.

¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦¦

¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦

v1.5


D O C U M E N T A T I O N


(c) Marco Vieth, May 1998


5. Data Transfer CPC <-> PC

­­­­­­­­­­­­­­­­­­­­­­­­­­­­

What can you do with a good emulator when you do not have any programs for

it or if you do not see any possibility to get programs from a CPC across

to the PC?

In chapter 6 (Supply, ...) some ftp sources are listed where

CPC software can be found.

This chapter deals with the data transfer of CPC software to the PC.

Some utilities for the different possible methods of doing this are

described (disk, with parallel or serial interface).




5.1 Disk as a media

====================

This is the simplest way to get CPC software across to the PC. You only

need a CPC with a second drive of the correct size. Correct size means

that the disks must also fit in your PC drive. (If not, you could still

try to connect a 3" drive to your PC.) The PC is persuaded to recognize

the CPC formatted disk using a utility to read the CPC formatted disks.

This utility is called CPCTRANS.



5.1.1 The disk transfer program CPCTRANS

-----------------------------------------

I have developed CPCTRANS to create disk images from CPC disks.

Standard CPC formats as well as double sided Vortex formats are

supported.

CPCTRANS is not intended to transfer copy protected formats!

When calling CPCTRANS without parameters you will get a short

overview.

CPCTRANS is similar to the DOS COPY-instruction:

'CPCTRANS <source> <destination> <options>'.

Examples:

'CPCTRANS B: DISK1.DSK' copies the disk in drive B to the disk image

DISK1.DSK. If it does not exist, it is created.

'CPCTRANS DISK1.DSK B:' writes the disk image back to the disk in

drive B.

The first command only runs for the DATA format.

For other formats you have to use an option:

/f 0 : DATA format (default)

/f 1 : DATA format, double-sided

/f 2 : SYSTEM format

/f 3 : SYSTEM format, double-sided

/f 4 : VORTEX format, double-sided

/f 5 : unknown, CPCTRANS tries to detect it

/f 6 : +3DOS

Note the space between "/f" and the number.

When using the double sided DATA- or SYSTEM-format, you can select

the side A or B in the disk menu (3.2.1).

When writing back a disk image, the disk in the drive must have

the same format! For simple formats you can use 22DISK, described

in the next section.

For copying the B-side of a disk, use the option "/s 1"

With 'CPCTRANS B: DISK1.DSK /s 1' only the B-side of the disk is

copied, with 'CPCTRANS DISK1.DSK B: /s 1' it is written back.

The option "/v" turns on "verify", so CPCTRANS checks if the copy

is correct. That is indeed a bit slower but increases security.

The option "/t <count>" sets the number of tracks to copy.

Normally it is 40 tracks, only for the VORTEX format it is 80.

The option "/q" (quick format) is a feature with which you can format

a disk image, instead of copying data onto it. Nevertheless you have

to specify a valid drive as first parameter, even if it is not used.

Example:

'CPCTRANS a: SYSTEM.DSK /f 2 /q' formats SYSTEM.DSK as a disk image

with SYSTEM format.



5.1.2 The format- and copy-utility 22DISK by SYDEX

---------------------------------------------------

This program is available as shareware. With correct definitions you

can use nearly all CP/M formats!

Unfortunately just the CPC formats are not included with the evaluation

copy of 22DISK. Therefore I have defined the formats in the file

CPMDISKS.DEF. You will find them in the UTILITY subdirectory.

What can you do with 22DISK?

You can transfer single files back and forth between DOS and non-DOS

formats, format disks and so on.

Copy the CPC files into the TAPE directory. Read section 3.2.2 for

an explanation how to load them.



5.2 The parallel interface

===========================

If you own a CPC without second drive, you can do the data transfer

over the parallel interface.

If you own a CPC without a second drive, you can do the data transfer

over the parallel interface. The original idea came from Gilles Molinari,

he had also written some Turbo Pascal programs. But maybe you belong to

the group of users, who do not have a Turbo Pascal compiler on their CPC,

so you could not do much with the Pascal source. Therefore I have

rewritten the utilities in Locomotive BASIC, and extended it by adding

the direction PC->CPC.

Thus it is possible to transfer files back and forth between CPC and PC!

The CPC and PC are coupled together via their parallel interfaces.

If you own a CPC 6128 with Centronics connectors and compare them with

a printer you will note that CPC and PC fit together excellently when

using a standard PC printer cable! But do not do that now, please read

further.

It seems that only Schneider CPCs have Centronics connectors. If you

have an Amstrad CPC 6128 with simple edge connectors or a CPC 464,664,

use the diagram at the end of this section.

First you have to jump over two hurdles:

1. constructing a simple adapter

2. input a short program into the CPC

Wait! Do not skip the rest!

Both steps are really simple, because

1. is possible without soldering and

2. is indeed very short (about 30 lines BASIC)

To step 2.

The program you need calls CPCREC.BAS and is in the UTILITY directory.

It is saved in ASCII, so you can send it to your printer without

problems and type it into your CPC.

It does its job like a thin rope sent through a pipe in order to

get a thick cable through it.

Here, the thin rope is CPCREC.BAS which receives files from the PC.

With this little utility you get CPCPARA.BAS (the thick cable) over

to the CPC. With CPCPARA.BAS you can receive and transmit. Then you

will not need CPCREC.BAS any more.

On the PC side you use PCPARA.EXE, also included in the UTILITY

directory.

But before you input CPCREC.BAS, have a look at step 1:


The parallel adapter

--------------------

You need an adapter between the PC printer cable and the PC printer

connector.

This goes easiest with a RS-232 wiring box, which has a 25pin D-Sub

male (plug) and a 25pin D-Sub female (socket) connector.

By plugging short wires into the box you can realize any possible

connection between both sides. Usually such a box is used - as its

name already says - for adapting RS-232 interfaces. Serial connections

do not function at the first, you know.

We use the adapter the other way round, that is, the plug is for the PC

side and the socket for the printer cable.

Plug it together now:

Plug for the PC printer- Socket for the printer cable

connector (left side): (right side):

Pin 2 --------------- Pin 11

Pin 10 --------------- Pin 8

Pin 11 --------------- Pin 1

Pin 12 --------------- Pin 7

Pin 13 --------------- Pin 6

Pin 15 --------------- Pin 5

Pin 19 --------------- Pin 19


As you see, you do not need all the 25 wires, only 7 of them.

Although the wiring box is cheap if you buy it from a electronic

mail-order company, you can get it even cheaper by using a jumper box.

Then you have to solder the wires. The cheapest way is to buy a 25pin

D-Sub plug, a 25pin D-Sub socket, a box and some wires.

Now I presume you have connected the computers with the adapter and

CPCREC.BAS on your CPC.

What now?

1. On the CPC : Run CPCREC.BAS (after you have saved it)

2. On the PC : Run 'PCPARA /s CPCPARA.BAS'

Now it gets exciting, if no error messages appear on the PC screen, all

is OK, the file is on the CPC.

If the PC does not send anything and reports an error message the

connection may be incorrect.

If it is sending ("Sending block xx"), but some error messages appear

occasionally, your PC may be to fast or to slow. The direction

PC->CPC is very time crucial, you know.

On my 386/33 I must not have EMS memory installed, otherwise it is too

slow. On a very fast computer it could be necessary to use the turbo

switch.

Use the program under plain DOS, not OS/2 or Windows.

If it does not run at all, send me a note.

In the meantime you can type in the program CPCPARA.BAS which is

a little longer. The direction CPC->PC runs always, also under OS/2,

because it is nearly the same as printing. The PC behaves like a printer.

I assume that you have CPCPARA.BAS on your CPC now.

Transfer files from CPC to PC in the following way:

1. On the PC: Run 'PCPARA /r'.

2. On the CPC: Run CPCPARA, select S)end and input every file you want

to transmit. (Run 'PCPARA /r' for every file you want to transmit,

CPCPARA runs in an endless loop.)


Thus, use PCPARA in the following way:

- PCPARA /r : start PCPARA in receiving mode

- PCPARA /s <file> : sends <file> to the CPC, if you use 'TRM:' as

file, you will get a terminal.

All programs in the UTILITY directory display an overview about its

options if you call them without any parameters.


WARNING:

Even if the construction is very simple, I cannot guarantee that you

do not damage anything. If your CPC printer-port is damaged afterwards,

it is a pity and rather an unfortunate accident. Perhaps it would be

also damaged if you had simply connected a printer.

For example, I know a former CPC user whose keyboard did not work

properly any more one day. After the repair he was told that he

should not plug the joystick in while the computer is switched on!

(Well, I do so always ?!?)

To come back:

I have built the adapter successfully. And have even sometimes

"forgotten" to insert the adapter in the connection and have had no

problems.





Diagrams by David Chapeau, if your CPC has no Centronics connectors:

34 <- - - - - - - - 18 \

______________________ |

| ________________ | |

| |________________| | - | ---> Printer Connector (Female) to CPC

|______________________| |

|

17 < - - - - - - - - 1 |

|

|||||||||||||||||| |

|||||||||||||||||| \

|||||||||||||||||| > "CPC 6128 to DMP 2160" Cable

|||||||||||||||||| /

|||||||||||||||||| |

|

1 - - - - - - - - > 18 |

________________________ |

\ ______________ / |

\ |______________| / - | ---> Centronics Connector (Male)

\__________________/ |

|

19 - - - - - - - -> 36 /



18 < - - - - - - - - 1 \

________________________ |

\ ______________ / |

\ |______________| / - | ---> Centronics Connector (Female)

\__________________/ |

|

36 <- - - - - - - - 19 |

|

|||||||||||||||||| |

|||||||||||||||||| \

|||||||||||||||||| > PC Parallel Adapter

|||||||||||||||||| /

|||||||||||||||||| |

|

1 - - - - - - - - > 13 |

________________________ |

\ .................. / |

\ ................ / - | ---> Sub-D Connector (Male) to PC (LPT1)

\__________________/ |

|

14 - - - - - - - -> 25 /


13 < - - - - - - - - 1 \

________________________ |

\ .................. / |

\ ................ / - | ---> Sub-D Connector (Female)

\__________________/ |

|

25 <- - - - - - - - 14 |

|

|||||||||||||||||| |

|||||||||||||||||| \

|||||||||||||||||| > RS 232 "Wired Box"

|||||||||||||||||| /

|||||||||||||||||| |

|

1 - - - - - - - - > 13 |

________________________ |

\ .................. / |

\ ................ / - | ---> Sub-D Connector (Male) to PC (LPT1)

\__________________/ |

|

14 - - - - - - - -> 25 /



Printer Centronics Centronics Sub-D Sub-D Sub-D

Connector (Female) (Male) Connector Connector Connector

1 --------- 1 1 --------- 1 11 --------- 2

. . 8 --------- 10

. . 1 --------- 11

. . 7 --------- 12

17 --------- 17 14 --------- 14 6 --------- 13

18 --------- 19 19 --------- 19 5 --------- 15

. 21 --------- 20 19 --------- 19

. 23 --------- 21

. 25 --------- 22

34 --------- 35 27 --------- 23

29 --------- 24

30 --------- 25

31 --------- 16

32 --------- 15

33 --------- 18

36 --------- 17



CPCPARA -> PCPARA (v1.1) transfer speed:

Times to transfer a block of 0x4000 Bytes from CPC to PC with the

parallel adapter:

Source on CPC: bytes/s: bit/s:

-----------------------------------------------------------

File from floppy disk: 1600 12800

Block from memory: 2240 17920

Block from memory, no ints.: 2445 19560

(poke &b941,&c9 on CPC 6128)

The block sending was controlled in BASIC (inside CPCPARA):

defstr a:a="test.$$$":call sstr,@a

a=string$(&80):for i=1 to &80:call sstr,@a:next:call sbyte,0:stop


You can read further information about the parallel adapter in chapter 7.



5.3 The serial interface

=========================

If you own a serial interface for the CPC, you can certainly use it

for data transfer to the PC.



5.4 Other possibilities

========================

There are some more fantastic ways to get the software onto the PC.

- Connect the 3" disk drive to the PC. Some (older) models should fit to

a 5.25" connection.

- With a detour over the the Spectrum+3: read the 3" disk on the

Spectrum+3, convert it in the Spectrum format and use a utility

to read it on the PC. This utility comes with the Spectrum emulator Z80

by Gerton Lunter.

- When is was necessary to get the ROM yourself, someone told me about

his way:

He took the ROM chip out of the CPC and inserted it instead of the VGA

BIOS. With a small program he was able to read the contents.

- Maybe you will find another way?

7.6.2 The parallel adapter

---------------------------

First, the construction of the adapter, now with functional description:


PC D-SUB Cent. CPC Function

-------------------------------- ---------------------------

GND 19 ---- 19 GND GND

BUSY 11 <--- 1 -STROBE Synchro (Data available)

-ACK 10 <--- 8 D6 |

PE 12 <--- 7 D5 | Data

SELECT 13 <--- 6 D4 |

-ERROR 15 <--- 5 D3 |

D0 2 ---> 11 BUSY Synchro (Ready to receive)


Direction CPC->PC

-----------------

Normally the adapter is designed for this direction only. Sending

on a CPC is on principle the same as printing on a line printer.

If the PC sets Not-BUSY, the CPC writes a nibble (4 bit of a byte)

to the port, sets STROBE as sign that the data is there, and clears

it afterwards. So the PC only needs to clear BUSY (with D0), wait

for STROBE (his BUSY line) and take the nibble (from the input-lines

printer->PC), and set BUSY.

Question: Why not sending 8 bits parallel?

Answer:

1. The PC printer port must be reprogrammed for input and I am not

sure if that is possible on all PCs and

2. The CPC has a 7 bit printer port only.


Direction PC->CPC

-----------------

One day I thought about the possibility of sending data in the other

direction. Unfortunately the CPC has only one single input line at

the printer port, namely the BUSY signal. So it would not improve the

situation if you try to design a better adapter for this direction.

Thus take what you have already and make the best out of it by

developing a clever protocol.

A serial interface also has one data line for each direction.

But, a serial interface uses hardware synchronization, usually with

a quartz, and both peers have to use exactly the same baud rate

(e.g. 1200 baud).

It is hard to do that with software only.

What should I do?

The idea is to utilize the speed advantage of the PC over the CPC.

Each byte is split into 8 bit and transmitted serial, the PC has

to set the BUSY line accordingly.

During this 8 bit the CPC gives its maximum speed and the PC has to

conform with it. The CPC writes a "bit request" with one assembler

instruction. Now the PC must react promptly by setting the BUSY line

accordingly the next bit. Since with the following-but-one (?)

instruction the CPC will read it.

In order to not disable the interrupts during the whole transfer,

for every byte a "connection" is established.

The CPC says "Hey, send something to me!", and the PC answers

"Ok, I'm waiting until you want it." by toggling the BUSY-line.

The whole story is protected with timer, so no peer can hang when

waiting on a signal never sent.

Thus you can escape the programs with <ESC> or <CRTC>+<BREAK>

any time.




7.6.3 CPCTRANS

---------------

Another option not mentioned is "/d 0" or "/d 1". With 1 a special

double-step mode is selected, on 80 track drives every second track

is skipped when working with 40 track disks.

This option should be unnecessary, because CPCTRANS switches

automatically to double-step when detecting a 5.25" 360 KB disk.

Normally it is very simple to read or write sectors by using the BIOS.

But the BIOS cannot handle B-sides of disks with head-mark=0.

So I had to program the FDC functions myself, with the aid of

the MINIX source as an outline. Unfortunately the MINIX source contains

some errors, and the timing in critical sections was done by

simple delay loops possibly outlined for a 8086 processor.



¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦

¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦¦

¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦

v1.5


D O K U M E N T A T I O N


(c) Marco Vieth, Mai 1998



5. Datenübertragung CPC <-> PC

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

Was nützt Ihnen der schönste Emulator, wenn Sie keine Programme dafür

haben oder keine Möglichkeit sehen, die Programme von Ihrem CPC zum

PC zu bekommen?

Im Kapitel 6 (Bezugsquellen) sind auch einige Quellen aufgeführt, wo

Sie CPC-Software bekommen können.

In diesem Kapitel soll es darum gehen, wie Sie eigene CPC-Software auf

den PC transferieren.

Für die verschiedenen Möglichkeiten (Diskette, über parallele oder

serielle Schnittstelle) werden auch Hilfsprogramme vorgestellt.



5.1 Diskette als Medium

========================

Dies ist meistens die einfachste und schnellste Möglichkeit, die

CPC-Software auf den PC zu bekommen.

Sie brauchen dazu nur einen CPC mit Zweitlaufwerk in richtiger Größe.

Richtige Größe bedeutet dabei, daß die Disketten von der Größe her

in Ihr PC-Laufwerk passen müssen. Ansonsten könnten Sie versuchen,

ein 3" Laufwerk an den PC anzuschließen.

Der PC wird dann mit einem Zusatzprogramm überredet, die

CPC-Diskettenformate zu lesen.

Dieses Zusatzprogramm heißt CPCTRANS.


5.1.1 Das Diskettentransferprogramm CPCTRANS

---------------------------------------------

Ich habe CPCTRANS geschrieben, um Disketten-Abbilder aus

CPC-Disketten zu erstellen. Es werden sowohl die normalen CPC-Formate

als auch das doppelseitige VORTEX-Format gelesen.

CPCTRANS ist nicht dafür gedacht, kopiergeschützte Formate zu übertragen!

Wenn Sie CPCTRANS ohne Parameter aufrufen, erhalten Sie eine kurze

Übersicht.

Rufen Sie CPCTRANS ähnlich wie den DOS COPY-Befehl auf:

'CPCTRANS <Quelle> <Ziel> <Optionen>'.

Beispiele:

'CPCTRANS B: DISK1.DSK' kopiert die Diskette im Laufwerk B in

das Disketten-Abbild DISK1.DSK. Falls diese nicht existiert,

wird sie neu erzeugt.

'CPCTRANS DISK1.DSK B:' kopiert das Disketten-Abbild zurück

auf die Diskette im Laufwerk B.

Der erste Befehl funktioniert nur für das DATA-Format.

Für andere Formate müssen Sie eine Option angeben:

/f 0 : DATA-Format (Standard)

/f 1 : DATA-Format, doppelseitig

/f 2 : SYSTEM-Format

/f 3 : SYSTEM-Format, doppelseitig

/f 4 : VORTEX-Format, doppelseitig

/f 5 : unbekannt, CPCTRANS versucht es selber zu erkennen.

/f 6 : +3DOS

Beachten Sie das Leerzeichen zwischen "/f" und der Zahl.

Beim doppelseitigen DATA- und SYSTEM-Format wählen Sie die Seite A oder B

im Disketten-Menü (3.2.1).

Beim Zurückschreiben eines Disketten-Abbildes muß die Diskette

schon mit dem richtigen Format formatiert sein! Dazu können Sie

22DISK benutzen, was im nächsten Abschnitt beschrieben wird.

Wollen Sie die B-Seite einer Diskette kopieren, wählen Sie Seite B

durch die Option "/s 1".

Durch 'CPCTRANS B: DISK1.DSK /s 1' wird also nur die B-Seite der

Diskette kopiert, mit 'CPCTRANS DISK1.DSK B: /s 1' wird sie wieder

zurückgeschrieben.

Durch die Option '/v' schalten Sie "verify" ein, d.h. es wird

überprüft, ob die Daten korrekt kopiert wurden. Das ist zwar ein

bißchen langsamer, erhöht aber die Sicherheit.

Mit der Option '/t <Anzahl>' geben Sie an, wieviele Spuren (tracks)

kopiert werden sollen. Normalerweise werden immer 40 Spuren kopiert,

nur beim VORTEX-Format sind es 80.

Eine Besonderheit ist die Option '/q' (Quick-Format). Hiermit

formatieren Sie ein Disketten-Abbild, anstatt den Inhalt

einer Diskette hineinzukopieren.

Trotzdem müssen Sie als ersten Parameter ein gültiges Laufwerk angeben,

auch wenn es nicht benutzt wird.

Beispiel:

'CPCTRANS a: SYSTEM.DSK /f 2 /q' formatiert SYSTEM.DSK als

SYSTEM-Format-Diskette.



5.1.2 Das Formatier- und Kopierprogramm 22DISK von SYDEX

---------------------------------------------------------

Dieses Programm ist als Shareware erhältlich. Durch geeignete

Definitionen können Sie sämtliche CP/M-Formate benutzen!

Leider sind gerade die CPC-Formate in der Prüfversion von 22DISK nicht

enthalten. Deshalb habe ich diese Formate in der Datei CPMDISKS.DEF

definiert. Sie befindet sich auch im UTILITY-Verzeichnis.

Was können Sie mit 22DISK machen?

Sie können einzelne Dateien zwischen DOS und den Fremdformaten hin- und

herkopieren, Disketten formatieren und so weiter.

Kopieren Sie die CPC-Dateien einfach in das TAPE-Verzeichnis, und

lesen Sie im Abschnitt 3.2.2 nach, wie Sie Programme von Kassette laden.



5.2 Parallele Schnittstelle

============================

Falls Sie noch einen CPC ohne Zweitlaufwerk besitzen, haben Sie die

Möglichkeit, den Datentransfer über die parallele Schnittstelle zu

tätigen.

Ursprünglich hatte Gilles Molinari diese Idee und auch Turbo-Pascal

Programme dazu geschrieben. Nur gehören Sie vielleicht zu den Benutzern,

die keinen Turbo-Pascal Compiler auf den CPC haben, somit könnten Sie

damit nicht viel anfangen. Ich habe sie deshalb in Locomotive-BASIC

umgeschrieben und durch die zusätzliche Richtung PC->CPC ergänzt.

Es ist also möglich, Programme vom CPC zum PC und umgekehrt zu übertragen!

CPC und PC werden dabei an den Druckerschnittstellen gekoppelt.

Wenn Sie einen CPC 6128 haben und sich die Anschlüsse mal genauer ansehen,

werden Sie feststellen, daß Sie mit einem parallelen PC-Druckerkabel die

beiden Computer hervorragend verbinden können! Doch tun Sie es noch nicht,

lesen Sie erst weiter.

Wenn Sie einen Amstrad CPC 6128 ohne Centronics-Buchse oder einen

CPC 464/664 haben, benutzen Sie das Diagramm am Ende des Abschnitts.

Zwei kleine Hürden müssen Sie überwinden:

1. Einen kleinen Adapter bauen

2. Ein kurzes Programm in den CPC eintippen

Warten Sie! Blättern Sie nicht gleich weiter!

Beide Schritte sind ganz einfach, denn

1. geht auch OHNE LÖTEN und

2. ist wirklich ziemlich kurz (etwa 30 Zeilen BASIC)

Zu 2.

Das Programm, was Sie brauchen, heißt CPCREC.BAS und befindet sich im

UTILITY-Verzeichnis. Es ist in ASCII-Form abgespeichert, so daß Sie

es problemlos ausdrucken und in Ihren CPC eintippen können.

Es erfüllt in etwa die Aufgabe eines dünnen Seiles, das Sie durch ein

Rohr schicken, um ein dickes Tau nachziehen zu können.

Das dünne Seil ist hier CPCREC.BAS und empfängt (receive) Programme

vom PC. Mit diesem "Progrämmchen" holen Sie das Programm CPCPARA.BAS

(das dicke Tau) auf Ihren CPC. Damit können Sie sowohl Programme

empfangen als auch senden. CPCREC.BAS brauchen Sie dann nicht mehr.

Auf der PC-Seite haben Sie die ganze Zeit PCPARA.EXE.

Natürlich sind auch diese beiden Programme im UTILITY-Verzeichnis.


Doch bevor Sie CPCREC.BAS eintippen, kommen wir zu 1.


Der parallele Adapter

---------------------

Sie brauchen also einen Adapter zwischen dem PC-Druckerkabel und dem

PC-Druckeranschluß.

Am einfachsten geht das mit einer RS-232 Wiring-Box, die einen 25pin

D-Sub Stecker und eine 25pin D-Sub Buchse hat. Durch Stecken von

kurzen Drahtbrücken realisieren Sie damit beliebige Verbindungen zwischen

den beiden Seiten. Normalerweise wird so eine Box - wie ihr Name

schon sagt - zur Anpassung von RS-232 Schnittstellen benutzt. Serielle

Verbindungen scheinen nämlich nie auf Anhieb zu funktionieren.

Bei unserem Adapter benutzen Sie die Box einfach "andersherum", d.h.

der Stecker kommt an den PC, in die Buchse kommt dann das PC-Druckerkabel.

Stecken wir die Box eben zusammen:

Stecker für den PC- Buchse für das Drucker-

Druckeranschluß (links): kabel (rechts):

Pin 2 --------------- Pin 11

Pin 10 --------------- Pin 8

Pin 11 --------------- Pin 1

Pin 12 --------------- Pin 7

Pin 13 --------------- Pin 6

Pin 15 --------------- Pin 5

Pin 19 --------------- Pin 19


Wie Sie sehen, brauchen Sie nicht alle 25 Drahtbrücken sondern nur 7.

Meine Wiring-Box habe ich bei einem Elektronik-Versand für 13 DM bekommen.

Sie können es natürlich auch günstiger haben, indem Sie eine sogenannte

Jumper-Box verwenden, bei der Sie die Drahtbrücken festlöten müssen.

Diese sollte etwa 7 DM kosten.

Noch günstiger sind Stecker, Buchse, Adapter-Gehäuse und ein paar Drähte.

Das hat mich etwa 3 DM gekostet.


Sie haben jetzt mit dem Adapter die beiden Computer verbunden und das

"Progrämmchen" CPCREC.BAS in den CPC eingetippt.

Wie geht es nun weiter?

1. Auf dem CPC: CPCREC.BAS starten (nachdem Sie es abgespeichert haben)

2. Auf dem PC : 'PCPARA /s CPCPARA.BAS' starten.

Jetzt wird es kritisch, denn wenn auf dem PC keine Fehler gemeldet werden,

ist alles gut verlaufen, das Programm ist auf dem CPC.

Falls der PC überhaupt nichts sendet und nur eine Fehlermeldung ausgibt,

ist die Verbindung wahrscheinlich nicht in Ordnung.

Falls er etwas sendet ("Sending block xx"), aber zwischendurch Fehler

auftreten, ist Ihr PC vielleicht zu schnell oder zu langsam. Die Richtung

PC->CPC ist nämlich ziemlich zeitkritisch.

Auf meinem 386/33 darf ich kein EMS installiert haben, sonst ist es zu

langsam. Auf einem besonders schnellen Computer könnte es aber nötig

Sein, die Taktfrequenz herunterzuschalten. Benutzen Sie es unter DOS,

nicht unter OS/2 oder Windows.

Wenn es überhaupt nicht klappen sollte, benachrichtigen Sie mich.

In der Zwischenzeit könnten Sie das etwas längere CPCPARA.BAS eintippen,

die Richtung CPC->PC funktioniert nämlich immer, auch unter OS/2, da das

nicht viel anders ist als ausdrucken. Der PC spielt dabei den Drucker.

Ich nehme an, daß Sie jetzt CPCPARA.BAS auf Ihrem CPC haben.

Übertragen Sie Dateien vom CPC zum PC folgendermaßen:

1. Auf dem PC: 'PCPARA /r' eingeben.

2. Auf dem CPC: CPCPARA starten, Menüpunkt S)end wählen, und nacheinander

die zu übertragenden Dateien eingeben. (Rufen Sie 'PCPARA /r' für jede

zu übertragende Datei erneut auf, CPCPARA hingegen läuft in einer

Endlosschleife.)


Sie benutzen also PCPARA folgendermaßen:

- PCPARA /r : startet PCPARA im Empfangsmodus

- PCPARA /s <Datei> : sendet die <Datei> zum CPC, falls Sie als

Datei 'TRM:' angeben, bekommen Sie ein Terminal.

Bei den meisten Programmen im UTILITY-Verzeichnis bekommen Sie übrigens

eine Übersicht über die Optionen, wenn Sie nur den Dateinamen eingeben.


WARNUNG:

Auch wenn der Aufbau ganz simpel ist, kann ich doch nicht

garantieren, daß Sie dabei nicht irgend etwas kaputtmachen. Wenn z.B.

nachher Ihr CPC-Druckerport defekt ist, dann ist das schade und wohl

eher ein dummer Zufall. Wahrscheinlich wäre er auch dann kaputtgegangen,

wenn Sie nur Ihren Drucker angeschlossen hätten.

Ich kenne z.B. einen ehemaligen CPC-Benutzer, dessen Tastatur mal nicht

mehr funktionierte. Nach der Reperatur sagte man ihm, er dürfe den

Joystick auch nicht bei angeschaltetem Computer einstöpseln!

(Also ich mache das immer ?!?)

Also:

Der Adapter wurde nicht nur von mir schon mehrfach erfolgreich nachgebaut.

Und auch Benutzer, die "mal vergessen" haben, den Adapter zwischen der

Verbindung anzubringen, berichten von keinen Problemen.



Diagramme von David Chapeau, falls Ihr CPC keinen Centronics-Anschuß hat:

34 <- - - - - - - - 18 \

______________________ |

| ________________ | |

| |________________| | - | ---> Buchse für CPC-Druckeranschluß

|______________________| |

|

17 < - - - - - - - - 1 |

|

|||||||||||||||||| |

|||||||||||||||||| \

|||||||||||||||||| > "CPC 464/664 nach DMP 2160"-Kabel

|||||||||||||||||| /

|||||||||||||||||| |

|

1 - - - - - - - - > 18 |

________________________ |

\ ______________ / |

\ |______________| / - | ---> Centronics-Stecker

\__________________/ |

|

19 - - - - - - - -> 36 /



18 < - - - - - - - - 1 \

________________________ |

\ ______________ / |

\ |______________| / - | ---> Centronics-Buchse

\__________________/ |

|

36 <- - - - - - - - 19 |

|

|||||||||||||||||| |

|||||||||||||||||| \

|||||||||||||||||| > PC Parallel Adapter

|||||||||||||||||| /

|||||||||||||||||| |

|

1 - - - - - - - - > 13 |

________________________ |

\ .................. / |

\ ................ / - | ---> Sub-D Stecker zum PC (LPT1)

\__________________/ |

|

14 - - - - - - - -> 25 /


13 < - - - - - - - - 1 \

________________________ |

\ .................. / |

\ ................ / - | ---> Sub-D Buchse

\__________________/ |

|

25 <- - - - - - - - 14 |

|

|||||||||||||||||| |

|||||||||||||||||| \

|||||||||||||||||| > RS-232 "Wiring-Box"

|||||||||||||||||| /

|||||||||||||||||| |

|

1 - - - - - - - - > 13 |

________________________ |

\ .................. / |

\ ................ / - | ---> Sub-D Stecker zum PC (LPT1)

\__________________/ |

|

14 - - - - - - - -> 25 /



Drucker Centronics Centronics Sub-D Sub-D Sub-D

(Buchse) (Stecker) (Buchse) (Stecker) (Buchse) (Stecker)

1 --------- 1 1 --------- 1 11 --------- 2

. . 8 --------- 10

. . 1 --------- 11

. . 7 --------- 12

17 --------- 17 14 --------- 14 6 --------- 13

18 --------- 19 19 --------- 19 5 --------- 15

. 21 --------- 20 19 --------- 19

. 23 --------- 21

. 25 --------- 22

34 --------- 35 27 --------- 23

29 --------- 24

30 --------- 25

31 --------- 16

32 --------- 15

33 --------- 18

36 --------- 17



Übertragungsgeschwindigkeit CPCPARA -> PCPARA (v1.1):

Mit der eingebauten Statistik wurden folgende Übertrangungsraten

für einen 0x4000 Byte-Block vom CPC zum PC gemessen:

Quelle auf dem CPC: Bytes/s: bit/s:

-----------------------------------------------------------

Datei von Diskette: 1600 12800

Block aus dem Speicher: 2240 17920

Block aus Speicher,keine Int. 2445 19560

(poke &b941,&c9 auf CPC 6128)

Das Senden eines Blocks wurde in BASIC folgendermaßen realisiert:

defstr a:a="test.$$$":call sstr,@a

a=string$(&80):for i=1 to &80:call sstr,@a:next:call sbyte,0:stop


Weitere Informationen zum parallelen Adapter finden Sie im Kapitel 7.




5.3 Serielle Schnittstelle

===========================


Falls Sie eine serielle Schnittstelle am CPC haben, können Sie die

Daten natürlich auch seriell übertragen.



5.4 Sonstige Möglichkeiten

===========================

Es gibt auch abenteuerlichere Methoden, an seine Software zu kommen.

- 3" Diskettenlaufwerk an den PC anschließen. Manche (ältere) Modelle

sollen direkt an den 5.25"-Anschluß passen.

- Mit Hilfe des Spectrum+3 (oder so) die 3" Disketten einlesen, in das

Spectrum-Format konvertieren und mit einem Hilfsprogramm auf den PC

übertragen. Dieses Hilfsprogramm soll dem Spectrum-Emulator Z80 von

Gerton Lunter beiliegen.

- Als es noch nötig war, irgendwie an die ROMs zu kommen, hat mir ein

Benutzer von seiner Methode berichtet:

Er hat den ROM-Chip aus dem CPC ausgebaut und anstatt des VGA-BIOS in

seine Grafikkarte eingesetzt. Mit einem kleinen Programm konnte er

dann den Inhalt auslesen.

- Vielleicht finden Sie noch Ihre eigene Methode?


7.6.2 Der parallele Adapter

----------------------------

Zuerst einmal der Aufbau des Adapters, jetzt mit Funktionsweise:

PC D-SUB Cent. CPC Funktion

-------------------------------- ---------------------------

GND 19 ---- 19 GND GND

BUSY 11 <--- 1 -STROBE Synchro (Daten verfügbar)

-ACK 10 <--- 8 D6 |

PE 12 <--- 7 D5 | Daten

SELECT 13 <--- 6 D4 |

-ERROR 15 <--- 5 D3 |

D0 2 ---> 11 BUSY Synchro (empfangsbereit)


Richtung CPC->PC

----------------

Für diese Richtung ist der Adapter normalerweise gedacht. Im Prinzip

funktioniert das Senden auf dem CPC genauso, wie das Ausdrucken auf

einen Drucker. Wenn der PC Nicht-BUSY anlegt, legt der CPC ein

Nibble (Teil eines Bytes auf 4 Bits) auf den Port, setzt STROBE als

Zeichen, daß etwas da ist und löscht es danach wieder. Der PC braucht

also nur BUSY zu löschen (mittels D0), auf STROBE zu warten (über BUSY)

dann das Nibble übernehmen (über die Einabeleitungen Drucker->PC)

und BUSY zu setzen.

Frage: Warum kann man denn nicht 8 Bits auf einmal übertragen?

Antwort:

1. Der PC-Druckerport müßte auf Eingabe programmiert werden, das geht

nicht mit jedem und

2. Der CPC hat nur einen 7-Bit Druckerport


Richtung PC->CPC

----------------

Ich habe mir gedacht, daß es auch möglich sein müßte, Daten in die

andere Richtung zu verschicken. Leider hat der CPC am Druckerport

nur ein einziges Eingangssignal, nämlich das BUSY-Signal. Es würde

also nichts bringen, einen besseren Adapter für diese Richtung bauen

zu wollen. Also kann man auch gleich den Adapter nehmen, den man schon

hat, und ein geschicktes Protokoll entwickeln.

Immerhin funktioniert eine serielle Schnittstelle auch nur mit einer

Datenleitung für jede Richtung.

Doch: Bei seriellen Schnittstellen wird die Synchronisation

normalerweise mit einem Quarz erreicht. Es muß auf beiden Seiten exakt

dieselbe Übertragungsrate eingestellt sein (z.B. 1200 Baud).

Softwaremäßig ist das schlecht zu realisieren.

Was tun?

Die Idee ist, den Geschwindigkeitsvorteil des PC gegenüber dem CPC

auszunutzen. Jedes Byte wird in 8 Bit zerlegt und seriell übertragen,

indem der PC den Zustand der BUSY-Leitung richtig setzt.

Während dieser 8 Bit gibt der CPC die Geschwindigkeit vor und der

PC muß sich danach richten. Der CPC schreibt die Bit-Anforderung mit

einem Assembler-Befehl. Der PC muß jetzt schnell reagieren, und

die BUSY-Leitung entsprechend des nächsten Bits setzen, denn schon

mit dem übernächsten Assembler-Befehl wird der CPC dieses lesen wollen.

Damit nicht immer die Interrupts ausgeschaltet bleiben müssen,

erfolgt zuvor für jedes Byte ein "Verbindungsaufbau". Der CPC sagt

"Schick mir mal was rüber!" und der PC antwortet "Na gut, ich warte

jetzt, bis Du was haben willst.", indem er das BUSY-Signal wechselt.

Die ganze Geschichte ist durch Timer abgesichert, damit kein Computer

hängt, weil er auf irgendein Signal wartet, was dummerweise nicht

kommt. Sie können die Programme also immer durch ESC bzw CTRL-BREAK

abbrechen.





7.6.3 CPCTRANS

---------------

Eine noch nicht erwähnte Option ist "/d 0" und "/d 1". Bei 1

wird der Double-Step Modus gesetzt, d.h. 80-Spur-Laufwerke

springen immer 2 Spuren weiter, wenn sie 40-Spur Disketten

bearbeiten. Die Option sollte unnötig sein, da CPCTRANS bei

5.25" 360KB Formaten auf 80 Spur-Laufwerken automatisch

Double-Step einschaltet.

Normalerweise ist es ganz einfach, mit dem BIOS Sektoren zu

lesen und zu schreiben. Leider ist das BIOS aber nicht in der Lage,

B-Seiten von Disketten mit Kopfseite=0 zu verarbeiten.

Deshalb mußte ich die FDC-Routinen selber programmieren,

wobei der Floppy-Teil des MINIX-Source-Codes als Vorlage diente.

Leider enthält der MINIX-Code einige Fehler, und das Timing

wurde an den kritischen Stellen durch simple Warteschleifen realisiert,

die vermutlich für einen 8086 Prozessor ausreichten.




(c) 3/2003 by Bernd LeitenbergerStart of page