QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: odin on January 19, 2020, 11:18:54 am

Title: QB64 v1.4 Release Candidate up for testing
Post by: odin on January 19, 2020, 11:18:54 am
First things first, we have moved development to a new GitHub repository. Follow us at https://github.com/QB64Team/qb64 (https://github.com/QB64Team/qb64).

Although we don't follow a strict schedule regarding updates to QB64, every once in a while a feature that's been requested gets implemented or a new bug is found and then fixed, and eventually we have enough for a new release.

We have named the upcoming release QB64 v1.4, and it's already available in the development channel (accessible at http://www.qb64.org/devbuilds.php (http://www.qb64.org/devbuilds.php)). Although you can follow development by checking out our repository on GitHub (https://github.com/QB64Team/qb64/commits/development (https://github.com/QB64Team/qb64/commits/development)), the time for us to compile a more concise changelog has finally come.

One big change worth mentioning first, since it affects QB64 code from now on in a big way, is the new $NOPREFIX (http://www.qb64.org/wiki/$NOPREFIX) metacommand.

QB64-specific keywords, those that expand on the original set of keywords from QBasic/QuickBASIC 4.5, which we aim to replicate, are those that start with an underscore. It has been designed that way so that, in the event that you want to load an older program you wrote back in the day that had variables or procedures with identical names, they would not collide with the new keywords, making it possible to use QB64 entirely as you did with QBasic but also add the new functionality without breaking anything.

However, we have over the years been following our userbase create more and more programs that have no dependency whatsoever on older code, which means these aren't just QBasic programs with benefits, but actually QB64-native programs, written from scratch with QB64 in mind.

All that said, the new $NOPREFIX metacommand allows you, for the first time ever, to write QB64 programs without having to add the leading underscore to use the modern keywords.

That will allow code like this:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. COLOR _RGB32(255), _RGB32(255, 0, 255)
  3. m$ = "Hello, world!"
  4.  
  5.     _DISPLAY
  6.     _LIMIT 30
To be written as:

Code: QB64: [Select]
  1. SCREEN NEWIMAGE(800, 600, 32)
  2. COLOR RGB32(255), RGB32(255, 0, 255)
  3. m$ = "Hello, world!"
  4. PRINTSTRING ((WIDTH - PRINTWIDTH(m$)) \ 2, (HEIGHT - FONTHEIGHT) \ 2), m$
  5.  
  6.     DISPLAY
  7.     LIMIT 30
  8. LOOP UNTIL KEYHIT
With the new metacommand in use, a program can both use _DISPLAY and DISPLAY, for example. User variables and procedures still cannot start with a single underscore (double underscores are accepted).

Here's the complete changelog, for now. We invite you to try the development build and help us test (and try to break) the new features, so that we can polish everything for release as soon as possible:

https://www.qb64.org/portal/changelog-of-v1-4/ (https://www.qb64.org/portal/changelog-of-v1-4/)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 02:18:19 pm
Example of _DEFLATE$ and _INFLATE$ to compress/decompress a string:

Code: QB64: [Select]
  1.  
  2. a$ = "The quick brown fox jumps over the lazy dog. "
  3. PRINT "Original string (a$): ";
  4. COLOR 15: PRINT a$: COLOR 7
  5. FOR i = 1 TO 15
  6.     a$ = a$ + a$
  7.  
  8. PRINT "After concatenating it into itself several times, LEN(a$) =";
  9. COLOR 12: PRINT LEN(a$): COLOR 7
  10.  
  11. PRINT "Hit any key..."
  12. i$ = INPUT$(1)
  13.  
  14. b$ = _DEFLATE$(a$)
  15. PRINT "After using _DEFLATE$ to compress it, LEN =";
  16. COLOR 10: PRINT LEN(b$): COLOR 7
  17.  
  18. PRINT "Hit any key..."
  19. i$ = INPUT$(1)
  20.  
  21. c$ = _INFLATE$(b$)
  22. PRINT "After using _INFLATE$ to decompress it, LEN =";
  23. COLOR 12: PRINT LEN(c$): COLOR 7
  24.  
  25. PRINT "Hit any key to display the decompressed string..."
  26. i$ = INPUT$(1)
  27.  
  28.  
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 02:37:12 pm
The $ASSERTS metacommand enables the _ASSERT macro, which can be used to perform tests in code that's in development, for debugging purposes. After the code is considered error-free, you can disable error checking by removing the $ASSERTS metacommand from the top of your program, and then all tests will be ignored.

IF $ASSERTS:CONSOLE is used instead, an optional error message is output to the console window, to help with debugging.

When the condition specified in the _ASSERTS statement isn't met, execution is interrupted and an error message with "_ASSERT failed on line #" is displayed.

Sample usage:

Code: QB64: [Select]
  1. $ASSERTS:CONSOLE
  2.  
  3.     a = INT(RND * 10)
  4.     b$ = myFunc$(a)
  5.     PRINT a, , b$
  6.     _LIMIT 3
  7.  
  8. FUNCTION myFunc$ (value AS SINGLE)
  9.     _ASSERT value > 0, "Value cannot be zero"
  10.     _ASSERT value <= 10, "Value cannot exceed 10"
  11.  
  12.     IF value > 1 THEN plural$ = "s"
  13.     myFunc$ = STRING$(value, "*") + STR$(value) + " star" + plural$ + " :-)"
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 02:52:35 pm
_PUTIMAGE would generate an error if the source and destination images were the same. In the upcoming version, QB64 generates a copy of the source image in memory first, so that source and destination can be the same in a copy operation.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 250, 32)
  2.  
  3. FOR i = 1 TO 100
  4.     CIRCLE (250, 125), i, _RGB32(RND * 255, RND * 255, RND * 255)
  5.  
  6. _PRINTSTRING (500, 0), "Press a key to copy that circle..."
  7. a$ = INPUT$(1)
  8.  
  9. _PUTIMAGE (500, 0), , , (0, 0)-(500, 250)
  10.  
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 03:00:13 pm
$COLOR:0 or $COLOR:32 add named color constants to your programs:

Code: QB64: [Select]
  1. COLOR BrightWhite, Red
  2. PRINT "Bright white on red."
  3.  

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 400, 32)
  2. COLOR CrayolaGold, DarkCyan
  3. PRINT "CrayolaGold on DarkCyan."
  4.  

Color references: color0.bi (https://github.com/QB64Team/qb64/blob/development/source/utilities/color0.bi) and color32.bi (https://github.com/QB64Team/qb64/blob/development/source/utilities/color32.bi)

These are not compatible with $NOPREFIX, as there are QB64 functions with color names (_RED, _GREEN, _BLUE), so the metacommands have exclusive usage over each other.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 03:13:57 pm
Steve demoed the new $CONSOLE functionality for Windows:
Code: QB64: [Select]
  1.  
  2. PRINT "Welcome to a demostration of the Windows Console System for QB64,"
  3. PRINT "as overhauled by Steve!"
  4. PRINT "First, allow me to illustrate two newly implemented commands: SLEEP and CLS"
  5. Pause
  6. PRINT "And now, I'll illustrate how to change colors in the console:"
  7. FOR i = 0 TO 15
  8.     COLOR i, 15 - i
  9.     PRINT "COLORS:"; i; "ON"; 15 - i
  10. Pause
  11. PRINT "And now, we're going to have fun with the console size."
  12. PRINT "Our original screen should be set at 80x25 for default."
  13. PRINT "Press <ANY KEY> when ready to change modes."
  14. Pause
  15. WIDTH 120, 50
  16. PRINT "Here we're set at 120x50."
  17. Pause
  18. WIDTH 120, 50, 120, 50
  19. PRINT "And here we no longer have a scroll buffer; it's also 120x50."
  20. PRINT "Notice the vertical scroll bar is gone?"
  21. Pause
  22. WIDTH 100, 33, 300, 150
  23. PRINT "And here we now have both a vertical and a hortizontal scroll bar."
  24. FOR i = 1 TO 50
  25.     PRINT "See? ";
  26.     _LIMIT 10
  27. PRINT "Be certain to scroll the bar so you can 'See' all the text."
  28. Pause
  29. PRINT "And, of course, I can now work with LOCATE..."
  30. LOCATE 10, 10: PRINT "LOCATE 10,10"
  31. LOCATE 20: PRINT "LOCATE 20"
  32. LOCATE , 20: PRINT "LOCATE ,20"
  33. Pause
  34. PRINT "And, of course, I can now get back single character returns..."
  35. PRINT "Press any key, and I'll give you the scan code for it.  <ESC> quits the demo."
  36.     x = _CONSOLEINPUT
  37.     IF x = 1 THEN 'don't update for mouse input
  38.         c = _CINP
  39.         PRINT c;
  40.     END IF
  41. LOOP UNTIL c = 1
  42.  
  43. SUB Pause
  44.     PRINT
  45.     PRINT "Press <ANY KEY> to continue."
  46.     SLEEP
  47.  
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 03:24:09 pm
Use _NUMLOCK, _CAPSLOCK and _SCROLLLOCK to read these keys' states.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 300, 32)
  2.  
  3. PRINT "Try toggling your caps, num and scroll lock keys..."
  4. PRINT "ESC to quit"
  5.  
  6.         LINE (10, 150)-STEP(80, 50), _RGB32(255), B
  7.         LINE (20, 160)-STEP(5, 5), _RGB32(255, 200, 0), BF
  8.     ELSE
  9.         LINE (10, 150)-STEP(80, 50), _RGB32(120), B
  10.         LINE (20, 160)-STEP(5, 5), _RGB32(120), BF
  11.     END IF
  12.  
  13.         LINE (600, 10)-STEP(50, 50), _RGB32(255), B
  14.         LINE (610, 20)-STEP(5, 5), _RGB32(255, 200, 0), BF
  15.     ELSE
  16.         LINE (600, 10)-STEP(50, 50), _RGB32(120), B
  17.         LINE (610, 20)-STEP(5, 5), _RGB32(120), BF
  18.     END IF
  19.  
  20.         LINE (700, 60)-STEP(50, 50), _RGB32(255), B
  21.         LINE (710, 70)-STEP(5, 5), _RGB32(255, 200, 0), BF
  22.     ELSE
  23.         LINE (700, 60)-STEP(50, 50), _RGB32(120), B
  24.         LINE (710, 70)-STEP(5, 5), _RGB32(120), BF
  25.     END IF
  26.  
  27.     _DISPLAY
  28.     _LIMIT 30

You can use _CAPSLOCK ON/OFF/_TOGGLE, _NUMLOCK ON/OFF/_TOGGLE or _SCROLLLOCK ON/OFF/_TOGGLE, although it is advisable to avoid changing these keys' states without your users' request.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 03:45:07 pm
BIT functions and examples provided by Cobalt:

_TOGGLEBIT:
Code: QB64: [Select]
  1. A~%% = 0 '_UNSIGNED _BYTE
  2. PRINT A~%%
  3. A~%% = _TOGGLEBIT(A~%%,4) 'toggle the fourth bit of A~%%
  4. PRINT A~%%
  5. A~%% = _TOGGLEBIT(A~%%,4) 'toggle the fourth bit of A~%%
  6. PRINT A~%%

_RESETBIT:
Code: QB64: [Select]
  1. A~%% = 0 '_UNSIGNED _BYTE
  2. PRINT A~%%
  3. A~%% = _SETBIT(A~%%,6) 'set the seventh bit of A~%%
  4. PRINT A~%%
  5. A~%% = _RESETBIT(A~%%,6) 'Reset the seventh bit of A~%%
  6. PRINT A~%%

_READBIT:
Code: QB64: [Select]
  1. A~%% = _SETBIT(A~%%,4)
  2. PRINT "Bit 4 is currently ";
  3. IF _READBIT(A~%%,4) = -1 THEN PRINT "ON" ELSE PRINT "OFF"
  4. PRINT "And bit 2 is currently ";
  5. IF _READBIT(A~%%,2) = -1 THEN PRINT "ON" ELSE PRINT "OFF"

_SETBIT:
Code: QB64: [Select]
  1. A~%% = 0 '_UNSIGNED _BYTE
  2. PRINT A~%%
  3. A~%% = _SETBIT(A~%%,6) 'set the seventh bit of A~%%
  4. PRINT A~%%
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SierraKen on January 19, 2020, 06:26:05 pm
Thank you! I just put all the files on top of v. 1.3 and just to check it it works fine so far with the $NOPREFIX which is the first thing I checked. But I clicked Help and About and it still says v. 1.3. I wonder if it's because I overlapped the older files? I did it this way so I won't have to try and move all the programs I've made.
Also, for some reason it won't let me click About more than once when the window is maximized. I have to minimize it first to click it again. This is the 64 bit Windows version.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: bplus on January 19, 2020, 06:37:06 pm
Thank you! I just put all the files on top of v. 1.3 and just to check it it works fine so far with the $NOPREFIX which is the first thing I checked. But I clicked Help and About and it still says v. 1.3. I wonder if it's because I overlapped the older files? I did it this way so I won't have to try and move all the programs I've made.
Also, for some reason it won't let me click About more than once when the window is maximized. I have to minimize it first to click it again. This is the 64 bit Windows version.

Yeah I have v 1.3 too and files not overlapped so I guess they haven't changed version number.

I notice and not just with this version when the window is maximized the screen is half a line off and all mouse clicks have to be done on the top half of every line.

Let me guess in full screen mode you have a black crack along the top like this:
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 19, 2020, 06:59:56 pm
Yeah, version number hadn't been updated yet, only functionality. I just changed it on the server now.

Although you guys got lucky, it's never a good idea to unpack a new version of QB64 on top of an older one, keep that in mind if things go awry at some point. Since you guys are willing to help us test it, unpacking it to a clean folder is highly recommended, as we won't know if any issue that may arise only happened because of old files getting in the way.

About not being able to click the menu bar, it is indeed an old render issue that's in OpenGL's hands; it occurs with the IDE because it runs in text mode (SCREEN 0) and when the Window size isn't a multiple of 16 you'll get the black bars. I advise not using the maximize button if your screen resolution gives you that type of issue. Just stretch the window manually to fill the screen and it should resize properly.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SierraKen on January 19, 2020, 11:56:28 pm
Thanks B+ and Felippe. Oh well, if something bad happens I'll put the old version back where it was. lol
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Qwerkey on January 20, 2020, 05:20:28 am
By the time that all the skilled guys have beta-tested the latest version, you may be able to fully release on Feb 14th - the 14 and v1.4 correspond.  So why not (in the manner of the Ghastly Product Names dept. of Microsoft) name the new version QB64 Valentine?
I only say this because it happens to be my birthday, so please arrange delivery of suitably romantic gifts.  I thank you!

Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: RhoSigma on January 22, 2020, 03:47:59 am
Question for the IDE-Gurus,

would it be easily possible to add at least the proper indention to code which uses line continuation?
I understand it's tricky to properly format all the tokens, as there may also user intended formatting to align lines. What I mean is just to add the proper indention (according to the current block scope) in front of each line, but leave the rest of the lines as is, hence make this
Code: QB64: [Select]
  1. a$="Hello "+_
  2.    "World "+_
  3.    "!!"
  4.  

into this
Code: QB64: [Select]
  1.     a$="Hello "+_
  2.        "World "+_
  3.        "!!"
  4.  

it would already be a great enhencement for readability of those multiline statements, as they no longer completely disrupt the block formatting.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 22, 2020, 05:54:48 am
I'll have a look into it, no promises for 1.4 though.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: OldMoses on January 23, 2020, 03:42:50 pm
Downloaded, installed and ran my main project on it. Any other enhancements in this one? It seemed to handle a 3D graphic rotation routine smoother than 1.3 did.

Looking forward to $NOPREFIX, that's always been a bit of a pain.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 23, 2020, 04:11:55 pm
Downloaded, installed and ran my main project on it. Any other enhancements in this one? It seemed to handle a 3D graphic rotation routine smoother than 1.3 did.

Looking forward to $NOPREFIX, that's always been a bit of a pain.

Glad you're helping us test it out, OldMoses. Please report back if you find anything out of place.

I don't think we have touched the graphics system tho. You may have been too hopeful :-)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 23, 2020, 04:30:17 pm
Our wiki has already been updated with the upcoming statements and functions, and the first post in this thread has also been updated with links to the new articles: https://www.qb64.org/forum/index.php?topic=2103.msg113347#msg113347
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on January 23, 2020, 04:47:31 pm
Question: http://www.qb64.org/wiki/INFLATE$

Has _INFLATE$ been altered to no longer accept the optional size parameter, or is the wiki just missing it?  Originally it allowed for an optional parameter to save extracting over and over in a DO...LOOP until the proper size is allocated to hold and return the decompressed data.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 23, 2020, 04:56:58 pm
Nothing changed, I just didn't add it because I didn't understand it. Care to elaborate? 😁
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on January 23, 2020, 05:53:59 pm
Nothing changed, I just didn't add it because I didn't understand it. Care to elaborate? 😁

Zlib doesn’t track the original size of our file, nor our compression ratio for us.  It simply takes the string of our data which we give it and then crunches it down into a compressed form.  So lets say we start with a file of 1000 bytes in size.  If it’s text, it might compress down to 40 bytes...

When we send that 40 bytes back to zlib to decompress, zlib has do idea of how compressed it is, or how much memory it needs to uncompress it.  Unless we tell it the size of memory it needs to reserve, it runs a trial-and-error decompression method for us.

PASS 1; Reserve 100 bytes...  Attempt decompress...  FAIL, not enough memory to fully decompess.
PASS 2; Reserve 200 bytes... Attempt decomress... FAIL.
PASS N; Reserve 10000 bytes...  Attempt decompress...  SUCCESS!  Return the 1000 bytes of the original, free the temp memory.

That optional parameter lets us bypass that trail and error by telling it the exact size it needs to reserve to return our uncompressed data back to us.

PASS 1: Reserve 1000 bytes of memory.  Decompress...  SUCCESS... Return 1000 bytes.

(Of course the values aren’t set in 100s of bytes, but instead are much larger by default internally, but it highlights the process.)

For people who are worried about efficiency and minimal memory use, they’re much better served if they use the optional parameter to manually set the return size — especially if dealing with large files which may need multiple attempts at resizing to reserve the right amount of memory for the full decompression.

Use would be similar to:

Text$  = “Whatever we want to compress.... lots more junk”
OriginalSize = LEN(text$)
Compressed$ = _DEFLATE$(text$)
... other program stuff you want to do...
Decompressed$ = _INFLATE$(Compressed$, OriginalSize)

The above tells Zlib the exact amount of memory it needs to reserve the data we send it...  Without that optional parameter, it just makes a guess at what’s needed, and then guesses bigger and bigger, until it either succeeds or runs out of memory and finally pops an error.



Inflate without size is for quick and easy coding.  Inflate with size is for efficient, quicker programs.  If I just wanted a demo for the forums, I probably wouldn’t worry about that parameter (or if I knew my extracted file sizes were small).  If I was concerned about FPS, for video ot a game, then I’d store those values and be certain to use them with the command.



EDIT to expand:

And for those curious, I just checked our source to get default size: _INFLATE reserves 10MB by default as a memory buffer to extract to, and increases the buffer by 10MB per pass until it’s large enough to hold your uncompressed data. 
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 23, 2020, 06:23:05 pm
All clear now. Please check it: http://www.qb64.org/wiki/INFLATE$ (http://www.qb64.org/wiki/INFLATE$)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on January 23, 2020, 06:26:55 pm
All clear now. Please check it: http://www.qb64.org/wiki/INFLATE$ (http://www.qb64.org/wiki/INFLATE$)

Looks good.  👍
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: OldMoses on January 23, 2020, 07:51:02 pm
An initial observation, which seems a relatively minor glitch. The line number display (on left edge) of 1.3 has the line highlight color which remains solid when scrolling with the mouse wheel, while 1.4 blinks/flashes between highlight color and background when scrolling in 1.4.

Edit: scratch that...now it's behaving alright. Not sure what caused that the first time. Maybe it's just me doing something weird.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 23, 2020, 07:53:05 pm
Is that with $NOPREFIX on?
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: OldMoses on January 23, 2020, 07:54:47 pm
Is that with $NOPREFIX on?

Yes, both times.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 23, 2020, 08:01:17 pm
If it's good now, then it's good 😁
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Pete on January 23, 2020, 08:15:20 pm
All clear now. Please check it: http://www.qb64.org/wiki/INFLATE$ (http://www.qb64.org/wiki/INFLATE$)

Guys, is this mainly for shrinking text size before storing it in a file?

Pete
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 23, 2020, 08:26:29 pm
You can compress binary data too.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on January 23, 2020, 09:49:00 pm
Guys, is this mainly for shrinking text size before storing it in a file?

Pete

Compressing any data. After all, this is how PNG format files compress the data inside them.  ;)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Pete on January 23, 2020, 10:07:21 pm
...Would make for a nice QB64 photo viewer.

Thanks guys,

Pete
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: doppler on January 23, 2020, 10:10:23 pm
Just a thought.  Inflating/compression is all fine and dandy.  Is there someway to encrypt the data too?  Encrypt/decrypt pairing with inflate/compression to secure data being written.  PGP would be a good candidate.  I have not used it in a long time.  I think there is a DLL that can be exploited to handle all the niceties.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: OldMoses on January 25, 2020, 09:45:24 am
So far so good. I've removed all underscores from my present project with no issues.

I really like the bit operators. They allowed me to eliminate a bunch of wasteful DIM SHARED bytes that I've been using as true/false display toggles, and put all toggles into a single DIM SHARED unsigned integer and just flip, set, reset and read the bits of that integer variable. It eliminated 9 additional toggle definitions and still allowed 6 more bit slots for future expansion. If I need more than that, I can just go to a long. Easy Peasy and helps clean up the main module some.

I could then set an initial state (for example from my project):
togs = &B0000000110001101

...and go from there. It took me a couple tries to figure out the little endian/big endian scheme of it, which was probably why trying the bitwise math operations were not working well for me. I really must learn to read from right to left better. This has been a cool addition for a slow learner like me, and works well in my application.

and just a parting thought for version 1.5...

Would it be feasible to do something like a multiple bit setter that handles the endian issue? Calling it _MULTIBIT or _XBITS or some such...

e.g.  result = _MULTIBIT(numericalVariable, bit0 thru bit{n})

which would, for the preceding example, be something like:

togs = _MULTIBIT(togs, 101100011) ' then leave any excess bits as reset

don't know if that would be useful enough to bother with, just a thought from a really lazy coder... ;)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Richard Frost on January 25, 2020, 05:40:08 pm
I like to blink the leds!  However, this doesn't blink the status lights.  I did download 1.4 and installed
it to a fresh folder.  Says it's 1.4 under Help too.   Using _TOGGLE instead of ON or OFF didn't work either.

I'm using Windows XP on a 64 bit machine, with 32 bit versions of QB64. 

Code: QB64: [Select]
  1. oldcap%% = _CAPSLOCK '                      save current state for restoration on exit
  2. oldnum%% = _NUMLOCK
  3. oldscroll%% = _SCROLLLOCK
  4.  
  5. _CAPSLOCK OFF '                             turn all off
  6.  
  7. _SCREENHIDE '                               nothing to see here people, move along!
  8.  
  9. DO: _LIMIT 10 '                             blink each led
  10.     FOR i = 1 TO 3
  11.         SELECT CASE i
  12.             CASE i = 1: _CAPSLOCK _on
  13.             CASE i = 2: _NUMLOCK ON
  14.             CASE i = 3: _SCROLLLOCK ON
  15.         END SELECT
  16.         _DELAY .1
  17.         SELECT CASE i
  18.             CASE i = 1: _CAPSLOCK OFF
  19.             CASE i = 2: _NUMLOCK OFF
  20.             CASE i = 3: _SCROLLLOCK OFF
  21.         END SELECT
  22.     NEXT i
  23. LOOP UNTIL LEN(INKEY$) '                    key pressed, done
  24.  
  25. IF oldcap%% THEN _CAPSLOCK ON ELSE _CAPSLOCK OFF '          restore entry settings
  26.  
  27.  
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: OldMoses on January 25, 2020, 06:33:15 pm
I like to blink the leds!  However, this doesn't blink the status lights.  I did download 1.4 and installed
it to a fresh folder.  Says it's 1.4 under Help too.   Using _TOGGLE instead of ON or OFF didn't work either.

I'm using Windows XP on a 64 bit machine, with 32 bit versions of QB64. 

I couldn't get it to work until I made the changes to the CASE statements, then the lights blinked just fine.

Now for the funny part.... I couldn't get the INKEY stop to work unless I maximized the "output" screen, which was all white. However, when I did that, the IDE behind it started doing the funny left margin blinking that I posted about earlier.

Code: QB64: [Select]
  1. oldcap%% = _CAPSLOCK '                      save current state for restoration on exit
  2. oldnum%% = _NUMLOCK
  3. oldscroll%% = _SCROLLLOCK
  4.  
  5. _CAPSLOCK OFF '                             turn all off
  6.  
  7. _SCREENHIDE '                               nothing to see here people, move along!
  8.  
  9. DO: _LIMIT 10 '                             blink each led
  10.     FOR i = 1 TO 3
  11.         SELECT CASE i
  12.             CASE IS = 1: _CAPSLOCK ON
  13.             CASE IS = 2: _NUMLOCK ON
  14.             CASE IS = 3: _SCROLLLOCK ON
  15.         END SELECT
  16.         _DELAY .1
  17.         SELECT CASE i
  18.             CASE IS = 1: _CAPSLOCK OFF
  19.             CASE IS = 2: _NUMLOCK OFF
  20.             CASE IS = 3: _SCROLLLOCK OFF
  21.         END SELECT
  22.     NEXT i
  23. LOOP UNTIL LEN(INKEY$) '                    key pressed, done
  24.  
  25. IF oldcap%% THEN _CAPSLOCK ON ELSE _CAPSLOCK OFF '          restore entry settings
  26.  

EDIT: When running Richard's code, I can pretty reliably get the number line margin to flash apparently randomly. I then maximize the screen from his code and hit a key to stop it. After which, I don't touch any mouse button, but rather roll the mouse wheel and the margin will flash while doing so. If I click on a line to set a highlight, the flashing stops.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: euklides on January 26, 2020, 05:08:41 am
_Deflate$ et _inflate$ work fine !!!

Il took a text from a long batch file (text from a ebook, 3823 lines) et wrote this little program:
'reading
OPEN "c:\temp\myfile.txt" FOR INPUT AS 1: WHILE NOT EOF(1): LINE INPUT #1, a$
TX$ = TX$ + a$ + CHR$(13) + CHR$(10): WEND: CLOSE
PRINT "Len of tx$ is " + STR$(LEN(TX$)) 'here I had 812804

'deflating
TXD$ = _DEFLATE$(TX$)
PRINT "Len of TXD$ is " + STR$(LEN(TXD$)) 'here I had 309067

'puting the deflated text in a binary
OPEN "c:\temp\TEST.BIN" FOR BINARY AS #1
PUT #1, , TXD$: CLOSE 1

'reading the deflated text
OPEN "c:\temp\TEST.BIN" FOR BINARY AS #1
TXE$ = SPACE$(LOF(1)):GET #1, , TXE$: CLOSE #1
'inflating
TX1$ = _INFLATE$(TXE$)
'testing
IF TX1$ = TX$ THEN PRINT "ok" ELSE PRINT " error"  'YES: ok !!!

SLEEP

'and of course you can create a clone of your batch file
CLOSE: OPEN"C:\temp\myfile_COPY.txt" FOR OUTPUT AS 1
PRINT #1, TX1$: CLOSE 1



Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: euklides on January 26, 2020, 06:56:46 am
$COLOR:0
COLOR BrightWhite, Red
PRINT "Bright white on red."

Where can I found the list of the constants colors, like here "Red" ou "Brightwhite" ?
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on January 26, 2020, 07:30:26 am
$COLOR:0
COLOR BrightWhite, Red
PRINT "Bright white on red."

Where can I found the list of the constants colors, like here "Red" ou "Brightwhite" ?

From the wiki:
$COLOR:0 adds constants for colors 0-15. The actual constant names can be found in the file source/utilities/color0.bi.
$COLOR:32 adds constants for 32-bit colors, similar to HTML color names. The actual constant names can be found in the file source/utilities/color32.bi.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: euklides on January 26, 2020, 10:10:03 am
Thank's for colors answer...


Encrypting deflated text (just an idea) (Doppler suggestion)


Imagine you have a deflated text with a length  of 1,000,000 characters.

You split the deflated text in this way: (for instance here in four blocks, but it can be more..)

block A  from 1 au 125000     
block B frorm 125001 to 256777
block C from 256778 to  514435
block D from 514436 to 1000000

Now create a new block, for instance NEWBLOCk =Bloc C + Bloc D + Bloc A + Bloc B

To inflate NEWBLOCK, if you don't know how to group it back in the right order (before inflating), you will have some problem...
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: euklides on January 26, 2020, 11:01:01 am
_READBIT a little test...


FOR w = 0 TO 255 STEP 1
    A~%% = w
    K$ = "": FOR X = 7 TO 0 STEP -1:
        IF _READBIT(A~%%, X) = -1 THEN K$ = K$ + "1" ELSE K$ = K$ + "0"
    NEXT X
    LOCATE , 1: PRINT w;: LOCATE , 6: PRINT K$;: LOCATE , 15: COLOR 7, 0: IF w > 254 THEN COLOR 0, 7
    PRINT " press a key";
    SLEEP: LOCATE , 15: PRINT SPACE$(15)

NEXT w


Nice.
--------------------------------------
$ASSERTS:CONSOLE (my opinion)
The given example gives for ' a = 0 '
'Line 11 (in main module)
'_Assert failed (check console for description)
'
So you must read the program in the line 11 to find ""Value cannot be zero"
Well...
I think it would be more interesting, when the program breaks, to have the possibility to read the current value of  ' a ' for understanding what is the problem (??) (This is possible in Visual Basic Excel)...





Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Richard Frost on January 26, 2020, 02:36:13 pm
Thank you, Old Moses.   Works for me now.  Three cheers for the _CAPSLOCK, _NUMLOCK, and _SCROLLLOCK.

I have a use for blinking the leds.  How embarassing that I so rarely use CASE that I messed it up.
Maybe the IDE should have flagged that as an error, or at least warned me.   But this is the best
way to learn, as long as it doesn't crash a plane!
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: OldMoses on January 26, 2020, 04:03:58 pm
Maybe the IDE should have flagged that as an error, or at least warned me. 

It's funny that it didn't, as that's the only reason that I caught it.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on January 26, 2020, 04:43:54 pm
It's funny that it didn't, as that's the only reason that I caught it.

Except it’s not an error.

CASE 1 + 2  <— You wouldn’t consider this an error, would you?  It’s a simple math formula which adds together to become 3.  (Though normally you’d see it more with CONST values, rather than numbers themselves, such as CASE Key_A + Uppercase to represent the uppercase “A”.)

CASE i = 1 is just another simple math formula.  If i is 1, it evaluates to a CASE -1; otherwise it evaluates to a CASE 0.

Take the following example and study it:

SELECT CASE x
     CASE i = 1

With the above, if X = 0 and i <> 1, we’d execute whatever is in that CASE block, while at the same time, if x = -1 and i = 1, we’d execute whatever is in that CASE block.  Otherwise we skip it. 



It’s not really a syntax error for the IDE to catch, any more than CASE 1 + 2 would be an error for the IDE to catch when the user meant CASE 1, 2.

It’s valid syntax; it’s just not the syntax you really wanted in this case.  ;)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 27, 2020, 10:37:15 am
There has been such a bug since version 1.3: When I run a program and when it stops, it doesn't always go back to the IDE. There will be a black screen. It is only when I move the mouse cursor down and click on it that the IDE opens.
My OS is Windows 7.

ps. Version 1.2 works fine.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 27, 2020, 01:56:51 pm
Of course, you can work around this by typing:

_FULLSCREEN _OFF: END
or
_FULLSCREEN _OFF: SYSTEM

But you didn't have to do it before! ;-)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Bert22306 on January 27, 2020, 04:30:32 pm
Can you post the code that causes this problem? Since you implied this only happens when using _FULLSCREEN, I tried this little guy here, and it seems to work as I would expect, every time:

Code: [Select]
_FULLSCREEN
FOR i = 1 TO 10
    a = a + 1
NEXT i
PRINT a
FOR i = 1 TO 20
    b = b + 1
NEXT i
PRINT b
END

It says "press any key to continue," and you're back to the IDE. (Windows 10, QB64 v1.4)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: bplus on January 27, 2020, 04:41:50 pm
Hi Bert22306,

Make71 says he's using Windows 7.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Bert22306 on January 27, 2020, 04:50:03 pm
I know. It would be nice to know if this is only related to Windows 7. Usually, these bugs do not seem to be related to the Windows version, but who knows.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 05:31:45 am
"_FULLSCREEN
FOR i = 1 TO 10
    a = a + 1
NEXT i
PRINT a
FOR i = 1 TO 20
    b = b + 1
NEXT i
PRINT b
END"
 It does not work! The same black screen when I pressed any key.

 Reinstalling Windows 7 didn't help!
 However, on my older computer with the same windows everything works!
 Could there be a problem with the graphics card?
 But yes there is something wrong with Qb64 too, because in older version 1.2 everything works on my newer PC.
  I also tried the 32-bit version, but the same black screen will appear when the program finishes.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on January 28, 2020, 07:25:57 am
Does replacing END with SYSTEM make it go away?
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: doppler on January 28, 2020, 08:08:15 am
Maybe related to the graphics driver.  Many and I do mean many, video boards lost support when win 10 came out.  And to top it off, video board mfg's stopped support for some lines after Win 7.  So when win 8, 8.1 came out, they said: "If it works o.k., if it don't no support"
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 08:43:08 am
Does replacing END with SYSTEM make it go away?

"END" or "SYSTEM", both with black screen.

If the program is not in "_FULLSCREEN" mode, it will exit normally.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 09:58:24 am
Maybe related to the graphics driver.  Many and I do mean many, video boards lost support when win 10 came out.  And to top it off, video board mfg's stopped support for some lines after Win 7.  So when win 8, 8.1 came out, they said: "If it works o.k., if it don't no support"

That's damn true!
And as it was with XP, even though Win7 support ended, it will be used in the world for years to come.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Petr on January 28, 2020, 11:03:49 am
It works fine for me with windows 7 and Nvidia graphics card. The programs will end in a black screen with the words press any key to continue... at the bottom (as expected) and when pressing the key, am back in the IDE.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 11:07:23 am
Of course, you can work around this by typing:

_FULLSCREEN _OFF: END
or
_FULLSCREEN _OFF: SYSTEM

But you didn't have to do it before! ;-)

It seems that this doesn't always work either!
A small but annoying mistake. :-(
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Petr on January 28, 2020, 11:17:27 am
Maybe - what is your monitor resolution? If it's 4K, it's possible no one has ever tested it. Or, there's another thing. Some LCD monitors simply do not display other than their resolution. Try to set a valid resolution for the monitor with _NEWIMAGE, then _FULLSCREEN. Whether the problem persists or it resolves the problem.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 11:17:55 am
"_FULLSCREEN
FOR i = 1 TO 10
    a = a + 1
NEXT i
PRINT a
FOR i = 1 TO 20
    b = b + 1
NEXT i
PRINT b
END"

I tried this 10 times and it always worked as it should, in version 1.2!
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Petr on January 28, 2020, 11:30:26 am
So I really don't know where the problem is. This program works in QB64 in all versions, including 1.4. I think, I don't know exactly what it was then, I was also solving something, I had to turn on some support for the graphics card driver, or in directX, it's been so long, Someone led me, I had some problems with rendering graphics. I had something off in the system. It's quite possible that it will be the same problem. It was something to enable for redraw OpenGL, I really don't know what was it. It's been too long.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on January 28, 2020, 11:33:30 am
I’ve tried to replicate the issue but haven’t had any luck with it with my system.  Whatever it is, it seems to be very machine specific.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 11:36:18 am
Maybe - what is your monitor resolution? If it's 4K, it's possible no one has ever tested it. Or, there's another thing. Some LCD monitors simply do not display other than their resolution. Try to set a valid resolution for the monitor with _NEWIMAGE, then _FULLSCREEN. Whether the problem persists or it resolves the problem.

I tried with many different resolutions that my monitor supports, but the "black screen" does not give up!
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 11:42:19 am
I’ve tried to replicate the issue but haven’t had any luck with it with my system.  Whatever it is, it seems to be very machine specific.

Yes, in fact, my other PC sometimes thinks something, but pretty soon the black screen disappears and the IDE appears.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Petr on January 28, 2020, 11:44:48 am
I'm trying to throw this bug. No success yet. When you print those numeric variables, do you see them?
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 11:56:35 am
I'm trying to throw this bug. No success yet. When you print those numeric variables, do you see them?

Yes, of course I see.

Now I try this with my own program...

SCREEN _NEWIMAGE(800, 600, 32)
_FULLSCREEN

DO
    PRINT " TEST ";
LOOP UNTIL _KEYHIT = 27 ' Press ESC

SYSTEM

Works a couple of first times, but then it gets black again!
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on January 28, 2020, 12:00:36 pm
" SCREEN _NEWIMAGE(640, 480, 32)
_FULLSCREEN

DO
    PRINT " TEST ";
LOOP UNTIL _KEYHIT = 27

'_FULLSCREEN _OFF: SYSTEM
'_SCREENHIDE: SYSTEM
_SCREENICON: SYSTEM "

 The last of the three lines at the end of the program (_SCREENICON: SYSTEM) seems to work every time in my version 1.4!
 Good thing and thank you to everyone who tried to help me! :-)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Bert22306 on January 28, 2020, 04:11:04 pm
So I really don't know where the problem is. This program works in QB64 in all versions, including 1.4.

Seems to work in Windows 7 or Windows 10, except for the one problem machine Make71 has. As Steve says, very machine specific. The most obvious first thoughts might be, the graphics card or the antivirus software?
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: hanness on February 02, 2020, 06:53:45 pm
I've not been able to do extensive testing as I've been out of it with the flu, but here's what I've tested so far...

I do a lot with console output so that is where my testing has been focused.

VERSIONINFO - I've not tested all options, but the ones I have tested are all now working correctly with current versions of Windows.

SLEEP - This appears to be working just fine for me.

COLOR - All these statements are working in my testing

INKEY$ - Maybe I can put this on the wish-list for version 1.5. This currently is not working when the destination is a console, and I guess it's not expected to be working at this time.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: SMcNeill on February 02, 2020, 07:07:51 pm
Code: [Select]
DO
    x = _CONSOLEINPUT
    IF x = 1 THEN 'don't update for mouse input
        c = _CINP
        PRINT c;
    END IF
LOOP UNTIL c = 1

Use _CONSOLEINPUT and _CINP to get single character console events (and mouse events).
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: hanness on February 03, 2020, 10:46:28 am
Thanks, Steve.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: hanness on February 03, 2020, 12:39:16 pm
You are probably aware of this already, but I thought I would just mention it to be on the safe side:

I don't see help in the program yet (as of the Jan 29th dev build) for _CINP or for _CONSOLEINPUT
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: OldMoses on February 07, 2020, 08:46:16 am
Just reporting this, I don't know if it means anything in particular...

I fell asleep with the laptop in my lap. When I awoke this morning I was greeted by the following dialog box:

Alert: gluBuild2DMipmaps failed

When I clicked OK it was followed by:

Alert: 1285

When I clicked on this one, QB64 closed.

When I restarted, it asked if I wanted to recover from autosave, which I didn't as it was unnecessary. I had saved all my changes.

I don't recall if I was running the application when I lost consciousness, but it wasn't running when I awoke.

Perhaps my snoring irritated it. ;)

EDIT: After googling this, I gather it is associated with OpenGL, which I am NOT using in anything I do.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: Make71 on February 09, 2020, 07:31:54 am
There has been such a bug since version 1.3: When I run a program and when it stops, it doesn't always go back to the IDE. There will be a black screen. It is only when I move the mouse cursor down and click on it that the IDE opens.
My OS is Windows 7.  ps. Version 1.2 works fine.
After hard work, I finally solved the problem that caused the "black window" after the "END" or "SYSTEM" command!
 I adjusted my time on Win7 settings until the bug localized to: Control Panel\System and Security\System
 And here: Advanced system settings | Performance | Settings.
 Check the box to "enable desktop layout".

 After the operation, the "black window" no longer appears! ;-)
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on February 09, 2020, 08:09:47 am
Great news, Make71.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on February 09, 2020, 08:11:11 am
You are probably aware of this already, but I thought I would just mention it to be on the safe side:

I don't see help in the program yet (as of the Jan 29th dev build) for _CINP or for _CONSOLEINPUT

Those have just been added to the wiki. In the IDE, hit Shift+F1 and open the Alphabetical order page. Then go to Help menu and choose Update this page.

The links for _CINP and _CONSOLEINPUT will show up. When you click them, these pages will be downloaded.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on February 09, 2020, 08:13:35 am
EDIT: After googling this, I gather it is associated with OpenGL, which I am NOT using in anything I do.

You are always using it when you're using QB64, even in SCREEN 0, as it's OpenGL that renders the characters.

Something in the library clearly doesn't like going into sleep/hibernation mode on your machine. I personally always use hibernation and keep QB64 open across sessions and never had an issue, but I guess that's really very system-dependant.

Thanks for reporting, although in this case there's probably very little we can do.
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on February 09, 2020, 01:03:02 pm
Provided no major issues come up with the current test version, we'll be releasing it officially this week.

Hope everyone has had enough time to test it out.

❤️
Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: hanness on February 11, 2020, 01:09:40 am
So far, so good. I have a program just shy of 7,000 lines of code that seems to be working fine on the dev builds.

I'm basically just doing console mode operations, no fancy graphics, but nevertheless, all looks good.

I have no issues at this point.

Title: Re: QB64 v1.4 Release Candidate up for testing
Post by: FellippeHeitor on February 11, 2020, 01:13:38 am
Thanks for the report, hanness.