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 > 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
 
... 10 posts hidden. Click here to view all posts....
 
2007-06-19 13:32
Mace

Registered: May 2002
Posts: 1799
Damn hard to read, unformatted code with hard addresses instead of labels :P

request   please use
          the [ code ] UBB-codes
          to format
your code
2007-06-19 13:34
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
this is the biggest and worst sinus raster routine i have ever seen :)
2007-06-19 13:37
Mace

Registered: May 2002
Posts: 1799
The CSDb way of teaching in a nutshell:

Quoting Oswald
ah getting better, altho still messy

Quoting Mace
Damn hard to read, unformatted code with hard addresses instead of labels

Quoting Rambones
This is the biggest and worst sinus raster routine i have ever seen

:D
2007-06-19 13:44
Conrad

Registered: Nov 2006
Posts: 849
Here's a cleaned up version of the code (ACME).

Hope it makes more sense now :-)

EDIT: the text supposed to have tabs to make the layout better, but looks like it hasn't turned out good on this forum :D


!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
!for I, 12 { nop } ;2 * 12

ldy #$00
.loop1
ldx #$08
.loop2
lda colours_show ,y ;4
sta $d020 ;4
sta $d021 ;4
iny ;2
dex ;2
beq .loop1 ;3

!for I, 20 { nop } ;2 * 20

colourbar_lines
cpy #$47 ;2
bne .loop2 ;3

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



;----- and now, the sinus thingy...

clc
sinus_pointer_1
ldx #$00
lda sinus_table,x

sinus_pointer_2
ldx #$00
adc sinus_table,x
tay
clc
ldx #$00

sinus_loop
lda colours_raw,y
sta colours_show,x

iny
cpy colourbar_lines+1
bcc sinus_skip
beq sinus_skip
tya
sbc colourbar_lines+1
tay
clc
sinus_skip
inx
cpx colourbar_lines+1
bne sinus_loop

lda sinus_pointer_1+1
clc
adc #$01
sta sinus_pointer_1+1

lda sinus_pointer_2+1
clc
adc #$02
sta sinus_pointer_2+1

jmp $ea81


kopieren
ldx #$00
.copy
lda colours_raw,x
sta colours_show,x
inx
bpl .copy
rts


*=$0f00
colours_raw
!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


*=$1200
colours_show ;This is where the bar are displayed on screen



*=$1400
sinus_table
!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 15:15
raven
Account closed

Registered: Jan 2002
Posts: 137
Just a small note, might be irrelevant to this prog:

dec $d019 ;4 <-- if this is supposed to be a cycle count,
it is wrong.
DEC/INC $xxxx takes 6 cycles
2007-06-19 16:13
Mace

Registered: May 2002
Posts: 1799
@ CRD: since you missed it the first time I posted it, I will post it in ALL CAPS NOW:

USE [ CODE ] {insert code here} [ /CODE ]

And your tabs are there again ;-)
2007-06-19 16:56
Oswald

Registered: Apr 2002
Posts: 5094
time to add proper irq set up code & explanation to codebase64.... +stable irq, etc etc...
2007-06-20 08:08
spindizzy
Account closed

Registered: Feb 2007
Posts: 18
Many many Thanx,
@CRD, thx for the code, now i'm trying to understand it ;) !
Thanx to everybody and i will now always use ()


;)
Spindizzy
2007-06-20 08:10
spindizzy
Account closed

Registered: Feb 2007
Posts: 18
i mean formatted Code !

;)
Spindizzy
2007-06-20 20:27
Danzig

Registered: Jun 2002
Posts: 440
not to forget that jmp$ea81 is teh shyte... use jmp$ea7e instead for $dc0d...

or even better, don't use irq at all for just some crappy moving rastersbars :D
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
kbs/Pht/Lxt
Andy/AEG
XmikeX
Peacemaker/CENSOR/Hi..
Sulevi/Virtual Dreams
slimeysmine
megasoftargentina
grass/LETHARGY
Hagar/The Supply Team
t0m3000/hf^boom!^ibx
Mibri/ATL^MSL^PRX
Guests online: 169
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 Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

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