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 ?
 
... 4 posts hidden. Click here to view all posts....
 
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: 5022
- 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.
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: 1568
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: 5022
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.
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
Knut Clausen/SHAPE/F..
jamespurcell
Isildur/Samar
St0rmfr0nt/Quantum
Acidchild/Padua
Mythus/Delysid
Clayboy
Guests online: 181
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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