Dumping/reverse engineering MSX models thread

Page 22/24
15 | 16 | 17 | 18 | 19 | 20 | 21 | | 23 | 24

By Manuel

Ascended (18855)

Manuel's picture

14-02-2022, 22:20

Grauw wrote:

Specifically for the expanded I/O ports test, if you write 0 to 40H and read anything back other than 0FFH, it similarly indicates there is a floating bus. But of course it could be returning 0FFH by chance. So as the tester scans through all the device IDs, probably worth flagging how many of those return a non-0FFH result in addition to which it does return the exact complement for. Then if those numbers don’t add up you know the match is probably a coincidence.

By the way, I think it is valuable documenting which machines have a floating bus, and emulating it.

10 'Check for device IDs present on the switched I/O ports
20 'By FRS, 2015-11
30 CLS:DEFINTA-Z:PRINT"Switched I/O ports scanner v1.0 by FRS"
35 F=0
40 FOR M=1TO255
50 OUT&H40,M
60 IF (INP(&H40)XOR255)=M THEN F=-1:PRINT"ID=";M;"found"
70 NEXT M
80 IF NOT F THEN PRINT"No Switched I/O IDs were found."

This is the program used. Perhaps someone could enhance it and feed it back to FRS :)

By Grauw

Ascended (10604)

Grauw's picture

15-02-2022, 10:49

Something like:

60 I=INP(&H40):IF (IXOR255)=M THEN F=-1:PRINT"ID=";M;"found" ELSE IF I<>255 THEN F=0:PRINT"ID=";M;"unexpected";I;"floating?"

Should print out extra lines when a non existent switched I/O ID does not result in 255.

By sdsnatcher73

Prophet (3388)

sdsnatcher73's picture

15-02-2022, 09:03

All ID's return 120 exempt ID 135 which says found.

By Grauw

Ascended (10604)

Grauw's picture

15-02-2022, 10:11

There you have it, so the bus seems to always read 120 when it is floating (at least in this test). 120 is the complement of 135, so the hit on switched I/O port 135 is a false positive.

Did you test on the Mitsubishi ML-8000 or the Sanyo MPC-2 (or both)?

Can you do the ?INP(0) test as well just to confirm there’s nothing unusual on I/O 40H?

By Grauw

Ascended (10604)

Grauw's picture

15-02-2022, 11:17

And as for a little possible explanation “why 120 on both machines if it’s unpredictable”; The opcode of IN A,(C) is ED 78, and the hex value of 120 is 78H, which matches the second byte of the opcode. Probably not a coincidence that this matches the value that was read back.

Although reads of a floating bus can return all manner of different things depending on electrical characteristics of the machine and capacitance and all that, it’s not completely random either. The data bus is not pulled high nor low so it kind of floats about. If you ever saw the oscilloscope view of a data line without pull-ups in a Youtube video (like on Noel's Retro Lab or Adrian’s Digital Basement), you’ll recall that the bus assumes strange analog values while it’s floating that is definitely not a nice digital square signal anymore. And depending on the time since the bus was last driven, and the capacitance and thresholds of the chips connected to the data bus, this can return either a 0 or a 1, but at least for a short while it is also possible that it still reads the previous value that was on the bus.

By sdsnatcher73

Prophet (3388)

sdsnatcher73's picture

15-02-2022, 12:36

Makes sense, this was the ML-8000. I don’t have a MPC-2 at the moment but it seems that these are similar in design on this front.

By sdsnatcher73

Prophet (3388)

sdsnatcher73's picture

15-02-2022, 12:44

Is it safe to assume there are also no pull-up/down resistors on the address bus? How long should we expect the value on such busses to persist? The 78 instruction was fetched from memory (BIOS I presume). What is the ROM chips behavior? It will be asked to supply a specific memory location, put its value on the data bus, then CS will probably be lowered for that chip and it disconnects from the bus? Is that even possible? Or will it stop driving the bus?

By sdsnatcher73

Prophet (3388)

sdsnatcher73's picture

15-02-2022, 12:49

BTW the machine has 4 8kB EPROMS! Have not seen that a lot in an MSX…

By Grauw

Ascended (10604)

Grauw's picture

15-02-2022, 14:45

sdsnatcher73 wrote:

Is it safe to assume there are also no pull-up/down resistors on the address bus?

Yes, although that doesn’t really matter since the value on the address bus can’t be read by programs in any way, and in the MSX architecture the CPU is the only one driving the address bus, too.

sdsnatcher73 wrote:

How long should we expect the value on such busses to persist?

I can’t tell, it is really down to low-level analog electronics behaviour. It can in theory even differ between machines of the same model, e.g. if during their lifecycle they changed the brand of the ROM, CPU or other chips connected to the bus, or they were produced by a different fab, or with NMOS or CMOS technology, etc.

sdsnatcher73 wrote:

The 78 instruction was fetched from memory (BIOS I presume). What is the ROM chips behavior? It will be asked to supply a specific memory location, put its value on the data bus, then CS will probably be lowered for that chip and it disconnects from the bus? Is that even possible? Or will it stop driving the bus?

Yes, after the CPU’s read request ends the ROM chip enable pin is turned off and the ROM chip will no longer drive the data bus. Disconnecting from the bus and stopping driving the bus is the same thing. The address and data bus lines are tri-state, that is they can be driven low, high, or floating (not driven). Without this third state it would not be possible to connect multiple devices to the same bus, as when two devices drive the bus simultaneously with different data, you get a bus conflict (a short circuit).

What pull-up resistors do, is that when the bus is not driven, they pull the signal back to VCC (+5V). When the bus is driven, the pull of the pull-up resistors is overridden by the the device that drives the bus because it gives a path of lesser resistance for the current to flow. So the pull-up resistors make the voltage on the bus more well-defined when nothing is connected.

By Manuel

Ascended (18855)

Manuel's picture

15-02-2022, 22:19

Thanks for clearing that up guys Smile So, ID 135 is probably always a floating bus effect, right?

Page 22/24
15 | 16 | 17 | 18 | 19 | 20 | 21 | | 23 | 24