Portar Specifications |
I/O Addressing I/O Port Summary Memory Peripheral Interface Video Display Processor Sound Generator Cartridge Memory Mappers Floppy Disk Controller Real Time Clock RS 232 Interface Kanji ROM Special I/O Registers |
CPU Specs Z80 CPU Specifications General MSX Info Different MSX Models External Connectors Data Structures and Formats This & other docs About this Document Other DOCs |
About this Document |
http://www.work.de/nocash/portar.txt http://www.work.de/nocash/portar.htm |
I/O Port Summary |
Port R/W Chip/Name/Function 00-3F NC Free for User 40-7B NC Reserved 7C ? MSX MUSIC YM2413/OPLL (FM-PAC,FM-PAK,MSX2+) Index 7D ? MSX MUSIC YM2413/OPLL (FM-PAC,FM-PAK,MSX2+) Data I/O 7E-7F NC Reserved 80 R/W RS232 I8251 (ACIA) Data 81 R/W RS232 I8251 (ACIA) Status/Command 82 R RS232 Status for CTS,Timer/counter2,RI,CD 82 W RS232 Interrupt mask register 83 R RS232 ?Clock 0,1,2 read? 83 W RS232 ?Receive ready interrupt enable? 84 R/W RS232 I8253 (Baud gener.) Counter 0 Receive clock 85 R/W RS232 I8253 (Baud gener.) Counter 1 Transmit clock 86 R/W RS232 I8253 (Baud gener.) Counter 2 Used by programs 87 W RS232 I8253 (Baud gener.) Mode register 88 ? ?Modem enable? 88-8B R/W,W External VDP 9938 adaptor for MSX1 (similiar to Port 98-9B) 8C-8D ? Reserved for modem 8E-8F NC Reserved 90 R ULA5RA087 Centronic BUSY state (bit 1=1) 90 W ULA5RA087 Centronic STROBE output (bit 0=0) 91 W ULA5RA087 Centronic Printer Data 92-97 NC Reserved 98 R/W 9918,9929,9938,9958,9978 VRAM Data Read/Write 99 R 9918,9929,9938,9958,9978 VDP Status Registers 99 W 2nd Byte b7=0: 99X8 VRAM Address setup 99 W 2nd Byte b7=1: 99X8 VDP Register write 9A W MVDP (MSX2) 9938,9958 Color Palette Register (2 bytes) 9B W MVDP (MSX2) 9938,9958 Register data 9C-9F NC Reserved A0 W I AY-3-8910 PSG Sound Generator Index A1 W I AY-3-8910 PSG Sound Generator Data write A2 R I AY-3-8910 PSG Sound Generator Data read A3-A7 NC Reserved A8 R/W I 8255A/ULA9RA041 PPI Port A Memory PSLOT Register (RAM/ROM) A9 R I 8255A/ULA9RA041 PPI Port B Keyboard column inputs AA R/W I 8255A/ULA9RA041 PPI Port C Kbd Row sel,LED,CASo,CASm AB W I 8255A/ULA9RA041 Mode select and I/O setup of A,B,C AC-AF NC Reserved B0-B3 ? External 8255 (SONY DataRamPack) B4 W RP 5C01 (Not in 738) RTC Register select B5 R/W RP 5C01 (Not in 738) RTC data B6-B7 NC Reserved B8-BB ? SANYO Light pen interface BC-BF ? VHD control C0-C1 ? MSX audio (used in Music Module cartridge by Philips, OPL1) C2-C7 NC Reserved C8-CF ? MSX Interface (??) D0-D7 ? External Floppy Disk Controller D8h W Kanji ROM Select Class 1 Code (lower 6 bits) D9h W Kanji ROM Select Class 1 Code (upper 6 bits) D9h R Kanji ROM Read Class 1 Data (32 bytes) DAh W Kanji ROM Select Class 2 Code (lower 6 bits) DBh W Kanji ROM Select Class 2 Code (upper 6 bits) DBh R Kanji ROM Read Class 2 Data (32 bytes) DC-F4 NC Reserved E5-E7 ? MSX-Engine chip (MSX2/2+/TurboR) ??? F5 W System Control (used to disable internal I/O ports) F6 ? colour bus F7 R/W Audio/Video control F8-FB NC Reserved (But somehow accessed by MSX2 BIOS ???) FC R/W Memory Mapper (RAM bank for 0000-3FFF) FD R/W Memory Mapper (RAM bank for 4000-7FFF) FE R/W Memory Mapper (RAM bank for 8000-BFFF) FF R/W Memory Mapper (RAM bank for C000-FFFF) |
DISK:7FXX Floppy Disk Controller DISK:BFXX Floppy Disk Controller CART:XXXX Cartridge Memory Mappers CART:98XX Cartridge SCC (Sound Custom Chip) SLOT:FFFF Secondary Slot (select DISK ROM or MAIN RAM in a PSLOT) |
Memory |
Port A8 Primary Slot Register (PPI Port A, PSLOT) (Read/Write) Port FC-FF Memory Mapper RAM page select (Read/Write) Mem. SLOT:FFFF Secondary Slot Register (Read Inverted/Write) Mem. CART:XXXX Cartridge Memory Mappers |
Memory | PSLOT=0 | PSLOT=1 | PSLOT=2 | PSLOT=3 | Address | MainROM | Cart. A | Cart. B | MainRAM | -----------+---------+---------+---------+----------+ 0000..3FFF | BIOS | <aux> | <aux> | RAM3 (*) | 4000..7FFF | BASIC | <aux> | <aux> | RAM2 (*) | 8000..BFFF | N/A | <aux> | <aux> | RAM1 (*) | C000..FFFF | N/A | <aux> | <aux> | RAM0 | |
Memory | PSLOT=0 | PSLOT=1 | PSLOT=2 | [...........PSLOT=3...........] | Address | MainROM | Cart. A | Cart. B | SSLOT=0 SSLOT=1 SSLOT=2 SSLOT=3 | -----------+---------+---------+---------+---------------------------------+ 0000..3FFF | BIOS | <aux> | <aux> | N/A SUB RAM[3] N/A | 4000..7FFF | BASIC | <aux> | <aux> | N/A DISK RAM[2] N/A | 8000..BFFF | N/A | <aux> | <aux> | N/A N/A RAM[1] N/A | C000..FFFF | N/A | <aux> | <aux> | N/A N/A RAM[0] N/A | |
Bit Expl. 0-1 PSLOT number 0-3 for memory at 0000-3FFF 2-3 PSLOT number 0-3 for memory at 4000-7FFF 4-5 PSLOT number 0-3 for memory at 8000-BFFF 6-7 PSLOT number 0-3 for memory at C000-FFFF |
Bit Expl. 0-1 SSLOT number 0-3 for memory at 0000-3FFF of respective PSLOT 2-3 SSLOT number 0-3 for memory at 4000-7FFF of respective PSLOT 4-5 SSLOT number 0-3 for memory at 8000-BFFF of respective PSLOT 6-7 SSLOT number 0-3 for memory at C000-FFFF of respective PSLOT |
Port FC RAM bank number to be mapped at 0000-3FFF Port FD RAM bank number to be mapped at 4000-7FFF Port FE RAM bank number to be mapped at 8000-BFFF Port FF RAM bank number to be mapped at C000-FFFF |
Peripheral Interface |
Bit Expl. 0-1 PSLOT number 0-3 for memory at 0000-3FFF 2-3 PSLOT number 0-3 for memory at 4000-7FFF 4-5 PSLOT number 0-3 for memory at 8000-BFFF 6-7 PSLOT number 0-3 for memory at C000-FFFF |
Bit Name Expl. 0-7 KC0-7 Keyboard line status |
Bit Name Expl. 0-3 KB0-3 Keyboard line (0-8 on SV738 X'Press) 4 CASON Cassette motor relay (0=On, 1=Off) 5 CASW Cassette audio out (Pulse) 6 CAPS CAPS-LOCK lamp (0=On, 1=Off) 7 SOUND Keyboard klick bit (Pulse) |
Bit Name Expl. 0 B Set/reset the bit (0=Reset, 1=Set) 1-3 N0-N2 Bit number (0-7) 4-6 0 Not used 7 SF Must be "0" for bit set/reset function. |
Line Bit_7 Bit_6 Bit_5 Bit_4 Bit_3 Bit_2 Bit_1 Bit_0 0 "7" "6" "5" "4" "3" "2" "1" "0" 1 ";" "]" "[" "\" "=" "-" "9" "8" 2 "B" "A" ??? "/" "." "," "'" "`" 3 "J" "I" "H" "G" "F" "E" "D" "C" 4 "R" "Q" "P" "O" "N" "M" "L" "K" 5 "Z" "Y" "X" "W" "V" "U" "T" "S" 6 F3 F2 F1 CODE CAP GRAPH CTRL SHIFT 7 RET SEL BS STOP TAB ESC F5 F4 8 RIGHT DOWN UP LEFT DEL INS HOME SPACE ( 9 NUM4 NUM3 NUM2 NUM1 NUM0 NUM/ NUM+ NUM* ) ( 10 NUM. NUM, NUM- NUM9 NUM8 NUM7 NUM6 NUM5 ) |
Video Display Processor |
VDP I/O Ports |
Video Modes (Screens) |
M1 M2 M3 M4 M5 Screen format 1 0 0 0 0 Text 40x24 (BASIC SCREEN 0) 0 0 0 0 0 Half text 32x24 (BASIC SCREEN 1) 0 0 1 0 0 Hi resolution 256x192 (BASIC SCREEN 2) 0 1 0 0 0 Multicolour 4x4pix blocks (BASIC SCREEN 3) ----Below MSX2 only---- 0 0 0 1 0 Screen2 with 8 Sprites/Line (BASIC SCREEN 4) 0 0 1 1 0 256*212, 16 colours/pixel (BASIC SCREEN 5) 0 0 0 0 1 512*212, 4 colours/pixel (BASIC SCREEN 6) 0 0 1 0 1 512*212, 16 colours/pixel (BASIC SCREEN 7) 0 0 1 1 1 256*212, 256 colours/pixel (BASIC SCREEN 8) 1 0 0 1 0 Text 80x24 (BASIC SCREEN 0, WIDTH 80) |
0000-03BF BG Map 0800-0FFF BG Tiles |
0000-07FF BG Tiles 1800-1AFF BG Map 1B00-1B7F OBJ Attributes 2000-201F BG Colors 3800-3FFF OBJ Tiles |
0000-17FF BG Tiles 1800-1AFF BG Map 1B00-1B7F OBJ Attributes 2000-37FF BG Colors 3800-3FFF OBJ Tiles |
0000-07FF BG Tiles (block colors) 0800-0AFF BG Map 1B00-1B7F Sprite attribute table 3800-3FFF Sprite character patterns |
0000-17FF Charcter patterns 1800-1AFF Name table (char positions) 1C00-1DFF Sprite colours 1E00-1E7F Sprite attribute table 1E80-1E9F Palette 2000-37FF PixelByte colour table 3800-3FFF Sprite character patterns |
0000-69FF Matrix (Bitmap) 7400-75FF Sprite colours 7600-767F Sprite attribute table 7680-769F Palette 7800-7FFF Sprite character patterns |
0000-69FF Matrix (Bitmap) 7400-75FF Sprite colours 7600-767F Sprite attribute table 7680-769F Palette 7800-7FFF Sprite character patterns |
0000-D3FF Matrix (Bitmap) F000-F7FF Sprite character patterns F800-F9FF Sprite colours FA00-FA7F Sprite attribute table FA80-FA9F Palette |
0000-D3FF RGB Matrix (Bitmap) F000-F7FF Sprite character patterns F800-F9FF Sprite colours (See note I) FA00-FA7F Sprite attribute table FA80-FA9F Palette (Huh?) |
Bit 0-1 Blue, 0-3 Bit 2-4 Red, 0-7 Bit 5-7 Green, 0-7 |
0000-077F (086F) Name table (char positions) 0800-08EF (090D) Character attribute (Blink) 1000-17FF Character patterns (font) |
Foreground Sprites |
0: Y-pos, Vertical position (FFh is topmost, 00h is second line, etc.) 1: X-pos, Horizontal position (00h is leftmost) 2: Pattern number 3: Attributes. b0-3:Color, b4-6:unused, b7:EC (Early Clock) |
Bit 0-3 CL Color Code (0-15) Bit 4 0 Unused Bit 5 IC Ignore collisions with other sprites. (1=Ignore) Bit 6 CC Mix color with sprite that has next higher priority. Bit 7 EC Early clock (shift this line of the sprite 32 pixels to left) |
Bit 0 Blue (1=on, 0=off) Bit 1 Red (1=on, 0=off) Bit 2 Green (1=on, 0=off) Bit 3 Intensity (1=Light, 0=dark) |
VRAM Data Read/Write |
Byte 1/Bit 0-7 Lower bits of VRAM Pointer Byte 2/Bit 0-5 Upper bits of VRAM Pointer Byte 2/Bit 6 Desired VRAM Direction (0=Reading, 1=Writing) Byte 2/Bit 7 Must be "0" for VRAM Pointer setup |
VDP Status Registers |
Bit Name Expl. 0-4 5/9th Number for the 5th sprite (9th in screen 4-8) on a line 5 C 1 if overlapping sprites 6 5D 1 if more than 4 sprites on a horizontal line (8 in screen 4-8) 7 F V-Blank IRQ Flag (1=interrupt) (See also IE0 flag) |
Bit Name Expl. 0 FH Horizontal Retrace IRQ Flag (See also: VDP Reg 13h and IE1 flag) 1-5 ID# VDP Type (0=V9938/MSX2, 2=V9958/MSX2+ and Turbo R, 1=V9948?!) 6 LPS Light Pen ??? (MSX2 only, Not MSX2+) 7 FL Light Pen and/or Mouse ??? (MSX2 only, Not MSX2+) |
Bit Name Expl. 0 CE Command Execute (0=Finished, 1=VDP Command still executing) 1 EO Display field flag (??) (0=display first field) 2-3 0 Not Used 4 BO Search Command Result (0=Not found, 1=Found) 5 HR Horizontal Retrace Flag (1=HBlank) 6 VR Vertical Retrace Flag (1=VBlank) 7 TR Data Ready (For CPU <--> VRAM Commands) (0=Not Ready, 1=Ready) |
Bit 0-7 Color Code |
VDP Register Write |
Byte 1, Bit 0-7 Data (New value for the register) Byte 2, Bit 0-6 Index (VDP register number) (MSX1: 0-7, MSX2: 0-2E) Byte 2, Bit 7 Must be "1" for VDP Register setup |
Byte 1, Bit 0-2 Blue data (0-7) Byte 1, Bit 4-6 Red data (0-7) Byte 2, Bit 0-2 Green data (0-7) Byte 1, Bit 3,7 Always 0 (no effect) Byte 2, Bit 3-7 Always 0 (no effect) |
VDP Registers 00h-07h: Basic MSX1/MSX2 Video Registers |
Bit Name Expl. 0 D External video input (0=input disable, 1=enable) 1 M3 Mode M3 (Screen 2,5,7,8) 2 M4 Mode M4 (Screen 4,5,8,0Hi) (MSX2 only) 3 M5 Mode M5 (Screen 6,7,8) (MSX2 only) 4 IE1 H-Blank Interrupt Enable (MSX2 only) (see also VDP Reg 13h) 5 IE2 Light pen/mouse on ??? (MSX2 ONLY not MSX2+) 6 DG DiGitize mode (MSX2 only) 7 0 Not Used |
Bit Name Expl. 0 MAG Sprite zoom (0=x1, 1=x2) 1 SZ Sprite size (0=8x8, 1=16x16) 2 0 Not Used 3 M2 Mode M2 (Screen 3: Block) 4 M1 Mode M1 (Screen 0: Text) 5 IE0 V-Blank Interrupt Enable (0=Disable, 1=Enable) 6 BLK Screen output control (0=Disable, 1=Enable) 7 416 VRAM size control (0=4K, 1=16K) (No Function on MSX) |
Bit 7 6 5 4 3 2 1 0 Name 0 A16 A15 A14 A13 A12 A11 A10 |
Bit 7 6 5 4 3 2 1 0 Name A13 A12 A11 A10 A09 A08 A07 A06 |
Bit 7 6 5 4 3 2 1 0 Name 0 0 A16 A15 A14 A13 A12 A11 |
Bit 7 6 5 4 3 2 1 0 Name A14 A13 A12 A11 A10 A09 A08 A07 |
Bit 7 6 5 4 3 2 1 0 Name 0 0 A16 A15 A14 A13 A12 A11 |
Bit Name Expl. 0-3 TC0-3 Background colour in SCREEN 0 (also border colour in SCREEN 1-3) 4-7 BD0-3 Foreground colour in SCREEN 0 |
0 = Transparent 8 = Medium red 1 = Black 9 = Light red 2 = Medium green 10= Dark yellow 3 = Light green 11= Light yellow 4 = Dark blue 12= Dark green 5 = Light blue 13= Magenta 6 = Dark red 14= Gray 7 = Cyan 15= White |
Bit Name Expl. 0-1 Background color A 2-3 Background color B 4 Enable Background color B (0=Use color A only, 1=use both) |
VDP Registers 08h-17h: Additional MSX2 Video Registers |
Bit Name Expl. 0 BW 32 Greylevel MVDPmode out through CompositeVideo output. (Normally composite video and RGB are not generated from this output but from another on the MVDP). 1 SP Disable OBJ Sprites (0=On, 1=Disable) 2-3 VRS VRAM size and speed (0=1*16KB,1=4*16KB,2=1*64KB,3=64KB/HighSpeed) 4 CB colour Bus direction (0=Output, 1=Input) 5 TP Transparent from palette (0=Normal, 1=Color 0 is solid) 6 LCS Lightpen Select (active 1) connected through colourbus (not MSX2+) 7 MSE Mouse select (active 1) connected through colourbus (not MSX2+) |
Bit Name Expl. 0 DC Dot Clock Direction (0=Output, 1=Input) (V9958.TXT) 1 NT NTSC (0=NTSC/60Hz, 1=PAL/50Hz) 2 EO Even Odd Display (0=Normal, 1=Two screen) 3 IL Interlace (0=Off, 1=On) 4-5 S# Simultaneus mode (0=Intern, 1=Mix, 2=Extern/Digitize) 6 0 Always 0 7 LN Vertical heigth (pixels) (0=192, 1=212) |
Bit 7 6 5 4 3 2 1 0 Name 0 0 0 0 0 A16 A15 A14 |
Bit 7 6 5 4 3 2 1 0 Name 0 0 0 0 0 0 A16 A15 |
Bit Name Expl. 0-3 BC0-3 Inverse/Blink text background colour 4-7 T20-3 Inverse/Blink text forground colour |
Bit Name Expl. 0-3 OF0-3 Off blink time (1/5 sec) 4-7 ON0-3 On blink time (1/5 sec) |
Bit 7 6 5 4 3 2 1 0 Name 0 0 0 0 0 A16 A15 A14 |
Bit Name Expl. 0-3 S0-3 Status register number (0-9) 4-7 0 Always 0 |
Bit Name Expl. 0-3 C0-3 colour palette register number (0-15 for colour 0-15) to receive data from port 09Ah 4-7 0 Always 0 |
Bit Name Expl. 0-5 R0-5 VDP Register Index (for writing data to Port 9Bh) 6 0 Always 0 7 AII Auto increment VDP index (0=on, 1=off) |
Bit Name Expl. 0-3 H0-3 Horizontal adjust (0-0Fh, +-8 pixels) 4-7 V0-3 Vertical adjust (0-0Fh, +-8 pixels) |
Bit Name Expl. 0-7 IL0-7 Interrupt line (0-255 in 50 Hz mode) |
Bit Name Expl. 0-7 DO0-7 Display offset Y (0-255). |
VDP Registers 18h-1Fh: MSX2+/turbo R Video Registers |
Bit Name Expl. 0 SP2 H-Scroll Screen Width (0=One page, 1=Two pages) 1 MSK H-Scroll Mask 8 Pixels (0=Normal, 1=Hide Leftmost Pixels) 2 WTE VRAM Access Waitstates (0=Normal, 1=Enable CPU Waitstate) 3 YJK YJK Mode Enable (0=Normal RGB, 1=YJK System) 4 YAE YJK Attribute Enable (0=No Attribute, 1=With Attribute) 5 VDS Pin 8 Output selection (0=Output CPUCLK, 1=Output /VDS) 6 CMD Video Command Mode (0=Normal, 1=Screen 2-4 as screen 8) 7 0 Not Used |
Bit 7 6 5 4 3 2 1 0 Name 0 0 HO8 HO7 HO6 HO5 HO4 HO3 |
Bit 7 6 5 4 3 2 1 0 Name 0 0 0 0 0 HO2 HO1 HO0 |
Bit Dot 0 Dot 1 Dot 2 Dot 3 0-2 KL KH JL JH Shared J and K values for all dots 3-7 Y1 Y2 Y3 Y4 Separate Y values for each dot |
Bit Dot 0 Dot 1 Dot 2 Dot 3 0-2 KL KH JL JH Shared J and K values for all dots 3 A A A A Attribute for each dot 4-7 Y1 Y2 Y3 Y4 Separate Y values for each dot |
RGB to YJK: J=R-Y, K=G-Y, Y=B/2+R/4+G/8 YJK to RGB: R=Y+J, G=Y+K, B=Y*5/4-J/2-K/4 |
VDP Registers 20h-2Eh: MSX2 Video Command Registers |
Bit Name Expl. 0-7 CL Color Code |
Bit Name Expl. 0 MAJ Longest side (Line command) (0=Normal, 1=Exchange X/Y-Len) 1 EQ Equal (For Search command) (0=Repeat until equal, 1=not equal) 2 DIX X step direction (0=right, 1=left) 3 DIY Y step direction (0=down, 1=up) 4 MXS Source external memory (0=128K VRAM, 1=64K external) 5 MXD Destination external memory (0=128K VRAM, 1=64K external) 6 MXC CPU Access external memory (0=128K VRAM, 1=64K external) 7 0 Always 0 |
Bit Name Expl. 0-2 AR0-2 Logical argument, see below. ignored by highspeed commands 3 TRN Transparent (1=Transparent Color 0) ignored by highspeed commands 4-7 C0-3 Command, see below. |
Value: Expl.: 0 Stop 4 Get Pixel, VRAM -> VDP 5 Put Pixel, VDP -> VRAM 6 Search Pixel, VRAM -> VRAM 7 Draw Line, VDP -> VRAM 8 Logical Fill Rectangle, VDP -> VRAM 9 Logical Copy Rectangle, VRAM -> VRAM A Logical Get Pixels, VRAM -> CPU B Logical Put Pixels, CPU -> VRAM C Highspeed Fill Rectangle, VDP -> VRAM D Highspeed Copy Rectangle, VRAM -> VRAM E Highspeed Copy Vertically, VRAM -> VRAM F Highspeed Put Bytes, CPU -> VRAM |
Value: Name: Expl.: 0 PSET Set bits, set old bits to 0 1 AND Mask bits 2 OR Set bits, include old 3 XOR Swap new bits 4 NOT Set new bits to 0 |
Display Timings |
Scanline Time : 227.75 cycles Scanline Rate : 15716.99 Hz |
Frame Height : 313 scanlines Frame Time : 71285.75 cycles Exact Frame Rate : 50.214 Hz Possible HBL IRQs: Line 00-FF (either 192/212 pix mode) |
Frame Height : 262 scanlines Frame Time : 59670.5 cycles Exact Frame Rate : 59.9885 Hz Possible HBL IRQs: Line 00-EA (192 pix mode), 00-F4 (212 pix mode) |
VDP Interrupts |
Sound Generator |
F = 3.579545MHz / 32 / nn ;with nn in range 0..4095 |
F = 3.579545MHz / 32 / nn ;with nn in range 0..31 |
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) |
F = 3.579545MHz / 32 / nn ;with nn in range 0..65535 |
T = nn*512 / 3.579545MHz ;with nn in range 0..65535 (0-9.37 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 |
Bit Expl. 0 Joystick Up (0=Moved, 1=Not moved) 1 Joystick Down (0=Moved, 1=Not moved) 2 Joystick Left (0=Moved, 1=Not moved) 3 Joystick Right (0=Moved, 1=Not moved) 4 Joystick button A (0=Pressed, 1=Not pressed) 5 Joystick button B (0=Pressed, 1=Not pressed) 6 Keyboard Switch (Japanese SVI machines only ?) 7 Cassette input |
Bit Expl. 0 1 (Used as handshaking output if touchpad) 1 1 (Used as handshaking output if touchpad) 2 1 (Used as handshaking output if touchpad) 3 1 (Used as handshaking output if touchpad) 4 Pulse 1 (Positive pulse starting a monostable timer) 5 Pulse 2 (Positive pulse starting a monostable timer) 6 Joystick select (0=Connector 1, 1=Connector 2) 7 LED Code LED, if any (0=On, 1=Off) |
Cartridge Memory Mappers |
Memory Content (not mappable) 0000-3FFF sometimes mirror of 1st 16KB of ROM 4000-7FFF 1st 16KB of ROM 8000-BFFF 2nd 16KB of ROM (eventually 1st 16K if size less than 32K) |
Memory Mapper I/O Address 4000-5FFF fixed, always bank 0 6000-7FFF select bank by writing to 6000 8000-9FFF select bank by writing to 8000 A000-BFFF select bank by writing to A000 |
Memory Mapper I/O Address 4000-5FFF select bank by writing to 5000-57FF (5000 used) 6000-7FFF select bank by writing to 7000-77FF (7000 used) 8000-9FFF select bank by writing to 9000-97FF (9000 used) A000-BFFF select bank by writing to B000-B7FF (B000 used) |
Memory Mapper I/O Address 4000-5FFF select bank by writing to 6000-67FF (6000 used) 6000-7FFF select bank by writing to 6800-6FFF (6800 used) 8000-9FFF select bank by writing to 7000-77FF (7000 used) A000-BFFF select bank by writing to 7800-7FFF (7800 used) |
Memory Mapper I/O Address 4000-7FFF select bank by writing to 6000-67FF (or 6000-6FFF ?) (6000 used) 8000-BFFF select bank by writing to 7000-77FF (or 7000-7FFF ?) (7000 used) |
Floppy Disk Controller |
FDC I/O Addresses |
7FF8h R Status Register 7FF8h W Command Register 7FF9h R/W Track Register 7FFAh R/W Sector Register 7FFBh R/W Data Register 7FFCh R?/W Side (bit 0) Motor here? 7FFDh R ?? 7FFDh W Drive (bit 0) Motor here? 7FFEh - Unused 7FFFh R Data Request (bit 7), Busy (bit 6) |
7FB8h R Status Register 7FB8h W Command Register 7FB9h R/W Track Register 7FBAh R/W Sector Register 7FBBh R/W Data Register 7FBCh R IRQ/Not Busy (bit 7), Data Request (bit 6) 7FBCh W Select Drive 0/1 (bit 0/1), Side (bit 2), Motor (bit 3) 7FBDh-Fh - Unused |
D0h R Status Register D0h W Command Register D1h R/W Track Register D2h R/W Sector Register D3h R/W Data Register D4h W Drive (bit 1), Side (bit 4), Motor (bit ??) D4h R IRQ/Not Busy (bit 7), Data Request (bit 6) (V3.0 and up) D5h-D7h - Unused |
FDC Description |
Type Command b7 b6 b5 b4 b3 b2 b1 b0 I Restore 0 0 0 0 h V r1 r0 I Seek 0 0 0 1 h V r1 r0 I Step 0 0 1 T h V r1 r0 I Step-In 0 1 0 T h V r1 r0 I Step-Out 0 1 1 T h V r1 r0 II Read Sector 1 0 0 m S E C 0 II Write Sector 1 0 1 m S E C a0 III Read Address 1 1 0 0 0 E 0 0 III Read Track 1 1 1 0 0 E 0 0 III Write Track 1 1 1 1 0 E 0 0 IV Force Interrupt 1 1 0 1 i3 i2 i1 i0 |
r1,r0 Stepping Motor Rate (0: 6ms, 1: 12ms, 2: 20ms, 3: 30 ms) 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) 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 side compare, 1: enable side comp) 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) |
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 i0 1 = Not ready to ready transition |
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) 6 Protected (1=Disk write protected) 7 Not Ready (1=Drive not ready) |
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) |
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 |
.. x 4E |
Disk FAT Format |
00-02 jump to 80x86 boot procedure (not used for MSX, but see below) 03-0A ascii disk name 0B-0C bytes / sector 0D sectors / cluster 0E-0F sectors / boot-record 10 number of FAT-copys 11-12 entrys / root-directory 13-14 sectors / disk 15 ID: F8=hdd, F9=3.5", FC=SS/9sec, FD=DS9, FE=SS8,FF=DS8 16-17 sectors / FAT 18-19 sectors / track 1A-1B heads / disk 1C-1D number of reserved sectors 1E-1FF MSX boot procedure (loaded to address C01Eh in RAM) |
(0)000 unused, free (0)001 ??? (0)002... pointer to next cluster in chain (0)002..(F)FEF (F)FF0-6 reserved (no part of chain, not free) (F)FF7 defect cluster, don't use (F)FF8-F last cluster of chain |
00-07 Filename (first byte: 00=free entry,2E=dir, E5=deleted entry) 08-0A Filename extension 0B Fileattribute 0C-15 reserved 16-17 Timestamp: HHHHHMMM, MMMSSSSS 18-19 Datestamp: YYYYYYYM, MMMTTTTT 1A-1B Pointer to first cluster of file 1C-1F Filesize in bytes |
Real Time Clock |
Bit Name Expl. 0-3 ? RTC register (0-15) 4-7 0 Not used |
Bit Name Expl. 0-3 ? RTC data read/write 4-7 0 Not used |
Block 0 Block 1 Block 2 Block 3 Index (BCD Timer) (BCD Alarm) (Screen) (Ascii) ----- ------------ ------------ ------------ ------------ 0 Seconds, low --- Scratch Type 1 Seconds, hi --- X-Adjust Char 1, low 2 Minutes, low Minutes, low Y-Adjust Char 1, hi 3 Minutes, hi Minutes, hi Screen Char 2, low 4 Hours, low Hours, low Width, low Char 2, hi 5 Hours, hi Hours, hi Width, hi Char 3, low 6 Day of Week Day of Week Color, Text Char 3, hi 7 Day, low Day, low Color, BG Char 4, low 8 Day, hi Day, hi Color, Border Char 4, hi 9 Month, low --- Cas/Prn/Key Char 5, low A Month, hi 12/24 hours Beep Frq/Vol Char 5, hi B Year, low Leap Year Color, Title Char 6, low C Year, hi --- Native Code? Char 6, hi D Mode Register (Read/Write) E Test Register (Write Only) F Reset Register (Write Only) |
Bit Name Expl. 0-1 M0-1 Select Block (0-3) 2 AE Alarm enable (0=Disable, 1=Enable) (not used in MSX) 3 TE Enable Seconds (0=Freeze, 1=Active) |
Bit Name Expl. 0 T0 Increment Seconds at a rate of 16384Hz 1 T1 Increment Minutes "" 2 T2 Increment Hours "" 3 T3 Increment Days "" |
Bit Name Expl. 0 AR Reset all Alarm Registers to zero (1=Reset) 1 CR Reset fractions smaller than 1 second (1=Reset) 2 C16 Enable 16Hz clock output (0=Enable?) 3 C1 Enable 1Hz clock output (0=Enable) |
RS 232 Interface |
ACIA Data, Status, Mode, Command |
Bit Name Desc. 0 TxRDY Transmit Ready 1 RxRDY Receive Ready (1=Received byte may be read from Port 80h) 2 TxEMPTY Transmit buffer Empty 3 PE Parity Error if 1 4 OE Overrun Error if 1 (CPU has not received character) 5 FE Framing Error if 1 (ASYNC only, STOP BIT not valid) 6 SYNDET/BRKDET SYNC/BREAK found 7 DSR Data Set Ready |
Bit Name Expl. 0-1 BAUDFACT Baud Fact (0=Sync Mode, 1=1.8432MHz, 2=115.2kHz, 3=28.8kHz) 2-3 WORD Number of Data Bits (0=5bits, 1=6bits, 2=7bits, 3=8bits) 4 PAREN Parity Bit Enable (0=No Parity Bit, 1=One Parity Bit) 5 PARITY Parity Generation/Check (0=Odd, 1=Even) 6-7 STOP Number of Stop Bits (0=Invalid, 1=1bit, 2=1.5bits, 3=2bits) |
Bit Name Expl. 0 TX Transmit Enable (0=Disable, 1=Enable) 1 DTR Set Data Terminal Ready (0=No, 1=Ready) 2 RX Receive Enable (0=Disable, 1=Enable) 3 BRK Break Operation (0=No, 1=Send Break (TxD=Low)) 4 ERR_RES Reset Error Flags (0=No, 1=Reset Error Flags PE,OE,FE) 5 RTS Set Request to Send (0=No, 1=Request to Send) 6 RESET Internal Reset (0=No, 1=Reset and wait for MODE SETUP) 7 HUNT Enter Hunt Mode (0=No, 1=Search for SYNC character) |
Status, Interrupt Mask |
Bit Name Expl. 0 CD Carrier Detect (0=Active, 1=Not active) 1 RI Ring Indicator (0=Active, 1=Not active) (N/C in MSX) 6 Timer Output from i8253 Counter 2 7 CTS Clear to Send (0=Active, 1=Not active) |
Bit Expl. 0 Receive data ready (0=Enable Interrupt, 1=Disable) 1 Transmit data ready (0=Enable Interrupt, 1=Disable) (N/C in MSX) 2 Sync/Break found (0=Enable Interrupt, 1=Disable) (N/C in MSX) 3 i8253 channel 2 Timer (0=Enable Interrupt, 1=Disable) (N/C in MSX) |
8253 Baud Rate Generator |
Bit Expl. 0 Counter Format (0=Binary, 1=BCD) 1-3 Counter Mode (See below) (6,7=Reserved) 4-5 Prepare Read/Write (See below) 6-7 Index (Counter 0-2) (3=Reserved) |
0 = Interrupt Generator 3 = Square Wave Generator 1 = Programmable Monoflop 4 = Trigger Output by Software 2 = Clock Pulse Generator 5 = Trigger Output by Hardware |
0 = Latch Counter for Reading 2 = Load high byte 1 = Load low byte 3 = Load low and high byte |
Kanji ROM |
Special I/O Registers |
Bit Expl. 0 Kanji ROM Class 1 1 Kanji ROM Class 2 (?) 2 MSX-AUDIO 3 Superimpose 4 MSX interface 5 RS-232C 6 Lightpen 7 CLOCK-IC (only on MSX2) |
Bit R/W Expl. 0 W Audio R (mixing ON) 1 W Audio L (mixing OFF) 2 W Select video input (21p RGB) 3 -R- Detect video input (no input) 4 W AV control (TV) 5 W Ym control (TV) 6 W Inverse of bit 4 of VDP register 9 7 W Inverse of bit 5 of VDP register 9 |
Z80 CPU Specifications |
Z80 Usage in MSX Models |
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 8bit 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 ------ |
Z80 16bit Load Commands |
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 |
Z80 Blocktransfer- and Searchcommands |
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 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 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 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 8bit 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 |
Z80 16bit Arithmetic Commands |
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 |
Z80 Rotate and Shift Commands |
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) |
Z80 Singlebit Operations and CPU-Control Commands |
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 nop 00 4 ------ no operation halt 76 4 ------ repeat until interrupt occurs di F3 4 ------ iff=0 ;disable interrupts ei FB 4 ------ iff=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. |
Z80 Jumpcommands |
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 reti ED 4D 14 ------ pop PC, IFF2=IFF1 (ret from INT) retn ED 45 14 ------ pop PC, IFF2=IFF1 (ret from NMI) rst n xx 11 ------ call n ;n=00,08,10,18,20,28,30,38 |
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 |
Mode Cycles Refresh Operation 0 1+var 0+var IFF=0, read and execute opcode from databus 1 12 1 IFF=0, CALL 0038h 2 18 1 IFF=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 |
Different MSX Models |
External Connectors |
1 Out /CS1 ROM addresses 4000-7FFF select signal 2 Out /CS2 ROM addresses 8000-BFFF select signal 3 Out /CS12 ROM addresses 4000-BFFF select signal 4 Out /SLTSL Slot select signal 5 - Reserved Reserved, don't use 6 Out /RFSH Refresh cycle signal 7 In /WAIT CPU's WAIT request signal 8 In /INT Interrupt request signal to CPU 9 Out /M1 Signal expressing CPU fetch cycle 10 In /BUSDIR External data bus buffer direction 11 Out /IORQ I/O request signal 12 Out /MERQ Memory request signal 13 Out /WR Write timing signal 14 Out /RD Read timing signal 15 Out /RESET System reset signal 16 - Reserved Reserved, don't use 17-32 Out Ax Address bus (A9,15,11,10,7,6,12,8,14,13,1,0,3,2,5,4) 33-40 I/O Dx Data bus (D1,D0,D3,D2,D5,D4,D7,D6) 41 - GND Ground 42 Out CLOCK CPU clock 3.579545MHz 43 - GND Ground 44 - SW1 For insertion/removal protect 45 - +5V +5V power source 46 - SW2 For insertion/removal protect 47 - +5V +5V power source 48 - +12V +12V power source 49 In SOUNDIN Sound input signal (-5bdm) 50 - -12V -12V power source |
1-3 GND 4 Out Data Output (Record) 5 In Data Input (Play) 6 Out Remote+ 7 Out Remote- 8 GND |
1 In Up 2 In Down 3 In Left 4 In Right 5 +5V 6 I/O Trigger 1 7 I/O Trigger 2 8 Out /Select 9 GND |
1 Out /Strobe 2-9 Out D0-D7 10 N/C N/C 11 In Busy 12-14 N/C NC |
Pin PAL-version RGB-version (french only) 1 - +5V Out Status RGB 2 - GND - GND 3 Out Audio Out Blue 4 Out Luminance Out Luminance 5 Out Video Out Red 6 - +12V - +12V 7 N/C Not Used Out Sound 8 N/C Not Used Out Green |
1 Out Audio Out, right 2 N/C Audio In, right 3 Out Audio Out, left 4 Audio GND 5 Blue GND 6 N/C Audio In, left 7 Out Blue Out 8 Out Status CVBS 9 Green GND 10 N/C NC 11 Out Green Out 12 N/C NC 13 Red GND 14 GND 15 Out Red Out 16 Out Status RGB 17 CVBS GND 18 RBG Status GND 19 Out CVBS Out 20 N/C CVBS In 21 Socket GND (Shield) |
4 /In Use Pin 20 /Step 6 /Drive Select 3 Pin 22 /Write Data 8 /Index Pin 24 /Write Gate 10 /Drive Select 0 Pin 26 /Track 00 12 /Drive Select 1 Pin 28 /Write Protect 14 /Drive Select 2 Pin 30 /Read Data 16 /Motor On Pin 32 /(Head Select) 18 /Direction Pin 34 /Ready |
1 N/C (middle) 2 GND (upper left) 3 +12V (lower left) 4 +5V (lower right) 5 -12V (upper right) |
Data Structures and Formats |
Disk Images |
Disk FAT Format (alias) |
Disk File Formats |
1 byte File type (FEh=binary) 2 bytes Load Address (Destination Address for Data in RAM) 2 bytes Last Address (Load Address + Data Length - 1) 2 bytes Start Address (Used if started as BLOAD"FILE",R) |
Cassette File Formats |
1E00h "1"-bits synchronisation bits 10 bytes file type (repeated 10 times the same value) 6 bytes file name (unused entries filled by SPCs) |
780h "1"-bits synchronisation bits <nn> lines data, format for each line as follows: 2 bytes origin of next line (lower byte first) <xx> bytes data (xx = nextlineorg-currentlineorg-2) 2 bytes 0000h zero origin, no further lines following 7-8 bytes terminator, seven or eight 00h bytes |
780h "1"-bits synchronisation bits 2 bytes load address (lower byte first) 2 bytes end address ("") 2 bytes start address ("") <len> bytes data (length = endadr-loadadr+1) |
780h "1"-bits synchronisation bits 100h bytes data (ended by EOF/1Ah, unused bytes filled up by 1Ah) |
1 start bit ("0") 8 data bits (lower bit first) 1 first stop bit ("1") 1 second stop bit ("1") (but might be unreadable if short delay follows) |
"0" = \_______/"""""""\ "1" = \___/"""\___/"""\ |
ROM Headers |
Address Name Expl. X000 ID Identification Code (4241h=ROM Cartridge, 4443h=SUBROM) X002 INIT Start Address (could be anywhere 0000-BFFF) X004 Statement Statement expansion routine address. For creating new CALL statement (For example CALL MUSIC used in FM PAC) X006 DEV For creating new devices (CAS:, MEM:, GRP:, etc...) X008 TEXT Pointer to BASIC program in ROM, must be in 8000-BFFF. X00A-F N/A Reserved (0) |
Other DOCs |
END |