How do I, using the VBLANK interrupt, a CIA-based interrupt, a VIC-II
interrupt, or in fact any method other than a number-based loop, pause
for a period of time such that, for example, a game or graphics demo
will function at a suitable speed?
|
|
0
|
|
|
|
Reply
|
rose.joseph12 (88)
|
3/27/2012 1:54:29 PM |
|
27.03.2012 16:54, Harry Potter kirjoitti:
> How do I, using the VBLANK interrupt, a CIA-based interrupt, a
> VIC-II interrupt, or in fact any method other than a number-based
> loop, pause for a period of time such that, for example, a game or
> graphics demo will function at a suitable speed?
Make a counter that will decrease one per interrupt until zero. This is
one example, 8 bit counter. It will stop at zero. When run in a
interrupt, it counts down in constant speed.
Code:
---- interrupt code ---
ldx counter
beq .off
dex
stx counter
..off
---- more interrupt code ----
In main code:
lda #50 ;50 interrupts
sta counter ;set to countdown register
..wait lda counter
bne .wait ;wait until zero. Interrupts are on, so counter
;decreases.
Now we have waited one second, if this is run on a pal machine.
Of course the example of main code is a bit stupid - you usually can do
something in the main loop except waiting for a counter. For example, if
you need to load something, you can do it while waiting something on the
screen and so on. You just need to check the counter and when it is
zero, do next thing.
|
|
0
|
|
|
|
Reply
|
pekka.NOtakala (8)
|
3/27/2012 10:04:10 PM
|
|
|
1 Replies
78 Views
(page loaded in 0.033 seconds)
Similiar Articles: VICE 2.3 has been released. - comp.sys.cbm... and download instructions check out ... Emulation of all known pipeline delays for full cycle ... it emulates the Commodore C64, C128, VIC20, PET, PLUS4 and the CBM-II, as w... '?'s in Rom Firmware Kernal dumps - comp.sys.cbmThe days of simply cycle counting are >> over. >> >> Main reason that optimizing has ... Replace and ... It would mean that every two out of five C64 owners ... High resolution timer. - comp.lang.asm.x86... QueryPerformanceCounter returns the raw cycle counter. ... the kernel doesn't really need RDTSCP to figure out ... The I/O access time wont count to the delay of a slowed CPU. Intel High Precision Event Timers - comp.protocols.time.ntp ...... like the recent x86 CPU's > 64-bit cycle ... Right now the old count is still in effect until it times out. ... the NB transaction doesn't only delay ... Fast bit-reverse on an x86? - comp.dspThat would result in a timing delay ... the routines on cpu with 3/cycle may prove otherwise. As you've pointed out their ... so adding nothing to the overall cycle count ... improve strlen - comp.lang.asm.x86:) Out of curiousity, what happened to "repne scasb"? ... /* All the more reason that counting cycles isn't a good ... writing assembler are usually the development cycle time ... RDTSC (was: Fastest logical not) - comp.lang.asm.x86Yeah, sometimes I see one cycle more or less. To make ... limit and the test is re-done if the result is out of ... (L)APIC seem to count in terms of frames/blocks/accessed... Could anyone give me the spice-mode.el - comp.emacsHi, All I am new to *NIX and I am thinking of writing spice code under Emacs. However, I have no idea of Emacs Lisp. Hence, I could not write a packa... Central Vac overload - comp.home.automationTurns out there was a defective sail switch, as well as ... vac in my previous house for 36 years and can count on ... And don't forget a delay or other override to handle the ... Cycle Counting – the Secret to Inventory AccuracyCycle Counting – the Secret to Inventory Accuracy ... Too many item A, Not enough item B, Dollars even out ... inventory as low as you can Ship what you can Delay ... Menstrual cycle - Average cycle time for women, short cycle ...Find out about menstrual cycle. Average cycle time for women, short cycle, irregular cycle. Solve your problems. 7/24/2012 5:57:20 PM
|