View Single Post
Old 11 May 2014, 10:30   #6
Toni Wilen
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,674
Of course it isn't AGA (A1200 didn't exist when demo was released, few months too early)

Anyway, because hanging bad wait code is used for disk stepping delays (and probably other disk delays), hang or not hang situation depends on lots of variables, including external variables like rotation rate of floppy and relative position of sectors between tracks.

Any kind of configuration may or may not hang. It is completely accidental if it works. Running it on my real A500 hangs slightly later than currently in emulation but it probably hangs differently if different disk drive is used, for example.

Code that hangs is simple:

start CIAB timer B
btst #1,$bfdd00
beq.s loop

Module player uses also CIAB timer A and interrupts. Module player can interrupt above waiting loop which isn't a problem because CIA interrupts have small delay which allows btst to always notice set bit before interrupt starts. (also CIA chips seem to have undocumented feature, interrupt line seem to never activate during CIA access = CS line is active)

There are also situations where vblank interrupt interrupts above wait loop, still not a problem. Vblank does not touch CIA registers.

It hangs when vblank interrupt that interrupted above wait loop gets interrupted by module player CIAB timer A interrupt. Module player interrupt clears CIAICR = waiting loop never sees bit 1 set anymore. Infinite loop.

Above wait loop should have tested CIA B timer B status bit, not interrupt status which clears when read.
Toni Wilen is offline  
Page generated in 0.05049 seconds with 9 queries