ALK'96
HOW TO FIX INT?
══════════════════════════════════════════
Today in the "HARDWARE" section, we will touch upon a painful topic concerning (once again!) the imperfection of our domestic SPECTRUM schemes. I will briefly describe the essence of the problem: every user of "Leningrads", "Pentagons", "Angstrems", etc., being in full health and clear mind, has repeatedly noticed some "glitches" in programs such as VENOM STRIKES BACK, MONTE CARLO CASINO, SHOCK MEGADEMO (MULTICOLOR, GREETINGS), CHASE H.Q.128... - this list can be continued with a bunch of trainers for various games.
In some programs, one can observe periodic disappearance or "trembling" of moving sprites, while in others, various stripes on the BORDER are misaligned upward, although logically they should be positioned slightly lower.
...All
this,
as
it is said,
the external
effect
external effect
Now I will try to explain why "this" happens. All "glitchy" effects "over there" (i.e., abroad) are usually written for branded SPECTRUMs. Such effects are executed synchronously with the frame scan of the television signal - this technique is necessary to achieve the "smoothness" and "uniformity" of the movements of sprites, scrolling lines, etc. Synchronization of object redrawing programs with the frame scan in branded SPECTRUMs is achieved by placing these programs in the handler for maskable interrupts, or by executing them in a loop after the HALT microprocessor command (which, in fact, does not change the essence). Maskable interrupts occur synchronously with the frame scan at a frequency of 50 Hz - short pulses of this frequency are fed to the INT input of the microprocessor. It is known that a maskable interrupt in a PENTAGON occurs simultaneously with the frame pulse, i.e., the interrupt processing begins simultaneously with the construction of a new frame. In a branded SPECCY, the interrupt signal is "delayed" relative to the frame pulse by a time roughly equal to the construction of sixteen raster lines.
Programs developed on branded "computers" are "tuned" to the "shifted" INT relative to the frame, so when launched on non-standard SPECTRUMs, they will "show" the observer the picture at those moments in time when the sprite is being redrawn (meaning software redrawing, not coinciding with the hardware redrawing of the TV frame). This is displayed as a partially "disappearing" or "folded" image by one line.
If the program provides for various BORDER effects like MONTE-CARLO, then on "bad" computers this can still be tolerated - so what if there are stripes at the top, at least it works, but what about MULTICOLORs?
--------------------------
A lyrical digression...
For those who do not know,
what MULTICOLOR is, let me explain: it is a technique for obtaining several colors -
more than two simultaneously in
one character position. This effect
is achieved by
FULL synchronization of the com-
puter with the line scan of the tele-signal, and this
is achieved in turn
by synchronizing with the frame
based on INT interrupts
- there is simply no other way in SPECTRUM. Naturally, if your computer has a non-standard INT signal phase, you will see some wide color stripes flickering almost randomly instead of stunning magnificence. Basically, the normal operation
of MULTICOLOR-effects depends
not only on the correct phase of the INT signal, but also on the scheme of raster line formation in the computer - I will return to this problem a bit later... ----------------------------------------- When I first encountered the BORDER effect in the program VENOM STRIKES BACK, which, as you guessed, did not work correctly, I accepted it, but when I saw (or rather could not see properly!) SHOCK MEGADEMO, namely MULTICOLOR in the form perceived by abstract artists, and GREETINGS, which I could not discern on the screen at all - my patience snapped...
A month of searching for an optimal solution resulted in a small circuit shown below. The essence of this device's operation is to delay the requests for maskable interrupts coming from the computer's circuit to the INT input of the microprocessor by a strictly defined amount. The time delay can be adjusted. The circuit is connected in the break between the INT input of the microprocessor and the rest of the computer's circuit. Microchips: DD1 - K5SSTM2, DD2 - K5SSЛН1 or K5SSЛН2, DD3 - K555ЛАЗ, DDЧ,DDS - K5SSUE7, DD6 - K5SSЛА2, you can use both 155 and 1533 series microchips. Diodes: VD1,VD2 - КДS22Б. Capacitors: C1 - 10n, (can be changed during setup), C2 - 1n, C3 - 10n. Resistors: R1,R2 - 180 Ohm, R3,R4 - 1 KOhm. Power supply wiring: +5 volts to pin 14 of DD1,DD2,DD3,DD6, to pin 16 of DDЧ,DDS, "ground" to pin 7 of DD1,DD2,DD3,DD6, to pin 8 of DDЧ,DDS. ----------------------------------------- Circuit adjustment. The circuit can be assembled on a single-sided fiberglass board measuring 25x75 mm. It is not necessary to create printed circuit boards - all connections can be made with multi-stranded MGTW wire. For convenience in setup, connect the outputs of counters DDЧ,DDS to the inputs of DD6 with long wires, unused (according to the scheme) outputs of the counters should also be soldered with wires - they may come in handy. Free (and used as well) inputs of the microchip DD6 must be connected to +5V through 1 KOhm resistors. Wires are also soldered to all inputs of DD6. All these preparations do not concern the connection of pin 3 of DDЧ with pin 1 of DD6 - this connection can be made immediately without extension wires - during setup, it will not need to be interrupted. It is advisable to place capacitor C1 at some distance from the microchip casings to reduce the influence of air temperature changes, while there is no need to move it too far - you will have to find a reasonable compromise. After adjusting the circuit, the entire board must be shielded with some metallic casing, and the casing should be connected to the negative (ground) terminal of the power supply. However, it is not necessary to shield the board - but this will affect the stability of the delay time. After assembling the circuit, it is connected (observing polarity!) to the power buses of the computer. The contact pad leading to pin 16 of the Z-80 (INT) is cut, and the circuit is included in the resulting gap. You can make it easier - if your Z-80 is installed on a panel, then carefully removing it from there, bend the same pin 16, and put the processor back in place, connecting the circuit in this case involves soldering the circuit's input to the contact pad and the output to the free pin 16 of the processor. If you are (a lucky?) owner of a PENTAGON or "Leningrad" with a music coprocessor that has been "added" on top of the main board, then consider yourself very lucky - you do not need to "torture" the processor and the computer's board at all, just remove the coprocessor board and bend the 16th pin of the expansion connector, solder the output of the circuit to it, connect the input as in the previous case, then reinstall the coprocessor board. ----------------------------------------- Circuit tuning. After the "integration" of the circuit into the computer is complete, make sure that all connections are made according to the scheme, and that the switch SA1 is in the upper (according to the scheme) position. For the first launch, it is advisable to connect the outputs of counters DDЧ,DDS to the inputs of DD6 as shown in the scheme. Before starting the computer, stock up on disks with "suspicious" programs in which you believe there are "glitches." Collect at least five such programs and confidently turn on your "computer". If after turning it on the computer responds to your button presses, then you can confidently say that the circuit is functioning normally. If, on the contrary, the keyboard does not respond, then try flipping the switch SA1, if after that the keyboard "comes to life", then you will have to look for errors in the connections of the assembled circuit, otherwise - you have "burned" something inside the computer, in which case please accept my condolences. So, you load some program, preferably one that uses some BORDER effect. Flick the switch and observe the BORDER, if after turning the switch to the "upper" position the stripes shift down, then you can say with even greater confidence that the circuit is not only functioning normally, but also fulfilling its direct duties. Adjusting the delay time comes down to setting the optimal number of jumpers between the outputs of counters DDЧ,DDS (3, 2, 6, 7) and the inputs of the 8-NOT element (DD6 - 2, 3, 4, 5, 6, 11, 12). Each installed jumper has its own "weight coefficient" of time delay, so for each lower jumper (according to the scheme) the weight of the delay increases roughly twice compared to the upper one. "Playing" with the jumpers, you will notice that adding each new jumper increases the delay (shifts the BORDER effect down) and vice versa, with "lower" jumpers having a greater influence on the delay time. If, as a result of experiments with the jumpers, you cannot set the delay value accurately, it makes sense to "play" with capacitor C1, changing its capacitance in the range from 8 to 20 nanofarads - in this case, you can set the delay very precisely.
...
Here we come to the most important point. After adjusting the circuit for the first program, and loading another, you will be surprised to notice that the BORDER effect in the new program is shifted. This is especially noticeable if you tuned the circuit to the Academy program (Tau Ceti II), and then loaded VENOM STRIKES BACK (for those who haven't seen these programs (???) - in them, the BORDER effects are in opposite places on the BORDER - at the top and bottom). This is very "well" observed on the PENTAGON, which, as they say, "has no brakes at all." Thus, we return to the problem of line scanning...__________________________________________
The problem of line scanning...
It turns out that our homemade SPECTRUMs have another implicit "glitch".
Thus, during the construction of one raster line by the hardware circuit of the video controller (originally ULA), the number of microprocessor cycles for "Soviet" and "branded" SPECTRUMs is different. For example, PENTAGONS manage to perform more operations than SPECCY, while SCORPIONS, on the contrary.
This is influenced by factors such as the actual clock frequency of the microprocessor and the hardware design of the video controller. The actual clock frequency depends on the degree of "WAIT"-ing of the computer, i.e., on the hardware delays of the processor's operation. Such delays are generally undesirable, but paradoxically, in a real SPECTRUM, these processor delays exist. They occur when the processor and ULA try to access the video memory simultaneously - the processor according to the action program, ULA to read a byte of video memory for display on the screen. Preference is given to ULA in such a situation, and the processor "slows down". The same happens if the program is in the screen area - its performance decreases on average by 25% compared to a "normal" program. I repeat, this applies to standard SPECTRUMs and some models of domestic ("Leningrad", "SCORPION")... Rejoice, happy (!) owners of PENTAGONS!!! All the lines said above do not apply to you. The "Pentagon" is free from these "brakes". Programs on the "Pentagon" work uniformly throughout the memory, and the WAIT pin of the processor is not used at all. However, for everything, one must pay... at least for the fact that "branded" MULTICOLORs even with the scheme published here will only work in one part of the screen (about 12 character positions). For "Leningrad" users, accordingly, the picture will look better due to the WAIT stops of the processor, but it will also not be ideal. ----------------------------------------- Continuation of the adjustment. If you understood what I was trying to explain in the last "insert", then you probably realized that there is no way to make the "Pentagon" work like a real SPECTRUM. You can only approximate the phase of the INT signal so that at least partial "imported" MULTICOLORs and BORDER-SCROLLERS can be observed. Therefore, it is better to adjust the circuit to the middle of the screen (MONTE CARLO) or to the first line of the screen, i.e., to the first line in the screen area (SHOCK MEGADEMO, MULTICOLOR). There is also another "criterion" for adjusting the INT phase - by the absence of "trembling" sprites in CHASE H.Q.128 (main menu), or by the "presence" of a scrolling line in SHOCK MEGADEMO, part of GREETINGS.
So, having adjusted the circuit to your liking, you can solder short jumpers instead of debugging ones, and desolder the unused wires. Inputs to the microchip DDб, which will only be connected to +5V through resistors, can be combined and connected to the same +5V through one resistor.
----------------------------------------
Improvements to the circuit.
The operation of the delay circuit can be stabilized by replacing capacitor C1 with a quartz resonator with a frequency of 100-200 kilohertz. But in this case, the delay can only be "tuned" by "playing" with the jumpers. The accuracy and dosage range of the delay can be improved if, in addition to the jumpers, additional inverters (LN1, LN2) are used, connecting them between the outputs of the counters and the inputs of the 8-NOT DDб.
----------------------------------------
The syndrome of domestic MEGADEMO construction. Everything said below does not offend "our" coderob, take it all as a statement of fact... It is no secret to anyone in our country that the number of branded, real SPECTRUMs among domestic users literally drowns in an ocean of mutants, assembled in deep underground, stamped in serial production at various industrial associations. The palm of supremacy in the number of various "perversions" still belongs to the "Pentagon". There are many domestic MEGADEMs that PRINCIPALLY can only work correctly on PENTAGON. Let's put aside the topic of the "mythical" #FD port - that is a separate global problem. There are countless examples: ZY-ZY, INSULT, SATISFACTION, PSG-WINS, MENTAL MASTURBATION, ECSTASY,... What can you do, the PENTAGON has become a kind of standard for "tying" MULTICOLORs. Some may find it strange that the author has started rambling about our MEGADEMs when the article is not about that. But I am leading to the point that it is not for nothing that there is a tiny switch SA1 in the INT delay circuit, which disconnects the circuit from the processor. This is done precisely so that one can normally view MULTICOLOR, say in SATISFACTION, and in SHOCKe. Thus, we have come to the end.
══════════════════════════════════════════
* * *
__________________________________________
Instead of a postscript: For those who are not tired of reading this nonsense, I can explain in detail how the described circuit works. You should stock up on a copy of this circuit on a piece of paper and turn the page...
----------------------------------------
How "this" works... The entire circuit can be conditionally divided into four large blocks:
1. Trigger block (DD2.1, DD1.1, DD2.4, DD2.5, DD2.6, C2, R3, VD1):
2. Clock generator (DDЗ.1-DDЗ.3, C1, R1, R2):
3. Counting scheme (DDЧ, DDS, DDб):
4. Output INT signal generator (DD2.2, DD2.3, C3, R4, VD2).
With the arrival of an "abnormal" interrupt request at the input DD2.1, the state of the trigger DD1.1 is set to logic one. This will trigger the clock generator (5n.DDЗ.2=1) and unlock the composite counter with an initial zero state (14n.DDЧ, DDS=0). The generator is connected to the accumulation input (+1) of counter DDЧ.
Thus, the counting process begins - the outputs of counters DDЧ, DDS "iterate" code combinations in binary eight-bit code. This process will continue until the matching circuit, assembled on microchip DDб and the jumpers you installed, "catches" the last extreme combination of ones. If, in addition to the jumpers, you used additional inverters (which is more correct), then the extreme code combination (and thus the delay value) will be determined not only by the first "encountered" ones but also by the zero bits. If there has not been a match yet, then the output of DDб will be logic 1 - "no match".
When the required and current combinations match, a logic 0 will be formed at the output. The fact of the transition of the output DDб from 1 to 0 is registered by the short pulse generator on elements DD2.2, DD2.3, C3, R4, VD2 - at the output DD2.3 a "delayed" INT request is formed, which is fed to the INT input of the processor.
It should be noted that this generator completely replicates the scheme in the PENTAGON, so there is no reason to worry about the length of the short pulse - it will be the same (presumably normal) as before.
After the output signal is formed, the clock generator continues to operate correctly, and with its next clock pulse, another code combination appears at the outputs of the counters, one greater than required. In this case, the matching circuit (8n.DDб) again outputs logic 1 - "no match".
The fact of the transition of the matching circuit from 0 to 1 is "caught" by another short pulse generator (DD2.4-DD2.6, C2, R3, VD1), at the output of which a logic 0 pulse is formed. This pulse returns trigger DD1.1 to its initial state - at the output Q(5n.) a logic 0 is set, which stops the clock generator, at the output not-Q(6n.) a logic 1 is set, which resets counters DDЧ, DDS to zero. After that, the circuit is ready to receive a new request... That's all.
It should be noted that this scheme has one drawback - the delay value will "float" over a time interval equal to one period of the clock generator. Therefore, it is advisable to set the maximum possible frequency for the generator, and to tune the delays using the "higher" jumpers. If a quartz resonator is installed instead of capacitor C1, there will be no problems with "floating".
----------------------------------------
Goodbye once again!
══════════════════════════════════════════
* * *
Contents of the publication: Oberon #02
- Introduction
Introduction to the second issue of Oberon magazine, with insights into its delays and team expansion. The editorial team acknowledges past misunderstandings and introduces the new issue's contributors. Details on distribution, contributions, and user interaction features are provided.
- Scroll - Alex Noman
Game manual for 'Peking', detailing controls, menu options, and gameplay strategy, involving matching pairs of crates under time constraints.
- Scroll
Empire 128 is a strategic space game where players act as merchants dealing with an alien invasion. Gameplay involves trading, mission completion, and space exploration. The game requires 128K memory and offers both disk and RAM save options.
- Scroll
Description of various space ships, including their specifications, weapon systems, and purposes. Each model differs in speed, armament, and functionality. Includes notes on origins and uses.
- Review
Review of ZX Spectrum games and tools: Double Xinox 128 offers a modern twist on Xonix with 80 levels and new challenges. UFO 2: Terror in the Deep has multiple versions with improvements and issues noted. Shadow Dancer for ZX Spectrum shows graphical evolution but maintains classic gameplay elements.
- Review - Unbeliever
Analysis of the 1996 ENLIGHT demo competition in St. Petersburg, evaluating participants and results across platforms. Highlights the achievements and critiques of notable entries. Provides insights into the dynamics of the competition and perspectives on the ZX Spectrum demos.
- Our Response
Reader feedback and editor's response regarding magazine content, the need for more graphics, and the state of local Samara software distribution.
- About Everything
Critique of Sinclair software quality, concerns about poor programming affecting computer lifespan, and commentary on CODE BUSTERS group's practices.
- Educational Program - Paul Atrides
An in-depth examination of the eight essential stages of software development, from defining technical requirements to testing and distribution. The article provides insights into the necessity of each stage and critiques poorly executed examples. It emphasizes the importance of systematic programming for both commercial and personal software projects.
- Hardware
The article discusses synchronization issues in various Spectrum models and provides a circuit solution to correct INT signal delays for improved graphics performance.
- Announcement - M.M.A
Introduction of new column highlighting Samara programmers' works, detailing projects like ZX-WINWORD, UNRECOGNIZED FORMATTING OBJECT, and DESIGNER ANALYSIS FUNCTIONS. ZX-WINWORD aims to be a publishing system for Spectrum, while U.F.O. offers advanced disk copying. DESIGNER ANALYSIS FUNCTIONS aids in mathematical graphing and function analysis.
- Programming - Unbeliever
A humorous narrative featuring Stirlitz, a fictional intelligence officer, in absurd and surreal situations involving Gestapo, programming, and secret plans.
- Pogurammim - Unbeliever
A humorous and fictional narrative involving Shtrilitz's spy adventures during a covert operation with many unexpected turns and satire.
- Advertisement
Advertisement for electronics and components store offering used equipment, software, and literature.