| |
Dr.j
Registered: Feb 2003 Posts: 277 |
help to create delay table for raster
hey there , i wonder if there is a good technique to
create delay table according the raster line. for example
i want to do rasters at #$7c (after a "bad line") the table may look like that : 0a,8,8,8 ,8,8,8,1 (for 8 times)
i know raster line is $40 (63 cycles and 23 for bad line)
but i don't know what is the best way to make this tables.
the routine is simple..
which raster line?
c: lda color,x
ldy delay,x
!:dey
bne !-
sta $d020
sta $d021
inx
cpx #$08
bne c
|
|
... 1 post hidden. Click here to view all posts.... |
| |
daison
Registered: May 2005 Posts: 90 |
I did it recently for the first time and I just manually entered the numbers by looking at the results on screen, for the complete raster area to make every line long enough. I couldn't tweak it to use just 8 lines.
Probably that's a bad approach though, and you should not listen to me at all...
The result is sweet, but if I change my routine, I have to manually adjust the whole area again and of course it takes loads of extra bytes.
...What I'm saying is, I would like more info on it too :) |
| |
Ervin
Registered: May 2008 Posts: 14 |
I think of something like this for the (bad)line-dependent delay:
lda $d012
and #7
tax
ldy delay,x
dey
bne *-1
So only a 8-entry delay table is needed.
(Geez, all registers destroyed :) |
| |
The Phantom
Registered: Jan 2004 Posts: 360 |
Using $d011..
ldx #$00
lda $scanline
cmp $d012 (loop)
bne loop
lda $d012 (loop2)
and #$07
ora #$10
sta $d011
lda $colors,x
sta $d020
sta $d021
inx
cpx #$xx
bne loop2
------
Using Timing....
ldx #$scanline
cpx $d012 (loop1)
bne loop1
ldx #$00
lda $colors,x (loop2)
ldy $timingdata,x
dey (loop3)
bne loop3
sta $d020
sta $d021
inx
cpx #$xx
bne loop2
timingdata $08,$08,$08,$08, etc...
This could be easier if you just read Coders World 2 (article G) ((another shameless plug)) |
| |
Dr.j
Registered: Feb 2003 Posts: 277 |
to The Phantom: i've read coders world #02 (nice mag.)
and i know how to make rasters, but they don't explain
good how to create the delay table.. they jusy say "try and
see" according to the raster-line . i am looking for good'n'simple techniqe. that's all .
thanks for the $d011 method.
/Dr.j of the Force (israel)
|
| |
raven Account closed
Registered: Jan 2002 Posts: 137 |
There is no need to guess or "try".
The loop should take exactly 63 cycles per normal-line
and 23 per bad-line.
Just count the cycles & see exactly which delay value is
needed to reach an exact count per line.
Changing the start-line of the routine might require
changing the start index to the delay table, depending
how you change it.
For example, if this is your delay table:
delay .byte 8,8,8,8,8,8,8,1 <- the 1 is for bad-line
...
and you start the loop on a normal-line right after a bad-
line, you need to read from the beginning of the table.
If you start one line later (2 lines after a bad-line) then
you need to start reading from delay+1 etc etc.
Very simple stuff :)
|
| |
Dr.j
Registered: Feb 2003 Posts: 277 |
thanks Raven :) |
| |
Ervin
Registered: May 2008 Posts: 14 |
Adding a macro before every conditional jump in a cycle-exact timig-critical code, which warns upon compilation if the jump crosses a page, might be a good idea - as well as aligning arrays which are acessed by indexed operations. |
| |
FillmoreC Account closed
Registered: Dec 2008 Posts: 7 |
Quote: Using $d011..
ldx #$00
lda $scanline
cmp $d012 (loop)
bne loop
lda $d012 (loop2)
and #$07
ora #$10
sta $d011
lda $colors,x
sta $d020
sta $d021
inx
cpx #$xx
bne loop2
------
Using Timing....
ldx #$scanline
cpx $d012 (loop1)
bne loop1
ldx #$00
lda $colors,x (loop2)
ldy $timingdata,x
dey (loop3)
bne loop3
sta $d020
sta $d021
inx
cpx #$xx
bne loop2
timingdata $08,$08,$08,$08, etc...
This could be easier if you just read Coders World 2 (article G) ((another shameless plug))
Hey, I've recently read coders world and i tried the code for rasterbars. The $d011 thing worked, but i don't know how to clear the last character to make wierd text go away. How do you clear the last character if you are using the characters that are present when you cut the computer on?
Also, I tried the timming way but when I get to the 3rd line, it messes with the 2nd line. So I could never get past the 3rdline without it messing up.
Also where can I find coders world 4 and beyond that. |
| |
Moloch
Registered: Jan 2002 Posts: 2928 |
Coders World died after issue #3.
|
| |
Dr.j
Registered: Feb 2003 Posts: 277 |
thanks guyz for the help.
have nice "Hanocka" holdiay (traditional jewish holiday)
back 2 work..
|
Previous - 1 | 2 - Next |