| |
ready.
Registered: Feb 2003 Posts: 441 |
full screen sprite mux scroller
hello all,
I am coding an upscroller but I'd like to put it in upper and lower border, thus I am using sprites for displaying text, just like +2K end part.
I got the main code to work: I have a stable irq (1-cycle jitter), I move up by one raster line all raster IRQs when I want to move up the text/sprites and that works. I use the $d018 trick to change sprite pointer and that works.
But I am having trouble with bad lines, which still cause flickering when I change $d018 during one of them.
How could I have the $d018 write happen when I want? I tried to move the IRQ entry point earlier in the position of a bad line, but that does not help: then $d018 changes too early and sprites are displayed wrong.
I cheked the +2K code but I could not get out with it.
thanx for help,
Ready.
|
|
... 20 posts hidden. Click here to view all posts.... |
| |
algorithm
Registered: May 2002 Posts: 705 |
@ready. you can try what jackasser suggested. or if $d018 switching on badline with 8 sprites is an issue, perhaps use 7 sprites and use the $d018 method |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Quote: @Ready: For a sprite upscroller the extremly simple solution is not to pack the sprites back 2 back, nobody will notice nor care anyway. Have a gap of 2 raster lines or something and get on with it.
if I were going for this (I was) I'd use 5 pixel high chars, that gives you 2 rasterlines between char rows (3 char rows per sprite each 7 pixel high), and sprites can still be back 2 back. only the sprite pointer changing can be inaccurate. |
| |
ready.
Registered: Feb 2003 Posts: 441 |
@Oswald and Jackasser: I might have to face reality and surrender to a compromise. Actually I wanted to implement something that can be "recycled", use it this time for displaying text and maybe in the future a picture or something continuos, unlike char rows. But still leave the possibility to use char displaying behind/over sprites.
I had in mind the Pearl For Pigs big sprite picture moving around the screen (borders included), but there's no char mode behind and I guess (have not checked the code) there's no bad line happening there.
I might try a few more tricks using stable raster before surrendering :)
I'd like to try the $d018 change one the line right before a bad line but after all the sprites on that line have been displayed. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
you may also want to try to dec/inc d018 as suggested, but make your raster stable first. then try to find the sweet spot :) |
| |
ready.
Registered: Feb 2003 Posts: 441 |
ok, I am getting the first decent results.
First I implemetned a 100% stable raster. Used double irq method for first synch in order to start CIA1 timer A at the beginning of a raster line (loaded $dc04 with value #62).
Then my $d012 irq code looks like this:
[/code]
pha
lda $dc04
eor #63
lsr
sta *+4
bpl *+2
.fill 30, $ea
bcc *+2
bit $ea
irq_badline_patch
nop #$ff ;nop #$ff = 2 cycles, op code $80
;nop $ff = 3 cycles, op code $04
nop
bit $ea
irq_d018
lda #00 ;$d018
sta $d018
inc $d021
dec $d021
|
| |
ready.
Registered: Feb 2003 Posts: 441 |
hello again. I am getting the first good results.
I implemented a stable irq via CIA timer. I used a double irq synching routine to start CIA1 timer A at the beginning of a raster line in the upper border (to avoid bad lines). I loaded $dc04 with #62.
Then my $d012 irq looks like this (unoptimized):
irq
pha
lda $dc04
eor #63
lsr
sta *+4
bpl *+2
.fill 30, $ea
bcc *+2
bit $ea
irq_badline_patch
nop #$ff ;nop #$ff = 2 cycles, op code $80
;nop $ff = 3 cycles, op code $04
nop
bit $ea
irq_d018
lda #00
sta $d018
inc $d021
dec $d021
;rest of irq code: set sprite y position, new sprite pointers, badline patch for next irq.......
In this way $d018 is set right after the beginning of a raster line.
Bad lines are handled using a lookup table that can add (irq_badline_patch = $04) or not add (irq_badline_patch = $80) 1 cycle delay.
When bad lines cause wrong sprite pointer to display, the corresponding irq has to be anticipated by 1 raster line and eventually patched with irq_badline_patch = $04.
The tuning process is tedious as there are 21 y positions, so 21 frames to tune and for each frame there can be some bad line to fix.
Furthermore, entry irq raster line anticipation and irq_badline_patch can be fine tuned also to solve the conflict with the nmi routine I use for opening the upper/lower border.
I'll get back with results after tuning is done.
So far no need for inc/dec $d018.
Sorry for double posting, can't delete the previous one. |
| |
WVL
Registered: Mar 2002 Posts: 902 |
Quoting ready.I had in mind the Pearl For Pigs big sprite picture moving around the screen (borders included), but there's no char mode behind and I guess (have not checked the code) there's no bad line happening there.
No badlines there :) (if there would be, you can be 100% sure I would have shown that by displaying a nice picture ofcourse! ;)) |
| |
Mr. SID
Registered: Jan 2003 Posts: 424 |
Maybe this can give you some ideas? It has graphics behind the big sprite head.
Einstein IV
|
| |
ready.
Registered: Feb 2003 Posts: 441 |
@Mr.SID: yeah I remember that demo, amazing stuff for 1989.
Anyhow, I finally managed to get the scroller right without glitches.
Sooner or later I will put some char stuff behind. Ok, enough for today, gotta rush, as I am becoming father again :)
|
| |
WVL
Registered: Mar 2002 Posts: 902 |
Good that you got it working!
Btw, you can forget to have 8 sprites, open sideborders and a picture in the background (well, a picture with badlines at least..).
There's no multiplexer in PfP at all btw, the zoomer in the borders only has 7 sprites on the screen... |
Previous - 1 | 2 | 3 - Next |