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 > Beginner: Raster Bars etc
2003-12-12 01:21
wozza

Registered: May 2003
Posts: 18
Beginner: Raster Bars etc


As a beginner in ML C64 coding, I would like to ask for assitance in a programming related matter. I'm trying not to be a 'lamer' and ask 'how to do this?'without trying to work it out myself - Rather is it permitted to post my crap code that kinda works - for members to help me understand what basics I am doing wrong.

If the forum considers that this post is not what should be here, please say so, and I wont bother you again.

If this is the case please ignore the following, Otherwise I'm sure that you gurus will easily guide me in the right direction.

I'm am trying to create a rather simple effect, moving some raster bars, but I'm having problems with my loop, as for some reason the rotation of the bars and the colours also increases the same colours in the border and screen.

What am I doing wrong so I can just rotate the bars colours.

Thanking you in advance.

Regards, Wozza.

*= $2000

sei
lda #147
jsr $ffd2
lda #$7f
sta $dc0d
lda #$60
sta $d012
lda #<irq
sta $0314
lda #>irq
sta $0315
lda #$f1
sta $d01a
cli
ever jmp ever

irq lda #01
sta $d019
lda $d011
and #$7f
sta $d011
lda #$60
sta $d012
ldx #00
back lda colr,x
sta $d020
sta $d021
jsr delay
inx
cpx #78
bne back
ldx #00
ldy colr
loop lda colr+1,x
sta colr,x
inx
cpx #78

bne loop
tya
sta colr,x
jmp $ea31

delay ldy #05
del1 nop
dey
bne del1
rts


colr
!byte $00,$09,$09,$08,$0a,$07,$01,$00,$09,$09,$02,$02,$08,$08
!byte $0a,$0a,$07,$07,$01,$01,$00,$09,$09,$09,$02,$02,$02,$08,$08,$08
!byte $0a,$0a,$0a,$07,$07,$07,$01,$01,$01,$01,$01,$01,$07,$07,$07,$0a
!byte $0a,$0a,$08,$08,$08,$02,$02,$02,$09,$09,$09,$00,$01,$01,$07,$07
!byte $0a,$0a,$08,$08,$02,$02,$09,$09,$00,$01,$07,$0a,$08,$02,$09,$00



 
... 1 post hidden. Click here to view all posts....
 
2003-12-12 07:06
Stryyker

Registered: Dec 2001
Posts: 465
I don't understand your problem. You want to have the region outside of the raster bars black?
2003-12-12 07:38
fade
Account closed

Registered: Mar 2002
Posts: 290
back lda colr,x
sta $d020
sta $d021

i;d say this is where it goes wrong, but i cant code outside of my sleep so for predictions sake, yes krill is right and it only took four lines ! :)
2003-12-12 08:18
Oswald

Registered: Apr 2002
Posts: 5017
hi... :)

first of all.. your delay routine wont work out correctly, as the timing is not the same for all lines. on the first rasterline of ever char row the vic steals 40 cycles from the cpu, so there you need to have less delay...

from the top of my head.. :

ldx #$00
loop lda color,x
sta $d020
sta $d021
ldy delaytab,x
dey
bne *-1
inx
cpx #linestodisplay
bne loop

lda #$00
sta $d020
sta $d021 ;you need this to have a constant color
;outside your colored rasterlines



delaytab .byte 1,8,8,8,8,8,8,8
.byte 1,8,8,8,8,8,8,8
.byte 1,8,8,8,8,8,8,8
...

colors .byte ...whatever...


you have to get the routine above to start on the right cycle in a rasterline, and it will work...
2003-12-12 09:33
Stryyker

Registered: Dec 2001
Posts: 465
and for that, easiest would be to check C= Hacking archives, www.ffd2.com has them
2003-12-14 21:14
wozza

Registered: May 2003
Posts: 18
Thanks guys. Not only was the loop wrong, but as mentioned the timing was up the creek.
I appreciate your time.
Cheers. wozza
2003-12-19 10:48
Richard

Registered: Dec 2001
Posts: 619
Although I can code rasters, there's something, which I cannot do, and that is a small raster bar moving over the large one, and then moving behind. An example for this is the WOD intro designer.

I know Fairlight used some sprites, instead of a proper raster bar for their intro (That green bar going under & over the FLT logo).
2003-12-19 14:26
algorithm

Registered: May 2002
Posts: 702
It's far easier than you think. An area of memory is reserved for the color values and all these color values are read in a loop and plotted to $d020 etc.

sei
lp3 ldx #$80
ldy #$00
lp2 lda $1000,y
lp1 cpx $d012
bne lp1
sta $d020
sta $d021
inx
inx
iny
cpy #$3f
bne lp2
jmp lp3

In the above example $1000-$103f holds the color values, you just have to create a routine which shifts the color values in the $1000-$103f and not to worry about changing the rasters etc.

In the above example, only even raster lines are latched on to (no badlines)

Sorry for the poor example, but it's been 8 years since coding on the C64.
2003-12-19 16:21
Richard

Registered: Dec 2001
Posts: 619
Thank you & Merry Christmas :)
2004-03-15 13:10
Optic
Account closed

Registered: May 2002
Posts: 28
Someone who is able and willing, please pick up the coding tutorial left unfinished by Cruzer/CML..

The first chapters are already there, but just when things get interesting.. *arrgh*

http://www.c64.ch/programming/
2004-03-15 13:13
Optic
Account closed

Registered: May 2002
Posts: 28
*weird double-post deleted*
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
spider-j
kbs/Pht/Lxt
zscs
Didi/Laxity
Ray Manta/DataDoor
Paulko64
Gordian
Sumaleth/Pearl
LDX#40
Thierry
Guests online: 60
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 MWS  (9.6)

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