Jump to content



2

Another use for paddles - short duration timers


8 replies to this topic

#1 Rybags ONLINE  

Rybags

    Quadrunner

  • 10,323 posts
  • Location:Australia

Posted Wed Jun 21, 2006 9:36 AM

Well, not paddles really, but the POTx registers.

On the 8-bit, the paddles are read by storing to POTGO ($D20B) then waiting for POKEY to generate the value.

According to the HW manual, capacitor dump transistors charge, and return a value from 0 to 227.

This is useful to us, since whilst generating a POTx value, the registers count up from 0 at the rate of 1 per scanline (exactly). In Fast Scan mode, the scan takes 2 scanlines - which equates to 228 machine cycles.

So, instead of tight timing loops which are affected by DMA and Refresh we can set fast pot scan and just wait until POTx reaches the delay value required.

Or, in standard mode, we can get delays by x scanlines - which is more precise than ANTIC's VCOUNT as it only has 2 line resolution.

This method has distinct advantages over POKEY timers as they are more involved to setup and monitor, plus it costs you a sound channel. The other advantage is that you don't need wasteful delay loops - you just periodically check the counter value.

The downside, though, is that you can't have a paddle plugged into that port because the POTn register might not count as high as you want it to.
Although, on the XL/XE, POT4-7 are not connected so are free to use. On 400/800 you just have to trust the user not to have paddles plugged into Port 4.

Downside #2 is that Atari800Win doesn't seem to emulate fast scan mode at all - the countup is instant.

Here's an example using POT7 for speech timing. Binary load file - press START or SELECT once it loads. Note that it won't work properly on the emulator:

Attached File  potdemo.zip   12.81K   57 downloads (warning - contains profanities)



Below is a visual representation of POT7 value as the screen is drawn. The glitches towards the right are where the value changes. Note how it stops at value 227 (brownish colour).
By storing into POTGO at a specific time, the counter can be reset. In this case, it is the OS VBI routine. But, it is quite fine to store again at a time of your own chosing, which starts the countup process again.

CH008_0622_013205.jpg

Edited by Rybags, Wed Jun 21, 2006 9:38 AM.


#2 Heaven/TQA OFFLINE  

Heaven/TQA

    Quadrunner

  • 8,111 posts
  • Location:Baden-Württemberg, Germany

Posted Wed Jun 21, 2006 10:14 AM

might be interesting for Fox to update the Atari800-Core.

#3 Rybags ONLINE  

Rybags

    Quadrunner

  • 10,323 posts
  • Location:Australia

Posted Wed Jun 21, 2006 10:45 AM

Yes. Fast mode could be handy, all you need is
LDA # <delay factor in cycles>
STA $D20B
WAIT CMP $D20B
BCC WAIT

Much more efficient than POKETs timers.

I've played around with standard mode - not 100% sure but the change of value seems to take place around the same time each scanline regardless of when you do POTGO.

#4 deathtrappomegranate OFFLINE  

deathtrappomegranate

    River Patroller

  • 4,384 posts
  • Lipstick on my cigarette

Posted Sat Jun 24, 2006 5:44 PM

I'm surprised at the lack of response to this - it sounds very interesting.

#5 Stephen OFFLINE  

Stephen

    River Patroller

  • 3,250 posts
  • A8 Gear Head
  • Location:Akron, Ohio

Posted Sun Jun 25, 2006 5:04 PM

That is seriously cool. What a versatile piece of hardware.

Stephen Anderson

#6 a8isa1 OFFLINE  

a8isa1

    Dragonstomper

  • 786 posts

Posted Mon Jun 26, 2006 2:48 AM

Awesome demonstration, Rybags!

Scared the crap out of me!

BTW, your demo runs reasonably well using Atari++ ver 1.46 (Windows) emulator. Just a slight bit of static but it could be my less than state-of-the-art PC.


- Steve Sheppard

Edited by a8isa1, Mon Jun 26, 2006 2:49 AM.


#7 hawk OFFLINE  

hawk

    Space Invader

  • 43 posts
  • Location:Adelaide, Australia

Posted Tue Jun 27, 2006 7:08 PM

I think it's a great discovery, but I'm a long way from needing to use it. Possibly it goes over the head of most members of the forum.

#8 tschak909 OFFLINE  

tschak909

    Chopper Commander

  • 161 posts
  • Location:USA

Posted Sun Jul 2, 2006 1:30 AM

actually, any timing source I can get my hands on for game development makes perfect sense, and since this is perfectly timed to the horizontal colour clocks, it would be great for all sorts of things in a DLI. muaahahaha, why didn't I think of this? :-D especially, since upon reading the entry for POTGO in the Atari 400/800 hardware manual, it seems so @#($#@$(#@$#@ OBVIOUS!

-Thom

#9 Rybags ONLINE  

Rybags

    Quadrunner

  • 10,323 posts
  • Location:Australia

Posted Sun Jul 2, 2006 1:46 AM

Sadly none of the emulators seem to do fast mode at all. Although I tried it on Ver 1.45 (older) of Atari ++

The one big limitation other than that is the fact that if someone has a paddle plugged into the relevant port, then the technique is rendered useless - although that's only a problem on the 400/800.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users