| |
andym00
Registered: Jun 2009 Posts: 45 |
$d013 sync ??
Okay, be nice, I've been away from the C64 for over 20 years and I thought this would be easy having seen it mentioned once on here... I cobbled this together a few weeks ago, and now when I've just tried it out again I'm getting variable results, regards getting to a stable clock cycle..
lda #16
sta $dc01
lda #0
sta $dc01
lda $d013
lsr
lsr
adc #17+13
lsr
sta bm + 1
bm: bne *
!for .count, 30 {
nop
}
bcs + ; if carry set 3 cycles, if clear 2 cycles..
Okay, so maybe it might be out by a constant amount of cycles, but it's all over the place..
Does this technique actually work (by creating a button press to trigger the light-pen) or have I misunderstood from what little tidbits have been mentioned here ?
I examined a load of demos and don't see much messing with $d013, so I'm guessing maybe I've got the wrong end of the stick, but this should work in theory right ?
I only want it for stablising some CIA IRQs, and I know there's other ways to do it, but this just seemed like something I should give a go, but it's borked :) |
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
here is a working routine (used this last time over 10 years ago, forgot how exactly it works =P)
.scope
lda $d019
sta $d019
ldx #$ff
ldy #$00
stx $dc00
sty $dc02
stx $dc03
stx $dc01
sty $dc01
stx $dc01
lda $d013
stx $dc02
sty $dc03
stx $dc01
ldx #$7f
stx $dc00
lsr a
lsr a
lsr a
sta timeout+1
bcc timing
timing: clv
timeout: bvc timeout
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
rts
.endscope
|
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
The $D013 sync has a major disadvantage: If you press space, it does not work. Better synchronize via double IRQ.
|
| |
algorithm
Registered: May 2002 Posts: 705 |
Thats interesting
I assume that this is inside the IRQ and that things would sync properly at the end of the routine? Would sprites affect the syncing of this somewhat. Double IRQ is always a better approach, but the above seems somewhat cleaner.
I would not think it would be that much of an issue to not press spacebar (unless it is a 'press space' to continue' demo) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
ofcourse the syncing is affected by sprites... and also by badlines (or what ever else disturbs the timing) |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
I don't think that inverting the CIAs keyboard matrix direction to cheat the VIC into thinking the lightpen has triggered is somewhat "clean" :)
Btw it would be interesting to know who invented this routine. I've first seen it in 64'er magazine issue 11/88.
|
| |
Radiant
Registered: Sep 2004 Posts: 639 |
I think I've seen stable rasters referred to as "lightpen rasters" in some early demo; perhaps that was the first known method of stabilizing? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
Quote:I've first seen it in 64'er magazine issue 11/88.
hannes sommer .... (and the routine above is exactly his, copied from said 64er =)) |
| |
andym00
Registered: Jun 2009 Posts: 45 |
Thanks Groepaz, that works a treat, and I hunted high and low for that original article from Hannes curious to see how he originally wrote it.. Now I know :)
I just wanted a nice clean way to setup CIAs at startup to the exact cycle I wanted, and if the users presses space then woe betide them ;)
I only wanted to try this way because I never had done before and I liked the idea of it.. |
| |
ready.
Registered: Feb 2003 Posts: 441 |
I am coding a full screen sprite mux, showing sprites on char screen+upper+lower border (not the side boreders) and I need to have a stable raster even in the lower border area where $d011 MSB is at 1.
I think this $d013 stabilizing code is much more handy than double-irq for working in the raster area over $0ff to $137, since you don't need to care about setting $d011. Usually double-irq method just calls for inc $d012, for triggering stable irq on next line, but this does not work in the lower border.
|
| |
Radiant
Registered: Sep 2004 Posts: 639 |
Of course it works in the lower border. The only time it doesn't work is if you're putting the initial IRQ on line $ff - then you need to set $d011 as well. Workaround: don't do that. Other than that, inc $d012 will work just as fine in the lower border as anywhere else on the screen. |
... 6 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 - Next |