Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > help to create delay table for raster
2008-12-03 08:08
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....
 
2008-12-03 09:25
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 :)
2008-12-03 13:20
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 :)
2008-12-04 03:41
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))
2008-12-04 10:07
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)


2008-12-04 13:41
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 :)

2008-12-04 13:58
Dr.j

Registered: Feb 2003
Posts: 277
thanks Raven :)
2008-12-04 15:11
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.
2008-12-20 17:53
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.
2008-12-21 01:07
Moloch

Registered: Jan 2002
Posts: 2928
Coders World died after issue #3.
2008-12-22 06:58
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
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
rexbeng
E$G/HF ⭐ 7
RetroGL
Andy/AEG
DeMOSic/MS^LSD^ONS
Guests online: 105
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.059 sec.