Make your own free website on

Spectrum Cassette, EAR and MIC port, Issue 2 and 3

Research about it I started when I tested some games on different Spectrum emulators: I found that games Abu Simbel Profanation and Rasputin wouldn't start play from the control selection menu.

This program is intended for authors of Spectrum emulators:

10 OUT 254,BIN 11101111
20 PRINT IN 254
30 OUT 254,BIN 11111111
40 PRINT IN 254
50 GOTO 10

For correct test do not press any key while running, and of course have no EAR input.

Note: Issue 2 and Issue 3 are different versions of Spectrum's PCB, but real difference is actually version of ULA chip. Later PCB versions use same ULA as Issue 3, so behavior is also same.

The only correctly responding emulator which I found is zx32 by Vaggelis Kapartzianis: in this test this emulator acts exactly like an Issue 2, and also zx32 was the only emulator which correctly started Abu Simbel Profanation and Rasputin. (I tested x128 v0.8, Z80 v3.05, Warajevo v1.5, UKV, JPP, ZX-JAM, WSpecem, SP2 and VGASpec.)

By port 254,  the ULA chip uses the same pin for 3 functions: MIC output, EAR input and internal speaker drive. That's why OUT 254 or sound generation affects bit 6 when it is read by IN 254. 

In Z80.DOC by Gerton Lunter (which is the reference for most other documents) are some errors:

What is missing from Z80.DOC is the fact that not only the input level at EAR affects bit 6 by IN 254. Bits 3 and 4 from the previous OUT 254 also have an effect, and there is little difference between Issue 2 and 3, and it isn't something like the inversion of the EAR input.

    The difference between Issue 2 and 3 is:

            Truth table:

Out b4 Out b3 In Is2 In Is3 Is2 V Is3 V
1 1 1 1 3.79 3.7
1 0 1 1 3.66 3.56
0 1 1 0 0.73 0.66
0 0 0 0 0.39 0.34

Out b4 and Out b3 are output bits.  In Is2 is value of bit 6 by IN (254), after propriety OUT by Issue 2, and Is3 is same that - by Issue 3.     Is2 V  and  Is3 V  are voltage levels on pin 28 of ULA chip after propriety OUT,  without input signal on EAR. This is common pin for MIC, EAR and internal speaker.

I tested on which level on pin 28 input bit 6 changes from 0 to 1 or reverse. This is   exactly 0.7 Volts by Issue 2 and same by Issue 3 , and no inverting, no hysterezis:

Iinput bit 6 is 1 if voltage on pin 28 is over 0.7 Volt, else is 0 - by both Issues.

On hardware level  only difference between Issue2 and 3 is this: there are little higher voltages by Issue 2. You may see in table , by input combination: 0 1  that voltage values are near around that 0.7 V. 

By faster programs situation isn't so simple, there is some delay when output bit 4 changes from 1 to 0. And games are written mostly in assembler. To illustrate it here are 2 short assembler routines:

      ORG 45000
LD A,#18  ;OR #F8 e.g.
OUT (254),A
LD A,#08  ;OR #E8
OUT (254),A

TIMING  LD B,7 ;crucial value
DL     LD IX,0

 IN A,(254) ;query state

 In this case IN A,(254) - output gives sometimes 255, sometimes 191. If you change 'crucial value' in line TIMING to a smaller one, then the result will be always 255, if delay is longer (B>7) then the result will be always 191. Of course this is valid only for Issue 3.  The  situation is something different by longer duration of high output level on port 254:

   ORG 50000
HALT  ;sync.
LD A,#18
OUT (254),A
HALT   ;delay 20ms

LD A,#08
OUT (254),A 

TIMING  LD B,107  ;crucial value
DL    LD IX,0    

IN A,(254)

   As you may see, after longer high level duration -  delay is also much longer.   So delay varies approximately from  180 T states (about 50 microsec.) to 2800 T states (about 800 microsec.) - depending from the duration of high level on port 254.   Explanation for this delay are capacitors connected between pin 28 of ULA and EAR and MIC connectors.
By changing from 0 to 1 (bit 4 by OUT) no delay. 

In the ROM 'Beeper' subroutine, at address #03CF there is instruction OR 8, which is before OUT (#FE),A , and this routine is activated every time when you type character in Basic; And it is the reason (with all above) why IN 254 on an Issue 2 normally gives 255, and 191 on an Issue 3.

(Written somewhere in 1999...  Modified in August 2005, mostly grammar)

  Situation with emulators in August 2005:

Spectaculator 6.25   -  OK.
Spin  V0.504   - OK, however 'Issue 2 switch' is made in confusing way (48K = Issue 2, above models are Issue 3).
SpecEmu V 2.3  - No Issue 2, should be in 2.4...
Spectrum Anywhere V1.1  - No Issue 2.
EmuZWin   v2.5  -  no Issue 2.
RealSpec  - OK.
Klive  - OK.
YASE - No Issue 2, no ambition...
VBSpec 1.8  -  No Issue 2.
Z80 for Win  - OK. See emulator site about where to download free full version!
ASpectrum  -  No Issue 2.
Delphi Spec  V 0.3  - No Issue 2.
DSP  v 0.3  - Although there is something about keyboard bit 6 in files, Abu Simbel works not.
ESpectrum v 0.6beta  -  OK.
WinZX32 V 0.1  - No Issue 2.
ZX82 v0.2  - No Issue2.
Fuse 0.7.0  (V 7 in English)  - OK.  This is Unix/Mac OS emulator.

Let authors correct me if I'm wrong somewhere. I tested only Windows emulators, newer ones. (except Z80 Win, which is from 1999), and Fuse (Linux). Will not test more alphas like V 0.1 and similar...
Result is 10:7  for no support :-(

Back to start page