| |
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..
|
|
| |
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 |
| |
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 |
| |
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
|
| |
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. |
| |
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...
|