"Inline" BASIC Extensions

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
Paul
Posts: 1511
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: "Inline" BASIC Extensions

Post by Paul »

But what happens with repeated LPRINT?
Is the second LPRINT again at the first position? I would expect it to fill the printer buffer until it's a full line and then print the line.
Is there an easy way to get the current printer position and is it enough to reset this?
In theory, there is no difference between theory and practice. But, in practice, there is.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: "Inline" BASIC Extensions

Post by dr beep »

I would make code like this:

PRINT (c$(1)+c$(2)) AND USR n

where at N the data on the calculator stack is fetched and a result with BC =0 would prevent any display.
Used it on the ZX Spectrum many times.
User avatar
GCHarder
Posts: 427
Joined: Sat Dec 14, 2013 7:46 pm

Re: "Inline" BASIC Extensions

Post by GCHarder »

siggi wrote: Tue Mar 21, 2023 9:45 am
using
21 LPRINT C$(1 to 2);
is easier.

Then the machine code can fetch PRINTABLE(!) characters from printer buffer (address 16444....) and the length of the basic code does not need to be calculated to call the machine code (line 20).

A single number X can be passed to m/c using RAND X and fetch the number X from address 16434
I'll have to play around with this idea, it may be possible to pass all parameters if they're less than 256 via LPRINT...

LPRINT C$(1 TO 2)+CHR$ X;

Greg
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: "Inline" BASIC Extensions

Post by XavSnap »

Paul wrote: Tue Mar 21, 2023 11:50 am But what happens with repeated LPRINT?
If the printer buffer reach 32 characters, it prints the buffer!
10 LPRINT "ZX81";
30 GOTO 10
This example reset the printer buffer:
10 LPRINT "ZX81";
20 POKE 16444,118
30 GOTO 10
In ASM:
LD (IY+60),118

Or Set the PR_CC to 60 ( Offset from IY =PR_BUFF): "20 POKE 16440,60"
LD (IY+56),60
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
Paul
Posts: 1511
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: "Inline" BASIC Extensions

Post by Paul »

XavSnap wrote: Tue Mar 21, 2023 11:02 pm
Paul wrote: Tue Mar 21, 2023 11:50 am But what happens with repeated LPRINT?
If the printer buffer reach 32 characters, it prints the buffer!
10 LPRINT "ZX81";
30 GOTO 10
This example reset the printer buffer:
10 LPRINT "ZX81";
20 POKE 16444,118
30 GOTO 10
In ASM:
LD (IY+60),118

Or Set the PR_CC to 60 ( Offset from IY =PR_BUFF): "20 POKE 16440,60"
LD (IY+56),60
Thanks Xav, exactly what I was looking for!
:idea:
In theory, there is no difference between theory and practice. But, in practice, there is.
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: "Inline" BASIC Extensions

Post by siggi »

GCHarder wrote: Tue Mar 21, 2023 9:47 pm
siggi wrote: Tue Mar 21, 2023 9:45 am
using
21 LPRINT C$(1 to 2);
is easier.

Then the machine code can fetch PRINTABLE(!) characters from printer buffer (address 16444....) and the length of the basic code does not need to be calculated to call the machine code (line 20).

A single number X can be passed to m/c using RAND X and fetch the number X from address 16434
I'll have to play around with this idea, it may be possible to pass all parameters if they're less than 256 via LPRINT...

LPRINT C$(1 TO 2)+CHR$ X;

Greg
Same as for PRINT on screen: non-printable chars are LPRINTed as "?", so 0-63 and 128 to 191 are OK
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
User avatar
GCHarder
Posts: 427
Joined: Sat Dec 14, 2013 7:46 pm

Re: "Inline" BASIC Extensions

Post by GCHarder »

I'm tending to forgo using LPRINT for parameter passing as it would make the programs incompatible with ZXPand.

Regards;

Greg
User avatar
GCHarder
Posts: 427
Joined: Sat Dec 14, 2013 7:46 pm

New version "Inline" routines.

Post by GCHarder »

I've uploaded a new version of the "Inline" program. I've done away with all the POKEs for parameter passing. Without the POKEs the GOSUBs are no longer needed so things are bit faster as well.

Parameter passing is now in the form...

10 PRINT USR FILL;[Lines],[CODE CHR "X"]

I've added two new routines "Quick Print" and "Spiral Wipe".

See Readme for details;

Enjoy;

Greg
User avatar
GCHarder
Posts: 427
Joined: Sat Dec 14, 2013 7:46 pm

New "Inline" routine-Diagonal Wipe

Post by GCHarder »

Makes a nifty display.

I'll add this to the main program later on I'm still working on other routines as well.

Enjoy;

Greg
Attachments
Diagonal Wipe.zip
Demo program
(2.48 KiB) Downloaded 139 times
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: "Inline" BASIC Extensions

Post by Moggy »

Thanks Greg.
Post Reply