In the Schneider computers with 3-inch floppies, floppy disks — as with many other computers — can be made write protected by flipping a small lever on the floppy disk. This write protection can also be queried from Basic with the following short machine program. When entering the program, you have to decide whether you want to type in the source code of the machine program or the Basic loader with the DATA lines. The Basic Loader also gives some operating instructions and generates freely movable machine code and always stores it exactly under HIMEM. In this way, the "space sacrifice" can be limited to 80 bytes. After initializing the RSX extension, a new RSX command is available:
|DISC. WP "WP" stands for "Write-protected". After entering this RSX command, you can query the memory location 356, which is usually not used by the computer and is therefore available for our purposes: A=PEEK(356) If A=0, then the write protection on the floppy disk is not engaged; a value of 255, on the other hand, indicates that the write protection is set. This program can be used profitably, for example, in programs that use floppy disk drives. At least with the CPC-464, it is not possible to catch error messages from the floppy in Basic! Try ON ERROR GOTO: this command is ineffective in case of floppy disk errors! With DISC. WP you can at least rule out this - particularly annoying - source of error. The functionality of the program should be of particular interest to advanced machine programmers:
Like almost all peripherals connected to Z80 computers, the floppies are also managed via the Z80 ports. These are input and output channels for the CPU to communicate with other ICs and devices. This is exactly how the FDC (floppy disc controller) 765 is controlled: The port address &FB7E manages the main status register of the controller, the address &FB7F the data register. If the command bytes &04 and &00 are output via the data port, the FDC reads its status register 3, in whose bit 6 the WP flag is located. The contents of the register are sent to the data port and can be read there with an IN command.
Like almost all peripherals connected to Z80 computers, the floppies are also managed via the Z80 ports. These are input and output channels for the CPU to communicate with other ICs and devices. This is exactly how the FDC (floppy disc controller) 765 is controlled: The port address &FB7E manages the main status register of the controller, the address &FB7F the data register. If the command bytes &04 and &00 are output via the data port, the FDC reads its status register 3, in whose bit 6 the WP flag is located. The contents of the register are sent to the data port and can be read there with an IN command.
einfach ist die Sache aber doch nicht: Der Floppy-Controller ist für Maschinenprogramme zu langsam! So muß zuerst festgestellt werden, ob der FDC ein „Request for Master“ schickt, eine Art Bestätigung der Empfangsbereitschaft. Außerdem muß man nach jedem Byte, das auf den But it's not quite that simple: The floppy controller is too slow for machine programs! For example, it must first be determined whether the FDC is sending a "Request for Master", a kind of confirmation of readiness to receive. In addition, after each byte that is given to the data port, you have to give the floppy controller time to provide the required information. The easiest way is to look at the helper routine in a ROM listing of the floppy operating system from the address &C95C and use it in your own program!
M. Kotulla/LM, Computer Show
- DIVERS -
RSX command : |DISC.WP
PEEK(356)=0 is Disc is normal and PEEK(356)=255 write protected.