question about SCROLL

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
sl07h1
Posts: 34
Joined: Mon Feb 22, 2021 7:16 pm

question about SCROLL

Post by sl07h1 »

First of all, sorry if this post doesn't belong here, but I didn't know where else to post it and I am curious about this since I was a child.

Given this program

Code: Select all

10 PRINT AT 21,0 "SOMETHING"
20 SCROLL
30 GOTO 10
If "SOMETHING" is a string of 32 chars long and I let the program run until fillling the screen, then BREAK the program and then press enter, the screen goes blank and then I see the code in the screen. Nothing strange with that. But if "SOMETHING" is a short string of, let's say 2 chars long and I BREAK the program and then press enter, the screen starts to "clean" slowly to the last line (I would say "hardly" because you can see chars appearing and dissapearing, like a lot of activity), and it takes a while.

Why?

What is going on there?

Thanks in advice.
User avatar
BarryN
Posts: 151
Joined: Thu Nov 09, 2017 11:34 pm

Re: question about SCROLL

Post by BarryN »

I think you left out a ;, other than that, I reproduced the behavior so now I am curious.
sl07h1 wrote: Wed Jul 21, 2021 11:23 pm

Code: Select all

10 PRINT AT 21,0;"SOMETHING"
20 SCROLL
30 GOTO 10
If "SOMETHING" is a string of 32 chars long and I let the program run until fillling the screen, then BREAK the program and then press enter, the screen goes blank and then I see the code in the screen. Nothing strange with that. But if "SOMETHING" is a short string of, let's say 2 chars long and I BREAK the program and then press enter, the screen starts to "clean" slowly to the last line (I would say "hardly" because you can see chars appearing and dissapearing, like a lot of activity), and it takes a while.

Why?

What is going on there?

Thanks in advice.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: question about SCROLL

Post by XavSnap »

In fact, the SCROLL function is bugged on the Zx81 using a 16k ram pack!

The scroll function compress the D_File and move the Vars… byte per byte.

It slow, and a CLS reconstruct the D_File to the 32 bytes length… and move the Vars too… this process slower the screen rebuild.

If you had to launch an ASM Scroll right, down , up or left… it crash the D_file while return in Basic !
This Scroll function crash the COPY function on the ZxPrinter too.

If you had to scroll the screen, use a ASM routine! not the basic function, the ASM routine will move the full row length 32 bytes and don't move the vars memory segment.

16k D_file expended...
Animation1.jpg

Scroll command:
Animation2.jpg


CLS... return to the 16k D_file...
Animation3.jpg
Animation4.jpg
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
sl07h1
Posts: 34
Joined: Mon Feb 22, 2021 7:16 pm

Re: question about SCROLL

Post by sl07h1 »

XavSnap wrote: Thu Jul 22, 2021 1:40 am In fact, the SCROLL function is bugged on the Zx81 using a 16k ram pack!
You, sir, are right!

I took off the memory expansion (memopak 32k) and the behavior doesn't show up. It has to do with the different DFILES formats in 1k and 16/32k, as you showed.

I don't want to use the scroll for anything, only I was curious, so SCROLL is bugged and it leaves the DFILE in 1k format and CLS has to "transform" one DFILE format to another, I think...
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: question about SCROLL

Post by XavSnap »

Codes from the Mageco Disassembler & toolkit :

Code: Select all

;------- Rom and Ram Symbols -------
SLOW equ $0F2B
RAM_MEMBOT01 equ $405E
RAM_MEMBOT03 equ $4060
RAM_PRBUFF00 equ $403C
RAM_SPARE1 equ $4021
RAM_MEMBOT05 equ $4062
RAM_MEMBOT07 equ $4064
RAM_D_FILE equ $400C
BREAK_1 equ $0F46
RAM_LAST_K equ $4025
DECODE equ $07BD
COPY equ $0869
DEBOUNCE equ $0F4B
CLS equ $0A2A
RAM_DF_CC equ $400E
RAM_PRBUFF02 equ $403E
RAM_MEMBOT0D equ $406A
RAM_MEMBOT17 equ $4074
RAM_MEMBOT00 equ $405D
RAM_MEMBOT13 equ $4070
RAM_MEMBOT11 equ $406E
RAM_MEMBOT0F equ $406C
RAM_S_POSN equ $4039
LINE_ADDR equ $09D8
RECLAIM_2 equ $0A60
RAM_RAMTOP equ $4004
RAM_E_LINE equ $4014
DIFFER equ $0A17
NEW equ $03C3
RAM_CHECK equ $03CB
ADD_CHAR equ $0526
FAST equ $0F23
RAM_VARS equ $4010
LOC_ADDR equ $0918
STACK_BC equ $1520
PRINT_FP equ $15DB
REPORT_D equ $03A6
RAM_SPARE2 equ $407B
RAM_FRAMES equ $4034
RAM_DBOUNCE equ $4027

Code: Select all

Lb3BA5: ; <15269> [UP]
	LD HL,(RAM_D_FILE) ; GET D-FILE
	PUSH HL 
	PUSH HL 
	LD DE,$02B6 
	ADD HL,DE 
	LD (RAM_DF_CC),HL ; SET DF-CC
	LD A,$21 
	LD (IY+57),A 
	LD A,$03 
	LD (IY+58),A 
	POP HL 
	LD DE,$0021 
	ADD HL,DE 
	POP DE 
	LD BC,$02D6 
	LDIR 
	RET ; ==========================


Lb3C33: ; <15411> [RIGHT]
	LD HL,(RAM_D_FILE) ; GET D-FILE
	LD DE,$0020 
	ADD HL,DE 
	LD DE,$0040 
	LD C,$16 
Lb3C3F:
	LD B,$1F 
	LD A,(HL) 
	PUSH AF 
Lb3C43:
	DEC HL 
	LD A,(HL) 
	INC HL 
	LD (HL),A 
	DEC HL 
	DJNZ Lb3C43 ; [$3C43:15427]
	POP AF 
	LD (HL),A 
	ADD HL,DE 
	DEC C 
	JR NZ, Lb3C3F ; [$3C3F:15423]
	RET ; ==========================

	Lb3C51: ; <15441> [LEFT]
	LD HL,(RAM_D_FILE) ; GET D-FILE
	LD C,$16 
Lb3C56:
	INC HL 
	LD A,(HL) 
	LD B,$1F 
	PUSH AF 
Lb3C5B:
	INC HL 
	LD A,(HL) 
	DEC HL 
	LD (HL),A 
	INC HL 
	DJNZ Lb3C5B ; [$3C5B:15451]
	POP AF 
	LD (HL),A 
	INC HL 
	DEC C 
	JR NZ, Lb3C56 ; [$3C56:15446]
	RET ; ==========================

Lb3C69: ; <15465> [DOWN]
	LD HL,(RAM_D_FILE) ; GET D-FILE
	PUSH HL 
	PUSH HL 
	PUSH HL 
	LD DE,$02D6 
	ADD HL,DE 
	EX DE,HL 
	LD BC,$02B5 
	POP HL 
	ADD HL,BC 
	LDDR 
	POP HL 
	LD B,$20 
Lb3C7E:
	INC HL 
	LD (HL),$00 
	DJNZ Lb3C7E ; [$3C7E:15486]
	POP HL 
	INC HL 
	LD (RAM_DF_CC),HL ; SET DF-CC
	LD A,$21 
	LD (RAM_S_POSN),A ; SET S-POSN
	LD A,$01 
	LD (RAM_S_POSN+1),A ; SET S-POSN
	RET ; ==========================

Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
BarryN
Posts: 151
Joined: Thu Nov 09, 2017 11:34 pm

Re: question about SCROLL

Post by BarryN »

sl07h1 wrote: Thu Jul 22, 2021 2:13 am
XavSnap wrote: Thu Jul 22, 2021 1:40 am In fact, the SCROLL function is bugged on the Zx81 using a 16k ram pack!
You, sir, are right!

I took off the memory expansion (memopak 32k) and the behavior doesn't show up. It has to do with the different DFILES formats in 1k and 16/32k, as you showed.

I don't want to use the scroll for anything, only I was curious, so SCROLL is bugged and it leaves the DFILE in 1k format and CLS has to "transform" one DFILE format to another, I think...
Interesting. Does anyone have a patched BASIC ROM?
sl07h1
Posts: 34
Joined: Mon Feb 22, 2021 7:16 pm

Re: question about SCROLL

Post by sl07h1 »

This made me remember another thing: I noted that without the Memopak, when I press Break when I just type LOAD "" (without starting to load), I get the "D/0" error, which is OK, but when I do the same with the memopak plugged I don't get the error, but a space and the K, like I just wrote a space.
User avatar
1024MAK
Posts: 5103
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: question about SCROLL

Post by 1024MAK »

sl07h1 wrote: Thu Jul 22, 2021 3:10 am This made me remember another thing: I noted that without the Memopak, when I press Break when I just type LOAD "" (without starting to load), I get the "D/0" error, which is OK, but when I do the same with the memopak plugged I don't get the error, but a space and the K, like I just wrote a space.
Yes, this is known about as well.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: question about SCROLL

Post by Moggy »

BarryN wrote: Thu Jul 22, 2021 2:44 am
sl07h1 wrote: Thu Jul 22, 2021 2:13 am
XavSnap wrote: Thu Jul 22, 2021 1:40 am In fact, the SCROLL function is bugged on the Zx81 using a 16k ram pack!
You, sir, are right!

I took off the memory expansion (memopak 32k) and the behavior doesn't show up. It has to do with the different DFILES formats in 1k and 16/32k, as you showed.

I don't want to use the scroll for anything, only I was curious, so SCROLL is bugged and it leaves the DFILE in 1k format and CLS has to "transform" one DFILE format to another, I think...
Interesting. Does anyone have a patched BASIC ROM?
The Big Bang double speed BASIC ROM found below clears the screen perfectly fast and without the usual stuttering after the use of SCROLL,CLS, and is the only BASIC ROM worth using in my opinion.

https://sinclairzxworld.com/viewtopic.p ... 327#p40327
Post Reply