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: 1570
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: 705
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: 1570
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: 5094
- 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: 1570
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: 705
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: 1570
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.
2008-12-03 15:53
Cruzer

Registered: Dec 2001
Posts: 1048
Quote:
you should always add a music when you are coding
Word
2008-12-03 16:14
Scout

Registered: Dec 2002
Posts: 1570
Found it!

The problem was that the music was playing in the 'visible' area ($33-$fa). Moved it somewhere else, et voilá..a stable raster with music.

Yay & Woo!

Nevertheless, thanx y'all for replying!
2008-12-03 16:19
Oswald

Registered: Apr 2002
Posts: 5094
thats more of a workaround :) "multiple irqs" for me didnt translated as "double irq method" sorry.
2008-12-03 16:57
Radiant

Registered: Sep 2004
Posts: 639
It's possible to obtain a stable raster regardless of what you do during the graphic screen. Just moving code around until it "works" is a solution, but not a good one, since a subsequent code modification may render it all unstable again. I can't see any kind of stabilizing code at all in your example apart from the $d012 polling, so I guess it was/is simply stable by luck and of course that means it'll break if you add music (or pretty much anything at all).

If a double IRQ raster suddenly turns unstable it's pretty much the same thing: It looks stable, but the code is incorrect and any perceived stability can be attributed to chance. I wouldn't go so far as to recommend you always play music while testing; a main loop filled with sufficient nonsensical opcodes of varying cycle lengths is IME enough to reveal any false stability.
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
t0m3000/hf^boom!^ibx
Holy Moses/Role
cobbpg
/Panor..
Guests online: 132
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

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