English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 23 April 2021, 17:24   #21
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
I mean that it doesn't use a copper interrupt at all.

The music player is called at the top of the vblank interrupt, and then in the copperlist, there's a copper wait for (for example) line 15 followed by a copper move to DMACON.

The music player just patches this copper move with the correct value, and it is automatically set by the copper at line 15
DanScott is online now  
Old 23 April 2021, 17:38   #22
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by DanScott View Post
The music player is called at the top of the vblank interrupt, and then in the copperlist, there's a copper wait for (for example) line 15 followed by a copper move to DMACON.
Ah, sorry, I read too fast and wanted to see INTREQ instead of DMACON.

Quote:
The music player just patches this copper move with the correct value, and it is automatically set by the copper at line 15
That's smart and is probably the best solution for a VERTB-based player. The same is done for writing the repeat-pointers to AUDxLC, a few lines later?
phx is offline  
Old 23 April 2021, 17:49   #23
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
Quote:
Originally Posted by phx View Post
Ah, sorry, I read too fast and wanted to see INTREQ instead of DMACON.

That's smart and is probably the best solution for a VERTB-based player. The same is done for writing the repeat-pointers to AUDxLC, a few lines later?
I don't think that's necessary with LSP... but I guess it could work for a player that needs to set AUDxLC too. Removes a lot of overhead cycles "wasted" by interrupt handlers and CPU internal interrupt triggering
DanScott is online now  
Old 23 April 2021, 17:57   #24
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
Quote:
Originally Posted by phx View Post
That's smart and is probably the best solution for a VERTB-based player. The same is done for writing the repeat-pointers to AUDxLC, a few lines later?
There are two modes for that (neither involves copper):
1. no short samples, they are set at the start of the next frame (with a ~20ms delay but that's ok because samples are sufficiently long and haven't started looping yet)
2. short samples, the usual cia timer method
a/b is online now  
Old 24 April 2021, 08:42   #25
koobo
Registered User
 
koobo's Avatar
 
Join Date: Sep 2019
Location: Finland
Posts: 361
Quote:
Originally Posted by Antiriad_UK View Post
As others said use PHX's routine for most cases. I use in my intros too.

For scenario above. Cia interrupt for music players is level6 (high priority) and usually only takes a few scan lines to execute. Because of the module timing it will generally occur at a different scan line each frame. For example on frame 1 the cia interrupt may be around scanline 10, on frame 2 it may be 30, basically it could happen anywhere. (Interesting to watch it move around with WinUAE visual debugger)

If you are triggering a lev3 interrupt with the copper alongside PHX's player with cia interrupt then usually will have two outcomes:
1. Lev 6 CIA interrupt is currently executing when copper requests lev3 interrupt
- Lev3 interrupt can't interrupt lev6, so lev3 interrupt only starts once lev6 interrupt finished

2. Lev 3 interrupt is currently executing, cia lev6 requested
- Lev6 cia CAN interrupt lev3, once lev6 finished continues with lev3

So yes, you have to think a little bit about some scenarios where this could cause an issue. For example if you have a very precise "wait for line x" with the cpu in a lev3 then it could potentially miss that check periodically if the music player happened at the same time. So often safer to "wait for line greater than". In practice it's usually fine and you just start the music playing and forget about it
An anecdote in system programming, ie. non-demo context. Using a level 6 CIA-timer for module playback will disturb serial transfers which use the level 5 interrupt. Therefore HippoPlayer triggered a level 1 interrupt for music playback from which ever CIA-timer it was able to allocate.

Out of four available CIA-timers two trigger lev2 and two trigger lev6 interrupts. Lev2 timer interrupt and lev1 software interrupt are available in demo programming as well.

All of the above with the "as far as I can remember" -disclaimer
koobo is offline  
Old 24 April 2021, 11:40   #26
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by koobo View Post
An anecdote in system programming, ie. non-demo context. Using a level 6 CIA-timer for module playback will disturb serial transfers which use the level 5 interrupt. Therefore HippoPlayer triggered a level 1 interrupt for music playback from which ever CIA-timer it was able to allocate.

Out of four available CIA-timers two trigger lev2 and two trigger lev6 interrupts. Lev2 timer interrupt and lev1 software interrupt are available in demo programming as well.

All of the above with the "as far as I can remember" -disclaimer
I second that.
DeliTracker does the same : trigger a SoftInt to defer the work so that the player does not disturb anyone.

Also, as mentioned CIA-B has high priority but CIA-A is lower than Copper and Vert Beam.

But there is another way to handle this. Let's say your main interrupt has to do heavy duty stuff but also some small but more time critical things.
You could separate the two by triggering another lower priority interrupt, but you also have the possibility to reallow interrupts by setting an appropriate IPL level in SR and tell Paula you're done with your high level interrupt (by simply acknowledging it before it has finished).
Then, start with the fast but time critical stuff, then reallow interrupts (including lower level ones), then do the more heavy duty things (which are ok to interrupt with a module player).
(Not sure i've been clear on this ).
meynaf is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
CIA periodic interrupt jotd Coders. Asm / Hardware 12 02 January 2021 21:22
Extended Vertical Blank sandruzzo Coders. Asm / Hardware 9 23 October 2019 15:17
Vertical blank and Bobs geldo79 Coders. Asm / Hardware 4 21 October 2019 10:04
example of a CIA timer interrupt in assembler using cia.resource Apollo Coders. Asm / Hardware 3 05 July 2013 08:40
CIA timer interrupt handler called twice during mod playback absence Coders. General 5 16 March 2009 18:55

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:31.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.14147 seconds with 15 queries