| |
Trash
Registered: Jan 2002 Posts: 122 |
Stable rasters, again...
I'm really no newbie at this and I've got a few ideas for some new parts I want to put together but I can't seem to get my rasters stable.
Here's the code, what am I doing wrong?
(Only tested in Vice since my C128 and C64 ain't allowed in the livingroom according to my better half)
* = $0900
;-------------------------------------------------------------------------
rasterrow = $fb
;-------------------------------------------------------------------------
sei
lda #$7f
sta $dc0d
lda #<stableraster
sta $fffe
lda #>stableraster
sta $ffff
lda #rasterrow
sta $d012
lda #$1b
sta $d011
lda #1
sta $d01a
sta $d019
cli
jmp *
;-------------------------------------------------------------------------
stableraster
lda #rasterrow ;2
cmp $d012 ;6
beq newrow ;8 / 9
dec $d012 ;14
bit $ea ;17
nop ;19
adc #1 ;21
cmp $d012 ;
beq *+2 ;
;-------------------------------------------------------------------------
inc $d019 ;Trigger a new interrupt
jsr maincode ;
jmp $ea81 ;done
;-------------------------------------------------------------------------
newrow
inc $d012 ;
inc $d019 ;Trigger a new interrupt
cli
.byte $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea ; 16 * 2 = 32
.byte $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea ; 16 * 2 = 32
.byte $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea, $ea ; 16 * 2 = 32
jmp *-48
;-------------------------------------------------------------------------
maincode
inc $d020
dec $d020
rts
|
|
... 8 posts hidden. Click here to view all posts.... |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Now we're talking stable rasters - anyone knows if there's a way to do it if you're not just jumping to * outside the irq, but doing something else that takes more cycles/command? And preferrably a way that doesn't waste too many additional rasterlines ofcourse. |
| |
TDJ
Registered: Dec 2001 Posts: 1879 |
"(Only tested in Vice since my C128 and C64 ain't allowed in the livingroom according to my better half)"
I think you need a better better half more than you need stable rasters :)
|
| |
Trash
Registered: Jan 2002 Posts: 122 |
Quote: Now we're talking stable rasters - anyone knows if there's a way to do it if you're not just jumping to * outside the irq, but doing something else that takes more cycles/command? And preferrably a way that doesn't waste too many additional rasterlines ofcourse.
I've got an idea that involves NMI-interrupts, in theory all you need for that idea isto do it this way:
1. Find out which timerchip you're working with (it's my understanding that there are two versions out and that they differ a cycle when interrupting)
2. Stable your rasters the usual way (double irq or whatever)
3. Point a timer interrupt at the code above
4. Prepare the interrupt so it corresponds to the exakt number of cycles your C64 invokes in a screen
5. Start the interrupt so it occurs exactly when you want it to
That could work!
The Dark Judge:
No, what I need is a big house with a playroom for just me :-)
|
| |
trident
Registered: May 2002 Posts: 91 |
Quote: Now we're talking stable rasters - anyone knows if there's a way to do it if you're not just jumping to * outside the irq, but doing something else that takes more cycles/command? And preferrably a way that doesn't waste too many additional rasterlines ofcourse.
Is that really a problem with the double-IRQ method? The first IRQ should work with any normal amount of cycle jitter and the second IRQ occurs in the midst of NOPs and isn't affected. In any case, it is always possible to do a tripple-IRQ where the first IRQ just invokes a jmp * loop. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Trash: your idea wont work, as even NMI has to wait the current instruction to be finished before it can jump to it's routine.
The nicest way is to have an nmi timer count the horizontal cycles of each rasterline. So it runs 0-63 all the time in synch with the VIC. Now when your raster irq starts, you just poll the timer to see how much cycles you are off, and then add the needed delay with a self modded beq/bne. (check reflex's 4x4 routines for example, they use this method) |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
Oswald: NMI timer count? Any timer will do :)
The fastest way for a stable raster is probably Double-Timer. Most convenient... way too much ;) Most seem to like Double-IRQ or IRQ+Timer, though.
I give away sources, if someone is interested... |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
ninja:Yeah any timer, just in my mind nmi and timer is connected in a strange way .) |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Guess the double irq would work with more instability aswell. Didn't really get it at first actually. :-) I wasn't aware that you could interrupt and interrupt with another interrupt. I have always used two d012-compares to get the raster stabilized. |
| |
Fungus
Registered: Sep 2002 Posts: 686 |
Sure you can interrupt an IRQ. or even an NMI.
Just CLI in your irq/nmi routine (as the processor sets this flag when any irq/nmi condition occurs).
This is even used as a protection sometimes.
I like that timer/irq method. But doubel irq is most trustworthy when it comes right down to it. It works weather your on pal or ntsc (provided enough nops are there) , doesnt matter what vic chip revision (pal or ntsc), or CIA revision (pal or ntsc).
www.ffd2.com/fridge/stableraster.txt
;)
|
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
I prefer the timer approach since 63-timer value + some offset is actually the X-position of the rasterbeam. This gives you the opportunity to create auto adjusting timing such as when removing the sideborder which requires exact timing plus using an unknown number of sprites flying around which screws up the timing.
/JackAsser
|
Previous - 1 | 2 - Next |