TIP: Click on subject to list as thread! ANSI
echo: apple
to: comp.sys.apple2
from: mdj
date: 2008-03-20 02:57:02
subject: Re: Apple emulators that support `floating bus` video sensing?

On Mar 20, 10:43 am, "Michael J. Mahon"  wrote:

> > Actually, this isn't strictly true. On a IIe, the $C019 softswitch
> > will read with the high order bit set during (and only during) the
> > vertical blanking interval. On a IIc, the same softswitch will read
> > with the high order bit set if a VBL interrupt has occurred since the
> > last time it was read.
>
> > For practical purposes, being either waiting for VBL to draw, or using
> > it as a real time event source, software that polls the softswitch
> > will behave identically on both machines, assuming you read the
> > softswitch at least every 1/60th of a second.
>
> But if you read it *very* often, while polling, you would observe only
> one instance of the high bit set, right?  And is it only set "if a VBL
> interrupt has occurred"?  If so, that would be a problem if I don't
> want VBL interrupts to occur.

Well, there's no reason not to have them occur :-)

> That's actually pretty different behavior, since the normal way to use
> it is to poll for one state, then poll for the other.  (This is to allow
> the polling routine to be re-called before the polled-for state ends.)

I guess I just can't imagine a use-case for it. Since the transitions
aren't symmetrical they're not useful as a high(er) resolution timer,
and calling a routine a potentially arbitrary number of times would
destroy real-time determinism.

In order to reliably use the VBL as a timer, you have to act on the
state-transition, which requires observing it in both states. All
having it self-reset is going to cause is recognising the 'low' state
earlier which is potentially an advantage. Since the applications
output is synchronised to a real-time event, there'd be no discernable
behavioral difference, even though the underlying hardware is behaving
quite differently.

> > The catch is, $C019 is also used to indicate mouse button and movement
> > activity whilst the mouse firmware is active, so you cannot reliably
> > poll it on a IIc if your program is also using the mouse.
>
> A complication, but one I'd be willing to ignore for my uses...  ;-)
>
> > I'm not 100% sure since I don't have a IIc handy that I can test with,
> > but I also have an inkling that VBL interrupts must be active for this
> > to work on a IIc ($C05A disable, $C05B enable), and I'm relatively
> > sure they're disabled by default. Of course, you also have to ensure
> > (processor) interrupts are disabled or the firmware is going to handle
> > them for you...
>
> Ah, there's the rub.  I really wouldn't want to enable VBL interrupts.
>
> > I guess Apple decided that the relatively short amount of time the IIe
> > spent in the wild before the IIc appeared meant it was OK to change
> > the behaviour? Most software would have used the floating bus method
> > to remain II/II+ compatible so the impact on developers was minor.
>
> That was my thinking, as well, and why I decided to go with the floating
> bus approach to detecting video frames.

Yeah... I think this approach has the greatest reach on actual
hardware. Using a VBL interrupt (activated by AppleMouse firmware)
potentially has greater practical reach, since all IIgs and many IIe
emulators implement it. And I would imagine the diehards among us
still using real 8-bit machines have a Mouse card lying around.

> > And for the IIgs? I have no idea... Can someone shed some light?
>
> > I must admit I am *very* curious about what it is you're trying to
> > achieve that requires both the possibility of an accelerator being
> > operational *and* a real time clock source .... ;-)
>
> Actually, pretty simple.  I'd like to run an animation at a certain
> rate independent of processor speed, but get the benefit of any
> acceleration that may be present when searching the game tree.

Sounds cool... Can't wait to see it :-)

Matt
--- SBBSecho 2.12-Win32
* Origin: Derby City BBS - Louisville, KY - derbycitybbs.com (1:2320/100)
SEEN-BY: 10/1 3 14/300 34/999 90/1 106/1 120/228 123/500 134/10 140/1 222/2
SEEN-BY: 226/0 236/150 249/303 261/20 38 100 1404 1406 1410 1418 266/1413
SEEN-BY: 280/1027 320/119 393/11 396/45 633/260 262 267 712/848 800/432
SEEN-BY: 801/161 189 2222/700 2320/100 105 200 2905/0
@PATH: 2320/100 261/38 633/260 267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.