[Tuto] Basic Screen mirroring in A$...

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

[Tuto] Basic Screen mirroring in A$...

Post by XavSnap »

Hi,

To create a maze with several hidden infos.
Cap0130.jpg
Cap0130.jpg (4.54 KiB) Viewed 2035 times

Code: Select all

10 DIM A$(10,10)
12 LET X=1
13 LET Y=1
14 LET G=0
15 LET S=0
16 LET M=0
20 LET A$(1)="   «G«    "
21 LET A$(2)=" « « « «« "
22 LET A$(3)=" « « « «G "
23 LET A$(4)=" «   «G««*"
24 LET A$(5)=" «««««««E "
25 LET A$(6)="    «S«G« "
26 LET A$(7)=" «« «   « "
27 LET A$(8)="  «G« « « "
28 LET A$(9)="« ««« « « "
29 LET A$(10)="G     «   "
30 CLS
35 PRINT "««««««««««««"
40 FOR A=1 TO 10
45 PRINT "«";
50 FOR B=1 TO 10
55 PRINT "«" AND A$(A,B)="«";" " AND A$(A,B)=" ";
56 IF A$(A,B)<>"«" AND A$(A,B)<>" " THEN PRINT "?";
60 NEXT B
65 PRINT "«"
70 NEXT A
75 PRINT "««««««««««««"; AT 0,16;"GOLD = 0";AT 2,16;"SWORD= 0"
80 PRINT AT Y,X;"£"
84 LET X1=X
86 LET Y1=Y
88 IF X<10 THEN LET X=X+((1 AND INKEY$="8") AND A$(Y,X+1)<>"«")
89 IF X>1 THEN LET X=X-((1 AND INKEY$="5") AND A$(Y,X-1)<>"«")
90 IF Y<10 THEN LET Y=Y+((1 AND INKEY$="6") AND A$(Y+1,X)<>"«")
92 IF Y>1 THEN LET Y=Y-((1 AND INKEY$="7") AND A$(Y-1,X)<>"«")
95 IF X1=X AND Y1=Y THEN GOTO 88
98 PRINT AT Y1,X1;" "
100 IF A$(Y,X)="G" THEN LET G=G+1
110 IF A$(Y,X)="S" THEN LET S=S+1
120 IF A$(Y,X)="*" AND S=0 THEN GOTO 2000
125 IF A$(Y,X)="*" AND S>0 THEN LET S=S-1
130 IF A$(Y,X)="E" THEN GOTO 1000
135 LET A$(Y,X)=" "
140 PRINT AT 0,23;G;AT 2,23;S
150 GOTO 80
1000 PRINT "THIS IS THE END..."
1010 STOP
2000 PRINT AT Y,X;"*"
2005 LET X=X1
2010 LET Y=Y1
2020 GOTO 80
PRN0008.jpg
MAZE.P
(2.15 KiB) Downloaded 106 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
bola_dor
Posts: 398
Joined: Wed Oct 02, 2019 5:32 am

Re: [Tuto] Basic Screen mirroring in A$...

Post by bola_dor »

Several LET ...=0 and LET....=1
It doesn't looks like being you Xav !??¡!.🤣🤣🤣

I'll have a look at this tomorow as I'm interested about BASIC and mazes..
Looks good so far..
Have a nice weekend!!!
Ernesto
ZX80 USA, ZX81UK, ZX Spectrum, ZX Spectrum+, ZX Spectrum 128+ UK, ZX Spectrum +2/A, Sinclair QL, CZ1000, CZ1500, CZ2000, CZ1000Plus, CZ1500Plus, CZ Spectrum, CZ Spectrum Plus, TK83, TK85, TK90X, TK95. TS2068. And more to come :D
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: [Tuto] Basic Screen mirroring in A$...

Post by dr beep »

well, not quite hidden data, more unknown data. If you want hidden data you should use chr$ 64, chr$ 73, chr$ 82.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: [Tuto] Basic Screen mirroring in A$...

Post by XavSnap »

HI,
Thanks!
You can put specials characters on the screen, but the main purpose is to avoid to read the screen buffer, D_file and PEEK process.
X and Y is equal to the variable array coords..
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
bola_dor
Posts: 398
Joined: Wed Oct 02, 2019 5:32 am

Re: [Tuto] Basic Screen mirroring in A$...

Post by bola_dor »

Is it faster than peeking the Dfe ram?
Ernesto
ZX80 USA, ZX81UK, ZX Spectrum, ZX Spectrum+, ZX Spectrum 128+ UK, ZX Spectrum +2/A, Sinclair QL, CZ1000, CZ1500, CZ2000, CZ1000Plus, CZ1500Plus, CZ Spectrum, CZ Spectrum Plus, TK83, TK85, TK90X, TK95. TS2068. And more to come :D
bola_dor
Posts: 398
Joined: Wed Oct 02, 2019 5:32 am

Re: [Tuto] Basic Screen mirroring in A$...

Post by bola_dor »

Is it faster than peeking the Dfile ram?
Ernesto
ZX80 USA, ZX81UK, ZX Spectrum, ZX Spectrum+, ZX Spectrum 128+ UK, ZX Spectrum +2/A, Sinclair QL, CZ1000, CZ1500, CZ2000, CZ1000Plus, CZ1500Plus, CZ Spectrum, CZ Spectrum Plus, TK83, TK85, TK90X, TK95. TS2068. And more to come :D
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: [Tuto] Basic Screen mirroring in A$...

Post by XavSnap »

Hi bola_dor,

No, but the main process is to mirror the screen... not to read the D_File.
It designed to assign coords to an array, not to test a move directly on the screen.

Imagine a foggy map with many treasures or monsters.

But, it's a easy way to move in a screen on a Zx81 without 16k ram pack (<2k)

viewtopic.php?f=5&t=3919
Last edited by XavSnap on Fri Nov 19, 2021 1:19 am, edited 1 time in total.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
bola_dor
Posts: 398
Joined: Wed Oct 02, 2019 5:32 am

Re: [Tuto] Basic Screen mirroring in A$...

Post by bola_dor »

Oh I see now
Or I don't 🤣
Ernesto
ZX80 USA, ZX81UK, ZX Spectrum, ZX Spectrum+, ZX Spectrum 128+ UK, ZX Spectrum +2/A, Sinclair QL, CZ1000, CZ1500, CZ2000, CZ1000Plus, CZ1500Plus, CZ Spectrum, CZ Spectrum Plus, TK83, TK85, TK90X, TK95. TS2068. And more to come :D
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: [Tuto] Basic Screen mirroring in A$...

Post by XavSnap »

:shock:

Really !

Imagine a foggy map with many treasures or monsters.


Don't tell me Spanish can't imagine treasures or monsters in a map !!!
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
bola_dor
Posts: 398
Joined: Wed Oct 02, 2019 5:32 am

Re: [Tuto] Basic Screen mirroring in A$...

Post by bola_dor »

XavSnap wrote: Fri Nov 19, 2021 1:32 am :shock:

Really !

Imagine a foggy map with many treasures or monsters.


Don't tell me Spanish can't imagine treasures or monsters in a map !!!
Yes!!! I mean I can't see the hidden treasures through the fog in your map....
Ernesto
ZX80 USA, ZX81UK, ZX Spectrum, ZX Spectrum+, ZX Spectrum 128+ UK, ZX Spectrum +2/A, Sinclair QL, CZ1000, CZ1500, CZ2000, CZ1000Plus, CZ1500Plus, CZ Spectrum, CZ Spectrum Plus, TK83, TK85, TK90X, TK95. TS2068. And more to come :D
Post Reply