X and Y

A place to discuss the ZX80's and ZX81's younger brother - the Sinclair ZX Spectrum
User avatar
XavSnap
Posts: 653
Joined: Sat May 10, 2008 4:23 pm

Re: X and Y

Post by XavSnap » Fri Jun 21, 2019 11:44 am

Hi,
On the Zx81, you can't use the PRINT AT all over the screen.

Code: Select all

1 FOR A=0 TO 23
2 PRINT AT A,0;"X"
3 NEXT A
Will crash, or give an display error !

It's due to the command lines window (2 lines located in line 22 & 23), used for INPUT command !

We had to fill this zone with a PRINT AT 21,0; "xxxxxxxxxx...xxxxxxxxx" (1+2=3 lines of x continus chars!)
In this case, PRINT AT 22,x and PRINT AT 23,x give a Basic error.

To avoid this error, you had to set the INPUT zone, and set the Basic variable (DF-SZ) to 1 to allow the line 22 or to 0, to set the line#23 to a free use.

Code: Select all

0 POKE 16418,0
1 FOR A=0 TO 23
2 PRINT AT A,0;"X"
3 NEXT A
4 GOTO 4
In this case, the PRINT AT 23,x will work fine, but you had to set the "DF-SZ" to '1', if you had to get an INPUT command line.

'POKE 16418,0' is to set the full PRINT AT screen but, in case of INPUT command, the INPUT prompt won't be displayed !
:roll:

Otherwise, I still do not understand your questions …
Print AT 0 to 31 and PRINT AT 23,31...
[0-31] 32 characters. (columns)
[23-0] 24 characters. (lines)
In a normal stat, only 22 [Lines 0-21] are usable… without a DF-SZ set.
That's all.

2late
Posts: 14
Joined: Fri Apr 26, 2019 12:00 pm

Re: X and Y

Post by 2late » Fri Jul 19, 2019 1:38 am

Crayon21 wrote:
Fri Jun 21, 2019 12:16 am
what are all the numbers for? positions? kinda lost here
Yes, the numbers are positions.

Leaving alone the input lines, PRINT AT goes "the other way round" as PLOT in two ways.
  • PLOT has a mathematical system where the horizontal position is counted left to right and is the first argument of PLOT.
  • PRINT AT also counts left to right, but the horizontal position goes into the second argument
  • PLOT counts the vertical position bottom up and it is the second argument of PLOT.
  • PRINT AT however counts the lines top down, and the vertical position goes into the first argument
So to convert position from PLOT to PRINT you have to
  1. convert the horizontal i.e. x position by dividing it by 8 and take the INT of this
  2. convert the vertical i.e. y position by dividing it by 8 and take the INT of this and subtract the result from 21
The attached snapshot draws a line across the screen and then puts an S to the start and an E to the end by converting the coordinates and using PRINT AT.
CONVERT-PLOT-TO-PRINT-AT-COORDINATES.png
Attachments
plotprintat.sna.tar
(50 KiB) Downloaded 3 times

2late
Posts: 14
Joined: Fri Apr 26, 2019 12:00 pm

Re: X and Y

Post by 2late » Fri Jul 19, 2019 1:42 am

Crayon21 wrote:
Sat Jun 15, 2019 11:31 pm
BTW, how do i save drawings as Jpeg or other using Fuse?
I simply make a screen copy with https://www.gimp.org/

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

Re: X and Y

Post by XavSnap » Fri Jul 19, 2019 2:10 am

Thanks 2Late.
:ugeek:

Post Reply