Hi,
I'm back (I've been re-installing Win'95 on my PC after a motherboard
exchange (upgrading from 486-66 to Pentium MMX-200 ;-), all working
fine again)
CLAUDIO MASSAO KAWATA <[EMAIL PROTECTED]>
wrote:
> > Sure you can't destroy MSX hardware by a simple
> > programming trick! (prove me wrong) (...)
>
> Okay, I'll try: have you read documentation about
> PSG register #7? It follows:
>
> 7 6 5 4 3 2 1 0
> joystick C B A C B A
> control -- noise -- -- tone --
> bits
>
> The joystick control bits are connected to some
> active electronic components (transistors or ICs). Bit
> 1 means output, 0 is input. They must be ever set to
> "10xxxxxx". However, if it is made something like
> "11xxxxxx", you will have both signals set to output,
> causing an internal (PSG) and external (coupling
> circuitry) short-circuit! I have heard from half a dozen
> people that they tried it home and nothing happened. On
> the other hand, I have read A LOT of complaints like
> "can't use joystick in game X" or "my MSX resets after
> loading opening" or even "it takes half an hour to restart
> my MSX if I run game Z". Funny? Not at all. Some of that
> problems are caused by wrong set-up of PSG R7. Some MSX
> don't have any protection against stupid programmers that
> haven't read MSX data books before starting to set-up PSG
> registers. The result is that there are many, and I mean
> MANY, games that set those two bits wrong! Most MSX won't
> complain if the joystick control bits are set wrong (at
> least, not immediately - it takes some time to stress the
> circuitry to the point of hardware failure), but it's not
> worth to risk burning some MSX circuits running programs
> that does that. Once my turbo R restarted and got a
> "strange behaviour" after testing one of such games. I
> debugged it and found the "hazardous bug": it set both
> bits to 1 when restarting the music routine.
You're right!
I hoped no-one had noticed it, not to encourage people (or
virus-writers?) to try and damage their or somebody else's MSX this
way, but you're right.
Exact conditions would be: PSG-register 7, bit 6 set to "1" (x1xxxxxx
binairy), which sets PSG-port A (reg.14) as output, and writing
different values to the output pins (through reg. 14), then what is
read as input.
No problem for port B, as this is normally already used as output, so
if you switch that to input, nothing much will happen.
Bit 6 of PSG-port A (some signal used in Japanese machines, as
mentioned earlier) might be most badly affected by this, as it might
be hardwired to GND or +5V, making a short-circuit more harmfull.
The other pins (bit 0-5, and 7 (cassette input signal)) will usually
be connected to some output pin of another IC, which might limit the
short-circuit current, or divide the resulting heat production over
the IC's involved.
I think you can consider this a hardware design error. As a
design-rule, it is not allowed to connect outputs to each other,
if it's possible that these could have different states, as is the
case here (and under the programmer's control).
For safety, inputs that can be set as outputs under program control,
should be considered as outputs.
Some exceptions (inputs tied together as well, open-collector
outputs, etc.) exist, but don't apply here, so this should
definitely be considered a hardware design error.
In this case, this could have been done better by for instance
including some series resistors between these pins (values for
instance 470 or 1kOhm).
If used for input, this need not affect the correct function, if
switched to output, this would limit the short-circuit current to
no-problem levels.
But:
It's still very unlikely for permanent hardware damage to result from
this. Damage from short-circuits is usually in one way or the other,
the result from a local overheating inside some IC, or other part,
causing some permanent change to the semiconducting material.
This even applies to for instance static discharges, any damage here
would result from a small amount of heat, released in a very short
time, confined to a very small area.
Absolute worst condition here would be this port set to output, and
all output pins set to a state different from what is read as input.
Typical short circuit currents for such IC outputs are in the range
of around some 20 milliAmps (maybe more, maybe less).
If this would occur to all eight pins, this would mean an extra heat
production of eight pins x 20 mA x 5 Volts = 800 milliWatts (0,8 W)
This is somewhere in the neighbourhood of what would be a maximum
allowed heat production for an IC like the PSG (or similar).
Although not really healthy, this would still very unlikely be the
cause of permanent damage.
All differences from this, would make this less critical:
-All outputs pins under worst condition will in practice never occur,
unless some program would try this on purpose
-The short circuit current might be less (yeah okay, more as well)
-If the maximum output currents are somewhere equal to those of
the other IC's the PSG is connected to, this would be divided
over these IC's.
-It only lasts until the next reset of the machine, or till some
program sets it straight again (like a call to BIOS-routine
initialising the PSG? This occurs with every beep that follows an
error, for instance).
This could explain the problems with un-correct functioning of these
ports after such a program, even for a while after that (because
things might have heated up nicely in the mean while).
This would seldom explain a reset or crash of the machine, unless it
uses some turbo-circuit:
In that case (if the PSG was included in some MSX-engine), the
heating up of this engine might make it function slower than before,
and not reaching the speed it was used on before (on about room
temperature).
At lower speeds, this would still be within limits, because of the
large margins that usually exist.
As a hardware design mistake, this can happen ofcourse.
But if the PSG was included with those 'other' IC's together in one
IC, and this would still work exactly the same way, I would consider
that a big, bad mistake in that IC's design.
Here, this function should be hardwired in such a way, that maybe the
bit in the PSG-register involved might be changed, but not setting
these inputs to output, if they only have use as inputs (go complain
to ASCII or Sony, or whatever, about that).
> There is a similar problem with the PPI, about the
> keyboard control bits, but I cannot remember it by heart.
> Some say it requires that the user types something to
> actually cause the short-circuit, but what if there are
> active circuits, like multiplexers [the Brazilian Expert
> does!], connected...? And they are just programming
> "tricks"!
Not really.
For the keyboard, you usually have a 'de-multiplexer', which
functions as follows:
This would for instance have 16 outputs, of which one has a
different state from the other output pins. Which one, would be
selected by 4 input signals (=the keyboard-row selected, 2^4 gives 16
different states for the de-multiplexer outputs).
This single selected output is then fed to one row of keys (the
other outputs to other key-rows), where the return signals are
connected to some inputs (PPI pins are used for that).
If you would set these PPI pins as outputs (possible), and give the
output pins different states, any short-circuit would only involve a
single output pin of this de-multiplexer (if an output PPI-pin state
of "1" would interfere with a de-multiplexer output of "0", than this
would never interfere with the other de-multiplexer pins, because
they would have the other state that doesn't cause this
short-circuit).
On the side of the PPI, this would also involve only one pin, or be
divided among several, but still a one-pin short circuit current).
And this would only occur if the right keys are pressed to make the
connections.
One way or the other: surely never causing permanent damage, or have
lasting effects.
There is one problem with this matrix-construction used for the
keyboard, and that is that some special combinations of keys pressed,
cause other keys to be 'seen' as being pressed, even if they're not.
Find some book showing a MSX keyboard matrix, and try pressing 3 keys
in a 2x2 block in this matrix at the same time, this might give the
effect of the 4th key in this 2x2 block being pressed, even though
it's not... Maybe that's what was meant above?
Greetings,
Alwin Henseler ([EMAIL PROTECTED])
http://huizen.dds.nl/~alwinh/msx (MSX Tech Doc page)
aaahh, finally they made an increase in the web-space I have there,
giving me some more room for new uploads... =;-))
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****