Page 2 of 2

Re: Useful POKEs

Posted: Sat Feb 05, 2022 6:53 am
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$

Re: Useful POKEs

Posted: Sat Feb 05, 2022 7:03 am
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

Re: Useful POKEs

Posted: Sat Feb 05, 2022 10:30 am
by mrtinb
(Comment removed. My mistake)

Re: Useful POKEs

Posted: Sat Feb 05, 2022 10:36 am
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

Re: Useful POKEs

Posted: Sat Feb 05, 2022 1:09 pm
by Moggy
I was thinking the same thing.
Hurrah Moggy gets something right. :lol:

Re: Useful POKEs

Posted: Sat Feb 05, 2022 7:23 pm
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 !