Setting the screen size in BASIC

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Setting the screen size in BASIC

Post by Shaun_B »

Hi guys,

Is there a simple-ish way to make the ZX81 screen size 16 x 15 characters or something similar?

Thanks,

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

Re: Setting the screen size in BASIC

Post by XavSnap »

Yes, but only on the lines counter.(on the Zx/TS 16kb)

Code: Select all

1 POKE 16418,8
2 CLS
3 FOR A=1 TO 20
4 PRINT A
5 NEXT A
On le ZxBASIC 16 Kb, the screen width is set to 32 columns.

The other way to set a screen mask, is to redirect the D_file to an existing string variable.

DIM A$(17,16)
A$(1)=chr$(118)+"xxxxxxxxxxxxxxx"
A$(x)="...
A$(17)=chr$(118)
POKE 16396,xx
POKE 16397,xx
And set directly the LET value to display chars.

OR

Set a REM CHR(118)+xxxxxx...xxxxxxx+CHR(118)+xxxxxxxxxxxxxx..+(...)+CHR(118)+CHR(118)
Set the D_FILE at h4082
POKE 16396,130
POKE 16397,64

And Poke this the REM line to display the right character.

Note:
-You had to poke all chars to 0, to erase the display.
-Keep the old D_File address to retrieve the right basic monitor screen!

Variable reassignment process used in the "Star trek, the last battle." game & and "Something to do" games .
Last edited by XavSnap on Sun Mar 05, 2017 4:21 am, edited 1 time in total.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Setting the screen size in BASIC

Post by XavSnap »

Code: Select all

1 DIM A$(18,16)
2 FOR A=1 TO 16
3 LET A$(A)=CHR$(118)
4 LET A$(17,A)=CHR$(118)
6 NEXT A
7 LET A$(18)=CHR$(118)+CHR$(118)
8 POKE 16418,10
9 LET DES=8+PEEK(16400)+256*PEEK(16401)
10 REM SAVE DFILE
13 POKE 16507,PEEK(16396)
14 POKE 16508,PEEK(16397)
16 POKE 16396,DES-INT(DES/256)*256
17 POKE 16397,INT(DES/256)
18 POKE 16444,PEEK(16396)
19 POKE 16445,PEEK(16397)
20 FOR A=1 TO 15
21 LET A$(A,A+1)=CHR$ (A+156)
22 NEXT A
30 REM DEMO
31 FOR A=1 TO 15
32 LET A$(A,A+1)=CHR$ (A+28)
33 NEXT A
34 FOR A=1 TO 15
35 LET A$(A,A+1)=CHR$ (A+156)
36 NEXT A
45 FOR B=1 TO 8
50 FOR A=1 TO 15
55 LET A$(A)=CHR$(118)+A$(A,3 TO)+A$(A,2)
56 NEXT A
57 NEXT B
59 FOR A=1 TO 14
60 POKE 16396+SIN PI+SIN PI+SIN PI,PEEK(16507)
61 POKE 16397,PEEK(16508)
62 PRINT ".........HELLO WORLD........."
63 POKE 16396+SIN PI+SIN PI+SIN PI,PEEK(16444)
64 POKE 16397,PEEK(16445)
65 NEXT A
71 FOR B=1 TO 15 STEP 3
72 LET A$(B,2 TO)=".ZX81.16X15.SCR.."
73 FOR A=1 TO 15
74 LET A$(B)=CHR$(118)+A$(B,3 TO)+A$(B,2)
75 NEXT A
76 NEXT B
100 POKE 16396,PEEK(16507)
110 POKE 16397,PEEK(16508)
DEMO.P
(2.09 KiB) Downloaded 213 times
1 DIM A$(18,16) can be set to 1 DIM A$(17,16)...

Note: the D_File jump generate a short black screen!
Have Fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: Setting the screen size in BASIC

Post by Shaun_B »

I see messing with the screen pointer can obfuscate the BASIC listing for protecting it a bit more. This is good.

Regards,

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

Re: Setting the screen size in BASIC

Post by XavSnap »

In fact, the D_File don't occur the Basic and vars datas.
It only redirect the display reading.
Just POKE or LET things to the good 'relocated' D_File!

All "PRINT" or "PLOT" (Basic process) stay on the "right" (original:after Basic memory) screen offset, but isn't showed and stay hidden!
The D_File transfer can be used to display a "waiting" splash-screen... in a rem.

just type a rem with:
REM chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+"PLEASE WAIT..."+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)

And swap the D_file to this REM!

Warning to Errors prompts, they are displayed on the 'original' D_file offset... and hidden!

DEMO: "Wait" screen with progress bar.

Code: Select all

# REM XXXXXXXXXXX        PLEASE WAIT .
#     ..XXXXXXXXXXXXXX
     1  REM [HEX:\
76,76,76,76,76,76,76,76,\
76,76,76,00,00,00,00,00,\
00,00,00,35,31,2A,26,38,\
2A,00,3C,26,2E,39,00,1B,\
1B,1B,76,76,76,76,76,76,\
76,76,76,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,05,76,76,76,76,76,\
 ]
9 LET DES=16514
10 REM SAVE DFILE
13 POKE 16507,PEEK(16396)
14 POKE 16508,PEEK(16397)
16 POKE 16396,DES-INT(DES/256)*256
17 POKE 16397,INT(DES/256)
18 POKE 16444,PEEK(16396)
19 POKE 16445,PEEK(16397)
20 LET P=16556
21 FOR S=P TO P+17
22 POKE S+1,136
23 NEXT S
25 FOR A=0 TO PI STEP VAL".17"
26 LET P=P+1
27 PLOT SIN A*COS A*25+SQR A*30,-SIN A*COS A*20+20
28 POKE P,128
29 NEXT A
100 POKE 16396,PEEK(16507)
110 POKE 16397,PEEK(16508)
PROGRESS.P
(1.5 KiB) Downloaded 214 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Setting the screen size in BASIC

Post by XavSnap »

XavSnap wrote: Tue Mar 07, 2017 4:45 am just type a rem with:
REM chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+"PLEASE WAIT..."+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)+chr$(118)
This technic allow 0 to 34 characters per lines!
"StarTrek" use this method to rising the width to 34x24.
:P
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: Setting the screen size in BASIC

Post by siggi »

Shaun_B wrote: Sat Mar 04, 2017 8:44 pm Hi guys,

Is there a simple-ish way to make the ZX81 screen size 16 x 15 characters or something similar?

Thanks,

Shaun.
Yes, use Wilf's NOVA:
http://www.user.dccnet.com/wrigter/inde ... va2005.htm

Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
Post Reply