31 March 2022, 21:13 | #1 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
PTPlayer / Vertical Blank Interrupt / 060
Hi!
I've just tried my RoboCop build out on some real hardware to see how it's looking and I've come across the following issue: when I the ptplayer audio initialised using '_mt_install_cia' and I start playing a mod file, the scrolling completely breaks, and the blitted objects all seem to go haywire. Example here, the first part of the video shows how the game runs without the audio initialised and playing a mod, the second part with: [ Show youtube player ] This was recorded on FS-UAE, but the result is exactly the same on a 060 A4000 machine. I can only guess it's some sort of PTPlayer interrupt (level 6 I think) clashing with the vertical blank interrupt I have refreshing the display (level 3 I think). No issues with a plain A1200 setup on FS-UAE, and I'm trying to get my A1200 hardware up and running to check that but in the mean time, does anyone have any pointers as to why this might happen? Cheers, Daniel |
31 March 2022, 22:20 | #2 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,436
|
I'm not entirely sure what causes this. I was thinking it might be a race condition between the interrupts, but given it's a protracker interrupt that causes the issue it seems to me that the race condition should not occur every frame (because the interrupt will not occur on the same scanline between frames). So that doesn't really make much sense.
It almost looks like some register isn't being properly saved/restored between the interrupts. Which would also be weird as the ptplayer you're referring to stacks all registers. One thing that might certainly cause issues though, is that the interrupts on A4000's with fast accelerators can sometimes trigger multiple times in a row before the motherboard's slow interrupt acknowledgment gets processed. This would be the case if the interrupt ends too quickly (for instance, it's in fast memory or the cache). Generally this can be fixed by acknowledging interrupts twice in the code instead of once (both in the PT Player and in the other interrupt code). This works because CPU access to chip memory/custom chips is slow enough to let the acknowledgment propagate before the CPU returns from the exception. Last edited by roondar; 31 March 2022 at 22:30. |
31 March 2022, 22:49 | #3 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,182
|
Try to disable int2 and 6 (so PT interrupts won't fire), if that fixes it interrupts are the cause. @roondar has good suggestions, especially "It almost looks like some register isn't being properly saved/restored between the interrupts" -> Look at your own interrupt routines, maybe they assume some registers have specific values (usual culprits being a4 or a6).
|
31 March 2022, 23:46 | #4 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
VBR ?
Do you have the value of the VBR? This needs to be passed to the player init |
01 April 2022, 12:44 | #5 | |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
Thanks all, I'll go across my code with a fine tooth comb and see if anything pops out at me.
Quote:
Thanks for the pointers everyone! |
|
01 April 2022, 17:24 | #6 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
So a bit more information:
- The VBR is getting set correctly via Supervisor() if the CPU is != 68000 - As far as I can see, all of the registers are being saved/restored (but I will be going over this again) - If I install the vertical blank interrupt before I install the PTPlayer interrupt then the player doesn't initialise correctly and no sound is output at all. I'll check on Gorman and continue my analysis... |
01 April 2022, 19:08 | #7 |
Registered User
Join Date: Jan 2012
Location: USA
Posts: 372
|
How much time does your vblank int handler take? Is it being delayed excessively by frequent lvl 6 ints generated by the player?
Have your vblank handler change the background color at the very end if your routine to see just when it competes relative to the rest of the screen. Instead of vblank ints, maybe you can use the copper to trigger an int at the end of the last displayed line. This will give your handler more time. |
01 April 2022, 23:26 | #8 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
More thinking out loud and trying anything... am I setting up my vertical blank interrupt correctly?
Code:
;----- ; install interrupt move.l VBRPtr,a0 move.l #VerticalBlankInterrupt,INTVECTORL3(a0) move.w #$c020,INTENA(a6) Code:
VerticalBlankInterrupt: movem.l d0/a6,-(sp) lea CUSTOM,a6 btst #5,$1f(a6) ;check if it's our vertb int. beq.s .notvb *--- do stuff here ---* bsr UpdateFrame *--- do stuff here ---* moveq #$20,d0 ;poll irq bit move.w d0,INTREQ(a6) move.w d0,INTREQ(a6) .notvb: movem.l (sp)+,d0/a6 rte |
01 April 2022, 23:40 | #9 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Interrupt setup is OK. Does the "UpdateFrame" routine save/restore all used registers?
|
02 April 2022, 01:09 | #10 | |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
Quote:
This is what the output looks like on the A4000 (060): This is the same executable on the A1200 with standard config: |
|
02 April 2022, 01:21 | #11 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,016
|
Does your blitter code expect $dff000 in A6 just like your level 3 interrupt?
And is your blitter waits before or after your BLTSIZE activation? |
02 April 2022, 01:39 | #12 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,053
|
Set-up is ok if you preface it with e.g. $7fff to INTENA (disable everything, and btw calling exec's Disable() won't do the job properly). If you only do $c020 to INTENA, you are enabling VBL int3 but also leaving the rest as is (e.g. inherited from system, which has several other interrupts enabled).
I'd also do $0020 to INTREQ (in your case it doesn't matter I guess, but in general you might not want your interrupt to trigger right away because request bit was pre-set). |
02 April 2022, 02:07 | #13 |
Registered User
Join Date: Jan 2012
Location: USA
Posts: 372
|
Your interrupt handler looks like it checks for the possibility of another interrupting event. Are there other events that cause an int3 like the blitter? If other int3s are possible, what happens to old vector to handle those ints? You don't save the old vector when installing your own.
|
02 April 2022, 02:09 | #14 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,016
|
Quote:
|
|
02 April 2022, 02:09 | #15 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,016
|
Quote:
|
|
02 April 2022, 07:17 | #16 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,053
|
Yep, but not while installing the interrupt handler (that's what I had in mind). If request bit is not cleared, interrupt might trigger right after you hit INTENA (for VBL doesn't matter much, but in general...).
|
02 April 2022, 11:21 | #17 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
|
03 April 2022, 23:10 | #18 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Quote:
Sounds like there is something timing-critical in your VERTB-handler which cannot tolerate losing the CPU for the few raster lines the player needs. Also note that the ptplayer interrupts will always be at different frame positions. It is not synchronised with the video in any way. Quote:
Generally the player should work fine with level-3 interrupts and I'm testing with my A3000/060 all the time. All my games are coded in a way that most of the engine is running in a VERTB-interrupt. |
||
04 April 2022, 13:31 | #19 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
Sorry guys, I've had the weekend off coding (things like this demotivate me immensely) but will pick up and try and get answers to your questions over the next couple of days. Thanks for all of your suggestions and input, I appreciate the help.
I won't let it defeat me |
05 April 2022, 01:26 | #20 | ||||||
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
Hi! Hopefully I've got some answers to your questions below, if not I'll try again in the morning. Here's a couple of files anyway:
Intro Executable Level Executable Startup Code Thanks again for any help! Quote:
Regarding the blitter waits, I tend to wait before I setup the blitter registers, so well before the BLTSIZH(a6) activation. My blitter wait code is a macro and looks like this: Code:
WAITBLITTER:macro tst.w (a6) ;for compatibility with A1000 .wb\@: btst #6,2(a6) bne.s .wb\@ endm Quote:
Quote:
Quote:
Quote:
Quote:
I've tried the very latest version of player too, and called _mt_music from the VBL interrupt with the VBLANK_MUSIC set to 1. Same issue too Last edited by DanielAllsopp; 08 April 2022 at 19:46. Reason: Removed obsolete links to executable files... it's fixed! |
||||||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiblitz 3 and PtPlayer | Nightshft | Coders. Blitz Basic | 4 | 14 November 2021 00:28 |
CIA or vertical blank/copper interrupt for playing music in an intro? | pushead | Coders. Asm / Hardware | 25 | 24 April 2021 11:40 |
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 |
ASM: Wait for Vertical Blank | Asman | Coders. Tutorials | 75 | 01 October 2019 12:11 |
|
|