There's not functions to get a byte from the screen memory on the Zx81.
You had to define an array and get the mirrored value in it.
I code an example where the ZX81 Basic don't use a mirrored value.
I tryed to optimize the code to speed up our lazy Basic Rom.
In the first example, i use the Rom pointer refreshed by the PRINT AT command.
The DF_CC is set while a "AT y,x" Rom call.
It retrieve the memory pointer at D_File+( 33*Y+X ).
The secound program retrive this value, using the D_File address.
Have Fun.
Note: "((" "+(USR 743))(TO 1))" equal the Fast command.
You had to add and display a blank space to avoid to print the BC call back.
PRINT "***";USR 743;"***"
> ***12763***
PRINT "***";(" "+(USR 743)));"***"
> *** 12763***
PRINT "***";(" "+(USR 743))(TO 1));"***"
> *** ***
But, A "1 FAST" take only 6 Bytes ...
a (" "+(USR 743))(TO 1)) take 30 Bytes !
Code: Select all
1 REM EXEMPLE 1 - DF/CC
2 PRINT AT 5,4;((" "+(USR 743))(TO 1));"LLLLLLLLLLLLLLL"
3 FOR A=1 TO 15
4 PRINT TAB 5;"L L"
5 PRINT AT 5+A,6+INT(RND*13);(STR$ A AND A<8)
6 NEXT A
7 PRINT AT 20,5;"LLLLLLLLLLLLLLL"
8 SLOW
9 PRINT AT 2,1;"1234567"
10 LET X=15
20 LET Y=15
30 LET A=X
40 LET B=Y
45 LET X=A-(INKEY$="7")+(INKEY$="6")
48 LET Y=B-(INKEY$="5")+(INKEY$="8")
50 PRINT AT X,Y;
60 IF PEEK(PEEK 16398+256*PEEK 16399) THEN GOTO 100
65 PRINT "O";AT A,B;" "
80 GOTO 30
100 LET C$=CHR$ PEEK(PEEK 16398+256*PEEK 16399)
110 IF C$="L" THEN GOTO 45
120 IF C$>"0" AND C$<"8" THEN PRINT AT 2,VAL C$;CHR$ (CODE C$+128)
130 PRINT AT X,Y;
199 GOTO 65
Code: Select all
1 REM EXEMPLE 2 - D/FILE
2 PRINT AT 5,4;((" "+(USR 743))(TO 1));"LLLLLLLLLLLLLLL"
3 FOR A=1 TO 15
4 PRINT TAB 5;"L L"
5 PRINT AT 5+A,6+INT(RND*13);(STR$ A AND A<8)
6 NEXT A
7 PRINT AT 20,5;"LLLLLLLLLLLLLLL"
8 SLOW
9 PRINT AT 2,1;"1234567"
10 LET X=15
20 LET Y=15
30 LET DF=PEEK 16396+(256*PEEK 16397)+Y*33+X+1
42 REM
45 LET DFB=DF-(INKEY$="7")*33+(INKEY$="6")*33-(INKEY$="5")+(INKEY$="8")
50 REM
60 IF PEEK(DFB) THEN GOTO 100
61 POKE DF,0
62 POKE DFB,CODE "O"
65 LET DF=DFB
80 GOTO 45
100 LET C$=CHR$ PEEK DFB
110 IF C$="L" THEN GOTO 45
120 IF C$>"0" AND C$<"8" THEN PRINT AT 2,VAL C$;CHR$ (CODE C$+128)
199 GOTO 61