Connecting a 3.5" serial port

ZXNet echo conference «hardware.zx»

From Kirill Frolov To All 27 November 2002

================================================================================ * Forwarded by Kirill Frolov (500:812/1.507) * Area : NETMAIL (My soap) * From : Kirill Frolov, 2:5030/827.2 (27 Nov 02 22:11) *To: Yuri Potapov * Subj : 3.5" drive connection ================================================================================ Press RESET immediately, Yuri! 26 Nov 02 21:11, Yuri Potapov wrote to Kirill Frolov: YP> in this case I have this idea YP> on one side there is a green ZS Scorpion, there is no confusion YP> on the other hand, not a very sophisticated PC running Linux YP> most likely, the PC will have a CD, 1.44 drive, screw, modem YP> but in general it should act as a server from/where I will download YP> files YP> modem emulation is not needed YP> much of what I will transmit should go as commands YP>console YP> the spec will have to play the role of a client, including how I do YP> explained that it is possible to surf the Internet via Linux using YP> regular terminal That is, you need either a network (telnet, ssh...), which does not exist, or a connectionvia serial port (Spectrum terminal emulation). Usually remote control of a machine via a unix terminal is only possible via a network or serial interface (modem). YP> and this will already be more promising than trying to write in Spec now YP> browser and tcp/ip and so on Well, it’s for such purposes, IMHO, that you need to write. Only with a view to using the resources of a pussy that is not in the next room, but accessible via the Internet. For example, try telneting cyberspace.org - you can get account on a machine running SunOS and use it to access other network information resources. There is no network on the Spectrum yet, well, at least there is definitely no telnet there. Therefore, there are two options left for you: ZX <- serial interface -> PC. The role of a “serial interface” can be either a cable or a pair modems. If you already have an ISA modem installed on your Spectrum, then just connect you will receive a multicard from the PC and you will receive a serial port. If you need parallel and modem, or do you need several serial ports then you will have to think about upgrading the modem connection circuit. If the modem is on Spectrum is not available, that is, there are 2 options: through a multicard (for example, by Kondratiev scheme) and through software emulation of asynchronousSpectrum serial interface. In case of software emulation it is not necessary The piss multicard is already in short supply. The "minimal" null modem cable for connecting two computers contains just three wires: ZX PC ----------------- ----------------- signal DB9S DB25S signal DB9S DB25S TD 3 2 <----------> RD 2 3 RD 2 3 <-----------> TD 3 2 GROUND 5 7 <-----------> GROUND 5 7 Columns DB9S and DB25S indicate the pin numbers on the corresponding connectors. There are several standard connectors for this interface, and most popular ones are DB9S and DB25S (the letter S means Socket, that is, a socket. This connectors with “holes” on the cable and with “pins” on the computer). In modern IBM PC computers usually use DB9. The minimum cable version has some disadvantages, in particular it provides only software flow control, which is completely unsuitable for use in the case of software emulation of a serial interface on Spectrum (Spectrum can only receive data in a port polling cycle, but when in the absence of other signal wires, he cannot in any way communicate to another whether the computer is ready to receive it or not). In case of hardware implementationinterface on the Spectrum, the use of a 3-wire cable is also undesirable, since it is difficult for Spectrum with its slowness to guarantee timely extracting received data from the receiver buffer. Mentioned disadvantage There is no 3-wire cable in the 4-wire or 5-wire interface, where hardware flow control is used: ZX PC ----------------- ----------------- signal DB9S DB25S signal DB9S DB25S TD 3 2 <----------> RD 2 3 RD 2 3 <-----------> TD 3 2 RTS 7 4 <-----------> CTS 8 5 * CTS 8 5 <--(*)------> * RTS 7 4 GROUND 5 7 <-----------> GROUND 5 7 The signal marked with an asterisk '*' in the case of a 4-wire interface may not be be used, but its non-use is undesirable: this signal provides protection against overflow of the receiver buffer in the PC, just like a signal does RTS for Spectrum. 5-wire interface provides a complete full-duplex transmission channel information with hardware flow control. But if it is necessary to transmit some control information outside the transmission channel, for example ready/unready, reset/handshake, as often used in modems, then you need a full-fledged interface consisting of 9 wires:ZX PC ----------------- ----------------- signal DB9S DB25S signal DB9S DB25S TD 3 2 <----------> RD 2 3 RD 2 3 <-----------> TD 3 2 RTS 7 4 <-----------> CTS 8 5 CTS 8 5 <-----------> RTS 7 4 DTR 4 20 <--------+--> DSR 6 6 DSR 6 6 <--+-----)--> DTR 4 20 * DCD 1 8 <--+ +--> DCD 1 8 * RI 9 22 RI 9 22 GROUND 5 7 <-----------> GROUND 5 7 Signals marked with asterisks ('*') RI and DCD are used only in modems. RI is an input at the terminal (computer) indicating the arrival of a call, DCD signals the establishment of communication (presence of carrier). In this case, RI is not is used, and the DCD is connected to the DTR signal from the remote side, which provides "carrier appearance" when signaling the readiness of the remote side. This was the wiring of a full-fledged null modem cable. She doesn't coincides with the wiring of a regular modem cable! In your case, I would use a 5-wire interface. As cable, if it is impossible to get it ready-made, it is better to take a modem cable and make a special adapter. I do not recommend making a cable yourself, it’s better to take a ready-made one.In a modem cable, all signals are connected one to one, and in a null modem reception and transmission signals, RTS-CTS, DTR-DSR are swapped. Below is complete pinout of the serial interface. There are several standards here we mean the RS-232C interface, used in most personal computers. Designation Connector contact Direction RS232 DB9 DB25 output PG - 1 - protective ground (protect ground) TD 3 2 output data transmission (transmit data) RD 2 3 input data reception (receive data) RTS 7 4 output request transfer (request to send) data CTS 8 5 input ready for (clear to send) data reception DSR 6 6 input ready (data set ready) devices data transmission SG 5 7 - signal (signal ground) common wire DCD 1 8 input detection (data carrier detected) carrier DTR 4 20 output ready (data terminal ready) terminalRI 9 22 input bell (ring indicator) Historically, although it no longer makes much sense, that all devices using the RS-232C interface are divided into 2 types: devices data transmission (DCE == Data Connection Equipment, e.g. modems) and final equipment, terminals (DTE == Data Terminal Equipment, for example, when When connecting a modem to a computer, the computer plays the role of a terminal). In fact both devices are equivalent, but from this division they are designated differently signals: DTR or DSR, RTS or CTS... and there is a little confusion. So here it is the above table refers to DTE devices, that is, terminals (computers). The pin numbers for DTE devices are correct, but for DCE devices (modems) must be swapped TD and RD, CTS and RTS, DSR and DTR. Hence, by the way, the difference between “straight” modem cables and “twisted” ones null modem. And besides, in the table above there are only signals used in the IBM-PC and most other computers. Full version interface defines a larger number of signals on the DB25 connector. When connecting an ISA multicard from an IBM-PC computer, problems may arise. problems with connecting the remote connector cable ("miscarriage") to the multicard. The fact is that there are several different options for pinout of contacts onmultimap. Here are the main ones: Contact on the multicard Contact on the connector Var.1 Var.2 Var.3 Var.4 DB9 DB25 (10) (10) (10) 1 - 1 3 5 3 3 3 2 2 3 4 5 2 3 7 4 8 7 7 4 8 6 7 9 8 5 6 2 9 11 6 6 5 9 1 13 5 7 1 1 5 15 1 8 4 7 2 14 4 20 9 8 6 18 9 22 Version 1 8-bit multicard loop Ver.2 loop of 16-bit multicards Version 3 cable for ports integrated on the motherboard Version 4 wide cable to 25-pin connector From everything written about how a multicard is connected, for example, by Kondratiev's scheme should already be clear. Naturally, the ISA slot should 3 voltages are supplied: -12 volts, +12 volts, and +5 volts. Herself The Kondratiev diagram for connecting an ISA modem (multi-card) to the Spectrum is here: Original Kondratieff adapter circuit for connection internal modem. DD1 __ +---+ RD -----------------+1 | _____ | +------- IORD# (modem) +---+ | DD1 | +---+ +---+ | A4 ----+1 | | ____ | +----+ IORQ --+ | | +---+ | DD1 | +---+ +---+1 | _____ __ | +---+-- IOWR# (modem) WR -----------------+ | | +---+ | | +--------------------+ | | DD2 | +--------+ +5v - | ---o R | | | Q +-----+ +----/ C | | | | | A11 --------> D _ | | _____ | Q O-- | RESET --+---o S | | | +--------+ | | | | DD3 | | +---+ | | |1 | | +----+ O--------------- RESET (modem) | | | +---+ | | | | | DD1 DD3 | +---+ +---+ +--+1 | --- |1 | | +------ NMI (modem) IRQ4 ----+ O---------+ | | | +---+ +---+ A8 ------------------- A0 (modem) A9 ------------------- A1 (modem) A10 ------------------- A2 (modem) D0..D7 ---------------- D0..D7 (modem) +5v -------------------- A3..A10 (modem) GND -------------------- AEN (modem) List of elements: DD1 1533LL1 DD2 1533TM2 DD3 1533ЛH1 Signals marked in brackets "(modem)" are connected to corresponding pins of the ISA slot for the modem, the rest the signals are connected directly to the computer bus. Accessing modem registers via ports The modem registers are accessible through the microprocessor I/O ports. The address is calculated like this: 0xF0EF + (0x0800 if NMI interrupts are disabled) + (register_address*0x100) The interrupt enable trigger from the modem switches only when output to the modem ports. NOTE: Instead of non-maskable (NMI), you can use maskable (INT) interrupt. Not all programs support this yet, but THIS IS MORE CORRECT DECISION. THE USE OF NMI CAN POTENTIALLY RESULT IN STACK OVERFLOW AND DISRUPTION OF NORMAL OPERATION OF PROGRAMS. Just in case, I’m also bringing a modified one (so that it doesn’t work with the 7FFD port). conflicted) Shepelev’s scheme: Modified Shepelevsky scheme, supported in the Melon program. D0..D7 ----------------------- D0..D7 (modem) A8 -------------------------- A0 (modem) A9 -------------------------- A1 (modem) A10 -------------------------- A2 (modem) A11 -------------------------- A3 (modem) A12 -------------------------- A8 (modem) A13 -------------------------- A9 (modem)+5v ---------------------- A4 (modem) +5v ---------------------- A5 (modem) GND ----------------------- AEN (modem) +---+ A14 --------+ 1 | | +---+ A15 --------+ | | +---+ | DD1.1 | +---+ +--+ 1 | | o----+---- A7 (modem) A6 ---------------------+ | | +---+ +---- A6 (modem) DD2.1 ____ +---+ IORQ ----+---+ 1 | __ | | +----------- IORD# (modem) RD -----(---+ | | +---+ | DD1.2 | +---+ +---+ 1 | __ | +----------- IOWR# (modem) WR ---------+ | +---+ DD1.3 +---+ GND -----+ 1 | _____ | o----------RESET (modem) RESET -------+ | +---+ DD2.2 Read more: DD1 1533ЛЛ1 DD2 1533ЛЕ1 Read the story of the story The story of the story of the story of the story микропроцессора, Read more about the article: 0x38BF + адрес_регистра_модема In the end the story was written. использование прерыванийfrom the modem, but this feature can be added by connecting one of the outputs modem interrupts via an inverter with an "open collector" output (chip 555ЛH2) with an INT signal (maskable interrupt) on the bus ZX-Spectrum. An NPN bipolar transistor can act as an inertor (for example KT315) in the corresponding connection circuit. The above schemes have some disadvantages. For example, they most likely will not work if you connect the modem and computer with long (>10cm) wires. The whole problem here is excessive inductance of conductors. If the modem does not work, you can try passing signals A8,A9,A10,IOWR and IORD through the trigger Schmidt installed in close proximity to the ISA slot or through resistors with a resistance of 30-50 ohms. Pin assignments of the short (8-bit) ISA slot: +---------+---------------+-----------------+---------+ | contact | signal | signal | contact | +-+-----+-+---------------+-----------------+-+-----+-+ | A1 | IOCHK | GND | B1 | +-----+-----------------+-------------------+-----+ | A2 | D7 | RESET | B2 | +-----+-----------------+-------------------+-----+ | A3 | D6 | +5v | B3 | +-----+-----------------+-------------------+-----+ | A4 | D5 | IRQ2/9 (*) | B4 | +-----+-----------------+-------------------+-----+ | A5 | D4 | -5v | B5 | +-----+-----------------+-------------------+-----+ | A6 | D3 | DRQ2 | B6 | +-----+-----------------+-------------------+-----+ | A7 | D2 | -12v | B7 | +-----+-----------------+-------------------+-----+ | A8 | D1 | OWS2# | B8 | +-----+-----------------+-------------------+-----+ | A9 | D0 | +12v | B9 | +-----+-----------------+-------------------+-----+ | A10 | IOCHDRY | GND | B10 | +-----+-----------------+-------------------+-----+ | A11 | AEN | SmemWR# | B11 | +-----+-----------------+-------------------+-----+ | A12 | A19 | SmemRD# | B12 | +-----+-----------------+-------------------+-----+ | A13 | A18 | IOWR# | B13 | +-----+-----------------+-------------------+-----+ | A14 | A17 | IORD# | B14 | +-----+-----------------+-------------------+-----+ | A15 | A16 | DACK3# | B15 | +-----+-----------------+-------------------+-----+ | A16 | A15 | DRQ3 | B16 | +-----+-----------------+-------------------+-----+ | A17 | A14 | DACK1# | B17 | +-----+-----------------+-------------------+-----+ | A18 | A13 | DRQ1 | B18 | +-----+-----------------+-------------------+-----+ | A19 | A12 | REFR# | B19 | +-----+-----------------+-------------------+-----+ | A20 | A11 | BClock | B20 | +-----+-----------------+-------------------+-----+ | A21 | A10 | IRQ7 | B21 | +-----+-----------------+-------------------+-----+ | A22 | A9 | IRQ6 | B22 | +-----+-----------------+-------------------+-----+ | A23 | A8 | IRQ5 | B23 | +-----+-----------------+-------------------+-----+ | A24 | A7 | IRQ4 | B24 | +-----+-----------------+-------------------+-----+ | A25 | A6 | IRQ3 | B25 | +-----+-----------------+-------------------+-----+ | A26 | A5 | DACK2# | B26 | +-----+-----------------+-------------------+-----+ | A27 | A4 | TC | B27 | +-----+-----------------+-------------------+-----+ | A28 | A3 | BALE | B28 | +-----+-----------------+-------------------+-----+ | A29 | A2 | +5v | B29 | +-----+-----------------+-------------------+-----+ | A30 | A1 | OSC | B30 | +-----+-----------------+-------------------+-----+ | A31 | A0 | GND | B31 | +-----+-----------------+-------------------+-----+ Note: some modem (multi-card) models are designed to connect to long (16-bit) ISA slot. You can connect them without any problems and into a short slot when used interrupts in the range IRQ1..IRQ7. NOTE: Instead of the Non-Maskable Interrupt (NMI) used in Kondratiev circuit, you can use a maskable (INT) interrupt. Not yet all programs support this, but THIS IS A MORE CORRECT SOLUTION. USE NMI CAN POTENTIALLY RESULT IN A STACK OVERFLOW AND INTERRUPTION OF NORMAL PROGRAM OPERATIONS. Everything should be clear by now with connecting ISA multicards and modems. Remaining two more options: a serial port based on i8251 (K580VV51) - if necessary I’ll find a diagram, but there’s a lot of soldering required, and the speed is only 9600. And another option is this software emulation of a serial interface. Everything is here in terms of soldering much simpler, you need two software-controlled ports (you need two binary discharge) on the output and two ports on the input. If you plan to useinterface without flow control, you can get by with one output port and one at the entrance. But this is a very unreliable solution; it requires the use of special data transfer protocols that guarantee error-free data transfer. Yes Another option is using flow control only in the direction from PC to ZX (see above, 4-wire interface), but it’s still better to use a full-fledged 5-wire interface. Let's say we already have two output ports, two ports at the entrance. The ports are based on TTL logic, that is, they transmit binary signals with levels from 0 to +5 volts. They must be coordinated with the RS-232C interface. Below there is a table explaining the coding of signals in TTL logic and interface RS-232C: Signal TTL logic RS-232C ----------------------------------- log. 0. 0..1.5 volts +3..12 volts log. 1. 2..5 volts -3..-12 volts Coordination is best accomplished using specially designed this microcircuit (imported): receiver - 1489, transmitter - 1488. There are and Soviet analogues of these microcircuits, but I don’t remember their designations. There is also newer and easier-to-use microcircuits that allow TTL matching logic with RS-232C interface, for example MAX-232. Convenience lies in no need to have a power source with a voltage of -12 and +12 volts(generated inside the microcircuit, on capacitors). But the price is at least 1.5 Few people will like the American dollar... On the other hand, 1488 and 1489 in There is no price list at all. I provide the pinout of microcircuits 1488 and 1489, I don’t have the pinout for MAX-232 hand. receiver: transmitter: +-----------+ +-----------+ | | | | 1A -o1 14o- VCC VEE -o1 14o- VDD | | | | 1C -o2 13o- 4A 1A -o2 13o- 4A | | | | 1Y -o3 12o- 4C 1Y -o3 12o- 4B | | | | 2A -o4 1489 11o- 4Y 2A -o4 1488 11o- 4Y | | | | 2C -o5 10o- 3A 2B -o5 10o- 3A | | | | 2Y -o6 9o- 3C 2Y -o6 9o- 3B | | | | GND -o7 8o- 3Y GND -o7 8o- 3Y | | | | +-----------+ +-----------+ Signal designation for the receiver (1489): A -- RS232 input, C -- control hysteresis (TTL input), Y -- TTL output, VCC -- +5 volt power supply.Signal designations for the transmitter (1488): A, B -- TTL inputs, Y -- output RS232, VDD -- +12 volt power supply, VEE -- -12 volt power supply. GND is common everywhere wire The transmitter chip implements logical function conjunctions, below is the table truth: A input | B entrance | Y output --------+--------+--------- 0 | 0 | VDD --------+--------+--------- 0 | 1 | VDD --------+--------+--------- 1 | 0 | VDD --------+--------+--------- 1 | 1 | VEE note: it is assumed that the missing input 1B is connected to logic 1. If the transmitter chip will only be used for TTL negotiation outputs with an RS232 interface, then the unused inputs of the transmitter should submit log.1. (according to the truth table, otherwise signal transmission through a microcircuit will be impossible). I have no information on using the “hysteresis control input”. At the receiver input, capacitors with a capacity of several tens of nanofarads, apparently to suppress the “bounce” of the signal. (required here clarification). In the absence of microcircuits 1488 and 1489, you can match the signals with using a number of discrete elements. So much simplified receiver circuit consists of only two diodes (you just need to take into account signal inversion): + VCC (+5 volts) |--- /\n ----- | RS232 input -------+--------> TTL input | --- /\n ----- | -----GND For a flow control circuit (5-wire cable), two such circuits are needed to TD and RTS signals. In case of extreme simplification, a direct connection of the TTL output to RS232 is possible input (you only need to take into account the signal inversion). It will most likely be work on most modern IBM-PC computers, but when connected to other equipment may cause problems. The fact is that some modern RS232 receivers consider a signal level less than +3 volts to be log. 1. If direct connection is not desired, then a simple circuit can be used transistor transmitter, such as that implemented in the ZS-Scorpion computer for Connecting a serial printer: +--------+ +5..12 volts | | - | 1.5k| | | |_| | | b|/ e +------| KT361A | | to - | 560ohm| | - |_| | | 560ohm 1.5k | |_| TTL ____ b|/ to |exit --|____|--| KT315A +---+---> RS232 output | e | | | - | --- GND | | --- 180pf |_| --- 2.7k | | +---+- -5..12 volts For a flow control circuit (5-wire cable), two such circuits are needed to TD and RTS signals. The ZS-Scorpion computer already has one output and one RS232 input for connecting a printer with a serial interface (signals "DSR" and "RS232" on system connector). To implement an interface with flow control signals, you need another entrance and another exit. Can use unused bit 5 of port joystick kempston for input, and one of the unused bits of the FE port (bits 5, 6 and 7) for output. If you plan to use for signal matching special microcircuits, it is better to put all signals there, and transistors and Remove the diodes from the board. Or, as an option, the above circuits with diodes and transistors only for unmatched signals. Total two out of three options (multi-card, 580BB51, software emulation) I described the connections sort of like this. For software emulation, the driver remains. Here he: The raw version (driver piece) is designed for a speed of 38400 bps: ;--------------------------------------- ; RS232 EMULATOR ZX-LINK ; TXPORT EQU #CFF7 RXMAX EQU 270 ZXL_INI LD A,1 JR ZXL_CTL ZXL_OFF XOR A ZXL_CTL ;LD (ZXL_DCD),A AND #01 RLCA RLCA LD (TXMASK),A IN A,(#1F) RLCA RLCA RLCA AND #01 RET ; LINE SCAN BC=SIZE D=SPEED CY=NOTHING LSCAN DI PUSH IX PUSH IY LD HL,RXMAX LD DE,RXBYTE PUSH DE LD IX,(M_BUFF) LD IY,TXMASK LD BC,TXPORT LD A,(TXMASK) OR #20 OUT (C),A RXNEXT LD D,#9F ; TIME RXWAIT IN A,(#FE) RLA RET C IN A,(#FE) ; 25..34 ~40 RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C DEC D JP NZ,RXWAIT ; +14 IN A,(#FE) RLA RET C LD A,(TXMASK) LD E,A ; +17 IN A,(#FE) RLA RET C OUT (C),E ; +12 IN A,(#FE) RLA RET C LD D,#7 ; +7 IN A,(#FE) RLA RET C RXWAIT1 IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C DEC D JP NZ,RXWAIT1 RXEND POP BC EX DE,HL LD HL,RXMAX OR A SBC HL,DE POP IY POP IX JR NZ,RXOK LD BC,#0101 XOR A INC A SCF RET RXOK LD D,LINKSPEED LD B,H LD C,L XOR A INC A RET RXBYTE IN A,(#FE) RLA JR C,RXBYTE1 DEC SP DEC SP JP RXWAIT RXBYTE1 JR $+2 JR $+2 JR $+2 JR $+2 NOP IN A,(#FE) ; B0 RLA RR E DEC HL LD A,H OR L CP 1 SBC A,A CPL AND #20 OR (IY) OUT (C), A IN A,(#FE) ; B1 RLA RR E LD BC,RXBYTE PUSH BC LD BC,TXPORT JR $+2 JR $+2 JR $+2 IN A,(#FE) ; B2 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B3 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B4 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B5 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B6 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B7 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B STOP RLA JR C,RXERR LD A,E CPL LD (IX),A INC IX JP RXNEXT RXERR LD A,(TXMASK) OUT (C),A JP RXEND ; SEND BLOCK IN MDMBUFF BC=SIZE LTRANS DI PUSH IX LD E,C LD D,B LD IX,(M_BUFF) LD BC,TXPORT TXBYTE LD A,(TXMASK) OR #08 OUT (C),A LD A,(IX) CPL LD L,A LD H,8 JR $+2 LD A,0 TXBIT RR L SBC A,A AND #08 OR 0 TXMASK EQU $-1 OUT (C),A JP $+3 JP $+3 JP $+3 LD A,0 DEC H JR NZ,TXBIT JR $+2 LD A,0 LD A,(TXMASK) OUT (C),A JR $+2 JR $+2 JR $+2 INC IX DEC DE LD A,D OR E JR NZ,TXBYTE LD B,4 DJNZ$ POP IX RET Unfortunately, there is one error here that does not manifest itself in any way when done correctly. operation of the PC COM port but potentially very dangerous (as always buffer overflow). The error there is that after filling receiving buffer, Spectrum resets CTS so that the PC stops transmitting, after this Spectrum receives the last byte (CTS signal blocks transmission next byte, but the current one has already begun to be transmitted). It's just in process When receiving the last byte, the Spectrum does not receive one byte, but how many they give. The pisyuk usually doesn’t give more than one, but if it does, the Spectrum will accept to the bitter end. In this case, the criterion for the end of transmission for Spectrum serves as a long stop bit, that is, a pause in transmission of several bits intervals. I'll definitely fix this bug, I'm just too lazy now, I'm tired of it write a letter (>32kb already)... Now regarding the encoding of information in the serial interface. Log.0. coded voltage +3..+12 volts, logic 1. -3..-12 volts. Data are transmitted sequentially, starting from 0-bit and ending with the last. There are several standard sending formats: 5,6,7 or 8 data bits, 1 or 0 parity bits (or odd), 1 or more stop bits. Stop bit, same as start bitdefinitely there. Usually they use the 8N1 format, that is, start bit, 8 data bits, no parity and one (or more) stop bits. With 8 data bits controls parity is not possible. In the 8N1 format, only 10 bits are transmitted for 8 information bits, that is, 20% of the channel capacity is lost. In an inactive state, when nothing is transmitted, the TD signal is in the log.1 state. (this means pause). If the TD signal is long (more than one byte transmission) is in log.0 state. then a sign of a wire break is formed. Transfer starts with the start bit -- transmitted during one bit interval log.0., all information bits are transmitted sequentially (one interval by one bit), then the parity bits (if any) and then the proper number stop bits (at least one, sometimes 1, 1.5, 2...) which are encoded by log.1. The time period allocated for the bit interval is defined as the value inversely proportional to speed. For example, at a speed of 38400 bps (which is used in my source) the length of the bit interval is 26.0416 microseconds or 91.1456 Z80 processor cycles at clock speed 3.5Mhz. When transmitting 10 bits of data (byte in 8N1 format), the mismatch speeds cannot be more than 5%, and for reliable reception even less - It must be taken into account that the signal in the cable is affected by various distortions. Receivercan detect and signal certain errors. There are a number standard speeds supported by most devices: 50, 75, 110, 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bps. On the Spectrum, without turbo mode, the achievable maximum is 38400 bits per second -- the limitation is imposed by the algorithm of the receiver (see source). C turbo mode at 7MHz will be 57600, but the program needs to be adjusted to specific implementation of turbo mode - it’s easier to turn it off for a while reception and transmission. Transferring files between ZX and PC can be done using the program MMD (aka MacroMoDem) on Spectrum (together with a special modem driver, supports your interface type, a compatible one must be used on the PC program (XMD for example). It is possible to use other Spectrum terminals (for example Melon - the source code was lying around somewhere, you can use any interface screw), and on the PC X,Y,Z modem. If the task is to transfer files, then IMHO it is better to use MMD - it can be programmed for automatic operation. If you need to control the PC in the console (for example, in Linux) then it would be better to use an ANSI or at least a BT VT52 compatible terminal, capable of receiving files using the Z-modem protocol. Could be a good option using Melon (may need adaptation to your interface). Yesfragments from CP/M, I think I implemented VT52 there, but Z-modem is there naturally no. Perhaps another ANSI terminal will appear... Idk. Without the Internet there is no point. For now, the best option for you is MMD and Melon. Then maybe telnet (ansi/vt220 terminal) and network... Without a network there will be no virtual disks. Although... MAS for MMD emulated a turbojet engine on a PC via a link. But this is only inside MMD. As I understand it, at least 2 people are currently working on the network issue (groups) in the exUSSR and several foreigners. Everything is separate. Already have zxtcp, zsock, uip, cpcip... someone threw something into zx.spectrum... IMHO the process is needed just push hard in that direction. In general, you have the task of choosing an interface: modems, multicards, 580ВВ51, emulation, maybe something else... all consistent. And parallel to The PC will only have support in self-written programs and therefore has no prospects (and RS232 also already has a place in the museum, it’s just that a lot has been done, but Now USB rules). I hope Lara won’t choke on your 36kb letter? Looks like there are some pissy glitches there no, you shouldn't. -+- [ZX] + Origin: Eat some more of these soft French rolls and drink some tea (2:5030/827.2) ================================================================================ Press RESET immediately, All!

From Kirill Frolov To All 27 November 2002

================================================================================ * Forwarded by Kirill Frolov (500:812/1.507) * Area : NETMAIL (My soap) * From : Kirill Frolov, 2:5030/827.2 (27 Nov 02 22:11) *To: Yuri Potapov * Subj : 3.5" drive connection ================================================================================ Press RESET immediately, Yuri! 26 Nov 02 21:11, Yuri Potapov wrote to Kirill Frolov: YP> in this case I have this idea YP> on one side there is a green ZS Scorpion, there is no confusion YP> on the other hand, not a very sophisticated PC running Linux YP> most likely, the PC will have a CD, 1.44 drive, screw, modem YP> but in general it should act as a server from/where I will download YP> files YP> modem emulation is not needed YP> much of what I will transmit should go as commands YP>console YP> the spec will have to play the role of a client, including how I do YP> explained that it is possible to surf the Internet via Linux using YP> regular terminal That is, you need either a network (telnet, ssh...), which does not exist, or a connectionvia serial port (Spectrum terminal emulation). Usually remote control of a machine via a unix terminal is only possible via a network or serial interface (modem). YP> and this will already be more promising than trying to write in Spec now YP> browser and tcp/ip and so on Well, it’s for such purposes, IMHO, that you need to write. Only with a view to using the resources of a pussy that is not in the next room, but accessible via the Internet. For example, try telneting cyberspace.org - you can get account on a machine running SunOS and use it to access other network information resources. There is no network on the Spectrum yet, well, at least there is definitely no telnet there. Therefore, there are two options left for you: ZX <- serial interface -> PC. The role of a “serial interface” can be either a cable or a pair modems. If you already have an ISA modem installed on your Spectrum, then just connect you will receive a multicard from the PC and you will receive a serial port. If you need parallel and modem, or do you need several serial ports then you will have to think about upgrading the modem connection circuit. If the modem is on Spectrum is not available, that is, there are 2 options: through a multicard (for example, by Kondratiev scheme) and through software emulation of asynchronousSpectrum serial interface. In case of software emulation it is not necessary The piss multicard is already in short supply. The "minimal" null modem cable for connecting two computers contains just three wires: ZX PC ----------------- ----------------- signal DB9S DB25S signal DB9S DB25S TD 3 2 <----------> RD 2 3 RD 2 3 <-----------> TD 3 2 GROUND 5 7 <-----------> GROUND 5 7 Columns DB9S and DB25S indicate the pin numbers on the corresponding connectors. There are several standard connectors for this interface, and most popular ones are DB9S and DB25S (the letter S means Socket, that is, a socket. This connectors with “holes” on the cable and with “pins” on the computer). In modern IBM PC computers usually use DB9. The minimum cable version has some disadvantages, in particular it provides only software flow control, which is completely unsuitable for use in the case of software emulation of a serial interface on Spectrum (Spectrum can only receive data in a port polling cycle, but when in the absence of other signal wires, he cannot in any way communicate to another whether the computer is ready to receive it or not). In case of hardware implementationinterface on the Spectrum, the use of a 3-wire cable is also undesirable, since it is difficult for Spectrum with its slowness to guarantee timely extracting received data from the receiver buffer. Mentioned disadvantage There is no 3-wire cable in the 4-wire or 5-wire interface, where hardware flow control is used: ZX PC ----------------- ----------------- signal DB9S DB25S signal DB9S DB25S TD 3 2 <----------> RD 2 3 RD 2 3 <-----------> TD 3 2 RTS 7 4 <-----------> CTS 8 5 * CTS 8 5 <--(*)------> * RTS 7 4 GROUND 5 7 <-----------> GROUND 5 7 The signal marked with an asterisk '*' in the case of a 4-wire interface may not be be used, but its non-use is undesirable: this signal provides protection against overflow of the receiver buffer in the PC, just like a signal does RTS for Spectrum. 5-wire interface provides a complete full-duplex transmission channel information with hardware flow control. But if it is necessary to transmit some control information outside the transmission channel, for example ready/unready, reset/handshake, as often used in modems, then you need a full-fledged interface consisting of 9 wires:ZX PC ----------------- ----------------- signal DB9S DB25S signal DB9S DB25S TD 3 2 <----------> RD 2 3 RD 2 3 <-----------> TD 3 2 RTS 7 4 <-----------> CTS 8 5 CTS 8 5 <-----------> RTS 7 4 DTR 4 20 <--------+--> DSR 6 6 DSR 6 6 <--+-----)--> DTR 4 20 * DCD 1 8 <--+ +--> DCD 1 8 * RI 9 22 RI 9 22 GROUND 5 7 <-----------> GROUND 5 7 Signals marked with asterisks ('*') RI and DCD are used only in modems. RI is an input at the terminal (computer) indicating the arrival of a call, DCD signals the establishment of communication (presence of carrier). In this case, RI is not is used, and the DCD is connected to the DTR signal from the remote side, which provides "carrier appearance" when signaling the readiness of the remote side. This was the wiring of a full-fledged null modem cable. She doesn't coincides with the wiring of a regular modem cable! In your case, I would use a 5-wire interface. As cable, if it is impossible to get it ready-made, it is better to take a modem cable and make a special adapter. I do not recommend making a cable yourself, it’s better to take a ready-made one.In a modem cable, all signals are connected one to one, and in a null modem reception and transmission signals, RTS-CTS, DTR-DSR are swapped. Below is complete pinout of the serial interface. There are several standards here we mean the RS-232C interface, used in most personal computers. Designation Connector contact Direction RS232 DB9 DB25 output PG - 1 - protective ground (protect ground) TD 3 2 output data transmission (transmit data) RD 2 3 input data reception (receive data) RTS 7 4 output request transfer (request to send) data CTS 8 5 input ready for (clear to send) data reception DSR 6 6 input ready (data set ready) devices data transmission SG 5 7 - signal (signal ground) common wire DCD 1 8 input detection (data carrier detected) carrier DTR 4 20 output ready (data terminal ready) terminalRI 9 22 input bell (ring indicator) Historically, although it no longer makes much sense, that all devices using the RS-232C interface are divided into 2 types: devices data transmission (DCE == Data Connection Equipment, e.g. modems) and final equipment, terminals (DTE == Data Terminal Equipment, for example, when When connecting a modem to a computer, the computer plays the role of a terminal). In fact both devices are equivalent, but from this division they are designated differently signals: DTR or DSR, RTS or CTS... and there is a little confusion. So here it is the above table refers to DTE devices, that is, terminals (computers). The pin numbers for DTE devices are correct, but for DCE devices (modems) must be swapped TD and RD, CTS and RTS, DSR and DTR. Hence, by the way, the difference between “straight” modem cables and “twisted” ones null modem. And besides, in the table above there are only signals used in the IBM-PC and most other computers. Full version interface defines a larger number of signals on the DB25 connector. When connecting an ISA multicard from an IBM-PC computer, problems may arise. problems with connecting the remote connector cable ("miscarriage") to the multicard. The fact is that there are several different options for pinout of contacts onmultimap. Here are the main ones: Contact on the multicard Contact on the connector Var.1 Var.2 Var.3 Var.4 DB9 DB25 (10) (10) (10) 1 - 1 3 5 3 3 3 2 2 3 4 5 2 3 7 4 8 7 7 4 8 6 7 9 8 5 6 2 9 11 6 6 5 9 1 13 5 7 1 1 5 15 1 8 4 7 2 14 4 20 9 8 6 18 9 22 Version 1 8-bit multicard loop Ver.2 loop of 16-bit multicards Version 3 cable for ports integrated on the motherboard Version 4 wide cable to 25-pin connector From everything written about how a multicard is connected, for example, by Kondratiev's scheme should already be clear. Naturally, the ISA slot should 3 voltages are supplied: -12 volts, +12 volts, and +5 volts. Herself The Kondratiev diagram for connecting an ISA modem (multi-card) to the Spectrum is here: Original Kondratieff adapter circuit for connection internal modem. DD1 __ +---+ RD -----------------+1 | _____ | +------- IORD# (modem) +---+ | DD1 | +---+ +---+ | A4 ----+1 | | ____ | +----+ IORQ --+ | | +---+ | DD1 | +---+ +---+1 | _____ __ | +---+-- IOWR# (modem) WR -----------------+ | | +---+ | | +--------------------+ | | DD2 | +--------+ +5v - | ---o R | | | Q +-----+ +----/ C | | | | | A11 --------> D _ | | _____ | Q O-- | RESET --+---o S | | | +--------+ | | | | DD3 | | +---+ | | |1 | | +----+ O--------------- RESET (modem) | | | +---+ | | | | | DD1 DD3 | +---+ +---+ +--+1 | --- |1 | | +------ NMI (modem) IRQ4 ----+ O---------+ | | | +---+ +---+ A8 ------------------- A0 (modem) A9 ------------------- A1 (modem) A10 ------------------- A2 (modem) D0..D7 ---------------- D0..D7 (modem) +5v -------------------- A3..A10 (modem) GND -------------------- AEN (modem) List of elements: DD1 1533LL1 DD2 1533TM2 DD3 1533ЛH1 Signals marked in brackets "(modem)" are connected to corresponding pins of the ISA slot for the modem, the rest the signals are connected directly to the computer bus. Accessing modem registers via ports The modem registers are accessible through the microprocessor I/O ports. The address is calculated like this: 0xF0EF + (0x0800 if NMI interrupts are disabled) + (register_address*0x100) The interrupt enable trigger from the modem switches only when output to the modem ports. NOTE: Instead of non-maskable (NMI), you can use maskable (INT) interrupt. Not all programs support this yet, but THIS IS MORE CORRECT DECISION. THE USE OF NMI CAN POTENTIALLY RESULT IN STACK OVERFLOW AND DISRUPTION OF NORMAL OPERATION OF PROGRAMS. Just in case, I’m also bringing a modified one (so that it doesn’t work with the 7FFD port). conflicted) Shepelev’s scheme: Modified Shepelevsky scheme, supported in the Melon program. D0..D7 ----------------------- D0..D7 (modem) A8 -------------------------- A0 (modem) A9 -------------------------- A1 (modem) A10 -------------------------- A2 (modem) A11 -------------------------- A3 (modem) A12 -------------------------- A8 (modem) A13 -------------------------- A9 (modem)+5v ---------------------- A4 (modem) +5v ---------------------- A5 (modem) GND ----------------------- AEN (modem) +---+ A14 --------+ 1 | | +---+ A15 --------+ | | +---+ | DD1.1 | +---+ +--+ 1 | | o----+---- A7 (modem) A6 ---------------------+ | | +---+ +---- A6 (modem) DD2.1 ____ +---+ IORQ ----+---+ 1 | __ | | +----------- IORD# (modem) RD -----(---+ | | +---+ | DD1.2 | +---+ +---+ 1 | __ | +----------- IOWR# (modem) WR ---------+ | +---+ DD1.3 +---+ GND -----+ 1 | _____ | o----------RESET (modem) RESET -------+ | +---+ DD2.2 Read more: DD1 1533ЛЛ1 DD2 1533ЛЕ1 Read the story of the story The story of the story of the story of the story микропроцессора, Read more about the article: 0x38BF + адрес_регистра_модема In the end the story was written. использование прерыванийfrom the modem, but this feature can be added by connecting one of the outputs modem interrupts via an inverter with an "open collector" output (chip 555ЛH2) with an INT signal (maskable interrupt) on the bus ZX-Spectrum. An NPN bipolar transistor can act as an inertor (for example KT315) in the corresponding connection circuit. The above schemes have some disadvantages. For example, they most likely will not work if you connect the modem and computer with long (>10cm) wires. The whole problem here is excessive inductance of conductors. If the modem does not work, you can try passing signals A8,A9,A10,IOWR and IORD through the trigger Schmidt installed in close proximity to the ISA slot or through resistors with a resistance of 30-50 ohms. Pin assignments of the short (8-bit) ISA slot: +---------+---------------+-----------------+---------+ | contact | signal | signal | contact | +-+-----+-+---------------+-----------------+-+-----+-+ | A1 | IOCHK | GND | B1 | +-----+-----------------+-------------------+-----+ | A2 | D7 | RESET | B2 | +-----+-----------------+-------------------+-----+ | A3 | D6 | +5v | B3 | +-----+-----------------+-------------------+-----+ | A4 | D5 | IRQ2/9 (*) | B4 | +-----+-----------------+-------------------+-----+ | A5 | D4 | -5v | B5 | +-----+-----------------+-------------------+-----+ | A6 | D3 | DRQ2 | B6 | +-----+-----------------+-------------------+-----+ | A7 | D2 | -12v | B7 | +-----+-----------------+-------------------+-----+ | A8 | D1 | OWS2# | B8 | +-----+-----------------+-------------------+-----+ | A9 | D0 | +12v | B9 | +-----+-----------------+-------------------+-----+ | A10 | IOCHDRY | GND | B10 | +-----+-----------------+-------------------+-----+ | A11 | AEN | SmemWR# | B11 | +-----+-----------------+-------------------+-----+ | A12 | A19 | SmemRD# | B12 | +-----+-----------------+-------------------+-----+ | A13 | A18 | IOWR# | B13 | +-----+-----------------+-------------------+-----+ | A14 | A17 | IORD# | B14 | +-----+-----------------+-------------------+-----+ | A15 | A16 | DACK3# | B15 | +-----+-----------------+-------------------+-----+ | A16 | A15 | DRQ3 | B16 | +-----+-----------------+-------------------+-----+ | A17 | A14 | DACK1# | B17 | +-----+-----------------+-------------------+-----+ | A18 | A13 | DRQ1 | B18 | +-----+-----------------+-------------------+-----+ | A19 | A12 | REFR# | B19 | +-----+-----------------+-------------------+-----+ | A20 | A11 | BClock | B20 | +-----+-----------------+-------------------+-----+ | A21 | A10 | IRQ7 | B21 | +-----+-----------------+-------------------+-----+ | A22 | A9 | IRQ6 | B22 | +-----+-----------------+-------------------+-----+ | A23 | A8 | IRQ5 | B23 | +-----+-----------------+-------------------+-----+ | A24 | A7 | IRQ4 | B24 | +-----+-----------------+-------------------+-----+ | A25 | A6 | IRQ3 | B25 | +-----+-----------------+-------------------+-----+ | A26 | A5 | DACK2# | B26 | +-----+-----------------+-------------------+-----+ | A27 | A4 | TC | B27 | +-----+-----------------+-------------------+-----+ | A28 | A3 | BALE | B28 | +-----+-----------------+-------------------+-----+ | A29 | A2 | +5v | B29 | +-----+-----------------+-------------------+-----+ | A30 | A1 | OSC | B30 | +-----+-----------------+-------------------+-----+ | A31 | A0 | GND | B31 | +-----+-----------------+-------------------+-----+ Note: some modem (multi-card) models are designed to connect to long (16-bit) ISA slot. You can connect them without any problems and into a short slot when used interrupts in the range IRQ1..IRQ7. NOTE: Instead of the Non-Maskable Interrupt (NMI) used in Kondratiev circuit, you can use a maskable (INT) interrupt. Not yet all programs support this, but THIS IS A MORE CORRECT SOLUTION. USE NMI CAN POTENTIALLY RESULT IN A STACK OVERFLOW AND INTERRUPTION OF NORMAL PROGRAM OPERATIONS. Everything should be clear by now with connecting ISA multicards and modems. Remaining two more options: a serial port based on i8251 (K580VV51) - if necessary I’ll find a diagram, but there’s a lot of soldering required, and the speed is only 9600. And another option is this software emulation of a serial interface. Everything is here in terms of soldering much simpler, you need two software-controlled ports (you need two binary discharge) on the output and two ports on the input. If you plan to useinterface without flow control, you can get by with one output port and one at the entrance. But this is a very unreliable solution; it requires the use of special data transfer protocols that guarantee error-free data transfer. Yes Another option is using flow control only in the direction from PC to ZX (see above, 4-wire interface), but it’s still better to use a full-fledged 5-wire interface. Let's say we already have two output ports, two ports at the entrance. The ports are based on TTL logic, that is, they transmit binary signals with levels from 0 to +5 volts. They must be coordinated with the RS-232C interface. Below there is a table explaining the coding of signals in TTL logic and interface RS-232C: Signal TTL logic RS-232C ----------------------------------- log. 0. 0..1.5 volts +3..12 volts log. 1. 2..5 volts -3..-12 volts Coordination is best accomplished using specially designed this microcircuit (imported): receiver - 1489, transmitter - 1488. There are and Soviet analogues of these microcircuits, but I don’t remember their designations. There is also newer and easier-to-use microcircuits that allow TTL matching logic with RS-232C interface, for example MAX-232. Convenience lies in no need to have a power source with a voltage of -12 and +12 volts(generated inside the microcircuit, on capacitors). But the price is at least 1.5 Few people will like the American dollar... On the other hand, 1488 and 1489 in There is no price list at all. I provide the pinout of microcircuits 1488 and 1489, I don’t have the pinout for MAX-232 hand. receiver: transmitter: +-----------+ +-----------+ | | | | 1A -o1 14o- VCC VEE -o1 14o- VDD | | | | 1C -o2 13o- 4A 1A -o2 13o- 4A | | | | 1Y -o3 12o- 4C 1Y -o3 12o- 4B | | | | 2A -o4 1489 11o- 4Y 2A -o4 1488 11o- 4Y | | | | 2C -o5 10o- 3A 2B -o5 10o- 3A | | | | 2Y -o6 9o- 3C 2Y -o6 9o- 3B | | | | GND -o7 8o- 3Y GND -o7 8o- 3Y | | | | +-----------+ +-----------+ Signal designation for the receiver (1489): A -- RS232 input, C -- control hysteresis (TTL input), Y -- TTL output, VCC -- +5 volt power supply.Signal designation for the transmitter (1488): A, B -- TTL inputs, Y -- output RS232, VDD -- +12 volt power supply, VEE -- -12 volt power supply. GND is common everywhere wire The transmitter chip implements logical function conjunctions, below is the table truth: A input | B entrance | Y output --------+--------+--------- 0 | 0 | VDD --------+--------+--------- 0 | 1 | VDD --------+--------+--------- 1 | 0 | VDD --------+--------+--------- 1 | 1 | VEE note: it is assumed that the missing input 1B is connected to logic 1. If the transmitter chip will only be used for TTL negotiation outputs with an RS232 interface, then the unused inputs of the transmitter should submit log.1. (according to the truth table, otherwise signal transmission through a microcircuit will be impossible). I have no information on using the “hysteresis control input”. At the receiver input, capacitors with a capacity of several tens of nanofarads, apparently to suppress the “bounce” of the signal. (required here clarification). In the absence of microcircuits 1488 and 1489, you can match the signals with using a number of discrete elements. So much simplified receiver circuit consists of only two diodes (you just need to take into account signal inversion): + VCC (+5 volts) |--- /\n ----- | RS232 input -------+--------> TTL input | --- /\n ----- | -----GND For a flow control circuit (5-wire cable), two such circuits are needed to TD and RTS signals. In case of extreme simplification, a direct connection of the TTL output to RS232 is possible input (you only need to take into account the signal inversion). It will most likely be work on most modern IBM-PC computers, but when connected to other equipment may cause problems. The fact is that some modern RS232 receivers consider a signal level less than +3 volts to be log. 1. If direct connection is not desired, then a simple circuit can be used transistor transmitter, such as that implemented in the ZS-Scorpion computer for Connecting a serial printer: +--------+ +5..12 volts | | - | 1.5k| | | |_| | | b|/ e +------| KT361A | | to - | 560ohm| | - |_| | | 560ohm 1.5k | |_| TTL ____ b|/ to |exit --|____|--| KT315A +---+---> RS232 output | e | | | - | --- GND | | --- 180pf |_| --- 2.7k | | +---+- -5..12 volts For a flow control circuit (5-wire cable), two such circuits are needed to TD and RTS signals. The ZS-Scorpion computer already has one output and one RS232 input for connecting a printer with a serial interface (signals "DSR" and "RS232" on system connector). To implement an interface with flow control signals, you need another entrance and another exit. Can use unused bit 5 of port joystick kempston for input, and one of the unused bits of the FE port (bits 5, 6 and 7) for output. If you plan to use for signal matching special microcircuits, it is better to put all signals there, and transistors and Remove the diodes from the board. Or, as an option, the above circuits with diodes and transistors only for unmatched signals. Total two out of three options (multi-card, 580BB51, software emulation) I described the connections sort of like this. For software emulation, the driver remains. Here he: The raw version (driver piece) is designed for a speed of 38400 bps: ;--------------------------------------- ; RS232 EMULATOR ZX-LINK ; TXPORT EQU #CFF7 RXMAX EQU 270 ZXL_INI LD A,1 JR ZXL_CTL ZXL_OFF XOR A ZXL_CTL ;LD (ZXL_DCD),A AND #01 RLCA RLCA LD (TXMASK),A IN A,(#1F) RLCA RLCA RLCA AND #01 RET ; LINE SCAN BC=SIZE D=SPEED CY=NOTHING LSCAN DI PUSH IX PUSH IY LD HL,RXMAX LD DE,RXBYTE PUSH DE LD IX,(M_BUFF) LD IY,TXMASK LD BC,TXPORT LD A,(TXMASK) OR #20 OUT (C),A RXNEXT LD D,#9F ; TIME RXWAIT IN A,(#FE) RLA RET C IN A,(#FE) ; 25..34 ~40 RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C DEC D JP NZ,RXWAIT ; +14 IN A,(#FE) RLA RET C LD A,(TXMASK) LD E,A ; +17 IN A,(#FE) RLA RET C OUT (C),E ; +12 IN A,(#FE) RLA RET C LD D,#7 ; +7 IN A,(#FE) RLA RET C RXWAIT1 IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C IN A,(#FE) RLA RET C DEC D JP NZ,RXWAIT1 RXEND POP BC EX DE,HL LD HL,RXMAX OR A SBC HL,DE POP IY POP IX JR NZ,RXOK LD BC,#0101 XOR A INC A SCF RET RXOK LD D,LINKSPEED LD B,H LD C,L XOR A INC A RET RXBYTE IN A,(#FE) RLA JR C,RXBYTE1 DEC SP DEC SP JP RXWAIT RXBYTE1 JR $+2 JR $+2 JR $+2 JR $+2 NOP IN A,(#FE) ; B0 RLA RR E DEC HL LD A,H OR L CP 1 SBC A,A CPL AND #20 OR (IY) OUT (C), A IN A,(#FE) ; B1 RLA RR E LD BC,RXBYTE PUSH BC LD BC,TXPORT JR $+2 JR $+2 JR $+2 IN A,(#FE) ; B2 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B3 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B4 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B5 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B6 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B7 RLA RR E JR $+2 JR $+2 JR $+2 JR $+2 JR $+2 NOP NOP IN A,(#FE) ; B STOP RLA JR C,RXERR LD A,E CPL LD (IX),A INC IX JP RXNEXT RXERR LD A,(TXMASK) OUT (C),A JP RXEND ; SEND BLOCK IN MDMBUFF BC=SIZE LTRANS DI PUSH IX LD E,C LD D,B LD IX,(M_BUFF) LD BC,TXPORT TXBYTE LD A,(TXMASK) OR #08 OUT (C),A LD A,(IX) CPL LD L,A LD H,8 JR $+2 LD A,0 TXBIT RR L SBC A,A AND #08 OR 0 TXMASK EQU $-1 OUT (C),A JP $+3 JP $+3 JP $+3 LD A,0 DEC H JR NZ,TXBIT JR $+2 LD A,0 LD A,(TXMASK) OUT (C),A JR $+2 JR $+2 JR $+2 INC IX DEC DE LD A,D OR E JR NZ,TXBYTE LD B,4 DJNZ$ POP IX RET Unfortunately, there is one error here that does not manifest itself in any way when done correctly. operation of the PC COM port but potentially very dangerous (as always buffer overflow). The error there is that after filling receiving buffer, Spectrum resets CTS so that the PC stops transmitting, after this Spectrum receives the last byte (CTS signal blocks transmission next byte, but the current one has already begun to be transmitted). It's just in process When receiving the last byte, the Spectrum does not receive one byte, but how many they give. The pisyuk usually doesn’t give more than one, but if it does, the Spectrum will accept to the bitter end. In this case, the criterion for the end of transmission for Spectrum serves as a long stop bit, that is, a pause in transmission of several bits intervals. I'll definitely fix this bug, I'm just too lazy now, I'm tired of it write a letter (>32kb already)... Now regarding the encoding of information in the serial interface. Log.0. coded voltage +3..+12 volts, logic 1. -3..-12 volts. Data are transmitted sequentially, starting from 0-bit and ending with the last. There are several standard sending formats: 5,6,7 or 8 data bits, 1 or 0 parity bits (or odd), 1 or more stop bits. Stop bit, same as start bitdefinitely there. Usually they use the 8N1 format, that is, start bit, 8 data bits, no parity and one (or more) stop bits. With 8 data bits controls parity is not possible. In the 8N1 format, only 10 bits are transmitted for 8 information bits, that is, 20% of the channel capacity is lost. In an inactive state, when nothing is transmitted, the TD signal is in the log.1 state. (this means pause). If the TD signal is long (more than one byte transmission) is in log.0 state. then a sign of a wire break is formed. Transfer starts with the start bit -- transmitted during one bit interval log.0., all information bits are transmitted sequentially (one interval by one bit), then the parity bits (if any) and then the proper number stop bits (at least one, sometimes 1, 1.5, 2...) which are encoded by log.1. The time period allocated for the bit interval is defined as the value inversely proportional to speed. For example, at a speed of 38400 bps (which is used in my source) the length of the bit interval is 26.0416 microseconds or 91.1456 Z80 processor cycles at clock speed 3.5Mhz. When transmitting 10 bits of data (byte in 8N1 format), the mismatch speeds cannot be more than 5%, and for reliable reception even less - It must be taken into account that the signal in the cable is affected by various distortions. Receivercan detect and signal certain errors. There are a number standard speeds supported by most devices: 50, 75, 110, 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bps. On the Spectrum, without turbo mode, the achievable maximum is 38400 bits per second -- the limitation is imposed by the algorithm of the receiver (see source). C turbo mode at 7MHz will be 57600, but the program needs to be adjusted to specific implementation of turbo mode - it’s easier to turn it off for a while reception and transmission. Transferring files between ZX and PC can be done using the program MMD (aka MacroMoDem) on Spectrum (together with a special modem driver, supports your interface type, a compatible one must be used on the PC program (XMD for example). It is possible to use other Spectrum terminals (for example Melon - the source code was lying around somewhere, you can use any interface screw), and on the PC X,Y,Z modem. If the task is to transfer files, then IMHO it is better to use MMD - it can be programmed for automatic operation. If you need to control the PC in the console (for example, in Linux) then it would be better to use an ANSI or at least a BT VT52 compatible terminal, capable of receiving files using the Z-modem protocol. Could be a good option using Melon (may need adaptation to your interface). Yesfragments from CP/M, I think I implemented VT52 there, but Z-modem is there naturally no. Perhaps another ANSI terminal will appear... Idk. Without the Internet there is no point. For now, the best option for you is MMD and Melon. Then maybe telnet (ansi/vt220 terminal) and network... Without a network there will be no virtual disks. Although... MAS for MMD emulated a turbojet engine on a PC via a link. But this is only inside MMD. As I understand it, at least 2 people are currently working on the network issue (groups) in the exUSSR and several foreigners. Everything is separate. Already have zxtcp, zsock, uip, cpcip... someone threw something into zx.spectrum... IMHO the process is needed just push hard in that direction. In general, you have the task of choosing an interface: modems, multicards, 580ВВ51, emulation, maybe something else... all consistent. And parallel to The PC will only have support in self-written programs and therefore has no prospects (and RS232 also already has a place in the museum, it’s just that a lot has been done, but Now USB rules). I hope Lara won’t choke on your 36kb letter? Looks like there are some pissy glitches there no, you shouldn't. -+- [ZX] + Origin: Eat some more of these soft French rolls and drink some tea (2:5030/827.2) ================================================================================ Press RESET immediately, All!