Software detection of IDE model

ZXNet echo conference «code.zx»

From Alexandr Sinyakov To All 13 February 2007

Hello, All Let's move on... Is there some way to programmatically determine which IDE circuit is connected (or is it connected) to ZX? There is an idea - read the IDE status register and check if the device is busy. But SMUK and the ATM controller work through shadow ports, but for me the doubt is closed that in every TRDos there is in a, (c); ret one at a time and the same address.

From Alexandr Sinyakov To All 13 February 2007

Hello, goodboy goo> can first check for the presence of in a,(c) in the TRDOS ROM ? goo> hl,#xxxx goo> c,#13 goo> call #3d13 goo> goo> 16 bytes from the address in HL will be transferred to #5cdd Wow, I didn’t even think about that! I started looking for ldir:ret... Thanks for the reminder. 2 EARL There is no need to go in cycles. You can count several thousand times. If it's still busy means he is not there.

From goodboy To All 13 February 2007

Hello, EARL Can you first check for the presence of in a, (c) in the TRDOS ROM? hl,#xxxx c,#13 call #3d13 16 bytes from the address in HL will be transferred to #5cdd

From Dmitry Limonov To All 13 February 2007

Hello, SAM style If you read the status register and check if the device is busy like this: ┌─- CODE ─── NO_BSY LD BC,#FFBE CALL IN_A RLCA RET NC JR NO_BSY IN_A - controller register read function └── CODE ─── If there is no controller being checked, this will lead to a loop. I suggest doing the following: select the first device on this controller and we write, for example, some value to the sector register, and then check it contents, then do the same for the second controller device. There is one big drawback if no device is connected to controller being tested, but it actually exists, then we will not define it. For NEMO and NEMO A8 controllers need to carry out an additional test to clarify specific scheme. I did this: 1. Choose any NEMO/NEMO A8 model 2. We fill a buffer of 512 bytes with the value #FF 3. Issue the command #EC (Drive Identify) to the controller 4. Read the data block into our buffer 5. Check the value in the buffer at offset 256. If this value differs from #FF (I don’t remember why, but in this place if reading is successful there will definitely not be #FF), then we have the selected model, otherwise we have a different model PS. Due to the lack of a real machine with any of the IDE controllers at hand all tests were carried out on the Unreal Speccy emulatorP.P.S. If anyone is interested, I can post the implementation of everything in the evening described above for NEMO, NEMO A8 and SMUC models.

From Alexandr Sinyakov To All 14 February 2007

Hello, EARL However, the program is good. It even gave me some ideas. And the control is simple by changing the sector register (as was done at the beginning of each program) isn’t it will it take you for a ride? By the way, I don’t have to determine whether there is a screw (and with a CD/DVD program, it seems, will not work, because the #EC command is considered an error there). The main thing is detect the circuit (or lack thereof) and configure the driver, through which then ATA devices will be detected.

From Dmitry Limonov To All 14 February 2007

Hello, SAM style Here is the promised code. I actually had to rewrite it a little, but everything seems to work (tested in Unreal Speccy 35B). You need to call the detect_ide function, which is register A returns the detected interfaces in a bitwise representation: 0 - SMUC 1 - NEMO A8 2 - NEMO goo> can first check for the presence of in a,(c) in the TRDOS ROM ? goo> hl,#xxxx goo> c,#13 goo> call #3d13 goo> goo> 16 bytes from the address in HL will be transferred to #5cdd You should add this check before calling detect_ide! File: ide_detect.rar http://zx.pk.ru/attachment.php?attachmentid=4594

From Dmitry Limonov To All 14 February 2007

Hello, SAM style SAM> However, the program is good. It even gave me some ideas. Thank you! This is a piece of code cut and forwarded from my unfinished BIOS, which supposedly should work on all machines with any iron, but I never finished it. SAM> And control by simply changing the sector register (as done in SAM> at the beginning of each program) won't it work? I think not, because if the device is not connected to the one being tested controller, then when reading the sector register the same is always returned value (either #00 or #FF, I don’t remember now) and it cannot be changed! Therefore you have to go through all the circuits and all the devices for each of them (Master/Slave). Otherwise we won't determine anything. SAM> and with CD/DVD the program, it seems, will not work, because there is a command SAM> #EC is considered an error Well, yes, only in this case can you read the value from the cylinder register (before by writing there something other than #14EB) and, if it is equal to #14EB, then we have there is a CD-ROM, and therefore the controller itself!