General Category > LisaList2
An Arduino-Based Parallel Port Hard Drive Troubleshooter
rayarachelian:
--- Quote from: stepleton on October 01, 2021, 10:04:51 am ---A lookup table is an easy way to compute parity, but I'm guessing that you might find it irritating to spend 256 bytes of your available 8K.
--- End quote ---
You could also split the byte into 4 bit nibbles and then use only 16 bytes for the lookup table. You'd then XOR the two values.
Or more efficiently, you could do something like this from C:
--- Code: ---parity=(!!(d & 128))^(!!(d & 64))^(!!(d & 32))^(!!(d & 16))^(!!(d & 8))^(!!(d & 4))^(!!(d & 2))^(!!(d & 1));
--- End code ---
In Python, you can do this - though you'd probably be able to optimize it a bit, and admittedly, looks fugly. But it does work.
You can reverse (0,1) to (1,0) in every expression below to get even parity if (0,1) not compatible with the Lisa's parity circuit.
--- Code: ---parity = (0,1) [ ((128 & d)!=0)^((64 & d)!=0)^((32 & d)!=0)^((16 & d)!=0)^((8 & d)!=0)^((4 & d)!=0)^((2 & d)!=0)^((1 & d)!=0) ]
--- End code ---
Or (still python) if you're fine with a boolean result instead of 0 or 1, this is a bit cleaner:
--- Code: ---parity = ((128 & d)!=0)^((64 & d)!=0)^((32 & d)!=0)^((16 & d)!=0)^((8 & d)!=0)^((4 & d)!=0)^((2 & d)!=0)^((1 & d)!=0)
--- End code ---
This might help too: http://graphics.stanford.edu/~seander/bithacks.html#ParityMultiply if you can use a multiply in that microcontroller. This is even cleaner:
http://graphics.stanford.edu/~seander/bithacks.html#ParityParallel - in the case for the profile you can discard operations on the high bytes.
So just:
--- Code: ---uint8 parity(uint8 data) {
uint32 v=data;
v ^= v >> 4;
v &= 0xf;
return (0x6996 >> v) & 1;
}
--- End code ---
AlexTheCat123:
Thanks for all of the parity suggestions! Unfortunately, they were all too slow for the Arduino, so I ended up borrowing an LS280 parity generator from one of my ProFiles instead. Now that we have parity, attempting to boot from a ready-made Office System 3.0 image still gives the same 10707 error as before, but I do get a bit farther when trying to install LOS from floppies. Now the installer is able to make it through the disk erase/initialization process, but it always fails at some point during the actual installation (the farthest it's ever made it is to disk 4). When it fails, it either gives the same "can't write to the disk" error as before or it gives a message stating that there isn't enough room on the disk, which doesn't make any sense to me. It's weird that it can boot MacWorks Plus, MacWorks XL 3.0, the Cameo/Aphid Selector, and BLU just fine, but that LOS doesn't work. Hopefully I can figure this out!
rayarachelian:
--- Quote from: AlexTheCat123 on October 03, 2021, 12:36:54 pm ---Thanks for all of the parity suggestions! Unfortunately, they were all too slow for the Arduino, so I ended up borrowing an LS280 parity generator from one of my ProFiles instead.
--- End quote ---
Uh, that's a bit disturbing, so the q is, is it going to be fast enough to work as a profile emulator fully, if it can't do a few XORs and shifts?
--- Quote from: AlexTheCat123 on October 03, 2021, 12:36:54 pm ---Now that we have parity, attempting to boot from a ready-made Office System 3.0 image still gives the same 10707 error as before, but I do get a bit farther when trying to install LOS from floppies. Now the installer is able to make it through the disk erase/initialization process, but it always fails at some point during the actual installation (the farthest it's ever made it is to disk 4). When it fails, it either gives the same "can't write to the disk" error as before or it gives a message stating that there isn't enough room on the disk, which doesn't make any sense to me. It's weird that it can boot MacWorks Plus, MacWorks XL 3.0, the Cameo/Aphid Selector, and BLU just fine, but that LOS doesn't work. Hopefully I can figure this out!
--- End quote ---
Do you know what state in the state machine of the write it failed in?
see: http://john.ccac.rwth-aachen.de:8000/patrick/data/profile_write_cycle.png
AlexTheCat123:
--- Quote ---Uh, that's a bit disturbing, so the q is, is it going to be fast enough to work as a profile emulator fully, if it can't do a few XORs and shifts?
--- End quote ---
I'm definitely pushing the limits of the Arduino with this project! Adding parity calculation causes it to start occasionally missing /PSTRB pulses, but it's really reliable as long as it doesn't have to calculate parity.
--- Quote ---Do you know what state in the state machine of the write it failed in?
--- End quote ---
The weird thing is that it doesn't fail during a write. The Office System just gives up in between writes according to the logic analyzer. When I look at the writes that occured immediately before it gives the error, they all seem to be perfectly normal, so I don't really know what's going on.
During my troubleshooting, I decided to change the spare table so that my device reports itself as being a 10MB ProFile instead of a 5MB ProFile and now the Office System installs and boots just fine! It boots up pretty fast (around 40 to 45 seconds) and it seems to be quite stable. I have no clue why making it a 10MB drive would cause it to start working, so I'll definitely have to look into this more tomorrow!
rayarachelian:
--- Quote from: AlexTheCat123 on October 03, 2021, 06:49:57 pm ---I'm definitely pushing the limits of the Arduino with this project! Adding parity calculation causes it to start occasionally missing /PSTRB pulses, but it's really reliable as long as it doesn't have to calculate parity.
--- End quote ---
You might be good now, but it means you can't upgrade this thing or add much else to it. So it's gonna be a dead end. Might want to consider the next model up.
--- Quote from: AlexTheCat123 on October 03, 2021, 06:49:57 pm ---
--- Quote ---Do you know what state in the state machine of the write it failed in?
--- End quote ---
The weird thing is that it doesn't fail during a write. The Office System just gives up in between writes according to the logic analyzer. When I look at the writes that occured immediately before it gives the error, they all seem to be perfectly normal, so I don't really know what's going on.
During my troubleshooting, I decided to change the spare table so that my device reports itself as being a 10MB ProFile instead of a 5MB ProFile and now the Office System installs and boots just fine! It boots up pretty fast (around 40 to 45 seconds) and it seems to be quite stable. I have no clue why making it a 10MB drive would cause it to start working, so I'll definitely have to look into this more tomorrow!
--- End quote ---
This sounds more like LOS thinks the drive is shared with MacWorks, but doesn't have enough free space.
Or maybe the spare table is incorrectly formed for 5MB and reports too many spared blocks?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version