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


Forums > C64 Coding > Down Scroll
2003-05-18 11:12
fermhg
Account closed

Registered: Oct 2002
Posts: 43
Down Scroll

According to Mark Greenshields in his book "Mastering Machine Code on your Commodore 64" we can do a down scroll using this routine:

LDA #$13
STA $FFD2
LDA #$11
STA $FFD2
LDA #$9D
STA $FFD2
LDA #$94
STA $FFD2
LDA #$80
STA $DA
RTS

This routine is like this in Basic:

10 PRINT "{HOME}{CRSR DOWN}{CRSR LEFT}{INST}"
20 POKE 218,128

I need to do a loop introducing, in the opportune moment some letters so that these go down according to the scroll. However I have problems to use a loop using the code machine but it works well using the Basic. Why does this happen? Can I make a down scroll down using this routine as I want?
2003-05-18 17:20
fermhg
Account closed

Registered: Oct 2002
Posts: 43
Sorry, sorry
The code is this
LDA #$13
JSR $FFD2
LDA #$11
JSR $FFD2
LDA #$9D
JSR $FFD2
LDA #$94
JSR $FFD2
LDA #$80
STA $DA
RTS
2003-05-19 00:53
CyberBrain
Administrator

Posts: 392
I don't know much about the (fucked up) kernal, but is there a reason you want to use the kernal for making your downscroll?
2003-05-19 08:00
Testicle
Account closed

Registered: Sep 2002
Posts: 131
if you want to scroll the screen down in machine-language, i'd suggest this way. it's more bytes, but therefor more elegant. ;-)


;copy lines

ldx #39
.loop
lda $0798,x
sta $07c0,x
lda $0770,x
sta $0798,x
lda $0748,x
sta $0770,x
...
lda $0400,x
sta $0428,x
dex
bpl .loop

;clear first line

ldx #39
lda #$20
.loop2
sta $0400,x
dex
bpl .loop2



but for upscrolling the screen you can use the kernel. jsr $e8ea scrolls the screen up by 1 line.


i didn't get, what you meant with your problems according to use a loop. but probably this problem won't happen, when using the code above?!?

good luck.

regards,
daniel.
2003-05-19 12:38
fermhg
Account closed

Registered: Oct 2002
Posts: 43
Thank you,
2003-05-21 13:11
fermhg
Account closed

Registered: Oct 2002
Posts: 43
HERE YOU ARE AN EXAMPLE OF MY QUESTION:

My code is this but it doesn't work, then I tried it using basic and it works perfect.

*=$1000

JSR $E544
INICIO LDY #$00
SCROLL LDA TEXTO,Y
CMP #$00
BEQ INICIO
STA $0450
LDA #$13
JSR $FFD2
LDA #$11
JSR $FFD2
LDA #$9D
JSR $FFD2
LDA #$94
JSR $FFD2
LDA #$80
STA $DA
INY
BNE RETARDO
JMP INICIO
RETARDO LDA #$1E
STA $F9
LDX #$00
LDA #$FE
RASTER CMP $D012
BNE RASTER
DEC $F9
BNE RASTER
JMP SCROLL
TEXTO .BYTE $08,$05,$0C,$0C,$0F,$20
.BYTE $17,$0F,$12,$0C,$04,$20
.BYTE $20,$20,$20,$20,$00

In Basic:

0 PRINT CHR$(147)
5 FOR A=0 TO 15:READ F$
8 PRINT"{HOME}{CRSR DOWN X 2}";F$
10 PRINT"{HOME}{CRSR DOWN}{CRSR LEFT}{INST}"
20 POKE 218,128
23 FOR T=1 TO 100:NEXT T
25 NEXT A:RESTORE:GOTO 5
30 DATA H,E,L,L,O, ,W,O,R,L,D
40 DATA ,,,,,

What's the problem? Can I get a downscroll using Mark Greenshield's ML routine?

2003-05-21 19:42
Testicle
Account closed

Registered: Sep 2002
Posts: 131
why are you so fixated at mark greenshields routine? you should think about alternativ ways of realizing it in machine-language, it's quite easy.
2003-05-22 16:38
Richard

Registered: Dec 2001
Posts: 621
Then try making the scroll smoother using $D011

RicHARD/CiViTaS
2003-05-22 21:06
fermhg
Account closed

Registered: Oct 2002
Posts: 43
Ok Richard, but my question is this: why it work in basic but doesn't work in Code Machine? What's the problem? Only this. I know there is many ways to do a down scroll, and I know using $D011 but I need to know why this routine doesn't work using Code Machine and works using Basic.

Thank you very much.
2003-05-23 22:15
White Flame

Registered: Sep 2002
Posts: 136
I must agree that using that kernal scroll and relying on the line link tables is the slowest and problematic way I've seen a scroll done.

Your "FOR A=0 TO 15" loop doesn't exist in the asm version.

If the first LDA reads a zero, it'll inifinitely loop to "INICIO", since it'll just read the same zero over and over again.

Why are you using address $F9 at all?

Some hints about using branching better:

LDA texto,Y; CMP #$00; BEQ label -> LDA texto,Y; BEQ label

BNE retardo; JMP inicio; retardo -> BEQ inicio
2003-05-28 11:52
Unifier
Account closed

Registered: May 2003
Posts: 1
Testicle: You can put both loops together, and have the value #$20 stored permanently in the Y register. This will execute slightly faster.

// Ulf Harnhammar
 
... 4 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
Scan/House Designs
psenough
Jammer
Guests online: 87
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 X-Mas Demo 2024  (9.5)
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 Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.6)
5 Facet  (9.6)

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