X and Y

A place to discuss the ZX80's and ZX81's younger brother - the Sinclair ZX Spectrum
Crayon21
Posts: 128
Joined: Sun Nov 04, 2018 2:33 am

X and Y

Post by Crayon21 » Sat Jun 15, 2019 11:31 pm

When using the plot and draw commands, I get confused as to what X and Y symbolize as far as cardinal direction.
Is X up and Y left, is the second number a completely different direction? Is there some sort of guide i can use to map out the Plot and Draw commands. In short, do i need to know geometry to do simple commands? Clearly, Sinclair never thought that we'd need a map just to make a simple picture. I can understand Circle fine, but even making a simple face is frustrating. please help

BTW, how do i save drawings as Jpeg or other using Fuse?
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

User avatar
1024MAK
Posts: 2554
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: X and Y

Post by 1024MAK » Sun Jun 16, 2019 2:03 am

In terms of graphics, imagine you are looking at a piece of graph paper (with a fine grid printed on it).

X is then the horizontal plane, with point zero on the bottom left, and as you move to the right, X increments upwards.

Y is the vertical plane. Point zero is still the bottom left. As you move up, Y increases.

This is a completely different system to the PRINT AT coordinate system.

See the manual for more details...

Mark

Crayon21
Posts: 128
Joined: Sun Nov 04, 2018 2:33 am

Re: X and Y

Post by Crayon21 » Sun Jun 16, 2019 9:50 am

and for PRINT AT?
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

User avatar
1024MAK
Posts: 2554
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: X and Y

Post by 1024MAK » Sun Jun 16, 2019 12:22 pm

PRINT AT line, column

E.g.
PRINT AT 11,15;”Hi”
will print Hi in the middle of the screen.

PRINT AT 0,0;
will set the current print position to the top left corner.

PRINT AT is shown in the manual here.

Mark

User avatar
XavSnap
Posts: 782
Joined: Sat May 10, 2008 4:23 pm

Re: X and Y

Post by XavSnap » Tue Jun 18, 2019 5:01 am

Hi,

I had to diet a Spectrum program, to add a display routine in it.
I had to delete all "PRINT AT" to retrieve memory rooms…

http://zx81.ordi5.free.fr/sacha/downloa ... _ATOME.zip

I just use the specials display characters:
Print AT 14,15 ( 1+7+1+7= 16 bytes) (+4 bytes if you had to cut a text line: ";AT 14,15;" )
\{22}\{14}\{15} (3 bytes)
Where \{22}=CHR$(22) \{14}=Y AND \{15}=X

SCpos$=CHR$(22) +CHR$(14)+ CHR$(15) >> Print AT 14,15;"HELLO WORLD" ==PRINT SCpos$;"HELLO WORLD"

But, you can't replace all AT functions in the main Basic Editor. You had to run my updated "ZmakeBas" release !
It able to add binaries in texts.

"ZmakeBas" and examples enclosed in the "Galagor" zipped file.
:ugeek:

Crayon21
Posts: 128
Joined: Sun Nov 04, 2018 2:33 am

Re: X and Y

Post by Crayon21 » Wed Jun 19, 2019 2:31 am

Is there some sort of Graph Paper reference as far as direction.

10,10 is center and 0,0 is top left, what direction or placement are the others? :?:
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

User avatar
XavSnap
Posts: 782
Joined: Sat May 10, 2008 4:23 pm

Re: X and Y

Post by XavSnap » Wed Jun 19, 2019 3:03 am

1024MAK wrote:
Sun Jun 16, 2019 12:22 pm
PRINT AT is shown in the manual here.
??? Arrhg … the famous "Have a look to the fucking manual"...
what direction or placement are the others?
Elementary my dear Watson: all around the center !

User avatar
1024MAK
Posts: 2554
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: X and Y

Post by 1024MAK » Wed Jun 19, 2019 5:19 pm

Try...

Code: Select all

10 CLS
20 FOR C=0 TO 31 STEP 8
30 FOR L=0 TO 21
40 PRINT AT L,C;L;“ ”;C
50 NEXT L
60 NEXT C
70 PAUSE 4E4
[Works on both the ZX Spectrum and the ZX81, but the Zeddy takes a bit longer...]

Mark

User avatar
1024MAK
Posts: 2554
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: X and Y

Post by 1024MAK » Wed Jun 19, 2019 6:02 pm

Also try...
[ZX Spectrum version]

Code: Select all

10 FOR A=0 TO 1 STEP 0
20 CLS
30 INPUT “Line number? ”;L
40 INPUT “Column number? ”;C
50 PRINT AT L,C;”O”
60 PAUSE 4E4
70 NEXT A
[ZX81 version]

Code: Select all

10 FOR A=0 TO 1 STEP 0
20 CLS
30 PRINT AT 21,0;“LINE NUMBER”
40 INPUT L
50 PRINT AT 21,0;“COLUMN NUMBER”
60 INPUT C
70 CLS
80 PRINT AT L,C;”O”
90 PAUSE 4E4
100 NEXT A
With both, type the keyword STOP in the input line to stop.

Mark

Crayon21
Posts: 128
Joined: Sun Nov 04, 2018 2:33 am

Re: X and Y

Post by Crayon21 » Fri Jun 21, 2019 12:16 am

what are all the numbers for? positions? kinda lost here
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

Post Reply