Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > IRQ instable with music playing?!
2008-12-02 22:54
Scout

Registered: Dec 2002
Posts: 1568
IRQ instable with music playing?!

Hi

Rusty old Scout here...
I have coded a sideborder routine which neatly opens the sideborder.
No problem there but...as soon as I add a music-routine the IRQ becomes instable.
I just can't get the sideborders open again.

What could be the problem ?
2008-12-02 23:12
Cybernator

Registered: Jun 2002
Posts: 154
> What could be the problem ?

It's hard to tell. Make sure there's no conflict between yours and the player's variables. Another possibility is that your routine is not perfectly stable. I can't tell how many times I achieved a "perfectly" stable routine with an empty main loop (i.e. jmp *), which failed as soon as I added something. Oh, now that I mentioned it, make sure that a recent addition you may have made didn't cause page-crossing somewhere in your sideborder routine. This can be a bitch to detect.
2008-12-02 23:53
algorithm

Registered: May 2002
Posts: 702
Quote: Hi

Rusty old Scout here...
I have coded a sideborder routine which neatly opens the sideborder.
No problem there but...as soon as I add a music-routine the IRQ becomes instable.
I just can't get the sideborders open again.

What could be the problem ?


After your stable raster, remove the sideborders and then run the music player as each jump to the player can differ in cycle or are you doing this already?
2008-12-03 00:23
The Phantom

Registered: Jan 2004
Posts: 360
I had a problem similar to this with 7 years (FOE).. (shameless plug.. sorry)

My problem was the IRQ itself, which forced me to rewrite it (something with $dcod and $d019... not sure what it was now).

Show your IRQ and/or the routine your having problems with, we can all help you better that way.
2008-12-03 08:36
Mace

Registered: May 2002
Posts: 1799
Yeah, show us your top-secret routine!
2008-12-03 12:54
Scout

Registered: Dec 2002
Posts: 1568
Here's the code.
I used $d012 polling in this example. Of course I use multiple IRQ's in my real project.

This code compiles in 64tass and shows 2 sprites in the left and right sideborder.
If you add a tune (doesn't matter if you use $d012-polling or mult. irq's) the IRQ isn't stable anymore.

border = $d016
;border = $d021

*=$0800

				.byte $00, $0c, $08, $00,  $00, $9e, $20 ,$32 , $30, $36, $34, $00 , $00, $00

*=$0810



				lda #%00000110  
				sta $d015
				sta $d01d
				lda #%00000100
				sta $d010

				lda #$00
				sta $d002
				lda #$50
				sta $d004

				lda #$43
				sta $d003
				clc
				adc #21
				sta $d005

				lda #8192/64
				ldx #0
-
				sta $07f9,x
				inx
				cpx #7
				bne -
				

				ldx #0
				lda #$ff
spr
				sta $2000,x
				inx
				cpx #64
				bne spr


				sei
				lda #<irq
				ldy #>irq
				sta $fffe
				sty $ffff

				lda #<brkirq
				ldy #>brkirq
				sta $fffa
				sty $fffb

				lda #$7f
				sta $dc0d
				sta $dd0d

				lda #$00
				sta $d012

				lda #$1b
				sta $d011

				lda #$01
				sta $d019
				sta $d01a
				lda $dc0d
                                lda $dd0d


				lda #$35
				sta $1
				cli

				jmp *
irq

				pha
				txa
				pha
				tya
				pha


				lda #$41
-
				cmp $d012
				bne -

				ldx #11
				dex
				bne *-1
				nop

				lda #$08
				ldx #$07

				bit $eaea			
				bit $eaea			
				bit $eaea			
				bit $eaea			
				nop
				
			
.rept 8

.rept 25
				nop
	
.next
				stx border
				sta border
				
.next
				bit $eaea
				bit $ea				
				stx border
				sta border
				
.rept 7

.rept 25
				nop
.next
				stx border
				sta border

.next

				bit $eaea
				bit $ea				
				stx border
				sta border
				

.rept 7

.rept 25
				nop
.next
				stx border
				sta border

.next

				bit $eaea
				bit $ea				
				stx border
				sta border

.rept 7

.rept 25
				nop
.next
				stx border
				sta border

.next

				bit $eaea
				bit $ea				
				stx border
				sta border

.rept 7

.rept 25
				nop
.next
				stx border
				sta border

.next
				bit $eaea
				bit $ea				
				stx border
				sta border


				lda #1
				sta $d019

				pla
				tay
				pla
				tax
				pla
brkirq
				rti


2008-12-03 13:00
Oswald

Registered: Apr 2002
Posts: 5027
- I always start my code with SEI, god know when a kernal irq will hit and mess up something for me.
- cmp $d012 bne *-3 is anything but stable. use double irq or smth, check codebase.
2008-12-03 13:02
Scout

Registered: Dec 2002
Posts: 1568
Quote:

- cmp $d012 bne *-3 is anything but stable. use double irq or smth, check codebase.


Yeah, but could you read what I just wrote?
2008-12-03 13:11
algorithm

Registered: May 2002
Posts: 702
What oswald said. The code does not give stable raster all the time particularly when running a routine which may use a different amount of cycles per jump - ie. music player.

Use other stable raster methods instead (Double IRQ) etc
2008-12-03 14:43
Graham
Account closed

Registered: Dec 2002
Posts: 990
That said, you should always add a music when you are coding stable rasters because otherwise you might end up with a pseudo-stable IRQ. For example, if you have JMP * in the main loop, you will get a "stable" IRQ as soon as the rastertime outside the IRQ can be divided by 3.
2008-12-03 15:38
Scout

Registered: Dec 2002
Posts: 1568
Apparently nobody reads :-(

Again:
Quote:
I used $d012 polling in this example. Of course I use multiple IRQ's in my real project.

This code compiles in 64tass and shows 2 sprites in the left and right sideborder.
If you add a tune (doesn't matter if you use $d012-polling or mult. irq's) the IRQ isn't stable anymore.


Only Graham's answer seems to have some logic, by using a tune when stabilizing.
 
... 4 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Laurikka
taper/ΤRIΛD
Apollyon/ALD
rambo/Therapy/ Resou..
ilesj/Artline Designs
Guests online: 134
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 No Bounds  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 Layers  (9.7)
2 It's More Fun to Com..  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Censor Design  (9.3)
4 Crest  (9.3)
5 Performers  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Stinsen  (9.7)
3 Jeroen Tel  (9.6)
4 Linus  (9.6)
5 MacMagix  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.058 sec.