QBasic and QB64 Discussion Board

[QB Forum Archives (1999-2009)/ ] [QB FAQ] [QB Links and Downloads] [Subforums and Chat Room] [Search]

QB64.Net Homepage   QB/QB64 Keywords   QB Graphics Forum   Homework Policy



a possibility in running x11basic (with color) on windows without ansi.sys

by mn (no login)

bear with me, this is a python trick for getting limited ansi support in 32-bit (maybe 64) windows.

it has not been tested, and may require downloading and installing colorama (free/libre.) it will definitely require you to run the python installer.

from os import system
from colorama import init
init()
system("x11basic")
# that's it

other windows/cross platforum dialects that may benefit: yabasic, python itself, any other dialect that doesn't have built-in analogs of COLOR() ... though at this point, i may have found one.

if i thought it had no chance of working, i wouldn't put it here. i've gotten weirder things to work, i once imported pictures into basic by running a dos picture viewer with a switch to exit after loading, hit alt-enter a couple times to switch back and forth from window to full screen, then used basic to read the pixels with point(x, y) i mean, i think it was point(). this was in win3.1 or 95 days. i don't know if this is one of those kinds of things or not.

Posted on Oct 21, 2014, 9:59 PM

Respond to this message   

Return to Index


If I had a junker PC, I'd give it a try.

by Pete (no login)

But I need to keep the one I'm using up, so I don't experiment with it.

I have set aside X11, because that LOCATE bug it has really annoys me.

Some good progress was me figuring out a way I could install apps directly to my android device. Now I simply save a BASIC program to my PC, and transfer it directly to the Android-BASIC folder.

Pete

Posted on Oct 21, 2014, 10:39 PM

Respond to this message   

Return to Index


bah, i've got a desktop and laptop you could have, but it's not worth the shipping

by mn (no login)

i've been refurbishing for a while. well, it's silly to call it that. it's the same kind of refurbishing that goes for pawn shops and thrift stores: check cables, reinstall o.s., see if it boots. they often skip step 2, it's not always an option, and neither always is step 1.

i bet michael does it 10 times better. as for the professionals... well, there are some wonderful stories online about shenanigans at apple's fixit dos.

how hard is it to get a junker pc these days? i mean where you are. anything with at least 500mb of ram should be able to run debian or if it has to be ubuntu, xubuntu is probably the least silly of them (among xubuntu versions, you'd want an lts.)

best of all you'd never have to install ansi support ever again... ha, i know it'll never happen. i like it for one (and two and three) because it's like dos: you can boot from a single disc with no hard drive, and you never have to "authorize" a stupid os installation again. but it was a complete pita for a few years (dos surprisingly, not as much...)

Posted on Oct 21, 2014, 10:57 PM

Respond to this message   

Return to Index


Converting QB code to print on Android.

by Pete (Premier Login iorr5t)
Forum Owner

This is a QB program I've converted to begin a scrolling program on my Android-BASIC project.

--------------------

text_viewport_top = 1
text_viewport_bottom = 15
text_viewport_lefxt = 1
text_viewport_widtxh = 24
text_indent = 0
FOR i = 1 TO text_viewport_widtxh - 5
   blank$ = blank$ + " "
NEXT
CLS
VIEW PRINT 1 TO 15
' Dimension Arrays
DIM Text_Displaxy$(1000)
' Place data into array
FOR i = 1 TO 20
   READ a$
   x$ = MID$(a$, 1, LEN(a$)) + MID$(blank$, LEN(a$), text_viewport_widtxh - LEN(a$))
   Text_Displaxy$(i) = x$
   ' Get total entries as {i} for READ, FILE, or any other input methods.
   total_entries = total_entries + 1
NEXT
' Print contents to screen
LOCATE text_viewport_top, text_viewport_lefxt + text_indent
FOR i = 1 TO text_viewport_bottom
   text_row = text_row + 1
   index_text = index_text + 1
   LOCATE text_row, text_viewport_lefxt + text_indent
   PRINT Text_Displaxy$(i);
NEXT
' Place an arbitrary cursor at last entry printed.
LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
PRINT " _";
' Audit keyboard
WHILE -1
   WHILE -1
      b$ = INKEY$
      '' QB to Android-BASIC key conversion
      IF b$ = CHR$(0) + "H" THEN b$ = CHR$(30)
      IF b$ = CHR$(0) + "P" THEN b$ = CHR$(31)
      ''
      IF b$ = CHR$(30) OR b$ = CHR$(31) THEN
         EXIT WHILE
      END IF
   WEND
   ' Scrolling Routine
   SELECT CASE ASC(b$)
      CASE 30
         ' Scroll up
         IF index_text > 1 THEN
            SELECT CASE text_viewport_top = text_row
               CASE 0
                  LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
                  ' hide cursor
                  PRINT "  ";
                  index_text = index_text - 1
                  text_row = text_row - 1
                  LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
                  PRINT " _";
               CASE ELSE
                  ' hide cursor
                  LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
                  PRINT "  ";
                  index_text = index_text - 1
                  FOR i = index_text TO index_text + text_viewport_bottom - 1
                     LOCATE i - index_text + 1, text_viewport_lefxt + text_indent
                     PRINT Text_Displaxy$(i);
                  NEXT
                  ' Send cursor back to the top
                  LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
                  PRINT " _";
            END SELECT
         END IF
      CASE 31
         ' Scroll down
         IF index_text < total_entries THEN
            LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
            ' hide cursor
            PRINT "  ";
            SELECT CASE text_viewport_bottom = text_row
               CASE 0
                  text_row = text_row + 1
                  index_text = index_text + 1
                  LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
                  PRINT " _";
               CASE ELSE
                  ' Cursor is on last input line.
                  ' move cursor down
                  PRINT
                  index_text = index_text + 1
                  LOCATE text_row, text_viewport_lefxt + text_indent
                  PRINT Text_Displaxy$(index_text);
                  LOCATE text_row, text_viewport_lefxt + text_indent + LEN(RTRIM$(Text_Displaxy$(index_text)))
                  PRINT " _";
            END SELECT
         END IF
   END SELECT
WEND
END
DATA "This is a test for"
DATA "The scrolling"
DATA "capabilities of the"
DATA "the Android tablet."
DATA "The program will"
DATA "use the arrow up and"
DATA "down keys to scroll"
DATA "this text in the"
DATA "Android device"
DATA "window. I will add"
DATA "a color matrix to"
DATA "the library as"
DATA "soon as the plain"
DATA "text scrolling has"
DATA "been adequately"
DATA "accomplished."
DATA "This concludes this"
DATA "initial test of"
DATA "the Android device"
DATA "scrolling algorithm."

Posted on Oct 21, 2014, 8:24 PM

Respond to this message   

Return to Index


*it's a great looking dialect. the gui stuff is not at all awful. super basicy goodness

by mn (no login)

Posted on Oct 21, 2014, 8:37 PM

Respond to this message   

Return to Index


Re: *it's a great looking dialect. the gui stuff is not at all awful. super basicy goodness

by Pete (no login)

Actually, the post is all QB code, but made so it is as easy as possible to convert to Android-BASIC, which has these differences for that code:

DATA for strings needs to be enclosed in quotes. If not, it tends to split lines or no apparent reason when read.

Do not use any keywords in REM. Use ' mark to avoid this.

Do not use any keyword as part of a variable.

LOCATE is flip-flop of QB (eg: POS(0), CSRLIN). LOCATE can only accept row and column, other added QB cursor parameters will be ignored.

ENDIF instead of END IF.

BREAK instead of any EXIT statements.

Only accepts WHILE for loops.

TIMER is 1000 times QB. Use TIMER / 1000 to emulate QB timer.

CONSOLE is required to set text screen.

SELECT CASE does NOT support (-) negative numbers.

Posted on Oct 21, 2014, 10:43 PM

Respond to this message   

Return to Index


*not bad! i've tried much worse

by mn (no login)

Posted on Oct 21, 2014, 11:01 PM

Respond to this message   

Return to Index


a question for pete, regarding old main-forum conventions (url)

by mn (no login)

(remember these?)

cross-forum notices: http://www.network54.com/Forum/183705/message/1413881459/

Posted on Oct 21, 2014, 1:54 AM

Respond to this message   

Return to Index


BRILLIANT! So now ONE POST CAN TAKE UP MULTIPLE FORUMS!

by Clippy (Login burger2227)
R

Posted on Oct 21, 2014, 4:58 AM

Respond to this message   

Return to Index


*please try to reply in the thread linked to in the url, to avoid hypocrisy

by mn (no login)

Posted on Oct 21, 2014, 5:24 AM

Respond to this message   

Return to Index


Like this?

by Clippy (Login burger2227)
R

Posted on Oct 21, 2014, 5:36 AM

Respond to this message   

Return to Index


Clippy, please quit ruining my board

by gopus (no login)

Thank you.

Posted on Oct 21, 2014, 1:38 PM

Respond to this message   

Return to Index


* Take it easy, please. (Stay calm, and watch baseball.)

by Michael Calkins (Login MCalkins)
Moderator

Posted on Oct 21, 2014, 4:28 PM

Respond to this message   

Return to Index


That would be good advice...if I wasn't a Dodgers fan!

by Pete (no login)

I'm lucky I only got to see the last 10 min of that final series game, in the golf shop. I felt sorry for my friends, who recorded it.

I hope those two can air out their differences without intervention. I fine with you or any of the other mods making any decisions you feel are necessary for the forum. Just so you know, I am not overly concerned about what Mac would call clutter as o late, because this is a transitional time, and people need to express their opinions easily, until it is all sorted out. We don't have personal email PM or whatever it is called, but I am in favor of getting back to using the community forum or such discussion, when the changes are launched.

Pete

Posted on Oct 21, 2014, 6:39 PM

Respond to this message   

Return to Index


Long key presses? Let's go bowling with Pete again!

by Pete (Premier Login iorr5t)
Forum Owner

What few mobile BASIC languages that exist are quite limited compared to QB. Some only allow for INKEY$, no INP(), and I haven;t checked out PEEK/POKE methods yet.

A lot o mobile devices rely on long key presses, as a way to give the user more keyboard choices. A limitation with INKEY$ has always been key status. INKEY$ will indicate false at times when a key is held down constantly. To get around that problem, we make a routine. So let's go bowling!

---------------------------

' LONG KEY PRESS DEMO USING INKEY$
'
' Returns long_key_press as -1 if a key is held down.
'
'
' VARIABLE TABLE
' keyin_lkp$: INKEY$ input variable
' long_key_press: Returns a value of -1 i a key is held.
' lockoutkey: 0 = Repeat on long key press / -1 Limit to one event and resets long_key_press to 0 so events triggered by -1 stop. / 1 Limit to one event as long as key is down but continues sending -1 value for long_key_press.
' lockoutkey$: Records the current key down and communicates with lockout key.
' last_key$: Records previous key press.
' press_timer1: When diference between press_timer2 > .1 triggers key_up_down evaluation. Resets to TIMER when triggered.
' press_timer2: Begins as soon as any key is pressed.
' key_up_down_timer: Begins when key held down is detected by last_key$. When < .1 sets long_key_press as TRUE.
' lkp_timer: Used in conjunction with lockoutkey to detemine release state.
'
'
' LONG KEY PRESS DEMO USING INKEY$
'
' Returns long_key_press as -1 if a key is held down.
'
' Stand alone routine
'
' Remove a remark below to use in gosub and sub calls.
'
' GOTO gosub_type
' GOTO sub_type_no_static
' GOTO sub_type_static
'
' -------------------------Long Key Press Stand Alone Routine--------------------------
'
' lockoutkey {0,-1,1}
' 0 = repeat on long key press.
'-1 disallow repeat and reset long_key_press to 0 even if key remains down.
' 1 disallow repeat and hold value at -1 until key is released.
'
lockoutkey = 0
'
press_timer1 = TIMER
key_up_down_timer = TIMER
lkp_timer = TIMER
' Display key status for demo. -1 indicates a long key press.
LOCATE 1, 1
PRINT "long_key_press =";
'
WHILE -1
   LOCATE 1, 18
   PRINT long_key_press;
   b$ = INKEY$
   IF b$ <> "" THEN
      press_timer2 = TIMER
      IF b$ = last_key$ THEN
         IF long_key_press OR lockoutkey$ = b$ THEN
            IF long_key_press THEN
               IF lockoutkey THEN lkp_timer = TIMER
            END IF
         ELSE
            IF ABS(press_timer2 - press_timer1) > .1 THEN
               IF ABS(TIMER - key_up_down_timer) < .1 THEN
                  long_key_press = -1
                  IF lockoutkey THEN
                     lockoutkey$ = b$
                  END IF
                  lkp_timer = TIMER
               END IF
               press_timer1 = TIMER
            END IF
            key_up_down_timer = TIMER
         END IF
      ELSE
         ' Reset values
         press_timer1 = TIMER
         key_up_down_timer = TIMER
         lkp_timer = TIMER
         long_key_press = 0
         lockoutkey$ = ""
      END IF
      last_key$ = b$
   ELSE
      IF long_key_press THEN
         IF ABS(lkp_timer - TIMER) > 1 THEN
            ' Reset values
            press_timer1 = TIMER
            key_up_down_timer = TIMER
            lkp_timer = TIMER
            long_key_press = 0
         END IF
      ELSE
         IF ABS(lkp_timer - TIMER) > .25 AND lockoutkey$ <> "" THEN
            lockoutkey$ = ""
         END IF
      END IF
   END IF
WEND

-----------------------------------------------------------

Pete

Posted on Oct 20, 2014, 11:38 AM

Respond to this message   

Return to Index


i'm confused, i thought this was a mouse issue, not keyboard...

by dibmn (no login)

when a position at x,y is held for a "long press" it makes up for the fact that there is no way to "right click" a touchscreen. i think it even returns the equivalent of a right click.

but this is a mouse issue. you're emulating it with the keyboard? that's cool, but does it work out when you use it on your phone? i guess that's really what matters here.

Posted on Oct 20, 2014, 12:33 PM

Respond to this message   

Return to Index


I converted a modiied version to lean a little more about my Android device.

by Pete (no login)

The results demonstrated a different behavior, at least in Android-BASIC. INKEY is polled and released without repeat. You have to physically press the key again to emulate a held keypress in QB. There may be a keyboard repeat option I need to turn on.

Also, to OS appears as if it may pass along the results of the key press length, as alternate characters appear if the key is held slightly longer in the BASIC program, without a need to assign a variable for the task. That;s pretty neat. Interesting too that the elapsed time can be all over the place, yet the alternate or standard key input is constant in regard to the length o the press. There apparently is no way to measure that in the program.

Pete

Posted on Oct 20, 2014, 2:09 PM

Respond to this message   

Return to Index


try the mouse routines, really

by mn (no login)

android is arm, there is x11 (the graphics layer, not the basic version) for android, there are versions of gnu/linux for the same hardware (rarely but sometimes) and in x11, this is mouse stuff.

i can't comment on dalvik (android vm layer) or android itself, only on similar platforms for the same hardware. in those, the long-press isn't done through timing, it's abstracted as a right-click. this sometimes requires changes to the x11 configuration file, but not necessarily the software itself.

the first thing i would try is to see how a right mouse click is detected in your version of basic. then run that on android and see if a long press gets detected as a right click.

but i still don't understand how inkey$ would pick up a touch event, unless the mouse events are (like they are with some versions of basic) handled by the dialect's version of inkey$. i'm not against inkey$ being overloaded with mouse events, the only issue is that it makes this matter a little more confusing.

i have an android device, and somewhere, a charger for it. mobile may well be the future, but not for me, as long as my choices are limited to android, ios and windows. i've had at least $1000 worth of android-compatible devices, i won't buy another android device if i can help it. if android-x86 continues to progress, maybe i'll be able to setup a test environment.

Posted on Oct 20, 2014, 2:54 PM

Respond to this message   

Return to Index


you know, you never explained what the long-press was needed for

by mn (no login)

if you've got an existing gui with right-click functionality, the easiest translation of the right click on a touchscreen is long-press.
it's only used rarely though, because most functionality on a touchscreen is mac-single-button-like.

(plus there's swipes, aka drag and drop, which in this context is easier than long press.)

why isn't long-press usually a keyboard thing? because keyboards have shift keys, and touchscreens don't.

i used a high-quality, larger-sized, name-brand smartphone with android (at least 4) over roughly a year period. most time a long-press is needed, it's because there aren't enough buttons at the bottom 2 or 3 "we use these for everything" icons. long-press hasn't got much going for it.

it's understandable to want long-press functionality, but what would you use it with? you might be better off sticking with normal presses and (on a touch screen, mind you) little boxes that say "are you sure?" perhaps with less inane wording like "click to confirm," etc. ...still curious. i can imagine some clever applications of long-press, but i'm probably not going to be the one to unleash those on the world.

Posted on Oct 21, 2014, 8:33 PM

Respond to this message   

Return to Index


Re: you know, you never explained what the long-press was needed for

by Pete (no login)

My Android has the ability to hold a key for 300 ms and it will give you the alternate character, which would otherwise need the alt key to be pressed, first. The problem is that it appears to be OS regulated, so no luck using the function I created, but it was still fun doing it, and I will find some use for it in other PC applications.

What I was hoping it would do on the Android device was allow for a long key press of the arrow left and right key to be a home / end replacement, as the keyboard does not have those options. The obvious reason, touch screen.

Pete

Posted on Oct 21, 2014, 9:26 PM

Respond to this message   

Return to Index


you need a different android keyboard

by mn (no login)

i KNOW what it's like to be old and have someone younger tell you things like they know everything, so just roll your eyes and bear with me. (yes, it's probably something you've already thought of, but just in case):

if you enable 3rd party sources, you can get free-licensed apk's from f-droid.org. they even have an app for searching and installing (by category or name.) there are several android keyboards, free. i used these packages exclusively (i even replaced my homescreen/launcher.)

some android keyboards have an alt key, or a keyboard that has a setting that has an alt key (they allow different-size layouts, the ones with more keys have smaller keys.)

of course when they make an android basic sophisticated enough to create an alternate keyboard, you can make your own. in the meantime, i wouldn't suppose you'd like to make a graphical menu to select these characters from? the menu could be in the shape of a keyboard, and (if we're lucky) copy the character to the clipboard, like charmap. (is there a charmap app?) also: check f-droid for a charmap application. http://f-droid.org

Posted on Oct 21, 2014, 9:38 PM

Respond to this message   

Return to Index


Yep, knew that...

by Pete (no login)

Unfortunately the installation of some of those products has also screwed up the device in general, or so I have read. I could always to a factory rest though.

Posted on Oct 21, 2014, 10:00 PM

Respond to this message   

Return to Index


i'd like to know which ones, so i can warn people in the future

by mn (no login)

i don't expect you to know the names off the top of your head, but i never screwed anything up installing them on a variety of devices.

i didn't test every app though, there are probably 1-200 in the repo, and i haven't checked it in a year.

the keyboard i used was called hackers keyboard, presumably based on the non-malevolent definition of the word. (not to be confused with the hack's keyboard, used to write headlines for cnn.)

uninstalling should be an option on most/all apps.

Posted on Oct 21, 2014, 10:11 PM

Respond to this message   

Return to Index


Using QBasic to generate HTML files

by johng (no login)

Hi, I'm using XP for a platform as it has DOS v5.1(cmd.exe) that enables QBasic v6.22 to work just nicely... now I'm assuming that everyone knows that both data, and, programme files(.bas) can be opened in , of all things, "Wordpad". Okay, well my question is to those of you into "hybrids"... Can these "text" files be used to generate HTML files, and, after learning the No.2 easiest to programme with language, is it just a matter of giving the file an HTML extension in opposition to the .bas extension?... thanks

Posted on Oct 18, 2014, 8:54 AM

Respond to this message   

Return to Index


name change, sorry

by johng (Select Login bitbanger)

didn't realise, no login, now with a login I'm "Bitbanger"... sorry

Posted on Oct 18, 2014, 9:39 AM

Respond to this message   

Return to Index


Re: Using QBasic to generate HTML files

by Pete (no login)

You can change the name of the extension to .html/ The file would then open in your default browser, but it won;t have any html mark up tags, so it will present as one long word-warp line.

Example:

myprog.bas

cls
a$ = "12345"
key$ = "x"
print mid$(a$, 1, 2) + key$ + mid$(a$, 2 + 1, len(a$));"/";
sleep 5
end

Presents as this when named as an html file when opened in a browser:

cls a$ = "12345" key$ = "x" print mid$(a$, 1, 2) + key$ + mid$(a$, 2+1, len(a$));"/"; sleep 5 end

----------------

So at minimal, it is missing the <br> tags that separate the lines.

cls<br>
a$ = "12345"<br>
key$ = "x"<br>
print mid$(a$, 1, 2) + key$ + mid$(a$, 2 + 1, len(a$));"/";<br>
sleep 5<br>
end


Pete

Posted on Oct 18, 2014, 10:36 AM

Respond to this message   

Return to Index


with an addenda...

by bitbanger (no login)

"correspondent"...,
My apologies, when I referred to learning another language, I meant learning the HTML language, Tags 'n all, for the purpose of using in the same situation where:- a ".cpp" programmer, I think it's in Linux, can use their native text editor, or Emacs, or GVim to write program files, using C++, give the file a .cpp extension, and then use the text editor file anywhere up to the Bash Shell. The direction I wish to take is similar, in that, if I were already an HTML programmer, but only had a very programmable QBasic to work with, I wish to output text files written "1 on 1" as HTML program files with a .bas extension, once output and sitting in the IDE, invocation of a DOS routine could change the extension from .bas to .HTML and then return to execution in the QBasic program. I was wondering if this idea has been tried before....?
bitbanger

Posted on Oct 21, 2014, 6:01 AM

Respond to this message   

Return to Index


Anyone else want to jump in and try to explain this?

by Pete (no login)

I just can't seem to figure out what bitbanger is getting at. Write a QB program that generates HTML code is the only thought I seem to come up with.

I know years back I would have liked to have had QB run an HTML page, and have the links and forms in the page be managed by the same QB program that launched it, so when the user clicked a ink or submitted a form, the QB program would generate or load a page or a response. That would be a neat way around programming graphics, which the HTML page would produce.

Possibly bitbanger can post a pseudo-code example, if nobody else gets it, either.

Pete

Posted on Oct 21, 2014, 6:46 PM

Respond to this message   

Return to Index


when you get as little traffic as this, you might as well brute force the answer

by mn (no login)

or at least the next step:

we know he's using wordpad, and basic (qb i think) and wants to use html.

so wordpad can be used to write basic files (.bas) even though i can't imagine why anyone would.

it can be used to print .rtf files, which can be parsed by a basic program (or called from shell to print them out.)

it might be able to save rtf as html, but probably not.

then there's the possibility that he wants to display basic programs as html pages, and there there's pete's graphics output (i used to do that with tables, but divs and now canvas work, the latter probably saves dom resources and changes loading time by an order of magnitude.)

possible input: .txt .bas .rtf .htm
possible processors: -> wordpad -> qb, or qb -> wordpad
possible output: .txt .bas .rtf .htm

(...but we know the output is .htm, so the poison is obviously in the drink in front of me. still, you must have known i would realize that, so the poison is obviously in the drink in front of you!)

this is really about what html can do, even if the language barrier (or alternatively, the attempt to put us on) is not too large an obstacle.

in order of difficulty:

1. basic code can be written in wordpad, and wordpad or basic can turn that into nicely formatted html pages for showing off a basic program

2. wordpad can convert (some) rich text documents to rtf, which can be converted (with wordpad) or parsed with a qb program to make .rtf (a plainttext-based format, that's why rtf) into html (a more modern plaintext format)

3. you can take a basic program, convert it to javascript (with difficulty,) and put that in an html page

so really:

input: .bas
processors: ?????
output: .html

we need to see the .bas file, or we need a better explanation of what the .html file will have in it when it's done.

other than that i think we're wasting our time (but that's ok too.)

(i rehashed some things pete already said. it would have been still more confusing otherwise.)

Posted on Oct 21, 2014, 7:56 PM

Respond to this message   

Return to Index


pseudocode (delete if in violation of hh guidelines)

by mn (no login)

open .bas file
open .same filename minus the bas extension, plus something like "_out", then the html extension
(the _out is to avoid clobbering existing files)

make a loop through the bas file

with each line in the loop:
* convert leading spaces to non-breaking spaces (preserve indents)
* add the html for a line break
* add line to the .html file

end the loop through the file

close both files

if "1 to 1" means more than that, he's going to need to parse rtf. it can be done, but it's a lot more work

(at least some of this is on the faq)

Posted on Oct 21, 2014, 8:11 PM

Respond to this message   

Return to Index


just back

by bitbanger (no login)

Pete,
You're bang-on about the graphics, one of the primary reasons for using HTML in the first place is, how could anybody be satisfied with two shades of eight colors when even the download of the "primary" shade selector system leaves you stunned as you leaf through about a hundred different shades of "blue"...etc., Now as you know, machine code subroutines have their source code converted to chr$() "string" characters and are reloaded back into the QB system as individual string-array-subroutines available for program use, the handiest thing you can do with a language whose op-characters fall within the 0 - 255 range, available for "CALL"ing upon establishing subroutine address by use of the " A = VARPTR$() " & segment command "VARSEG". In these subroutines, presumably, would be 32-bit machine-code, able to access the UMB graphics registers... a-la 32 bit graphics... past this I would be conjecturing as although I have a bit of time up on Basic's of one distro or another, and quite an amount of time on 16-bit machine-code, but on 32-bit, I have a "MASM" IDE in mem.... as I say, any others been this way before...

Posted on Oct 23, 2014, 5:53 AM

Respond to this message   

Return to Index


i think if you want to replace basic with html, you're going to need javascript

by mn (no login)

otherwise the graphics that come out are just going to sit there and do nothing.

then again, css has roughly enough functionality to be turing complete at this point. but i don't know anyone that can convert any basic program to javascript, and css would be much more difficult. there's no solid basic to javascript translator that i know of.

Posted on Oct 23, 2014, 6:37 AM

Respond to this message   

Return to Index


Re: just back

by Michael Calkins (Login MCalkins)
Moderator

Upper Memory Blocks are within the first 1MB of real mode address space, so could be accessed directly from 16 bit real mode.

Don't confuse 24 or 32 bit graphics color depth with 32 bit protected mode code.

If you want easy 24 or 32 bit graphics, have you looked at QB64? http://www.qb64.net/
There are two versions, an older SDL version, and a newer OpenGL/freeglut version.

I've never heard of anyone using QBASIC Call Absolute to run protected mode code. I guess it's possible, but I don't know that anyone has ever done it.

Obviously any binary data can be encoded in text as hexadecimal, base64, or even decimal values...

Regards,
Michael

Posted on Oct 24, 2014, 6:17 AM

Respond to this message   

Return to Index


With some help from mn, trying to determine what you are looking for...

by Pete (no login)

OPEN "mybasic.htm" FOR OUTPUT AS #2
PRINT #2, "<!DOCTYPE html PUBLIC " + CHR$(34) + "-//W3C//DTD HTML 4.01 Transitional//EN" + CHR$(34) + ">"
PRINT #2, "<html>"
PRINT #2, "<head>"
PRINT #2, "<meta content=" + CHR$(34) + "text/html; charset=ISO-8859-1" + CHR$(34) + " http-equiv=" + CHR$(34) + "content-type" + CHR$(34) + ">"
PRINT #2, "<title>QBASIC APPLICATION</title>"
PRINT #2, "</head>"
PRINT #2, "<body>"
'OPEN "MYBASIC.BAS" FOR INPUT AS #1
DO
'do UNTIL EOF(1)
'LINE INPUT #1, a$
READ a$: IF MID$(a$, 1, 3) = "eof" THEN EXIT DO
x1$ = LTRIM$(a$)
x2$ = ""
FOR i = 1 TO LEN(a$) - LEN(x1$)
x2$ = x2$ + "&nbsp;"
NEXT
PRINT #2, x2$ + LTRIM$(a$) + "<br>"
LOOP
PRINT #2, "</body>"
PRINT #2, "</html>"
SHELL _DONTWAIT "mybasic.htm"
END

DATA "CLS"
DATA "FOR i = 1 to 5"
DATA " PRINT #2, i"
DATA " IF i = 5 THEN"
DATA " PRINT #2, Done$"
DATA " END IF"
DATA "NEXT"
DATA "eof"


------------------------

You will have to copy it and indent the code yourself. If I use the formatted text option at this forum, it will not allow the html tags to be seen.

I'll put the spaced data in a separate post, underneath this one.

If you remove the DATA READ statement, and the data, unremark the OPEN file statement, and the DO UNTIL EOF(1), get rid of the other do, and it will take a file of yours called mybasic.bas and open it in your default web browser.

The demo as is will do the same, but use the small program as written in the data statements.

Pete

Posted on Oct 21, 2014, 10:13 PM

Respond to this message   

Return to Index


DATA with spacing to replace in above post.

by Pete (Premier Login iorr5t)
Forum Owner

DATA "CLS"
DATA "FOR i = 1 to 5"
DATA "   PRINT #2, i"
DATA "   IF i = 5 THEN"
DATA "      PRINT #2, Done$"
DATA "   END IF"
DATA "NEXT"
DATA "eof"

Posted on Oct 21, 2014, 10:16 PM

Respond to this message   

Return to Index


*howd you do the spaces?

by mn (no login)

Posted on Oct 21, 2014, 10:17 PM

Respond to this message   

Return to Index


Spaces require formatted text box checked, and...

by Pete (no login)

&nbsp; substituted for every leading space.

I have to use Opera to have the formatted text box option, IE and FF won;t show it, or Photobucket option, I don't know why.

So...

IF a = 0
&nbsp;&nbsp;&nbsp;PRINT a
END IF

...would show up indented if I was posting in Opera with formatted text box checked.

Pete

Posted on Oct 21, 2014, 10:27 PM

Respond to this message   

Return to Index


here pete, try this

by mn (no login)

'''' go ahead and add your w3c stuff if you like

filename$ = "myfile.bas"
'''' this program is public domain

open filename$ for input as #1

'''' remove . (and spaces just because)
f$ = ""
for x = 1 to len(filename$)
one$=mid$(filename$,x,1)
if one$ <> chr$(32) and one$ <> "." then f$ = f$ + one$
next x
f$ = f$ + "-out.htm"

open f$ for output as #2

'''' read and convert
do while not eof(1)
line input #1, ln$

f$ = ""
leading = 1
for x = 1 to len(ln$)
one$=mid$(ln$,x,1)
if one$ <> chr(32) then leading = 0
select case one$
case " "
if leading then f$ = f$ + "&nbsp;" else f$ = f$ + chr(32)
case "<"
f$ = f$ + "&lt;"
case ">"
f$ = f$ + "&gt;"
case "&"
f$ = f$ + "&amp;"
case "\"
f$ = f$ + "&#92;" ' won't hurt
end select
next x
f$ = f$ + "<br/>"
print #2, f$

loop

close

Posted on Oct 21, 2014, 10:38 PM

Respond to this message   

Return to Index


Re: here pete, try this

by Pete (no login)

I used the same DATA or the myfile.bas, and tested it.

myile.bas

CLS
FOR i = 1 to 5
PRINT #2, i
IF i = 5 THEN
PRINT #2, Done$
END IF
NEXT

myfile-out.html

<br/>
<br/>
&nbsp; <br/>
&nbsp; <br/>
&nbsp; <br/>
&nbsp; <br/>
<br/>

-------------------------

Also, don;t forget, QB requires CHR$(32), not CHR(32). SOME other BASIC languages allow the $ to be dropped.

Pete

Posted on Oct 21, 2014, 10:57 PM

Respond to this message   

Return to Index


*thanks. i do know but stringdollarsign muscle memory after 5 years is gone. don't miss it

by mn (no login)

Posted on Oct 21, 2014, 11:04 PM

Respond to this message   

Return to Index


You needed a CASE ELSE added...

by Pete (no login)

filename$ = "myfile.bas"
'''' this program is public domain

OPEN filename$ FOR INPUT AS #1

'''' remove . (and spaces just because)
f$ = ""
FOR x = 1 TO LEN(filename$)
one$ = MID$(filename$, x, 1)
IF one$ <> CHR$(32) AND one$ <> "." THEN f$ = f$ + one$
NEXT x
f$ = f$ + "-out.htm"

OPEN f$ FOR OUTPUT AS #2

'''' read and convert
DO WHILE NOT EOF(1)
LINE INPUT #1, ln$

f$ = ""
leading = 1
FOR x = 1 TO LEN(ln$)
one$ = MID$(ln$, x, 1)
IF one$ <> CHR$(32) THEN leading = 0
SELECT CASE one$
CASE " "
IF leading THEN f$ = f$ + "&nbsp;" ELSE f$ = f$ + CHR$(32)
CASE "<"
f$ = f$ + "&lt;"
CASE ">"
f$ = f$ + "&gt;"
CASE "&"
f$ = f$ + "&amp;"
CASE "\"
f$ = f$ + "&#92;" ' won't hurt
CASE ELSE
f$ = f$ + one$
END SELECT
NEXT x
f$ = f$ + "<br/>"
PRINT #2, f$

LOOP

CLOSE

-------------------------------------

The CASE ELSE adds the file contents that was missing.

So, looks good. Hopefully between mine and your example, there is something bitbanger can use.

Pete

Posted on Oct 21, 2014, 11:21 PM

Respond to this message   

Return to Index


whew! i so did. so...

by mn (no login)

while we're here, did you get my original note a week or so ago, about my login?

i've been practicing my newer set of keys (they're on this forum, and mostly in the python forum) and my new login is being used regularly.

i (really) don't care if you transfer the linux club to me again or not, i already said you could have those back. (on the other hand, i'm willing if you need that done. haven't seen any spammers in a while, but etc.)

the python forum currently has no mod which is fine, but whatever you do could you activate the r group for dibmn? i'm not sure if i need that to be able to edit my own stuff there.

Posted on Oct 22, 2014, 12:29 AM

Respond to this message   

Return to Index


* youd possibly want to convert <'s in source to & lt; and >'s to & gt; and &'s to

by mn (no login)

Posted on Oct 21, 2014, 8:16 PM

Respond to this message   

Return to Index


Re: Using QBasic to generate HTML files

by Michael Calkins (Login MCalkins)
Moderator

cmd.exe is not DOS. It is the Windows command prompt.

The DOS command prompt is command.com, and runs under ntvdm.

Regards,
Michael

Posted on Oct 24, 2014, 6:18 AM

Respond to this message   

Return to Index


Need help finishing a program

by Haristole craft (no login)

Can someone help me finishing this. We were supposed to write a program where customers are supposed to come in to use some servers. We were given the arrival rate of those customers and it's 4 minutes and and the service time when a customers uses a server is 2.4 minutes. What we need to find out is the average waiting time for customers in the queue before they get serviced to a server. There are 10 servers and 100000 customers are supposed to come in.
Someone started the program but he didn't finish it. The blank space between line 210 and 270 are the missing codes that he didn't finish.

100 DIM C(50) (50 is max number of servers)
110 INPUT S,NSTOP (S,NSTOP = number of servers, customers to be simulated)
120 FOR D=1 TO NSTOP
130 IA= (IA = interarrival time)
140 A=A+IA (A = arrival time)
150 J=0
160 J=J+1 (J = index of server being probed)
170 IF J=S+1 THEN K=K+1 (K = number of customers that are blocked)
180 IF J=S+1 THEN 270
190 IF A<C(J) THEN 160 (C(J) = completion time for server J)
195 AS W = 0
200 X= (X = service time)
205 SX = X + SX + W (Sum of holding times for carried load)
210 C(J)=A+X+W


270 NEXT D
280 PRINT K/NSTOP, SX/A, SW/NSTOP (fraction of customers blocked, utilization, average waiting time)
285 END

Posted on Oct 16, 2014, 3:26 AM

Respond to this message   

Return to Index


Not only are you cheating, you want us to finish it for you?

by Clippy (Login burger2227)
R

[linked image]

Posted on Oct 16, 2014, 5:25 AM

Respond to this message   

Return to Index


*I'll jump on this if you post your own attempt.

by STxAxTIC (no login)

Posted on Oct 16, 2014, 5:41 AM

Respond to this message   

Return to Index


Re: *I'll jump on this if you post your own attempt.

by Haristole craft (no login)

Basic is not my language, because i've never studied it. It's not something i'll even use one day professionally. But i am required to finish this program in this language. I spent a little hours trying to attempt it on my own but i could not arrive at anything. That's why i decided to come here, but it's ok if you don't want to help, although i would really appreciate it if you do.

Posted on Oct 16, 2014, 5:56 AM

Respond to this message   

Return to Index


Nobody gives homework for programming you aren't learning about!

by Clippy (Login burger2227)
R

Go cheat somewhere else!

Posted on Oct 16, 2014, 6:30 AM

Respond to this message   

Return to Index


Re: Nobody gives homework for programming you aren't learning about!

by Haristole craft (no login)

Thank you for reading this anyway. And no, the homework is not about the program. That is one small part of the homework. The class is not even about programming. It's queueing theory. Not too many people know about BASIC nowadays. Now if it was JAVA i would have done it long ago. Anyway, thank you for your input.

Posted on Oct 16, 2014, 6:46 AM

Respond to this message   

Return to Index


Furthermore....

by Solitaire (no login)

The code you are showing is from an antique version of BASIC using line numbers. It's unstructured, and jumps from one line number to another. This is totally obsolete. Where did you get this code?

QBasic is structured and does not require line numbers.

I suggest you write the program in Java, if that's the language you understand, and then use a translator to convert it into a more modern version of Basic.

Posted on Oct 16, 2014, 8:16 AM

Respond to this message   

Return to Index


But where on Google Earth would he find a JAVA to BASIC translator?

by Pete (no login)

It would be nice if things were really that simple, but they are not.

The best advice I can give Mr. Craft.

1) Ignore Clippy.

2) Reread 1 and repeat.

3) Post us some psudo-code like

input number of customers
input number of servers
input interval of time each customer arrives
input interval of time to process each customer on a server

etc...

QBasic works with statements like:

Input "Number of customers: "; noc

where words between quotes get printed to the screen, and the user presses Enter after typing a response. The numerical response then gets assigned to the variable, which I named noc.

After all input is in, use standard calculations to arrive at averages from input.

theanswer = a / b + c / d

etc.

If you don;t have a copy of QBasic, you can go to www.qb64.net. A download of QB64 is available at:
http://www.qb64.net/forum/index.php?topic=6007.0

you could install it, start writing code, and run it to test it. You are always welcome to return her, post what code you have working, pseudo-code you are trying to find how to use in QB, and get help that way.

Pete


Posted on Oct 16, 2014, 9:09 AM

Respond to this message   

Return to Index


Re: But where on Google Earth would he find a JAVA to BASIC translator?

by Haristole craft (no login)

Thank you for taking interest.

I was already thinking of using java, if i couldn't complete the program. And While i'll be deducted some points for not completing it, the main purpose of this assignment is that we developed a theory and we need to know if it's true by checking it with a running simulation program that would calculate the same variables and see if we end up with the same results. Java aside, even Excel can easily do that.


It would seem to calculate the waiting time it would be the completion time of a server after being used minus the arrival time of the coming customer. The completion time i think is calculated on line 210 which is the variable C(J). So the waiting time should be something like: W = C(J) - A (A stand for the arrival time).

After that you need to generate a new completion time which is: service time + the previous completion time then you generate a new customer. For this code, i'm not sure at all how to write it.

I had already installed qb64, Thanks. The solution is there and i think it's easy but i'm just not used to this language.

Posted on Oct 16, 2014, 11:50 AM

Respond to this message   

Return to Index


Translator

by Solitaire (no login)

Try this. It includes a Java to VB (Visual Basic) translator:

http://www.tangiblesoftwaresolutions.com/

Posted on Oct 16, 2014, 4:04 PM

Respond to this message   

Return to Index


as_an_addenda_to_Pete

by bitbanger (no login)

g'day there,
just a quick afterthought on what Pete said about getting QB64, at the same time go to Biblio.com. when you get there (a) have a PayPal account or MasterCard handy, (b) put the following title -: The Waite Group's QBasic Primer Plus, in the search line. You'll be quite amused by the "array"... pricing of the volume goes by the amount of appreciation for what a truly valuable piece of computer programming hard-copy they have in their possession. I've seen from $8 - $80 as a price for this book....
best of luck
bitbanger

Posted on Oct 21, 2014, 6:37 AM

Respond to this message   

Return to Index


The Waite Group...

by Pete (no login)

Interestingly enough, they still try to sell the old QB books. I used to have the dot com name Qbasicforum.com. I held it for awhile, in case N54 ever went under during the recession. Let it go, and I suspect The Waite Group or someone associated to those publishers picked up the domain name, and are using it to hock the books.

Pete

Posted on Oct 21, 2014, 9:19 PM

Respond to this message   

Return to Index


i think my second basic book was from waite

by mn (no login)

definitely worth its waite in paper.

but my first book was this: http://www.pinterest.com/pin/388294799093230186/

that's the one i modeled my tutorial after. the one that's not by clippy, even though it appears to be in the headings on the downloads page...

i say "modeled," but but i hadn't seen it in 15 years when i wrote the tutorial. i didn't know input$ OR inkey$ until i had the waite book, and i still used gw-basic (though ibm didn't call it that) when i got the waite book.

Posted on Oct 22, 2014, 12:38 AM

Respond to this message   

Return to Index


The only thing missing is finding the sum SW for the total witing time

by qbguy (no login)

Isn't it just

SW = SW + W

since W holds the waiting time?

Posted on Oct 16, 2014, 9:39 AM

Respond to this message   

Return to Index


Re: The only thing missing is finding the sum SW for the total witing time

by Haristole craft (no login)

Thank you also for taking interest.

Yes, this code is needed to find the sum of the waiting times but it doesn't complete the program.

As i just explained to Pete. First i need to the find the waiting time for each customer and that is the completion time when a sever is finished being used minus the arrival time of the coming customer. The completion time is on line 210, so it's something like W = C(J) - A.

The next step that looks more completed to me is when we have to generate the new completion time when a customer come using a server and it should be: service time + the previous completion time. But I don't know how to write that.

Posted on Oct 16, 2014, 12:02 PM

Respond to this message   

Return to Index


Re: Need help finishing a program

by Pete (no login)

Fixed variables

10 Servers
100000 projected users

(Sounds like Obamacare launch, but I digress...)

4 minutes average time elapsed until a new new user signs on.
2.4 minutes per user on a server.

So the problem I have with this scenario, program aside, is it would only require 1 server, as a person shows up every 4 minutes, but gets done 1.6 minutes before the next person even shows up. If that is so, there is no waiting time or anyone in the queue.

Am I missing something?

Pete

Posted on Oct 16, 2014, 1:15 PM

Respond to this message   

Return to Index


Re: Need help finishing a program

by Haristole craft (no login)

Oh, yea sorry i didn't mention about that, because i didn't think it was necessary. And i didn't want to complicate it more for you guys. But we're using 4 methods when we run the program. 1) A Poisson arrival time with an exponential service time (so the time between each arrival is exponentially distributed). 2) Poisson arrival with constant service time. 3) constant inter-arrival time with exponential service time, then 4) constant inter-arrival time with constant service time.

The last method with just the constant 4 and 2.4 minutes will give you no waiting at all.

Posted on Oct 16, 2014, 2:00 PM

Respond to this message   

Return to Index


And the winner is, Android-BASIC.

by Pete (no login)

At least in a race between RFO-BASIC and X11-BASIC, Android-BASIC appears to be the most QB compatible. X11 looked promising, but I couldn't get over the bug in the text screen. Weird, but it locates the cursor one space down and two spaces forward. You actually have to set variables to the row and column and subtract one from each after any print statement followed by a ";" sign. What a pain. Alos weird is the call the variables CRSLIN instead of CSRLIN, and CRSCOL for POS(0). X11 is also missing a way to read from the screen. Android-BASIC has a screen reading function, and uses CSRLIN and POS(0) but in reverse order, as in COLUMN, ROW instead of ROW, COLUMN. It has some drawbacks. It actually assigns line numbers, so I'm glad I hardly ever use GOTO. It also requires, as all 3 do, you separate statements completely. No colons. Every IF statement has to have an ENDIF. No blank lines allowed. Don;t even think about including a keyword as part of a longer variable name, it won't accept it. TIMER is similar but all integers. It just moves faster, so .4 would be 400. None of the ones mentioned have ways to manipulate the cursor appearance. Android-BASIC only supports WHILE/WEND for loops. INKEY$ has some interesting values, like 12 for backspace, 29 cursor left, 28, cursor right, etc.

So a lot to consider to make a conversion program. It makes me appreciate what an advanced BASIC language QB is.

Pete

Posted on Oct 15, 2014, 7:56 PM

Respond to this message   

Return to Index


it's not easy at all to make a good language

by mn (no login)

my approach has been to do mostly the easy stuff first, then try to add what has to be there. i'm not sure it will get there, but like the last one or two toy languages it's good experience (i've coded more in the past week than in the past 6-8 months.)

i thought i'd be making it easier having it based on simple tokens. the fact is, a minimal amount of punctuation in the syntax would make it easier to accomplish certain things, like figuring out whether to treat something as an array or a string (usually no problem, only ideally i want statements that treat them as equal citizens.)

as for the locate bug, i can tell you i've been there. when i started working with ansi, it was a nightmare. the equivalent of print ""; is vital (i can do that now, it's a big deal) and yes, it's definitely a huge difference to be able to fit more than one command per line.

not every language does, of course. logo, which i consider a "pre-beginner" language, has simple tokens, very minimal punctuation in the syntax, and typically one-statement-per-line. i say typically meaning almost always; it's not like the laws of physics. logo dialects vary widely, and also not as much as basic dialects. python lines really benefit from having not so many side (and really do more per line anyway) but you still have the option.

the simpler your dialect's lines are to compose, the more you will need. but the more elegant your dialect's lines are, the fewer you will need before you realize you're done. there's not a lot of elegance out there, and qb wasn't the least-curmudgeonly dialect ever. i think it's still better than most dialects... it's difficult, really really difficult, to make a good language. being galleon helps sometimes, but honestly -very- few things are as easy as qb.

Posted on Oct 15, 2014, 8:16 PM

Respond to this message   

Return to Index


*hey, give me this though... the locate commands seem to work :)

by dibmn (no login)

Posted on Oct 15, 2014, 8:35 PM

Respond to this message   

Return to Index


locate has options

by mn (no login)

something like locate r, c, 1 to turn the cursor on <br/>locate r, c, 0 to hide it. <br/> <br/>there was a cursorheight parameter... possibly more commas on locate

Posted on Oct 15, 2014, 3:02 AM

Respond to this message   

Return to Index


*this was supposed to go under the bowling post

by mn (no login)

Posted on Oct 15, 2014, 3:02 AM

Respond to this message   

Return to Index


But if it were up to Steve...

by Pete (no login)

LOCATE [row], [column], [cursor], [start, stop], [blink-rate], [color], [last row], [last column], [character under cursor], [car payment], [time and temperature], [eye color], [heart rate], [current episode of Scooby Doo], [local pizza delivery near you]

Anyway, I have so enjoyed the QB LOCATE [row], [column], [cursor], [start, stop] statement. In several of my apps I needed to hide, show, or change the cursor shape, and those extra parameters, past row and column, helped a ton. What I am noticing now is mobile BASIC languages lack some of the Stevieness of QB, for example, LOCATE only has row and column parameters. So, I made a substitute in all BASIC code for possible use with those.

Manipulating the cursor in a mobile device might be possible with calls to the bios. I noticed qbguy posted that for PC usage. Mobile is definitely an odd angry bird. Some mobile keyboards use chr$(127) for backspacing, instead of chr$(8). Some don't have arrow controls. Escape key? Ha!

So the previous post with the cursor code a suitable solution if a bios call won't work in my android device. Also, the anti-Steve taking statement features away from the language was a fun bonus. I will have to get to work on stripping out that nasty 3rd parameter of MID$() in QB next!

Pete

Posted on Oct 15, 2014, 7:34 AM

Respond to this message   

Return to Index


If you are going mobile, you are not gonna need the pizza delivery app

by Clippy (Login burger2227)
R

You may need the PPS (Pizza or pepperoni positioning satellite) app however.

Steve's a farmer who tries to scare people on his farm this time of year...

What's SCARY is that he gets tax deductions for it...

[linked image]

Posted on Oct 15, 2014, 8:33 AM

Respond to this message   

Return to Index


LOL, and stop giving Steve ideas! LOCATE ,,,,[keys]

by Pete (no login)

It won't get QB64 on a mobile device any faster, but at least with Steve's new parameter, you will be able to locate your car keys, using your PC, so you can drive out and get pizza!

Pete

Posted on Oct 15, 2014, 8:55 AM

Respond to this message   

Return to Index


Billy Mays here for Steve Away! Or: Let's go bowling with Pete...

by Billy Mays (Premier Login iorr5t)
Forum Owner

Like to bowl? Sure we all do, and now thanks to Steve away, you won't have just 10 pins to knock down, because we are doubling the offer and giving you 20. Know how the cursor parameters were added to QB? Most BASIC languages don't include them, and now you don't have to either. Thanks to just a few squirts of Steve Away, you can have your own cursor sub-routine in your QB programs, and never have to worry about those embarrassing cursor parameters ever again!

CLS
mystring$ = "Press Ins key to change cursor shape: "
startpos = 10
endpos = startpos + LEN(mystring$)
promptline = 5
REM Hide system cursor.
LOCATE promptline, startpos, 0, 7, 1
PRINT mystring$;

WHILE -1
  zcursor1 = TIMER
  ycsrlin = CSRLIN
  xpos = POS(0)
  WHILE -1
      b$ = INKEY$
      IF MID$(b$, 2, 1) = "R" THEN
        ins = ABS(ins) - 1
      END IF
      IF b$ <> "" AND MID$(b$, 2, 1) <> "R" THEN
        IF blinkon THEN
            PRINT replacechr$;
            LOCATE ycsrlin, xpos
        END IF
        IF b$ = CHR$(27) THEN END
        IF MID$(b$, 2, 1) = "K" OR MID$(b$, 2, 1) = "M" THEN
            IF POS(0) > startpos AND MID$(b$, 2, 1) = "K" OR POS(0) < endpos AND MID$(b$, 2, 1) = "M" THEN
              EXIT WHILE
            END IF
        ELSE
            EXIT WHILE
        END IF
      END IF
      zcursor2 = ABS(TIMER - zcursor1)
      IF zcursor2 > .4 OR MID$(b$, 2, 1) = "R" THEN
        blinkon = ABS(blinkon) - 1
        zcursor2 = 0
        zcursor1 = TIMER
        GOSUB cursordisplay
      END IF
  WEND
  SELECT CASE MID$(b$, 2, 1)
      CASE "K"
        PRINT replacechr$;
        LOCATE CSRLIN, POS(0) - 2
        blinkon = -1
        GOSUB cursordisplay
      CASE "M"
        PRINT replacechr$;
        blinkon = -1
        GOSUB cursordisplay
  END SELECT
WEND
END

cursordisplay:
ycsrlin = CSRLIN
xpos = POS(0)
IF blinkon THEN
  replacechr$ = CHR$(SCREEN(ycsrlin, xpos))
  IF ins THEN
      PRINT CHR$(177);
  ELSE
      PRINT "_";
  END IF
ELSE
  PRINT replacechr$;
END IF
LOCATE ycsrlin, xpos
RETURN

-------------------------

Pete

Posted on Oct 15, 2014, 12:20 AM

Respond to this message   

Return to Index


Cursor parameters

by qbguy (no login)

Changing the cursor shape is a BIOS call.

To change the cursor shape, Call int 10h with AH=01h, CH = Scan Row Start, CL = Scan Row End

To change the cursor position, Call int 10h with AH=02h, BH = Page Number, DH = Row, DL = Column

You can use ANSI escape codes:

Hide the cursor: 0x9B 0x3F 0x32 0x35 0x6C
Show the cursor: 0x9B 0x3F 0x32 0x35 0x68

Posted on Oct 15, 2014, 4:24 AM

Respond to this message   

Return to Index


*the kite from 2009 hides the cursor. originally it was a qb program

by mn (no login)

Posted on Oct 15, 2014, 4:36 AM

Respond to this message   

Return to Index


What happened to OBDS?

by angros47 (no login)

Do you remember Open Basic Development System (OBDS), a project by Nekrophidius for a QB-compatible compiler for windows, announced in 2003?

Has it ever been released?

Posted on Oct 14, 2014, 12:31 AM

Respond to this message   

Return to Index


Does anyone have a mirror of old QBasic.com?

by Mark (no login)

I'd like to put back up the old website (Mallard's). I once had a mirror copy of the site, but I can't find it.

I know it's been years, but I bet one of you folks has a backup, right? :)

Posted on Oct 13, 2014, 9:55 PM

Respond to this message   

Return to Index


*matt and i supplied the last copy. he's gone and i didn't keep a copy. good luck.

by anonymous (no login)

Posted on Oct 13, 2014, 10:40 PM

Respond to this message   

Return to Index


*I emailed Matt, found an old gmail address he used. Hope he still checks it.

by Mark (no login)

Posted on Oct 14, 2014, 12:18 AM

Respond to this message   

Return to Index


Have you looked on archive.org?

by angros47 (no login)

Look here:

https://web.archive.org/web/*/http://www.qbasic.com

There are many version of the site, from 1997 to today.

Posted on Oct 14, 2014, 12:27 AM

Respond to this message   

Return to Index


Fully aware of Archive.org.

by Mark (no login)

They don't back up files and often don't keep orphaned pages. I'm looking for a more complete backup.

Posted on Oct 14, 2014, 12:43 AM

Respond to this message   

Return to Index


don't say i never change my mind: i relent! (sort of)

by mn (no login)

after some soul-searching, i have decided that "not-basic" is too black and white for all these basic hybrids out there.

therefore:

freebasic-lite
qb-lite64
gambasic-lite

of course for pete's sake (that is the forum owner, not the "pete" in "for pete's sake"):

fb-bloat
qb-bloat64
gambasic-ish

but -lite is fine with me.

who cares that i'm compromising? no one... (actually this will probably annoy pete slightly. sorry pete, good intentions, road under construction, menn at work.) i care. "who cares" will be relevant when these things are put to a vote (don't see that happening.)

qb64 is still basic. i give it a year, tops. it will ALWAYS be at least qb-lite.

if the new basic is basic-lite, what's old basic?

basic-basic, i suppose.

basic is dead! long live basic-lite...

Posted on Oct 12, 2014, 9:55 AM

Respond to this message   

Return to Index


You must have been talking with that French guy, Myst again...

by Pete (no login)

BASIC is dead?

What two other accessories, besides a butter knife, does a French version off the Swiss Army Knife have?

1) A bottle opener

2) A white flag!

BASIC isn't dead, it's just homeless. It has been seen on corners of the internet, and will SLEEP in a box, DOSBox, to be precise. Once upon a time, it had a mission, but the father who ran the mission, turned into a real mother, and kicked it the SDL out of it.

Sorry, can't stay and chat, I have to go bowling.

Pete

Posted on Oct 12, 2014, 10:10 AM

Respond to this message   

Return to Index


i met a homeless college professor once

by mn (no login)

well, that's what he SAID he was, anyway.

i think you found the best metaphor yet. of course if politicians ever kept their word, there wouldn't be any homeless to compare it to. and if communities cared half as much as they claim, they would try harder to do something, rather than defend the problem.

but you know how it goes.

you know, even if you really like the french (especially their descendants) there's something about them (the pretentiousness?) that makes the jokes extra enjoy-ah-bluh. (well, that's how canadians pronounce it, anyway.)

i honestly and sincerely hope myst is having a lot of fun, whether he's coding in ada or croissant or qbasic in the windows version of dosbox (in WINE, naturellement!)

Posted on Oct 12, 2014, 10:33 AM

Respond to this message   

Return to Index


We clear keyboard buffers the old fashioned way, we POKE it.

by Smith Barney (no login)

DEF SEG = &H40 'switch to BIOS data segment
POKE &H1A, PEEK(&H1C) 'make the buffer head pointer
POKE &H1B, PEEK(&H1D) 'equal then buffer tail pointer
DEF SEG 'back to default data segment

'An alternative:
'WHILE LEN(INKEY$) : WEND
'This runs a loop while there is anything in the keyboard buffer.

Pete

Posted on Oct 11, 2014, 9:05 AM

Respond to this message   

Return to Index


i think the inkey$ one is more basic...

by mn (no login)

but what on earth are you poking to? is that in an emulator? is it 32bit or something?

Posted on Oct 11, 2014, 9:59 AM

Respond to this message   

Return to Index


Re: i think the inkey$ one is more basic...

by Pete (no login)

PEEK/POKE worked in 98 and before. I can't remember i we lost these in XP or Vista.

Pete

Posted on Oct 11, 2014, 11:43 AM

Respond to this message   

Return to Index


* That will not clear the _KEYHIT buffer

by Luke (Login flukiluke)
R

Posted on Oct 11, 2014, 6:22 PM

Respond to this message   

Return to Index


No, but _KEYHIT is a pain, anyway.

by Pete (no login)

I converted my keyboard input routine to it, and the mapping was a pain. 2128 or delete instead o CHR$(0) + "S". No thanks. It was actually easier to do the same thing with INKEY$ and PEEK/POKE statements to use shift with arrow keys to highlight text, etc. My old routine still works on modern operating systems. The best improvement was the name change from _HITKEY although that one was a little more apropos in my opinion. Again, it would have been nicer to just increase the ability of the INKEY$ statement, using the same or very similar parameter structure.

Pete

Posted on Oct 12, 2014, 3:44 AM

Respond to this message   

Return to Index


i can see how chr$(0) might have been a problem

by mn (no login)

oh come on, how was i supposed to resist that??

Posted on Oct 12, 2014, 5:53 AM

Respond to this message   

Return to Index


You're right, even if you don't know it

by Luke (no login)

You can't use a function in a CONST, which means you can't do CONST KEY_UP = CHR$(0) + "H" (Or whatever letter up is, I can never remember). However, it's trivial to assign _KEYHIT's numeric values; having the appropriate CONST declarations let you write something like SELECT CASE _KEYHIT: CASE KEY_UP: CASE KEY_DOWN: CASE KEY_DELETE: END SELECT which is far more readable than any other alternative I reckon.

Posted on Oct 12, 2014, 7:48 AM

Respond to this message   

Return to Index


i'm in good company then; when i'm right, a lot of people don't know it

by mn (no login)

i like the example.

Posted on Oct 12, 2014, 7:54 AM

Respond to this message   

Return to Index


Actually the _KEYHIT value IS the SAME: CVI(CHR$(0) + "S") = 21248

by Clippy (Login burger2227)
R

He just put the string value in CVI to get it.

th_pretty-little-dutch-clip.jpg

Posted on Oct 12, 2014, 9:16 AM

Respond to this message   

Return to Index


*touche

by mn (no login)

Posted on Oct 12, 2014, 9:39 AM

Respond to this message   

Return to Index


67 is for Clippy, that's not good enough for me...

by Pete (no login)

67;108;105;112;112;121

or

Clippy

Which one looks more BASIC?

-----------

Pete

Posted on Oct 12, 2014, 9:56 AM

Respond to this message   

Return to Index


please don't compare basic to clippy

by mn (no login)

i was going to explain why, and then i realized how much it stands on its own.

feel free to compare basic-lite to clippy, but not basic-basic or more-basic. not telling you what to do; just asking, for the love of mercy.

Posted on Oct 12, 2014, 9:59 AM

Respond to this message   

Return to Index


Sorry, I need to replace his off-topic pics again...

by Pete (Premier Login iorr5t)
Forum Owner

I'll replace them with his avatar, instead...

[linked image]

Posted on Oct 12, 2014, 10:21 AM

Respond to this message   

Return to Index


*i need to borrow some of thebob's coffee so i can almost spit it out

by mn (no login)

Posted on Oct 12, 2014, 10:37 AM

Respond to this message   

Return to Index


remember when qb64 was about putting an end to pissing matches, instead of starting them?

by mn (no login)

remember when fb was for trouser-copter-in-your-face, and qb was just for fun?

those were the days.

Posted on Oct 9, 2014, 9:36 PM

Respond to this message   

Return to Index


but where's the data on that?

by STxAxTIC (no login)

I have yet to see Steve or anyone else take on a giant endeavor that causes an avalanche of bugs and holes in QB64. These guys are in the business of making surgical, concise, and more importantly, *small* improvements in the language.

Sure, I'm a little less happy about adding one new keyword per week, or per month (do the math on that), but I'm willing to overlook the downsides of that, if there even are any. Plus, none of the extra junk ends up in your EXE at the end of the day, right? A pure form of QB is still back there somewhere. Just ignore what you don't want.

Sorry, the "just ignore what you don't want" is just about the *best* argument you can get from me, besides the obvious thing.

... And the obvious thing is:

QB is a prototyping language. I have never used QB64 (although I have used FB) to do science-grade work. Want a REAL program? Gotta do it in a man's language. C-family languages will outlive all of us. By definition, C will outlive QB64.

Get embrace something like C++ if the philosophical troubles about QB64 are STILL bothering you. It's the only way I was really able to make peace with the whole thing myself.

Posted on Oct 10, 2014, 6:18 AM

Respond to this message   

Return to Index


two part reply

by mn (no login)

A man is flying in a hot air balloon and realizes he is lost.

He reduces height and spots a man down below. He lowers the balloon further and shouts: "Excuse me, can you help me? I promised my friend I would meet him half an hour ago, but I don't know where I am."

The man below says: "Yes. You are in a hot air balloon, hovering approximately 30 feet above this field. You are between 40 and 42 degrees N. latitude, and between 58 and 60 degrees W. longitude."

"You must be an engineer," says the balloonist.

"I am," replies the man. "How did you know?"

"Well," says the balloonist, "everything you have told me is technically correct, but I have no idea what to make of your information, and the fact is I am still lost.

...so there you have it. what you're talking about has absolutely nothing to do with what you're replying to.

there's a second part of the joke, so i'll just say it's fine, it's NOT your fault (read the rest of the joke) but still, there's not much for me to work with here. respectfully, i don't want to go in circles with this more than we have already.

and if that's not good enough, look-- this is subforum stuff. i mean, this is regarding stuff on the subforums.

regardless, "pissing match" isn't a technical issue. it's a community issue. if you really want this explained, pete has explained it a number of times (i've also tried. pardon me if i don't try again at this time.)

Posted on Oct 10, 2014, 9:42 AM

Respond to this message   

Return to Index


*balloon analogy flew over my head, no pun.

by STxAxTIC (no login)

Posted on Oct 10, 2014, 9:09 PM

Respond to this message   

Return to Index


now i understand why clippy has to use pictures

by mn (no login)

>>> "Well," says the balloonist, "everything you have told me is technically correct, but I have no idea what to make of your information, and the fact is I am still lost.

>>> ...so there you have it. what you're talking about has absolutely nothing to do with what you're replying to.

i post about a community issue, you ask me about a technical specifications.

i look forward to a day when people don't need it explained that there is more to a project than technical specs. i blame open source for this, they're reductionists who operate under the militant ideal that the only ideal is code. well, uh, no.

but i see no point in getting into that, until i find a giant photo or animated gif to explain it. sheesh.

Posted on Oct 11, 2014, 12:29 AM

Respond to this message   

Return to Index


*yes, a picture of your data please.

by STxAxTIC (no login)

Posted on Oct 11, 2014, 6:05 AM

Respond to this message   

Return to Index


*get help

by mn (no login)

Posted on Oct 11, 2014, 6:29 AM

Respond to this message   

Return to Index


i hAve LocAtEd tHe daTa aT tHe foLlowinG cOorDinaTes (URL 7752:8102)

by futurebot2000 (no login)

http://www.network54.com/Forum/190885/message/1413036429/where+is+the+data-

END OF LINE.

Posted on Oct 11, 2014, 7:12 AM

Respond to this message   

Return to Index


* you win, im switching to Java.

by STxAxTIC (no login)

Posted on Oct 11, 2014, 8:20 AM

Respond to this message   

Return to Index


*and am I cross-eyed, or did you edit the orig. subject?

by STxAxTIC (no login)

Posted on Oct 11, 2014, 8:23 AM

Respond to this message   

Return to Index


*not me. no idea, honestly

by mn (no login)

Posted on Oct 11, 2014, 8:29 AM

Respond to this message   

Return to Index


you are cross-eyed. i know of no way to stealth-edit posts, unless someone has db access

by mn (no login)

it looks alright to me, i don't think it's important enough to make a conspiracy theory. (n54 is very hands off; sometimes i picture them on an island somewhere talking to someone on the phone: "you mean we still have a website?" at least, unlike google, they own a phone.)

but when posts are edited they say who by at the bottom of the post, and when the most recent edit is. even pete's, i believe.

Posted on Oct 11, 2014, 9:18 AM

Respond to this message   

Return to Index


you won't believe it, but i have a qb related question

by mn (no login)

other than the help system in qb45, where can i get a full list of qbasic (OR qb45) commands? (preferably online) ...i even looked in the faq.

Posted on Oct 8, 2014, 10:40 PM

Respond to this message   

Return to Index


it took some looking. on the second round, i found a great list (url)

by mn (no login)

http://gamma.zem.fi/~fis/qb.html#QEw4MGI2

it looks like it's copied from the help system, though i haven't looked too closely

Posted on Oct 8, 2014, 10:46 PM

Respond to this message   

Return to Index


Nice find!

by Pete (no login)

It looks like help or help from The Revolutionary Guide to QBasic.

:)

Posted on Oct 8, 2014, 11:18 PM

Respond to this message   

Return to Index


btw, what do you think of the linux subforum proposal?

by mn (no login)

gonna give michael a few more days to reply, i guess.

Posted on Oct 9, 2014, 5:53 AM

Respond to this message   

Return to Index


Here's a better, more detailed one

by Clippy (Login burger2227)
R

http://www.qb64.net/wiki/index.php/Keyword_Reference_-_Alphabetical

[Img removed. Go plug your camera someplace else!]

Posted on Oct 9, 2014, 7:18 AM

Respond to this message   

Return to Index


*good list, i didn't notice anything of note missing

by mn (no login)

Posted on Oct 9, 2014, 11:23 AM

Respond to this message   

Return to Index

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement