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 > Free cycles in raster line..
2005-09-16 11:32
Ben
Account closed

Registered: Feb 2003
Posts: 163
Free cycles in raster line..


Is there some sort of stable, line dense raster leaving some cycles per line free which can then be filled with instructions executed outside the IRQ?
2005-09-16 13:53
WVL

Registered: Mar 2002
Posts: 902
you can make an nmi that you trigger each 63 cycles maybe.. then you have to take care of turning the nmi's on/off by yourself though (or you have to make 200 separate nmi's ;)

for some examples, look at some nmi sample players.
2005-09-16 15:39
yago

Registered: May 2002
Posts: 333
Some hints when using nmis for rasters:
nmis should be turned on with stable irq
only use accumulator inside nmi-routine

so that only

pha
;some routine
pla
rti

is neccesary.

To turn the nmis off, a normal raster-irq is sufficient.

And to spare some additional cycles, ROM should be turned off.

2005-09-16 16:02
WVL

Registered: Mar 2002
Posts: 902
Quote: Some hints when using nmis for rasters:
nmis should be turned on with stable irq
only use accumulator inside nmi-routine

so that only

pha
;some routine
pla
rti

is neccesary.

To turn the nmis off, a normal raster-irq is sufficient.

And to spare some additional cycles, ROM should be turned off.



and yago is wasting cycles immediately! ;)

better not to use pha/pla, that costs you 7 cycles! rather put the code in the 0page, and do

sta loada
;some routine
loada=*+1
lda #$00
rti

which is only 5 cycles for saving & restoring the accumulator.. 2 cycles profit of the max 63 available. You can buy me a beer at PS.

cycles, my precioussssss
2005-09-16 16:05
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: and yago is wasting cycles immediately! ;)

better not to use pha/pla, that costs you 7 cycles! rather put the code in the 0page, and do

sta loada
;some routine
loada=*+1
lda #$00
rti

which is only 5 cycles for saving & restoring the accumulator.. 2 cycles profit of the max 63 available. You can buy me a beer at PS.

cycles, my precioussssss


Since beer is for free at PS, I will just go and fetch you one then :)
2005-09-16 17:22
tlr

Registered: Sep 2003
Posts: 1790
Quote: you can make an nmi that you trigger each 63 cycles maybe.. then you have to take care of turning the nmi's on/off by yourself though (or you have to make 200 separate nmi's ;)

for some examples, look at some nmi sample players.


We did this in 6566+. There is an interrupt on each raster line, even though we decided on colors that doesn't change at every line.
It won't be more stable than within roughly 7 cycles depending on what code you run in the background, but it will always stay around the desired point.
If you want it on the exact same cycle every time you will have to waste cycles to take up the jitter every interrupt.
2005-09-16 18:33
yago

Registered: May 2002
Posts: 333
Marko Makela described this Technique in C=Hacking #10.

http://www.ffd2.com/fridge/chacking/

@WVL: OK, I'll give you a Karlsquell.
2005-09-16 19:35
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: We did this in 6566+. There is an interrupt on each raster line, even though we decided on colors that doesn't change at every line.
It won't be more stable than within roughly 7 cycles depending on what code you run in the background, but it will always stay around the desired point.
If you want it on the exact same cycle every time you will have to waste cycles to take up the jitter every interrupt.


I see you are using:

thing pha
lda $dd0d
inc foo+1
foo lda $0800
sta $d021
sta $d020
pla
rti

You however seem to destroy the initialization of the interrupts on purpose :)

I reckon you do something like
lda #<thing
ldx #>thing
sta $0316
stx $0317
to launch the NMI

7 cycles jitter is quite a blow.. is there any mechanism allowing one to stabilize the raster in any fashion, e.g. to appropriate the routine for open sideborder?
2005-09-16 19:37
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: Marko Makela described this Technique in C=Hacking #10.

http://www.ffd2.com/fridge/chacking/

@WVL: OK, I'll give you a Karlsquell.


Nice magazine :) Thanks for the link!
2005-09-16 20:11
tlr

Registered: Sep 2003
Posts: 1790
Quote: I see you are using:

thing pha
lda $dd0d
inc foo+1
foo lda $0800
sta $d021
sta $d020
pla
rti

You however seem to destroy the initialization of the interrupts on purpose :)

I reckon you do something like
lda #<thing
ldx #>thing
sta $0316
stx $0317
to launch the NMI

7 cycles jitter is quite a blow.. is there any mechanism allowing one to stabilize the raster in any fashion, e.g. to appropriate the routine for open sideborder?


We thought we were the first doing full screen rasters with sprites over them + music running, so we wanted to set the competition back a bit. ;) (also I was 14 years old)

The over writing is done when starting the code, but ironically I forgot the packed version at $8000. :P
Note that Rob Hubbards Zoolook was manually relocated to
$090d to get a contiguous block just for show off. :)

BTW: I still haven't found anyone doing this before us, does anyone here know an earlier example of this technique?
2005-09-16 20:37
tlr

Registered: Sep 2003
Posts: 1790
Quote: I see you are using:

thing pha
lda $dd0d
inc foo+1
foo lda $0800
sta $d021
sta $d020
pla
rti

You however seem to destroy the initialization of the interrupts on purpose :)

I reckon you do something like
lda #<thing
ldx #>thing
sta $0316
stx $0317
to launch the NMI

7 cycles jitter is quite a blow.. is there any mechanism allowing one to stabilize the raster in any fashion, e.g. to appropriate the routine for open sideborder?


That should be $0318/$0319, but it would be much better to use $fffa/$fffb.
Also the 7 cycles (or is it 6?) depend on the fact that the longest 6510 instruction is 7 cycles (eg "inc abs,x"). If you restrict which instructions you run, you will get less jitter. If you want it really stable you'll have to use the timer value to compensate, which won't leave many cycles at all for stuff to run in the background.
 
... 15 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - 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
Peacemaker/CENSOR/Hi..
Scrap/Genesis Project
t0m3000/hf^boom!^ibx
Perplex/Offence
CreaMD/React
Knut Clausen/SHAPE/F..
Sillicon/Unreal
The Human Co../Maste..
Dr.Science/Atlantis
Malmix/Fatzone
ΛΛdZ
kbs/Pht/Lxt
MCM/ONSLAUGHT
Conjuror
Guests online: 128
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (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 Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

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