[hatari-devel] behaviour when RS232 is not emulated

Nicolas Pomarède npomarede at corp.free.fr
Mon Dec 5 00:39:06 CET 2011


Hello

some games ('Treasure Trap' and 'The Deep' for example) are writing 
messages or debug informations to the rs232 port. Those are not required 
to play the game, but the program will loop until it can successfully 
send the bytes.

It's not obvious for users to know that settings should be changed to 
enable RS232, especially since it has no real purpose (and this kind of 
option can confuse the user).

So, it would not be a problem if bytes written to $fffa2d were lost 
(RS232_TransferBytesTo() already handle this), but the problem is when 
reading the status in $fffa2d.

for example, this is the code in "The Deep" :

000033e2:  MOVE.B $00fffa2d,D0
000033e8:  AND.B #$80,D0
000033ec:  BEQ.B #$fffffff4 == 000033e2 (TRUE)
000033ee:  MOVE.B (A7,$0001) == $00003b8f,$00fffa2f

So, unless bit 7 in $fffa2d is set to 1 (buffer empty), this will loop 
forever.

In the case where rs232 is not enabled, we do :

void RS232_TSR_ReadByte(void)
{
         if (ConfigureParams.RS232.bEnableRS232)
                 IoMem[0xfffa2d] |= 0x80;        /* Buffer empty */
         else
                 IoMem[0xfffa2d] &= ~0x80;       /* Buffer not empty */
}

I think it would be better do always "|= 0x80" to report an empty buffer 
(which is more or less the case when rs232 is disabled).

This way, programs will consider bytes are always sent and games that 
don't require send/receive capabilities will still work without enabling 
rs232.


As I didn't write this part, does someone have any objection on this, 
any side effect I don't know ?

Regards

Nicolas



More information about the hatari-devel mailing list