Useful POKEs

Discussion about ZX80 / ZX81 Software
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Useful POKEs

Post by XavSnap »

Is there anyway I can remove lines of BASIC whilst the BASIC program is running?
Remove the line to get room in the memory... you can't. (not easy in Basic)

But, if you had to add a trigger on a program, just replace the first binary code to the REM code (234).

Simple code without a REM shadowing:

Code: Select all

10 PRINT "IS THERE ANY ZXPRINTER ONLINE ?"
20 INPUT A$
30 FOR A=1 TO 10
40 PRINT A
50 IF A$(1)="Y" THEN LPRINT A
60 NEXT A
Replace the LPRINT with the REM instruction:

Code: Select all

10 PRINT "IS THERE ANY ZXPRINTER ONLINE ?"
20 INPUT A$
30 LET Z$=""
50 GOSUB 1000
60 POKE PRT,234
70 IF A$(1)="Y" THEN POKE PRT,225
80 FOR A=1 TO 10
90 PRINT A
95 LET Z$=STR$ A
100 GOSUB 1100
110 NEXT A
120 STOP
1000 LET PRT=PEEK 16426*256+PEEK 16425+4
1100 LPRINT Z$
1500 RETURN
1100 LPRINT Z$ >> 1100 REM Z$
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: Useful POKEs

Post by XavSnap »

POKE 16418,0
from within a program gives to 2 more lines at the bottom of the screen to be PRINTed AT (so the full screen 24x32 may be used by the program).
But set it back to the normal value 2, if you want to INPUT data (needs that 2 lines).
All CLS commands reset this system pointer.
You had to repeat POKE 16418,0 before a PRINT AT 23,0;"xxx" command to avoid to get a Basic error.
Note:
POKE 16418,x can be set up to 2... to trim the screen display 23-x for SCROLL command for example.
(from an André*** idea)

Code: Select all

1 DIM A$(9,32)
2 LET A$(1)="HELLO"
3 LET A$(2)="WORLD"
4 LET A$(3)="-----"
5 LET A$(4)="THIS"
6 LET A$(5)="IS"
7 LET A$(6)="A"
8 LET A$(7)="SCROLLING"
9 LET A$(8)="DEMO"
10 LET A$(9)="-----"
15 POKE 16418,0
20 FOR A=1 TO 23
30 PRINT "oooooooooooooooooooooooooooooooo"
40 NEXT A
100 POKE 16418,15
110 FOR A=1 TO 9
120 PRINT AT 8,0;A$(A)
130 FOR Z=1 TO 10
140 NEXT Z
150 SCROLL
160 NEXT A
170 GOTO 110
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Useful POKEs

Post by mrtinb »

(Comment removed. My mistake)
Last edited by mrtinb on Sat Feb 05, 2022 1:52 pm, edited 1 time in total.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
1024MAK
Posts: 5103
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Useful POKEs

Post by 1024MAK »

mrtinb wrote: Sat Feb 05, 2022 10:30 am Beware that variable PRT is used before defined.
Err, it gets defined when the GOSUB 1000 in line 50 redirects program flow. It’s not used before this.

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: Useful POKEs

Post by Moggy »

I was thinking the same thing.
Hurrah Moggy gets something right. :lol:
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Useful POKEs

Post by XavSnap »

Beware that variable PRT is used before defined.
It's used to get the Next_line Basic pointer.
It point to the last character after the $76 , just at the beginning of the next line header (4 memory characters:2 line# and 2 length)
#+4 is the command token.
#+5 is the REM content in case of ASM floating codes. (RAND USR ...)

We can't add any line between the line 1000 and 1100 !
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply