scroll routine $e975 (59765 in basic) doesn't work reliable for me

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
aitsch
Vic 20 Amateur
Posts: 62
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

scroll routine $e975 (59765 in basic) doesn't work reliable for me

Post by aitsch »

after a long break i have started a new vic20 project and immediately i run into the first problems :roll:

The scroll routine $e975 (59765 in basic) always scrolls two lines the first time it is called.
On the next calls, it scrolls single lines as it should do.
I have not yet found out when two lines are scrolled again, but it also happens again at later times.

What is the reason for this and how can the routine be called up reliably?
User avatar
Mike
Herr VC
Posts: 5134
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: scroll routine $E975 (59765 in decimal) doesn't work reliably for me

Post by Mike »

aitsch wrote:What is the reason for this [...]
$E975 scrolls up logical lines. This is done by the screen editor to ensure no remnants of, respectively, incomplete logical lines are there at the top of the screen when, for example, BASIC programs are listed.

With the start-up message on screen, the overflowing of "**** ... ****" into the next physical line results in the first two physical screen lines being combined into one logical line, therefore $E975 scrolls up two physical lines.
[...] and how can the routine be called up reliably?
Avoid physical lines to be combined into logical lines in first place.

Alternatively, write and use an own scroll routine.
User avatar
aitsch
Vic 20 Amateur
Posts: 62
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

Re: scroll routine $e975 (59765 in basic) doesn't work reliable for me

Post by aitsch »

yep, i understand that for the basic start screen or basic lines.

but here is an example code (i'm afraid i've mixed up 'up' and 'down'):

Code: Select all

*=$1001
!byte $0b,$08, $00,$00, $9e, $34, $36, $30, $30, $00,$00, $00
SCROLL_DOWN = $e975
SCROLL_UP   = $ea08
*=$11f8
		; some initial things
                lda #9  
                sta $900f
                ldy #21
                -
                sta $1fe4,y
                dey
                bpl -
                
                
  .key       ; wait for keys (up/down)
                jsr $ffe4
                beq .key
                
                ; up
                cmp #17
                bne .down
               ;scolling from line 1
                lda #1
                sta $f2
                jsr SCROLL_UP
                
                ; copyline 1 to line 2 and delete 1
                ldx #21
                -
                lda $1e00,x
                sta $1e00+22,x
                lda #32
                sta $1e00,x
                dex
                bpl -
                
                
  .down     ;scroll down
  		cmp #145
                bne .key
                jsr SCROLL_DOWN
                jmp .key
                
I don't understand why the VIC assumes physical lines here ?
It alway's starts with 2 lines and continues with 1 line.
User avatar
Mike
Herr VC
Posts: 5134
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: scroll routine $E975 (59765 in decimal) doesn't work reliably for me

Post by Mike »

You would need to provide an executable (not just source code) of this test program and the exact course of actions up to the point where you think the routine deviates from expected behaviour for me (or anyone else) to follow through.

The KERNAL retains any existing linking of physical lines into logical lines when your machine code just does direct access to screen memory. A screen clear by sending CHR$(147) over CHROUT, or re-initializing the screen editor with JSR $E518 will separate all logical lines.
User avatar
aitsch
Vic 20 Amateur
Posts: 62
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

Re: scroll routine $e975 (59765 in basic) doesn't work reliable for me

Post by aitsch »

here is the .prg file of the programm.

after switching between up and down the $975-routine starts with scrolling 2 lines and continues with 1 line.
but i don't think there is a chance to affect the kernal.

i always try to save bytes by using kernal routines but in this case it seems that i have to write my own function :(
Attachments
scrollUPandDOWN.zip
(267 Bytes) Downloaded 154 times
User avatar
Mike
Herr VC
Posts: 5134
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: scroll routine $E975 (59765 in decimal) doesn't work reliably for me

Post by Mike »

The scroll down routine not only scrolls down from a given line, it opens a new physical line for the current logical line (unless the maximum of 4 physical lines for one logical line has been reached).

In the case at hand, and as a side effect, it combines the two top physical lines into one logical line, calling $E975 then scrolls this logical line (consisting of two physical lines) away.
aitsch wrote:I always try to save bytes by using KERNAL routines but in this case it seems that I have to write my own function.
... as I already had suggested.
Post Reply