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 > Mixing multiple effects is messing up stuff
2011-11-08 22:29
Cobrakid

Registered: Oct 2011
Posts: 23
Mixing multiple effects is messing up stuff

I am doing a small and very lowtech demo but I seem to be confused about the raster timing - probably like any other C64 newbie out there(?).

I know(?) this is related to the raster interrupt I am using plus my routines and that everyone will shout out "learn to code before you do a demo" and you are right but I really need some directions or hints here as I cannot get my head around this problem. I have read a lot on the C64 Codebase and here in the forum but still I don't get it (no hope for me!?).

I am trying to get a static (not moving) rasterbar below a 2x2 scroll plus some music - this must be "demo programming day 1". I have done each part individually and they work but together they are screwing up things (of course!?). Well, the music and the 2x2 scroll I can get working but introducing the raster gets ne problems.

What I have is a rasterbar... fired up at raster pos #$80 (as an example). A few lines below I am starting my scroll and this is totally messing up things... the scroll is veeery slow and shifting between the 2x2 charset and the system charset and when playing music I can hear it is slowing down to 1/4 of the normal pace or alike. This must be because the rasters are overlapping but how can I overcome this?

This is not a matter of getting the rasterbars looking nice but a more fundamental problem I think - then the prettyness of the bars will be a problem for later on.

If anyone would explain me how or point me to a fool-proof-dummy-guide on how I might can solve this I would really appreciate it as I am getting really frustrated now and I don't see any solutions for it (though there obvioulsy is one).
 
... 30 posts hidden. Click here to view all posts....
 
2011-11-10 23:48
Stainless Steel

Registered: Mar 2003
Posts: 966
I'm really not an expert, but i took the liberty to modify your code a bit. how about this :

(ACME format. Rasterbar timingtable unfixed. Also this is is not the best way to do things but it works. Note for the wiseguys : yeah $d012 polling is slow and all but its an easier concept to grasp for beginners i think)


!TO "test.prg"


*=$0ffe
!BIN "tune.dat"

scrltxt = $5000

*= $4000

jsr $e544
sei
lda #$01
sta $d01a
lda #$7f
sta $dc0d
lda #<split1
sta $0314
lda #>split1
sta $0315
cli
ldx #$00
jsr $1000
jmp *

split1
lda #$00
cmp $d012
bne *-3
lda #$00
sta $d020
sta $d021

split2
lda #$7a
cmp $d012
bne *-3

lda #$15
sta $d018

lda smooth ; move the scroll
sta $d016 ; to the left dep.
; on the smooth-bit

jsr raster ; draw the rasterbar

split3
lda #$9d
cmp $d012
bne *-3

dec $d020 ;<- visualize rasterusage
jsr scroll2x2 ; print the
; scrolltext
inc $d020 ;<- visualize rasterusage

lda #$08 ; set normal
sta $d016 ; screen

split4
lda #$c0
cmp $d012
bne *-3
lda #$03
sta $d020
sta $d021

dec $d020 ;<- visualize rasterusage
jsr $1003
inc $d020 ;<- visualize rasterusage

inc $d019
jmp $ea31


; ======================================

scrspeed !byte $02 ; speed of scr.(1-8)
smooth !byte $07 ; smooth bit
half !byte $02
char !byte $00

scroll2x2
; ---------------------------
; Routine mostly from Ghouls
; Maskinkode Kursus as seen
; on CSDb (release id=8646)
; ---------------------------

lda smooth
sec
sbc scrspeed ; substract speed
and #$07 ; AND it with 7
; to get the
; smooth effect
sta smooth ; save the new
; smooth val
bcs quit ; quit the scroll
; if we dont need
; to update the
; screen

ldy #$00 ; black text color
ldx #$00
repeat1 lda $0401+(10*40),x ; move the
sta $0400+(10*40),x ; two lines
lda $0401+(11*40),x ; one to
sta $0400+(11*40),x ; the left
tya
sta $d800+(10*40),x ; set char
sta $d800+(11*40),x ; color
inx
cpx #39 ; move 39 chars
bne repeat1

; ---
; Only put a new char from the
; scrolltxt on the screen for
; every second frame/move
dec half
bne rolltxt ; jump to display
; a new char if
; we have ended
; the 2nd half of
; this char
lda #$02 ; reset the val
sta half ; that tells if
; this is the 2nd
; half of the
; char
lda char ; get the char
; that we are
; working on
ora #$40 ; shift it
sta $0400+(10*40)+39 ; and dis-
; play it
; on the
; 1st line
ora #$80 ; invert
sta $0400+(11*40)+39 ; it and
; display
; on 2nd
jmp quit

; ---
; Display a new char from the
; scrolltxt - it will only show
; the 1st half of the char
rolltxt lda scrltxt ; read next char
cmp #$00 ; stopchar? "@"
bne nextchar ; if not then jmp

lda #<scrltxt ; restart scroll
sta rolltxt+1
lda #>scrltxt
sta rolltxt+2
jmp rolltxt ; continue scroll

nextchar sta $0400+(10*40)+39 ; print
; the next char in the raster
; border (pos 39) on both lines
sta char ; set the working
; char
ora #$80 ; invert it
sta $0400+(11*40)+39

inc rolltxt+1 ; incr the scrtxt
; addr (low-byte)
bne quit
inc rolltxt+2 ; incr the scrtxt
; if it is longer
; than 256 bytes

quit rts ; return to my irq

; ======================================

raster
; Fine-tune raster position
; to avoid flickers
nop
nop
nop
nop
nop

ldx #0
loopcol lda colors,x
sta $d020
sta $d021
ldy delays,x
loopdel dey
bne loopdel
inx
cpx #numcols
bne loopcol

lda #$00
sta $d020
sta $d021

rts

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

indexcol !BYTE $00
numcols = 33

*= $5a00
colors
!BYTE $0a,$02,$0a,$0a,$0a,$07
!BYTE $0a,$00
!BYTE $07,$0a,$07,$07,$07,$0d
!BYTE $07,$00
!BYTE $0d,$07,$0d,$0d,$0d,$03
!BYTE $0d,$00
!BYTE $03,$0d,$03,$03,$03,$00
!BYTE $03,$00
!BYTE $00,$00,$00,$00,$00,$00
!BYTE $00,$00
!BYTE $00,$00,$00,$00,$00,$00
!BYTE $00,$00
!BYTE $01,$00,$00,$00,$00,$00
!BYTE $00,$00
!BYTE $00,$00,$01

*= $5b00
delays !BYTE $08,$08,$08,$08,$08,$08
!BYTE $08,$01
!BYTE $08,$08,$08,$08,$08,$08
!BYTE $08,$01
!BYTE $08,$08,$08,$08,$08,$08
!BYTE $08,$01
!BYTE $08,$08,$08,$08,$08,$08
!BYTE $08,$01
!BYTE $08,$08,$08,$08,$08,$08
!BYTE $08,$01
!BYTE $08,$08,$08,$08,$08,$08
!BYTE $08,$01
!BYTE $08,$08,$08,$08,$08,$08
!BYTE $08,$01
!BYTE $08,$08,$08

; ============================

scrolltext
*=$5000
!SCR "hi i am a scrolltext"

Oh yeah and you wont get the jitters away with this easily. Use delays where necessary to move them out of visual areas.
Previous - 1 | 2 | 3 | 4 - 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
Peacemaker/CENSOR/Hi..
REBEL 1/HF
krissz
Mibri/ATL^MSL^PRX
DeMOSic/MS^LSD^ONS
Sepa/OCD
Andy/AEG
MCM/ONSLAUGHT
theK/ATL
New Design/Excess
MightyAxle
LDX#40
algorithm
Guests online: 101
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 Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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