I need it in order to be synchronized with TV ray. I need to switch
> screens every interrupt. Interrupt starts at the beginning of screen
> refresh (top of screen). This is used on many games and demos (ZX,
> Amiga...etc) to achieve smooth animation, because every screen update is
> synchronized with TV refresh.
You might try without synchronization first... depending on your animation,
tearing might not be that bad. There was also at least a good QL game using
the second screen with nice results.
Btw, at the end you can also reenable interrupts and return to SuperBASIC if
you saved and restored the sys vars area.
> >should be able to adjust timing in your code.
>
> In my case it shall be easily possible, but more complex program would be
> hard to manually finetune.
Yes, if the program has different CPU loads at different stages, it would be
difficult to maintain the frame rate constant.
On the other hand, if the CPU load is about constant but you want to
maintain the frame rate on systems with different CPU speed, you might
insert a idle loop at the end (of your frame-drawing routine), and choose
the number of idle iterations at the beginning by benchmarking your program
while you show a splash screen and interrupts are still enabled (to use them
as timers).
> >If you allow interrupts, even if you remove all other polled tasks from
> the
> >chain, QDOS will still access the second screen area, for example it will
> >increment the SV.POLLM variable.
>
> --> Do you know how many bytes is absulutely minimum for the interrupt
> handler?
I don't know without trying it. But I have a book called 'QL Advanced User
Guide' that has a weird program that allows you to use the part of the
second screen that's not used by system vars. According to the book, system
vars take 5KB. The program works by always showing screen #0 initially,
synchronizing with the 50-60Hz interrupt to detect the start of screen
refresh, then if screen #1 is to be shown, the program waits until it knows
the screen is refreshing the lower half and switches to it at that point.
However, there are two drawbacks that make this program more of a curiosity
than really usable:
1) the wait is done by busy waiting:
MOVE.W #1360,D0
DBRA D0
This means that you spend most of the time busy waiting, while not wasting
time was exactly the reason you wanted to directly use the second screen.
2) you can only use approximately the lower half of the screen.
> That might be possible with Gold Card, but plain QL is simply too slow for
> it.You can hardly move 32k in 1/50sec.
If you have to move memory, also try MOVEP as it may be faster.
Finally, here is some code from the QL interrupt handler (you can get a
commented ROM disassembly from here: http://www.terdina.net/ql/jsrom.zip):
L00352 MOVEM.L D7/A5-A6,-(A7) * INTERRUPT 2 handler
XL00352 EQU L00352
MOVEA.L A7,A5
MOVEA.L #$00028000,A6
MOVE.B $00018021,D7
LSR.B #1,D7
BCS L02ABC * gap interrupt
LSR.B #1,D7
BCS L02CCC * interface interrupt
LSR.B #1,D7
BCS L02CD8 * transmit interrupt
LSR.B #1,D7
BCS L00900 * frame interrupt
LSR.B #1,D7
Perhaps you might be able to poll for the frame interrupt by looking at this
register $18021 even with interrupts disabled??? But I'm not sure it would
be set if interrupts are disabled, and you would still have to do some
occasional polling, and find out how to clean up the HW registers manually.
Daniele
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm