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 > half variance who can help me...
2005-04-22 17:57
Testa
Account closed

Registered: Oct 2004
Posts: 197
half variance who can help me...

high.. after 14 years i am coding again... after some starting problems i coded a sideborderroutine witch uses a loop. no big routines with endless nops and bit ea. but a nice little routine witch works just fine. one problem. i used an old source from myself and it seems that i have a big timing problem it only works at line $b5?? strange i dont use a double irq or any other method to stable the lines . so is this a lucky timing thing??? who knows an easy example of the half variance method becoz i dont like the double irq method... it eats to much time from my point of view..... nice to good again... i never quit again..
2005-04-22 17:59
Testa
Account closed

Registered: Oct 2004
Posts: 197
oh fuck.. i mean nice to code again.. ..sorry for my bad english.. i work on it okay.... bye bye
2005-04-25 05:53
JackAsser

Registered: Jun 2002
Posts: 2014
The half variance method itself stabalizes slower than the double irq method. Half variance takes 3 lines to stabalize where as double irq requires 2. But if you for instance fire off a timer with a 63 tick countdown once you've got a stable raster point you can use the timer value to stabalize later on which will only require about 20 cycles. I do have some nice code which I initially got from Krill. I have to double check with him to see if it's allright to spread.

/JackAsser
2005-04-25 07:53
Testa
Account closed

Registered: Oct 2004
Posts: 197
that would be cool jack! thanks for your reply... i was a little afraid that nobody would give a reply at all... hehe
becoz this is not the first topic about this subject..but
i think that there are a lot of people who are looking for an commented source example of the half variance method instead of just info.... in the mean time iam trying to find it out myself ofcourse.... what a challenge... bye

2005-04-25 08:42
JackAsser

Registered: Jun 2002
Posts: 2014
Ok, I've spoken with Krill and he (as expected) gave me his permissions.

The first thing to recognize when using a raster IRQ is the jitter. The jitter can vary from 0-7 cycles depending on the op-code that executed when the IRQ occured. So, by simply stalling (NOPping) to make sure half the jitter is on line X and half the jitter is on line X+1 you can read $d012 and take appropriate counter measures. This first iteration will reduce the jitter into 0-3 cycles. Another iteration and you're down to 0-1 and yet another iteration (this is the same step as the double irq method), u're down to 0 cycle jitter. You got a stable raster point.

Example code (which should be run without other any IRQ and sprites, and also not crossing a page):
*=$c000
sei

lda #$00 ;Disable sprites
sta $d015

;Wait for vertical blank
bit $d011
bpl *-3
bit $d011
bmi *-3

;Perform the half variance polling
ldx $d012
inx
cpx $d012
bne *-3
ldy #$0a
dey
bne *-1
inx
cpx $d012
nop
beq *+5
nop
bit $24
ldy #$09
dey
bne *-1
nop
nop
inx
cpx $d012
nop
beq *+4
bit $24
ldy #$0a
dey
bne *-1
inx
cpx $d012
bne *+2
nop
nop
nop
nop
nop

Raster is stable here. Now to do something usefull with this we launch a continous timer which a count of 63.

lda #$3e
sta $dc04
sty $dc05
lda #%00010001
sta $dc0e

So simply, the $dc03 contains (62-raster beam xpos) which can be used to stabalize fast and efficient in a raster IRQ for instance.

; blah blah setup raster IRQ code here;

; cli
; jmp *

*=$c200
rasterIRQ:
sta $02 ; Save the regs
stx $03
sty $04

; Read timer value and and compensate
; Due to the setup earlier the timer value will be 7-0.
; If sprites are used here the timer value will shift,
; and appropriate counter measures has to be taken.
lda #$07
eor $dc04 ;7-timer value
sta *+4
bpl *+2
lda #$a9
lda #$a9
lda #$a9
lda #$a5
nop

; Stable raster point here!

I can explain more in depth on #c-64, ircnet.
2005-04-25 20:43
Testa
Account closed

Registered: Oct 2004
Posts: 197
very cool man... and thanx a lot.. this is something i can not code by myzelf at the moment. i am still a beginner... so i have to pay my respect to you boys ... very nice and smart... i think that are a lot of dudes who can use this .. thanks krill thanks jack..... wow...
at the moment i am using the method of trash who also had a topic in this forum about this subject and my sideborderroutine finally works 100 %.... i succeed at last... bye bye ...

i also have a message from loena for krill.. i must say that he is in the hospital at the moment and that he will send you an email as soon when he is at home again.... this nice youngster is very ill... so loena i hope you get better soon ... be strong man like a rock...

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
ciccior2003/HF
ΛΛdZ
kbs/Pht/Lxt
algorithm
radius75
Guests online: 95
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.6)
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 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.088 sec.