News:

Welcome to RetroCoders Community

Main Menu

BASIC Anywhere Machine: LPRINT

Started by CharlieJV, Sep 24, 2022, 07:29 PM

Previous topic - Next topic

CharlieJV

BASIC Anywhere Machine (aka BAM) being a browser-based BASIC, access to hardware (like the file system or printers) doesn't come by naturally like it would for a traditional/installed BASIC implementation.

I'm hoping the newly added LPRINT statement will make it easy to get output to a file.

(One step towards the goal of not only making BAM better as a stand-alone BASIC implementation, but also more useful as a portable source code repository and test interpreter for bigger/standard implementations of BASIC.)


johnno56

hmm... I thought that LPRINT was used to output to a printer?

J
May your journey be free of incident.  Live long and prosper.

CharlieJV

Quote from: johnno56 on Sep 24, 2022, 08:34 PMhmm... I thought that LPRINT was used to output to a printer?

J

For sure, but LPRINT as implemented in traditional/installed BASIC's will not work in a web browser (i.e. print to paper one line at a time.)

So if that can't work in a web browser, then it makes sense to instead use LPRINT as a mechanism to output to a file, which works well from a web browser as a way to "paper-print" without actually being able to "paper-print."

If anybody can explain to me how to implement in a browser-based BASIC how to LPRINT the same as a traditional/installed BASIC, then I can make LPRINT pristine.

I figure:  LPRINT is available, might as well take it so that programs written in other BASIC's that do print to printer, those programs won't go kaboom.

Something like that.

Broken-record reminder: the goal of BASIC Anywhere Machine will never be, can never be, substitute for any traditional/installed BASIC.  But if it can be a sidekick (portable source code repository and coding/testing from anywhere) for those bigger BASIC's, that's cool.


johnno56

My apologies. I am not familiar with 'BAM' and immediately remembered the old days of 'LPRINT' or PRINT #8 and my old dot matrix printer...

"never be, can never be"?  Is that not the purpose of these types of applications, like emulators, to recreate the experience of 'how it was'? For those of us who witnessed the beginning of Basic, back in the mid-late 60's, can remember 'how it was'. Sure, all these 'new fangled' Basics are great, but recreate the experience? I would love to see that...

Do you have a link to 'BAM' that you would care to share?
May your journey be free of incident.  Live long and prosper.

CharlieJV

Quote from: johnno56 on Sep 24, 2022, 09:59 PMMy apologies. I am not familiar with 'BAM' and immediately remembered the old days of 'LPRINT' or PRINT #8 and my old dot matrix printer...

"never be, can never be"?  Is that not the purpose of these types of applications, like emulators, to recreate the experience of 'how it was'? For those of us who witnessed the beginning of Basic, back in the mid-late 60's, can remember 'how it was'. Sure, all these 'new fangled' Basics are great, but recreate the experience? I would love to see that...

Do you have a link to 'BAM' that you would care to share?

Don't mind me.  I get knee-jerk reaction trying to explain BAM.  I have TiddlyWiki folk who don't like this notion of BASIC hosted in a TiddlyWiki, and I get BASIC folk who don't see the point of BASIC in a web browser.

I figure if I've got people in both camps who are not happy about it, then I must be doing something right ...

BASIC Anywhere Machine has to work within the confines/constraints/rules/realm of web browsers, in particular everything having to do with security as implemented in web browsers.

The biggest things BASIC Anywhere Machine cannot do is things involving access to the operating system and the things the operating system provides (in particular: access to hardware like printers and drives/storage.)

In every other respect (i.e. a BASIC program that doesn't need to read from files or write to files/printers), this thing isn't too shabby at running, largely as is, BASIC programs from the 70's, 80's, and 90's.

Well, POKE and PEEK not withstanding.

GOTO, GOSUB, and Line numbers?  No problem.  If you prefer not use those, then structure your heart out.

If you want to do some programs that take advantage of some browser stuff, A-1.  (clipboard, browser local storage, browser session storage)

BAM is a little bit like a biosphere, or a bottle garden: it has everything it needs all in one file to run in any web browser (I have no tablet or smartphone to test, so that will be a work in progress once I do have those devices.)

Oops.  Wordy me.

Links:

Aside:  BASIC Anywhere Machine is a single-html-file TiddlyWiki instance hosting the IDE, tools, the interpreter, and acting as source code repository for all programs.  Programs existing in "tiddlers" (i.e. wiki pages).  The interpreter is a significantly modified version of wwwBASIC.

I'm trying to make BASIC Anywhere Machine as compatible as reasonably possible with other BASIC implementations, so that BAM has access to a large repository of existing programs, and so that BAM can be a useful sidekick to these other BASIC's.

Compatibility effort:



Slow work, because I cannot stand javascript programming.


CharlieJV

Enhanced LPRINT with some additional statements: _STARTSPOOL, _ENDSPOOL, _CANCELSPOOL


mysoft

to implement LPRINT on browser you have to stack the LPRINTS into a virtual page... and then once there's a timeout or whatever you show that and trigger the browser printing...

CharlieJV

Quote from: mysoft on Sep 26, 2022, 01:04 PMto implement LPRINT on browser you have to stack the LPRINTS into a virtual page... and then once there's a timeout or whatever you show that and trigger the browser printing...

I know just enough about javascript to be aware that there is such a thing as a function that can be called based on some defined timeout period.  Well, aware of something like that...

Say I have multiple LPRINT statements in a loop, and there is a significant amount of delay between LPRINT statements in that loop (say some serious number-crunching or string formatting/manipulation going on).

How is javascript supposed to know what the timeout period, or what event should trigger "Save File As" time?

To me, the easiest thing is to say "_ENDSPOOL" (or  _CANCELSPOOL) is the trigger for printing (well, "Save File As") or aborting.

I'd like to do some reading about it.  Can you point me to a javascript resource that shows how print spooling is done via a timeout thingy?