Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 308
» Latest member: Donaldvem
» Forum threads: 1,741
» Forum posts: 17,901

Full Statistics

Latest Threads
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 762
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 31
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 32
DAY 009:_PutImage
Forum: Keyword of the Day!
Last Post: grymmjack
09-02-2023, 02:57 PM
» Replies: 54
» Views: 2,034
Fall Banner Contest?
Forum: Site Suggestions
Last Post: grymmjack
08-31-2023, 11:50 PM
» Replies: 36
» Views: 1,261
ColorPicker - Function th...
Forum: Dav
Last Post: Dav
08-31-2023, 11:04 PM
» Replies: 3
» Views: 315
Goals(1) = New Tile()
Forum: Works in Progress
Last Post: RhoSigma
08-31-2023, 09:45 PM
» Replies: 3
» Views: 127
micro(A)v11
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:14 PM
» Replies: 90
» Views: 3,589
Updating The Single Most ...
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:13 PM
» Replies: 7
» Views: 254
QBJS Image Question
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 05:49 PM
» Replies: 5
» Views: 155

 
  Adding without adding
Posted by: SMcNeill - 05-11-2022, 10:11 AM - Forum: Programs - No Replies

So, how do you add two numbers, without adding them?  

Code: (Select All)
Print Add(200, 22, Overflow~%%);: If Overflow~%% Then Print "Overflow!" Else Print
Print Add(245, 22, Overflow~%%);: If Overflow~%% Then Print "Overflow!" Else Print

Function Add (A As _Unsigned _Byte, B As _Unsigned _Byte, Overflow As _Unsigned _Byte)
    Dim As _Unsigned _Byte CarryFlag
    Overflow = 0
    While B <> 0
        CarryFlag = A And B
        Overflow = Overflow Or _SHR(CarryFlag, 7)
        A = A Xor B
        B = _SHL(CarryFlag, 1)
    Wend
    Add = A
End Function

You XOR, Bit shift, and AND them into submission!   Big Grin

Print this item

  First Computer Programming Book You Bought
Posted by: TarotRedhand - 05-11-2022, 10:09 AM - Forum: General Discussion - Replies (12)

I still have "Illustrating BASIC" (6th reprint 1981) by Donald Alcock. Published by the Cambridge University Press and first released in 1977. It covers Dartmouth BASIC and I bought before I had any computer.

So over to you. What was your first computer programming (there are other types of programming) book that you actually bought?

TR

Print this item

  _Round () issue
Posted by: dcromley - 05-11-2022, 04:08 AM - Forum: Help Me! - Replies (17)

I know this is a 'nit -- a very minor thing, but it probably should be fixed in the future.

It is that _Round(5/10) should be 1, but it is 0.  And there is a pattern: 25, 45, 65, etc. 
But maybe that is an alternative rule that I don't know about.  It is a 'nit.

Code: (Select All)
[ deleted 5/13 - incorrect ]

Print this item

  Phoenix Edition Repo Info
Posted by: SMcNeill - 05-11-2022, 01:59 AM - Forum: SMcNeill - Replies (3)

(Say that title ten times fast!  That's a great tongue twister!)

Code: (Select All)
Screen _NewImage(1024, 720, 32)
com$ = "curl -H " + Chr$(34) + "Accept: application/vnd.github.v3+json" + Chr$(34)
com$ = com$ + " https://api.github.com/repos/QB64-Phoenix-Edition/QB64pe/releases"
com$ = com$ + " >temp.txt"

Shell _Hide com$
_Delay 1 'give the os time to download and create the file
Open "temp.txt" For Binary As #1
Do Until EOF(1)
    Line Input #1, temp$
    If InStr(temp$, "download_count") Then Print Mid$(temp$, 27);
    If InStr(temp$, "browser_download_url") Then Print Mid$(temp$, 33)
Loop

For anyone who wants to take a look at the number of downloads the Phoenix Edition has for each release, you can use the little app above to do so.

If you're really curious about a lot more junk than just the download count, you can open the "temp.txt" and get a whole status report on the repo and the releases and such.  I'm not certain if anyone else would be interested in this type of thing, but I thought I'd share just in case.  Wink

Print this item

  Remember SBMIDI?
Posted by: davidshq - 05-10-2022, 10:35 PM - Forum: Help Me! - Replies (1)

Hi All,

One of the games I'm working with comes bundled with SBMIDI, it appears to be a sound driver of sorts for Soundblaster back in the day. See for example:
https://github.com/creationix/basic-game...I.DOC#L147

I'm trying to figure out what if anything I need to do to have the sound continue to work in QB64. The SBMIDI files aren't Windows compatible and I don't have the source code.

Any suggestions?

Thanks!
Dave

Print this item

  Announcing QB64 Phoenix Edition v0.6 Release!
Posted by: admin - 05-10-2022, 02:42 PM - Forum: Announcements - Replies (6)

Release v0.6.0 - QB64 Phoenix Edition/QB64pe (github.com)

Another step forward in making our first version "1.0" as the new team working on QB64. This release (version 0.5) now:

  • Add "Run Only" option to IDE menu.
  • Swap out PNG library for modern version -- we now load PNG files about 30% faster.
  • Fix to page width with variable width fonts.
  • _Bin$ added to the language. (see wiki for more information)
  • Removed/Replaced several more links which were pointing to the old qb64.org sites and forums.
  • Using the number-based $VERSIONINFO flags will now also set the string versions of those flags, if values for them are not provided.



Release v0.5.0 Notes

Another step forward in making our first version "1.0" as the new team working on QB64. This release (version 0.5) now:
  • Has swapped out the mingw compilers to updated versions for Windows users.
  • Reduced the size of the repo considerably for those who wish to download direct and setup QB64 manually, for whatever reason.
  • Prepacked Linux and max versions of QB64, which come in at less than 10MB each now.
  • We've swapped out all the references to the now defunct .net and .org sites that we could find, and replaced them to proper, working links which now connect to our new wiki, forum, and all at qb64phoenix.com.
  • $Color:0 and $Color:32 has now been tweaked to work with $NoPrefix. Color names will remain the same in all cases, if $Color is used without $NoPrefix. When $Color is used in conjunction with $NoPrefix, the colors of Red, Green, and Blue which would normally conflict with the now underscoreless commands of _Red, _Green, _Blue, have been altered to have NP_appended to them (for No Prefix). Example: Color NP_Red, Orange for a red on orange color.


Click on the big title above to go directly to the release page and grab yourself a copy of the latest version for all your QB64 needs!

Print this item

  Spiro - A Simulation
Posted by: TarotRedhand - 05-10-2022, 07:02 AM - Forum: Programs - Replies (13)

Another adaptation of an old QB4.5 program of mine. This is a simulation of a Spirograph. To be precise it simulates the result of a wheel that runs around inside a larger wheel and the patterns that can be created with different diameters of the small wheel and offsets from its centre. It is easy to use and is something of a rabbit hole that you may well disappear down into. While instructions are included in the comments, here is the relevant text -

Quote:To experiment with the patterns that this program can produce it is only necessary to alter the values held in two constants.  These constants are SmallDiameter# and Offset#.  Changing the value in SmallDiameter# will alter the overall shape of the pattern while altering Offset# will change the "pointyness" of the peaks.  To see what I am talking about, simply play around with these constants.  Note that it is not necessary to change both values every time that you wish to change the pattern.


If you find values for one or the other of those constants feel free to post them in here. To start you off try a value of 100 for SmallDiameter#. One little warning - it is possible to get the drawing to run off the screen although this doesn't crash the program.

SPIRO.BAS
Code: (Select All)
'===========================================================================
' Subject: SIMULATION OF A SPIROGRAPH        Date: 02-23-99 (21:53)
'  Author: TarotRedhand                      Code: QB, QBasic, PDS
'===========================================================================
'SPIRO.BAS - A simulation of the most used part of the toy called a
'            spirograph.  Public domain.  Use entirely at own risk.  The
'            author accepts no liability whatsoever.  In the case that I have
'            used a registered trademark, I apologise.  I do not at this time
'            own any trademarks.
'
' There is a toy called a spirograph that is used to make curved patterns.
' This toy consists of a number of pieces that are made from transparent
' plastic and a number of ball-point pens with different coloured inks in them.
' Each piece has gear-teeth along their outside edges.  The gear-teeth are
' all of the same size, independent of the piece that they are on.  In
' addition each piece has a number of holes in them, which are designed to
' accept a pen point.
'
' This program works in VGA mode 12 graphics and is a simulation of the most
' often used part of that toy.  It simulates the use of 2 of the plastic pieces
' to produce a circular pattern.  As this program uses double-precision
' numbers and maths, it is comparatively slow.  One thing that I have done to
' speed this up is to have 2 identical SUBs with STATIC variables in them.
' This works by ensuring that the built-in functions SIN and COS are only
' called once for each of the 2 angles that are used.
'
' RULES
'
' In order to use this program there are a few rules that you should be aware
' of.  DO NOT alter the value of the constant LargeDiameter#.  DO NOT place a
' value in the constant SmallDiameter# that is less than or equal to zero or
' greater than or equal to the value in LargeDiameter#.  DO NOT place a value
' greater than one or less than or equal to zero in the constant Offset.
' Violation of any of these rules will result in at best, the program
' attempting to draw off of the screen.
'
' Using this program.
'
' To experiment with the patterns that this program can produce it is only
' necessary to alter the values held in two constants.  These constants are
' SmallDiameter# and Offset#.  Changing the value in SmallDiameter# will alter
' the overall shape of the pattern while altering Offset# will change the
' "pointyness" of the peaks.  To see what I am talking about, simply play
' around with these constants.  Note that it is not necessary to change both
' values every time that you wish to change the pattern.
'
' Anyway, have fun.
'
' TarotRedhand - 11/1998
'
Const PI# = 3.141592653589793#
Const LargeDiameter# = 478
Const SmallDiameter# = 333
Const CenterX# = 320, CenterY# = 240
Const Offset# = .725
Const Angle1# = 1
Const StartColour = 1
Const EndColour = 13
Const FALSE% = 0
Const TRUE% = Not FALSE%

LC# = (PI# * LargeDiameter#) / 360
A2# = 360 / ((PI# * SmallDiameter#) / LC#)
SmallRadius# = SmallDiameter# / 2
SmallCenterY# = 1 + SmallRadius#
SmallCenterX# = CenterX#
StartX# = CenterX#
StartY# = 1 + SmallRadius# - (SmallRadius# * Offset#)
MyX# = StartX#
MyY# = StartY#
Orbit1 SmallCenterX#, SmallCenterY#, CenterX#, CenterY#, Angle1#, TRUE%
Orbit1 MyX#, MyY#, CenterX#, CenterY#, Angle1#, FALSE%
Orbit2 MyX#, MyY#, SmallCenterX#, SmallCenterY#, -A2#, TRUE%
Screen 12
_FullScreen _SquarePixels
Line (1, 1)-(640, 480), 15, BF
Colour = StartColour
Line (StartX#, StartY#)-(MyX#, MyY#), Colour
Do
    For Index% = 1 To 360
        Orbit1 SmallCenterX#, SmallCenterY#, CenterX#, CenterY#, Angle1#, FALSE%
        Orbit1 MyX#, MyY#, CenterX#, CenterY#, Angle1#, FALSE%
        Orbit2 MyX#, MyY#, SmallCenterX#, SmallCenterY#, -A2#, FALSE%
        Line -(MyX#, MyY#), Colour
        _Delay 0.002
        If InKey$ <> "" Then
            Exit Do
        End If
    Next Index%
    Colour = Colour + 1
    If Colour > EndColour Then Colour = StartColour
Loop
End

Sub Orbit1 (PointX#, PointY#, OrbitX#, OrbitY#, Angle#, FirstTime%)
    Static C#, S#
    If FirstTime% Then
        C# = Cos(Angle# * (PI# / 180#))
        S# = Sin(Angle# * (PI# / 180#))
    End If
    OldX# = PointX# - OrbitX#
    OldY# = PointY# - OrbitY#
    PointX# = (OldX# * C# - OldY# * S#) + OrbitX#
    PointY# = (OldX# * S# + OldY# * C#) + OrbitY#
End Sub

Sub Orbit2 (PointX#, PointY#, OrbitX#, OrbitY#, Angle#, FirstTime%)
    Static C#, S#
    If FirstTime% Then
        C# = Cos(Angle# * (PI# / 180#))
        S# = Sin(Angle# * (PI# / 180#))
    End If
    OldX# = PointX# - OrbitX#
    OldY# = PointY# - OrbitY#
    PointX# = (OldX# * C# - OldY# * S#) + OrbitX#
    PointY# = (OldX# * S# + OldY# * C#) + OrbitY#
End Sub

TR

Print this item

  My masterpiece - 13,500+ lines - WIM-Tools, Windows Image Management Tools
Posted by: hanness - 05-09-2022, 09:58 PM - Forum: Programs - No Replies

I'm not a professional programmer, just a hobbyist, but I'm proud of what I was able to accomplish with QB64.

This is a program that will be of interest to a limited audience. It's for those who want to be able to manage, update, manipulate, and deploy Windows 10 and 11 images and media.

I've spent years learning how to perform all these tasks, and more importantly, how to do them the RIGHT way. I've poured all that knowledge into this program.

If this sounds like something that you might be at all interested in check it out on my GitHub page. It was simply too large to post here.

hsehestedt (github.com)

Print this item

  Find a compressed copy of the QB64 wiki and forum
Posted by: Coolman - 05-09-2022, 09:57 PM - Forum: General Discussion - Replies (11)

i found a compressed archive of the qb64 wiki that looks quite recent dated 2022-04-20, there is a database and files. i got the files to convert them to pdf and assemble them into one file. if anyone is interested, here is the link to the archive. it seems useless to reinvent the wheel for the new wiki:

https://archive.org/details/qb64.org-wiki

also a link compressed archive of the forum of qb64 dated 2022-04-20 :

https://archive.org/details/qb64.org-forum

I try to download but the archive has a size of about 3.3go and it's very slow...

Print this item

  Optimized bash script compilation of QB64 for Linux
Posted by: Coolman - 05-09-2022, 03:54 PM - Forum: General Discussion - Replies (1)

This script was located in this post : why the qb64 editor is slow under linux

to simplify the updates, I created this dedicated post.


after reading some information about gcc, i decided to use the -O3 compiler option. it's a good compromise between security and speed.

if this is your first installation of qb64, it is advised to run the script setup_lnx.sh to install the package dependencies necessary for qb64...

this script allows to insert the -O3 compiler option of gcc g++ to optimize qb64. the original files are saved. i removed some useless sections of the original script setup_lnx.sh. download the source code of qb64, unzip, put the script in the directory where is setup_lnx.sh, make it executable and run it. the processing is automatic. if the compilation was successful, the qb64 executable will be created:

compile_qb64.sh

Code: (Select All)
#!/bin/bash
# QB64 Installer
# Argument 1: If not blank, qb64 will not be started after compilation

dont_run="$1"

#This checks the currently installed packages for the one's QB64 needs
#And runs the package manager to install them if that is the case
# *** SECTION ENLEVE ***


#Make sure we're not running as root
if [ $EUID == "0" ]; then
  echo "You are trying to run this script as root. This is highly unrecommended."
  echo "This script will prompt you for your sudo password if needed to install packages."
  exit 1
fi

GET_WGET=
#Path to Icon
#Relative Path to icon -- Don't include beginning or trailing '/'
QB64_ICON_PATH="internal/source"

#Name of the Icon picture
QB64_ICON_NAME="qb64icon32.png"

DISTRO=

lsb_command=`which lsb_release 2> /dev/null`
if [ -z "$lsb_command" ]; then
  lsb_command=`which lsb_release 2> /dev/null`
fi

#Outputs from lsb_command:

#Arch Linux  = arch
#Debian      = debian
#Fedora      = Fedora
#KUbuntu     = ubuntu
#LUbuntu     = ubuntu
#Linux Mint  = linuxmint
#Ubuntu      = ubuntu
#Slackware   = slackware
#VoidLinux   = voidlinux
#XUbuntu     = ubuntu
#Zorin       = Zorin
if [ -n "$lsb_command" ]; then
  DISTRO=`$lsb_command -si | tr '[:upper:]' '[:lower:]'`
elif [ -e /etc/arch-release ]; then
  DISTRO=arch
elif [ -e /etc/debian_version ] || [ -e /etc/debian_release ]; then
  DISTRO=debian
elif [ -e /etc/fedora-release ]; then
  DISTRO=fedora
elif [ -e /etc/redhat-release ]; then
  DISTRO=redhat
elif [ -e /etc/centos-release ]; then
  DISTRO=centos
fi

#Find and install packages
# *** SECTION ENLEVE ***

echo "Compiling and installing QB64..."

### Build process
find . -name "*.sh" -exec chmod +x {} \;
find internal/c/parts -type f -iname "*.a" -exec rm -f {} \;
find internal/c/parts -type f -iname "*.o" -exec rm -f {} \;
find internal/c/libqb -type f -iname "*.o" -exec rm -f {} \;
rm ./internal/temp/*

echo "Modification 'makeline*'"
cp ./internal/c/makeline_lnx.txt ./internal/c/makeline_lnx_ORG.txt
find ./internal/c -type f -name "makeline_lnx.txt" -print0 | xargs -0 sed -i 's/g++ -no-pie -w qbx.cpp/g++ -O3 -no-pie -w qbx.cpp/g'
cp ./internal/c/makeline_lnx_nogui.txt ./internal/c/makeline_lnx_nogui_ORG.txt
find ./internal/c -type f -name "makeline_lnx_nogui.txt" -print0 | xargs -0 sed -i 's/g++ -no-pie -w qbx.cpp/g++ -O3 -no-pie -w qbx.cpp/g'

echo "Building library 'LibQB'"
pushd internal/c/libqb/os/lnx >/dev/null
rm -f libqb_setup.o
cp setup_build.sh setup_build_ORG.sh
cp build_test.sh build_test_ORG.sh
find . -type f -name "*.sh" -print0 | xargs -0 sed -i 's/g++ -c -w -Wall/g++ -O3 -c -w -Wall/g'
./setup_build.sh
popd >/dev/null

echo "Building library 'FreeType'"
pushd internal/c/parts/video/font/ttf/os/lnx >/dev/null
rm -f src.o
cp setup_build.sh setup_build_ORG.sh
cp build.sh build.sh_ORG.sh
find . -type f -name "*.sh" -print0 | xargs -0 sed -i 's/g++ -s -c -w -Wall/g++ -s -O3 -c -w -Wall/g'
./setup_build.sh
popd >/dev/null

echo "Building library 'Core:FreeGLUT'"
pushd internal/c/parts/core/os/lnx >/dev/null
rm -f src.a
cp setup_build.sh setup_build_ORG.sh
cp build.sh build.sh_ORG.sh
find . -type f -name "*.sh" -print0 | xargs -0 sed -i 's/gcc -s -O2 -c/gcc -s -O3 -c/g'
./setup_build.sh
popd >/dev/null

echo "Building 'QB64'"
tar -czvf ./internal/source/main.tar.gz ./internal/source/main.txt
find ./internal/source -type f -name "main.txt" -print0 | xargs -0 sed -i 's/g++ -c -s -w -Wall libqb.cpp -D FREEGLUT_STATIC/g++ -O3 -c -s -w -Wall libqb.cpp -D FREEGLUT_STATIC/g'
cp -r ./internal/source/* ./internal/temp/
pushd internal/c >/dev/null
g++ -O3 -no-pie -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64
popd

if [ -e "./qb64" ]; then
  echo "DISTRO: $DISTRO"
  echo "Done compiling!!"
  echo
  echo "QB64 is located in this folder:"
  echo "`pwd`"
else
  ### QB64 didn't compile
  echo "It appears that the qb64 executable file was not created, this is usually an indication of a compile failure (You probably saw lots of error messages pop up on the screen)"
  echo "Usually these are due to missing packages needed for compilation. If you're not running a distro supported by this compiler, please note you will need to install the packages listed above."
  echo "If you need help, please feel free to post on the QB64 Forums detailing what happened and what distro you are using."
  echo "Also, please tell them the exact contents of this next line:"
  echo "DISTRO: $DISTRO"
fi
echo
echo "Thank you for using the QB64 installer."

Print this item