Amstrad CPC Serial Interface II User Guide
Amstrad CPC Serial Interface II User Guide
Table of contents
Introduction ................................................................................................................ 2
Serial Interface Connections ........................................................................................ 4
Direct serial cable ................................................................................................... 4
CH376 USB Host module ......................................................................................... 5
Wireless connection using a Bluetooth module ....................................................... 6
Wireless connection using an ESP-8266 wifi module................................................ 7
Basic Usage .................................................................................................................. 8
Send & Receive bytes: ............................................................................................ 8
Send & Receive bytes with a WiFi module acting as TCP server: .............................. 9
Configure Interface .....................................................................................................10
RSX Commands ...........................................................................................................11
Windows PC Communication Utility ...........................................................................13
Terminal Function.................................................................................................. 15
File Copy to CPC Function ...................................................................................... 16
File Copy From CPC Function .................................................................................. 18
Image Copy Function ............................................................................................. 19
Direct Load Function .............................................................................................. 21
Configure Bluetooth Module ......................................................................................23
Configure ESP8266 WiFi Module .................................................................................24
Hints & Tips ................................................................................................................27
Introduction
Amstrad CPC Serial interface II (USIfAC II), is an evolution of a previous Design, based on a modern
powerful 18F47Q10@64Mhz 8bit PIC microcontroller, which offers many new amazing features:
(Connect ONLY Tx=Green, Rx=White, and Ground=black to serial interface pins, red cable MUST
NOT be connected to the 5V!)
After you made the proper connections, just set serial port speed to match that on PC side, using
the “|SET” Command, and then just give: “|EN” to enable Direct mode.
That‟s it!
From now on, you can access the hard disk drive of your PC,by browsing directories (|CD), receive
catalogues (|CAT), delete files (|DEL) and use directly load, run, save and cat commands, exactly
like you do with floppy disks. Note also the amazing loading speeds (that can be up to
~20kb/sec),where you can load most of the games in a couple of seconds!
Moreover, you can also select disk images (|MG) and then enable Floppy Disk controller emulation
(|FDC on CPC 664/6128, |464 on CPC 464),in order to have full read/write access on that disk
image! In 2 words, you convert the HDD of your PC, to a HUGE super fast floppy disk, directly
accessible by your Amstrad CPC! ;-)
CH376 USB Host module:
Using this module, you can access a usb storage device, like a usb flash drive! In the photo above,
you can also see what pins you need to connect to interface UART connector,using 4 small dupont
wires:
Usb flash drive must be FAT or FAT32 formatted. If you experience problems in usage (like
frequent hang-ups, delayed execution of commands, erroneous messages, or even crashes),try to
create a small partition of 256Mb and format it, using FAT file sytem. In most cases, this will solve
the problems. If not, then probably you need to change the flash drive you are using.
As a general rule, better NOT to use large capacity drives (like 32Gb or 64Gb) or very cheap ones.
Now, after proper connections, just turn on your Amstrad and give:|USB command,and you are ready
to go!
(* On CPC 464, you should give first “|464”, press reset, and then give the above command, but, you
only need to do this ONCE, after power on Amstrad)
Any usb flash drive connected to host module, is fully accessible by your Amstrad, through many RSX
commands that allows you to:
Browse, create, delete directories (|CD, |MD, |DELD),
Get catalogues (|CAT)
Load, Run, Save programs/files (Ascii files also supported),
Delete files (|DEL)
And as described above at “direct serial cable connection”, you can also select and have full
access on DSK images too!
For direct wireless connection to a Laptop/Note book/Smart phone equipped with Bluetooth, or, two
Bluetooth modules, one connected to CPC serial interface, and the other to a usb2serial cable
adapter connected to a usb port. Check “configure Bluetooth module” on how exactly you can
set up module for use. After that, everything is the same as described in previous “direct serial
cable connection”
Wireless connection using an ESP-8266 wifi module:
This is especially useful for creating a LAN or for direct connection to internet!
Check “configure Esp8266 WiFi module” on how exactly you can set up module for use. After that,
everything is the same as described in previous “direct serial cable connection”
All of the above, are very easy to find on ebay and they cost almost nothing!(usb2serial can be found at
~1euro and other modules for 2-3euros…).
Finally, if you have an on old motherboard with on board RS232 serial port, you can‟t use it directly to
connect with serial interface, but you must use an RS232 to TTL converter between them.
Basic Usage
Interface usage, is pretty simple and straight forward. Communication with the device is accomplished
using only two ports:
&FBD1: The control port
&FBD0: The data port
And the two BASIC commands INP() for receive and OUT for send.
This method can be used with direct serial/ Bluetooth module and also, WiFi module, which must be
pre-configured using the |WIFI RSX command, in order to establish a passthrough/transparent
transmission mode.
To receive a byte, you must first check if there is any byte available at the buffer, by reading the
control port. Use the BASIC command: INP(&FBD1). If it returns „255‟, there is a byte available, if not,
it returns „1‟.So, in order to receive a byte from serial port, you just give the BASIC command:
And if you want to wait until a byte is available, you can use a small loop like:
And here is the assembly code for doing the same thing:
check_BYTE:
LD A,&FB
iN A,(&D1)
DEC A
JR Z,check_BYTE
ld a ,&FB
in a,(&D0)
In order to send data using a WiFi module that is configured as TCP server (using the setservr
program), you must first execute an AT command:
AT+CIPSEND=0,X
Where X, is the length of the string to be sent. Data string follows immediately after.
Below is the BASIC routine to send a string of chars/bytes (named A$):
Receiving a byte/char, is done like with serial connection, BUT before getting the actual data, there is
always a header in the form of:
+IPD,1,X:
2: Enables a special asynchronous burst mode, for fast receiving the hole receive buffer (3100 bytes)
at once. When this mode is enabled, you don‟t use INP(&FBD1) to check if there is available byte, but
instead you receive directly data using only INP(&FBD0). When the receive buffer becomes empty,
next INP(&FBD0) will cause automatically refilling of the receive buffer (e.g. 3100bytes). This mode is
used in the file transfer utility, in order to avoid asking if there is a byte available for every byte to
receive. USE WITH CAUTION, because it will freeze Amstrad, until the receive buffer is full!
30: This is the command used by |STAT Rsx command, which returns the status of interface (UART
speed,ROM number, Status for Direct Mode,FDC emulation, DOS ROM emulation).
Also,in order to change serial interface ROM number you can give:
OUT &FBD2,x
Where x is the desired ROM number (Default number is 5). This might be useful if you have other I/O
devices connected to your Amstrad that might use the same ROM number.
For CPC464 you should use a number less of 7, and for CPC6128, a number less or equal of 15. Note
also, that you should avoid numbers 0 and 7, because they are reserved by Amstrad CPC for BASIC
and AMSDOS ROMs respectively. The new ROM number will be saved into microcontroller EEPROM
memory (except for numbers „0‟ and „7‟),and will be used from now on, so you don‟t need to give the
command every time. Finally you can check the current ROM number, using |STAT RSX command.
RSX Commands
- |HELP: Shows all RSX commands with short description and usage.
- |CAT: Shows catalogue of files and sub dirs.Using argument „X‟ (|CAT,'X') it will show a list of files,
starting from 'X'. With usb device, you can use more than one letter for filtering. Finally, with argument
„1‟(|CAT,1) it will give a list of DSK images in selected dir (use this,only with PC Direct Mode).
- |USB: Enables CH376 Usb Host Module,to access USB Storage Device.You need to give this
command every time after a hardware reset (by either pressing RESET button or switch off/on
Amstrad). Nevertheless, interface will still “remember” the last state of the usb device, like the directory
you were or the dsk image you selected.
- |EN: Enables Direct Mode 1 to access files from PC or USB Device program (this is done
automatically with the use of “|USB” command).This practically means that LOAD, RUN and CAT
commands, will access files (or have a catalogue) from PC or USB storage device.Note that you MUST
Enable Direct Mode, before load/run/save a game/program.
- |EN2: Enables Direct Mode 2,try this,if above Mode 1 fails to load a game/program (NOT to use with
USB device)
- |DIS: Disables Above Direct Modes to Access Disk Drive, which means that LOAD, RUN and CAT
commands will access Disk Drive again. Alternatively, you can press RESET on USIfAC II board, or
give: OUT &FBD1,4.The latter is very useful, if you happen to get “unknown command” error message,
when trying to use an RSX command.
- |FDC: Enables/Disables 765 Floppy Disk Controller (765FDC) Emulation. For accessing DSK images.
This should be used only with Amstrad CPC 664/6128.
- |464: Resets Amstrad and enables Amsdos/Parados and 765FDC emulation. Use this command, for
accesing DSK images on Amstrad CPC 464,or, Parados DSK images on all CPC models. Note also
that,in order to use USB device on CPC 464, first time after power on your Amstrad, you should
give “|464”, and then press RESET button.This must be done ONLY once, at “cold start”, after that,
you DON‟T need to do it again, no matter how many times you reset Amstrad (or even turn it off/on by
the switch)
- |MD,'name': Create directory 'name' in current Directory of a Usb storage device. For Usb Device
Only.
- |DEL,'xxx': Delete all files starting from 'xxx',from selected directory. With PC direct mode,you can
also use wild card '*' for multiple file deletion. Of course you can also give a single file name as
argument, to delete this file only.
- |COPY,'xxx': Copies from USB Device to a Floppy disk,all files starting from 'xxx'.
- |MG,'name': Selects DSK image 'name' to access, using “|FDC” or “|464” 765FDC emulation.
When in PC DIRECT mode, you can also use it without argument, to enable automatic selection of
image,e.g. first image found in current PC directory, will be selected (and the “Auto image selection”
check box, will be checked in PC windows utility).
- |SET: A small utility for easy setting Serial port speed. On CPC464 you should give 'Run' after 'Ready'
prompt.
- |WIFI: BASIC utility for easy configure ESP8266 WiFi modules.Again,on CPC464, give 'Run' after
'Ready' prompt.
- |FORMAT: Utility for easy and quick formatting floppy disks in just 15seconds! Supports both Data
and System formats
- |2PC: Utility for copying files,from Amstrad CPC floppy disk,to selected directory on PC or USB
Device.
- |2CPC: Utility for copying files,from PC to Amstrad CPC disks.This is the equivalent of the above
“|COPY” command, but for use with PC Direct mode.
- |LROM,addr: Loads EEPROM contents to RAM,at 'addr' address.Note also, that, you can use an
RST3,&FC00 assembly command, in order to directly execute any code routine you have uploaded to
EEPROM.(last 1kb of selected upper rom @ &fc000-&fffd is reserved for EEPROM, last 2 bytes are
reserved for saving serial port speed and ROM number, thus you have 1022 instead of 1024 bytes
available )
- |STAT: Shows current status of USIfAC II Interface (UART speed,ROM number,Status for Direct
Mode,FDC emulation, ROM DOS emulation )
- |GALA: Loads GALACHIP game.On CPC464 give 'Run' after 'Ready' prompt
- |PACMAN: Loads PACMAN game.On CPC464 give 'Run' after 'Ready' prompt
- |KGOR: Loads KILLER GORILLA game.On CPC464 give 'Run' after 'Ready' prompt.
Windows PC Communication Utility
I have developed a utility for PC with windows, that allows communication with Amstrad CPC:
On Amstrad CPC, give |TER RSX command,and the main terminal window appears:
On the left side, write anything, and by pressing <Return> it will be transmitted to PC. On the right side
you will receive any respond from the PC.
With terminal, you can also communicate with serial interface by sending various commands to
change port speed, clear receive buffer, get status etc. By pressing <Enter> (or <COPY> on WiFi
mode), you will get a list of all available commands. Commands are sent by pressing <Tab> and then
the desired code.
On PC side, after setting and enabling connection, select Terminal function. You can use the edit box
on the left of the <Send> button to write a message and by pressing Send button it will be transmitted
to Amstrad CPC.
File Copy to CPC Function
On Amstrad CPC, give |2CPC RSX command. You need to set the serial port speed (for WiFi mode,
don‟t forget to use |WIFI, to establish the connection) , and then, you should get a waiting for file…
message on screen:
After finishing transferring the files you want, you can reset Amstrad to exit the program.
File Copy From CPC Function
On PC, after setting and enabling connection, select File copy From CPC function.
Use the Set Save Dir button, to set the save directory for the files transferred from CPC. On Amstrad
CPC, give |2PC RSX command. You will get a files catalogue of the inserted floppy disk:
Use arrows to move between files, <space> to select/unselect a file, and <Return> to execute
transfers of the selected files. By pressing <1>, you will receive DRIVE A file catalogue and by <2> ,
DRIVE B file catalogue.
Finally, with <Caps Lock> you can select/unselect all the files. This is useful if you want to transfer all
files of the disk, or if you want to invert the already selected files (e.g. all selected files will be
unselected, and all other, will be selected).
On the half bottom of the screen, you will get a list of all the selected files. Files from this list, will be
removed one by one, during the transfer process:
Image Copy Function
On PC utility program, select Image copy to CPC function. Press Select Image button to choose a dsk
image. You will get a confirmation that image is loaded successfully:
If you select a non Amsdos image (usually copy protected games) you will by notified that currently
these images are not supported:
Now,give: |DSK RSX command on the CPC, and you will get a message to insert a disk:
By pressing any key, the transfer of the selected image will begin. Using serial speed of 460800bps or
more, it should take less than a minute (~55-56seconds) to transfer a hole 180Kb disk image into any
disk (either CPC/ PC/Apple formatted or unformatted).
Now, as you might already noticed, there is also a Fast Copy check box, right next to Select image
button. By checking this, you can transfer an image to an already Amstrad Formatted disk in just
~40 seconds! If you check Fast Copy, you will be notified, for the format type needed (in most cases is
Data Format) on the disk:
This can be proved very useful if you already transfer a game image to a disk, and you want to transfer
another image on the same disk.
Direct Load Function
By selecting the Direct Load function, you practically convert the HDD of your PC to a huge storage
device for your Amstrad! Through RSX commands you can load or run a program/game (at
INCREDIBLY fast speeds, of ~20kb/sec, e.g. ~4-5 times the actual speed of a 3” disk drive!) ,
save files, delete files, change directories, even access DSK images (at slightly faster speed
than with a real disk drive)!
By giving a simple |EN or |EN2 to your Amstrad, any LOAD, RUN or CAT command you will give, it will
be redirected to PC! Using button Direct Mode Dir, you can set the loading directory and have a list of
all available files in it:
You can also use |CD,‟name‟ command to change directory (or |CD to move up a directory), directly
from you Amstrad!
About ~90% of games can be directly executed using this super fast direct mode. For the rest,
you can always use the dsk image file of the game(although in that case, access is much slower,
usually slightly faster than with a real disk drive/gotek drive).
You can find many dozens of games that already tested here.
As this method requires to have files extracted from dsk image files, i have also included the cpc loader
utility:
Using this, you can easily extract multiple dsk images instantly!
If you try to run/load a file that it doesn‟t exist, or there is an error in loading, Amstrad will give you a
“File already open” error message.
For loading files with .BIN extension, this can be omitted (e.g. you can type: RUNGAME, instead of:
RUNGAME.BIN, regardless of the file having the BIN extension or not). But you must include
extension to load any .BAS files.
If you have any problem loading a game/program, and reseting Amstrad doesn‟t resolve it, try to
turn off/on Amstrad, and if this don‟t work, go to PC program and select momentarily another
function (like terminal) and then set to Direct Load again (this will reinitialize the PC routine in case
it has hang/crash).
Configure Bluetooth Module
You can also use the HC-06 which is a bit cheaper, but it lucks the Set-Up button, which is very useful,
if you want to change the default speed of the module (9600bps).
You can easily find these on ebay or electronics shops for a few euros.
Of course you will need a pair of these, to establish a bluetooth connection between Amstrad CPC and
a PC or another Amstrad CPC. Or, you can use only one module for Amstrad CPC serial interface to
connect with a tablet or a smart phone! ;-)
Connect Bluetooth module to the USB2Serial adapter cable (Red: 5V, Black: Ground, Green: Tx-goes
to Rx pin, White: Rx goes to Tx pin). Then, connect cable‟s usb plug to a free usb port of your PC,
WHILE pressing the setup button. The red led should flash every 2-3 seconds.Now, you should set
serial speed to 38400 by giving |SET command. Then, you can easily configure Bluetooth modules
using a terminal program on PC, or the |COM RSX command on Amstrad.
First give the commands:
AT -You should get respond OK
AT+UART=X,0,0
X, can be 2400,9600,19200,38400,57600,115200,230400,460800,921600. You should get response
OK.
Now, disconnect the Bluetooth module and connect the other one (don‟t forget to press the button while
powering to enter the setup mode).Give the above commands, but also add this one:
AT+ROLE=1 –You should get response OK
This is for making the module Master. In order for two Bluetooth modules to connect to each other, one
must be Master and the other Slave. But Since all BT modules are preconfigured as Slave, you should
change one of them to Master.
Finally, power off and on the BT module (in order to exit from setup mode) and connect the other BT
module to serial interface. After a few seconds, both modules should flash twice every 3-4
seconds. This means that they are connected, and you are ready to go!
Configure ESP8266 WiFi Module
Esp-07 or Esp-01/01S
The latter, will also need this 5v adapter (ESP-01 adapter):
You can easily find any of these, on ebay or many electronics shops, at very cheap prices, of only a few
euros. And remember to connect Tx to serial‟s interface Tx pin, and Rx to Rx pin (no swap of signals
needed).
Now, in order to use WiFi, module must be connected to an Access point and then connect to the TCP
server that is activated by the PC utility program. This can be done either manually (by giving the
appropriate AT commands), using the small terminal utility through |COM command, or more easily, by
giving |WIFI command. Program will first check for the current Wifi module serial speed, and ask you if
you want to change it.
Then, you just give the name and password of the access point (where WiFi module will be connected
to),and then, the ip address and port of the TCP server ,taken from groupbox WiFi Settings in PC
utility window program.
If everything goes well, you will get a connected! message, and then you can directly run and use any
utility you want. If there is a problem connecting to the given Access Point or TCP server, you will be
prompted for retrying or give new settings.
If for any reason you want to change TCP server‟s port number, you can do it from Wifi Settings
group box, (you will have to close and reopen the PC utility for activating the new port setting) .
Note also that, when a WiFi Connection is established, the Connection button will be automatically
enabled and connection type will be set to: Connection: WiFi. You can also have a serial connection
and a WiFi connection both activated at the same time and select which one to use by pressing the
connection type button.
In order to disable WiFi module connection you must first send a single string of: +++ (check
AT+CIPMODE command bellow) and then give the AT command: AT+CIPCLOSE to disconnect from
TCP server.
ESP8266 module use AT commands for control and communication.
You can give all AT commands using terminal program, or directly, using this small BASIC program (a$
is the AT command string):
Note that after giving the AT command, an: out &fbd0,13: out &fbd0,10 (CR and Line Feed) must be
also sent for proper execution!
There is a very big manual with 100‟s of commands available, but bellow, i give you the most useful
commands, for configuring the module manually:
AT+CIPSEND=[link id],x send x bytes. Bytes/chars follow immediately after the command. Link id is
usually 0 for single connections, but can be up to 5 in a LAN situation
AT+CIPCLOSE Closes the TCP/UDP/SSL Connection.
AT+CWLAP Will list access points in range.
AT+CWJAP=yourSSID,yourWifiPassword connects to an access point
AT+CWQAP quit from acess point
AT+UART_CUR=115200,8,1,0,0 (don‟t remain after reboot/power off)
AT+UART_DEF=115200,8,1,0,0 Set UART speed (remains after reboot/power off)
AT+CWMODE = 1 (1 for standard mode , 2 for AccessPoint mode & 3 for both)
AT+CIPMUX=1 (set multiple connections, this must be set to „1‟ if you want to use module as TCP
server)
AT+CIPSERVER=1,80 (start the TCP server at port 80)
AT+CIFSR (shows WiFi module‟s ip/mac address)
ATE0 remove echo (recommended for having WiFi module act as TCP server)
AT+CIPSTO=X (server timeout, range between 0 and 7200, set to large number or 0 for never)
AT+CIPSTART=TCP,Tcp server IP,port no. Connects to a TCP server, useful for connecting many
Amstrad CPC‟s together in a WiFi network!
AT+CWSAP_DEF=<ssid>,<pwd>,<chl>,<ecn> Set up WiFi module‟s Access point
<ssid>: string parameter, SSID of AP.
<pwd>: string parameter, length of password: 8 ~ 64bytes ASCII.
<chl>: channel ID.
<ecn>: encryption method; WEP is not supported.
‣ 0: OPEN
‣ 2: WPA_PSK
‣ 3: WPA2_PSK
‣ 4: WPA_WPA2_PSK
Example: AT+CWSAP_DEF=ESP8266,1234567890,1,3
For more detailed information and examples, you can refer to the AT command manual mentioned
above.
Hints & Tips
- As a general rule, better use RESET button (instead of on/off switch) every time you want to restart
Amstrad. Also this is the proper action for any problem you might encounter.
- If you happen to get an “unknown command” error message, when trying to use any of the RSX
commands, just give: OUT &FBD1,4 and everything should work fine. Just remember to give:
“|EN” again, before load/run/save a game program.
- If you are using a usb device, remember to give “|USB”,every time after pressing RESET button
on the board. However, you DON‟T need to do that, in case of a soft reset (by pressing
<ctrl>+<shft>+<esc>). In either case, interface will remember last directory/dsk image used.
Finally, don‟t forget that, on CPC 464, first time after power on your Amstrad, you should give
“|464”, and then press RESET button. This must be done ONLY once, after initial power up, you
DON‟T need to do it again, no matter how many times you Reset Amstrad (or even turn it off/on by
the switch momentarily)
- Always use UPPERCASE letters with arguments of RSX commands when using a USB
device, for example: |CD,”B” (and not “|CD,”b”). Nevertheless Load and Run commands , support
both upper and lowercase letters.
- For loading files with “.BIN” extension, this can be omitted (e.g. you can type:RUN”GAME”, instead
of:RUN”GAME.BIN”, regardless of the file having the “BIN” extension or not). But you must include
extension to load any “.BAS” files.
- Mind that many games you will find in dsk images (especially newer ones, after late 80‟s) are NOT
designed to run on a CPC464.
- Access to DSK images on a CPC 464 (and generally whenever you use |464 command) would be a
bit slow (~20%-30% slower than a real disk drive) because Interface‟s Microcontroller, need to
emulate both “missing” IC chips of AMSDOS/PARADOS ROM and 765 Floppy Disk Controller, at
the same time! BUT, in direct mode, where you access directly files, you will get the same amazing
loading speeds as with a CPC 664/6128!
- To use arguments with RSX commands on a CPC464, you can‟t pass them directly (this is BASIC‟s
1.0 “problem”), but you need first to assign argument to a variable. For example, if you want to
change directory to “DIR1”, you can‟t just give: |CD,”DIR1” but instead:
A$=”DIR1”
And then:
|CD,@A$