Using timer 2 instead of timer 1 
Author Message
 Using timer 2 instead of timer 1

Howdy..

I'm asm-coding a shoot'em-up for the 486+, called 'Space Axe'. Right
now it has three layers that scroll parallax (horizontal and vertical
at the same time), 200 sprites, joystick and Gravis Ultrasound
support, and easily runs at 72 fps on my VLBdx2/66.

I know very little about the internal timers, is there someone who can
replace the code below with code that uses timer2, instead of timer 1?

start_timer:    mov     al,10000000b  ;current timing position  in BX
                out     43h,al
                jmp     short $+2
                in      al,40h
                mov     bl,al
                jmp     short $+2
                in      al,40h
                mov     bh,al

get_timing_pos: mov     al,10000000b  ;relative timing position in AX
                out     43h,al
                jmp     short $+2
                in      al,62h
                mov     ah,al
                jmp     short $+2
                in      al,62h
                xchg    al,ah
                sub     ax,bx
                neg     ax

Scart/MetalMinds..



Fri, 30 Oct 1998 03:00:00 GMT  
 Using timer 2 instead of timer 1

Quote:

>I know very little about the internal timers, is there someone who can
>replace the code below with code that uses timer2, instead of timer 1?

You're probably trying to get it to use anothe timer than timer 0.

Timer 0 is the timer which gives you the IRQ0/INT8
Timer 1 is hooked to DRAM refresh
Timer 2 is hooked to the speaker

while it's fully possible to reprogram timers 1 and 2 you can not do
anything with them from your program  (except for beeping the speaker
or locking up your PC due to not having DRAM refresh)

Let me guess... you're in need for a second timer so you can have a
Vertical retrace interrupt emulation and to have a timer for your
sound routines...

If so.  Use the RealTime clock as timing source for the sound at
1/1024 sec resolution it should be more than you need, and that leaves
IRQ0/INT8 available for the Retrace interrupt.

Tasmaniac / ACiD / HypernovA / Zantarian Prophecy



Mon, 02 Nov 1998 03:00:00 GMT  
 Using timer 2 instead of timer 1

Quote:

> while it's fully possible to reprogram timers 1 and 2 you can not do
> anything with them from your program  (except for beeping the speaker
> or locking up your PC due to not having DRAM refresh)

Although timer 2 won't generate an interrupt, you conceivably could use it for timing (by reading it for the
time). I wouldn't want to, however, since the period and mode will be messed the instant BIOS decides to beep
at the user for filling the keyboard buffer or whatever!

Kevin



Thu, 05 Nov 1998 03:00:00 GMT  
 Using timer 2 instead of timer 1

Quote:

>If so.  Use the RealTime clock as timing source for the sound at
>1/1024 sec resolution it should be more than you need, and that leaves
>IRQ0/INT8 available for the Retrace interrupt.

I thought the realtime clock was driven by timer0, going at 18.2
ticks/sec.

From my understanding, when you change the frequency of Timer0 and put
in your own interrupt service routine, you still have to (well, WANT
to) call the BIOS timer0 call at 18.2 ticks/sec so that the system
time stays right etc.  So if you change its frequency to, say, 70
ticks/sec for a V-Retrace interrupt, you still have to call the BIOS
thing every 4th (or a bit more often) occurance of the interrupt to
keep things in order.

-----------------------------------------------------------------------------

Check out {*filter*}sphere, new from Psycon Soft.
http://www.*-*-*.com/ ~hellmanc
-----------------------------------------------------------------------------



Fri, 06 Nov 1998 03:00:00 GMT  
 Using timer 2 instead of timer 1

Quote:


>>If so.  Use the RealTime clock as timing source for the sound at
>>1/1024 sec resolution it should be more than you need, and that leaves
>>IRQ0/INT8 available for the Retrace interrupt.

>I thought the realtime clock was driven by timer0, going at 18.2
>ticks/sec.

>From my understanding, when you change the frequency of Timer0 and put
>in your own interrupt service routine, you still have to (well, WANT
>to) call the BIOS timer0 call at 18.2 ticks/sec so that the system
>time stays right etc.  So if you change its frequency to, say, 70
>ticks/sec for a V-Retrace interrupt, you still have to call the BIOS
>thing every 4th (or a bit more often) occurance of the interrupt to
>keep things in order.

The real-time clock is not managed by the 8254 counter timer chip,
or its equivalent.  That 1Khz clock is generated by the Dallas or
equiv. RTC that also implements the CMOS memory cells used to store
configuration information.  This is wired to a completely different
IRQ than the 8254, and is programmed in a different way entirely.

T0 on the 8254 drives the 55ms (18.2Hz) clock that spins down the
floppy drives after you're done accessing them, and updates the BIOS
"ticks since midnight" at 40:6c.  T1 can be used for DRAM refresh,
but this isn't always the case.  T2 is normally used for speaker tones,
but again this is flexible.
--
Steve Jones
GENERAL SOFTWARE, INC.

"Award winning system software for embedded and consumer electronics"



Mon, 09 Nov 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Wait ms Timer Multiple returning inaccurate timer value

2. Timers used with multiuser applications for refreshing browss screens

3. RUN() using TIMER()

4. Using Timer functions in parallel with VISA functions

5. using the Timer

6. Using NMI for timer related utilities

7. Timer Resolution Using Alsys

8. Timer Resolution Using Alsys

9. Timer in used CPU time ?

10. Using a timer with TK

11. Timer ticked event uses a Process with disabled interrupts

12. The IBM-PC 8253 Timer - What do the three outputs of the timer control?

 

 
Powered by phpBB® Forum Software