| |
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? |
|
| |
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
|
| |
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? |
| |
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.
|
| |
fermhg Account closed
Registered: Oct 2002 Posts: 43 |
Thank you, |
| |
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?
|
| |
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.
|
| |
Richard
Registered: Dec 2001 Posts: 621 |
Then try making the scroll smoother using $D011
RicHARD/CiViTaS
|
| |
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. |
| |
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
|
| |
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 |