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 > how to delay a routine from starting?
2008-12-30 17:39
FillmoreC
Account closed

Registered: Dec 2008
Posts: 7
how to delay a routine from starting?

Lets say I turned the screen black then started music, but i have scroller that I want to delay starting until a certain part of the music. how can I do that.

sort of like

lda #$00
sta $d020
sta $d021
jsr $1000
sei

then set the interupt up and all that

then

irq asl $d019
jsr $1003
jsr scroll
jmp $ea82

scroll
wait until into of the music is done
then scroll
rts




 
... 6 posts hidden. Click here to view all posts....
 
2008-12-31 23:30
Stainless Steel

Registered: Mar 2003
Posts: 966
Or what i like to do is to make the jsr $scrollroutine be a bit $scrollroutine initially.
When the delay routine hits its value it sets the bit to jsr on the scroller and a bit to the delay routine.
2009-01-01 05:16
Hate Bush

Registered: Jul 2002
Posts: 465
use timingmarks if your musicplayer supports them. if not, let's have one more
2009-01-02 17:19
FillmoreC
Account closed

Registered: Dec 2008
Posts: 7
Quote: delay .byte 7

init
lda #7 (delay)
sta delay
rts

interrupt routine
jsr not-every-frame-routine
rts

not-every-frame-routine
dec delay
beq go-on
rts

go-on
lda #7
sta delay
(routine to run at x frames, go here)
rts



This only slows the scroll down in speed. I need the scroll not to go for like maybe 5 -10 seconds then start scrolling for the rest of the demo.
2009-01-02 18:51
JackAsser

Registered: Jun 2002
Posts: 2014
frameCount: .word 0
startScroller: .byte 0

frameTrigger = 7*50 ; 7 seconds
frameCountLo = frameCount+0
frameCountHi = frameCount+1

irq_handler:
   jsr doMusic

   ; Update frameCount
   inc frameCountLo
   bne :+
      inc frameCountHi
   :

   ; If frameCount == frameTrigger then startScroller=1
   lda frameCountHi
   cmp #>frameTrigger
   bne :+
      lda frameCountLo
      cmp #<frameTrigger
      bne :+
         inc startScroller
   :

   ; If startScroller !=0 then doScroller
   lda startScroller
   beq :+
      jsr doScroll
   :

   ; exit IRQ
2009-01-02 19:34
Oswald

Registered: Apr 2002
Posts: 5094
oh no what have you done.. looked like c at first glance.. I have to stab my eyes... ;)
2009-01-02 22:09
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: oh no what have you done.. looked like c at first glance.. I have to stab my eyes... ;)

Sorry for that Ozzie but that's how I write c64 assembly. :)
2009-01-02 22:28
iopop

Registered: Dec 2001
Posts: 317
JackAssers code will stall the scroller 7 sec every 21.845 minute. Based on the previous code I would prevent it by using JSR/BIT as on/off markers in the code.

frameCount: .word 0
startScroller: .byte 0

frameTrigger = 7*50 ; 7 seconds
frameCountLo = frameCount+0
frameCountHi = frameCount+1

irq_handler:
   jsr doMusic

dly:  jsr doDelay
dsc:  bit doScroll

   ; exit IRQ

doDelay:
   ; Update frameCount
   inc frameCountLo
   bne :+
      inc frameCountHi
   :

   ; If frameCount == frameTrigger then startScroller=1
   lda frameCountHi
   cmp #>frameTrigger
   bne :+
      lda frameCountLo
      cmp #<frameTrigger
      bne :+
         lda #$20		;$20 is JSR ie. turn on the scroller.
         sta dsc
         lda #$2c		;$2c is BIT $abcd ie. disable the delay routine.
         sta dly
   :
   
   rts
2009-01-02 23:18
JackAsser

Registered: Jun 2002
Posts: 2014
:)
2009-01-06 17:28
FillmoreC
Account closed

Registered: Dec 2008
Posts: 7
Quote: JackAssers code will stall the scroller 7 sec every 21.845 minute. Based on the previous code I would prevent it by using JSR/BIT as on/off markers in the code.

frameCount: .word 0
startScroller: .byte 0

frameTrigger = 7*50 ; 7 seconds
frameCountLo = frameCount+0
frameCountHi = frameCount+1

irq_handler:
   jsr doMusic

dly:  jsr doDelay
dsc:  bit doScroll

   ; exit IRQ

doDelay:
   ; Update frameCount
   inc frameCountLo
   bne :+
      inc frameCountHi
   :

   ; If frameCount == frameTrigger then startScroller=1
   lda frameCountHi
   cmp #>frameTrigger
   bne :+
      lda frameCountLo
      cmp #<frameTrigger
      bne :+
         lda #$20		;$20 is JSR ie. turn on the scroller.
         sta dsc
         lda #$2c		;$2c is BIT $abcd ie. disable the delay routine.
         sta dly
   :
   
   rts


i understand this but I have bit of a syntax question. I don't understand

bne :+

i understand say

bne *-2

or

bne lable

but I've never seen bne :+ where is that branching too? Is it branching to the : right before the rts?
2009-01-06 17:50
JackAsser

Registered: Jun 2002
Posts: 2014
:+ refers to the next colon.
:- refers to the previous colon.

They're called anonymous labels iirc.

You can also use many + or minus to jump several colons back or forward (just to make stuff more unreadable :) )
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
Sepa/OCD
Andy/AEG
MCM/ONSLAUGHT
theK/ATL
Peacemaker/CENSOR/Hi..
New Design/Excess
MightyAxle
LDX#40
algorithm
Mibri/ATL^MSL^PRX
Guests online: 97
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.075 sec.