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 ?
 
... 4 posts hidden. Click here to view all posts....
 
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.
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
Bieno/Commodore Plus
Microshark/Damage(HUN)
Andy/AEG
Holy Moses/Role
CreaMD/React
MWR/Visdom
The Syndrom/TIA/Pret..
CA$H/TRiAD
Guests online: 116
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 Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

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