Re: Timer interrupt frequency (50Hz vs 60 Hz)

David Broman via Coco <coco-uNHYcr1XS/wmlAP/[email protected]>
Newsgroups gmane.comp.hardware.tandy.coco
Message-ID <PH7P223MB06891C97B0DD5CB9ECF12736CFDB2@PH7P223MB0689.NAMP223.PROD.OUTLOOK.COM>
If you'd like to go the route of counting hsyncs, here's some sample code you can start from. It counts scan lines so it can change the display mode at a known point in the middle of the frame. It could probably be easily adapted to simply count total scan lines between vsyncs.

https://cocotownretro.wordpress.com/2023/12/25/impossibly-colorful/

-----Original Message-----
From: Coco <coco-bounces-uNHYcr1XS/wmlAP/[email protected]> On Behalf Of Alex Evans via Coco
Sent: Thursday, March 20, 2025 6:19 PM
To: CoCoList for Color Computer Enthusiasts <coco-uNHYcr1XS/wmlAP/[email protected]>
Cc: Alex Evans <[email protected]>
Subject: Re: [Coco] Timer interrupt frequency (50Hz vs 60 Hz)

You could use something like the sync instruction with interrupts masked.

On Thu, Mar 20, 2025, 21:17 RETRO Innovations via Coco <coco-uNHYcr1XS/wmlAP/[email protected]>
wrote:

> On 3/20/2025 7:51 PM, Alex Evans via Coco wrote:
> > The trouble I see is that both hsync and hsync are IRQ though you 
> > can
> check
> > the pia to see which one fired.
> Apologies, I thought one was IRQ and the other FIRQ.  But yes, you 
> could check PIA.
> > There is also the issue that servicing an IRQ is not really fast 
> > because all of the registers are preserved.
>
> Well, my thought is that this code would only run once for at most 
> 1/25 of a second (worst case situation is that fsync irq is enabled 
> immediately following an FSYNC IRQ, so it would run one frame without 
> counting, and then the next it would count.  But, the below code can 
> be optimized if needed.
>
> My main is whether it would give different values on NTSC versus PAL.  
> I assume so, since there would be 262 or 263 hsyncs in NTSC, but 
> 312/313 in PAL.
>
> >
> > On Thu, Mar 20, 2025, 20:33 RETRO Innovations via Coco <
> coco-uNHYcr1XS/wmlAP/[email protected]>
> > wrote:
> >
> >> On 3/20/2025 7:07 PM, Alex Evans via Coco wrote:
> >>> Yes, you can interrupt (IRQ) on hsync on any coco.
> >> So if you write:
> >>
> >> prep:
> >>
> >> //put 0 in NUM
> >>
> >> // put 0 in START
> >>
> >> //enable fsync
> >>
> >> // wait for START to equal 2
> >>
> >> // use NUM value to calc PAL or NTSC
> >>
> >>
> >> fsync_IRQ
> >>
> >> // increment START
> >>
> >> // if START = 1
> >>
> >> // zero out NUM, enable hsync, and return
> >>
> >> // else disable fsync and hsync and return
> >>
> >> hsync_IRQ:
> >>
> >> // increment NUM
> >>
> >> // return
> >>
> >> Would the above give you different numbers in NUM you could use to 
> >> determine PAL/NTSC?
> >>
> >> Jim
> >>
> >> --
> >> RETRO Innovations, Contemporary Gear for Classic Systems 
> >> www.go4retro.com store.go4retro.com
> >>
> >>
> >> --
> >> Coco mailing list
> >> Coco-uNHYcr1XS/wmlAP/[email protected]
> >> https://pairlist5.pair.net/mailman/listinfo/coco
> >>
>
> --
> RETRO Innovations, Contemporary Gear for Classic Systems 
> www.go4retro.com store.go4retro.com
>
>
> --
> Coco mailing list
> Coco-uNHYcr1XS/wmlAP/[email protected]
> https://pairlist5.pair.net/mailman/listinfo/coco
>

--
Coco mailing list
Coco-uNHYcr1XS/wmlAP/[email protected]
https://pairlist5.pair.net/mailman/listinfo/coco

-- 
Coco mailing list
Coco-uNHYcr1XS/wmlAP/[email protected]
https://pairlist5.pair.net/mailman/listinfo/coco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.