Contents |
ZX80/ZX81 |
ZX80/ZX81 Models |
CPU: NEC P1X108-144 D780C-1 (Z80 compatible) 3.25MHz The clock frequency is gained from a high tolerance 6.5MHz chewing gum, not exactly a quartz oscillator, in fact, my oscilloscope tells me that my ZX81 is running at 3.33Mhz. Effective CPU Speed in SLOW mode (when Display is enabled) For 50Hz Display Refresh: 0.804600 MHz For 60Hz Display Refresh: 0.536400 MHz Custom: FERRANTI ULA 2C184E 8147 Combines the ZX80 video circuit in one chip, plus NMI-generator Video Tech Data Video: 32x24 Characters (256x192 pixels), 64x48 Dots Block Graphics Characters: 64 Characters, defined in ROM area Attributes: Normal and Inverted (separately for each char) Memory 8 Kbytes ROM 1 KByte RAM built-in Expanision RAM: 16KBytes (most popular) up to 56KBytes |
TK80 ZX80 clone with 4K ROM, 1K RAM, TTL-chips, without NMI TK82 ZX80 clone with 4K ROM, 2K RAM, TTL-chips, without NMI TK82-C ZX81 clone with 8K ROM, 2K RAM, TTL-chips, with NMI on daughterboard TK83 ZX81 clone with 8K ROM, 2K RAM, ULA-chip, with NMI,joystick,new case TK85 ZX81 clone with 10K ROM, 16K RAM, psg-solder-points, rubber keyb, and other extras... |
ZX80/ZX81 Keyboard Assignment |
<-key-> <------------- ZX81 -----------> <------ZX80------> NORMAL COMMAND SHIFT FUNCTION GRAPHICS ZX80/CMD ZX80/SHFT 1 1 <edit> -- 1000 1 NOT 2 2 AND -- 0100 2 AND 3 3 THEN -- 0001 3 THEN 4 4 TO -- 0010 4 TO 5 5 <left> -- 0101 5 <left> 6 6 <down> -- 0011 6 <down> 7 7 <up> -- 1100 7 <up> 8 8 <right> -- 0101 8 <right> 9 9 <graphics> -- -- 9 <hide???> 0 0 <rubout> -- -- 0 <rubout> Q PLOT "" SIN 0111 NEW 1010 W UNPLOT OR COS 1011 LOAD 0011 E REM STEP TAN 1110 SAVE 1000 R RUN <= INT 1101 RUN 0100 T RAND <> RND 0110 " " 0022 Y RETURN >= STR$ 1001 REM " U IF $ CHR$ -- IF $ I INPUT ( CODE -- INPUT ( O POKE ) PEEK -- PRINT ) P PRINT " TAB -- "?" * A NEW STOP ARCSIN 2222 LIST 2222 S SAVE LPRINT ARCCOS 2200 STOP 0110 D DIM SLOW ARCTAN 0022 DIM 0010 F FOR FAST SGN 2211 FOR 0001 G GOTO LLIST ABS 1122 GO TO 2200 H GOSUB ** SQR 2222 POKE ** J LOAD - VAL -- RANDOMISE - K LIST + LEN -- LET + L LET = USR -- "?" = ENTER newline function -- newline <edit> SHIFT -- -- -- -- -- -- Z COPY : LN -- "?" : X CLEAR ; EXP -- CLEAR ; C CONT ? AT -- CLS ? V CLS / -- -- GO SUB / B SCROLL * INKEY$ -- RETURN OR N NEXT < NOT -- NEXT < M PAUSE > PI -- "?" > . , -- -- "." , SPACE BREAK pound -- 1111 BREAK pound |
| 1 2 3 4 5 6 7 8 9 0 | | Q W E R T Y U I O P | | A S D F G H J K L ENTER| |SHF Z X C V B N M . SPACE| |
ZX81 ZX80 PC EDIT NOT ! AND AND & THEN THEN # TO TO % |
ZX80/ZX81 I/O Map |
xx0Fh.W PSG data (Bi-Pak ZON-X81 Sound) xx1Dh.R Zebra Joystick adapter xx2Fh.R Memopak I/F Centronics Interface status (IN status,[dd3Fh]);dd=data xx3Fh.R Memopak I/F Centronics Interface finish (IN dummy,[dd3Fh]) ;dd=data FF7Eh.R Lambda - read PAL/NTSC flag (A7=row) (via diode from A7 to KEYB.0) xx9Fh.W PSG index (Timedata ZXM Sound Box) xxBFh.R PSG data (Timedata ZXM Sound Box/Joystick Read) xxDFh.W PSG index (Bi-Pak ZON-X81 Sound) (default address) (sometimes CFh) xxDFh.W PSG data (Timedata ZXM Sound Box) xxDFh.R Mikro-Gen digital joystick xxDFh.R AGB - JOYSTICK II (port A) (or B ?) xxEFh.R AGB - JOYSTICK II (port B) (or A ?) xxF5h.R Lambda - toggle sound output level xxF5h.W Lambda - select charset line number (00..07) xxF6h.R Lambda - read selected charset data (8 pixels) xxF6h.W Lambda - select charset char number (00..3F) xxFBh.R Sinclair Printer Status xxFBh.W Sinclair Printer Output xxFDh.W Disable NMI (ZX81 only) xxFEh.W Enable NMI (ZX81 only) NNFEh.R Keyboard read, when NMI=Off: also enter VSYNC and set CAS.OUT=Low xxFFh.W Terminate Vsync and restart LINECNTR and set CAS.OUT=High |
0Eh.R Faulty mirror of FEh.R (used by a GRAND-PRIX game) CFh.W PSG index (Bi-Pak ZON-X81 Sound) (used accidently in Bi-Pak manual) CFh.W PSG index (Bi-Pak ZON-X81 Sound) (used by Lunar 10) FEh.W Faulty mirror of FFh.W (used by animated Space Invaders for ZX80) |
3E80h.R/W Mikro-Gen analog joystick A/D board 7FFFh.W PSG index (Quicksilva QS Sound board) 7FFEh.R/W PSG data (Quicksilva QS Sound board) |
I=00h Pseudo HiRes (Madjump II) I=08h Pseudo HiRes (Bipods, Micromouse) I=0Ch Pseudo HiRes (Rock Crush, Dans Revenge, etc.) I=1Eh ZX81 ROM Charset (or QS CHRS board RAM) I=2xh dk'tronics UDG ROM (or unknown UDG RAM) I=3xh dk'tronics UDG RAM I=40h Xtricator IM2 vector at [40FFh] (with databus assumed to be FFh) IR=x True hires bitmap address R=x Interrupt counter for "compressed" text output (INT wired to A6) R=x+EI Interrupt execution forces HSYNC (on ZX81: also resets NMI counter) |
ZX80/ZX81 I/O Ports |
Bit Expl. 0-4 Keyboard column bits (0=Pressed) 5 Not used (1) 6 Display Refresh Rate (0=60Hz, 1=50Hz) 7 Cassette input (0=Normal, 1=Pulse) |
Port____Line____Bit__0____1____2____3____4__ FEFEh 0 (A8) SHIFT Z X C V FDFEh 1 (A9) A S D F G FBFEh 2 (A10) Q W E R T F7FEh 3 (A11) 1 2 3 4 5 EFFEh 4 (A12) 0 9 8 7 6 DFFEh 5 (A13) P O I U Y BFFEh 6 (A14) ENTER L K J H 7FFEh 7 (A15) SPC . M N B |
Bit Expl. 0 Data Request (0=Busy, 1=Ready/DRQ) 1-5 Not used 6 Printer Detect (0=Okay, 1=None) 7 Newline (0=Nope, 1=Begin of new line) |
Bit Expl. 0 Not used 1 Undoc/Speed? (0=Normal, 1=used to slow-down last 2 scanlines) 2 Motor (0=Start, 1=Stop) 3-6 Not used 7 Pixel Output (0=White/Silver, 1=Black) |
ZX80/ZX81 Video Mode Text and Blockgraphics |
ZX80/ZX81 Video Mode Pseudo Hi-Res Graphics |
ZX80/ZX81 Video Mode True Hi-Res Graphics |
ZX80/ZX81 Video Blanking and Retrace |
ZX80/ZX81 Video Interrupts (INTs and NMIs) |
ZX80/ZX81 Video Display Timings |
Horizontal Display 128 cycles (32 characters, 256 pixels) Horizontal Blanking 64 cycles (left and right screen border) Horizontal Retrace 15 cycles Total Scanline Time 207 cycles |
Upper Blanking 11592 cycles 56 scanlines (7 charlines) Display Area 39744 cycles 192 scanlines (24 charlines) Lower Blanking ca.11592 cycles ca. 56 scanlines (or a bit less) Vertical Retrace 1235 cycles ca. 6 scanlines |
Upper Blanking 6624 cycles 32 scanlines (4 charlines) Display Area 39744 cycles 192 scanlines (24 charlines) Lower Blanking ca. 6624 cycles ca. 32 scanlines (or a bit less) Vertical Retrace 1235 cycles ca. 6 scanlines |
Item Original ZX81 Tuned ZX81 Total scanline time 207 cycles 207 cycles NMI WAIT - 14 cycles - 0 cycles (WAITMOD by Wilf Rigter) NMI CALL 66h - 12 cycles - 12 cycles NMI handler - 32 cycles - 29 cycles (NMIPATCH by Nocash) Remaining user time = 149 cycles = 166 cycles |
SLOW, 50Hz Effective Speed 0.804600 MHz (54*2*149 cycles, 50 frames) (ori) SLOW, 50Hz Effective Speed 0.896400 MHz (54*2*166 cycles, 50 frames) (tuned) SLOW, 60Hz Effective Speed 0.536400 MHz (30*2*149 cycles, 60 frames) (ori) SLOW, 60Hz Effective Speed 0.597600 MHz (30*2*166 cycles, 60 frames) (tuned) FAST, Total CPU Speed 3.250000 MHz (display disabled) ZX80/PAUSE/INPUT 0.0 MHz (user program stopped) |
ZX80/ZX81 Video Character Set |
____0___1___2___3___4___5___6___7___8___9___A___B___C___D___E___F____ 00 SPC [' ][ '][''][. ][: ][.'][:']{::}{..}{''} " GBP $ : ? 0F 10 ( ) > < = + - * / ; , . 0 1 2 3 1F 20 4 5 6 7 8 9 A B C D E F G H I J 2F 30 K L M N O P Q R S T U V W X Y Z 3F |
____0___1___2___3___4___5___6___7___8___9___A___B___C___D___E___F____ 00 SPC " [: ][..][' ][ '][. ][ .][.']{::}{..}{''}GBP $ : ? 0F 10 ( ) - + * / = > < ; , . 0 1 2 3 1F 20 4 5 6 7 8 9 A B C D E F G H I J 2F 30 K L M N O P Q R S T U V W X Y Z 3F |
ZX81 Video Nonstandard UDG/CHRS Expansions |
Asteroids Centipede Defender Meteor Storm Space Invaders Character Development System (aka UDG, User Defined Graphics editor) |
Centipede Peckman (this one probably requires the Kayde-ROM with Pac-Man symbols) Space Invaders |
ZX81 Video Nonstandard HIRES Expansions |
ZX81 Video Nonstandard Picture Size |
Highres Chess (192 hires lines, plus 1-2 text lines) Maxdemo (splits hires/text regions) |
ZX81 Video Nonstandard Color Expansions |
White plays 4 or CHR invested $ 160 Yellow key 5 or CHR $ 161 Light Blue plays 6 or CHR $ 162 Green light touch 7 or CHR $ 163 Fusch plays 8 or CHR $ 164 Red key 9 or CHR $ 165 Keyboard has blue or CHR $ 166 Dark gray or key B CHR $ 167 CHR turn gray or C $ 168 Kaki plays D or CHR $ 169 Cyan play E or CHR $ 170 Green plays or F CHR $ 171 Magenta G plays or CHR $ 172 Carmin playing H or CHR $ 173 And navy blue key or CHR $ 174 Black J key or CHR $ 175 |
10 PRINT CHR $ 173 20 PRINT "THREE" |
ZX81 Joystick Expansions |
Port_Joystick_Type___________________________7_6_5_4_3_2_1_0___Data Bits___ EFFE Nocash A12 joystick (keys 6,7,8,9,0) - - - D U R L F (0=Pressed) EFFE AGF (cursor mode, A12, keys 6,7,8,0) - - - D U R - F (0=Pressed) F7FE AGF (cursor mode, A11, key 5) - - - L - - - - (0=Pressed) DFFE AGF (2nd Joystick, A13, keys Y,U,I,P) - - - D U R - F (0=Pressed) FBFE AGF (2nd Joystick, A10, key T) - - - L - - - - (0=Pressed) nnFE PC8300 (ZX81 clone using A9..A13, bit3) - - - - x - - - (0=Pressed) xx1D Zebra Joystick - - - F R L D U (0=Pressed) xxBF Timedata ZXM Sound Box, PSG Reg 14 0 F U D L R y x (0=Pressed) xxDF Mikro-Gen (Digital joystick)(Frogs) - - - F L R D U (0=Pressed) MEM Mikro-Gen (Analog joystick) F a a a a a a a (analog) MEM Quicksilva Sound Board, PSG Reg 15 ? ? ? ? ? ? ? ? (?=Pressed) ???? Microdigital TK83/TK85 (DIN socket) ? ? ? ? ? ? ? ? (?) |
IN (xxDFh) -- bits 1,2 // lunar: bit2,3,4 xx == select something ? |
00h Axis 0 (request vertical position, and bit7=not used) 01h Axis 1 (request horizontal position, and bit7=Fire button 1=Pressed) ??h Axis 2,3 (for second joystick) (not used by any games) |
returns 7bit analog for selected axis (and bit7=fire, if any) vertical: 00h..7Fh = up..down horizontal: 00h..7Fh = left..right |
Space Invaders (Mikro-Gen) (uses analog value as screen position) Scramble (Mikro-Gen) (converts analog value to digital move/no move) Bomber (Mikro-Gen) (supports both digital and analog joysticks) Croaka Crawler (aka Hopper) (Quicksilva) |
Lunar Rescue (Mikro-Gen) Frogs (Mikro-Gen) Bomber (Mikro-Gen) (supports both digital and analog joysticks) Tempest (also does a single read from 3E80h, but otherwise supports DFh only) |
5-6-7-8-0 Joystick 1 (Cursor keys & rubout) T-Y-U-I-P Joystick 2 (same data bits as above, but other address lines) |
Reportedly: Use the $DF & $EF IN IRQ Port. Port A: Press "5" LEFT "6" DOWN "7" UP "8" RIGHT "New/Line" FIRE Port B: Press "A" LEFT "S" DOWN "W" UP "D" RIGHT "F" FIRE |
0 up (0=Pressed) 1 down (0=Pressed) 2 left (0=Pressed) 3 right (0=Pressed) 4 fire (0=Pressed) 5-7 |
1 REM 123456789 2 POKE 16514,219 DB ;\IN A,[1Dh] 3 POKE 16515,29 1D ;/ 4 POKE 16516,47 2F ;-CPL 5 POKE 16517,230 E6 ;\AND A,1Fh 6 POKE 16518,31 1F ;/ 7 POKE 16519,6 06 ;\LD B,0 8 POKE 16520,0 00 ;/ 9 POKE 16521,79 4F ;-LD C,A 10 POKE 16522,201 C9 ;-RET 20 PRINT USR 16514; |
ZX81 Sound Expansions |
F = 1625000 Hz / 16 / nnn |
OUT (CFh or DFh),A ;index OUT (0Fh),A ;data (w) |
Cosmic (brazilian magazine Revista Micro Sistemas, Oct/1986) Lunar 10 (brazilian magazine Revista Micro Sistemas, Nov/1986) |
F = 100000 Hz / nnn ;approximately, according to manual |
OUT (159),A ;9F index ;\same addresses for ZX81 and Spectrum, ZX81 OUT (223),A ;DF data (w) ; accesses via POKE+USR, Spectrum via OUT token IN A,(191) ;BF data (r) ;/ <--- for joystick port |
Pin Bit 1 PSG.PortA.Bit5 up / forward 2 PSG.PortA.Bit4 down / back 3 PSG.PortA.Bit3 left 4 PSG.PortA.Bit2 right 5 PSG.PortA.Bit1 general purpose (usually 1) (C64: Pot Y) 6 PSG.PortA.Bit6 Fire 7 +5V 8 GND 9 PSG.PortA.Bit0 general purpose (usually 1) (C64: Pot X) |
Sound Box Super Editor (Timedata) (zxm demo tape & type-in listing in manual) |
7FFFh index (W) 7FFEh data (R/W) |
Cosmic Guerilla (Quicksilva) Croaka (aka Hopper) (Quicksilva) Defenda (Quicksilva) Space Invaders Asteroids (Quicksilva) (also supports PSG reg 15 as alternate joystick) Scramble (Quicksilva) |
But... |
ZX80/ZX81 Memory Map and System Area |
0000-1FFF BIOS ROM (8KBytes) 2000-3FFF not used 4000-43FF Internal RAM (1 KByte) 4000-7FFF External RAM (16 KBytes) |
4000 System Area (see below) 407D BASIC Program D_FILE Video Memory (BG Map) VARS BASIC Variables E_LINE-1 Byte 80h E_LINE Input Buffer/Workspace STKBOT BASIC Calculator Stack STKEND Machine Stack/Free Memory SP Machine Stack/In Use (SP is meant to be the CPUs SP register) ERR_SP GOSUB Stack RAMTOP USR Programs (Begin of unused/reserved memory) |
Addr. Name Expl 4000 ERR_NR Errorcode-1 4001 FLAGS Various BASIC Control flags Bit0=used (purpose unknown) Bit1=Redirect Output to printer Bit2=used (purpose unknown) Bit3-5=not used Bit6=used (purpose unknown) Bit7=used (purpose unknown) 4002 ERR_SP Pointer to top of Machine Stack / Bottom of GOSUB Stack 4004 RAMTOP Pointer to unused/free memory (Changes realized at next NEW or CLS) 4006 MODE Selects [K], [L], [F], or [G] Cursor 4007 PPC Line Number of most recently executed BASIC line ---Begin of Save Area--- 4009 VERSN Should be 00h to identify ZX81 cassette files (FFh=Lambda) 400A E_PPC Line Number of currently selected line [>] Cursor 400C D_File Pointer to Video Memory (BG Map) / End of Basic Program 400E DF_CC Pointer to VRAM Address for PRINT 4010 VARS Pointer to BASIC Variables Area 4012 DEST Pointer to Variable when assigning a value to it 4014 E_LINE Pointer to Input Buffer/Workspace, and to --End of Save Area-- 4016 CH_ADD Pointer to next interpreted character 4018 X_PTR Pointer to character prior to [S] Symbol (=Syntax Error) (or ptr to aborted/breaked line) 401A STKBOT Pointer to BASIC Calculator Stack / End of Input Buffer/Workspace 401C STKEND Pointer to bottom of Machine Stack / End of Calculator Stack 401E BERG Calculator B-Register 401F MEM Pointer to Calculator Memory (usually same as MEMBOT) 4021 - Not used 4022 DF_SZ Number of lines in lower display section (including 1 blank line) 4023 S_TOP Line Number of first line for automatic LISTing 4025 LAST_K Keyboard - Recently pressed key (4025=row, 4026=shift/column) 4027 DEBOUN Keyboard - Debounce State (key release delay) 4028 MARGIN Vertical Border Height (55 lines at top/bottom for 50Hz, 31 for 60Hz) 4029 NXTLIN Address of next BASIC line which is to be executed, pointing to a byte >=40h when stopped, indicates autostart address in cassette files. 402B OLDPPC Line Number for CONT 402D FLAGX Various Flags Bit0 used (purpose unknown) Bit1 used (purpose unknown) Bit2-4 not used Bit5 used (purpose unknown) Bit6 used (purpose unknown) Bit7 not used 402E STRLEN Length of string during assignment 4030 T_ADDR Pointer to next item in Syntax Table (or INPUT's old S_POSN) 4032 SEED Random Number Seed 4034 FRAMES Decrementing Video Frame Counter (Bit15: 0=PAUSE, ie. display ON, program PAUSEd) 4036 COORDS X-Coordinate of last PLOT, Y-Coordinate of last PLOT 4038 PR_CC Least significant byte of PRBUFF printer buffer pointer 4039 S_POSN X-Coordinate for PRINT, Y-Coordinate for PRINT 403B CDFLAG Various Flags Bit7: Current Speed (1=SLOW (Display Enable), 0=FAST) Bit6: Requested Speed (or old speed during pause/cassette io, etc) Bit5-1: Not used Bit0: Keystroke (0=None, 1=Yes) 403C PRBUFF Printer Buffer 32 characters + NEWLINE (76h) 405D MEMBOT Default workspace for BASIC Calculator 407B - Not used (2 bytes) |
4000..4027 System Area 4028..(4008)-1 Basic Program (4008)..(4004 or 400A)-1 VARS (4004 or 400A)..(400C)-1 Input Buffer, and probably something else ??? (400C)... VRAM ... |
4000 ERR_NR Error Number (one less than report code) 4001 FLAGS Various Flags to control BASIC System 7 1-Syntax off 0-Syntax on 6 1-Numeric result 0-String result 5 1-Evaluating function (not used) 3 1-K cursor 0-L cursor 2 1-K mode 0-L mode 0 1-No leading space 0-Leading space 4002 PPC Line number which is to be executed next (bit15: 1=stopped) 4004 P_PTR Position in RAM of [K] or [L] cursor 4006 E_PPC Line Number of current line with [>] cursor (for LIST) 4008 VARS Address of start of variables area (end of BASIC Program) 400A E_LINE Address of start of Edit Line (end of VARS) (-save area end-) 400C D_FILE Start of Display File (VRAM) (end of Edit Line/Input Buffer) 400E DF_EA Address of the start of lower screen 4010 DF_END Display File End 4012 DF_SZ Number of lines in lower screen 4013 S_TOP The number of first line on screen 4015 X_PTR Address of the character preceding the [S] marker 4017 OLDPPC Line number to which CONTINUE jumps 4019 FLAGX More flags. 7 1-K mode 0-L mode 6 1-Numeric result 0-String result 5 1-Inputting 0-Editing 401A T_ADDR Address of next item in syntax table 401C SEED The seed for the random number 401E FRAMES Count of frames shown since start-up (incrementing) 4020 DEST Address of variable in statement ---Active/Basic: 4022 RESULT Value of the last expression 4024 S_POSN_X Column number for print position 4025 S_POSN_Y Line number for print position 4026 CH_ADD BASIC program pointer (address of next char/token) ---Pause/Input: 4022 - Keyboard debounce 4023 MARGIN Screen border height 4024 ? 4026 LAST_K Keyboard last key pressed (4026=row, 4027=column) |
ZX80/ZX81 Memory Mirrors and Expansions |
address code read write 0000..1FFF ROM ROM --- ;all ZX81's 2000..3FFF RAM4 RAM4 RAM4 ;ZX81 with 56K only 4000..7FFF RAM1 RAM1 RAM1 ;ZX81 with 16K or more RAM 8000..BFFF VRAM2 RAM2 RAM2 ;ZX81 with 32K or more RAM C000..FFFF VRAM1 RAM3 RAM3 ;ZX81 with 48K or more RAM (*) (*) That, for the RAM3 part, VRAM1 is of course found in all ZX with 16K |
ZX80/ZX81 Memory Binary Data/Machine Code Programs |
ZX80/ZX81 Cassette File Images |
ZX80/ZX81 Cassette File Content |
4014h defines the end address (used to calculate the file length) 4029h points to the next executed (autostarted) BASIC line 403Bh indicates if program runs in SLOW or FAST mode (bit 6) |
;nocash LD H,L trick for autostarting ZX80 files, 9/2009 by martin korth 4000h 8 x 00h ;System area: Zerofilled stuff 4008h 402Ch ;System area: Pointer to VARS 400Ah nn3Dh ;System area: Pointer to End of file 400Ch 1Ch x 00h ;System area: Zerofilled stuff 4028h 00h,01h,65h,76h ;BASIC program: Line 0001, LD H,L opcode, NEWLINE 402Ch 80h ;VARS area: End code 402Dh 13h x 00h ;Unused/padding (for entryoint 4040h) 4040h ... ;Machine code (entrypoint at 4040h) xxxxh (xx3Dh-$) x 00h ;Unused/padding (for end address xx3Dh) xx3Dh ;End of file (must be at xx3Dh) |
ZX80/ZX81 Cassette Signals |
x seconds your voice, saying "filename" (optional) x seconds video noise 5 seconds silence (only some clock cycles required for ZX81) 1-127 bytes filename (bit7 set in last char) LEN bytes data, loaded to address 4009h, LEN=(4014h)-4009h. 1 pulse video retrace signal (only if display was enabled) x seconds silence / video noise |
x seconds your voice, saying "filename" (optional) x seconds video noise 5 seconds silence (at least 0.5 seconds REQUIRED for ZX80) LEN bytes data, loaded to address 4000h, LEN=(400Ah)-4000h. x seconds silence / video noise |
0: /\/\/\/\________ 1: /\/\/\/\/\/\/\/\/\________ |
Hardware, Connectors, Upgrading |
HW External Connectors |
Ring: Shield Tip: TV Signal |
Ring: Ground Tip: Cassette Input |
Ring: Ground Tip: Cassette Output |
Ring: Ground Tip: 9V DC |
Upper Side Lower Side 1A D7 1B 5V DC 2A /RAM CS 2B 9V DC 3A ---SLOT--- 3B ---SLOT--- 4A D0 4B 0V 5A D1 5B 0V 6A D2 6B CLK 7A D6 7B A0 8A D5 8B A1 9A D3 9B A2 10A D4 10B A3 11A /INT 11B A15 12A /NMI 12B A14 13A /HALT 13B A13 14A /MREQ 14B A12 15A /IORQ 15B A11 16A /RD 16B A10 17A /WR 17B A9 18A /BUSAK 18B A8 19A /WAIT 19B A7 20A /BUSRQ 20B A6 21A /RESET 21B A5 22A /M1 22B A4 23A /REFSH 23B /ROM CS |
HW Internal Pins |
Pin 1-8: A15, A14, A8, A13, A9, A12, A10, A11. Pin 9-13: KBD0, KBD1, KBD2, KBD3, KBD4. |
0V sync 2.5V black 5V white |
2.5V sync 3.7V black 5.0V white |
0.0V sync 0.5V black 1.0V white |
1 A7' 2 A8' 3 A2' 4 A1' 5 A0' 6 /RD 7 /IORQ 8 /WR 9 /MREQ 10 M1 11 A14 12 /RAMCS 13 /ROMCS 14 OSC (EXPANSION) 15 /NMI 16 TV/TAPE 17 /HALT 18 A15 19 D7 20 TAPE.IN 21 D6 22 /NTSC 23 D5 24 D4 25 KDB4 26 D3 27 KDB3 28 D2 29 KDB2 30 D1 31 KDB1 32 D0 33 KBD0 34 GND 35 OSC (CERAM) 36 A3' 37 A4' 38 A5' 39 A6' 40 +5V |
HW Replacing the ZX81 ROM by an EPROM |
HW 56K RAM Upgrade |
____ __________________________________ /M1 ----|AND \__|__ ____ ____ RAM A15 A15 ----|____/ |OR \______|INV \_____ ____ A14 ----|OR \_____|____/ | |____/ ___|OR \___ /RAMCS A13 ----|____/ | | |____/ /MREQ --|AND \_____________ | ________|___|OR \___ /ROMCS /RFSH --|____/ |_____________|____/ |
HW Connecting a Joystick |
HW Making the ZX81 Faster |
------- R1 ---------------- /HALT CPU.18 |
----+-- R1 ------+--/cut/-- /HALT CPU.18 | ___ | +-----|C | +--------- GND | B|_____________ VCC--10K--|E__| /WAIT CPU.24 |
<---- Original NMI Handler ----> <----- Tuned NMI Handler -----> 0066 08 ex af,af 0066 08 ex af,af 0067 3C inc a 0067 3C inc a 0068 FA 6D 00 jp m,@@blah 0068 28 02 jr z,@@zero 006B 28 02 jr z,@@zero 006A 08 ex af,af @@blah: 006B C9 ret 006D 08 ex af,af @@zero: 006E C9 ret 006C 08 ex af,af @@zero: 006D F5 push af 006F 08 ex af,af 006E C5 push bc 0070 F5 push af 006F D5 push de 0071 C5 push bc 0070 E5 push hl 0072 D5 push de 0071 2A 0C 40 ld hl,[400Ch] 0073 E5 push hl 0074 CB FC set 7,h 0074 2A 0C 40 ld hl,[400Ch] 0076 76 halt 0077 CB FC set 7,h 0077 C3 7A 00 jp @@blah 0079 76 halt @@blah: 007A D3 FD out [0FDh],a 007A D3 FD out [0FDh],a 007C DD E9 jp ix 007C DD E9 jp ix |
1) Decrease Vertical Picture Size, increase upper/lower blanking accordingly 2) Decrease Vertical Retrace Time, increase upper blanking accordingly 3) Decrease Frame Rate by increasing upper/lower blanking |
HW Upgrading RamPaks for True Hi-Res Graphics |
ZX81.+5V --------------------+-----+---- RAMPACK.+5V | | ZX81./RFSH ----|<|---+--[4K7]--+ +---- RAMPACK./RFSH ;ALWAYS HIGH | ZX81./RD ----|<|---+-------------------- RAMPACK./RD ;/RD AND /RFSH |
HW Connecting a Monitor |
HW Getting rid of the 9V DC Power Supply |
HW Uploading Programs from the PC to the ZX81 |
1 PC with Parallel Port, and a normal Centronics Printer Cable 1 Centronics plug (36 pins, female) 1 EPROM (2764 non-CMOS) and EPROM burner (optional) 6 Diodes (for example 1N4148, ie. the most cheapest standard ones) and some short isolated wires |
ZX Mainboard Side Centronics Side Cassette Input (EAR) ------------- Centr.Pin2 (D0) Keyb Col0/Pin9 (CLK) -----|>|----- Centr.Pin3 (D1) Keyb Col1/Pin10 (D0) -----|>|----- Centr.Pin4 (D2) Keyb Col2/Pin11 (D1) -----|>|----- Centr.Pin5 (D3) Keyb Col3/Pin12 (D2) -----|>|----- Centr.Pin6 (D4) Keyb Col4/Pin13 (D3) -----|>|----- Centr.Pin7 (D5) Expansion 21A (RESET) -----|>|----- Centr.Pin8 (D6) ROM Pin26 (A13) ------------- Centr.Pin9 (D7) (LO=ZX80, HI=ZX81) VCC ----[10K]---- Centr.Pin9 (D7) Expansion 4B/5B (GND) ------------- Centr.Pin24 (GND) _______ CPU.Pin36 (A6) --|D1 Q1|-- Centr.Pin10 (ACK) CPU.Pin20 (/IORQ) --|CK1 | CPU.Pin26 (/RESET) --|SET1 | 74LS74 FlipFlop VCC ---------------------|RES1 | |_______| |
ZX Spectrum |
Spectrum Models |
1982 Spectrum 16K - original low-cost version (only 16K RAM) 1982 Spectrum 48K - original full version (48K RAM) 1984 Spectrum + - new keyboard, reset button 1985 Spectrum 128 - 128K-RAM,PSG,MIDI,RS232,RGB,32K-ROM 1986 Amstrad +2 (typewriter keyboard, built-in cas drive, two joy ports) 1987 Amstrad +2A (manufactured in Taiwan) (+3 style mainboard, Centronics) 1987 Amstrad +2B (same as +2A but manufactured in China instead of Taiwan) 1987 Amstrad +3 (more ROM, RAM map-able at 0000h for CP/M, built-in disk) |
1983 TS2068 special video modes, timex bios, PSG, 48K RAM, NTSC (USA) 1984 TC2068 special video modes, timex bios, PSG, 48K RAM, PAL (Portugal) 1984 TC2048 special video modes, spectrum bios, no PSG, 16K RAM, PAL (Portu.) |
Spectrum I/O Map |
Port Binary Address Dir Description xxFF ................ R Spectrum Current VRAM Data (dirt effect) xxFE nnnnnnnn.......0 R Spectrum ULA (Keyboard, and CAS Input) xxFE ...............0 W Spectrum ULA (Border Color, Speaker/CAS Output) F7FE ....0..........0 R Spectrum +2/+2A/+3 Joystick 2 EFFE ...0...........0 R Spectrum +2/+2A/+3 Joystick 1 F7FE ...10..........0 R Interface 2 Joystick 2 EFFE ...01..........0 R Interface 2 Joystick 1 FFFD 11............0. W Spectrum 128K/+2/+2A/+3 PSG index register FFFD 11............0. R Spectrum 128K/+2/+2A/+3 PSG data read (and RS232) BFFD 10............0. W Spectrum 128K/+2/+2A/+3 PSG data write (and RS232) 7FFD 0.............0. W Spectrum 128K/+2 Memory Control BFFD 10............0. R Spectrum +2A/+3 Mirror of Port FFFDh (+2A/+3 only) 7FFD 01............0. W Spectrum +2A/+3 Memory Control A 1FFD 0001..........0. W Spectrum +2A/+3 Memory Control B and Disk Motor 0FFD 0000..........0. Spectrum +2A/+3 Centronics 3FFD 0011..........0. R/W Spectrum +3 Floppy FDC NEC uPD765 data 2FFD 0010..........0. R Spectrum +3 Floppy FDC NEC uPD765 status xxFB .............0.. R/W ZX Printer xxF7 ...........10... R/W Interface 1 RS232/Network Data (1bit send/receive) xxEF ...........01... R/W Interface 1 Microdrive/RS232/Network Control xxE7 ...........00... R/W Interface 1 Microdrive Data (8bit send/receive) xx1F ........000..... R Kempston joystick |
xxFF ........11111111 Timex Display Mode xxFE nnnnnnnn11111110 R Timex ULA (Keyboard, and CAS Input) xxFE ........11111110 W Timex ULA (Border Color, Speaker/CAS Output) xxF4 ........11110100 Timex Memory Mapping xxF6 ........11110110 R/W Timex TS2068/TC2068 PSG data R/W (sound registers) x1F6 .......111110110 R/W Timex TS2068/TC2068 PSG data R/W (and joystick 1) x2F6 ......1.11110110 R/W Timex TS2068/TC2068 PSG data R/W (and joystick 2) xxF5 ........11110101 W Timex TS2068/TC2068 PSG index xxFB ........11111011 R/W Timex Printer (TS2040 or Alphacom 32) xx1F ..........0..... R Timex TC2048 joystick (kempston-style, A5-only) xxEF ........???0???? R/W Timex FDD Interface (for FDD or FDD-3000 drive) |
0007 W Cheetah Sweet Talker - Speech Output (halts CPU) 007F 0 W DK'Tronics Speech Synthesiser - Speech Output 007F 0 R DK'Tronics Speech Synthesiser - Speech Status xx7F ........011 R Fuller Box - Joystick port xx3F ........00 W Fuller Box - PSG index (also DK'Tronics PSG) xx3F ........00 R Fuller Box - PSG data read (maybe also DK'Tronics?) xx5F ........010 W Fuller Box - PSG data write (also DK'Tronics PSG) xx9F ........ 00 W Fuller Orator / Box Master Unit - Speech Output xxBF ........ 01 R Fuller Orator / Box Master Unit - Speech Status xx9F ........ 00 W William Stuart Systems Music Synthesiser PSG index xxDF ........ 10 W William Stuart Systems Music Synthesiser PSG data xxFF ........1..11111 W Bi-Pak ZON X Soundbox PSG index xx7F ........0..11111 W Bi-Pak ZON X Soundbox PSG data write 0038 0000000000111000 R Currah uSpeech enable/disable BIOS (mirror) |
xx7F ........01111111 Aerco Centronics Interface xx8F ........10001111 JLO status/command xx9F ........10011111 JLO track xxAF ........10101111 JLO sector xxBF ........10111111 JLO data xxB7 ........10110111 JLO select xxFB ........1....0.. ZX LPrint III Enable ROM, and Write=Data, Read=Busy xx7B ........0....0.. ZX LPrint III Disable ROM E3BF 0 W Kempston Centronics Ctrl (b0=0=Strobe)(0Eh,0Fh,81h) E2BF 0 R Kempston Centronics Status (b0=1=Busy) E0BF 0 W Kempston Centronics Data Output xxBB ........ R DK'Tronics Centronics Status (b7=1=Busy) xxBB ........ W DK'Tronics Centronics Ctrl (b1=0=Strobe) (02h,00h) xx9B ........ W DK'Tronics Centronics Data xxDB ........ W DK'Tronics Centronics Config 1 (set to 3Fh) xxFB ........ W DK'Tronics Centronics Config 2 (set to FFh,80h) dd0E dddddddd R Wafadrive Centronics Data Out ;via "IN A,(dd0Eh)" x00A s R Wafadrive Centronics Strobe Out;via "IN A,(s00Ah)" 0002 R Wafadrive Centronics Busy In ;returned in bit5 xxFB ........ W Indescomp Centronics Data xxFB ........ R Indescomp Status (b0=Busy,b1=Rs232Busy,b2=RxD) xx7F ........ W Indescomp Control (b0=Strobe,b1=TxD,b2=CTS) xx1B ........ 0 W Disciple FDC Command xx1B ........ 0 R Disciple FDC Status xx5B ........ 0 R/W Disciple FDC Track xx9B ........ 0 R/W Disciple FDC Sector xxDB ........ 0 R/W Disciple FDC Data xx1F ........ W Disciple Control Register xx1F ........ R Disciple Joystick/Printer/Network xx3B ........ 0 ? Disciple Network Wait F7FE 0 0 R Disciple Disciple Joystick EFFE 0 0 R Disciple Disciple Joystick xxBB ........ 0 R Disciple Enable Internal ROM/RAM xxBB ........ 0 W Disciple Disable Internal ROM/RAM xxFB ........ 0 W Disciple Centronics Data xx7B ........ 0 R Disciple Map ROM=0000h, RAM=2000h xx7B ........ 0 W Disciple Map ROM=2000h, RAM=0000h xxE3 ........ 000 W PlusD FDC Command xxE3 ........ 000 R PlusD FDC Status xxE7 ........ 001 R PlusD Enable Internal ROM/RAM xxE7 ........ 001 W PlusD Disable Internal ROM/RAM xxEB ........ 010 R/W PlusD FDC Track xxEF ........ 011 W PlusD Control Register xxF3 ........ 100 R/W PlusD FDC Sector xxF7 ........ 101 W PlusD Centronics Data xxF7 ........ 101 R PlusD Centronics Busy xxFB ........ 110 R/W PlusD FDC Data xx1F ........ W Beta Disk FDC Command xx1F ........ R Beta Disk FDC Status xx3F ........ R/W Beta Disk FDC Track xx5F ........ R/W Beta Disk FDC Sector xx7F ........ R/W Beta Disk FDC Data xxFF ........ R Beta Disk Status xxFF ........ W? Beta Disk Control |
xx9F ........ Multiface I In xx1F ........ Multiface I Out xxBF ........ Multiface 128 In xx9F ........ Multiface 128 In v2 (Disciple) (uh/what?) xx3F ........ Multiface 128 Out xx3F ........ Multiface III Button xx3F ........ Multiface III In xxBF ........ Multiface III Out 7F3F Multiface III P7FFD (uh?) 1F3F Multiface III P1FFD (uh?) FF3F British Micro Grafpad Pen up/down FFBF British Micro Grafpad Pen position X coordinate FF7F British Micro Grafpad Pen position Y coordinate FADF ......?0..0....? Kempston Mouse Buttons (b0=Right,b1=Left,b2=Mid) FBDF .....0?1..0....? Kempston Mouse X FFDF .....1?1..0....? Kempston Mouse Y xx1F ........000..... R/W AMX Mouse Z80PIO Data A: X, CentronicsLSBs/Strobe xx3F ........001..... R/W AMX Mouse Z80PIO Data B: Y, CentronicsMSBs/Busy xx5F ........010..... AMX Mouse Z80PIO Ctrl A: X, CentronicsLSBs/Strobe xx7F ........011..... AMX Mouse Z80PIO Ctrl B: Y, CentronicsMSBs/Busy xxDF ........110..... R AMX Mouse 74LSXX Logic: Mouse Buttons (R) xxDF ........ R Stack Light Rifle (R) (light gun trigger/sensor) |
0008h,1708h Interface 1 - Enable external ROM 0700h Interface 1 - Disable external ROM 0008h Wafadrive - Enable external ROM 0008h,0048h,1708h Discovery - Enable external ROM/RAM/WD/PIA 1748h Discovery - Disable external ROM/RAM/WD/PIA 2800h..2803h Discovery - WD1770 registers (disk) 3000h..3003h Discovery - PIA6821 registers (centronics, etc.) 0000h,0008h,0066h,028Eh Disciple and PlusD - Enable external ROM/RAM 0000h,0008h Timex FDD Interface - Enable ROM/RAM 0604h Timex FDD Interface - Disable ROM/RAM 0038h.Read Currah uSpeech enable/disable BIOS 1000h.Read Currah uSpeech Status (R) 1000h.Write Currah uSpeech Output (W) 3C00h..3CFFh Beta/BetaPlus Disk - Enable ROM and I/O Ports 3D00h..3DFFh Beta128 Disk - Enable ROM and I/O Ports 4000h..FFFFh Beta/BetaPlus/Beta128 - Disable ROM and I/O Ports |
Spectrum Memory Maps |
0000h-3FFFh ROM (BASIC) 4000h-7FFFh RAM (Work RAM and VRAM) (with waitstates) 8000h-FFFFh N/A |
0000h-3FFFh ROM (BASIC) 4000h-7FFFh RAM (Work RAM and VRAM) (with waitstates) 8000h-FFFFh Additional RAM |
0000h-3FFFh ROM0 (EDITOR) or ROM1 (BASIC) (see Port 7FFDh.Bit4) 4000h-7FFFh RAM Page 5 (VRAM) (with waitstates) 8000h-BFFFh RAM Page 2 (Work RAM) C000h-FFFFh RAM Page 0..7 (see Port 7FFDh.Bit0-2) (Page1,3,5,7=waitstates) |
0000h-3FFFh ROM0..ROM3 (see Port 7FFDh.Bit4 and 1FFDh.Bit2) 4000h-7FFFh RAM Page 5 (VRAM) (with waitstates) 8000h-BFFFh RAM Page 2 (Work RAM) C000h-FFFFh RAM Page 0..7 (see Port 7FFDh.Bit0-2) (Page 4-7 with waitstates) |
0000h-3FFFh RAM Page 0, 4, 4, or 4 (see Port 1FFDh.Bit0-2) 4000h-7FFFh RAM Page 1, 5, 5, or 7 (see Port 1FFDh.Bit0-2) 8000h-BFFFh RAM Page 2, 6, 6, or 6 (see Port 1FFDh.Bit0-2) C000h-FFFFh RAM Page 3, 7, 3, or 3 (see Port 1FFDh.Bit0-2) |
Address HOME EX-ROM DOCK 0000h-1FFFh BIOS Expansion Bank 0 N/A 2000h-3FFFh BIOS Expansion Bank 1 N/A 4000h-5FFFh VRAM (Screen 0) Expansion Bank 2 N/A 6000h-7FFFh VRAM (Screen 1) Expansion Bank 3 N/A 8000h-9FFFh N/A Expansion Bank 4 N/A A000h-BFFFh N/A Expansion Bank 5 N/A C000h-DFFFh N/A Expansion Bank 6 N/A E000h-FFFFh N/A Expansion Bank 7 N/A |
Address HOME EX-ROM DOCK 0000h-1FFFh BIOS Extended BASIC ROM Cartridge Bank 0 2000h-3FFFh BIOS Expansion Bank 1 Cartridge Bank 1 4000h-5FFFh VRAM (Screen 0) Expansion Bank 2 Cartridge Bank 2 6000h-7FFFh VRAM (Screen 1) Expansion Bank 3 Cartridge Bank 3 8000h-9FFFh RAM (Work RAM) Expansion Bank 4 Cartridge Bank 4 A000h-BFFFh RAM (Work RAM) Expansion Bank 5 Cartridge Bank 5 C000h-DFFFh RAM (Work RAM) Expansion Bank 6 Cartridge Bank 6 E000h-FFFFh RAM (Work RAM) Expansion Bank 7 Cartridge Bank 7 |
RAM Page 0 - Main RAM at C000h-FFFFh RAM Page 2 - Main RAM at 8000h-BFFFh RAM Page 5 - Main RAM at 4000h-7FFFh (with first VRAM block and system area) RAM Page 7 - Second VRAM block and Editor variables RAM Page 1,3,4,6 - RAM Disk |
Spectrum System Variables |
4000h VRAM Bitmap (256x192 pixels) 5800h VRAM Attributes (32x24 characters) 5B00h System Area 5CB6h Memory (starting with CHANS) |
CHANS channels (usually at 5CB6h) PROG basic program (usually at 5CCBh) VARS basic variables E_LINE input buffer WORKSP temporary work space STKBOT bottom of calculator stack (same as WORKSP when empty) STKEND start of spare space (same as STKBOT when empty) RAMTOP CPU stacktop+1 (usually FF57h) UDG User-defined graphics (charset) (usually FF58h) P_RAMT physical RAM top (FFFFh for 48K RAM, or 7FFFh for 16K RAM) |
0000h..3FFFh BIOS ROM 4000h..57FFh VRAM Bitmap (1800h bytes) 5800h..5AFFh VRAM Attr (300h bytes) 5B00h..5BFFh Printer Buffer 5C00h..5FFFh System Variables |
6000h..61FFh Machine Stack (200h bytes) 6200h..683Fh OS RAM-Resident Code 6840h..ARSBUF (Machine Code Variables) ARSBUF CHANS PROG VARS E_LINE WORK_SP STKBOT STKEND RAMTOP..P_RAMT UDG (user defined graphics) |
6000h..77FFh VRAM Bitmap 2 (1800h bytes) 7800h..7AFFh VRAM Attr 2 (300h bytes) 7B00h..ARSBUF (Machine Code Variables) ARSBUF..RAMTOP (as above) RAMTOP..F7BFh UDG (user defined graphics) F7C0h..F9BFh Machine Stack (200h bytes) F9C0h..P_RAMT OS RAM-Resident Code |
5B00h 256 PRBUFF LPRINT Buffer (32x8 pixel bitmap) (On Spectrum 128/+2/+2A/+3, PRBUFF is used as Extended System Area, see below) 5C00h 8 KSTATE Used in reading the keyboard. 5C08h 1 LASTK Stores newly pressed key. 5C09h 1 REPDEL Time (in 50ths of a second) that a key must be held down before it repeats. This starts off at 35, but you can POKE in other values. 5C0Ah 1 REPPER Delay (in 50ths of a second) between successive repeats of a key held down - initially 5. 5C0Bh 2 DEFADD Address of arguments of user defined function (if one is being evaluated), otherwise 0. 5C0Dh l K_DATA Stores 2nd byte of colour controls entered from keyboard. 5C0Eh 2 TVDATA Stores bytes of colour, AT and TAB controls going to TV. 5C10h 38 STRMS Addresses of channels attached to streams. (16bit pointers for Stream FDh..FFh, and 00..0Fh) 5C36h 2 CHARS 256 less than address of character set (which starts with space and carries on to (C)). Normally in ROM, but you can set up your down in RAM and make CHARS point to it. 5C38h 1 RASP Length of warning buzz. 5C39h 1 PIP Length of keyboard click. 5C3Ah 1 ERRNR 1 less than the report code. Starts off at 255 (for -1) so 'PEEK 23610' gives 255. 5C3Bh 1 FLAGS Various flags to control the BASIC system. 5C3Ch 1 TVFLAG Flags associated with the TV. 5C3Dh 2 ERRSP Address of item on machine stack to be used as error return 5C3Fh 2 LISTSP Address of return address from automatic listing. 5C41h 1 MODE Specifies 'K', 'L', 'C', 'E' or 'G' cursor. 5C42h 2 NEWPPC Line to be jumped to. 5C44h 1 NSPPC Statement number in line to be jumped to. Poking first NEWPPC and then NSPPC forces a jump to a specified statement in a line. 5C45h 2 PPC Line number of statement currently being executed. 5C47h 1 SUBPPC Number within line of statement currently being executed. 5C48h 1 BORDCR Border colour multiplied by 8; also contains the attributes normally used for the lower half of the screen. 5C49h 2 E_PPC Number of current line (with program cursor). 5C4Bh 2 VARS Address of variables. (End of BASIC Program) 5C4Dh 2 DEST Address of variable in assignment. 5C4Fh 2 CHANS Address of channel data (usually 5CB6h) 5C51h 2 CURCHL Address of current I/O channel (CHANS+n) 5C53h 2 PROG Address of BASIC program. (End of CHANS) 5C55h 2 NXTLIN Address of next line in program. (PROG+n, or 0000h=None) 5C57h 2 DATADD Address of terminator of last DATA item. (initially PROG-1) 5C59h 2 E_LINE Address of input buffer (aka line editor) (End of VARS) 5C5Bh 2 K_CUR Address of cursor in input buffer (E_LINE+n) 5C5Dh 2 CH_ADD Address of the next character to be interpreted (the character after the argument of PEEK, or the NEWLINE at the end of a POKE statement) 5C5Fh 2 X_PTR Address of the character after the [] marker. (or 00D7h?) 5C61h 2 WORKSP Address of temporary work space. 5C63h 2 STKBOT Address of bottom of calculator stack. 5C65h 2 STKEND Address of start of spare space. 5C67h 1 BREG Calculator's B register. 5C68h 2 MEM Address of area used for calculator's memory (usually MEMBOT, but not always). 5C6Ah 1 FLAGS2 More flags. (Bit3 set when CAPS SHIFT or CAPS LOCK is on.) 5C6Bh 1 DF_SZ Number of lines in lower part of screen (including one blank line) 5C6Ch 2 S_TOP The number of the top program line in automatic listings. 5C6Eh 2 OLDPPC Line number to which CONTINUE jumps. 5C70h 1 OSPPC Number within line of statement to which CONTINUE jumps. 5C71h 1 FLAGX Various flags. 5C72h 2 STRLEN Length of string type destination in assignment. 5C74h 2 T_ADDR Address of next item in syntax table. 5C76h 2 SEED The seed for RND. This is set by RANDOMIZE. 5C78h 3 FRAMES Frame counter incremented at 50Hz (or 60Hz) (24bit) 5C7Bh 2 UDG Address of first user-defined graphic (usually FF58h) 5C7Dh 2 COORDS X,Y coordinates of last point plotted. 5C7Fh 1 P_POSN 33-column number of printer position. 5C80h 2 PRCC Address of Current Column in PRBUFF (5B00h..5B1Fh) [Not used in 128K mode or when certain peripherals are attached] 5C82h 2 ECHO_E 33-column number and 24-line number (in lower half) of end of input buffer. 5C84h 2 DF_CC Address in display file of PRINT position. 5C86h 2 DF_CCL Like DF_CC for lower part of screen. 5C88h 1 S_POSN 33-column number for PRINT position. 5C89h 1 24-line number for PRINT position. 5C8Ah 2 SPOSNL Like S_POSN for lower part. 5C8Ch 1 SCR_CT Counts scrolls - it is always 1 more than the number of scrolls that will be done before stopping with 'scroll?'. If you keep poking this with a number bigger than 1 (say 255), the screen will scroll on and on without asking you. 5C8Dh 1 ATTR_P Permanent current colours, etc., (as set up by colour statements). 5C8Eh 1 MASK_P Used for transparent colours, etc. Any bit that is 1 shows that the corresponding attribute bit is taken not from ATTR_P, but from what is already on the screen. 5C8Fh 1 ATTR_T Temporary current colours, etc., (as set up by colour items). 5C90h 1 MASK_T Like MASK_P, but temporary. 5C91h 1 P_FLAG More flags. 5C92h 30 MEMBOT Calculator's memory area - used to store numbers that cannot conveniently be put on the calculator stack. 5CB0h 2 NMIADD Holds the address of the users NMI service routine. NOTE - On previous machines, this did not work correctly and these two bytes were documented as 'Not used.' Programs that used these two bytes for passing values may need to be modified. 5CB2h 2 RAMTOP Address of last byte of BASIC system area.(usually FF57h) 5CB4h 2 P_RAMT Address of last byte of physical RAM. (usually FFFFh) |
5CB6h 2 ERRLN Line number to GOTO on error 5CB8h 2 ERRLN Line number in which error occurred 5CBAh 1 ERRS Statement number within line in which error occurred 5CBBh 1 ERRT Error number (Report Code) 5CBCh 2 SYSCON Pointer to System Configuration Table 5CBEh 1 MAXBNK Number of Expansion Banks in System 5CBFh 1 CURCBN Current Channel Bank Number 5CC0h 2 MSTBOT Address of location above machine stack 5CC2h 1 VIDMOD Video Mode (non-zero if 2nd display file is used) 5CC3h 1 <undocumented/unused byte> ? 5CC4h 7 "Various variables used for BASIC cartridges" ...details? 5CCBh 1 STRMNM Current Stream number 5CCCh 334h - Not used (except, some stuff at 5EF3h..5EF6h is used?) |
Addr Siz Name Expl. Below is for Spectrum 128/+2: 5B00h 20 SWAP Paging subroutine. 5B14h 9 YOUNGER Paging subroutine. 5B1Dh 18 ONERR Paging subroutine. 5B2Fh 5 PIN 5B34h 22 POUT 5B4Ah 14 POUT2 Below is for Spectrum +3: 5B00h 16 SWAP Paging subroutine. 5B10h 17 STOO Paging subroutine. Entered with IRQs disabled, AF,BC pushed 5B21h 9 YOUNGER Paging subroutine. 5B2Ah 16 REGNUOY Paging subroutine. 5B3Ah 24 ONERR Paging subroutine. 5B52h 2 OLDHL Temporary register store while switching ROMs. 5B54h 2 OLDBC Temporary register store while switching ROMs. 5B56h 2 OLDAF Temporary register store while switching ROMs. Below is for both Spectrum 128 and +3: 5B58h 2 TARGET Subroutine address in ROM 3. 5B5Ah 2 RETADDR Return address in ROM 1. 5B5Ch 1 BANKM Copy of last byte output to I/O port 7FFDh. 5B5Dh 1 RAMRST RST 8 instruction. Used by ROM 1 to report old errors to ROM 3. 5B5Eh 1 RAMERR Error number passed from ROM 1 to ROM 3. Also used by SAVE/LOAD as temporary drive store. 5B5Fh 2 BAUD RS232 bit period in T states/26. Set by FORMAT LINE. 5B61h 2 SERFL Second-character-received-flag, and data. 5B63h 1 COL Current column from 1 to width. 5B64h 1 WIDTH Paper column width. Defaults to 80. (on +3 at least) 5B65h 1 TVPARS Number of inline parameters expected by RS232. 5B66h 1 FLAGS3 Various flags. Bits 0, 1, 6 and 7 unlikely to be useful. Bit 2 is set when tokens are to be expanded on printing. Bit 3 is set if print output is RS232. The default (at reset) is Centronics (on +3) and whatever? (on 128/+2). Bit 4 is set if a disk interface is present. Bit 5 is set if drive B: is present. Below is for Spectrum 128/+2: 5B67h 10 NSTR1 5B71h 1 HD00 5B72h 2 HD0B 5B74h 2 HD0D 5B76h 2 HD0F 5B78h 2 HD11 5B7Ah 1 SC00 5B7Bh 2 SC08 5B7Dh 2 SC0D 5B7Fh 2 SC0F 5B81h 2 OLDSP 5B83h 2 SFNEXT 5B85h 3 SPSPACE 5B88h 1 ROW01 5B89h 1 ROW23 5B8Ah 1 ROW45 5B8Bh 2 SYNRET 5B8Dh 5 LASTV 5B92h 2 RNLINE 5B94h 2 RNFIRST 5B96h 2 RNSTEP 5B98h 8 STRIP1 5BA0h 8 STRIP2 5BA8h 87 TSTACK 5BFFh 1 N/A Below is for Spectrum +3: 5B67h 1 BANK678 Copy of last byte output to I/O port 1FFDh. 5B68h 1 XLOC Holds X location when using the unexpanded COPY command. 5B69h 1 YLOC Holds Y location when using the unexpanded COPY command. 5B6Ah 2 OLDSP Old SP (stack pointer) when TSTACK is in use. 5B6Ch 2 SYNRET Return address for ONERR. 5B6Eh 5 LASTV Last value printed by calculator. 5B73h 2 RCLINE Current line being renumbered. 5B75h 2 RCSTART Starting line number for renumbering. The default is 10. 5B77h 2 RCSTEP Incremental value for renumbering. The default is 10. 5B79h 1 LODDRV Holds 'T' if LOAD, VERIFY, MERGE are from tape, otherwise 'A', 'B' or 'M'. 5B7Ah 1 SAVDRV Holds 'T' if SAVE is to tape, otherwise 'A', 'B' or 'M'. 5B7Bh 1 DUMPLF Holds the number of 1/216ths inch used for line feeds in 'COPY EXP'. This is normally set to 9. If problems are experienced fitting a dump onto a sheet of A4 paper, POKE this location with 8. This will reduce the size of the dump and improve the aspect ratio slightly. 5B7Ch 8 STRIP1 Stripe one bitmap. ;\allowed to be destroyed by 5B84h 8 STRIP2 Stripe two bitmap. ;/Temporary stack 5B8Ch 115 TSTACK Temporary stack (when RAM7 is mapped to C000h-FFFFh) 5BFFh 1 N/A Not used |
Spectrum ULA |
0-4 Keyboard Inputs (0=Pressed, 1=Released) 5 Not used 6 EAR Input (CAS LOAD) 7 Not used A8..A15 Keyboard Address Output (0=Select) |
0-2 Border Color (0..7) (always with Bright=off) 3 MIC Output (CAS SAVE) (0=On, 1=Off) 4 Beep Output (ULA Sound) (0=Off, 1=On) 5-7 Not used |
0-2 Screen mode. 000=screen 0, 001=screen 1, 010=hi-colour, 110=hi-res 3-5 INK color in hi-res mode (INK=0..7) (with PAPER=INK XOR 7, BORDER=PAPER) 6 Disable Frame Interrupt (0=Normal, 1=Disable) 7 External memory mode (0=DOCK/Cartridge Slot, 1=EX-ROM/Expansion Port) |
0 Memory at 0000h-1FFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=BIOS, EX-ROM=BASIC 1 Memory at 2000h-3FFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=BIOS 2 Memory at 4000h-5FFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=VRAM 3 Memory at 6000h-7FFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=VRAM 4 Memory at 8000h-9FFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=RAM 5 Memory at A000h-BFFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=RAM 6 Memory at C000h-DFFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=RAM 7 Memory at E000h-FFFFh (0=HOME, 1=DOCK or EX-ROM) ;HOME=RAM |
0-2 RAM Page to be mapped to C000h-FFFFh (0..7=Page 0..7) 3 RAM Page to be used as VRAM (0=Page 5, 1=Page 7) 4 ROM Page (0=New "128K" ROM0, 1=Old "48K" ROM1) 5 Lock Port 7FFDh (0=Normal/No change, 1=Lock/Until Reset) 6-7 Not used |
0 Paging mode (0=Normal; ROM and RAM, 1=Special; RAM only) 1-2 In special mode: RAM mapping mode (RAM only, for CP/M) Mode 0000h..3FFFh 4000h..7FFFh 8000h..BFFFh C000h..FFFFh 0 Bank0 Bank1 Bank2 Bank3 1 Bank4 Bank5/Screen1 Bank6 Bank7/Screen2 2 Bank4 Bank5/Screen1 Bank6 Bank3 3 Bank4 Bank7/Screen2 Bank6 Bank3 1 In normal mode, ignored. 2 In normal mode, MSB of ROM selection (LSB is in Port 7FFDh.Bit4) The four ROMs banks are (mapped to 0000h..3FFFh): ROM 0: 128k editor, menu system and self-test program ROM 1: 128k syntax checker ROM 2: +3DOS ROM 3: 48 BASIC 3 Disk motor; 1=on, 0=off 4 Printer port strobe. 5-7 Not used |
Spectrum VRAM |
A0..A4 Horizontal Coordinate in 8-pixel steps (0..31) A5..A7 Vertical Coordinate in 8-pixel steps (0..7) ;Vertical Charline A8..A10 Vertical Coordinate in 1-pixel steps (0..7) ;Vertical Scanline A11..A12 Vertical Coordinate in 64-pixel steps (0..2) ;Vertical Block |
D0..D7 Pixels (0=Paper, 1=Ink) (D7=Left-most ... D0=Right-most) |
A0..A4 Horizontal Coordinate in 8-pixel steps (0..31) A5..A9 Vertical Coordinate in 8-pixel steps (0..23) |
D0..D2 Ink (0..7 = color used for "1" bits in bitmap data) D3..D5 Paper (0..7 = color used for "0" bits in bitmap data) D6 Bright (brightness for both Ink and Paper) (0=Dark, 1=Bright) D7 Flash (0=Normal, 1=Blink; 16 frames normal, 16 frames inverted) |
0 Black ............... ............... ............... ....... 1 Blue g.............. r.............. bbbbbbbbB...... i...... 2 Red gg............. rrrrrrrrRR..... bb............. ii..... 3 Magenta ggG............ rrrrrrrrrRR.... bbbbbbbbbBB.... iiI.... 4 Green gggggggggGGG... rrrR........... bbbB........... iiiI... 5 Cyan ggggggggggGGG.. rrrrR.......... bbbbbbbbbbBBB.. iiiiI.. 6 Yellow ggggggggggGGGG. rrrrrrrrrrRRRR. bbbbBB......... iiiiII. 7 White gggggggggggGGGG rrrrrrrrrrrRRRR bbbbbbbbbbbBBBB iiiiiII |
TS2068 outputs only R,G,B (but NOT intensity, ie. bright is ignored) TC2068 and Spectrum 128 do output R,G,B,I (with intensity) CGA shows intensity=1 as FULL intensity (unlike darker blue/red on TV) CGA shows intensity=0 as HALF intensity or so (unlike 80% of bright on TV) CGA shows dark-yellow as brown (unlike Dark-Yellow on TV) CGA shows bright-black as dark-gray (unlike Black on TV) |
Spectrum Video Connectors |
1 Composite PAL (75 Ohms, 1.2 Volts pk-pk) .. .. 2 GND (0 Volts DC) / '-' \ 3 Bright output (TTL) . 7 6 . 4 Composite sync (TTL) | 3 8 1 | 5 Vertical sync (TTL) ' 5 4 ' 6 Green (TTL) \ 2 / 7 Red (TTL) '---' 8 Blue (TTL) |
1 +12V .. .. 2 GND (0V) / '-' \ 3 Audio Out . 7 6 . 4 /Composite Sync (TTL) | 3 8 1 | 5 +12V ' 5 4 ' 6 Green (Analogue 1.67V p-p) \ 2 / 7 Red (Analogue 1.67V p-p) '---' 8 Blue (Analogue 1.67V p-p) |
Spectrum Timings |
Maker Spectrum Spectrum Spectrum Timex Timex Version 16K/48K/+ 128/+2 +2A/+3 TC2048/2068 TS2068 CPU Osc 14.000MHz 17.73447MHz ? ? 14.112MHz Color Osc 4.4336MHz CPU Osc/4 CPU Osc/n ? 3.579545MHz CPU Clock 3.500000MHz 3.54690MHz 3.54690MHz 3.50000MHz 3.52800MHz PSG Clock N/A 1.7734MHz 1.7734MHz ? (if any) 1.764(75)? HorizontalTotal 224 clks 228 clks 228 clks ? 224 clks HorizontalDraw 128 clks 128 clks 128 clks 128 clks 128 clks HorizontalBlank 96 clks 100 clks 100 clks ? ? Vertical Total 312 lines 311 lines ? ? 262 lines Screen 192 lines 192 lines 192 lines 192 lines 192 lines Upper Border 64 lines 63 lines ? ? ? Lower Border 56 lines 56 lines ? ? ? Frame Rate 50.08Hz/PAL 50.01Hz/PAL 50.?Hz/PAL 50.?Hz/PAL 60.11Hz/NTSC Flash Rate 50/32=1.6Hz 50/32=1.6Hz 50/32=1.6Hz 50/32=1.6Hz 60/32=1.9Hz First Delay at 14335 clks ? 14361 clks ? ? Delay Pattern 6..1,0,0 ? 1,0,7..2 ? ? Port FEh Delay Yes Yes No Yes Yes VRAM Delay at 4000h-7FFFh RAM1,3,5,7 RAM4,5,6,7 4000h-7FFFh 4000h-7FFFh Snow Effect Yes Yes/Crash ? No? Yes/No? |
UUUUUUccUUUUUUccUUUUUUcc.. ;<--- U=Blocked by ULA, c=Free for CPU access 654321006543210065432100.. ;<--- Number of waitstates (0=none) |
UcUUUUUUUcUUUUUUUcUUUUUU.. ;<--- U=Blocked by ULA, c=Free for CPU access 107654321076543210765432.. ;<--- Number of waitstates (0=none) |
|-----8 clks----||-----8 clks----|-----H/V-Blank...------ /RAS (RAM.Pin4) -___-___---------___-___-------------------------------- /CAS (RAM.Pin15) -_-_-_-_---------_-_-_-_-------------------------------- |
|-----8 clks----||-----8 clks----| /RAS (RAM.Pin4) -___-__--___-__--___-__--___-__- ;four NOP opcodes /CAS (RAM.Pin15) -___-----___-----___-----___---- |
|-----8 clks----||-----8 clks----| /RAS (RAM.Pin4) -___-----___-----___-----___---- ;four NOP opcodes /CAS (RAM.Pin15) -___-----___-----___-----___---- |
Spectrum Sound |
Spectrum Sound ULA |
Port FEh.Bit4 = Audio Output (0 = 0.3 Volts, 1 = 3.7 Volts) Port FEh.Bit3 = Cassette Output (0 = 0.3 Volts, 1 = 0.7 Volts) |
Port FEh = 18h --> 3.7V Port FEh = 10h --> 3.6V Port FEh = 08h --> 0.7V Port FEh = 00h --> 0.3V |
Toggle between Internal Speaker External Amplifier 00h and 10h Volume = ##### Volume = ##### ;normal 00h and 08h Volume = ..... Volume = ##... ;unpredictable 10h and 18h Volume = ##... Volume = #.... ;unpredictable |
Spectrum Sound Speaker/Amplifier/Modulator |
Spectrum Sound PSG (Programmable Sound Generator) |
Model Index.W Data.W Data.R Chip Year Spectrum 128/+2/+2A/+3 FFFDh BFFDh FFFDh 8912 1985 Didaktik Melodik (spectrum 128 style) FFFDh BFFDh FFFDh 891x 19xx Timex TS2068 (NTSC) xxF5h xxF6h xxF6h 8912 1983 Timex TC2068 (PAL) xxF5h xxF6h xxF6h 8912 1984 Fuller Box xx3Fh xx5Fh xx3Fh 8912 1983 Fuller Box Master Unit (with Orator) xx3Fh xx5Fh xx3Fh 8912 1983 DK'Tronics 3 Channel Sound Synthesiser xx3Fh xx5Fh ? 8912 1984 Timedata ZXM Soundbox (ZX81) xx9Fh xxDFh xxBFh 8912 198x Timedata ZXM Soundbox (Spectrum) xx9Fh xxDFh xxBFh 8912 198x William Stuart Systems Music Synthesiser xx9Fh xxDFh ? 891x 1983 Bi-Pak ZON X81 Soundbox (ZX81) xxDFh xx0Fh N/A? 891x 198x Bi-Pak ZON X Soundbox (Spectrum) xxFFh xx7Fh N/A 8912 1982 Ricoll RISG Sound Generator ? ? ? 8910 1983 Ricoll RIFG Sound Generator with filters ? ? ? 8910 1983 Petron Trichord (includes PROM) ? ? ? 8910 1983 Signpoint Sound Synthesiser Plus ? ? ? 8910 1984 Datel 3 Channel Sound Synthesiser ? ? ? ? 1989 Investronica INAXEL Sound & Joystick ? ? ? ? ? |
Model CPU Clock Divide by Spectrum 128/+2/+2A/+3 3.54690MHz / 32 Timex TC2068 (PAL) 3.50000MHz / 32 Timex TS2068 (NTSC) 3.52800MHz / 32 |
ZON X81 Soundbox (ZX81) 3.25MHz / 32 ZON X Soundbox (Spectrum) 3.5MHz / ? Other Models... ? MHz / ? Timedata ZXM Soundbox (ZX81) approx 100000 Hz (probably means 3.25/32) Timedata ZXM Soundbox (Spectrum) approx 100000 Hz (probably means 3.xx/32) |
F = 3.5xxMHz / 32 / nn ;with nn in range 1..4095 (nn=0 acts as nn=1) |
F = 3.5xxMHz / 32 / nn ;with nn in range 1..31 (nn=0 acts as nn=1) |
noise_level = noise_level XOR shiftreg.bit0 newbit = shiftreg.bit0 XOR shiftreg.bit3 shiftreg = (shiftreg SHR 1) + (newbit SHL 16) |
Bit Expl. 0 Channel A tone enable (0=Enable, 1=Disable) 1 Channel B tone enable (0=Enable, 1=Disable) 2 Channel C tone enable (0=Enable, 1=Disable) 3 Channel A noise enable (0=Enable, 1=Disable) 4 Channel B noise enable (0=Enable, 1=Disable) 5 Channel C noise enable (0=Enable, 1=Disable) 6 I/O port A mode (0=Input, 1=Output) 7 I/O port B mode (0=Input, 1=Output) |
amplitude = max / sqrt(2)^(15-nn) ;(according to datasheet) eg. 15 --> max/1, 14 --> max/1.414, 13 --> max/2, etc. |
F = 3.5xxMHz / 32 / nn ;with nn in range 0..65535 (nn=0 acts as nn=1) |
T = nn*512 / 3.5xxMHz ;with nn in range 1..65535 (0 .. ca. 9.5 seconds) |
CONT ATT ALT HLD 0 0 X X \_________ 0-3 (same as 9) 0 1 X X /_________ 4-7 (same as F) 1 0 0 0 \\\\\\\\\\ 8 (Repeating) 1 0 0 1 \_________ 9 1 0 1 0 \/\/\/\/\/ A (Repeating) 1 0 1 1 \""""""""" B 1 1 0 0 ////////// C (Repeating) 1 1 0 1 /""""""""" D 1 1 1 0 /\/\/\/\/\ E (Repeating) 1 1 1 1 /_________ F |
Model Port A Port B Timex TC2068 and TS2068 Joysticks (*) N/A (uses 8912 chip) Spectrum 128/+2/+2A/+3 RS232/Keypad N/A (uses 8912 chip) Fuller Box ? N/A (uses 8912 chip) DK'Tronics Unused? N/A (uses 8912 chip) Timedata ZXM Soundbox Joystick/User Port N/A (uses 8912 chip) Signpoint ioport ioport Other expansions...? ? ? (some do use 8910 chip) |
Fuller Box Demonstration Program (Fuller) Sound Designer (DK'Tronics) Invasion of the Body Snatchas |
Composer (William Stuart Systems) |
Spectrum Sound Speech Overview |
Currah MicroSpeech (1983) - uses SP0256-AL2 speech processor, output via TV Fuller Orator - Speech Synthesis (1984) - uses G1-SP0256 AL voice chip Fuller Box Master Unit (PSG and Orator) Cheetah Sweet Talker (1983) (crude thing that HALTs the CPU during speech) DK'Tronics Speech Synthesiser (1985) - uses the SLO/256 chip |
Spirit Instruments - Spectrum Speech Synthesiser (1983) SS1 Speech Synthesiser (1983) VTR Vocal Synthesizer (1985) Timedata ZXS Speech Synthesiser (1983) William Stuart Systems Chatterbox (1983) William Stuart Systems Chatterbox II (1985) (with intonation) Zebra Talker Speech Synthesiser (for Timex) Datel Vox Box (1984) (allophone) DCP Microdevelopments S-Pack (1983) - vocabulary of 71 words (upgradeable) DCP Microdevelopments Speech Pack (1982) for ZX81 |
Chatbox (Demonstration Program by Cheetah Marketing Ltd.) |
Spectrum Voice Chess (Fuller Box version; ie. NOT the ULA version) (Artic) |
Speech Software (Demonstration Program by DK'Tronics Ltd.) |
Title Publisher 3-D Monster Chase Romik Software All or Nothing Abbex Electronics Arrow of Death Part 1 Digital Fantasia Arrow of Death Part 2 Digital Fantasia Atic Atac Ultimate Play The Game Auf Wiedersehen Pet Tynesoft Bingo Tynesoft Birds and the Bees, The Bug-Byte Software Ltd Blade Alley PSS Blastermind! Martech Games Ltd Blob, The 16/48 Tape Magazine Bongo Anirog Software Cagara Players Software Colour Clash Romik Software Connect 4 John Westhead Covenant, The PSS Crazy Golf Mr. Micro Ltd Currah MicroSpeech Currah Computer Components Ltd Currah MicroSpeech Software Cecomsa Evil Dead, The Palace Software Fruit Snapper LiveWire Software Giant's Revenge Thor Computer Software Golden Baton Digital Fantasia Grand Prix Driver Britannia Software Ltd Gremlins Thor Computer Software Harlequin Mr. Micro Ltd Hunchback Ocean Software Ltd Insult Generator Greg Fox Island, The Crystal Computing Jack and the Beanstalk Thor Computer Software Learn with Ted Playground Software Lunar Jetman Ultimate Play The Game Lunar Rescue Lyversoft Max Headroom Quicksilva Ltd Maze of Terror Kevin Hillyer Maziacs DK'Tronics Ltd Mega Fruit Thor Computer Software Mined-Out Quicksilva Ltd Moon Alert Ocean Software Ltd Mr. Wimpy Ocean Software Ltd Mystic Tower Aardvark Software Night Stalker Thor Computer Software Pi-Balled Automata UK Ltd Pogo Ocean Software Ltd Pontoon Oxford Computer Publishing Psi-Spy Postern Ltd Punchy Mr. Micro Ltd Rainy Day CCS Rockfall Crash Rockfall II Crash Roulette Oxford Computer Publishing Sexy Black Jack Load 'n' Run [Ita] Shark Attack Romik Software Skelby - The Schizophrenic Droid Q Bit Spectrum Voice Chess Artic Computing Ltd Spiders Web Thor Computer Software Sport of Kings Mastertronic Added Dimension Spyship SOS Dynamic Software Starbike The Edge Software Steve Davis Snooker CDS Microsystems Terrahawks CRL Group PLC Timebomb CDS Microsystems Time Machine, The Digital Fantasia Titanic R&R Software Ltd Twin Kingdom Valley Bug-Byte Software Ltd War of the Worlds, The CRL Group PLC Xavior PSS Zepherus National Software Library Zig Zag DK'Tronics Ltd |
Spectrum Sound Speech I/O Ports |
0-5 SP0256-AL2 Allophone number 6-7 Unknown |
0-6 Unknown 7 Load Request (LRQ) (0=Buffer full, 1=Ready to receive data) |
0-5 SP0256-AL2 Allophone number 6-7 Unknown |
0-6 Unknown 7 Load Request (LRQ) (0=Ready to receive data, 1=Not ready) |
LPRINT "\d k tronics" LPRINT "print this\speak this" |
0-5 SP0256-AL2 Allophone number 6-7 Unknown |
0-7 Data/Opcode from the (newly) activated ROM |
0 Load Request (LRQ) (1=Buffer full, 0=Ready to receive data) 1-7 Unknown/unused |
0-5 SP0256-AL2 Allophone Number (00h..3Fh) 6 Intonation (0=Decrease Pitch, 1=Increase Pitch) 7 Unknown/unused (should be zero) |
LET keys=0 ;disable spoken keystrokes (recommended for LOAD/SAVE) LET keys=1 ;enable spoken keystrokes (default) LET s$="he(ll)(oo)" ;say hello (normal lowercase) LET s$="hE(ll)(oO)" ;say hello (with raised intonation on "e" and "(oo)") PAUSE 1 ;wait for Vblank IRQ (where s$ is processed) CLEAR n ;change RAMTOP (speech buffer is between RAMTOP and UDG) IF PEEK(65364)=81 ;buffer pointer LSB, [FF54h]=51h=buffer_empty (on 48K) IF s$(TO 1)="*" ;check if s$ was processed (copied to speech buffer) IF s$(TO 1)="?" ;check if s$ was rejected (contained invalid characters) IF s$(TO 1)=other ;check if s$ was not yet processed (or buffer full) |
FF57h - Flag byte FF56h - Spare (unused general purpose byte; NOT reserved for anything) FF55h - Hi byte of buffer pointer ;\contains FF51h when empty FF54h - Lo byte of buffer pointer ;/ FF53h - Spare (unused general purpose byte; NOT reserved for anything) FF52h - Spare (unused general purpose byte; NOT reserved for anything) FF51h..FE58h - Speech buffer (default size=250) [FF51h]=next allophone |
Spectrum Sound Speech SP0256 Voice Generator |
Amplitude --> F0 --> F1 --> F2 --> F3 --> F4 --> F5 --> PWM --> External Pitch/Noise B0 B1 B2 B3 B4 B5 5kHz Filter |
Sample Rate = 3.12MHz/2/156 = 10.0kHz ;100us per sample |
6.4ms per repeat (noise and pause), or 9.1ms per repeat (tone with pitch=91) |
Amplitude = lower5bit SHL upper3bit |
__ Amplitude level (+) | | | |________|________|________ __ Zero level PITCH |
<-Pitch-> __ Amplitude level (-) <--------repeat=3---------> |
__ Amplitude level (+) | | | |_|_.____|_|_.____|_|_.____ __ Zero level PITCH+FILTERS | | | | | | | | | __ Amplitude level (-) |
__ Amplitude level (+) ||| || | | | || | || ||| | |||_|| |__|_|__||_|___|| |||_| __ Zero level NOISE | | || | || | ||| | | <-64->| || | || | ||| | | __ Amplitude level (-) <----------repeat=5----------> |
__ Amplitude level (+) |
______________________________ __ Zero level PAUSE (SILENCE) |
<-64-> __ Amplitude level (-) <----------repeat=5----------> |
_____ _____ ------------------>| |------------------->| |-----+-----> _____ | SUB | ______ | SUB | | +--->| *B |--->|_____| +--->| *2*F |-->|_____| | | |_____| _____ | |______| _____ | +---------------|OLDER|<---+---------------| OLD |<----+ |_____| |_____| |
for i=0 to 5 ;filter number sample = sample - quant_table[F.i] * OLD.i * 2 ;F0..F5 registers sample = sample - quant_table[B.i] * OLDER.i ;B0..B5 registers OLDER.i = OLD.i OLD.i = sample next i |
0 ,9 ,17 ,25 ,33 ,41 ,49 ,57 ,65 ,73 ,81 ,89 ,97 ,105,113,121 129,137,145,153,161,169,177,185,193,201,209,217,225,233,241,249 257,265,273,281,289,297,301,305,309,313,317,321,325,329,333,337 341,345,349,353,357,361,365,369,373,377,381,385,389,393,397,401 405,409,413,417,421,425,427,429,431,433,435,437,439,441,443,445 447,449,451,453,455,457,459,461,463,465,467,469,471,473,475,477 479,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495 496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511 |
Spectrum Sound Speech SP0256 Instruction Set |
0000b SETPAGE/RET Set Page for JUMP/CALL, or Return from CALL 0001b SETMODE Set the MODE bits and Repeat MSBs 0010b LOAD_23 Load Pitch, Amplitude, 2-3 Coefficients 0011b LOAD_56 Load Pitch, Amplitude, 5-6 Coefficients 0100b LOAD_56D Load Pitch, Amplitude, 5-6 Coefficients, Delta 0101b SETMSB_3 Load Amplitude, MSBs of 3 Coefficients 0110b SETMSB_23 Load Amplitude, MSBs of 2 or 3 Coeffcients 0111b LOAD_PA Load Pitch, Amplitude 1000b LOAD_ALL Load All Parameters (at full 8bit precision) 1001b DELTA_56 Add Delta to Amplitude, Pitch, 5 or 6 Coefficients 1010b SETMSB_3P Load Amplitude, MSBs of 3 Coefficients, Pitch 1011b DELTA_23 Add Delta to Amplitude, Pitch, 2 or 3 Coefficients 1100b SETMSB_3D Load Amplitude, MSBs of 3 Coefficients, Delta 1101b CALL Jump to Subroutine (12-bit PAGE-Relative Address) 1110b JUMP Jump to 12-bit PAGE-Relative Address 1111b PAUSE Silent Pause |
4 Target bit8-11 (in reversed bit-order!) 4 Opcode (must be 1110b or 1101b) 8 Target bit0-7 (in reversed bit-order!) 0..7 Byte-alignment for next opcode (should be padded with 0 bits) |
4 Zero for RET (00h=Return) 4 Opcode (must be 0000b) 0..7 Byte-alignment for next opcode (should be padded with 0 bits) |
4 Target bit12-15 (in reversed bit-order!) (01h..0Fh=Page) The above target bits are used for ALL following JUMP/CALL opcodes 4 Opcode (must be 0000b) |
2 Repeat Count bit4-5 (expands the next ONE opcode that uses 4bit repeat) 1 WIDTH for ALL following opcodes (0=Smaller, 1=Bigger bit-width) 1 EXTRA for ALL following opcodes (0=Exclude, 1=Include optional params) 4 Opcode (must be 0001b) |
4 Repeat Count 4 Opcode (must be 1111b) |
4 Repeat Count 4 Opcode (must be 0111b) 6 Amplitude MSBs (upper 3bit are exponent) 8 Pitch (00h=Noise) |
4 Repeat Count 4 Opcode (must be 1000b) 8 Amplitude unsigned (upper 3bit are exponent) 8 Pitch unsigned (00h=Noise) 8 Coeff B0 signed ;\coeff pair 0 8 Coeff F0 signed ;/ 8 Coeff B1 signed ;\coeff pair 1 8 Coeff F1 signed ;/ 8 Coeff B2 signed ;\coeff pair 2 8 Coeff F2 signed ;/ 8 Coeff B3 signed ;\coeff pair 3 8 Coeff F3 signed ;/ 8 Coeff B4 signed ;\coeff pair 4 8 Coeff F4 signed ;/ 8 Coeff B5 signed ;\coeff pair 5 8 Coeff F5 signed ;/ (8) Amplitude Interpolation, signed ;\when EXTRA=1 only (8) Pitch Interpolation, signed ;/ |
4 Repeat Count 4 Opcode (must be 0010b or 0011b or 0100b) 6 Amplitude MSBs (upper 3bit are exponent) 8 Pitch (00h=Noise) 3/6 Coeff B0 Bit4/1..6 unsigned ;\coeff pair 0 ;\ 5/6 Coeff F0 Bit3/2..7 signed ;/ ; 3/6 Coeff B1 Bit4/1..6 unsigned ;\coeff pair 1 ; opcode LOAD_56D, 5/6 Coeff F1 Bit3/2..7 signed ;/ ; and LOAD_56 only 3/6 Coeff B2 Bit4/1..6 unsigned ;\coeff pair 2 ; 5/6 Coeff F2 Bit3/2..7 signed ;/ ;/ 4/6 Coeff B3 Bit3/1..6 unsigned ;\coeff pair 3 6/7 Coeff F3 Bit2/1..7 signed ;/ 7/8 Coeff B4 Bit1/0..7 signed ;\coeff pair 4 6/8 Coeff F4 Bit2/0..7 signed ;/ (8) Coeff B5 Bit0..7 signed ;\coeff pair 5 ;\when EXTRA=1 only (8) Coeff F5 Bit0..7 signed ;/ ;/ 5 Amplitude Interpolation LSBs, unsigned ;\opcode LOAD_56D only 5 Pitch Interpolation LSBs, unsigned ;/ |
4 Repeat Count 4 Opcode (must be 0101b or 0110b or 1010b or 1100b) 6 Amplitude MSBs (upper 3bit are exponent) [8] Pitch (00h=Noise) ;-Opcode SETMSB_3P only 5/6 New F0 MSBs signed ;\ 5/6 New F1 MSBs signed ; Opcode SETMSB_3/3P/3D only 5/6 New F2 MSBs signed ;/ 6/7 New F3 MSBs signed ;\ 6/8 New F4 MSBs signed ; Opcode SETMSB_23 only (8) New F5 MSBs signed (when EXTRA=1 only) ;/ (0) Set F5=0 and B5=0 (when EXTRA=0 only) [5] Amplitude Interpolation LSBs, unsigned ;\Opcode SETMSB_3D only [5] Pitch Interpolation LSBs, unsigned ;/ |
4 Repeat Count 4 Opcode (must be 1001b or 1011b) 4 Amplitude Interpolation 6 MSBs signed 5 Pitch Interpolation LSBs signed 3/4 B0 4,7 MSBs signed ;\ ;\ 3/4 F0 5,6 MSBs signed ;/ ; 3/4 B1 4,7 MSBs signed ;\ ; opcode DELTA_56 only 3/4 F1 5,6 MSBs signed ;/ ; 3/4 B2 4,7 MSBs signed ;\ ; 3/4 F2 5,6 MSBs signed ;/ ;/ 3/4 B3 5,7 MSBs signed ;\ 4/5 F3 6,7 MSBs signed ;/ 4/5 B4 x,8 MSBs signed ;\ <---- DELTA_56: x=6, and DELTA_23: x=7 (?) 4/5 F4 6,8 MSBs signed ;/ (5) B5 (8) MSBs signed ;\ ;\when EXTRA=1 only (5) F5 (8) MSBs signed ;/ ;/ |
Spectrum Sound Speech SP0256 Allophones/Words |
Num Name Example Funny Actual Num Name Example Funny Actual 00h PA1 PAUSE 10ms 6.4ms 20h /AW/ Out 370ms 254.8ms 01h PA2 PAUSE 30ms 25.6ms 21h /DD2/ Do 160ms 72.1ms 02h PA3 PAUSE 50ms 44.8ms 22h /GG3/ Wig 140ms 110.5ms 03h PA4 PAUSE 100ms 96.0ms 23h /VV/ Vest 190ms 127.4ms 04h PA5 PAUSE 200ms 198.4ms 24h /GG1/ Got 80ms 72.1ms 05h /OY/ Boy 420ms 291.2ms 25h /SH/ Ship 160ms 198.4ms 06h /AY/ Sky 260ms 172.9ms 26h /ZH/ Azure 190ms 134.1ms 07h /EH/ End 70ms 54.6ms 27h /RR2/ Brain 120ms 81.9ms 08h /KK3/ Comb 120ms 76.8ms 28h /FF/ Food 150ms 108.8ms 09h /PP/ Pow 210ms 147.2ms 29h /KK2/ Sky 190ms 134.4ms 0Ah /JH/ Dodge 140ms 98.4ms 2Ah /KK1/ Can't 160ms 115.2ms 0Bh /NN1/ Thin 140ms 172.9ms 2Bh /ZZ/ Zoo 210ms 148.6ms 0Ch /IH/ Sit 70ms 45.5ms 2Ch /NG/ Anchor 220ms 200.2ms 0Dh /TT2/ To 140ms 96.0ms 2Dh /LL/ Lake 110ms 81.9ms 0Eh /RR1/ Rural 170ms 127.4ms 2Eh /WW/ Wool 180ms 145.6ms 0Fh /AX/ Succeed 70ms 54.6ms 2Fh /XR/ Repair 360ms 245.7ms 10h /MM/ Milk 180ms 182.0ms 30h /WH/ Whig 200ms 145.2ms 11h /TT1/ Part 100ms 76.8ms 31h /YY1/ Yes 130ms 91.0ms 12h /DH1/ They 290ms 136.5ms 32h /CH/ Church 190ms 147.2ms 13h /IY/ See 250ms 172.9ms 33h /ER1/ Letter 160ms 109.2ms 14h /EY/ Beige 280ms 200.2ms 34h /ER2/ Fir 300ms 209.3ms 15h /DD1/ Could 70ms 45.5ms 35h /OW/ Beau 240ms 172.9ms 16h /UW1/ To 100ms 63.7ms 36h /DH2/ Bath 240ms 182.0ms 17h /AO/ Aught 100ms 72.8ms 37h /SS/ Vest 90ms 64.0ms 18h /AA/ Hot 100ms 63.7ms 38h /NN2/ No 190ms 136.5ms 19h /YY2/ Yes 180ms 127.4ms 39h /HH2/ Hoe 180ms 126.0ms 1Ah /AE/ Hat 120ms 81.9ms 3Ah /OR/ Store 330ms 236.6ms 1Bh /HH1/ He 130ms 89.6ms 3Bh /AR/ Alarm 290ms 200.2ms 1Ch /BB1/ Business 80ms 36.4ms 3Ch /YR/ Clear 350ms 245.7ms 1Dh /TH/ Thin 180ms 128.0ms 3Dh /GG2/ Guest 40ms 69.4ms 1Eh /UH/ Book 100ms 72.8ms 3Eh /EL/ Saddle 190ms 136.5ms 1Fh /UW2/ Food 260ms 172.9ms 3Fh /BB2/ Business 50ms 50.2ms |
<--------------- Currah Codes ---------------> Num ASCII Num ASCII Num ASCII Num ASCII 18h a 27h r 14h (aa)/(ay) 29h (ck) 1Ch b 37h s 13h (ee) 3Ch (ear) 08h c 11h t 06h (ii) 1Ah (eh) 15h d 0Fh u 35h (oo)/(eau) 33h (er) 07h e 23h v 3Fh (bb) 34h (err) 28h f 2Eh w 21h (dd) 2Ch (ng) 24h g - x "ks" 3Dh (gg) 3Ah (or) 1Bh h 31h y 22h (ggg) 16h (ou) 0Ch i 2Bh z 39h (hh) 1Fh (ouu) 0Ah j 3Eh (ii) 20h (ow) 2Ah k 36h N/A 38h (nn) 05h (oy) 2Dh l 00h EOL 0Eh (rr) 25h (sh) 10h m 01h ' 0Dh (tt) 1Dh (th) 0Bh n 02h N/A 19h (yy) 12h (dth) 17h o 03h SPACE 3Bh (ar) 1Eh (uh) 09h p 04h , 2Fh (aer) 30h (wh) - q "kw" 04hx2 . 32h (ch) 21h (zh) |
00h (SPB640 08h One 14h Thirteen 20h Seventy Speech 09h Two 15h Fourteen 21h Eighty FIFO) 0Ah Three 16h Fifteen 22h Ninety 01h pause4 0Bh Four 17h Sixteen 23h Hundred 02h pause3 0Ch Five 18h Seventeen 24h Thousand 03h pause2 0Dh Six 19h Eighteen 25h -teen 04h pause1 0Eh Seven 1Ah Nineteen 26h -ty 05h pause0 0Fh Eight 1Bh Twenty 27h Press 06h "Mattel 10h Nine 1Ch Thirty 28h Enter Electronics 11h Ten 1Dh Fourty 29h Or Presents" 12h Eleven 1Eh Fifty 2Ah And 07h Zero 13h Twelve 1Fh Sixty |
00h Oh 09h Nine 12h Eighteen 1Bh Hour 01h One 0Ah Ten 13h Nineteen 1Ch Minute 02h Two 0Bh Eleven 14h Twenty 1Dh Hundred Hour 03h Three 0Ch Twelve 15h Thirty 1Eh Good Morning 04h Four 0Dh Thirteen 16h Forty 1Fh Attention Please 05h Five 0Eh Fourteen 17h Fifty 20h Please Hurry 06h Six 0Fh Fifteen 18h It is 21h Melody A 07h Seven 10h Sixteen 19h A.M. 22h Melody B 08h Eight 11h Seventeen 1Ah P.M. 23h Melody C |
80h..BFh Allophones (same as 00h..3Fh on SP0256-AL2) C0h "Enemy" C1h "All clear" C2h "Please" C3h "Get off" C4h "Open fire" C5h "Watch out" C6h "Mercy" C7h "Hit it" C8h "You blew it" C9h "Do it again" CAh "Incredible" FAh "U.F.O." FBh "Monster!" |
Spectrum Sound Speech SP0256 Pin-Outs |
1 GND 2 /RESET 3 ROM DISABLE 4 C1 5 C2 6 C3 7 VCC1 8 SBY 9 /LRQ 10 A8 11 A7 12 SER OUT 13 A6 14 A5 15 A4 16 A3 17 A2 18 A1 19 SE 20 /ALD 21 SER IN 22 TEST 23 VCC2 24 PWM OUT 25 /SBY RESET 26 ROM CLK 27 OSC1 28 OSC2 |
1 GND 2 C3 3 NC 4 ROM CLK 5..6 NC 7 CS1 8 /CS2 9 /ROM ENABLE 10 SERIAL OUT 11 VCC 12..13 NC 14 SERIAL IN 15 C1 16 C2 |
1 GND 2 C3 3 NC 4 ROM CLK 5..10 NC 11 CS1 12 /CS2 13 /ROM ENABLE 14 SERIAL OUT 15 VCC 16..21 NC 22 SERIAL IN 23 C1 24 C2 |
Spectrum Sound Digital Playback/Sampling |
OUT DFh ;output unsigned sample data (80h=silence) |
OUT 7Fh ;write any data to start sampling (to be followed by delay) IN BFh ;read sampled data (after OUT 7Fh) OUT BFh ;output (unsigned?) sample data (write twice?) |
OUT BFh ;write any data to start sampling (to be followed by delay) IN 7Fh ;read sampled data (after OUT BFh) OUT 7Fh ;output (unsigned?) sample data (output) |
IN DFh ;dummy read to start sampling (followed by delay, and then IN BFh) IN BFh ;read sampled data (unsigned, 80h=silence) (after IN DFh) OUT 9Fh ;output 8bit unsigned sample data (80h=silence) OUT 5Fh ;maybe MIDI (used 4 times with values 00h,01h) ;-INTERRUPT? OUT FC7Fh ;maybe MIDI (used 5 times with values 03h,91h,31h,11h) ;\ OUT FD7Fh ;maybe MIDI (used 1 time with variable value) ; ACIA? -- FE7Fh ;maybe MIDI (not used by existing software?) ; IN FF7Fh ;maybe MIDI (used 1 time) ;/ |
&F8E8(Write only) INTERUPT SEL Writing 01 to this port disables internal Amstrad interrupts and replaces the IRQ signal from ACIA. Writing 00 restores normality. &F8EC(Write only) ACIA Control See 6850 ACIA chip for details &F8ED(Write only) ACIA Data write See 6850 ACIA chip for details &F8EE(Read only) ACIA Status See 6850 ACIA chip for details &F8EF(Read only) ACIA Data read See 6850 ACIA chip for details |
Spectrum Disc and Tape Drives |
Interface Chip Type Cmd/Stat Track Sector Data Misc MFT PlusD 1772 IO E3h EBh F3h FBh EFh,E7h,F7h MFT Disciple 1772 IO 1Bh 5Bh 9Bh DBh 1Fh,3Bh,7Bh,BBh,FBh Beta Disk 1793 IO 1Fh 3Fh 5Fh 7Fh FFh Didaktik D80 ? IO 81h 83h 85h 87h 89h JLO ? IO 8Fh 9Fh AFh BFh B7h Putnik 1991 1772 IO F1h F3h F5h F7h DFh/1Fh Putnik 1998 1772 IO 73h F3h 77h F7h DFh/1Fh Opus Discovery 1770 MEM 2800h 2801h 2802h 2803h 3000h-3003h, IO:1Fh Spectrum +3 765 IO N/A N/A N/A 3FFDh 2FFDh,1FFDh |
Stepping Compatible MotorOn Pin20 WD179x Slow No WD1770 Slow Yes(Pin20) MO WD1772 Faster Yes(Pin20) MO WD1773 Slow WD1793 No END/RDY |
1 /CS 28 INTRQ -> 2 R/W 27 DRQ -> 3 A0 26 /DDEN <- Double Density Enable 4 A1 25 /WRPT <- 5 D0 24 /IP <- Index Hole 6 D1 23 /TR00 <- 7 D2 22 WD Write Data -> 8 D3 21 WG Write Gate -> 9 D4 20 MO Motor On -> 10 D5 19 /RD Read Data <- 11 D6 18 CLK 8MHz <- 12 D7 17 SD Step-Direction -> 13 /RES 16 STEP Step -> 14 GND 15 +5V |
0-4 Kempston Joystick 5 Not used (always 0) 6 INTRQ (from FDC chip) 7 DRQ (from FDC chip) |
Type divIDE Vehmaa Vehmaa 1-Chip Putnik Putnik Putnik Putnik SAfri ZXCF ZXATASP 8bitv1 8bitv2 16bitv1 16bitv2 16bit Data &xxA3 &00BF &039F? &00EF &xx2B &00BF &xx69 &xx2B &xx59 Error &xxA7 &01BF &039F? &01EF &xx2F &01BF &xx79 &xx2F &xx5B Count &xxAB &02BF &039F? &10EF &xx6B &10BF &xx6B &xx6B &xx5D Sector &xxAF &03BF &039F? &11EF &xx6F &11BF &xx7B &xx6F &xx5F CylinderLo &xxB3 &04BF &039F? &20EF &xxAB &20BF &xx6D &xxAB &xx79 CylinderHi &xxB7 &05BF &039F? &21EF &xxAF &21BF &xx7D &xxAF &xx7B Drive &xxBB &06BF &039F? &30EF &xxEB &30BF &xx6F &xxEB &xx7D Command &xxBF &07BF &039F? &31EF &xxEF &31BF &xx7F &xxEF &xx7F DataLo &08BF &009F? DataHi &09BF &019F? Error &0EBF AltStatus &0FBF Control &xxE3 |
Type Vehmaa Vehmaa Putnik JGH Sinclair ZXCF ZXATSP RomSwitch ROMBox Spectrum128 Range &00-&3F &00-&3F &00-&03 &00-&F0 &00-&10 Page ROM &10BF,n &029F,n &xxA9,n &xxFD,16*n &7FFD,16*n ZX ROM &10BF,&80+x &xxFD,&10 &7FFD,&10 RESET ROM &00 &00 &03 &00 &00 |
Spectrum Disc and Tape Drive Summary |
Spectrum Disc and Tape Commands |
LOAD "" ;load basic program (by wildcard) LOAD <filename> ;load basic program (by name) LOAD "picture.bin" CODE ;load binary to original addr LOAD "picture.bin" CODE dest(,len_verify) ;load binary to other addr LOAD "picture.bin" CODE SCREEN$ ;load binary to VRAM LOAD <filename> DATA a () ;load numeric array LOAD <filename> DATA a$ () ;load character array SAVE <filename> ;save basic program SAVE <filename> LINE <linenumber> ;save basic program with autostart SAVE "picture.bin" CODE SCREEN$ ;save binary file (VRAM at 4000h) SAVE "picture.bin" CODE 16384,6912 ;save binary file (same as SCREEN$) SAVE "picture.bin" CODE start,length ;save binary file (custom area) SAVE <filename> DATA a () ;save numeric array SAVE <filename> DATA a$ () ;save character array VERIFY <filename> ;compare file with program in in RAM MERGE <filename> ;merge file with program in in RAM |
filename="DISK" ;default name for "loader" option in +3 BIOS menu filename="filename.ext" ;max 8.3 characters (for CP/M-style filesystem) MOVE oldname newname ;rename (or move to other drive) MOVE oldname TO attr ;change attr "+p" "+s" "+a" or "-p" "-s" "-a" COPY oldname newname ;copy COPY textfile TO SCREEN$ COPY textfile TO LPRINT COPY binfile TO SPECTRUM FORMAT ;creates binfile.HED (with binary HEaDer) LOAD "d:" ;set default load drive (a:disk1, b:disk2, m:ramdisk, t:tape) SAVE "d:" ;set default save drive (a:disk1, b:disk2, m:ramdisk, t:tape) CAT (#stream),"filename" ;show directory (on stream #n) ERASE filename ;delete FORMAT drive FORMAT LINE baudrate ;set RS232 baudrate FORMAT LPRINT "r" ;redirect printer ("p") to RS232 ("r") stream |
OPEN #n,"k" ;keyboard (default=#1) OPEN #n,"s" ;screen (default=#2) OPEN #n,"p" ;printer (default=#3) |
LOAD! SAVE! MERGE! CAT! ERASE! --> access RAM disk |
LOAD * "m" ;1; "filename" SAVE * "m" ;1; "filename" FORMAT "m" ;1; "filename" CAT 1 |
CAT * ;directory for default drive CAT * "a:" ;directory for drive A CAT # "a:" ;set A as default drive and load (but do not show) directory POKE 23767,n ;set default drive (0=A, 1=B) SAVE * "a:name" ;save on drive A SAVE * "name" ;save on default drive |
FORMAT "j";1 ;enable kempston joystick port in opus discovery FORMAT "j";0 ;disable kempston joystick port in opus discovery |
LET DOS=15360 ;=3C00h ;for Beta and Beta Plus (TRDOSv1 or TRDOSv4) LET DOS=15616 ;=3D00h ;for Beta 128 (TRDOSv5) RANDOMIZE USR DOS+3:REM:LOAD"D:FILENAME" ;load from drive D RANDOMIZE USR DOS+0 ;switch from BASIC to TRDOS |
LIST (K-key) ;show directory ;<B>=bootable LOAD (J-key) or RUN (R-key) ;load a file USR ;set disk password RETURN (Y-key) ;switch from TRDOS to BASIC |
PRINT #4:LOAD"filename" PRINT #4:CAT:PRINT d ;d=drive number (1..4) |
RANDOMIZE USR 100: OPEN# 4, "dd" |
PRINT #4:LOAD"filename" |
Spectrum Cassette |
Silence (low level) 8063 (Header) or 3223 (Data) Pilot Pulses (2168 clks/pulse) (619us/pulse) 1st Sync Pulse (667 clks/pulse) (190us/pulse) 2nd Sync Pulse (735 clks/pulse) (210us/pulse) Blocktype Byte (00h=Header, FFh=Data) Data Byte(s) (two 855 or 1710 clks/pulse per bit) (244 or 488 us/pulse) Checksum Byte (above Blocktype and Data Bytes XORed with each other) End pulse (opposite level of last pulse) Silence (low level) |
/"""\__/ Sync Pulses (1st=667, 2nd=735 clks/pulse) /""""\____/ "0"-Bit (two pulses, 855 clks/pulse) /"""""""""\_________/ "1"-Bit (two pulses, 1710 clks/pulse) /""""""""""""\____________/ etc. Pilot Pulses (2168 clks/pulse) |
Pre 1 Blocktype (aka Flag Byte) (must be 00h for Header blocks) 0 1 Filetype (0..3, see below) 1 10 Filename (padded with blanks, ie. chr(20h)) 11 2 Length of following Data Block (LEN) 13 4 Parameters (depends on Filetype, see below) Post 1 Checksum (above 18 bytes XORed with each other) |
Pre 1 Blocktype (aka Flag Byte) (must be FFh for Data Blocks) 0 LEN Data Post 1 Checksum (above LEN+1 bytes XORed with each other) |
13 2 Autostart LINE Number (or 8000h..FFFFh if no autostart) 15 2 Size of the PROG area aka start of the VARS area |
13 1 Unknown 14 1 Name of the variable 15 2 Unknown |
13 2 Memory Address 15 2 Unused (Should be 8000h) |
Spectrum Cassette TZX Format |
00h 8 TZX signature ("ZXTape!",1Ah) 08h 1 TZX major revision number (currently 01h, for v1.20) 09h 1 TZX minor revision number (currently 1Ah, for v1.20) |
00h 2 Pause after this block (ms) (0=none) {1000} 02h 2 Length of data that follow (N) 04h N Data as in .TAP files (first byte implies number of pilot pulses) |
00h 2 Length of PILOT pulse {2168} ;-occurs P times at begin 02h 2 Length of SYNC first pulse {667} ;-occurs ONCE after above 04h 2 Length of SYNC second pulse {735} ;-occurs ONCE after above 06h 2 Length of ZERO bit pulse {855} ;-occurs TWICE per bit 08h 2 Length of ONE bit pulse {1710} ;-occurs TWICE per bit 0Ah 2 Number of PILOT pulses (P) {8063 for header, 3223 for data) 0Ch 1 Number of used bits in the last byte {8} (e.g. if this is 6, then the bits used (x) in the last byte are: xxxxxx00, where MSb is the leftmost bit, LSb is the rightmost bit) 0Dh 2 Pause after this block (ms) (0=none) {1000} 0Fh 3 Length of data that follow (N) 12h N Data as in .TAP files {block_type, data[N-2], chksum} |
00h 2 Length of one pulse in T-states 02h 2 Number of pulses |
00h 1 Number of pulses (N) 01h 2*N Pulse lengths (16bit each) |
00h 2 Length of ZERO bit pulse 02h 2 Length of ONE bit pulse 04h 1 Used bits in last byte (other bits should be 0) (e.g. if this is 6, then the bits used (x) in the last byte are: xxxxxx00, where MSb is the leftmost bit, LSb is the rightmost bit) 05h 2 Pause after this block (ms) (0=none) 07h 3 Length of data that follow (N) 0Ah N Data as in .TAP files |
00h 2 Number of T-states per sample-bit (usually 158 or 79) 02h 2 Pause after this block (ms) (0=none) 04h 1 Used bits (samples) in last byte of data (1..8) (eg. 2 means only first two samples of the last byte will be played) 05h 3 Length of sample data in bytes (N) 08h N Sample data. Each bit represents a state on the EAR port (i.e. one sample). MSb is played first. |
00h 4 Block length (without these four bytes) (10h+N) 04h 2 Pause after this block (ms) (0=none) 06h 3 Sampling rate 09h 1 Compression type (01h=RLE, 02h=Z-RLE) 0Ah 4 Number of stored pulses (after decompression, for validation purposes) 0Eh N CSW data, encoded according to the CSW file format specification. |
00h 2 Pause after this block (ms) (or 0=stop tape, ie. infinite pause) |
00 1 Length of the group name string (L) 01 L Group name in ASCII format (please keep it under 30 characters long) |
00h 2 Relative jump value (number of blocks, from current block) |
Jump +0 = Loop Forever ;this should never happen Jump +1 = Go to the next block ;acts as a NOP in assembler Jump +2 = Skip one block Jump -1 = Go to the previous block |
00h 2 Number of repetitions (greater than 1) |
00h 1 Number of calls to be made (N) 02h 2*N Array of call block numbers (relative-signed 16bit offsets) |
00h 2 Length of the whole block (without these two bytes) 02h 1 Number of selections (N) 03h .. List of selections |
00 2 Relative Offset (16bit) 02 1 Length of description text (L) 03 L Description text in ASCII (please use single line and max 30 chars) |
00h 4 Length of the block without these four bytes (=0) |
00h 4 Block length (without these four bytes) (=1) 04h 1 Signal level (0=low, 1=high) |
00h 1 Length of the text description (N) 01h N Text description in ASCII format |
00h 1 Time (in seconds) for which the message should be displayed 01h 1 Length of the text message (N) 02h N Message that should be displayed in ASCII format |
stick to a maximum of 30 chars per line; use single 0x0D (13 decimal) to separate lines; stick to a maximum of 8 lines. |
00h 2 Length of the whole block (without these two bytes) 02h 1 Number of text strings (N) 03h N List of Text Structures |
00h 1 Text identification byte (see list below) 01h 1 Length of text string (L) 02h L Text string in ASCII format |
00h Full title 01h Software house/publisher 02h Author(s) 03h Year of publication (eg. 1982) (in ASCII, too) 04h Language (v1.10 and up) (eg. English) (=default) 05h Game/utility type (v1.12 and up) (eg. arcade adventure, puzzle) 06h Price with currency (v1.12 and up) (eg. GBP 5.99, or chr(A3h)=GBP) 07h Protection scheme/loader (v1.12 and up) (eg. Speedlock 1, Alkatraz) 08h Origin (v1.12 and up) (eg. Original, Budget re-release) FFh Comment(s) xxh Reserved for future (decoders should skip any unknown entries) |
00h 1 Number of machines and hardware types for which info is supplied (N) 01h 3*N List of machines and hardware |
00h 2 General emulation flags: bit 0 : R-register emulation [1] bit 1 : LDIR emulation [1] bit 2 : high resolution colour emulation with true interrupt freq. [1] bit 3,4 : video synchronisation (1=high, 3=low, 0,2=normal) [0] bit 5 : fast loading when BIOS load routine is used [1] bit 6 : border emulation [1] bit 7 : screen refresh mode (0=off, 1=on) [1] bit 8 : start playing the tape immediately (0=no, 1=yes) [0] bit 9 : auto type LOAD"" or press ENTER when in 128k mode [0] 02h 1 Update screen every N frames (1..255) (used only when flags.bit7=1) 03h 2 Interrupt Frequency in Hertz (0..999) 05h 3 Reserved for future expansion |
00h 16 Identification string (in ASCII) (usually padded with spaces) 10h 1 Length of the custom info (L) 14h L Custom info |
00h 1 Snapshot type (00h=.Z80 format, 01h=.SNA format) 01h 3 Snapshot length (L) 04h L The Snapshot itself |
00h 9 ZXTape Header (excluding the "Z", ie. "XTape!",1Ah,MajR,MinR) |
00h 4 Block length (32bit) (without these four bytes) 04h .. Reserved |
Spectrum Cassette TZX Format HW |
00h 1 Number of machines and hardware types for which info is supplied (N) 01h 3*N List of machines and hardware (HWINFO) |
00h 1 Hardware type (00h..10h; see the headlines of the ID lists) 01h 1 Hardware ID (00h..xxh; see the ID list entries) 02h 1 Hardware information (00h..03h; see the small table below) |
00h The tape RUNS on this hardware (and may or may not use its features) 01h The tape RUNS and DOES use the special features of the hardware 02h The tape RUNS but DOES-NOT use the special features of the hardware 03h The tape DOES-NOT-WORK on this hardware |
- runs on ZX Spectrum 48K - runs on, but doesn't use any of the special hardware of ZX Spectrum 128K - doesn't run on ZX Spectrum 16K |
00h ZX Spectrum 16k 01h ZX Spectrum 48k, Plus 02h ZX Spectrum 48k ISSUE 1 03h ZX Spectrum 128k + (Sinclair) 04h ZX Spectrum 128k +2 (grey case) 05h ZX Spectrum 128k +2A, +3 06h Timex Sinclair TC-2048 07h Timex Sinclair TS-2068 08h Pentagon 128 09h Sam Coupe 0Ah Didaktik M 0Bh Didaktik Gama 0Ch ZX-80 (via ID 19h, generalized data block, supported in v1.20 and up) 0Dh ZX-81 (via ID 19h, generalized data block, supported in v1.20 and up) 0Eh ZX Spectrum 128k, Spanish version 0Fh ZX Spectrum, Arabic version 10h Microdigital TK 90-X 11h Microdigital TK 95 12h Byte 13h Elwro 800-3 14h ZS Scorpion 256 |
15h Amstrad CPC 464 16h Amstrad CPC 664 17h Amstrad CPC 6128 18h Amstrad CPC 464+ 19h Amstrad CPC 6128+ |
1Ah Jupiter ACE 1Bh Enterprise |
1Ch (was intended for Commodore 64) 1Dh (was intended for Commodore 128) |
1Eh Inves Spectrum+ 1Fh Profi 20h GrandRomMax 21h Kay 1024 22h Ice Felix HC 91 23h Ice Felix HC 2000 24h Amaterske RADIO Mistrum 25h Quorum 128 26h MicroART ATM 27h MicroART ATM Turbo 2 28h Chrome 29h ZX Badaloc 2Ah TS-1500 2Bh Lambda 2Ch TK-65 2Dh ZX-97 |
00h ZX Microdrive 01h Opus Discovery 02h MGT Disciple 03h MGT Plus-D 04h Rotronics Wafadrive 05h TR-DOS (BetaDisk) 06h Byte Drive 07h Watsford 08h FIZ 09h Radofin 0Ah Didaktik disk drives 0Bh BS-DOS (MB-02) 0Ch ZX Spectrum +3 disk drive 0Dh JLO (Oliger) disk interface 0Eh Timex FDD3000 0Fh Zebra disk drive 10h Ramex Millenia 11h Larken |
12h Kempston disk interface 13h Sandy 14h ZX Spectrum +3e hard disk 15h ZXATASP 16h DivIDE 17h ZXCF |
00h Sam Ram 01h Multiface ONE 02h Multiface 128k 03h Multiface +3 04h MultiPrint 05h MB-02 ROM/RAM expansion |
06h SoftROM 07h 1k 08h 16k 09h 48k 0Ah Memory in 8-16k used |
00h Classic AY hardware (compatible with 128k ZXs) 01h Fuller Box AY sound hardware 02h Currah microSpeech 03h SpecDrum 04h AY ACB stereo (A+C=left, B+C=right); Melodik 05h AY ABC stereo (A+B=left, B+C=right) |
06h RAM Music Machine 07h Covox 08h General Sound 09h Intec Electronics Digital Interface B8001 0Ah Zon-X AY 0Bh QuickSilva AY 0Ch Jupiter ACE |
00h Kempston 01h Cursor, Protek, AGF 02h Sinclair 2 Left (12345) 03h Sinclair 1 Right (67890) 04h Fuller |
00h AMX mouse 01h Kempston mouse |
00h Trickstick 01h ZX Light Gun 02h Zebra Graphics Tablet |
03h Defender Light Gun |
00h ZX Interface 1 01h ZX Spectrum 128k |
00h Kempston S 01h Kempston E 02h ZX Spectrum +3 03h Tasman 04h DK'Tronics 05h Hilderbay 06h INES Printerface 07h ZX LPrint Interface 3 08h MultiPrint 09h Opus Discovery 0Ah Standard 8255 chip with ports 31,63,95 |
00h ZX Printer, Alphacom 32 & compatibles 01h Generic printer 02h EPSON compatible |
00h Prism VTX 5000 01h T/S 2050 or Westridge 2050 |
00h RD Digital Tracer 01h DK'Tronics Light Pen 02h British MicroGraph Pad |
03h Romantic Robot Videoface |
00h ZX Interface 1 |
00h Keypad for ZX Spectrum 128k |
00h Harley Systems ADC 8.2 01h Blackboard Electronics |
00h Orme Electronics |
00h WRX Hi-Res 01h G007 02h Memotech 03h Lambda Colour |
Spectrum Cassette TZX Format ID 19h |
00h 4 Block length (without these four bytes) 04h 2 Pause after this block (ms) (0=none) 06h 4 Total number of symbols in pilot/sync block (can be 0) (TOTP) ;\pilot 0Ah 1 Maximum number of pulses per pilot/sync symbol (NPP) ; hdr 0Bh 1 Number of pilot/sync symbols in alphabet table (0=256) (ASP) ;/ 0Ch 4 Total number of symbols in data stream (can be 0) (TOTD) ;\data 10h 1 Maximum number of pulses per data symbol (NPD) ; hdr 11h 1 Number of data symbols in the alphabet table (0=256) (ASD) ;/ 12h .. Pilot/Sync symbols definition table (only if TOTP>0) ;\pilot .. .. Pilot/Sync RLE-compressed stream (PRLE) (only if TOTP>0) ;/stream .. .. Data symbols definition table (only if TOTD>0) ;\data .. .. Data stream (as in .TAP files) (only if TOTD>0) ;/stream |
00h 1 Symbol flags (b0-b1: starting symbol polarity) 0: opposite to current level (make an edge, as usual) - default 1: same as current level (no edge - prolongs previous pulse) 2: force low level 3: force high level 01h 2*MAXP Pulse lengths (16bit) (padded with 0000h if less than MAXP used) |
00h 1 Symbol to be output (eg. a symbol that defines the Pilot pulse) 01h 2 Number of repetitions (eg. number of Pilot pulses) |
00h 0000xxxxh ;Total block length (28h+LEN) 04h 03E8h ;Pause after this block (ms) 06h 00000002h ;Total number of pilot/sync symbols TOTP;\ 0Ah 02h ;Max pulses per symbol NPP ; pilot header 0Bh 02h ;Number of symbols in pilot/sync alphabet ASP ;/ 0Ch LEN*8 ;Total number of data symbols TOTD;\ 10h 02h ;Max pulses per data symbol NPD ; data header 11h 02h ;Number of symbols in data alphabet ASD ;/ 12h 00h,02168,00000 ;Pilot Symbol 0 (single pilot pulse) 17h 00h,00667,00735 ;Pilot Symbol 1 (two sync pulses) 1Ch 00h,08063 ;PRLE: take Pilot-Symbol 0, and repeat it 8063 times 1Fh 01h,00001 ;PRLE: take Pilot-Symbol 1, and repeat it 1 times 22h 00h,00855,00855 ;Data Symbol 0 27h 00h,01710,01710 ;Data Symbol 1 2Ch Data (LEN bytes: block_type, data[LEN-2], chksum) |
00h 0000xxxxh ;Total block length (58h+LEN) 04h 03E8h ;Pause after this block (ms) 06h 00000000h ;Total number of pilot/sync records TOTP;\no pilot 0Ah 00h ;Max pulses per symbol NPP ; for zx81 0Bh 00h ;Number of symbols in pilot/sync alphabet ASP ;/ 0Ch LEN*8 ;Total number of data symbols TOTD;\ 10h 12h ;Max pulses per data symbol NPD ; data header 11h 02h ;Number of symbols in data alphabet ASD ;/ 12h 3,530,520,530,520,530,520,530 ;\Data Symbol 0 4689,0,0,0,0,0,0,0,0,0,0 ;/ 37h 3,530,520,530,520,530,520,530 ;\Data Symbol 1 520,530,520,530,520,530,520,530,520,530,4689 ;/ 5Ch Data (LEN bytes: ZX81 filename, followed by memory [4009h..E_LINE-1]) |
Spectrum Cassette TZX Format Custom |
00h 16 Custom block ID ("POKEs" + 11 spaces) 10h 4 Length of data that follow 14h 1 General description length (L) 15h L General description in ASCII format 15h+L 1 Number of trainer definitions (N) 15h+L+1 .. Trainer definitions |
00h 1 Trainer description length (L) 01h L Trainer description in ASCII format 01h+L 1 Number of poke definitions in this trainer (N) 01h+L+1 .. POKEs definitions |
00h 1 POKE type: bit 0-2 : memory page number bit 3 : ignore memory page number bit 4 : user inserts the POKE value bit 5 : unknown original value 01h 2 POKE address 03h 1 POKE value (leave 0 if 'user inserts' bit set) 04h 1 POKE original value (leave 0 if 'unknown' bit set) |
00h 16 Custom block ID ("Instructions" + 4 spaces) 10h 4 Length of the following data (L) 14h L Instructions text in ASCII format |
00h 16 Custom block ID ("Spectrum Screen" + 1 space) 10h 4 Length of data that follow 14h 1 Description length (L) (if 0 then handle it as 'Loading Screen') 15h L Description of the picture in ASCII format 15h+L 1 BORDER Colour in Spectrum colour format (0=black, 1=blue, ...) 15h+L+1 6912 Screen in standard Spectrum video format |
00h 16 Custom block ID ("ZX-Edit document") 10h 4 Length of data that follow 14h 1 Description length (L) (if 0 then handle it as 'Instructions') 15h L Description of the document in ASCII format 15h+L .. The ZX-Editor document (.ZED file) |
00h 16 Custom block ID ("Picture" + 9 spaces) 10h 4 Length of data that follow 14h 1 Picture format (00h=GIF, 1=JPEG) 15h 1 Description length (L) (if 0 then handle it as 'Inlay Card') 16h L Description of the document in ASCII format 16h+L .. The picture itself |
Spectrum Cassette TZX Notes |
- All values are stored in little endian format (i.e. LSB first) - All unused bits should be set to zero - All timings are given in 3.5MHz clock cycles (unless otherwise stated) - All ASCII texts use the ISO 8859-1 (Latin 1) encoding - Some ASCII texts can have several lines, to be separated by chr(0Dh) - MSB = most significant byte, LSB = least significant byte - MSb = most significant bit, LSb = least significant bit - The values in curly brackets {} are the default values as used by BIOS |
Machine Pilot pulse Length Sync1 Sync2 Bit 0 Bit 1 ZX Spectrum 2168 (1) 667 735 855 1710 SAM Coupe' 58+19*W 6000 58+9*W 113+9*W 10+8*W 42+15*W (*) Amstrad CPC Bit 1 4096 Bit 0 Bit 0 (2) (2) Enterprise (fast) 742 ? 1280 1280 882 602 (**) Enterprise (slow) 1750 ? 2800 2800 1982 1400 (**) |
(1) The Spectrum uses different pilot lengths for header and data blocks. Header blocks have 8063 and data blocks have 3223 pilot pulses. (2) Amstrad CPC BIOS load/save routine can use variable speed for loading, so the bit 1 pulse must be read from the pilot tone and bit 0 can be read from the sync pulses, and is always half the size of bit 1. The checksum is also different than the other two machines. The speed can vary from 1000 to 2000 baud. (*) The SAM Coupe' timings can be user selected by a system variable. The standard value is 112, which is VERY close to ZX Spectrum loading speed, and therefore the 'Standard Speed Data' block can be used for those blocks. However if this system variable is changed then the timings will change accordingly. In the above table the value of this variable is given as 'W', the 'H' value is 'W/2'. Of course the best way to determine it is to calculate it from the timings you get when sampling the Pilot tone. The values in the table could be by a fraction of the real ones, but it should not matter. Note: All timings are written in 3.5MHz clock. Also, there might be some junk bits (usually 7 or 8) AFTER the checksum (XOR) byte at the end of the block, but they can just be ignored. (**) The Enterprise stores data in a different way than all other computers do. It stores the LSb first, but the data blocks require the data to be MSb first. This might lead to some confusion, but if the same mechanism is used to replay data for all machines then there will be no problem. Just store the data as MSb first, but if you want to view the raw data in the TZX file then you will have to mirror each byte to get the correct values. |
Spectrum Interface 1 (Microdrive, Network, RS232) |
0008h,1708h - Interface 1 - Enable external ROM (8K) (error and close#) 0700h - Interface 1 - Disable external ROM (8K) (ret) |
0-7 Microdrive Data (send/receive) |
0 Microdrive Write Protected 1 Microdrive Sync 2 Microdrive Gap 3 RS232 DTR 4 Busy (what busy?) 5-7 Not used |
0 Microdrive Comms Data (and Mode for Write to PortF7.Bit0) 1 Microdrive Comms Clk 2 Microdrive R/W 3 Microdrive Erase 4 RS232 CTS 5 Network Wait (used to synchronize) 6-7 Not used |
0 Network Input 1-6 Not used 7 RS232 TXDATA |
0 Network Output or RS232 RXDATA (depending on Port EFh.Bit0.Write) 1-7 Not used |
Spectrum Disc Spectrum +3 Disc Controller (NEC uPD765) |
Command Parameters Exm Result Description 02+MF+SK HU TR HD ?? SZ NM GP SL <R> S0 S1 S2 TR HD NM SZ read track 03 XX YY - specify spd/dma 04 HU - S3 sense drive state 05+MT+MF HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ write sector(s) 06+MT+MF+SK HU TR HD SC SZ LS GP SL <R> S0 S1 S2 TR HD LS SZ read sector(s) 07 HU - recalib.seek TP=0 08 - - S0 TP sense int.state 09+MT+MF HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ wr deleted sec(s) 0A+MF HU - S0 S1 S2 TR HD LS SZ read ID 0C+MT+MF+SK HU TR HD SC SZ LS GP SL <R> S0 S1 S2 TR HD LS SZ rd deleted sec(s) 0D+MF HU SZ NM GP FB <W> S0 S1 S2 TR HD LS SZ format track 0F HU TP - seek track n 11+MT+MF+SK HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ scan equal 19+MT+MF+SK HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ scan low or equal 1D+MT+MF+SK HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ scan high or eq. |
MT Bit7 Multi Track (continue multi-sector-function on other head) MF Bit6 MFM-Mode-Bit (Default 1=Double Density) SK Bit5 Skip-Bit (set if secs with deleted DAM shall be skipped) |
HU b0,1=Unit/Drive Number, b2=Physical Head Number, other bits zero TP Physical Track Number TR Track-ID (usually same value as TP) HD Head-ID SC First Sector-ID (sector you want to read) SZ Sector Size (80h shl n) (default=02h for 200h bytes) LS Last Sector-ID (should be same as SC when reading a single sector) GP Gap (default=2Ah except command 0D: default=52h) SL Sectorlen if SZ=0 (default=FFh) Sn Status Register 0..3 FB Fillbyte (for the sector data areas) (default=E5h) NM Number of Sectors (default=09h) XX b0..3=headunload n*32ms (8" only), b4..7=steprate (16-n)*2ms YY b0=DMA_disable, b1-7=headload n*4ms (8" only) |
b0..3 DB FDD0..3 Busy (seek/recalib active, until succesful sense intstat) b4 CB FDC Busy (still in command-, execution- or result-phase) b5 EXM Execution Mode (still in execution-phase, non_DMA_only) b6 DIO Data Input/Output (0=CPU->FDC, 1=FDC->CPU) (see b7) b7 RQM Request For Master (1=ready for next byte) (see b6 for direction) |
b0,1 US Unit Select (driveno during interrupt) b2 HD Head Adress (head during interrupt) b3 NR Not Ready (drive not ready or non-existing 2nd head selected) b4 EC Equipment Check (drive failure or recalibrate failed (retry)) b5 SE Seek End (Set if seek-command completed) b6,7 IC Interrupt Code (0=OK, 1=aborted:readfail/OK if EN, 2=unknown cmd or senseint with no int occured, 3=aborted:disc removed etc.) |
b0 MA Missing Adress Mark (Sector_ID or DAM not found) b1 NW Not Writeable (tried to write/format disc with wprot_tab=on) b2 ND No Data (Sector_ID not found, CRC fail in ID_field) b3,6 0 Not used b4 OR Over Run (CPU too slow in execution-phase (ca. 26us/Byte)) b5 DE Data Error (CRC-fail in ID- or Data-Field) b7 EN End of Track (set past most read/write commands) (see IC) |
b0 MD Missing Address Mark in Data Field (DAM not found) b1 BC Bad Cylinder (read/programmed track-ID different and read-ID = FF) b2 SN Scan Not Satisfied (no fitting sector found) b3 SH Scan Equal Hit (equal) b4 WC Wrong Cylinder (read/programmed track-ID different) (see b1) b5 DD Data Error in Data Field (CRC-fail in data-field) b6 CM Control Mark (read/scan command found sector with deleted DAM) b7 0 Not Used |
b0,1 US Unit Select (pin 28,29 of FDC) b2 HD Head Address (pin 27 of FDC) b3 TS Two Side (0=yes, 1=no (!)) b4 T0 Track 0 (on track 0 we are) b5 RY Ready (drive ready signal) b6 WP Write Protected (write protected) b7 FT Fault (if supported: 1=Drive failure) |
Spectrum Disc Opus Discovery |
0000-1FFF ROM (8K) 2000-27FF RAM (2K) 2800-2803 WD 1770 Ports (floppy controller) 3000-3003 PIA 6821 Ports (drive/side select, centronics etc.) |
PA0 drive 2 select (and enable motors for both drives) PA1 drive 1 select (and enable motors for both drives) PA4 side select PA5 double density enable PA6 centronics busy (input) PA7 enable kempston joystick port on A5=0 (from BASIC: type FORMAT "j";1) PB0..7 centronics data CA2 centronics ack CB2 centronics strobe |
0 CA1 Input Control (0..3) 0 = Set IRQA1 when CA1=Negative, but do not trigger /IRQA 1 = Set IRQA1 when CA1=Negative, and do trigger /IRQA 2 = Set IRQA1 when CA1=Positive, but do not trigger /IRQA 3 = Set IRQA1 when CA1=Positive, and do trigger /IRQA 2 DDRA Access (0=Data Direction Register A, 1=Data Register A) 3-5 CA2 Input/Output Control (0..7) 0 = Set IRQA2 when CA2=Negative, but do not trigger /IRQA 1 = Set IRQA2 when CA2=Negative, and do trigger /IRQA 2 = Set IRQA2 when CA2=Positive, but do not trigger /IRQA 3 = Set IRQA2 when CA2=Positive, and do trigger /IRQA 4 = Handshake Output Mode (CA2=High on CA1, CA2=Low on "Read A Data") 5 = Pulse Output Mode (CA2=Low for 1 clk after "Read A Data") 6 = Manual Output, set CA2=Low 7 = Manual Output, set CA2=High 6 IRQA2 Flag (CA2 input) 7 IRQA1 Flag (CA1 input) |
0-4 Kempston Joystick (disabled by default) 5-7 Not used |
1 VSS 6 PA4 11 PB1 16 PB6 21 R/W 26 D7 31 D2 36 RS1(A1) 2 PA0 7 PA5 12 PB2 17 PB7 22 CS0 27 D6 32 D1 37 /IRQB 3 PA1 8 PA6 13 PB3 18 CB1 23 /CS2 28 D5 33 D0 38 /IRQA 4 PA2 9 PA7 14 PB4 19 CB2 24 CS1 29 D4 34 /RES 39 CA2 5 PA3 10 PB0 15 PB5 20 VCC 25 PHI2 30 D3 35 RS0(A0) 40 CA1 |
Spectrum Disc Disciple and Plus D |
0 Drive A Select 1 Drive B Select 2 Single/double density 3 ROM bank select (first/second 8K of total 16K ROM) 4 Not used 5 Ext. select (?) 6 Centronics Strobe 7 Side select |
0 Drive select 1 Side select 2 Single/double density 3 ROM bank select (first/second 8K of total 16K ROM) 4 Inhibit switch control 5 Ext. select (?) 6 Centronics Strobe 7 Network Data Output (0=0V, 1=5V) |
0-4 Kempston Joystick Port (also mapped to Port F7FEh) 5 Not used 6 Centronics Busy 7 Network Data Input (0=0V, 1=5V) |
Port 3Bh is used for network synchronization (same as bit 5 of Interface One's port EFh). Any OUT to port 3Bh will halt the Spectrum until the logic level on the network is 0. It is used to wait for the start bit of a transmission frame. The network bus carries TTL logic levels (0 = 0 Volts, 1 = 5 Volts). The bit rate is 87.5 Kbps and data is exchanged in packets of max 256 bytes using a simple data-link level protocol. Network is an Interface 1 compatible net. |
0-7 Printer Data |
0-6 Not used 7 Printer Busy |
GDOS --> Built-in in Disciple G+DOS --> Built-in in PlusD Beta DOS --> Third-party DOS Replacement for PlusD UniDOS --> Third-party DOS Replacement for PlusD and Disciple |
Spectrum Disc Beta/BetaPlus/Beta128 Disk Interface (TRDOS) |
Interface Year TRDOS Description Beta 1984 v1 original version Beta Plus 1985 v4 auto-boot, drive-detect, magic-button, seq/rnd access Beta 128 1986 v5.0x changed USR addresses, auto-boot-disable-switch Pentagon 1989 v5.0x russian spectrum clone with beta 128 disk interface |
RANDOMIZE USR 15360 or 15616 --> switch from BASIC to TRDOS ;3C00h/3D00h RETURN (aka Y-key) --> switch from TRDOS to BASIC |
RANDOMIZE USR 15363 or 15619:REM:LOAD"filename" ;3C03h/3D03h |
0-5 Unused? 6 DRQ (data request) 7 INTRQ (command completion) |
0-1 Drive select (0..3 = Drive A..D) 2 Hardware microcontroller reset (0=reset, 1=normal) 3 Blocks signal HLT of microcontroller (=disk controller?) (1=normal) 4 Head select (0=First/bottom, 1=Second/Top) 5 Density select (0=FM, 1=MFM) 6-7 Unused |
Spectrum Disc Controller (Western Digital WD177x) |
Type Command b7 b6 b5 b4 b3 b2 b1 b0 I Restore 0 0 0 0 h/M V r1 r0 I Seek 0 0 0 1 h/M V r1 r0 I Step 0 0 1 T h/M V r1 r0 I Step-In 0 1 0 T h/M V r1 r0 I Step-Out 0 1 1 T h/M V r1 r0 II Read Sector 1 0 0 m S/M E C/0 0 II Write Sector 1 0 1 m S/M E C/P a0 III Read Address 1 1 0 0 0/M E 0 0 III Read Track 1 1 1 0 0/M E 0 0 III Write Track 1 1 1 1 0/M E 0/P 0 IV Force Interrupt 1 1 0 1 i3 i2 i1 i0 |
r1,r0 Stepping Motor Rate (0..3 = 6ms,12ms,20ms,30ms) (WD179X,WD1770/WD1773) r1,r0 Stepping Motor Rate (0..3 = 2ms,3ms,5ms,6ms) (WD1772 Preliminary docs) r1,r0 Stepping Motor Rate (0..3 = 6ms,12ms,2ms,3ms) (WD1772 Other docs... ?) V Track Number Verify Flag (0: no verify, 1: verify on dest track) h Head Load Flag (1: load head at beginning, 0: unload head) (WD179X) T Track Update Flag (0: no update, 1: update Track Register) a0 Data Address Mark (0: FB, 1: F8 (deleted DAM)) C Side Compare Flag (0: disable, 1: enable) (WD179X only) (and WD1773?) E 15 ms delay (0: no 15ms delay, 1: 15 ms delay) S Side Compare Flag (0: compare for side 0, 1: compare for side 1) m Multiple Record Flag (0: single record, 1: multiple records) P Write Precompensation (0=On, 1=Off) (WD1770/WD1772 only) (and WD1773?) M Motor On (0=on, 1=off) (WD1770/WD1772 only) |
i3-i0 0 = Terminate with no interrupt (INTRQ) i3 1 = Immediate interrupt, requires a reset i2 1 = Index pulse i1 1 = Ready to not ready transition (Not used on WD1770/WD1772) i0 1 = Not ready to ready transition (Not used on WD1770/WD1772) |
Bit Expl. 0 Busy (1=Command is in progress) 1 Index (1=Index mark detected from drive) 2 Track 0 (1=Read/Write head is positioned to Track 0) 3 CRC Error (1=CRC encountered in ID field) 4 Seek Error (1=Desired track was not verified) (reset 0 when updated) 5 Head Loaded (1=Head loaded an engaged) (WD1770/WD1772: Spin-up ready) 6 Protected (1=Disk write protected) 7 Not Ready (1=Drive not ready) (WD1770/WD1772: Motor On) |
Bit Expl. 0 Busy (1=Command is under execution) 1 Data Request (1=CPU must read/write next data byte) (DRQ) 2 Lost Data (1=CPU did not respond to DRQ in one byte time) 3-4 Error Code (1=Bad Data CRC, 2=Sector not found, 3=Bad ID Field CRC) 5 Fault/Type (Any Write:1=Write Fault, Read Sector:1=Deleted Data Mark) 6 Protected (Any Write:1=Write Protect, Any Read:Not used) 7 Not Ready (1=Drive not ready) (WD1770/WD1772: Motor On) |
00-F4 Write 00 thru F4 F5 Write A1, preset CRC F6 Write C2 F7 Generate 2 CRC bytes F8-FF Write F8 thru FF |
80 x 4E 12 x 00 3 x F6 (writes C2) 1 x FC (index mark) 50 x 4E |
12 x 00 3 x F5 (writes A1, preset CRC) 1 x FE (ID address mark) 1 x Track number 1 x Side number 1 x Sector number 1 x 01 (sector length=256) 1 x F7 (write 2 CRC bytes) 22 x 4E |
12 x 00 3 x F5 (writes A1, preset CRC) 1 x FB (data address mark) 256 x DATA 1 x F7 (write 2 CRC bytes) 54 x 4E |
etc. |
.. x 4E (padding until index hole interrupt) |
Spectrum Disc Controller (Other) |
Version Hardware Software Mk I : Port BFh, Bit0 I.R.Lavell (quite efficently coded) Mk II : Port 1Fh, Bit3 Draysoft (less efficiently coded) |
Spectrum Interrupts |
IF [5CB0h]=0000h then JMP [5CB0h] ;ie. jump to 0000h (bullshit) |
IF [5CB0h]<>0000h then JMP [5CB0h] |
Spectrum Keyboards |
Port Bit4 Bit3 Bit2 Bit1 Bit0 FEFEh A8 V C X Z SHIFT FDFEh A9 G F D S A FBFEh A10 T R E W Q F7FEh A11 5 4 3 2 1 EFFEh A12 6 7 8 9 0 DFFEh A13 Y U I O P BFFEh A14 H J K L ENTER 7FFEh A15 B N M SYM SPACE |
| 1 2 3 4 5 6 7 8 9 0 | | Q W E R T Y U I O P | | A S D F G H J K L ENTER| |SHF Z X C V B N M SYM SPACE| |
| 1 2 3 4 5 6 7 8 9 0 | | Q W E R T Y U I O P | | A S D F G H J K L ENTER| |SHF Z X C V B N M SYM BRK SHF| | [---------SPACE---------] | |
|TRUE INV 1 2 3 4 5 6 7 8 9 0 ESC| | / * ( ) | |DEL TAB Q W E R T Y U I O P | | 7 8 9 - | |EXT COPY A S D F G H J K L RET| | 4 5 6 + | |SHIFT CAPS Z X C V B N M . SHIFT| | 1 2 3 RET| |SYM ; " LEFT RIGHT SPACE UP DOWN , SYM| | 0 . | |
Spectrum Keyboard Assignment |
NORMAL SHIFT CMD SYMBOL EXT EXT+SYM EXT+SHIFT GRAPH GRAPH+SHFT 1 EDIT 1 ! P=BLUE DEF FN I=BLUE [ '] [:.] 2 CAPS 2 @ P=RED FN I=RED [' ] [.:] 3 TRUE_V 3 # P=MAGENT.LINE I=MAGENT. [''] [..] 4 INV_V 4 $ P=GREEN OPEN# I=GREEN [ .] [:'] 5 LEFT 5 % P=CYAN CLOSE# I=CYAN [ :] [: ] 6 DOWN 6 & P=YELLOW MOVE I=YELLOW ['.] [.'] 7 UP 7 ' P=WHITE ERASE I=WHITE [':] [. ] 8 RIGHT 8 ( (BRIGHT) POINT FLASH=OFF [ ] [::] 9 GRAPH 9 ) (DARK) CAT FLASH=ON GRA=OFF GRA=OFF 0 DELETE 0 _ P=BLACK FORMAT I=BLACK DELETE DELETE q Q PLOT <= SIN ASN ASN USR.Q USR.Q w W DRAW <> COS ACS ACS INKEY$ INKEY$ e E REM >= TAN ATN ATN USR.E USR.E r R RUN < INT VERIFY VERIFY USR.R USR.R t T RAND > RND MERGE MERGE USR.T USR.T y Y RETURN AND STR$ [ [ FN FN u U IF OR CHR$ ] ] USR.U USR.U i I INPUT AT CODE IN IN USR.I USR.I o O POKE ; PEEK OUT OUT USR.O USR.O p P PRINT " TAB RESET (C) RESET (C) USR.P USR.P a A NEW STOP READ FREE ~ FREE ~ USR.A USR.A s S SAVE NOT RESTORE STICK | STICK | USR.S USR.S d D DIM STEP DATA \ \ \ \ USR.D USR.D f F FOR TO SGN ON_ERR { ON_ERR { USR.F USR.F g G GOTO THEN ABS SOUND } SOUND } USR.G USR.G h H GOSUB ^ SQR CIRCLE CIRCLE USR.H USR.H j J LOAD - VAL VAL$ VAL$ USR.J USR.J k K LIST + LEN SCREEN$ SCREEN$ USR.K USR.K l L LET = USR ATTR ATTR USR.L USR.L ENTER ENTER ENTER ENTER ENTER ENTER ENTER ENTER ENTER SHIFT SHIFT SHIFT EXT=ON SHIFT EXT=OFF SHIFT SHIFT SHIFT z Z COPY : LN BEEP BEEP POINT POINT x X CLEAR pound EXP INK INK PI PI c C CONT ? LPRINT PAPER PAPER USR.C USR.C v V CLS / LLIST FLASH FLASH RND RND b B BORDER * BIN BRIGHT BRIGHT USR.B USR.B n N NEXT , INKEY$ OVER OVER USR.N USR.N m M PAUSE . PI INVERSE INVERSE USR.M USR.M SYMBOL EXT=ON SYMBOL SYMBOL SYMBOL SYMBOL EXT=OFF SHIFT EXT=ON SPACE SPACE SPACE SPACE SPACE SPACE SPACE SPACE SPACE |
Spectrum Joystick Ports |
Port_Joystick_Type___________________________7_6_5_4_3_2_1_0___Data Bits___ xx1F Kempston (and Timex TC2048) ? ? ? F U D L R (1=Pressed) xx7F Fuller Box F ? ? ? R L D U (0=Pressed) EFFE Protek (cursor mode, A12, keys 6,7,8,0) - - - D U R - F (0=Pressed) F7FE Protek (cursor mode, A11, key 5) - - - L - - - - (0=Pressed) DFFE AGF (2nd Joystick, A13, keys Y,U,I,P) - - - D U R - F (0=Pressed) FBFE AGF (2nd Joystick, A10, key T) - - - L - - - - (0=Pressed) EFFE Sinclair Port 1 (keys 6,7,8,9,0) - - - L R D U F (0=Pressed) F7FE Sinclair Port 2 (keys 5,4,3,2,1) - - - F U D R L (0=Pressed) E7FE Sinclair Garbage or Nothing - - - x x x x x (0=Pressed) 01F6 Timex TS2068/TC2068 PSG Reg 14, Port 1 F ? ? ? R L D U (0=Pressed) 02F6 Timex TS2068/TC2068 PSG Reg 14, Port 2 F ? ? ? R L D U (0=Pressed) 03F6 Timex TS2068/TC2068 PSG Reg 14, Both F ? ? ? R L D U (0=Pressed) xxBF Timedata ZXM Sound Box, PSG Reg 14 0 F U D L R y x (0=Pressed) ? Rotronics Wafadrive Joystick Adaptor ? ? ? ? ? ? ? ? (?=Select) |
6,7,8,9,0 --> Interprete as Sinclair Joystick Port 1 SHIFT+5,6,7,8,SPACE --> Interprete as Cursor Keys (for use in emulators) Q,A,O,P,SPACE --> Interprete as Keyboard Keys Port 1Fh --> Interprete as Kempston Joystick Port |
Kempston Homebrew TS2068/TC2068 Interface2 Spectrum+2 Protek Pin Joy1 Joy1 Joy1 Joy2 Joy1 Joy2 Joy1 Joy2 Joy1 1 Up Up Up Up Up Up N/A? N/A? Up 2 Down Down Down Down Down Down MA3 MA4 Down 3 Left Left Left Left Left Left N/A? N/A? Left 4 Right Right Right Right Right Right Fire Fire Right 5 N/A N/A N/A N/A N/A N/A Up Up ? 6 Fire Fire Fire Fire Fire Fire Right Right Fire 7 +5V (Fire 2) +5V +5V N/A N/A Left Left ? 8 GND +5V /A8 /A9 GND GND MA3 MA4 ? 9 N/A N/A GND GND N/A N/A Down Down ? |
Spectrum Mouse Ports |
Spectrum Mouse - Kempston Mouse |
0 Right Button (0=Pressed, 1=Released) 1 Left Button (0=Pressed, 1=Released) 2 Middle Button (not supported in original Kempston Mouse interface) 3 Not used 4-7 Mouse Wheel Counter (supported in some russian interfaces only) |
0-7 Counter (mickeys) |
Spectrum Mouse - AMX Mouse (Advanced Memory Systems) |
0 Mouse X Direction (XB input from mouse) (?=Left, ?=Right) 1-2 Not used 3 Centronics Strobe (should be usually output in Mode 3) 4-7 Centronics Data LSBs (should be usually output in Mode 3) |
0 Mouse Y Direction (YB input from mouse) (?=Up, ?=Down) 1-2 Not used 3 Centronics Busy (should be usually input in Mode 3) 4-7 Centronics Data MSBs (should be usually output in Mode 3) |
1stByte 2ndByte Function vvvvvvv0 N/A Set Interrupt Vector exxx0011 N/A Set Interrupt Enable eah00111 N/A Set Interrupt Enable/Control (for Mode 3 only) eah10111 mmmmmmmm Set Interrupt Enable/Control/Mask (for Mode 3 only) 00xx1111 N/A Set Mode 0 (all 8 data bits = Output) 01xx1111 N/A Set Mode 1 (all 8 data bits = Input) 10xx1111 N/A Set Mode 2 (all 8 data bits = Bidirectional) (Port A only) 11xx1111 dddddddd Set Mode 3 and Direction bits (0=Out, 1=In) |
vvvvvvv Interrupt Vector (Bit0=0, Bit1-7=vvvvvvv, Bit8..15="I"-Register) e Interrupt Enable (0=Disable, 1=Enable; trigger on each mickey) a Interrupt AND/OR (for Mode3 only) h Interrupt HI/LO (for Mode3 only) mmmmmmmm Interrupt Mask (for Mode3 only) (0=Monitor, 1=Mask) dddddddd Data Direction bits 0-7 (0=Output, 1=Input) |
0-4 Not used 5 Right Button 6 Middle Button 7 Left Button |
Spectrum Mouse - Amiga Mouse or Atari Mouse in Kempston Joystick port |
Pin Amiga Mouse Atari Mouse Kempston Joystick Kempston Mouse 1 YA XB Joystick up +5V 2 XA XA Joystick down XA 3 YB YA Joystick left YB 4 XB YB Joystick right Left Button 5 Middle Button Not connected Not connected Right Button 6 Left Button Left Button Fire button GND 7 +5V +5V +5V Not connected 8 GND GND GND YA 9 Right Button Right Button Not connected XB |
One Direction Opposite Direction XA _______----____ _____----______ XB _____----______ _______----____ |
One Direction Stop Opposite Direction XA _______---------------------------______ XB _____-------------------------------____ |
Spectrum Mouse - Other Mice |
0-3 In Horizontal or Vertical 4bit Counter (as selected via bit6) 4 In Button 1 (0=Pressed, 1=Released) (presumably Left) 5 In Button 2 (0=Pressed, 1=Released) (presumably Right) 6 Out Select Counter to be mapped to bit0-3 (?=Horizontal, ?=Vertical) 7 ? Border ("for testing, and computer effects, type multicolor") |
Spectrum Light Guns |
bit1 = Trigger Button (0=Pressed, 1=Released) bit4 = Light Sensor (0=Light, 1=No Light) other bits = Must be "1" (the programs use compare FDh to test if bit1=0) |
bit4 = light sensor (0=None, 1=Light) bit5 = trigger button (0=Pressed, 1=Released) |
Joystick UP (bit3) = Trigger button Joystick FIRE (bit4) = Light sensor Other (bit0-2,5-7) = Must be 0 (Jungle W. compares [1Fh] with 08h,10h,18h) |
Joystick FIRE = Trigger Button (LOW=Pressed, HIGH=Released) Joystick DOWN = Light Sensor (LOW=?) |
Grouse Shoot Stack Computer Services Ltd (compiled BASIC code) Shooting Gallery Stack Computer Services Ltd (compiled BASIC code) High Noon Stack Computer Services Ltd (compiled BASIC code) Invasion Force Micromania (real Z80 assembler code) |
Advanced Pinball Simulator Code Masters Ltd Billy the Kid Code Masters Ltd Bronx Street Cop Code Masters Ltd F-16 Fighting Falcon Code Masters Ltd Jungle Warfare Code Masters Ltd Super Car Trans Am Code Masters Ltd And... theoretically the AUX-based Magnum games should work, too? |
Billy the Kid Code Masters Ltd Bronx Street Cop Code Masters Ltd Bullseye Macsen Software F-16 Fighting Falcon Code Masters Ltd Jungle Warfare Code Masters Ltd Living Daylights Domark Ltd Lord Bromley's Estate Amstrad Missile Ground Zero Software Creations Operation Wolf Ocean Software Ltd Q's Armoury Amstrad Robot Attack Mastertronic Ltd Rookie Mastertronic Ltd Solar Invasion Mastertronic Ltd Super Car Trans Am Code Masters Ltd |
Acid Killer New Frontier Bestial Warrior Dinamic Software Cosmic Sheriff Dinamic Software El Equipo A (aka A-Team) Zafiro Software Division Guillermo Tell Opera Soft S.A. Hunting Mix New Frontier Mike Gunner Dinamic Software Shooting Range: Mix I New Frontier Solo Opera Soft S.A. Sootland Zafiro Software Division Space Smugglers MHT Ingenieros S.L. Target Plus Dinamic Software Trigger Opera Soft S.A. |
Spectrum Printer Ports |
Type Data Busy Strobe Interface Bis #1D (#1D).7 auto M'ody Technik 1986-12 #1F (inv) (#9F).4=0 (#9F).4=1 MB-02 #3F (#5F).7=1 (#5F).1=0 YAMOD.8211 #0n58 (#0n59).7=0 (#0n5A).0=1 ;n=0..1 Unipolbrit 2086 #xx7B (#BB).?=1 (#BB).?=0 AERCo Centronics #7F (#7F).4=1 auto MultiPrint #BF (#BB).6=1 (#BF)=X,(#BB)=X,(#BF)=X Informik 1989-II #E3 (#F3).4=0 (#F3).4=1 Sam FDD #E8 (#E9).0 (#E9).0=1 Elwro 800 Jr #DE (#DD).7=1 (#DD).2=0 Scorpion #DD (#FE).7 auto(?) AERCo FD-68 #E0DF ? (#xx??).? ?? PlusD #F7 (#F7).7 (#EF).6 DISCiPLE #FB (#1F).6 (#1F).6 ZX Lprint 3 & Pentagon #FB (#FB).7=1 auto (?) Centronics Microface #FB (#FB).7=1 auto ZX Spectrum +3 #0FFD (#0FFD).0=1 (#1FFD).4=0 GP500A PZ "APINA" #xx?? (#xx??).? ?? Kempston S (Software) #E0BF (#E2BF).0 E3BF.0 ;with SOFTWARE driver Kempston E (EPROM) #xx?? (#xx??).? ?? ;with EPROM driver DK'Tronics #xx9B (#xxBB).7 xxBB.1 INES Printerface #xx?? (#xx??).? ?? Opus Discovery (memory mapped PIA6821) ;BiDir.D0-D7,STB,READY,ACK Rotronics Wafadrive dd0Eh 0002h.5 000Ah/200Ah ;via IN (not OUT) Indescomp #FB (#FB).0 (#7F).0 Watford ? ? ? Fuller ? ? ? VISMO ZP83 parallel interface VTR Parallel Centronics Interface Tasman Parallel Printer Interface ADS Advanced Digital Systems Centronics Interface Dorsch Centronics Interface Technology Research S-Print Cambridge Intelligent Printer Interface Logitek Floppy/Printer Interface (centronics port and c64 floppy port) Miracle ZX Printer Interface (rs232-to-centronics converter for Interface 1) Morex Printer Interface (centronics, rs232, built-in word processor) Romantic Robot Multiprint Cambridge Microelectronics Polyprint Interface Camel Products Print-SP Ram Electronics RamPrint Interface (centronics, joystick, RamWrite in ROM) Euroelectronics ZX Lprint (centronics) Euroelectronics ZX Lprint III (centronics and rs232) AMX Mouse (with 8bit centronics data split into two 4bit fragments) Nidd Valley Digimouse Interface (professional version with Centronics port) |
Hilderbay Interface (same as the Kempston S thing) Datel Inter Printer (same as the DK'Tronics thing, distributed by datel) Datel Ramprint (same as the Ram Electronics thing, distributed by datel) Pentagon (russian spectrum clone, with built-in ZX Lprint 3) |
Interface Bis 5 input lines for LapLink M'ody Technik 1986-12 8255 used: #DF=config; PA=data. All signals inverted. MB-02 8255 used; #7F=config; PB=data, PC2=/ACK, PC3=/AUTOFEED, PC4=/ERROR, PC5=SELECT, PC6=PAPEROUT Unipolbrit 2086 8255 used; #FB=config; PA=data; only PA and PC0, PC1, PC4, PC5 are in DB15 slot Informik 1989-II 8255 used: #FB=config; PA=data (PB switches memory banks). All signals inverted. Elwro 800 Jr 8255, other bits reserved YAMOD.8211 PC LPT connected as YABUS.ZXISA AERCo Centronics (#7F).5=0 - printer present MultiPrint 8kB ROM, 8kB RAM ZX Lprint 3 Pentagon 2kB ROM Centronics Microface see files for documentation |
Spectrum Serial Port |
1 Not Connected. ___________ 2 In TXD | 5 4 3 2 1 | 3 Out RXD \_9_8_7_6_/ 4 In DTR ;should be high when ready 5 Out CTS ;should be high when ready 6 Not Connected. 7 GND 8 Not Connected. 9 +9V - Pull up. (DSR) |
0 AUX/Keypad pin 2 (out) 1 AUX/Keypad pin 4 (out) 2 RS232/MIDI pin 5 (RS232: output to remote CTS) (MIDI: DATA OUT) 3 RS232/MIDI pin 3 (RS232: output to remote RXD) (MIDI: Not used) 4 AUX/Keypad pin 3 (in) (Lightgun: light sensor: 0=No Light, 1=Light) 5 AUX/Keypad pin 5 (in) (Lightgun: trigger button: 0=Pressed, 1=Released) 6 RS232/MIDI pin 4 (RS232: input from remote DTR) (MIDI: Not used) 7 RS232/MIDI pin 2 (RS232: input from remote TXD) (MIDI: Not used) |
Pin Function 1 GND ___________________________ 2 OUTPUT BIT 0 __| 6 5 4 3 2 1 | 3 INPUT BIT 4 |__ ### ### ### ### ### ### | 4 OUTPUT BIT 1 |___________________________| 5 INPUT BIT 5 6 +12V AUX/Keypad socket |
Pin Function 1 GND (MIDI: RETURN) ____________________ 2 input from remote TXD (MIDI: not used) __| | 3 output to remote RXD (MIDI: not used) |__ 6 5 4 3 2 1 | 4 input from remote DTR (MIDI: not used) |____________________| 5 output to remote CTS (MIDI: DATA OUT) 6 +12V (MIDI: not used) RS232/MIDI socket |
Spectrum Expansion Ports |
-------TS2068------- ------TC2068------ ----Spectrum---- -ZX80/ZX81/TS1x00- Top Bottom Top/A Bottom/B GND 1 GND /BE 1 /EXROM Top Bottom EAR 2 SPKR/TAPE A15 2 A14 A15 1 A14 A7R 3 +15V A13 3 A12 A13 2 A12 Top Bottom D7 4 +5V D7 4 +5V D7 3 +5V D7 1 5V (DZ IN) 5 N.C. N.C. 5 +9V N.C. 4 +9V /RAM CS 2 9V (SLOT) 6 (SLOT) (SLOT) 6 (SLOT) (SLOT) 5 (SLOT) (SLOT) 3 (SLOT) D0 7 PWR GND D0 7 0V D0 6 0V D0 4 0V D1 8 PWR GND D1 8 0V D1 7 0V D1 5 0V D2 9 CPU CLK D2 9 CPU CLK D2 8 CPU CLK D2 6 CPU CLK D6 10 A0 D6 10 A0 D6 9 A0 D6 7 A0 D5 11 A1 D5 11 A1 D5 10 A1 D5 8 A1 D3 12 A2 D3 12 A2 D3 11 A2 D3 9 A2 D4 13 A3 D4 13 A3 D4 12 A3 D4 10 A3 /INT 14 A15'B /INT 14 /INT 13 /IORQULA /INT 11 A15 /NMI 15 A14'B /NMI 15 0V /NMI 14 0V /NMI 12 A14 /HALT 16 A13'B /HALT 16 VIDEO /HALT 15 VIDEO /HALT 13 A13 /MREQ'B 17 A12 /MREQ 17 /MREQ 16 /Y /MREQ 14 A12 /IORQ'B 18 A11 /IOREQ 18 /IOREQ 17 V /IORQ 15 A11 /RD'B 19 A10 /RD 19 /RD 18 U /RD 16 A10 /WR'B 20 A9 /WR 20 /BUSREQ /WR 19 /BUSREQ /WR 17 A9 /BUSAK 21 A8 21 /RESET -5V 20 /RESET /BUSAK 18 A8 /WAIT 22 A7 /WAIT 22 A7 /WAIT 21 A7 /WAIT 19 A7 /BUSRQ 23 A6 23 A6 +12V 22 A6 /BUSRQ 20 A6 /RESET 24 A5 24 A5 -12V 23 A5 /RESET 21 A5 /M1 25 A4 /M1 25 A4 /M1 24 A4 /MI 22 A4 /RFSH'B 26 (DZ OUT) /RFSH 26 /ROMCS /RFSH 25 /ROMCS /REFSH 23 /ROM CS /EXROM 27 RGB-R A8 27 /BUSACK A8 26 /BUSACK /ROSCS 28 RGB-G A10 28 A9 A10 27 A9 /BE 29 RGB-B N.C. 29 A11 N.C. 28 A11 (IO A5) 30 (BUSISO) RED 30 CSYNC SOUND 31 VIDEO GREEN 31 BRIGHT GND 32 GND BLUE 32 GND |
CPU CLK normally 3.5MHz clock, but, PAUSED during waitstates /ROMCS BIOS chipselect (can be dragged to 5V to disable internal BIOS) /IORQULA ULA chipselect (can be dragged to 5V to disable ULA mirrors) |
Spectrum ROM Cartridges |
TS2068/TC2068 Cartridges (2x18 pin) Interface 2 Cartridges (2x15 pin) Solder Side Component Side Whatever Side Other Side 1 A14'B 2 +5V 1A /ROMCS (+5V) 1B +5V 3..A12...........4..A13'B.....SLOT.. 2A A12 2B A15 (/CS2) 5 D0 6 D7 3A A7 3B A13 7 D1 8 A0 4A A6 4B A8 9 D2 10 A1 5A (SLOT) 5B (SLOT) 11 D6 12 A2 6A A5 6B A9 13 D5 14 A3 7A A4 7B A11 15 D3 16 A15B 8A A3 8B /MREQ (/OE) 17 D4 18 /MREQ'B 9A A2 9B A10 19 /IORQ'B 20 A7R'B 10A A1 10B A14 (/CS1) 21 /RD'B 22 /M1 11A A0 11B D7 23 /WR'B 24 A8 12A D0 12B D6 25 A7 26 A9 13A D1 13B D5 27 A6 28 A10 14A D2 14B D4 29 A5 30 A11 15A GND 15B D3 31 A4 32 /RFSH'B or /ROMCS 33 /BE or ROMDIS 34 /EXROM 35 /ROSCS 36 GND |
LROS --> Language ROM-Oriented Software at 0000h (Z80 Code) AROS --> Application ROM-Oriented Software at 8000h (BASIC or Z80 Code) |
0000h Not used (should be F4h for Spectrum ROMs, see comment) 0001h Cartridge Type (01h=LROS) 0002h Entrypoint (16bit) 0004h Initial Value Port F4h (XORed by FFh) 0038h IRQ Handler |
8000h Language Type (01h=BASIC, 02h=Machine Code) (other=Error) 8001h Cartridge Type (02h=AROS) (other=no cartridge) 8002h Entrypoint (16bit) (ptr to first BASIC Line, or to first opcode) 8004h Initial Value Port F4h (not XORed) (Bit0-3 must be set for BIOS/VRAM) 8005h Autostart Flag (0=No, 1=Autostart) 8006h Number of bytes of RAM reserved for Machine Code variables (16bit) |
07-9001 Supermath 07-9002 States and Capitals 07-9003 Chess 07-9004 Flight Simulator |
Spectrum Chipset Pinouts |
1 /CAS 6 A1 11 A6 16 VIDEO V 21 D1 26 KB4 31 D7 36 A14 2 /WR 7 A2 12 /INT 17 VIDEO /Y 22 D2 27 D4 32 CLOCK 37 A15 3 /RD 8 A3 13 +5V 18 D0 23 KB2 28 SOUND 33 /IO-ULA 38 /MREQ 4 /WE 9 A4 14 +5V' 19 KB0 24 KB3 29 D5 34 /ROM CS 39 OSC 5 A0 10 A5 15 VIDEO U 20 KB1 25 D3 30 D6 35 /RAS 40 GND |
1 A0 11 /EXROM 21 MUX 31 MA0 41 /CAS1 51 KB2 61 D4 2 A1 12 /BE 22 MA7 32 /ROSCS 42 CLK CPU 52 KB3 62 D7 3 A2 13 OSC OUT 23 MA3 33 /RAS1 43 +5V 53 KB4 63 /RD 4 A3 14 OSC IN 24 MA4 34 VIDEO U 44 A14 54 /RD' 64 /IORQ 5 A4 15 TAPE IN 25 MA2 35 VIDEO V 45 A15 55 D1 65 /WR 6 A5 16 TAPE OUT 26 GND 36 VIDEO /Y 46 VIDEO B 56 D2 66 /MREQ 7 A6 17 PSG BC1 27 /ROMCS 37 /DRAMWE 47 VIDEO G 57 D0 67 /INT 8 A7 18 PSG BDIR 28 MA6 38 A7R 48 VIDEO R 58 D3 68 /RFSH 9 A13 19 PSG CLK 29 MA1 39 /CAS3 49 KB0 59 D5 10 CLK EXP 20 /TS 30 MA5 40 /CAS2 50 KB1 60 D6 |
1 BUSY 14 MA3 27 A15 40 GND2 53 K10 66 GND3 79 /RFS 92 PSG CLK 2 EAR 15 GND1 28 K0 41 VCC1 54 DV7 67 VA3 80 /IRQ 93 PSG BC1 3 A0 16 MA4 29 K1 42 BRIT 55 DV6 68 VA2 81 /MRQ 94 PSG BDIR 4 A1 17 MA5 30 K2 43 /SNC 56 DV5 69 VA1 82 /WR 95 /VWE 5 A2 18 MA6 31 K3 44 FSC2 57 DV4 70 VA0 83 /RD 96 /VCS 6 A3 19 MA7 32 K4 45 /RS 58 DV3 71 D7 84 /ROM2 97 /VRS 7 A4 20 A8 33 /MTR 46 /CS 59 DV2 72 D6 85 /ROM1 98 MIC 8 A5 21 A9 34 PRNT 47 STRB 60 DV1 73 D5 86 RA14 99 /RS 9 A6 22 A10 35 /DRD 48 K5 61 DV0 74 D4 87 /ZCK 100 OSC 10 A7 23 A11 36 /DWR 49 K6 62 VA7 75 D3 88 /INT 11 MA0 24 A12 37 VIDEO B 50 K7 63 VA6 76 D2 89 /WAIT 12 MA1 25 A13 38 VIDEO R 51 K8 64 VA5 77 D1 90 GND4 13 MA2 26 A14 39 VIDEO G 52 K9 65 VA4 78 D0 91 VCC2 |
1 SND C 5 SND A 9 P5 13 P1 17 A8 (+5V) 21 D7 25 D3 2 TEST,NC 6 GND 10 P4 14 P0 18 BDIR 22 D6 26 D2 3 +5V 7 P7 11 P3 15 CLK 19 BC2(+5V) 23 D5 27 D1 4 SND B 8 P6 12 P2 16 /RES 20 BC1 24 D4 28 D0 |
Spectrum Xboo |
GND ------------------- CNTR.24 GND ULA.Pin28 ------|>o---- CNTR.10 ACK (SPKR) EAR ------------------- CNTR.2 D0 (EAR) KB1.Pin1 "0" ---|>|---- CNTR.3 D1 (CLK) KB1.Pin2 "9" ---|>|---- CNTR.4 D2 (D0) KB1.Pin3 "8" ---|>|---- CNTR.5 D3 (D1) KB1.Pin4 "7" ---|>|---- CNTR.6 D4 (D2) KB1.Pin5 "6" ---|>|---- CNTR.7 D5 (D3) CPU.Pin26 ----|>|---- CNTR.8 D6 (/RESET) EPROM.Pin27 ----------- CNTR.9 D7 (ROM.A14) EPROM.Pin27 ---/cut/--- /RD EPROM.Pin27 ---[3k3]--- +5V EPROM.Pin1 ----------- +5V |
KB1.PIN1 "0" ---|>|--- DSUB.Pin6 Fire KB1.PIN2 "9" ---|>|--- DSUB.Pin1 Up KB1.PIN3 "8" ---|>|--- DSUB.Pin2 Down KB1.PIN4 "7" ---|>|--- DSUB.Pin4 Right KB1.PIN5 "6" ---|>|--- DSUB.Pin3 Left KB2.PIN4 A12 ---|<|--- DSUB.Pin8 Common |
GND ----------------------------------------- Cinch GND VID ----------------------------------------- Cinch V MIC ----------------------------------------- Cinch A |
Spectrum 5V ------------ PC 5V (red floppy cable) Spectrum 5V -----||----- Spectrum GND Spectrum 5V ----|>|----- Spectrum 9V |
Lambda 8300 |
Name___________Usage_______________ Lambda 8300 (Denmark, Sweden, Norway) Power 3000 Creon Enterprises (Hongkong) (Denmark, Germany) Marathon 32K (Denmark) Futura 8300 Unisonic (USA) DEF 3000 (France) Your Computer IQ8300 (China?) BASIC 2000 BASIC 3000 PC 2000 PC 8300 Text on mainboard |
A11 = 2 = Up, A10 = W = Down, A12 = 9 = Left, A9 = S = Right, A13 = O = Fire |
XXX does the border affect the COLOR BURST signal? XXX and thus alter the colors in the picture region? XXXXXX the 3bit color values allow to use 8 colors, XXXXXX but it's unknown WHICH colors? |
I/O:xxF5h.W ;select charset line number (00..07) ;\use only in FAST mode, I/O:xxF6h.W ;select charset char number (00..3F) ;/or after HSYNC (NMI) I/O:xxFBh.W ;printer control (sinclair pixel-style, or ASCII character) I/O:xxFDh.W ;disable NMIs I/O:xxFEh.W ;enable NMIs I/O:xxFFh.W ;terminate retrace / CAS output I/O:xxF5h.R ;toggle sound output level I/O:xxF6h.R ;read selected charset data (8 pixels) I/O:xxFBh.R ;printer status I/O:NNFEh.R ;read keyboard (A8..A15=row) (and CAS.IN) (and JOYSTICK) ;(but no PAL/NTSC bit here, unlike ZX81) I/O:FF7Eh.R ;read PAL/NTSC flag (A7=row) (via diode from A7 to KEYB.0) MEM:00XXh dummy blink addr in write-protected BIOS ROM MEM:2000h optional boot entryoint (in COLOR RAM, or TS1510-cartirdges) MEM:2XXXh COLOR ATTRIBUTES (external color module) MEM:3000h disable color ram (on any write to 3000-3FFE with A0=0) MEM:3001h enable color ram (on any write to 3001-3FFF with A0=1) |
4000 2 unused (unlike ZX81: ERR_NR, FLAGS) (not used) 4002 2 err_sp (same as ZX81) 4004 2 ramtop (same as ZX81, but, max 32K) 4006 1 prmode (unlike ZX81: MODE, cursor shape) (instead: printer mode) 4007 1 err_nr (unlike ZX81: ppc.lsb) 4008 1 color (unlike ZX81: ppc.msb) |
4009 1 versn (versn, and other temporary flags) (00h=ZX81, FFh=Lambda) 400A 2 nxtlin (unlike ZX81: e_ppc) 400C 2 program (unlike ZX81: d_file) 400E 2 df_cc (same as ZX81) 4010 2 vars (same as ZX81) 4012 2 dest (same as ZX81) 4014 2 e_line (same as ZX81) (input/workspace buffer, end of SAVE area) 4016 2 ch_add (same as ZX81) 4018 2 x_ptr (same as ZX81) (error/abort address) 401A 2 stkbot (same as ZX81) 401C 2 stkend (same as ZX81) (increases on PUSHes) 401E 1 flags (unlike ZX81: berg) (same as 4001h on ZX81) 401F 2 mem (same as ZX81) 4021 1 munit (unlike ZX81: unused) (tempo for music) 4022 1 df_sz (same as ZX81) 4023 2 s_top (same as ZX81) 4025 2 last_k (same as ZX81) 4027 1 bounce (same as ZX81) 4028 1 margin (same as ZX81) (but, derived from other I/O mechanism) 4029 2 e_ppc (unlike ZX81: nxtlin) 402B 2 oldppc (same as ZX81) 402D 1 flagx (same as ZX81) 402E 2 strlen (same as ZX81) 4030 2 t_addr (same as ZX81) 4032 2 seed (same as ZX81) 4034 2 frames (same as ZX81) 4036 2 ppc (unlike ZX81: coords) (same as 4007h on ZX81) 4038 1 pr_cc (same as ZX81) 4039 2 s_posn (same as ZX81) 403B 1 cdflag (additional bit4=graphics_cursor, bit5=beep_disable) 403C 33 prbuff (same as ZX81) 405D 30 membot (same as ZX81) 407B 2 blink (unlike ZX81: blink address instead unused) N/A 1 mode (no [K],[L],[F] cursors, only [G] = flag in cdflag.bit4) N/A 1 berg (none such, memorized somehow elsewhere) N/A 2 coords (none such,isn't really used on ZX81 either) |
Jupiter ACE |
Jupiter ACE I/O Ports |
0-4 Keyboard Bits 5 Cassette Input (EAR/LOAD) 6-7 Not used |
0-2 Not used 3 Cassette Output (MIC/SAVE) 4-7 Not used |
Jupiter ACE Video |
Char Rows 20h..3Eh 7 ;1Fh chars (upper row blank) (lower row is used in $,;) 3Fh..5Eh 6 ;20h chars (upper and lower row blank) 5Fh..7Eh 7 ;20h chars (upper row blank) (lower row is used in _gjpqy) 7Fh 8 ;01h char (no blank rows) (copyright symbol) |
Jupiter ACE Dimensions and Timings |
Phase__________Dotclock_______________=_CPU Clock___________ Hsync 32 pixels (320..351) = 16 clks Left Border 64 pixels (352..415) = 32 clks Picture 256 pixels (0..255) = 128 clks Right Border 64 pixels (256..319) = 32 clks Total 416 pixels (0..415) = 208 clks |
Phase__________50_Hz_version__________60_Hz_Version_______ Vsync 8 lines (248..255) 8 lines (224..231) Upper Border 56 lines (256..311) 32 lines (232..263) Picture 192 lines (0..191) 192 lines (0..191) Lower Border 56 lines (192..247) 32 lines (192..223) Total 312 lines (0..311) 264 lines (0..311) |
Jupiter ACE Memory Map and System Area |
0000h-1FFFh R BIOS ROM (8K) (FORTH Interpreter) 2000h-23FFh R/W VRAM BgMap/Pad with CPU priority (video DMA shows garbage) 2400h-27FFh R/W VRAM BgMap/Pad with DMA priority (CPU gets paused by /WAIT) 2800h-2BFFh W VRAM Charset with CPU priority (video DMA shows garbage) 2C00h-2FFFh W VRAM Charset with DMA priority (CPU gets paused by /WAIT) 3000h R/W Unused (mirrors of 1K Work RAM) 3C00h R/W Work RAM (1K) 4000h-FFFFh R/W Expansion RAM (or open-bus if none such) |
FP_WS 3C00h 19 Workspace for floating point arithmetic LISTWS 3C13h 5 Workspace for 'LIST' and 'EDIT' RAMTOP 3C18h 2 Work RAM End Address (4000h=1K, 8000h=17K, 0000h=49K) HLD 3C1Ah 2 VRAM PAD Address of the latest character held in the pad by formatted output ('#', 'HOLD' and so on) SCRPOS 3C1Ch 2 VRAM Output Address: location of next char to be printed INSCRN 3C1Eh 2 VRAM InputBuf Address: start of current logical line CURSOR 3C20h 2 VRAM InputBuf Address: cursor addresss in input buffer ENDBUF 3C22h 2 VRAM InputBuf Address: end of current logical line L_HALF 3C24h 2 VRAM InputBuf Address: input buffer start (ends at 26FFh) KEYCOD 3C26h 1 Keyboard ASCII code of the last key pressed (00h=none) KEYCNT 3C27h 1 Keyboard Debounce counter (key accept and repeat delay) STATIN 3C28h 1 Keyboard Flags (0=newkey,1=caps,2=graph,3=invert,5=enter) EXWRCH 3C29h 2 Address of print chr(A) routine (or 0000h=print to screen) FRAMES 3C2Bh 4 Frames counter (number of /VSYNC interrupts since power-on) XCOORD 3C2Fh 1 PLOT last used x-coordinate YCOORD 3C30h 1 PLOT last used y-coordinate CURRENT 3C31h 2 Vocabulary Address of CURRENT vocabulary CONTEXT 3C33h 2 Vocabulary Address of CONTEXT vocabulary VOCLNK 3C35h 2 Vocabulary Address of NEWEST vocabulary (plus 3) STKBOT 3C37h 2 Work RAM Address of End of Dictionary / Start of Stack DICT 3C39h 2 Work RAM Address of the (still undefined) length field of the newest word in the dictionary (once when that length field is correctly filled in then DICT may be 0000h) SPARE 3C3Bh 2 Work RAM Address of first byte past top of the FORTH stack ERR_NO 3C3Dh 1 Error code (FFh=no error) (ERROR shown on ABORT if bit7=0) FLAGS 3C3Eh 1 Flags... Bit2 incomplete definition at the end of the dictionary Bit3 output is to be fed into the input buffer Bit4 the Ace is in invisible mode Bit6 the Ace is in compile (editing) mode BASE 3C3Fh 1 The system number base (default is 0Ah=decimal) 3C40h 5 FORTH name string "FORTH"+80h 3C45h 2 FORTH disp to next word (or 0000h if no next) 3C47h 2 FORTH ptr to 1FFFh in ROM (links to ROM words) 3C49h 1 FORTH length of "FORTH" name at 3C40h (ie. =05h) 3C4Ah 2 FORTH ptr to 11B5h in ROM (vocabulary handler) 3C4Ch 2 FORTH ptr to next word in chain (or to 3C49h if none) 3C4Eh 1 FORTH unknown/unused (usually 00h) 3C4Fh 2 FORTH ptr to previous vocabulary (always 0000h=none) 3C51h .. user dictionary |
Jupiter ACE Files |
Pre 1 Blocktype (00h=Header) 00h 1 Filetype (00h=Forth) 01h 10 Filename (ASCII, padded with spaces) (chr 00h = no name) 0Bh 2 Filesize (LEN=STKBOT-3C51h) 0Dh 2 Unused (usually 3C51h, dictionary start address) 0Fh 2 Offset to newest word at end of file (relative to 3C51h) 11h 2 Unused (usually 3C4Ch, CURRENT vocabulary) 13h 2 Unused (usually 3C4Ch, CONTEXT vocabulary) 15h 2 Unused (usually 3C4Fh, NEWEST vocabulary+3) 17h 2 Unused (usually 3C51h+filesize, STKBOT) Post 1 Chksum [00h..18h] XORed together (unlike Spectrum without Blocktype) |
Pre 1 Blocktype (00h=Header) 00h 1 Filetype (20h=Binary) 01h 10 Filename (ASCII, padded with spaces) (chr 00h = no name) 0Bh 2 Filesize (LEN) 0Dh 2 Fileaddr (Default target address, used when desired target=0) 0Fh 10 Unused (filled with spaces) Post 1 Chksum [00h..18h] XORed together (unlike Spectrum without Blocktype) |
Pre 1 Blocktype (FFh=Body) 00h LEN Forth stuff (starting with 1st word name) / Binary Data Post 1 Chksum [00h..LEN-1] XORed together (unlike Spectrum without Blktyp) |
Pos Len Content -N .. word name in ASCII (terminated by bit7=1 in last char) -4 2 disp from current addr to NEXT <word name> (RAM words only, not ROM) -2 2 ptr to PREVIOUS word definition +0 1 length of word name (up to including the last char with bit7=1) +1 2 ptr to Z80 machine code handler for this word (usually to ROM) +3 .. whatever, probably TYPE and definition... |
3C40h 5 FORTH name string "FORTH"+80h 3C45h 2 FORTH disp to next word (or 0000h if no next) 3C47h 2 FORTH ptr to 1FFFh in ROM (links to ROM words) 3C49h 1 FORTH length of "FORTH" name at 3C40h (ie. =05h) 3C4Ah 2 FORTH ptr to 11B5h in ROM 3C4Ch 2 FORTH ptr to next word in chain (or to 3C49h if none) |
LOAD worms GET graphics GO |
FORTH Overview |
Stack Notation Cells Description c 1 Character (high byte ignored) flag 1 Boolean (0 = False, 1 = True) n 1 Signed 16bit number u 1 Unsigned 16bit number x 1 Non-specific 16bit number adr 1 Memory address (16bit) d 2 Signed 32bit double number ud 2 Unsigned 32bit double number xd 2 Non-specific 32bit number f 2 Floating point 32bit number |
FORTH Stack and Memory |
x (--> x) Store 16bit immediate on stack (eg. 1) f (--> f) Store float immediate on stack (eg. 1.0) DROP (x -->) Discard TOS (top of stack) DUP (x --> x x) Copy 1st cell to top (Duplicate TOS) OVER (x2 x1 --> x2 x1 x2) Copy 2nd cell to top PICK (xn..x1 n --> xn..x1 xn) Copy nth cell to top SWAP (x2 x1 --> x1 x2) Rotate 2nd cell to top ROT (x3 x2 x1 --> x2 x1 x3) Rotate 3rd cell to top ROLL (xn..x1 n --> xn-1..x1 xn) Rotate nth cell to top ?DUP (x --> x (x)) Conditional DUP, only if x = non-zero >R (x -->) (R: --> x) Move TOS to Return Stack R> (R: x -->) (--> x) Retrieve from Return Stack |
@ (adr --> x) Read x (2 bytes) from adr ! (x adr -->) Store x (2 bytes) to adr C@ (adr --> c) Read c (1 byte) from adr C! (c adr -->) Store c (1 byte) to adr |
FORTH Maths |
+ (n1 n2 --> n3) n3 = n1 + n2 - (n1 n2 --> n3) n3 = n1 - n2 * (n1 n2 --> n3) n3 = n1 * n2 / (n1 n2 --> n3) n4 = n1 / n2 MOD (n1 n2 --> n3) Remainder of n1 / n2 (sign of n1) /MOD (n1 n2 --> n3 n4) n3 = remainder of n1/n2, n4=n1/n2 */ (n1 n2 n3 --> n4) n4 = n1*n2/n3 */MOD (n1 n2 n3 --> n4 n5) n4 = remainder of n1*n2/n3, n5=n1*n2/n3 1+ (n1 --> n2) n2 = n1 + 1 1- (n1 --> n2) n2 = n1 - 1 2+ (n1 --> n2) n2 = n1 + 2 2- (n1 --> n2) n2 = n1 - 2 ABS (n --> u) u = |n| (absolute value) NEGATE (n1 --> n2) n2 = -n1 (two's complement) U* (u1 u2 --> ud) ud = u1 * u2 U/MOD (ud u1 --> u2 u3) u2 = remainder of ud/u1, u3 = ud/u1 D+ (d1 d2 --> d3) d3 = d1 + d2 DNEGATE (d1 --> d2) d2 = -d1 (two's complement) |
INT (f --> n) Convert floating number to integer UFLOAT (u --> f) Convert unsigned integer to float F+ (f1 f2 --> f3) f3 = f1 + f2 F- (f1 f2 --> f3) f3 = f1 - f2 F* (f1 f2 --> f3) f3 = f1 * f2 F/ (f1 f2 --> f3) f3 = f1 / f2 FNEGATE (f1 --> f2) f2 = -f1 |
< (n1 n2 --> flag) True if n1 < n2 = (n1 n2 --> flag) True if n1 = n2 > (n1 n2 --> flag) True if n1 > n2 0< (n --> flag) True if n < 0 0= (n --> flag) True if n = 0 0> (n --> flag) True if n > 0 U< (u1 u2 --> flag) True if u1 < u2 D< (d1 d2 --> flag) True if d1 < d2 MAX (n1 n2 --> n3) Leave greater of two numbers MIN (n1 n2 --> n3) Leave lesser of two numbers |
AND (x1 x2 --> x3) Bitwise boolean AND OR (x1 x2 --> x3) Bitwise boolean OR XOR (x1 x2 --> x3) Bitwise boolean XOR |
FORTH Input/Output |
CR (-->) Print carriage return and line feed EMIT (c -->) Print ASCII character c SPACE (-->) Print one space SPACES (n -->) Print n spaces, if n > 0 ." ..." (-->) Print string terminated by " (." 123 test") TYPE (adr n -->) Print n characters from adr |
. (n -->) Print n with one trailing space U. (u -->) Print unsigned with one trailing space F. (f -->) Print float with one trailing space |
<# (-->) Initiate formatted output # (ud1 --> ud2) Convert one digit from ud1 and HOLD it in the PAD #S (ud --> 0 0) Convert and HOLD all remaining significant digits HOLD (c -->) Insert character into formatted string SIGN (n -->) HOLD minus sign if n < 0 #> (ud --> adr n) Finish formatted output leaving address & length of the resulting string |
BASE (--> adr) 1-byte variable containing system number base DECIMAL (-->) Set base to decimal ASCII text (--> c) ASCII code of first character in text |
QUERY (-->) Accept entry at the input buffer WORD (c --> adr) Take text from input buffer using c as delimiter, leave adr of length byte RETYPE ( --> ) Allow input buffer editing, turning cursor to "?" INKEY (--> x) Read keyboard (0 = no key pressed) |
CONVERT (d1 adr1 --> d2 adr2) Convert string at adr1 to double number and add into d1 leaving result d2 NUMBER (--> x (adr)) Get number from input buffer (--> n 4102) Converted to integer (--> f 4181) Converted to float (--> 0) Conversion failed |
CLS (-->) Clear screen AT (n1 n2 -->) Set print position to row n1 and column n2 PLOT (n1 n2 n3 -->) Plot X=n1,Y=n2,Mode=n3 (0=unplot,1=plot,2=move,3=change) |
FORTH .... |
IF (flag -->) Conditional structure IF..(ELSE)..THEN ELSE (-->) False condition of an IF structure THEN (-->) End of an IF conditional structure DO (n1 n2 -->) Counted loop structure DO...LOOP, (n2=start, n1=end) LOOP (-->) Increment loop count, terminate if end +LOOP (n -->) Add n to loop count, terminate if end I (--> n) Get current loop count I' (--> n) Get current loop count limit J (--> n) Get outer loop count LEAVE (-->) Force a DO...LOOP count to end BEGIN (-->) Begin a WHILE or UNTIL loop UNTIL (flag -->) Loop until flag = true (BEGIN..UNTIL) WHILE (flag -->) Exit loop when flag = false (BEGIN..WHILE..REPEAT) REPEAT (-->) Jump back to BEGIN in a WHILE loop EXIT ( --> ) Exit current word execution EXECUTE (adr -->) Execute word with compilation adr CALL (adr -->) Call Z80 code (terminated with JP IY) (not by RET) ABORT (... -->) Quit program, clearing data stack QUIT (-->) Quit program, not clearing data stack |
: pname ... ; (-->) Define a procedure (terminated by semicolon) VARIABLE vname (x -->) Define a variable with initial value x CONSTANT cname (x -->) Define a constant with constant value x CREATE aname (-->) Define an (empty) array (usually followed by ALLOT) ALLOT (n -->) Allocate n bytes at end of newest word (see CREATE) vname (--> adr) Get variable adr (eg. "vname @" to get its value) aname (--> adr) Get array address cname (--> x) Get constant value pname (-->) Call a procedure IMMEDIATE (-->) Make newest word to execute even in compile mode DEFINER word (-->) Start a defining word definition DOES> (--> adr) Define the action routine of a defining word COMPILER word (n -->) Start a compiling word definition (and ALLOT n) RUNS> (--> adr) Defines the action routine of a compiling word FIND word (--> adr) Find word compilation address (0 if not found) LIST word (-->) List word definition EDIT word (-->) Edit word definition (doesn't delete old word) FORGET name (-->) Delete <name> as well as ALL newer words REDEFINE name (-->) Delete old <name> and replace it by newest word |
VOCABULARY dname (-->) Define a new vocabulary dname (-->) Set CONTEXT to the <dname> vocabulary FORTH (-->) Set CONTEXT to the FORTH vocabulary DEFINITIONS (-->) Set CURRENT vocabulary to CONTEXT CONTEXT (--> adr) Get current word search vocabulary address ;3C33h CURRENT (--> adr) Get current word definition vocabulary addr ;3C31h VLIST (-->) List dictionary to screen (press BREAK to stop it) |
, (x -->) Compile x into dictionary (ALLOT 2 byte, set to x) C, (c -->) Compile c into dictionary (ALLOT 1 byte, set to c) LITERAL (x -->) Compile x into edited procedure (preceed by [ x ]) [ ... ] (... -->) Force ... to be interpreted (even during EDITing) |
( ...) (-->) Start a comment, terminated by ")" HERE (--> adr) Next available dictionary location, ie. [STKBOT] PAD (--> adr) Scratch pad area address (2701h aka 9985) SLOW (-->) Normal execution. Enable error checks FAST (-->) Faster execution. Disable error checks (and BREAK-key ?) BEEP (u1 u2 -->) Play tone, u1=1000000/(8*freq [Hz]), u2=duration [ms] IN (adr --> c) Read byte from Z80 input port adr OUT (c adr -->) Write byte to Z80 output port adr INVIS (-->) Disable copy-up mechanism and OK VIS (-->) Enable copy-up mechanism and OK LINE (-->) Interpret the input buffer as FORTH |
LOAD name (-->) Load vocabulary ;\lists all filenames VERIFY name (-->) Verify vocabulary ;/when no name typed SAVE name (-->) Save vocabulary BLOAD name (adr u -->) Load u bytes to adr ;\use file header value(s) BVERIFY name (adr u -->) Verify u bytes from adr ;/when adr=0 or u=0 BSAVE name (adr u -->) Save u bytes from adr |
FORTH Error Codes |
1 Not enough memory 2 Data Stack Underflow 3 BREAK pressed 4 Compile only word 5 Structure imbalance 6 Name size < 1 or > 64 7 PICK or ROLL operand = 0 8 Floating point overflow 9 AT or PLOT to the input buffer 10 Tape error 11 REDEFINE or FORGET error 12 Incomplete definition in dictionary 13 Word not found or is ROM or is FORTH 14 Word not Listable |
Z80 CPU Specifications |
Z80 Register Set |
16bit Hi Lo Name/Function --------------------------------------- AF A - Accumulator & Flags BC B C BC DE D E DE HL H L HL AF' - - Second AF BC' - - Second BC DE' - - Second DE HL' - - Second HL IX IXH IXL Index register 1 IY IYH IYL Index register 2 SP - - Stack Pointer PC - - Program Counter/Pointer - I R Interrupt & Refresh |
Z80 Flags |
Bit Name Set Clr Expl. 0 C C NC Carry Flag 1 N - - Add/Sub-Flag (BCD) 2 P/V PE PO Parity/Overflow-Flag 3 - - - Undocumented 4 H - - Half-Carry Flag (BCD) 5 - - - Undocumented 6 Z Z NZ Zero-Flag 7 S M P Sign-Flag |
Z80 Instruction Format |
r 8bit register A,B,C,D,E,H,L rr 16bit register BC, DE, HL/IX/IY, AF/SP (as described) i 8bit register A,B,C,D,E,IXH/IYH,IXL/IYL ii 16bit register IX,IY n 8bit immediate 00-FFh (unless described else) nn 16bit immediate 0000-FFFFh d 8bit signed offset -128..+127 f flag condition nz,z,nc,c AND/OR po,pe,p,m (as described) (..) 16bit pointer to byte/word in memory |
s Indicates Signed result z Indicates Zero h Indicates Halfcarry o Indicates Overflow p Indicates Parity c Indicates Carry - Flag is not affected 0 Flag is cleared 1 Flag is set x Flag is destroyed (unspecified) i State of IFF2 e Indicates BC<>0 for LDX(R) and CPX(R), or B=0 for INX(R) and OUTX(R) |
Z80 Load Commands |
Instruction Opcode Cycles Flags Notes ld r,r xx 4 ------ r=r ld i,i pD xx 8 ------ i=i ld r,n xx nn 7 ------ r=n ld i,n pD xx nn 11 ------ i=n ld r,(HL) xx 7 ------ r=(HL) ld r,(ii+d) pD xx dd 19 ------ r=(ii+d) ld (HL),r 7x 7 ------ (HL)=r ld (ii+d),r pD 7x dd 19 ------ ld (HL),n 36 nn 10 ------ ld (ii+d),n pD 36 dd nn 19 ------ ld A,(BC) 0A 7 ------ ld A,(DE) 1A 7 ------ ld A,(nn) 3A nn nn 13 ------ ld (BC),A 02 7 ------ ld (DE),A 12 7 ------ ld (nn),A 32 nn nn 13 ------ ld A,I ED 57 9 sz0i0- A=I ;Interrupt Register ld A,R ED 5F 9 sz0i0- A=R ;Refresh Register ld I,A ED 47 9 ------ ld R,A ED 4F 9 ------ |
Instruction Opcode Cycles Flags Notes ld rr,nn x1 nn nn 10 ------ rr=nn ;rr may be BC,DE,HL or SP ld ii,nn pD 21 nn nn 13 ------ ii=nn ld HL,(nn) 2A nn nn 16 ------ HL=(nn) ld ii,(nn) pD 2A nn nn 20 ------ ii=(nn) ld rr,(nn) ED xB nn nn 20 ------ rr=(nn) ;rr may be BC,DE,HL or SP ld (nn),HL 22 nn nn 16 ------ (nn)=HL ld (nn),ii pD 22 nn nn 20 ------ (nn)=ii ld (nn),rr ED x3 nn nn 20 ------ (nn)=rr ;rr may be BC,DE,HL or SP ld SP,HL F9 6 ------ SP=HL ld SP,ii pD F9 10 ------ SP=ii push rr x5 11 ------ SP=SP-2, (SP)=rr ;rr may be BC,DE,HL,AF push ii pD E5 15 ------ SP=SP-2, (SP)=ii pop rr x1 10 (-AF-) rr=(SP), SP=SP+2 ;rr may be BC,DE,HL,AF pop ii pD E1 14 ------ ii=(SP), SP=SP+2 ex DE,HL EB 4 ------ exchange DE <--> HL ex AF,AF 08 4 xxxxxx exchange AF <--> AF' exx D9 4 ------ exchange BC,DE,HL <--> BC',DE',HL' ex (SP),HL E3 19 ------ exchange (SP) <--> HL ex (SP),ii pD E3 23 ------ exchange (SP) <--> ii |
Instruction Opcode Cycles Flags Notes ldi ED A0 16 --0e0- (DE)=(HL), HL=HL+1, DE=DE+1, BC=BC-1 ldd ED A8 16 --0e0- (DE)=(HL), HL=HL-1, DE=DE-1, BC=BC-1 ldir ED B0 bc*21-5 --0?0- ldi-repeat until BC=0 lddr ED B8 bc*21-5 --0?0- ldd-repeat until BC=0 |
Z80 Arithmetic/Logical Commands |
Instruction Opcode Cycles Flags Notes daa 27 4 szxp-x decimal adjust akku cpl 2F 4 --1-1- A = A xor FF neg ED 44 8 szho1c A = 00-A <arit> r xx 4 szhonc see below <arit> i pD xx 8 szhonc see below, UNDOCUMENTED <arit> n xx nn 7 szhonc see below <arit> (HL) xx 7 szhonc see below <arit> (ii+d) pD xx dd 19 szhonc see below <cnt> r xx 4 szhon- see below <cnt> i pD xx 8 szhon- see below, UNDOCUMENTED <cnt> (HL) xx 11 szhon- see below <cnt> (ii+d) pD xx dd 23 szhon- see below <logi> r xx 4 szhp00 see below <logi> i pD xx 8 szhp00 see below, UNDOCUMENTED <logi> n xx nn 7 szhp00 see below <logi> (HL) xx 7 szhp00 see below <logi> (ii+d) pD xx dd 19 szhp00 see below |
add A,op see above 4-19 szho0c A=A+op adc A,op see above 4-19 szho0c A=A+op+cy sub op see above 4-19 szho1c A=A-op sbc A,op see above 4-19 szho1c A=A-op-cy cp op see above 4-19 szho1c compare, ie. VOID=A-op |
inc op see above 4-23 szho0- op=op+1 dec op see above 4-23 szho1- op=op-1 |
and op see above 4-19 sz1p00 A=A & op xor op see above 4-19 sz0p00 A=A XOR op or op see above 4-19 sz0p00 A=A | op |
Instruction Opcode Cycles Flags Notes add HL,rr x9 11 --h-0c HL = HL+rr ;rr may be BC,DE,HL,SP add ii,rr pD x9 15 --h-0c ii = ii+rr ;rr may be BC,DE,ii,SP (!) adc HL,rr ED xA 15 szho0c HL = HL+rr+cy ;rr may be BC,DE,HL,SP sbc HL,rr ED x2 15 szho1c HL = HL-rr-cy ;rr may be BC,DE,HL,SP inc rr x3 6 ------ rr = rr+1 ;rr may be BC,DE,HL,SP inc ii pD 23 10 ------ ii = ii+1 dec rr xB 6 ------ rr = rr-1 ;rr may be BC,DE,HL,SP dec ii pD 2B 10 ------ ii = ii-1 |
Instruction Opcode Cycles Flags Notes cpi ED A1 16 szhe1- compare A-(HL), HL=HL+1, DE=DE+1, BC=BC-1 cpd ED A9 16 szhe1- compare A-(HL), HL=HL-1, DE=DE-1, BC=BC-1 cpir ED B1 x*21-5 szhe1- cpi-repeat until BC=0 or compare fits cpdr ED B9 x*21-5 szhe1- cpd-repeat until BC=0 or compare fits |
Z80 Rotate/Shift and Singlebit Operations |
Instruction Opcode Cycles Flags Notes rlca 07 4 --0-0c rotate akku left rla 17 4 --0-0c rotate akku left through carry rrca 0F 4 --0-0c rotate akku right rra 1F 4 --0-0c rotate akku right through carry rld ED 6F 18 sz0p0- rotate left low digit of A through (HL) rrd ED 67 18 sz0p0- rotate right low digit of A through (HL) <cmd> r CB xx 8 sz0p0c see below <cmd> (HL) CB xx 15 sz0p0c see below <cmd> (ii+d) pD CB dd xx 23 sz0p0c see below <cmd> r,(ii+d) pD CB dd xx 23 sz0p0c see below, UNDOCUMENTED modify and load |
rlc rotate left rl rotate left through carry rrc rotate right rr rotate right through carry sla shift left arithmetic (b0=0) sll UNDOCUMENTED shift left (b0=1) sra shift right arithmetic (b7=b7) srl shift right logical (b7=0) |
Instruction Opcode Cycles Flags Notes bit n,r CB xx 8 xz1x0- test bit n ;n=0..7 bit n,(HL) CB xx 12 xz1x0- bit n,(ii+d) pD CB dd xx 20 xz1x0- set n,r CB xx 8 ------ set bit n ;n=0..7 set n,(HL) CB xx 15 ------ set n,(ii+d) pD CB dd xx 23 ------ set r,n,(ii+d) pD CB dd xx 23 ------ UNDOCUMENTED set n,(ii+d) and ld r,(ii+d) res n,r CB xx 8 ------ reset bit n ;n=0..7 res n,(HL) CB xx 15 ------ res n,(ii+d) pD CB dd xx 23 ------ res r,n,(ii+d) pD CB dd xx 23 ------ UNDOCUMENTED res n,(ii+d) and ld r,(ii+d) ccf 3F 4 --h-0c h=cy, cy=cy xor 1 scf 37 4 --0-01 cy=1 |
Z80 Jumpcommands & Interrupts |
Instruction Opcode Cycles Flags Notes jp nn C3 nn nn 10 ------ jump to nn, ie. PC=nn jp HL E9 4 ------ jump to HL, ie. PC=HL jp ii pD E9 8 ------ jump to ii, ie. PC=ii jp f,nn xx nn nn 10;10 ------ jump to nn if nz,z,nc,c,po,pe,p,m jr nn 18 dd 12 ------ relative jump to nn, ie. PC=PC+d jr f,nn xx dd 12;7 ------ relative jump to nn if nz,z,nc,c djnz nn 10 dd 13;8 ------ B=B-1 and relative jump to nn if B<>0 call nn CD nn nn 17 ------ call nn ie. SP=SP-2, (SP)=PC, PC=nn call f,nn xx nn nn 17;10 ------ call nn if nz,z,nc,c,po,pe,p,m ret C9 10 ------ pop PC ie. PC=(SP), SP=SP+2 ret f xx 11;5 ------ pop PC if nz,z,nc,c,po,pe,p,m rst n xx 11 ------ call n ;n=00,08,10,18,20,28,30,38 nop 00 4 ------ no operation |
Instruction Opcode Cycles Flags Notes di F3 4 ------ IFF1=0, IFF2=0 ;disable interrupts ei FB 4 ------ IFF1=1, IFF2=1 ;enable interrupts im 0 ED 46 8 ------ read opcode from databus on interrupt im 1 ED 56 8 ------ execute call 0038h on interrupt im 2 ED 5E 8 ------ execute call (i*100h+databus) on int. halt 76 N*4 ------ repeat until interrupt occurs reti ED 4D 14 ------ pop PC, IFF1=IFF2, ACK (ret from INT) retn ED 45 14 ------ pop PC, IFF1=IFF2 (ret from NMI) </INT=LOW,IM=0,IFF1=1> 1+var ------ IFF1=0,IFF2=0, exec opcode from databus </INT=LOW,IM=1,IFF1=1> 12 ------ IFF1=0,IFF2=0, CALL 0038h </INT=LOW,IM=2,IFF1=1> 18 ------ IFF1=0,IFF2=0, CALL [I*100h+databus] </NMI=falling_edge> ? ------ IFF1=0, CALL 0066h |
Z80 I/O Commands |
Instruction Opcode Cycles Flags Notes in A,(n) DB nn 11 ------ A=PORT(A*100h+n) in r,(C) ED xx 12 sz0p0- r=PORT(BC) in (C) ED 70 12 sz0p0- **undoc/illegal** VOID=PORT(BC) out (n),A D3 nn 11 ------ PORT(A*100h+n)=A out (C),r ED xx 12 ------ PORT(BC)=r out (C),0 ED 71 12 ------ **undoc/illegal** PORT(BC)=00 ini ED A2 16 xexxxx MEM(HL)=PORT(BC), HL=HL+1, B=B-1 ind ED AA 16 xexxxx MEM(HL)=PORT(BC), HL=HL-1, B=B-1 outi ED A3 16 xexxxx B=B-1, PORT(BC)=MEM(HL), HL=HL+1 outd ED AB 16 xexxxx B=B-1, PORT(BC)=MEM(HL), HL=HL-1 inir ED B2 b*21-5 x1xxxx same than ini, repeat until b=0 indr ED BA b*21-5 x1xxxx same than ind, repeat until b=0 otir ED B3 b*21-5 x1xxxx same than outi, repeat until b=0 otdr ED BB b*21-5 x1xxxx same than outd, repeat until b=0 |
Z80 Interrupts |
EI IFF1=1, IFF2=1 DI IFF1=0, IFF2=0 <INT> IFF1=0, IFF2=0 <NMI> IFF1=0 RETI IFF1=IFF2 RETN IFF1=IFF2 |
Mode Cycles Refresh Operation 0 1+var 0+var IFF1=0,IFF2=0, read and execute opcode from databus 1 12 1 IFF1=0,IFF2=0, CALL 0038h 2 18 1 IFF1=0,IFF2=0, CALL [I*100h+databus] |
Z80 Meaningless and Duplicated Opcodes |
Z80 Garbage in Flag Register |
RLD; CPL; RLCA; RLA; LD A,I; ADD OP; ADC OP; XOR OP; AND OP; RRD; NEG; RRCA; RRA; LD A,R; SUB OP; SBC OP; OR OP ; DAA. |
RLC OP; RL OP; SLA OP; SLL OP; INC OP; IN OP,(C); RRC OP; RR OP; SRA OP; SRL OP; DEC OP |
ADD RR,XX; ADC RR,XX; SBC RR,XX. |
DUMMY = "REG_C+DATA+1" ;for INI/INIR DUMMY = "REG_C+DATA-1" ;for IND/INDR DUMMY = "REG_L+DATA" ;for OUTI,OUTD,OTIR,OTDR FLG_C = Carry of above "DUMMY" calculation FLG_H = Carry of above "DUMMY" calculation (same as FLG_C) FLG_N = Sign of "DATA" FLG_P = Parity of "REG_B XOR (DUMMY AND 07h)" FLG_S = Sign of "REG_B" UNDOC = Bit3,5 of "REG_B AND 28h" |
FLG_H = (OLD_A AND 0Fh) > 09h FLG_C = Carry of result |
FLG_H = (NEW_A AND 0Fh) > 09h FLG_C = OLD_CARRY OR (OLD_A>99h) |
Content Instruction A*100h LD (xx),A ;xx=BC,DE,nn xx+1 LD A,(xx) ;xx=BC,DE,nn nn+1 LD (nn),rr; LD rr,(nn) ;rr=BC,DE,HL,IX,IY rr EX (SP),rr ;rr=HL,IX,IY (MEMPTR=new value of rr) rr+1 ADD/ADC/SBC rr,xx ;rr=HL,IX,IY (MEMPTR=old value of rr+1) HL+1 RLD and RRD dest JP nn; CALL nn; JR nn ;dest=nn dest JP f,nn; CALL f,nn ;regardless of condition true/false dest RET; RETI; RETN ;dest=value read from (sp) dest RET f; JR f,nn; DJNZ nn ;only if condition=true 00XX RST n adr+1 IN A,(n) ;adr=A*100h+n, memptr=A*100h+n+1 bc+1 IN r,(BC); OUT (BC),r ;adr=bc ii+d All instructions with operand (ii+d) |
OUT (N),A and block commands LDXX, CPXX, INXX, OUTXX and probably interrupts in IM 0, 1, 2 |
Z80 Compatibility |
Z80 Pin-Outs |
_____ _____ | |_| | A11 |1 40| A10 A12 |2 39| A9 A13 |3 38| A8 A14 |4 37| A7 A15 |5 36| A6 CLK |6 35| A5 D4 |7 34| A4 D3 |8 33| A3 D5 |9 32| A2 D6 |10 Z80 31| A1 VCC |11 CPU 30| A0 D2 |12 29| GND D7 |13 28| /RFSH D0 |14 27| /M1 D1 |15 26| /RST /INT |16 25| /BUSRQ /NMI |17 24| /WAIT /HALT |18 23| /BUSAK /MREQ |19 22| /WR /IORQ |20 21| /RD |_____________| |
Z80 Local Usage |
BASIC Interpreter |
BASIC Editor |
Key Name Expl. Equivalent/emulated PC Key Ret NEWLINE Confirm Input Enter Space BREAK Stops the program! Space Shift+0 RUBOUT Deletes a character Backspace Shift+1 EDIT Edits [>] Cursor selected line - Shift+5/8 <CURSOR> Moves Cursor left/right in input buffer Cursor Keys Shift+7/6 <CURSOR> Moves [>] Cursor up/down in listing Cursor Keys Shift+9 GRAPHICS Switches to [G] Graphics Cursor Mode Alt Shift+Ret FUNCTION Switches to [F] Function Cursor Mode Control |
BASIC Commands |
c-b Play note within current octave (c,d,e,f,g,a,b) C-B Play note within next higher octave (C,D,E,F,G,A,B) $ Flattens note following it (can be more flattened by $$ or $$$ etc.) # Sharpens note following it (can be more sharpened by ## or ### etc.) & Play silence (a pause of same length as normal c-b and C-B notes) _ Tied notes (eg. "5_7c" = crotchet c and a minim c tied together) On Set current octave (0..8) Tn Set tempo (60..240) n Set length of notes (1..12) (use "Nn" if preceeded by other digits) Nn Separates two numbers (eg. octave=1,length=2 --> O1N2, instead of O12) Vn Set volume level (0..15) (0=Off, 15=Loudest) Wn Set volume envelope type (0..7) (bit0=ATTACK, bit1=HOLD, bit2=REPEAT) Xn Set volume envelope frequency (0..65535) (affects all 3 channels) U Turn on volume envelope in any string ( Set loop start (if none specified: default is begin of string) ) Jump to loop start (repeat 2x, multiple brackets can repeat 4x,8x,16x..) )) Jump to loop starts (repeats endless if only ONE loop start was defined) ! ! Enclose a comment H Stop PLAY command (stops all 3 channels, including endless looping ones) Mn Configure PSG channels (bit0..2=Tone A..C, bit3..5=Noise A..C) Yn Turn on MIDI channel (1..16) Zn Send MIDI programming/configuration code (numbers depend on hardware) |
a) nothing b) a numeric expression, displayed either as normal decimal number (if in range 10^-5 .. 10^13) otherwise as nnEmm indicating nn*10^mm leading zeroes are displayed only if the first digit after the "." is not zero, ie. 0.3 and .03 are displayed as such. c) a string. undefined characters are displayed as question marks. d) AT y,x; - moves the PRINT position to the specified screen location, 0,0 is upper left. e) TAB n; - moves the PRINT position to the specified horizontal location. If this is to the left of the current location, then the vertical position is incremented. |
FORMAT LINE baudrate ;default=9600 FORMAT LPRINT target ;"R"=RS232, "C"=Centronics FORMAT LPRINT tokenmode ;"E"=Expanded, "U"=Unexpanded tokens COPY - normal screen copy to printer COPY EXP - expanded screen copy to printer (recurse BRIGHT attributes) COPY EXP INVERSE - expanded inverse screen copy to printer |
BASIC Functions |
ACS n Arcus Cosinus. ASN n Arcus Sinus. ATN n Arcus Tangens. COS n Cosinus. EXP n Exponent e^n. INT n Returns an integer value (rounded DOWN). LN n Logarhytmn of n (base e). PI 3.14159265... SIN n Sinus. SQR n Square root. TAN n Tangens. |
Op. Prio. Expl. a+b 6 Addition a-b 6 Subtraction a*b 8 Multiplication a/b 8 Division -a 9 Invert sign a**b 10 a^b |
Op. Prio. Expl. a=b 5 Equal a>b 5 Greater than a<b 5 Less than a<=b 5 Less or equal a>=b 5 Greater or equal a<>b 5 Not equal |
Op. Prio. Expl. a OR b 2 b<>0: Returns 1; b=0: Returns a. a[$] AND b 3 b<>0: Returns a (or a$); b=0: Returns 0 (or ""). NOT b 4 b<>0: Returns 0; b=0: Returns 1. |
LET A$(5 TO 7) = "***" ;overwrites 5th-7th character of A$ LET A$ = B$(TO 4) ;copies 1st-4th character of B$ to A$ |
BASIC Error Codes |
0 No Error, program terminated succesfully. 1 Encountered NEXT without FOR. 2 Undefined Variable. 3 DIM Index out of range. May also return error B if 16bit exceeded. 4 Memory full. 5 Screen full. Type CONT to continue with cleared screen. 6 Arithmetic Overflow, a value is greater than 10^38. 7 Encountered RETURN without GOSUB. 8 Attempted to use INPUT as command (without line number). 9 Program halted by STOP command, may continue by CONT. A Function with bad argument. B Integer out of range. C Failed VAL function. D Program aborted by BREAK (SPACE KEY), or entered STOP at begin of INPUT. E Not used. F Attempted to SAVE a file with empty "" name. |
0 program completed (or breaked), no error 1 NEXT without FOR 2 variable not defined 3 dimension out of range (DIM) 4 memory or gosub stack full 5 (???) 6 integer overflow (value exceeds -32768..+32767) 7 RETURN without GOSUB 8 attempted INPUT but program isn't running 9 STOP command |
BASIC Programs and Variables (ZX81/Spectrum) |
Bytes Expl. 2 Line Number (MSB,LSB) (!) 2 Line Length (LSB,MSB) LEN-1 Text 1 Newline (ZX81=76h) (Spectrum=0Dh) |
Bytes Expl. 1 60h + Letter (5bit) 5 Floating point number (exponent/value) |
Bytes Expl. 1 A0h + First Letter (5bit) NN 00h + Further Characters (6bit) 1 80h + Last Character (6bit) 5 Floating point number (exponent/value) |
Bytes Expl. 1 80h + Letter (5bit) 2 Total Length of all following data 1 Number of Dimensions D*2 Range of each of the Dimension(s) N*5 Values |
Bytes Expl. 1 E0h + Letter (5bit) 5 Current Value (float) 5 Target Value (float) 5 Step 2 Loop Linenumber (MSB,LSB) (!) |
Bytes Expl. 1 40h + Letter (5bit) 2 String Length (0 if empty) LEN Character String (none if empty) |
Bytes Expl. 1 C0h + Letter (5bit) 2 Total Length of all following data 1 Number of Dimensions D*2 Range of each of the Dimension(s) N*1 Characters |
1 Exponent 81h +/- location of most significant bit 4 Sign-Bit and Value excluding most significant bit |
1 Exponent 00h (indicates that it is a non-float value) 1 Sign (00h=Positive, FFh=Negative) 2 Integer (0000h..FFFFh) (or -0001h..-FFFFh when negative) 1 Unused (00h) |
10 FOR I = 0 TO 1 STEP .25 20 PRINT I 30 NEXT I |
1 IF VAL"0.25" < 1/4 THEN PRINT "TOO SMALL (ZX81 OR TS1000 OR SPECTRUM)" 2 IF VAL"0.25" > 1/4 THEN PRINT "TOO BIG (TS1500 OR LAMBDA)" 3 IF VAL"0.25" = 1/4 THEN PRINT "MATCH (WHOOPS)" |
BASIC Programs and Variables (ZX80) |
Bytes Expl. 2 Line Number (MSB,LSB) (!) ... Text 1 Newline (76h) |
Bytes Expl. 1 60h + Letter (5bit) 2 Signed Integer |
Bytes Expl. 1 40h + First Letter (5bit) NN 00h + Further Characters (6bit) 1 80h + Last Character (6bit) 2 Signed Integer |
Bytes Expl. 1 A0h + Letter (5bit) 1 Range (Counted from 0 to N) (N+1)*2 Signed Integers |
Bytes Expl. 1 E0h + Letter (5bit) 2 Current Value 2 Target Value 2 Loop Linenumber (normal LSB,MSB for ZX80) |
Bytes Expl. 1 80h + Letter (5bit) ... Character String (none if empty) 1 Ending Quotes (01h) |
About this document |