Re: visual 6502 simulation...

From: Wolfgang Moser <womo_at_news.trikaliotis.net>
Date: Fri, 17 Sep 2010 12:55:51 +0200
Message-ID: <i6vhfm$kkq$1@vs5413.trikaliotis.net>
Hi Olaf,

Rhialto schrieb:
> On Thu 16 Sep 2010 at 21:47:21 +0200, Wolfgang Moser wrote:
>> Ethan Dicks schrieb:
>>> On 9/16/10, Rhialto <rhialto@falu.nl> wrote:
>>>> Speaking of shift register bugs: there is this one that I don't remember
>>>> being explained. If you enable sound on a PET, then try to load anything
>>>> from cassette, the PET hangs. The STOP key does not work, nor does
>>>> anything actually load.
>>
>> this is _the_ 6522 shift register bug that also was the main cause for
>> the 1541 being throttled that much.
>>
>> And it has been exaplined in depth. I cannot tell you the exact forum
>> link at 6502.org, but I believe it was Garth Wilson who gave a thorough
>> explanation how a decent state of the Phi clock affected sampling of the
>> serial input, when external clocks were used. Have a search there.
> 
> I think we're not talking about the same thing. The VIA shift register
> isn't used for tape operations. The timer is likely used, though.

I see. Mainly I recognised "sound on a PET" which is one of the first
things where users recognised some buggy behavior that could be traced
back to the VIA.

> I found this thread, where the poster basically asks the same questions
> as I did, but his question doesn't seem to get answered. The discussion
> digresses mostly to the same shift register bug you mentioned too.
> 
> http://forum.6502.org/viewtopic.php?t=1514&highlight=shift+register+bug
> 
> Garth Wilson has a post in that thread, and he says 
> 
>     I haven't looked at what the Commodore firmware was doing; but since
>     you pretty much have to use interrupts to get the sample spacing
>     consistent enough for audio, I suspect the problem was that leaving
>     the audio running while you're trying to read data from tape left
>     the two jobs competing for exact time slots. If the tape routine
>     used software timing loops, it wouldn't stand a chance. This is
>     separate from the SR's bug.
> 
> which doesn't seem to hit the nail on the head, because PET audio
> doesn't use interrupts (just the shift register free-running, shifting
> the same data out over and over again, a bit at each timer underflow).
> 
> Hmmm I suddenly realise: the VIA application notes
> http://archive.6502.org/dataheets/synertek_sy6522.pdf stress that with
> the free running shift register, only the low byte of the timer (T2) is
> used for the shifting. Page 7 of the PDF. It doesn't seem to mention if
> this is a general constraint on the timer for other uses, but if that is
> the case (and it seems likely), then this would definitely affect tape
> timing.

Hmmm, two or three years ago I wrote a very special 1541/1571 high
precision timing application (cbmrpm41 for OpenCBM) where I also used
that 8-bit timer. I had to chose the 8-bit variant, because I needed a
programmable interval timer (programmed interval value was: 187-2),
where additional latches for the timer are required. In the floppy from
both VIAs only timer 2 is available and timer 2 has no latches for the
upper 8 bits. Tha latches are needed for the VIA to have a value to
compare with when the timer reached the end of the programmed interval.

If you're interested in some of my own findings, when programming the
VIA back then, have a read in "Appendix A2 of the following source file:


http://opencbm.cvs.sourceforge.net/viewvc/opencbm/cbm4win/cbmrpm41/cbmrpm41.a65


> (Programming the PET/CBM, page 390, confirms that it is Timer 2 which is
> used for the tape; that saves me looking it up in my ROM disassemly. I
> have seen PDFs of this book online and I found a good second-hand copy
> on Amazon.)


Womo

-- 
  ------ to obtain more infos about me, look up the page ------
    ------ http://www.wmsr.de | wm (at) wmsr (dot) de  ------

       Message was sent through the cbm-hackers mailing list
Received on 2010-09-17 12:00:14

Archive generated by hypermail 2.2.0.