[comp.sys.atari.st] Video interrupts: using or disabling

saj@chinet.UUCP (Stephen Jacobs) (03/09/88)

I am curious about the horizontal and vertical blank interrupts.  How much
code can one safely put in a horizontal blank routine?  How many micro
seconds does each call of the default vertical blank handler take?  There
appears to be a flag telling the default vertical blank handler to cut its
operation short: what awful thing (if any) would happen if the interrupt
threshold was simply set above the vertical blank level?  And finally, how
do I try playing with these things (I've never done anything with privileged
instructions on the 68000, so those interrupt levels and first 1 K of memory
flags are new territory).  I have Mark Williams C (with their assembler
included), a few Abacus books and some 68000 documentation.  Use your best
judgement about whether to mail or post replies.

wayneck@tekig5.TEK.COM (Wayne Knapp) (03/10/88)

In article <3379@chinet.UUCP>, saj@chinet.UUCP (Stephen Jacobs) writes:
> I am curious about the horizontal and vertical blank interrupts.  How much
> code can one safely put in a horizontal blank routine?  How many micro

 Horizontal blank is hard to use and the interrupt occurs every 64.5 usec.

> seconds does each call of the default vertical blank handler take?  There

 No idea, but there is time for lots of code during a vertical blank, at
 least a millisecond's worth of code.

> appears to be a flag telling the default vertical blank handler to cut its
> operation short: what awful thing (if any) would happen if the interrupt
> threshold was simply set above the vertical blank level?  And finally, how

  Ugh! You would very quickly get a stack overflow, crash, burn, ugly stuff.

> do I try playing with these things (I've never done anything with privileged
> instructions on the 68000, so those interrupt levels and first 1 K of memory
> flags are new territory).  I have Mark Williams C (with their assembler
> included), a few Abacus books and some 68000 documentation.  Use your best
> judgement about whether to mail or post replies.


   When playing around with the interrupts you will get many surprizes.  
Video interrupts can be very trickly.  If you only have a small routine I
run just add it to the vertical blank routine.  I spent a lot of time playing 
with the horizontal interrupts and finally gave up.  Just too much overhead
to try and handle a iterrupt every 64.5 usec.  Doing stuff with video
interrupt can give great results but it is very easy to burn up most of the
cpu cycles on just the interrupt code.  I've had much better luck with using
timers.  Also rememger you can get burned on the vertical blank since it can
be 50, 60, or 70hz. 

                               Wayne Knapp 

apratt@atari.UUCP (Allan Pratt) (03/12/88)

From article <2509@tekig5.TEK.COM>, by wayneck@tekig5.TEK.COM (Wayne Knapp):
> In article <3379@chinet.UUCP>, saj@chinet.UUCP (Stephen Jacobs) writes:
>> I am curious about the horizontal and vertical blank interrupts.  How much
>> code can one safely put in a horizontal blank routine?

>> appears to be a flag telling the default vertical blank handler to cut its
>> operation short: what awful thing (if any) would happen if the interrupt
>> threshold was simply set above the vertical blank level?

> Just too much overhead
> to try and handle a iterrupt every 64.5 usec.
>                                Wayne Knapp 

If you disable vblank (i.e. run at IPL 7), the mouse and blinking cursor
will stop, and the floppy motor won't shut off if it's on.  That's
about all -- no great bloody crashes.  I run this way when remote
debugging sometimes and it works fine.

Oh, but if you move the mouse at IPL 7, the keyboard packet handler will
get out of sync and you may not be able to recover.  Sorry. 

You can stop the vblank handler by setting the variable 'vblsem' to 0
(it's address 0x452 word).  I believe that there is still a counter
running, and when you unblock vblsem the vblank routines get hit as
many times as there were blocked vblanks.  Not sure about that.

When the ST was running at IPL 0, and the Hblank routine was just RTE,
we saw 25% performance degradation as compared with running at IPL 3 (no
Hblanks).  On the other hand, NEO and Spectrum do stuff at Hblank... 
It's not impossible, just hard. 

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt

egisin@watmath.waterloo.edu (Eric Gisin) (03/14/88)

In article <1012@atari.UUCP>, apratt@atari.UUCP (Allan Pratt) writes:
> If you disable vblank (i.e. run at IPL 7), the mouse and blinking cursor
> will stop, and the floppy motor won't shut off if it's on.  That's
> about all -- no great bloody crashes.  I run this way when remote
> debugging sometimes and it works fine.

You CAN trash a disk if you change floppies (assuming the motor
isn't stuck running) because media change won't be recognized with
vblank disabled.

unpowell@csvax.liv.ac.uk (03/16/88)

In article <3379@chinet.UUCP>, saj@chinet.UUCP (Stephen Jacobs) writes:
> I am curious about the horizontal and vertical blank interrupts.  How much
> code can one safely put in a horizontal blank routine?  How many micro
> seconds does each call of the default vertical blank handler take?  There
> appears to be a flag telling the default vertical blank handler to cut its
> operation short: what awful thing (if any) would happen if the interrupt
> threshold was simply set above the vertical blank level?  And finally, how
> do I try playing with these things (I've never done anything with privileged
> instructions on the 68000, so those interrupt levels and first 1 K of memory
> flags are new territory).  I have Mark Williams C (with their assembler
> included), a few Abacus books and some 68000 documentation.  Use your best
> judgement about whether to mail or post replies.

	Better using Timer B (the MFP timer that counts line returns). This
gives much better results than the priority 2 HBL, because it has priority
6, and also has higher priority than keyboard interrupts etc.
	Even though it has higher priority than keyboard you may still have
to disable keyboard interrupts as there are about 50 clock periods taken
up with the imterrupt acknowledge. During this time no other interrupts
can be processed. This isn't much of a problem eith normal interrupts, but
with graphics this can create some awful flicker.

********************************************************************************

 "...there's no success   JANET unpowell@uk.ac.lis.csvax
  like failure and        UUCP  {backbone}!mcvax!ukc!mupsy!lis-cs!unpowell
  failure's no success    ARPA  unpowell%csvax.lis.ac.uk@nss.cs.ucl.ac.uk
  at all..." B.Dylan

********************************************************************************