LINE-command (DRAW on ZX Spectrum)

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
dr beep
Posts: 2189
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

LINE-command (DRAW on ZX Spectrum)

Post by dr beep »

Here is a routine to draw a line in ZX81 BASIC.

Syntax:
PRINT USR 16516,y1,x1,y2,x2

The routine will scan the given coordinates and then draw a line between the 2 points
You can enter fixed values but also variables as the demo shows.

Out of screen will give an error

The routine is in the REM line but hidden.
The demo is line 1 and more.

To use the routine save your code with the LINE0
line.P
(1.12 KiB) Downloaded 23 times
User avatar
RS232
Posts: 76
Joined: Fri Apr 05, 2019 8:57 pm

Re: LINE-command (DRAW on ZX Spectrum)

Post by RS232 »

very cool. cheers. if you have time... maybe a feature to undraw a line also might be cool if you are working with a black background might be affective too :-)
dr beep
Posts: 2189
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: LINE-command (DRAW on ZX Spectrum)

Post by dr beep »

RS232 wrote: Mon Jun 10, 2024 11:39 am very cool. cheers. if you have time... maybe a feature to undraw a line also might be cool if you are working with a black background might be affective too :-)
I will make the syntax PRINT USR 16516,U,y1,x1,y2,x2 where U can be U or P for PLOTLINE or UNPLOTLINE
User avatar
RS232
Posts: 76
Joined: Fri Apr 05, 2019 8:57 pm

Re: LINE-command (DRAW on ZX Spectrum)

Post by RS232 »

@dr beep Much thanks :-)
dr beep
Posts: 2189
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: LINE-command (DRAW on ZX Spectrum)

Post by dr beep »

New version with option to UNPLOT a line too.

See that the direction can be set too.
The seperator can be anything , and a ; will both to the job.
line2.P
(1.14 KiB) Downloaded 9 times
User avatar
XavSnap
Posts: 1966
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: LINE-command (DRAW on ZX Spectrum)

Post by XavSnap »

Cool !
Many thanks Johan.

I don't know if it's usable in a graphic adventure game...
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
RS232
Posts: 76
Joined: Fri Apr 05, 2019 8:57 pm

Re: LINE-command (DRAW on ZX Spectrum)

Post by RS232 »

I think so. I might try and use it in a future game.. and will be sure to have him in the rolling credits :-)
User avatar
siggi
Posts: 1000
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: LINE-command (DRAW on ZX Spectrum)

Post by siggi »

Hi Johan
I tested on EO and found, that UNPLOT does nothing when using the ZX81x2 (Big Bang) rom.

Futhermore I would prefer a string instead the fixed letters P and U. Then a BASIC variable could be used (holding "P" or "U") instead of making a selfmodifying program to change the behaviour at runtime ..

Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
dr beep
Posts: 2189
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: LINE-command (DRAW on ZX Spectrum)

Post by dr beep »

siggi wrote: Wed Jun 12, 2024 11:40 am Hi Johan
I tested on EO and found, that UNPLOT does nothing when using the ZX81x2 (Big Bang) rom.

Futhermore I would prefer a string instead the fixed letters P and U. Then a BASIC variable could be used (holding "P" or "U") instead of making a selfmodifying program to change the behaviour at runtime ..

Siggi
Siggi,

you can use variable U and P. The program scans for the letter, not the variable That is done in the other parameters.

As for UNPLOT, I set a systemvariable to make this work.
See the ROM-UNPLOT routine. For PLOT it is set to <128 and 0 for UNPLOT.
dr beep
Posts: 2189
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: LINE-command (DRAW on ZX Spectrum)

Post by dr beep »

Now altered for BIG BANG ROM
line3.P
(1.14 KiB) Downloaded 2 times
Post Reply