15 March 2009, 23:55 | #1 |
Registered User
Join Date: Mar 2009
Location: moon
Posts: 373
|
CIA timer interrupt handler called twice during mod playback
I've been wondering why some old menu program plays a mod file with slower arpeggios than regular trackers. I started disassembling and found out that the player is the stock standard unchanged PT-Play.s from Protracker 1.1b. The difference is that the menu program calls it from a CIA timer interrupt handler instead of at vertical blank. The strange thing is that the CIA timer runs at 25 Hz instead of the regular 50 Hz. That explains the slower arpeggio, but the tune still plays at the right speed. Eventually I found out that somehow the interrupt handler is called twice each time the timer underflows (the second time immediately after the RTE from the first run). I'm curious about why this happens, as I'm trying to learn how the old Amiga hardware works. Here's the relevant code I've found so far:
Code:
init: ; ... MOVE.L #int_handler,$00000078 MOVE.B #$7f,$00bfdd00 MOVE.B #$6f,$00bfd500 MOVE.B #$03,$00bfd400 MOVE.B #$11,$00bfde00 MOVE.B #$81,$00bfdd00 ; ... int_handler: MOVEM.L D0-D7/A0-A6,-(A7) MOVE.W #$2000,$00dff09c TST.B $00bfdd00 BSR.W mt_music MOVEM.L (A7)+,D0-D7/A0-A6 RTE.L |
16 March 2009, 08:21 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,524
|
Paula interrupt is cleared but CIA interrupt line is still active -> Paula interrupt flag gets retriggered instantly.
(ADDED: I remember fixing this few years ago in UAE..) Last edited by Toni Wilen; 16 March 2009 at 09:09. |
16 March 2009, 10:39 | #3 | |
Registered User
Join Date: Mar 2009
Location: moon
Posts: 373
|
Quote:
Also, what code would have to be added to the interrupt handler to avoid the retrigging? |
|
16 March 2009, 10:43 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,524
|
|
16 March 2009, 11:48 | #5 |
Registered User
Join Date: Mar 2009
Location: moon
Posts: 373
|
Doh! I thought I had already tried swapping the MOVE and TST, but I must have goofed up the debugger commands, because it didn't work the last time. When I tried again now, it nicely slowed down to 25 Hz. Thanks for solving the mystery!
I can't help wondering whether the effect was intended, or if the coder couldn't figure out why the music played twice as fast and simply solved it by reducing the CIA frequency. |
16 March 2009, 18:55 | #6 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,524
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
example of a CIA timer interrupt in assembler using cia.resource | Apollo | Coders. Asm / Hardware | 3 | 05 July 2013 08:40 |
[WinUAE/A500] CIA A - Timer A INT2 problem | leoha | Coders. Asm / Hardware | 2 | 22 October 2012 10:18 |
Wanted: mod i think was called echoes or silence? | Impakt | request.Modules | 11 | 28 April 2009 00:17 |
Looking for a mod called galaxy | kolorabi | request.Modules | 3 | 31 May 2005 01:20 |
Whats this Music mod called? | WOC_Admin | request.Modules | 0 | 18 May 2003 18:50 |
|
|