X and Y

A place to discuss the ZX80's and ZX81's younger brother - the Sinclair ZX Spectrum
User avatar
XavSnap
Posts: 787
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 40 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: 787
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:

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

Re: X and Y

Post by Crayon21 » Thu Oct 24, 2019 7:10 am

a lot of games for the zx81 use moving graphics and (for the system anyway) Smooth movement. How do i go about creating a simple moving sprite in basic (Machine code as well but without all the pokes if possible) :?:
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

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

Re: X and Y

Post by XavSnap » Thu Oct 24, 2019 10:13 am

:shock:

On Amstrad Basic, there is the TAGON/TAGOFF command to set a character location on the X/Y matrix.
But, Sinclair took the Zx81 basic to build the Spectrum… not the CPC.
You can't do that, you never be able to do this…
Harrrg….

The only way to move a character from X to X+1 or Y to Y+1 is to redefine a 8 bits bloc on 2 characters.
:ugeek:

But, it's not easy.
udg.JPG

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

Re: X and Y

Post by XavSnap » Thu Oct 24, 2019 11:08 am

Hi,
Dancing Pac-man...
screen.jpg
screen.jpg (13.57 KiB) Viewed 777 times
Spec_Scroll.zip
(84.28 KiB) Downloaded 24 times
Enclosed TZX, text file and compiler.

Have fun.

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

Re: X and Y

Post by Crayon21 » Thu Oct 24, 2019 11:46 pm

how does the program work?
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

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

Re: X and Y

Post by XavSnap » Fri Oct 25, 2019 1:03 am

Hi Crayon,
We display 8 graphics characters step by step… §A, §B, §C … §H
I case of a single UDG, you had to redefine a source character to a target character… to erase the mirrored part!

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

Re: X and Y

Post by XavSnap » Fri Oct 25, 2019 1:53 am

2 characters demo:
Scroll2.Tzx
(3.26 KiB) Downloaded 14 times
udg2.JPG
10 FOR A=USR "A" TO USR "Q"+7:READ B :POKE A,B:NEXT A
20 INK 7:PAPER 0:PRINT AT 5,0;" "
22 LET A$="\A\B\C\D\E\F\G\H"
25 LET B$="\I\J\K\L\M\N\O\P"
30 FOR A=0 TO 31
35 FOR B=1 TO 8:PRINT AT 5,A;A$(B);B$(B):NEXT B:PRINT AT 5,A;" "
40 NEXT A:GOTO 20
2980 REM #65
2990 DATA BIN 01111000
3000 DATA BIN 10101100
3010 DATA BIN 10101100
3020 DATA BIN 11111100
3030 DATA BIN 11011100
3040 DATA BIN 11111100
3050 DATA BIN 10101000
3060 DATA BIN 00000000
3070 REM #66
3080 DATA BIN 00111100
3090 DATA BIN 01010110
3100 DATA BIN 01010110
3110 DATA BIN 01111110
3120 DATA BIN 01101110
3130 DATA BIN 01111110
3140 DATA BIN 01010100
3150 DATA BIN 00000000
3160 REM #67
3170 DATA BIN 00011110
3180 DATA BIN 00101011
3190 DATA BIN 00101011
3200 DATA BIN 00111111
3210 DATA BIN 00110111
3220 DATA BIN 00111111
3230 DATA BIN 00101010
3240 DATA BIN 00000000
3250 REM #68
3260 DATA BIN 00001111
3270 DATA BIN 00010101
3280 DATA BIN 00010101
3290 DATA BIN 00011111
3300 DATA BIN 00011011
3310 DATA BIN 00011111
3320 DATA BIN 00010101
3330 DATA BIN 00000000
3340 REM #69
3350 DATA BIN 00000111
3360 DATA BIN 00001010
3370 DATA BIN 00001010
3380 DATA BIN 00001111
3390 DATA BIN 00001101
3400 DATA BIN 00001111
3410 DATA BIN 00001010
3420 DATA BIN 00000000
3430 REM #70
3440 DATA BIN 00000011
3450 DATA BIN 00000101
3460 DATA BIN 00000101
3470 DATA BIN 00000111
3480 DATA BIN 00000110
3490 DATA BIN 00000111
3500 DATA BIN 00000101
3510 DATA BIN 00000000
3520 REM #71
3530 DATA BIN 00000001
3540 DATA BIN 00000010
3550 DATA BIN 00000010
3560 DATA BIN 00000011
3570 DATA BIN 00000011
3580 DATA BIN 00000011
3590 DATA BIN 00000010
3600 DATA BIN 00000000
3610 REM #72
3620 DATA BIN 00000000
3630 DATA BIN 00000001
3640 DATA BIN 00000001
3650 DATA BIN 00000001
3660 DATA BIN 00000001
3670 DATA BIN 00000001
3680 DATA BIN 00000001
3690 DATA BIN 00000000
3700 REM #73
3710 DATA BIN 00000000
3720 DATA BIN 00000000
3730 DATA BIN 00000000
3740 DATA BIN 00000000
3750 DATA BIN 00000000
3760 DATA BIN 00000000
3770 DATA BIN 00000000
3780 DATA BIN 00000000
3790 REM #74
3800 DATA BIN 00000000
3810 DATA BIN 00000000
3820 DATA BIN 00000000
3830 DATA BIN 00000000
3840 DATA BIN 00000000
3850 DATA BIN 00000000
3860 DATA BIN 00000000
3870 DATA BIN 00000000
3880 REM #75
3890 DATA BIN 00000000
3900 DATA BIN 00000000
3910 DATA BIN 00000000
3920 DATA BIN 00000000
3930 DATA BIN 00000000
3940 DATA BIN 00000000
3950 DATA BIN 00000000
3960 DATA BIN 00000000
3970 REM #76
3980 DATA BIN 00000000
3990 DATA BIN 10000000
4000 DATA BIN 10000000
4010 DATA BIN 10000000
4020 DATA BIN 10000000
4030 DATA BIN 10000000
4040 DATA BIN 00000000
4050 DATA BIN 00000000
4060 REM #77
4070 DATA BIN 10000000
4080 DATA BIN 11000000
4090 DATA BIN 11000000
4100 DATA BIN 11000000
4110 DATA BIN 11000000
4120 DATA BIN 11000000
4130 DATA BIN 10000000
4140 DATA BIN 00000000
4150 REM #78
4160 DATA BIN 11000000
4170 DATA BIN 01100000
4180 DATA BIN 01100000
4190 DATA BIN 11100000
4200 DATA BIN 11100000
4210 DATA BIN 11100000
4220 DATA BIN 01000000
4230 DATA BIN 00000000
4240 REM #79
4250 DATA BIN 11100000
4260 DATA BIN 10110000
4270 DATA BIN 10110000
4280 DATA BIN 11110000
4290 DATA BIN 01110000
4300 DATA BIN 11110000
4310 DATA BIN 10100000
4320 DATA BIN 00000000
4330 REM #80
4340 DATA BIN 11110000
4350 DATA BIN 01011000
4360 DATA BIN 01011000
4370 DATA BIN 11111000
4380 DATA BIN 10111000
4390 DATA BIN 11111000
4400 DATA BIN 01010000
4410 DATA BIN 00000000
4420 REM #81
4430 DATA BIN 01111000
4440 DATA BIN 10101100
4450 DATA BIN 10101100
4460 DATA BIN 11111100
4470 DATA BIN 11011100
4480 DATA BIN 11111100
4490 DATA BIN 10101000
4500 DATA BIN 00000000

Post Reply