Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user dstar ! (Registered 2024-05-25) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Sinus waving Rasterbars
2007-06-19 12:52
spindizzy
Account closed

Registered: Feb 2007
Posts: 18
Sinus waving Rasterbars

Hi gentlemen,

i'm trying to make some rasterbars which are moving on a sinus curve, but i'm not able to do this ;(, are ther perhaps code snippets tutorials which explain the sinus - effect on rasterbars or perhaps you can help me, here is my code :

!to "sinus.prg",cbm

*= $0800
!byte $00,$0c,$08,$0a,$00,$9e,$32,$31,$32,$38,$00,$00,$00,$00



*=$0850
jsr kopieren
sei ;2
lda #$7f ; 2
sta $dc0d ;4
lda $dc0d ;4
lda #$32 ;2
sta $d012 ;4
lda $d011 ;4
and #$7f ;2
sta $d011 ;4
lda #$01 ;2
sta $d01a ;4
ldx #<irq ;2
ldy #>irq ;2
stx $0314 ;4
sty $0315 ;4
lda #147
jsr $ffd2
cli ;2
rti ;6
irq
dec $d019 ;4
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop

ldy #$00
.loop1 ldx #$08
.loop2 lda $1200 ,y ;4
sta $d020 ;4
sta $d021 ;4
iny ;2
dex 2
beq .loop1 ;3
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
cpy #$47 ;2
bne .loop2 ;3

lda #$00 ;2
sta $d020 ;4
lda #$00 ;2
sta $d021 ;4



;-----------------------
lda #$00
sta $1500
ldx #$05
label1 lda $1400
sta $1600
ldy #$0e
label2 lda $0f00,y
sta $1200,y
dey
bpl label2
lda $1500
clc
adc #$0c
sta $1500
dex
bne label1
lda $1700
clc
adc #$03
sta $1700
jmp $ea81

kopieren ldx #$00
.copy lda $0f00,x
sta $1200,x
inx
bpl .copy
rts


*=$0f00

!byte $00, $00, $00, $00, $00, $00, $00, $00
!byte $02, $02, $01, $02, $02, $02, $0a, $0a
!byte $02, $0a, $0a, $0a, $07, $07, $0a, $07
!byte $07, $01, $01, $07, $01, $01, $01, $01
!byte $07, $01, $01, $07, $07, $0a, $07, $07
!byte $0a, $0a, $0a, $02, $0a, $0a, $02, $02
!byte $02, $01, $02, $02, $00, $00, $00, $00
!byte $00, $00, $00, $00, $00, $00, $00, $00
!byte $06, $0e, $03, $01, $03, $0e, $06, $00




*=$1400

!byte $00,$00,$00,$00,$00,$01,$02,$02
!byte $03,$04,$05,$07,$08,$09,$0b,$0c
!byte $0e,$10,$12,$14,$16,$18,$1a,$1c
!byte $1e,$21,$23,$25,$28,$2a,$2d,$2f
!byte $32,$34,$36,$39,$3b,$3e,$40,$42
!byte $45,$47,$49,$4b,$4d,$4f,$51,$53
!byte $55,$57,$58,$5a,$5b,$5c,$5e,$5f
!byte $60,$61,$61,$62,$63,$63,$63,$63
!byte $63,$63,$63,$63,$63,$62,$61,$61
!byte $60,$5f,$5e,$5c,$5b,$5a,$58,$57
!byte $55,$53,$51,$4f,$4d,$4b,$49,$47
!byte $45,$42,$40,$3e,$3b,$39,$36,$34
!byte $31,$2f,$2d,$2a,$28,$25,$23,$21
!byte $1e,$1c,$1a,$18,$16,$14,$12,$10
!byte $0e,$0c,$0b,$09,$08,$07,$05,$04
!byte $03,$02,$02,$01,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$01,$02,$02
!byte $03,$04,$05,$07,$08,$09,$0b,$0c
!byte $0e,$10,$12,$14,$16,$18,$1a,$1c
!byte $1e,$21,$23,$25,$28,$2a,$2d,$2f
!byte $32,$34,$36,$39,$3b,$3e,$40,$42
!byte $45,$47,$49,$4b,$4d,$4f,$51,$53
!byte $55,$57,$58,$5a,$5b,$5c,$5e,$5f
!byte $60,$61,$61,$62,$63,$63,$63,$63
!byte $63,$63,$63,$63,$63,$62,$61,$61
!byte $60,$5f,$5e,$5c,$5b,$5a,$58,$57
!byte $55,$53,$51,$4f,$4d,$4b,$49,$47
!byte $45,$42,$40,$3e,$3b,$39,$36,$34
!byte $31,$2f,$2d,$2a,$28,$25,$23,$21
!byte $1e,$1c,$1a,$18,$16,$14,$12,$10
!byte $0e,$0c,$0b,$09,$08,$07,$05,$04
!byte $03,$02,$02,$01,$00,$00,$00,$00



Many, many thanx
;)
Spindizzy
2007-06-19 13:12
Oswald

Registered: Apr 2002
Posts: 5028
holy cow, ffd2 to clr the screen ?! :D first of all look around there have been quite a few topics about how to set up a raster irq.... yours obviously wrong you should end it with rts, rti serves only to "return from interrupt" and is not exchangeable with rts "return from subroutine".


secondly, coding everything at one go and then wondering why doesnt it work is a wrong approach, and dont telling us what doesnt work is wrong again.

here is how do you supposed to work:

1. try to set up a raster irq
2. try to make it display nice raster bars
3. try to make one rasterbar move on it
4. try to make many rasterbar move on it

now at which point have you failed? I suppose already at nr1...
2007-06-19 13:14
spindizzy
Account closed

Registered: Feb 2007
Posts: 18
thx for your answer oswald ;)
ok rts instead of rti !

;)
Spindizzy
2007-06-19 13:17
Oswald

Registered: Apr 2002
Posts: 5028
so does it wok now ? maybe tell us which part fails... ;)
2007-06-19 13:19
spindizzy
Account closed

Registered: Feb 2007
Posts: 18
The point I failed was to make some sinusodial weavin Rasterbars.
1. I made some standing rasterbars -> works
2. I made them movin' up / down -> works
3. I tried a sinus Wave on some bars -> ;((

thx
Spindizzy
2007-06-19 13:22
spindizzy
Account closed

Registered: Feb 2007
Posts: 18
äähhmmm i really don't know how to describe but they simply don'move ;)

thx
Spindizzy
2007-06-19 13:23
Oswald

Registered: Apr 2002
Posts: 5028
try just one bar without sine, then add sine, then add more bars ;)
2007-06-19 13:24
Conrad

Registered: Nov 2006
Posts: 837
try this version. not too sure if it's what you're wanting though.


!to "execute.prg",cbm

*= $0800
!byte $00,$0c,$08,$0a,$00,$9e,$32,$31,$32,$38,$00,$00,$00,$00



*=$0850
jsr kopieren
sei ;2
lda #$7f ; 2
sta $dc0d ;4
lda $dc0d ;4
lda #$32 ;2
sta $d012 ;4
lda $d011 ;4
and #$7f ;2
sta $d011 ;4
lda #$01 ;2
sta $d01a ;4
ldx #<irq ;2
ldy #>irq ;2
stx $0314 ;4
sty $0315 ;4
lda #147
jsr $ffd2
cli ;2
rti ;6
irq
dec $d019 ;4
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop

ldy #$00
.loop1 ldx #$08
.loop2 lda $1200 ,y ;4
sta $d020 ;4
sta $d021 ;4
iny ;2
dex ;2
beq .loop1 ;3
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
nop ;2
cpy #$47 ;2
bne .loop2 ;3

lda #$00 ;2
sta $d020 ;4
lda #$00 ;2
sta $d021 ;4



;-----------------------

clc
ldx $1500
lda $1400,x
ldx $1700
adc $1400,x
tay
clc

ldx #$00

loop
lda $0f00,y
sta $1200,x

iny
cpy #$48
bcc skip
tya
sbc #$47
tay
clc
skip
inx
cpx #$48
bne loop

lda $1500
clc
adc #$01
sta $1500
lda $1700
clc
adc #$02
sta $1700
jmp $ea81








kopieren ldx #$00
.copy lda $0f00,x
sta $1200,x
inx
bpl .copy
rts


*=$0f00

!byte $00, $00, $00, $00, $00, $00, $00, $00
!byte $02, $02, $01, $02, $02, $02, $0a, $0a
!byte $02, $0a, $0a, $0a, $07, $07, $0a, $07
!byte $07, $01, $01, $07, $01, $01, $01, $01
!byte $07, $01, $01, $07, $07, $0a, $07, $07
!byte $0a, $0a, $0a, $02, $0a, $0a, $02, $02
!byte $02, $01, $02, $02, $00, $00, $00, $00
!byte $00, $00, $00, $00, $00, $00, $00, $00
!byte $06, $0e, $03, $01, $03, $0e, $06, $00




*=$1400

!byte $00,$00,$00,$00,$00,$01,$02,$02
!byte $03,$04,$05,$07,$08,$09,$0b,$0c
!byte $0e,$10,$12,$14,$16,$18,$1a,$1c
!byte $1e,$21,$23,$25,$28,$2a,$2d,$2f
!byte $32,$34,$36,$39,$3b,$3e,$40,$42
!byte $45,$47,$49,$4b,$4d,$4f,$51,$53
!byte $55,$57,$58,$5a,$5b,$5c,$5e,$5f
!byte $60,$61,$61,$62,$63,$63,$63,$63
!byte $63,$63,$63,$63,$63,$62,$61,$61
!byte $60,$5f,$5e,$5c,$5b,$5a,$58,$57
!byte $55,$53,$51,$4f,$4d,$4b,$49,$47
!byte $45,$42,$40,$3e,$3b,$39,$36,$34
!byte $31,$2f,$2d,$2a,$28,$25,$23,$21
!byte $1e,$1c,$1a,$18,$16,$14,$12,$10
!byte $0e,$0c,$0b,$09,$08,$07,$05,$04
!byte $03,$02,$02,$01,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$01,$02,$02
!byte $03,$04,$05,$07,$08,$09,$0b,$0c
!byte $0e,$10,$12,$14,$16,$18,$1a,$1c
!byte $1e,$21,$23,$25,$28,$2a,$2d,$2f
!byte $32,$34,$36,$39,$3b,$3e,$40,$42
!byte $45,$47,$49,$4b,$4d,$4f,$51,$53
!byte $55,$57,$58,$5a,$5b,$5c,$5e,$5f
!byte $60,$61,$61,$62,$63,$63,$63,$63
!byte $63,$63,$63,$63,$63,$62,$61,$61
!byte $60,$5f,$5e,$5c,$5b,$5a,$58,$57
!byte $55,$53,$51,$4f,$4d,$4b,$49,$47
!byte $45,$42,$40,$3e,$3b,$39,$36,$34
!byte $31,$2f,$2d,$2a,$28,$25,$23,$21
!byte $1e,$1c,$1a,$18,$16,$14,$12,$10
!byte $0e,$0c,$0b,$09,$08,$07,$05,$04
!byte $03,$02,$02,$01,$00,$00,$00,$00
2007-06-19 13:25
spindizzy
Account closed

Registered: Feb 2007
Posts: 18
thx Oswald i 'll tryin' it ;)

Spindizzy
2007-06-19 13:25
Oswald

Registered: Apr 2002
Posts: 5028
ldy #$0e


sure they dont move, you copy using the same offset every time.
2007-06-19 13:28
Oswald

Registered: Apr 2002
Posts: 5028
ah getting better, altho still messy, maybe you could try use some labels that makes more sence than $1500 and $1700 :)
 
... 10 posts hidden. Click here to view all posts....
 
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
nucleus/TempesT
TheRyk/MYD!
rambo/Therapy/ Resou..
Higgie/Kraze/Slacker..
Jetboy/Elysium
Sabbi/Hokuto Force
Mythus/Delysid
FABS/HF
sebalozlepsi
void256
Guests online: 68
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 No Bounds  (9.6)
7 Comaland 100%  (9.6)
8 Uncensored  (9.6)
9 Aliens in Wonderland  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 It's More Fun to Com..  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Covert Bitops  (9.4)
2 Nostalgia  (9.4)
3 Oxyron  (9.3)
4 Booze 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.071 sec.