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 > Is this a proper stable raster?
2010-09-20 22:37
MC
Account closed

Registered: Jul 2009
Posts: 71
Is this a proper stable raster?

I was searching for stable raster interrupts and only found ugly looking code tbh. I came up with this little trick and wonder if it will be stable under all conditions...

It is on VICE but I haven't had the chance to test this interrupt on a real machine yet... This is what I do in the IRQ:

raster1:	lda #rast1
br1:		cmp $d012
		bne br1
		nop
		nop
		nop
		nop
		nop
		lda #$00
		sta $d020
		sta $d021
(rest of interrupt stuff goes here)


The code simply compares the value in $d012 with the value stored in there by the last IRQ call and waits until the raster makes the switch, then a built in delay of 5 x nop makes sure we are in between the left and right border flip. (4 x nop and 6x nop also seem to work so I chose the safe value of 5 nops).

It SEEMS to work properly but I forgot how I used to do stuff before my 20 year lunchbreak...

I managed to open up the border with my second attempt at an all dancing & singing piece of raster interrupts with music-assembler tunes playing. Next up is a bouncy sprite scroller in the lower (and side) border area.

 
... 10 posts hidden. Click here to view all posts....
 
2010-09-21 11:07
Mr. SID

Registered: Jan 2003
Posts: 424
Have a look at Fungus' double irq stable raster, it's pretty simple:

http://codebase64.org/doku.php?id=base:double_irq
2010-09-21 21:03
MC
Account closed

Registered: Jul 2009
Posts: 71
Thanks. I dropped the idea of having a stable raster running as I'm now using two interrupts (experimenting with the NMI to handle sfx like vibrato, pulse modulation and really fast arps ) while the raster IRQ handles the music tracking.

Experiments experiments I do love em...
2010-09-22 12:13
Testa
Account closed

Registered: Oct 2004
Posts: 197
I always do this:

Init interrupt:

Disable timer interrupts
Enable raster interrupt
Interrupt vector $ffffe/$ffff
$01 = $35
$d012 = $2c
ack interrupt before clear the interrupt flag


Stable1:
inc $d012
inc $d019
cli

stable2:
nop
nop
nop
nop
nop
nop
nop
nop
jmp stable2

irq
ldx #$2c
cpx $d012
beq stable1
dec $d012
inc $d019
ldy #5
dey
bne *-1
nop
inx
cpx $d012
beq stable3
stable3

raster is stable here

don't know if it is sloppy code, but it seems to work...


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
Grue/Extend
Da Snake
BYB/Hokuto Force
Rick/F4CG
Paul Bearer
rexbeng
WVL/Xenon
psych
Guests online: 130
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 Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

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