PC Duet is a Russian clone ZX Spectrum 48k, produced by Lianozovo Electromechanical Plant (LEMZ). This is my very first computer and it is with me so far. From a young age I began to comprehend the basics of programming, microprocessor architectures and the design of digital circuits. But since then the question has not given me rest: where is the system monitor? After all, it is mentioned in the documentation. In the standard ZX Spectrum, I do not recall the presence of any system monitor. And in the documentation about the system monitor no more words. There is a Monitor for 48k
in the ROM version from 1990 . However, after switching on, the PC Duet displays on the screen instead of the standard greeting -
"() 1982 sinclair research ltd" another greeting:
"() DUET" . And this means that the ROM is still changed there. Or maybe there is a hardware monitoring capability? For example, the
Orel clone
BK-08 has a number of improvements: shadow RAM, NMI button and monitor MZ80. It would be very interesting, after so many years, to find some hidden possibilities of your piece of iron.
Finally, I found the answer to a question that periodically worried me all these years.

Why now?
As you know, Spectrum - almost incurable. And long periods of remission can be replaced by exacerbations under the influence of external factors: an article, a
Spectrum jubilee , and here you are again
on the forums , again there are
Spectra from the shelf on the table (of which
not one and
not even
two )
turn on and
work (or not ). And then, gradually lets go. But some questions remain unresolved and they hang somewhere deep in the subconscious and each time they strive to get back. They are not solved, as a rule, due to the hardware irrelevance of the platform (which is actually debatable). And what if the resolution of long-standing questions, problems or desires, even if they are no longer relevant now, can please the present? After all, now it is easier to do. I think it's worth a try!
')
Another coming issue of the monitor
For the first time I asked myself a question about the monitor almost immediately after purchase, but I never found the answer. Already in our time, at the beginning of 2016, I tried to
find out on the forum , but the answer was again not found. The question would have been forgotten, but by chance I came across an advertisement for the sale of a clone of the Spectrum -
“Nafanya” , and there was a photo of a documentation page in which it was written:
“The ROM contains the BASIC interpreter and the system monitor” . Well, we decided to still understand and put an end to this issue

Comrades in the forum gave advice:
Most likely, a system monitor is a set of standard ROM routines. Try:
1. look at the installed ROMs on the board, it seems that you have 2 pcs of 8K, this is 16K, if there are no additional ROMs, then you need to search among the available 16K.
2. merge the dump of the ROM and compare with the standard Sinkler, usually only the inscription in the clones changed. According to the differences, you can estimate whether there is something interesting.
Well, it can not be that everything is so simple! The study of the
scheme showed that there are no additional ROMs there: two 8KB ROMs (making up the standard 16kB ROM with a basic). Judging by the
photograph of the viscera of my specimen, my version is no different from the scheme on the site (in fact, there are minor improvements / changes, about which, perhaps, another time). Thus, the hardware capabilities for the existence of the monitor is not detected.
We verify ROM dumps
In order to merge the dump and verify it with the original, you need to do the following steps:
1) Get the data from the ROM on the PC Duet. Removing the ROM from the board and use the programmer for this is not required. For the simple reason that the ROM in the 48k version is entirely mapped into the
address space at 0..16383 . This is the lowest address space. It can either be read programmatically or saved via the tape output by the
SAVE "ROM" CODE 0, 16384
BASIC team.
2) Convert data from a sound file to a TAP file using a PC utility
3) Extract data from TAP format to binary format
4) Write or find a utility to compare byte-by-byte two binary files - from the Duet and from the original Spectrum.
Already at the first stage, I rejected this idea, because the laptop does not have a line input, and the adapter is soldered only in the direction of sound playback on a PC or smartphone via a line output for connecting the PC Duo input. Because 99% of the time now is downloading data to the Duet, and not vice versa.
Therefore, I decided to do exactly the opposite. Get the original ROM and load it into the Duet's RAM via a tape-in. Then write a program to verify data in memory cells with the output of information of different cells. Binary data of the original ROM is in almost every ZX Spectrum emulator. But to translate them into sound, for later downloading via a tape-in ​​input, I had to tinker a little. I went through 3-4 programs before I could make a TAP file from a binary file. Then it's easier - with the help of the utility Tape2WAV received sound files.
To load data from a tape recorder in BASIC ZX Spectrum, the LOAD command is used, with parameters that indicate that the code is loaded, and what memory address to load it, respectively, the
LOAD "" CODE 40000
loaded the data of the original ROM into memory, starting at address 40000 .
Writing a program to verify the memory
I happily rub my hands, because I have to remember my school experience and program under the ZX Spectrum, and on it myself! And, by the way, what is there to remember? BASIC is impossible to forget, the more so simple. It is difficult to make a mistake in a set of commands, because each keystroke immediately enters a whole command. Quick and convenient as T9, only for BASIC! I also want to say that it is not convenient to use 48k BASIC on the emulator, due to the fact that BASIC commands are not signed on modern computers. One more plus even of such a small car as 48k: we are immediately ready to work after switching on. No development environment, no compiler required. All that is needed for work is in the ROM.
BASIC inside the ZX Spectrum is interpreted. This reduces the speed of the programs. But to write such a simple and speed-critical program in assembler - I think this is already overkill. The program is written in 5 minutes. And even if it works the same, it will suit me. But it turned out that it took even less than five minutes:

In the screenshot, the program I typed in the emulator (just to take a screenshot of the source code). The same program I typed on the Duet. On top of the screenshot, I signed data on the differences found in memory cells. Well, there are not so many changes. Now you need to understand what touched these changes. To do this, you need to know what is in the ROM at the addresses found. Fortunately, all the information is in the book
"Full disassembler ROM ZX-Spectrum" in Russian .
Cell 109 - in the original ROM 40d in Duo 32d
006d 32 instead of 40. So 20h (JR nz, *) instead of 28h (JR z, *), and in the book jr nz.

As it turned out, in the original version of the ROM from 82 years old, an error was made in this place. This is a nonmaskable interrupt handling code. Without this error, you can set the address of the transition to the processor in the
NMIADD variable, for example, the same monitor. And by the NMI signal (using the NMI button, like on
Orel BK-08 ), the computer would switch to this handler. Corrections at this address indicate that in the Duet this error has been corrected and the NMI signal can be fully used. Well, it's not bad anymore, but judging by the number of remaining changes in the ROM, the monitor code is not sewn into it all the time :(
Expected, 4 bytes is “DUET” instead of (C) 1982 Sinclair Research Ltd
1539 (C)
153A " "
153B 68 "D"
153C 85 "U"
153D 69 "E"
153E 212 . . 212d + 80h = 54h - "T"
(MESSAGES - Each message is issued with an inverted last character (+80, hexadecimal).
Monitor not disagree?
Unfortunately, I did not find any system monitor debugger, although I tried very hard. But I am very glad that I could find out on my own ... But. But what is a "system monitor"? Why is it written in the documentation for the Duet and Nathan? As it was written above,
“Most likely, a system monitor is a set of standard ROM subroutines” . Also, in the book with the complete disassembler of the ZX Spectrum ROM, we can read the following:
...
ZX SPECTRUM
...
Spectrum, 16K,
Z80. :
. /.
. BASIC.
. .
, ,
10 . .
In recent years, when someone writes about the ZX Spectrum, then the contents of the ROM, he will most likely name the OS ZX Spectrum - this is the built-in BASIC. But in those days, apparently, this concept has not yet been formed. There were small programs - monitors for viewing and changing the contents of memory cells in HEX form. Used to debug programs in machine codes. Compared with them, the Spectrum "monitor" was very cool. And what we now call the "monitor", then more often called the "display".
Thus, there was some change in the meanings of the concepts. The monitor then and the monitor now are different concepts. So, we can assume that the monitor is still found :) Or maybe someone has additional information?
LinksZX Spectrum for users and programmers - system variables - NMIADD
ZX-Review 1991 â„–1 - Secrets rom - NMIADD and an error in the ROM
Microprocessor kit Z80. Book 1. 6. System interruption. - about NMI
"Complete disassembler ROM ZX-Spectrum" in RussianZ80 Instruction table