1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 10:30:36 +00:00

Updates help files [ci-skip]

This commit is contained in:
Fellippe Heitor 2021-02-11 08:41:53 -03:00
parent a59c3c7d34
commit 8458b4eac2
63 changed files with 447 additions and 370 deletions

View file

@ -11,7 +11,7 @@ The [[$NOPREFIX]] metacommand allows all QB64 functions and statements to be use
* If you are writing new code with QB64, and not importing code from QBasic/QuickBASIC 4.5, [[$NOPREFIX]] allows you to reduce typing by not having to use underscores in modern keywords.
* '''SUB _GL''' still must be prefixed.
* When [[$NOPREFIX]] is used, QB64 keywords can be used both with or without the leading underscore, so that both [[_DISPLAY]] and [[_DISPLAY|DISPLAY]] are valid in the same program, for example.
* [[$NOPREFIX]] must be the first line in a program.
* [[$NOPREFIX]] must be the first non-comment and non-whitespace line in a program.
==Availability==

View file

@ -48,31 +48,31 @@ Min _INTEGER64 value = 8000000000000000 with 16 digits
''Example 2:'' Converting a decimal number to a binary string value using [[HEX$]].
{{CodeStart}} '' ''
FUNCTION BIN$ (n&)
{{Cl|FUNCTION}} BIN$ (n&)
h$ = {{Cl|HEX$}}(n&) 'get hexadecimal string value
FOR i = 1 TO {{Cl|LEN}}(h$) 'scan the HEX$ digits
SELECT CASE {{Cl|MID$}}(h$, i, 1) 'read each HEX$ digit
CASE "0": b$ = b$ + "0000"
CASE "1": b$ = b$ + "0001"
CASE "2": b$ = b$ + "0010"
CASE "3": b$ = b$ + "0011"
CASE "4": b$ = b$ + "0100"
CASE "5": b$ = b$ + "0101"
CASE "6": b$ = b$ + "0110"
CASE "7": b$ = b$ + "0111"
CASE "8": b$ = b$ + "1000"
CASE "9": b$ = b$ + "1001"
CASE "A": b$ = b$ + "1010"
CASE "B": b$ = b$ + "1011"
CASE "C": b$ = b$ + "1100"
CASE "D": b$ = b$ + "1101"
CASE "E": b$ = b$ + "1110"
CASE "F": b$ = b$ + "1111"
END SELECT
NEXT i
b$ = {{Cl|RIGHT$}}(b$, LEN(b$) - {{Cl|INSTR}}(b$, "1") + 1) 'eliminate leading zeroes
IF {{Cl|VAL}}(b$) THEN BIN$ = b$ ELSE BIN$ = "0" 'return zero if n& = 0
END FUNCTION '' ''
{{Cl|FOR}} i = 1 {{Cl|TO}} {{Cl|LEN}}(h$) 'scan the HEX$ digits
{{Cl|SELECT CASE}} {{Cl|MID$}}(h$, i, 1) 'read each HEX$ digit
{{Cl|CASE}} "0": b$ = b$ + "0000"
{{Cl|CASE}} "1": b$ = b$ + "0001"
{{Cl|CASE}} "2": b$ = b$ + "0010"
{{Cl|CASE}} "3": b$ = b$ + "0011"
{{Cl|CASE}} "4": b$ = b$ + "0100"
{{Cl|CASE}} "5": b$ = b$ + "0101"
{{Cl|CASE}} "6": b$ = b$ + "0110"
{{Cl|CASE}} "7": b$ = b$ + "0111"
{{Cl|CASE}} "8": b$ = b$ + "1000"
{{Cl|CASE}} "9": b$ = b$ + "1001"
{{Cl|CASE}} "A": b$ = b$ + "1010"
{{Cl|CASE}} "B": b$ = b$ + "1011"
{{Cl|CASE}} "C": b$ = b$ + "1100"
{{Cl|CASE}} "D": b$ = b$ + "1101"
{{Cl|CASE}} "E": b$ = b$ + "1110"
{{Cl|CASE}} "F": b$ = b$ + "1111"
{{Cl|END SELECT}}
{{Cl|NEXT}} i
b$ = {{Cl|RIGHT$}}(b$, {{Cl|LEN}}(b$) - {{Cl|INSTR}}(b$, "1") + 1) 'eliminate leading zeroes
{{Cl|IF}} {{Cl|VAL}}(b$) {{Cl|THEN}} BIN$ = b$ {{Cl|ELSE}} BIN$ = "0" 'return zero if n& = 0
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
{{small|Code by CodeGuy}}
:''Explanation:'' Hexadecimal digits can be any value up to 15 which also corresponds to all four bits on in binary. The function above just adds every four bit binary string value together to return the binary value. After they are concatenated, the leading bit on is found by [[INSTR]] and everything from that point is kept removing the leading "0"'s.

View file

@ -14,7 +14,7 @@ The '''\''' mathematical operator performs [[INTEGER]] division on a numerical v
* Return values will be [[INTEGER]] or [[LONG]] value types only.
* Rounding is done to the closest EVEN [[INTEGER|integer]] or [[LONG|long integer]] value.
* Use the [[/]] integer division operator for [[SINGLE]] or [[DOUBLE]] floating decimal point return values.
* Division and multiplication operations are performed before addition and subtraction in Qbasic's order of operations.
* Division and multiplication operations are performed before addition and subtraction in QBasic's order of operations.
{{PageExamples}}

View file

@ -91,9 +91,9 @@ The [[ASC]] function returns the [[ASCII]] code number of a certain [[STRING]] t
{{PageExamples}}
''Example 1:'' How ASC can be used to find any ASCII code in a string of characters using QB64.
{{CodeStart}} '' ''
{{Cl|PRINT}} ASC("A")
{{Cl|PRINT}} ASC("Be a rockstar")
{{Cl|PRINT}} ASC("QB64 is not only COMPATIBLE, it can find any part of the string!", 18) '' ''
{{Cl|PRINT}} {{Cl|ASC}}("A")
{{Cl|PRINT}} {{Cl|ASC}}("Be a rockstar")
{{Cl|PRINT}} {{Cl|ASC}}("QB64 is not only COMPATIBLE, it can find any part of the string!", 18) '' ''
{{CodeEnd}}
''Returns:''
@ -114,8 +114,8 @@ The [[ASC]] function returns the [[ASCII]] code number of a certain [[STRING]] t
Q$ = {{Cl|CHR$}}(34) ' quote character
{{Cl|COLOR}} 10: {{Cl|LOCATE}} 5, 22: {{Cl|PRINT}} "Press some keys or combinations!"
{{Cl|COLOR}} 13: {{Cl|LOCATE}} 23, 30: {{Cl|PRINT}} "Escape key Quits"
DO
DO: {{Cl|SLEEP}}: key$ = {{Cl|INKEY$}}: {{Cl|LOOP}} {{Cl|UNTIL}} key$ <> "" ' prevent ASC empty string read error
{{Cl|DO}}
{{Cl|DO}}: {{Cl|SLEEP}}: key$ = {{Cl|INKEY$}}: {{Cl|LOOP}} {{Cl|UNTIL}} key$ <> "" ' prevent ASC empty string read error
code% = {{Cl|ASC}}(key$): {{Cl|COLOR}} 11: {{Cl|LOCATE}} 10, 10
{{Cl|IF...THEN|IF}} code% {{Cl|THEN}} ' ASC returns any value greater than 0
{{Cl|PRINT}} "{{Cl|CHR$}}(" + {{Cl|LTRIM$}}({{Cl|STR$}}(code%)) + ")" + {{Cl|SPACE$}}(13):
@ -133,18 +133,18 @@ DO
''Example 3:'' Reading only numerical values input by a program user.
{{CodeStart}}
DO: {{Cl|SLEEP}} ' requires a keypress to run loop once
K$ = {{Cl|{{Cl|INKEY$}}}}
{{Cl|DO}}: {{Cl|SLEEP}} ' requires a keypress to run loop once
K$ = {{Cl|INKEY$}}
code = {{Cl|ASC}}(K$)
{{Cl|IF...THEN|IF}} code >= 48 {{Cl|AND (boolean)|AND}} code <= 57 {{Cl|THEN}} entry$ = entry$ + {{Cl|{{Cl|CHR$}}}}(code) ' numbers only
{{Cl|IF...THEN|IF}} code = 46 {{Cl|AND (boolean)|AND}} flag = 0 {{Cl|THEN}}
{{Cl|IF}} code >= 48 {{Cl|AND (boolean)|AND}} code <= 57 {{Cl|THEN}} entry$ = entry$ + {{Cl|CHR$}}(code) ' numbers only
{{Cl|IF}} code = 46 {{Cl|AND (boolean)|AND}} flag = 0 {{Cl|THEN}}
entry$ = entry$ + K$: flag = 1: mark = {{Cl|LEN}}(entry$) ' decimal point
{{Cl|END IF}}
L = {{Cl|{{Cl|LEN}}}}(entry$) ' check entry length for possible backspace
{{Cl|IF...THEN|IF}} code = 8 {{Cl|AND (boolean)|AND}} L > 0 {{Cl|THEN}} ' backspace pressed and entry has a length
entry$ = {{Cl|{{Cl|MID$}}}}(entry$, 1, L - 1) ' remove one character from entry$
{{Cl|IF...THEN|IF}} L - 1 < mark {{Cl|THEN}} flag = 0 ' allow another decimal point if removed.
{{Cl|LOCATE}} 10, {{Cl|POS}}(0) - 1: {{Cl|PRINT}} {{Cl|{{Cl|SPACE$}}}}(1); ' remove character from screen
L = {{Cl|LEN}}(entry$) ' check entry length for possible backspace
{{Cl|IF}} code = 8 {{Cl|AND (boolean)|AND}} L > 0 {{Cl|THEN}} ' backspace pressed and entry has a length
entry$ = {{Cl|MID$}}(entry$, 1, L - 1) ' remove one character from entry$
{{Cl|IF}} L - 1 < mark {{Cl|THEN}} flag = 0 ' allow another decimal point if removed.
{{Cl|LOCATE}} 10, {{Cl|POS}}(0) - 1: {{Cl|PRINT}} {{Cl|SPACE$}}(1); ' remove character from screen
{{Cl|END IF}}
{{Cl|LOCATE}} 10, 10: {{Cl|PRINT}} entry$;
' display present entry to user(semicolon required for correct POS return)

View file

@ -178,7 +178,7 @@
<center>'''ASCII in Text and Printing'''</center>
* Characters '''0'''(NULL) and '''255'''(NBSP) can also be used to print spaces('''32'''). Useful for making file names harder to delete too.
* Character '''7''' will create a [[BEEP]] sound when printed in '''QB64''' or an error sound in Qbasic using a '''SCREEN 0''' window.
* Character '''7''' will create a [[BEEP]] sound when printed in '''QB64''' or an error sound in QBasic using a '''SCREEN 0''' window.
* Character '''8''' is returned when the '''Backspace''' key is pressed.
* Characters '''9 thru 13''' and '''28 thru 31''' can affect screen or file text placements and do not display the character when [[PRINT|printed]]:
:* Character '''9''' will '''Tab''' space the cursor 8 column spaces when printed.

View file

@ -1,5 +1,11 @@
The '''apostrophe''' is used to tell the compiler to ignore a statement or programmer comment.
{{PageSyntax}}
:: <b>'</b> a program comment
{{PageDescription}}
* Allows programmer comments or temporary code removal.
* [[REM]] can also be used to "comment out" a line.
@ -18,7 +24,6 @@ COLOR 11: PRINT "Print this...." ' PRINT "Don't print this program comment!"
{{PageSeeAlso}}
* [[Comma]], [[Semicolon]]
* [[REM]]

View file

@ -21,7 +21,7 @@ Arrays can store element bytes of information like any other variable depending
:::::: [[_FLOAT]] = 10 bytes (better than Double accuracy)
While Qbasic uses signed values '''QB64''' can use signed or [[_UNSIGNED]] values for [[_BIT]], [[_BYTE]], [[INTEGER]], [[LONG]] or [[_INTEGER64]] variable type values.
While QBasic uses signed values '''QB64''' can use signed or [[_UNSIGNED]] values for [[_BIT]], [[_BYTE]], [[INTEGER]], [[LONG]] or [[_INTEGER64]] variable type values.
The array's variable type must be determined when the array is created. If no type is used, the default type is [[SINGLE]].

View file

@ -137,7 +137,7 @@ alpha$ = "FF" 'solid alpha colors only
{{Cl|SCREEN}} 0: {{Cl|_FULLSCREEN}} ' used for fullscreen instead of window
{{Cl|COLOR}} 30, 6: {{Cl|LOCATE}} 12, 4: {{Cl|PRINT}} "Hello!" '' ''
{{CodeEnd}}
:''Result:'' Hello! is printed in flashing high intensity yellow with brown background behind text only when in Qbasic [[_FULLSCREEN|fullscreen]].
:''Result:'' Hello! is printed in flashing high intensity yellow with brown background behind text only when in QBasic [[_FULLSCREEN|fullscreen]].
''Example 4:'' Using [[CLS]] after setting the background color in SCREEN 0 to make the color cover the entire screen.

View file

@ -8,7 +8,7 @@ The '''comma''' is used to [[TAB]] the cursor after a [[PRINT]] statement's text
* A comma following the prompt text in an [[INPUT]] statement does not display a question mark. A [[Semicolon|semicolon]] or no prompt does.
* Commas are also used between [[INPUT]] statement variables when more than one input is required.
* [[LINE INPUT]] can use a comma or [[semicolon]] after the prompt text. Neither will display a [[question mark]].
* Commas are used as [[argument]] separators in many kinds of Qbasic statements and [[SUB]] or [[FUNCTION]] parameter lists.
* Commas are used as [[argument]] separators in many kinds of QBasic statements and [[SUB]] or [[FUNCTION]] parameter lists.
* [[WRITE]] statements use commas to separate values printed to the screen or sent to a file '''without tab spacing them'''.
* '''Literal numerical values entered into program code, [[DATA]], files or user [[INPUT]] cannot contain comma separators!'''

View file

@ -0,0 +1,37 @@
Although you cannot use LPRINT if you are not using Windows, you can still send raw data to a printer by connecting to it using TCP/IP. The code below showcases how to do so.
== Code ==
{{CodeStart}}
'TCP/IP Printing
'********************************
'this explains how to connect to a printer and send raw text to the printer
'this is very useful to linux users who cant use the LPRINT command.
'********************************
{{Cl|DIM}} PrinterConnect {{Cl|AS}} {{Cl|LONG}}
{{Cl|DIM}} CRLF AS {{Cl|STRING}}
{{Cl|DIM}} CRFF AS {{Cl|STRING}}
{{Cl|DIM}} LinePrint {{Cl|AS}} {{Cl|STRING}}
CRLF$ = {{Cl|CHR$}}(13) + {{Cl|CHR$}}(10) ' end current print line and starts new line
FF$ = {{Cl|CHR$}}(12) ' end current print line and finish printing
CLS
PrinterConnect = {{Cl|_OPENCLIENT}}("TCP/IP:9100:***.***.***.***") 'Replace asterisks with your printer's IP address. Opens a connection to your printer
{{Cl|IF}} PrinterConnect {{Cl|THEN}}
{{Cl|PRINT}} "[Connected to " + {{Cl|_CONNECTIONADDRESS}}(PrinterConnect) + "]"
{{Cl|ELSE}} {{Cl|PRINT}} "[Connection Failed!]"
{{Cl|END}} {{Cl|IF}}
printstring1$ = "this is a printed line" + CRLF$
{{Cl|PRINT}}
{{Cl|INPUT}} "please enter the name of the file you want to print>", FileName$
{{Cl|OPEN}} FileName$ {{Cl|FOR}} {{Cl|INPUT}} {{Cl|AS}} #1
{{Cl|DO}}
{{Cl|LINE}} {{Cl|INPUT}} #1, LinePrint$
PrintString$ = LinePrint$ + CRLF$
{{Cl|PUT}} #PrinterConnect, , PrintString$:
LOOP UNTIL EOF(1)
{{Cl|PUT}} #PrinterConnect, , FF$
{{CodeEnd}}
''Thanks to SpriggsySpriggs and Atomic Kevin for the code above''

View file

@ -12,7 +12,7 @@ The tutorial below shows you how to do things manually, for instructional purpos
Bits are numbered from 0 to 7 and normally are read from the most significant bit(MSB = 7) to the least significant bit(LSB = 0).
: The following example shows how to convert an [[_UNSIGNED]] [[_BYTE]] or [[INTEGER]] value(0 to 255) to a [[Binary]] [[STRING]] number in Qbasic.
: The following example shows how to convert an [[_UNSIGNED]] [[_BYTE]] or [[INTEGER]] value(0 to 255) to a [[Binary]] [[STRING]] number in QBasic.
{{CodeStart}} '' ''
{{Cl|DIM}} byte as {{Cl|_UNSIGNED}} {{Cl|_BYTE}}

View file

@ -19,7 +19,7 @@
<!--
{{PageExamples}}
''Example:'' In a Qbasic(ONLY) file delete, '''SEG''' forces the parameter to be passed as a far pointer.
''Example:'' In a QBasic(ONLY) file delete, '''SEG''' forces the parameter to be passed as a far pointer.
{{CodeStart}} '' ''
{{Cl|CONST}} file = "trashme.tmp" 'example temporary file name to delete
{{Cl|DEFINT}} A-Z

View file

@ -92,7 +92,7 @@ x = 1 'x is a {{Cl|SINGLE}} variable
''Example 8:'' Using QB64's alternative syntax to declare multiple variables/arrays of the same type.
{{CodeStart}} '' ''
{{Cl|DIM}} {{Cl|AS}} {{Cl|LONG}} w, h, id, weight, index 'all of these variables are created as type LONG
{{Cl|DIM}} {{Cl|AS}} {{Cl|SINGLE}} x, y, z ' all of these variables are created as type SINGLE
{{Cl|DIM}} {{Cl|AS}} {{Cl|SINGLE}} x, y, z 'all of these variables are created as type SINGLE
{{CodeEnd}} '' ''

View file

@ -36,9 +36,9 @@
''Example 1:'' Using WHILE to clear the keyboard buffer.
{{CodeStart}}
DO WHILE {{Cl|INKEY$}} <> "": LOOP ' checks evaluation before running loop code
{{Cl|DO}} {{Cl|WHILE}} {{Cl|INKEY$}} <> "": {{Cl|LOOP}} ' checks evaluation before running loop code
DO: LOOP WHILE INKEY$ <> "" ' checks evaluation after one run of loop code
{{Cl|DO}}: {{Cl|LOOP}} {{Cl|WHILE}} {{Cl|INKEY$}} <> "" ' checks evaluation after one run of loop code
{{CodeEnd}}
@ -46,9 +46,9 @@ DO: LOOP WHILE INKEY$ <> "" ' checks evaluation after one run of loop code
''Example 2:'' Using UNTIL to clear the keyboard buffer.
{{CodeStart}}
DO UNTIL {{Cl|INKEY$}} = "": LOOP ' checks evaluation before running loop code
{{Cl|DO}} {{Cl|UNTIL}} {{Cl|INKEY$}} = "": {{Cl|LOOP}} ' checks evaluation before running loop code
DO: LOOP UNTIL {{Cl|INKEY$}} = "" ' checks evaluation after one run of loop code
{{Cl|DO}}: {{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} = "" ' checks evaluation after one run of loop code
{{CodeEnd}}
@ -64,70 +64,70 @@ CheckScreen filenm$
{{Cl|DEFINT}} A-Z
{{Cl|SUB}} CheckScreen (Filename$) 'find Screen mode (12 or 13) and image dimensions
DIM Bsv AS {{Cl|STRING}} * 1
DIM Header AS STRING * 6
{{Cl|DIM}} Bsv {{Cl|AS}} {{Cl|STRING}} * 1
{{Cl|DIM}} Header {{Cl|AS}} {{Cl|STRING}} * 6
Scr = 0: MaxColors = 0
{{Cl|OPEN}} Filename$ FOR {{Cl|BINARY}} AS #1
{{Cl|OPEN}} Filename$ {{Cl|FOR (file statement)|FOR}} {{Cl|BINARY}} {{Cl|AS}} #1
{{Cl|GET}} #1, , Bsv '1 check for small 2 character
GET #1, , Header '2 - 7 rest of file header
{{Cl|GET}} #1, , Header '2 - 7 rest of file header
IF Bsv <> {{Cl|CHR$}}(253) THEN ' small 2 character denotes a {{Cl|BSAVE}} file
COLOR 12: LOCATE 15, 33: PRINT "Not a BSAVE file!": SLEEP 3: {{Cl|EXIT}} SUB
END IF
{{Cl|IF}} Bsv <> {{Cl|CHR$}}(253) {{Cl|THEN}} ' small 2 character denotes a {{Cl|BSAVE}} file
{{Cl|COLOR}} 12: {{Cl|LOCATE}} 15, 33: {{Cl|PRINT}} "Not a BSAVE file!": {{Cl|SLEEP}} 3: {{Cl|EXIT SUB}}
{{Cl|END IF}}
GET #1, , widN '8 no color info bmp sizes
GET #1, , depN '9 " " "
{{Cl|GET}} #1, , widN '8 no color info bmp sizes
{{Cl|GET}} #1, , depN '9 " " "
DO
IF widN > 63 OR depN > 63 THEN {{Cl|EXIT DO}} ' width and depth already found
{{Cl|DO}}
{{Cl|IF}} widN > 63 {{Cl|OR}} depN > 63 {{Cl|THEN}} {{Cl|EXIT DO}} ' width and depth already found
FOR i = 10 TO 55 'check for Screen 12 embedded colors
GET #1, , RGB
{{Cl|FOR}} i = 10 {{Cl|TO}} 55 'check for Screen 12 embedded colors
{{Cl|GET}} #1, , RGB
tot12& = tot12& + RGB
'PRINT i; RGB; : SOUND 300, 1 'test sound slows loop in QB
IF RGB > 63 OR RGB < 0 THEN {{Cl|EXIT DO}}
IF i = 55 AND tot12& = 0 THEN {{Cl|EXIT DO}}
NEXT
{{Cl|IF}} RGB > 63 {{Cl|OR}} RGB < 0 {{Cl|THEN}} {{Cl|EXIT DO}}
{{Cl|IF}} i = 55 {{Cl|AND}} tot12& = 0 {{Cl|THEN}} {{Cl|EXIT DO}}
{{Cl|NEXT}}
GET #1, , wid12 '56
GET #1, , dep12 '57
IF wid12 > 63 OR dep12 > 63 THEN {{Cl|EXIT DO}}
{{Cl|GET}} #1, , wid12 '56
{{Cl|GET}} #1, , dep12 '57
{{Cl|IF}} wid12 > 63 {{Cl|OR}} dep12 > 63 {{Cl|THEN}} {{Cl|EXIT DO}}
FOR i = 58 TO 775 'check for Screen 13 embedded colors
GET #1, , RGB
{{Cl|FOR}} i = 58 TO 775 'check for Screen 13 embedded colors
{{Cl|GET}} #1, , RGB
tot13& = tot13& + RGB
'PRINT i; RGB; : SOUND 300, 1 'test
IF RGB > 63 OR RGB < 0 THEN {{Cl|EXIT DO}}
IF i = 775 AND tot13& = 0 THEN {{Cl|EXIT DO}}
NEXT
GET #1, , wid13 '776
GET #1, , dep13 '777
LOOP {{Cl|UNTIL}} 1 = 1 'TRUE statement exits one-time LOOP
CLOSE #1
{{Cl|IF}} RGB > 63 {{Cl|OR}} RGB < 0 {{Cl|THEN}} {{Cl|EXIT DO}}
{{Cl|IF}} i = 775 {{Cl|AND}} tot13& = 0 {{Cl|THEN}} {{Cl|EXIT DO}}
{{Cl|NEXT}}
{{Cl|GET}} #1, , wid13 '776
{{Cl|GET}} #1, , dep13 '777
{{Cl|LOOP}} {{Cl|UNTIL}} 1 = 1 'TRUE statement exits one-time LOOP
{{Cl|CLOSE}} #1
COLOR 14: LOCATE 10, 25
{{Cl|COLOR}} 14: {{Cl|LOCATE}} 10, 25
{{Cl|SELECT CASE}} i
{{Cl|CASE IS}} < 56:
IF widN > 640 THEN
{{Cl|IF}} widN > 640 {{Cl|THEN}}
Scr = 13: MaxColors = 0
PRINT "Default Screen 13:"; widN \ 8; "X"; depN
ELSE
LOCATE 10, 15
PRINT "Screen 12 ("; widN; "X"; depN; ") OR 13 ("; widN \ 8; "X"; depN; ")"
DO: SOUND 600, 4
COLOR 13: LOCATE 12, 23 'ask if no data found. Prevents ERROR opening in wrong mode
{{Cl|PRINT}} "Default Screen 13:"; widN \ 8; "X"; depN
{{Cl|ELSE}}
{{Cl|LOCATE}} 10, 15
{{Cl|PRINT}} "Screen 12 ("; widN; "X"; depN; ") OR 13 ("; widN \ 8; "X"; depN; ")"
{{Cl|DO}}: {{Cl|SOUND}} 600, 4
{{Cl|COLOR}} 13: {{Cl|LOCATE}} 12, 23 'ask if no data found. Prevents ERROR opening in wrong mode
{{Cl|INPUT}} "Enter a Screen mode 12 or 13 : ", Scrn$
Scr = VAL(Scrn$)
LOOP UNTIL Scr = 12 OR Scr = 13
END IF
IF Scr = 12 THEN MaxColors = 0: PWidth = widN: PDepth = depN
IF Scr = 13 THEN MaxColors = 0: PWidth = widN \ 8: PDepth = depN
Scr = {{Cl|VAL}}(Scrn$)
{{Cl|LOOP}} {{Cl|UNTIL}} Scr = 12 {{Cl|OR}} Scr = 13
{{Cl|END IF}}
{{Cl|IF}} Scr = 12 {{Cl|THEN}} MaxColors = 0: PWidth = widN: PDepth = depN
{{Cl|IF}} Scr = 13 {{Cl|THEN}} MaxColors = 0: PWidth = widN \ 8: PDepth = depN
{{Cl|CASE}} 56 TO 775
PRINT "Custom Screen 12:"; wid12; "X"; dep12
{{Cl|PRINT}} "Custom Screen 12:"; wid12; "X"; dep12
Scr = 12: MaxColors = 16: PWidth = wid12: PDepth = dep12
{{Cl|CASE}} 776: PRINT "Custom Screen 13:"; wid13 \ 8; "X"; dep13
{{Cl|CASE}} 776: {{Cl|PRINT}} "Custom Screen 13:"; wid13 \ 8; "X"; dep13
Scr = 13: MaxColors = 256: PWidth = wid13 \ 8: PDepth = dep13
{{Cl|END SELECT}}

View file

@ -67,7 +67,7 @@ Strings have a property called ''length'', which is the number of characters cur
===Variable-length strings===
Variable length strings are undefined length string variables. Fixed length strings MUST be defined in a program before they are used. Undefined strings can be up to 32767 characters in Qbasic.
Variable length strings are undefined length string variables. Fixed length strings MUST be defined in a program before they are used. Undefined strings can be up to 32767 characters in QBasic.
{{CodeStart}}

View file

@ -96,17 +96,17 @@
''Example 5:'' Using multiple IF options in a one line statement.
{{CodeStart}} '' ''
{{Cl|INPUT}} "Enter a number over or under 200: ", x
{{Cl|IF...THEN|IF}} x > 200 {{Cl|THEN}} {{Cl|PRINT}} "High" {{Cl|{{Cl|ELSEIF}}}} x < 0 {{Cl|THEN}} {{Cl|PRINT}} "Low" {{Cl|{{Cl|ELSE}}}} {{Cl|PRINT}} "OK"
{{Cl|IF...THEN|IF}} x > 200 {{Cl|THEN}} {{Cl|PRINT}} "High" {{Cl|ELSEIF}} x < 0 {{Cl|THEN}} {{Cl|PRINT}} "Low" {{Cl|ELSE}} {{Cl|PRINT}} "OK"
'' ''
{{CodeEnd}}
''Example 6:'' [[STRING]] values can be compared using greater than, less than, not equal to or equal to operators only.
{{CodeStart}} '' ''
PRINT "Press a letter key: ";
{{Cl|PRINT}} "Press a letter key: ";
Key$ = {{Cl|INPUT$}}(1)
PRINT Key$
IF Key$ >= {{Cl|CHR$}}(65) AND Key$ <= {{Cl|CHR$}}(90) THEN PRINT "A to Z"
{{Cl|PRINT}} Key$
{{Cl|IF}} Key$ >= {{Cl|CHR$}}(65) {{Cl|AND}} Key$ <= {{Cl|CHR$}}(90) {{Cl|THEN}} {{Cl|PRINT}} "A to Z"
{{CodeEnd}}
: ''Explanation:'' Long [[STRING]] expression values are compared by their cumulative [[ASCII]] code values.

View file

@ -15,11 +15,11 @@
{{PageExamples}}
''Example 1:'' Reading the current RGB color settings used in a bitmap to an array.
{{CodeStart}} '' ''
SCREEN 12
{{Cl|SCREEN}} 12
{{Cl|DIM}} Colors%(47)
{{Cl|OUT}} &H3C7, 0 ' set color port for INP reads at attribute 0 to start
{{Cl|FOR...NEXT|FOR}} i = 0 {{Cl|TO}} 47
Colors%(i) = {{Cl|INP}}(&H3C9) ' moves to next color attribute every 3 loops
Colors%(i) = {{Cl|INP}}(&H3C9) ' moves to next color attribute every 3 loops
{{Cl|NEXT}} '' ''
{{CodeEnd}}
@ -38,9 +38,9 @@
{{CodeStart}} '' ''
{{Cl|DEFINT}} A-Z
{{Cl|SCREEN}} 12
{{Cl|DIM}} ball%(100) ' Set aside enough space to hold the ball sprite
{{Cl|DIM}} ball%(100) ' Set aside enough space to hold the ball sprite
{{Cl|CIRCLE}} (4, 3), 4, 4
{{Cl|PAINT}} (4, 3), 12, 4 ' Draw a filled circle and fill for ball
{{Cl|PAINT}} (4, 3), 12, 4 ' Draw a filled circle and fill for ball
{{Cl|GET (graphics statement)|GET}} (0, 0)-(8, 7), ball%(0) ' Get the sprite into the Ball% array
begin:
@ -50,56 +50,56 @@ x = 25: y = 25
dx = 1: dy = 1
LTpos = 50: RTpos = 50
DO: {{Cl|_LIMIT}} 100 'adjust higher for faster
{{Cl|CLS}}
{{Cl|IF...THEN|IF}} ScanKey%(17) {{Cl|THEN}} LTpos = LTpos - 1
{{Cl|IF...THEN|IF}} ScanKey%(31) {{Cl|THEN}} LTpos = LTpos + 1
{{Cl|IF...THEN|IF}} ScanKey%(72) {{Cl|THEN}} RTpos = RTpos - 1
{{Cl|IF...THEN|IF}} ScanKey%(80) {{Cl|THEN}} RTpos = RTpos + 1
{{Cl|DO}}: {{Cl|_LIMIT}} 100 'adjust higher for faster
{{Cl|CLS}}
{{Cl|IF...THEN|IF}} ScanKey%(17) {{Cl|THEN}} LTpos = LTpos - 1
{{Cl|IF...THEN|IF}} ScanKey%(31) {{Cl|THEN}} LTpos = LTpos + 1
{{Cl|IF...THEN|IF}} ScanKey%(72) {{Cl|THEN}} RTpos = RTpos - 1
{{Cl|IF...THEN|IF}} ScanKey%(80) {{Cl|THEN}} RTpos = RTpos + 1
{{Cl|PRINT}} "Player 1 : "; ponescore; " Player 2 : "; ptwoscore
{{Cl|PRINT}} "Player 1 : "; ponescore; " Player 2 : "; ptwoscore
{{Cl|IF...THEN|IF}} x > xmax - 15 {{Cl|AND (boolean)|AND}} y >= RTpos {{Cl|AND (boolean)|AND}} y <= RTpos + 100 {{Cl|THEN}}
dx = -1
{{Cl|ELSEIF}} x > xmax {{Cl|THEN}}
ponescore = ponescore + 1
{{Cl|GOSUB}} begin
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} x > xmax - 15 {{Cl|AND (boolean)|AND}} y >= RTpos {{Cl|AND (boolean)|AND}} y <= RTpos + 100 {{Cl|THEN}}
dx = -1
{{Cl|ELSEIF}} x > xmax {{Cl|THEN}}
ponescore = ponescore + 1
{{Cl|GOSUB}} begin
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} x < xmin + 15 {{Cl|AND (boolean)|AND}} y >= LTpos {{Cl|AND (boolean)|AND}} y <= LTpos + 100 {{Cl|THEN}}
dx = 1
{{Cl|ELSEIF}} x < xmin {{Cl|THEN}}
ptwoscore = ptwoscore + 1
{{Cl|GOSUB}} begin
{{Cl|END IF}}
{{Cl|IF}} x < xmin + 15 {{Cl|AND (boolean)|AND}} y >= LTpos {{Cl|AND (boolean)|AND}} y <= LTpos + 100 {{Cl|THEN}}
dx = 1
{{Cl|ELSEIF}} x < xmin {{Cl|THEN}}
ptwoscore = ptwoscore + 1
{{Cl|GOSUB}} begin
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} y > ymax - 5 {{Cl|THEN}} dy = -1
{{Cl|IF...THEN|IF}} y < ymin + 5 {{Cl|THEN}} dy = 1
' Display the sprite elsewhere on the screen
{{Cl|IF...THEN|IF}} y > ymax - 5 {{Cl|THEN}} dy = -1
{{Cl|IF...THEN|IF}} y < ymin + 5 {{Cl|THEN}} dy = 1
' Display the sprite elsewhere on the screen
x = x + dx
y = y + dy
x = x + dx
y = y + dy
{{Cl|PUT (graphics statement)|PUT}}(x, y), ball%(0)
{{Cl|PUT (graphics statement)|PUT}}(x, y), ball%(0)
{{Cl|LINE}} (20, LTpos)-(20, LTpos + 100)
{{Cl|LINE}} (620, RTpos)-(620, RTpos + 100)
{{Cl|LINE}} (20, LTpos)-(20, LTpos + 100)
{{Cl|LINE}} (620, RTpos)-(620, RTpos + 100)
{{Cl|_DISPLAY}} 'shows completed screen every call
{{Cl|_DISPLAY}} 'shows completed screen every call
{{Cl|LOOP}} {{Cl|UNTIL}} ScanKey%(1)
{{Cl|END}}
{{Cl|FUNCTION}} ScanKey% (scancode%)
{{Cl|STATIC}} Ready%, keyflags%()
{{Cl|IF...THEN|IF}} {{Cl|NOT}} Ready% {{Cl|THEN}} {{Cl|REDIM}} keyflags%(0 {{Cl|TO}} 127): Ready% = -1
i% = {{Cl|INP}}({{Cl|&H}}60) 'read keyboard states
{{Cl|IF...THEN|IF}} (i% {{Cl|AND (boolean)|AND}} 128) {{Cl|THEN}} keyflags%(i% {{Cl|XOR (boolean)|XOR}} 128) = 0
{{Cl|IF...THEN|IF}} (i% {{Cl|AND (boolean)|AND}} 128) = 0 {{Cl|THEN}} keyflags%(i%) = -1
K$ = {{Cl|INKEY$}}
ScanKey% = keyflags%(scancode%)
{{Cl|STATIC}} Ready%, keyflags%()
{{Cl|IF...THEN|IF}} {{Cl|NOT}} Ready% {{Cl|THEN}} {{Cl|REDIM}} keyflags%(0 {{Cl|TO}} 127): Ready% = -1
i% = {{Cl|INP}}({{Cl|&H}}60) 'read keyboard states
{{Cl|IF...THEN|IF}} (i% {{Cl|AND (boolean)|AND}} 128) {{Cl|THEN}} keyflags%(i% {{Cl|XOR (boolean)|XOR}} 128) = 0
{{Cl|IF...THEN|IF}} (i% {{Cl|AND (boolean)|AND}} 128) = 0 {{Cl|THEN}} keyflags%(i%) = -1
K$ = {{Cl|INKEY$}}
ScanKey% = keyflags%(scancode%)
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
: ''Note:'' [[_KEYDOWN]] can be used to read multiple keys simultaneously and is the '''recommended practice'''.

View file

@ -81,7 +81,7 @@ items% = ICO.Count
::* The [[LONG]] Data Offset value will indicate the byte position of the image bitmap header. Add one byte in QB and QB64.
<center>'''Bitmap Header Information'''</center>
: The Bitmap header information is located one byte after the Data Offset position because Qbasic sets the first byte of a file as 1 instead of zero. This bitmap image information is identical to a bitmap image header's last 40 bytes, but the height is doubled.
: The Bitmap header information is located one byte after the Data Offset position because QBasic sets the first byte of a file as 1 instead of zero. This bitmap image information is identical to a bitmap image header's last 40 bytes, but the height is doubled.
::* The [[LONG]] header size is always 40 bytes. This can be used to verify the start position of the header.
::* The [[LONG]] image width should be the same as the Entry header width.

View file

@ -197,7 +197,7 @@ DnNum:
COLOR 11: LOCATE 11, 26: PRINT "Down number pad "
{{Cl|RETURN}} '' ''
{{CodeEnd}}
: ''Explanation:'' The Number Lock or Caps Lock keys ON may hinder extended key reads in Qbasic but not QB64!
: ''Explanation:'' The Number Lock or Caps Lock keys ON may hinder extended key reads in QBasic but not QB64!
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>

View file

@ -20,7 +20,7 @@ The [[KILL]] statement deletes a file designated by a [[STRING]] value or variab
{{PageExamples}}
{{CodeStart}}
KILL "C:\Qbasic\data\2000data.dat"
KILL "C:\QBasic\data\2000data.dat"
{{CodeEnd}}

View file

@ -279,8 +279,8 @@ __NOTOC__
* [[_OPENCLIENT]] (TCP/IP function) {{text|connects to a Host on the Internet as a Client and returns the Client status handle.}}
* [[_OPENCONNECTION]] (TCP/IP function) {{text|open's a connection from a client that the host has detected and returns a status handle.}}
* [[_OPENHOST]] (TCP/IP function) {{text|opens a Host and returns a Host status handle.}}
* [[OPTION _EXPLICIT]] (precompiler directive) {{text|instructs the compiler to require variable declaration with [[DIM]] or an equivalent statement.}}
* [[OPTION _EXPLICITARRAY]] (precompiler directive) {{text|instructs the compiler to require array declaration with [[DIM]] or an equivalent statement.}}
* [[OPTION _EXPLICIT]] (precompiler statement) {{text|instructs the compiler to require variable declaration with [[DIM]] or an equivalent statement.}}
* [[OPTION _EXPLICITARRAY]] (precompiler statement) {{text|instructs the compiler to require array declaration with [[DIM]] or an equivalent statement.}}
* [[_OS$]] (function) {{text|returns the QB64 compiler version in which the program was compiled as [WINDOWS], [LINUX] or [MACOSX] and [32BIT] or [64BIT].}}
@ -668,7 +668,7 @@ __NOTOC__
* [[ON...GOTO]] (statement) {{text|sets up a numerical event procedure call.}}
* [[OPEN]] (file statement) {{text|opens a file name for an access mode with a specific file number.}}
* [[OPEN COM]] (statement) {{text|opens a serial communication port for access at a certain speed and mode.}}
* [[OPTION BASE]] (statement) {{text|can set the lower boundary of all arrays to 1.}}
* [[OPTION BASE]] (precompiler statement) {{text|can set the lower boundary of all arrays to 1.}}
* [[OR]] (logic operator) {{text|is used to compare two numerical values bitwise.}}
* [[OR (boolean)]] {{text| conditonal operator is used to include an alternative evaluation in an [[IF...THEN]] or [[Boolean]] statement.}}
* [[OUT]] (statement) {{text|writes numerical data to a specified register port.}}

View file

@ -23,7 +23,7 @@
* [[$DYNAMIC]] (metacommand) {{text|defines that all arrays are dynamic or changeable in size.}}
* [[ERASE]] (array statement) {{text|clears a [[STATIC|static]] array of all values and totally removes a [[$DYNAMIC|dynamic]] array.}}
* [[LBOUND]] (array function) {{text|returns the lowest valid index (lower boundary) of an [[arrays|array]].}}
* [[OPTION BASE]] (statement) {{text|sets the default starting index of an array to 0 or 1.}}
* [[OPTION BASE]] (precompiler statement) {{text|sets the default starting index of an array to 0 or 1.}}
* [[OPTION _EXPLICIT]] (precompiler directive) {{text|instructs the compiler to require variable declaration with [[DIM]] or an equivalent statement.}}
* [[OPTION _EXPLICITARRAY]] (precompiler directive) {{text|instructs the compiler to require array declaration with [[DIM]] or an equivalent statement.}}
* [[REDIM]] (statement) {{text|re-dimensions the number of elements in a [[$DYNAMIC|dynamic]](resizeable) [[arrays|array]] and defines the type.}}
@ -144,7 +144,7 @@
* [[DOUBLE]] {# numerical [[TYPE|type]]) {{text|an 8 byte floating decimal variable type with numerical values up to 15 decimal places.}}
* [[INTEGER]] {% numerical [[TYPE|type]]) {{text|a two byte variable type with values from -32768 to 32767. [[_UNSIGNED|Unsigned]] to 65535.}}
* [[LONG]] {& numerical [[TYPE|type]]) {{text|Integer values can be from -2147483648 to 2147483647. [[_UNSIGNED]] values to 4294967295.}}
* [[OPTION BASE]] (statement) {{text|sets the default starting index of an [[arrays|array]] to 0 or 1.}}
* [[OPTION BASE]] (precompiler statement) {{text|sets the default starting index of an [[arrays|array]] to 0 or 1.}}
* [[OPTION _EXPLICIT]] (precompiler directive) {{text|instructs the compiler to require variable declaration with [[DIM]] or an equivalent statement.}}
* [[OPTION _EXPLICITARRAY]] (precompiler directive) {{text|instructs the compiler to require array declaration with [[DIM]] or an equivalent statement.}}
* [[REDIM]] {{text|defines and sizes a [[$DYNAMIC|dynamic]](changeable) array and can define the type of value returned.}}
@ -260,7 +260,7 @@ The following table describes the error codes that are reported by the '''QB64''
|-
| 33 || Duplicate label || Line numbers or labels cannot be used twice in a procedure. || none
|-
| 35 || Subprogram not defined. || Often occurs when the Quickbasic Library is not used with [[CALL ABSOLUTE]] or [[INTERRUPT]] or a [[SUB]] or [[FUNCTION]] procedure has not been created for a [[CALL]]. || none
| 35 || Subprogram not defined. || Often occurs when the QuickBASIC Library is not used with [[CALL ABSOLUTE]] or [[INTERRUPT]] or a [[SUB]] or [[FUNCTION]] procedure has not been created for a [[CALL]]. || none
|-
| 37 || Argument-count mismatch || The number of sub-procedure [[parameters]] do not match the call. || none
|-
@ -296,7 +296,7 @@ The following table describes the error codes that are reported by the '''QB64''
|-
| 64 || Bad file name || File name contains illegal characters or exceeds 12 characters. || none
|-
| 67 || Too many files || Over 15 files are open in Qbasic. || none
| 67 || Too many files || Over 15 files are open in QBasic. || none
|-
| 68 || Device unavailable. || Device does not exist, busy or not connected. || none
|-
@ -921,7 +921,7 @@ The following table describes the error codes that are reported by the '''QB64''
== Sub procedures and Functions ==
<center>'''Qbasic and QB64'''</center>
<center>'''QBasic and QB64'''</center>
* [[CALL]] (statement) {{text|sends code execution to a [[SUB]] procedure in a program. Parameter brackets are required when used.}}
* [[CALL ABSOLUTE|CALL ABSOLUTE]] (statement) {{text|used to access Interrupts on the computer or execute assembly type procedures.}}
* [[CHAIN]] (statement) {{text|changes seamlessly from one program module to another.}}
@ -1083,10 +1083,10 @@ The following table describes the error codes that are reported by the '''QB64''
:'''Program Code Markers'''
* [[Apostrophe|' Apostrophe]] denotes a program comment, to ignore a code line or a Qbasic [[Metacommand]]. Same as using [[REM]].
* [[Apostrophe|' Apostrophe]] denotes a program comment, to ignore a code line or a QBasic [[Metacommand]]. Same as using [[REM]].
* [[Comma|, Comma]] is a statement variable or [[DATA]], [[SUB]] or [[FUNCTION]] parameter separator.
* [[Colon|: Colon]]s can be used to separate two procedure statements on one code line.
* [[Dollar_Sign|$ Dollar sign]] prefix denotes a Qbasic [[Metacommand]]. Only '''QB64''''s event [[$CHECKING]] should NOT be commented.
* [[Dollar_Sign|$ Dollar sign]] prefix denotes a QBasic [[Metacommand]]. Only '''QB64''''s event [[$CHECKING]] should NOT be commented.
* [[Parenthesis|( ) Parenthesis]] enclose a math or conditional procedure order, [[SUB]] or [[FUNCTION]] parameters or to pass by value.
* [[+|+ Plus]] [[concatenation]] operator MUST be used to combine literal string values in a variable definition.
* [[Quotation mark|" Quotation mark]] delimits the ends of a literal [[STRING]] value. Use [[CHR$]](34) to insert quotes in a text [[STRING]].

View file

@ -18,7 +18,7 @@ The [[LOCK]] statement restricts access to parts of a file by other programs or
* [[Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions|Keyword not supported in Linux or macOS versions]]
==QBasic/QuickBasic==
==QBasic/QuickBASIC==
* Required DOS '''SHARED.EXE''' to be run for QBasic to use networking access modes. No longer required.

View file

@ -13,6 +13,7 @@ The [[LPRINT]] statement sends string text or numerical values to a parallel por
* [[LPRINT USING]] can print formatted text data to a page identically to how [[PRINT USING]] formats a program screen.
* [[COLOR]]ed text and images can be printed using [[_PRINTIMAGE]] which stretches them to fit the default printer's paper size.
* LPRINT will only print to the default USB or LPT printer set up in Windows. '''[[Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions|Keyword Not Supported in Linux or MAC versions]]'''
** To print in Linux, see [[Connecting to printer via TCP/IP]].
* Note: Printer ''escape codes'' starting with [[CHR$]](27) will not work with LPRINT and may produce text printing errors.

View file

@ -24,7 +24,7 @@ The [[MOD]] operator gives the remainder after division of one number by another
{{CodeStart}}
I% = 100 {{Cl|\}} 9
R% = 100 {{Cl|MOD}} 9
PRINT "Integer division ="; I%, "Remainder ="; R%
{{Cl|PRINT}} "Integer division ="; I%, "Remainder ="; R%
{{CodeEnd}}
{{OutputStart}}
Integer division = 11 Remainder = 1 '' ''
@ -38,27 +38,27 @@ The [[MOD]] operator gives the remainder after division of one number by another
tmp1$ = " Normal: ####.# / #### = ##.### "
tmp2$ = " Integer: ####.# \ #### = ### "
tmp3$ = " Remainder: ####.# MOD #### = #### "
FOR i = 1 TO 6
SELECT CASE i
CASE 1: numerator = 1: divisor = 5
CASE 2: numerator = 13: divisor = 10
CASE 3: numerator = 990: divisor = 100
CASE 4: numerator = 1100: divisor = 100
CASE 5: numerator = 4501: divisor = 1000
CASE 6: numerator = 50.6: divisor = 10
END SELECT
LOCATE 5, 20: PRINT USING tmp1$; numerator; divisor; numerator / divisor
LOCATE 7, 20: PRINT USING tmp2$; numerator; divisor; numerator \ divisor
LOCATE 9, 20: PRINT USING tmp3$; numerator; divisor; numerator MOD divisor
DO: SLEEP: LOOP UNTIL INKEY$ <> ""
NEXT '' ''
{{Cl|FOR}} i = 1 {{Cl|TO}} 6
{{Cl|SELECT CASE}} i
{{Cl|CASE}} 1: numerator = 1: divisor = 5
{{Cl|CASE}} 2: numerator = 13: divisor = 10
{{Cl|CASE}} 3: numerator = 990: divisor = 100
{{Cl|CASE}} 4: numerator = 1100: divisor = 100
{{Cl|CASE}} 5: numerator = 4501: divisor = 1000
{{Cl|CASE}} 6: numerator = 50.6: divisor = 10
{{Cl|END SELECT}}
{{Cl|LOCATE}} 5, 20: {{Cl|PRINT USING}} tmp1$; numerator; divisor; numerator / divisor
{{Cl|LOCATE}} 7, 20: {{Cl|PRINT USING}} tmp2$; numerator; divisor; numerator \ divisor
{{Cl|LOCATE}} 9, 20: {{Cl|PRINT USING}} tmp3$; numerator; divisor; numerator {{Cl|MOD}} divisor
{{Cl|DO}}: {{Cl|SLEEP}}: {{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} <> ""
{{Cl|NEXT}} '' ''
{{CodeEnd}}
''Example 3:'' Integer division and MOD can be used to convert values to different base numbering systems from base 2 to 36 as [[STRING|strings]]:
{{CodeStart}} '' ''
{{Cl|CLS}}
DO
{{Cl|DO}}
{{Cl|INPUT}} "Enter a base number system 2 to 36: ", b%
{{Cl|IF...THEN|IF}} b% < 2 {{Cl|OR (boolean)|OR}} b% > 36 {{Cl|THEN}} {{Cl|EXIT DO}}
{{Cl|PRINT}} "Enter a positive value to convert: ";
@ -78,7 +78,7 @@ DO
{{Cl|FUNCTION}} BASEN$ (number&, basenum%)
{{Cl|IF...THEN|IF}} basenum% < 2 {{Cl|OR (boolean)|OR}} basenum% > 36 {{Cl|OR (boolean)|OR}} number& = 0 {{Cl|THEN}} {{Cl|EXIT FUNCTION}}
num& = number& 'protect value of number!
DO
{{Cl|DO}}
remain% = {{Cl|ABS}}(num&) {{Cl|MOD}} basenum% ' remainder is used to create actual digit 0 to Z
num& = num& \ basenum% ' move up one exponent of base% with integer division
{{Cl|IF...THEN|IF}} remain% > 9 {{Cl|THEN}}

View file

@ -3,7 +3,7 @@
|}
==Basic and QB64 Numerical Types==
<center>'''Qbasic Number Types'''</center>
<center>'''QBasic Number Types'''</center>
* [[INTEGER]] ['''%''']: 2 Byte signed whole number values from -32768 to 32767. 0 to 65535 unsigned. (not checked in QB64)
* [[LONG]] ['''&''']: 4 byte signed whole number values from -2147483648 to 2147483647. 0 to 4294967295 unsigned.
@ -18,7 +18,7 @@
* [[_BYTE]] ['''%%''']: 1 byte signed whole number values from -128 to 127. Unsigned values from 0 to 255.
* [[_INTEGER64]] ['''&&''']: 8 byte signed whole number values from -9223372036854775808 to 9223372036854775807
* [[_FLOAT]] [##]: currently set as 10 byte signed floating decimal point values up to 1.1897E+4932. '''Cannot be unsigned.'''
* [[_OFFSET]] [%&]: undefined flexable length integer offset values used in [[DECLARE DYNAMIC LIBRARY]] declarations.
* [[_OFFSET]] [%&]: undefined flexible length integer offset values used in [[DECLARE DYNAMIC LIBRARY]] declarations.
<center>'''Signed and Unsigned Integer Values'''</center>
@ -36,7 +36,7 @@ Negative (signed) numerical values can affect calculations when using any of the
<center>[[#toc|Return to Top]]</center>
==Mathematical Operation Symbols==
Most of the BASIC math operators are ones that require no introduction. The addition, subtraction, multplication and division operators are ones commonly used as shown below:
Most of the BASIC math operators are ones that require no introduction. The addition, subtraction, multiplication and division operators are ones commonly used as shown below:
{| class="wikitable"
! Symbol !! Procedure Type !! Example Usage !! Operation Order
@ -129,24 +129,27 @@ Sometimes a calculation may need BASIC to do them in another order or the calcul
<center> '''* angles measured in radians'''</center>
{{TextStart}} '''Degree to Radian Conversion:'''
FUNCTION Radian (degrees)
Radian = degrees * (4 * {{Cb|ATN}}(1)) / 180
END FUNCTION '' ''
''Example:'' Degree to Radian Conversion.
{{CodeStart}} '' ''
{{Cl|FUNCTION}} Radian (degrees)
Radian = degrees * (4 * {{Cl|ATN}}(1)) / 180
{{Cl|END FUNCTION}} '' ''
FUNCTION Degree (radians)
Degree = radians * 180 / (4 * {{Cb|ATN}}(1))
END FUNCTION
{{Cl|FUNCTION}} Degree (radians)
Degree = radians * 180 / (4 * {{Cl|ATN}}(1))
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
'''Logarithm to base n'''
FUNCTION LOGN (X, n)
IF n > 0 AND n <> 1 AND X > 0 THEN LOGN = {{Cb|LOG}}(X) / {{Cb|LOG}}(n) ELSE BEEP
END FUNCTION '' ''
''Example:'' Logarithm to base n.
{{CodeStart}} '' ''
{{Cl|FUNCTION}} LOGN (X, n)
{{Cl|IF}} n > 0 {{Cl|AND}} n <> 1 {{Cl|AND}} X > 0 {{Cl|THEN}} LOGN = {{Cl|LOG}}(X) / {{Cl|LOG}}(n) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
FUNCTION LOG10 (X) 'base 10 logarithm
IF X > 0 THEN LOG10 = {{Cb|LOG}}(X) / {{Cb|LOG}}(10) ELSE BEEP
END FUNCTION '' ''
{{TextEnd}}
{{Cl|FUNCTION}} LOG10 (X) 'base 10 logarithm
{{Cl|IF}} X > 0 {{Cl|THEN}} LOG10 = {{Cl|LOG}}(X) / {{Cl|LOG}}(10) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
<center>'''The numerical value of n in the [[LOG]](n) evaluation must be a positive value.'''</center>
@ -164,102 +167,107 @@ END FUNCTION '' ''
The following Trigonometric functions can be derived from the '''BASIC Mathematical Functions''' listed above. Each function checks that certain values can be used without error or a [[BEEP]] will notify the user that a value could not be returned. An error handling routine can be substituted if desired. '''Note:''' Functions requiring '''π''' use 4 * [[ATN]](1) for [[SINGLE]] accuracy. Use [[ATN]](1.#) for [[DOUBLE]] accuracy.
{{TextStart}}'' ''
FUNCTION SEC (x) 'Secant
IF COS(x) <> 0 THEN SEC = 1 / {{Cb|COS}}(x) ELSE BEEP
END FUNCTION
{{CodeStart}}'' ''
{{Cl|FUNCTION}} SEC (x) 'Secant
{{Cl|IF}} COS(x) <> 0 {{Cl|THEN}} SEC = 1 / {{Cl|COS}}(x) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION CSC (x) 'CoSecant
IF SIN(x) <> 0 THEN CSC = 1 / {{Cb|SIN}}(x) ELSE BEEP
END FUNCTION
{{Cl|FUNCTION}} CSC (x) 'CoSecant
{{Cl|IF}} SIN(x) <> 0 {{Cl|THEN}} CSC = 1 / {{Cl|SIN}}(x) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION COT (x) 'CoTangent
IF TAN(x) <> 0 THEN COT = 1 / {{Cb|TAN}}(x) ELSE BEEP
END FUNCTION
{{Cl|FUNCTION}} COT (x) 'CoTangent
{{Cl|IF}} TAN(x) <> 0 {{Cl|THEN}} COT = 1 / {{Cl|TAN}}(x) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION ARCSIN (x) 'Inverse Sine
IF x < 1 THEN ARCSIN = {{Cb|ATN}}(x / {{Cb|SQR}}(1 - (x * x))) ELSE BEEP
END FUNCTION
{{Cl|FUNCTION}} ARCSIN (x) 'Inverse Sine
{{Cl|IF}} x < 1 {{Cl|THEN}} ARCSIN = {{Cl|ATN}}(x / {{Cl|SQR}}(1 - (x * x))) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION ARCCOS (x) ' Inverse Cosine
IF x < 1 THEN ARCCOS = (2 * ATN(1)) - {{Cb|ATN}}(x / {{Cb|SQR}}(1 - x * x)) ELSE BEEP
END FUNCTION
{{Cl|FUNCTION}} ARCCOS (x) ' Inverse Cosine
{{Cl|IF}} x < 1 {{Cl|THEN}} ARCCOS = (2 * {{Cl|ATN}}(1)) - {{Cl|ATN}}(x / {{Cl|SQR}}(1 - x * x)) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION ARCSEC (x) ' Inverse Secant
IF x < 1 THEN ARCSEC = {{Cb|ATN}}(x / {{Cb|SQR}}(1 - x * x)) + ({{Cb|SGN}}(x) - 1) * (2 * ATN(1)) ELSE BEEP
END FUNCTION
{{Cl|FUNCTION}} ARCSEC (x) ' Inverse Secant
{{Cl|IF}} x < 1 {{Cl|THEN}} ARCSEC = {{Cl|ATN}}(x / {{Cl|SQR}}(1 - x * x)) + ({{Cl|SGN}}(x) - 1) * (2 * ATN(1)) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION ARCCSC (x) ' Inverse CoSecant
IF x < 1 THEN ARCCSC = ATN(1 / SQR(1 - x * x)) + (SGN(x)-1) * (2 * ATN(1)) ELSE BEEP
END FUNCTION
{{Cl|FUNCTION}} ARCCSC (x) ' Inverse CoSecant
{{Cl|IF}} x < 1 {{Cl|THEN}} ARCCSC = {{Cl|ATN}}(1 / {{Cl|SQR}}(1 - x * x)) + ({{Cl|SGN}}(x)-1) * (2 * {{Cl|ATN}}(1)) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION ARCCOT (x) ' Inverse CoTangent
ARCCOT = (2 * {{Cb|ATN}}(1)) - {{Cb|ATN}}(x)
END FUNCTION '' ''
{{Cl|FUNCTION}} ARCCOT (x) ' Inverse CoTangent
ARCCOT = (2 * {{Cl|ATN}}(1)) - {{Cl|ATN}}(x)
{{Cl|END FUNCTION}} '' ''
FUNCTION SINH (x) ' Hyperbolic Sine
IF x <= 88.02969 THEN SINH = ({{Cb|EXP}}(x) - {{Cb|EXP}}(-x)) / 2 ELSE BEEP
END FUNCTION '' ''
{{Cl|FUNCTION}} SINH (x) ' Hyperbolic Sine
{{Cl|IF}} x <= 88.02969 {{Cl|THEN}} SINH = ({{Cl|EXP}}(x) - {{Cl|EXP}}(-x)) / 2 {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
FUNCTION COSH (x) ' Hyperbolic CoSine
IF x <= 88.02969 THEN COSH = (EXP(x) + EXP(-x)) / 2 ELSE BEEP
END FUNCTION '' ''
{{Cl|FUNCTION}} COSH (x) ' Hyperbolic CoSine
{{Cl|IF}} x <= 88.02969 {{Cl|THEN}} COSH = ({{Cl|EXP}}(x) + {{Cl|EXP}}(-x)) / 2 {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
FUNCTION TANH (x) ' Hyperbolic Tangent or SINH(x) / COSH(x)
IF 2 * x <= 88.02969 AND EXP(2 * x) + 1 <> 0 THEN
TANH = ({{Cb|EXP}}(2 * x) - 1) / ({{Cb|EXP}}(2 * x) + 1)
ELSE BEEP
END IF
END FUNCTION '' ''
{{Cl|FUNCTION}} TANH (x) ' Hyperbolic Tangent or SINH(x) / COSH(x)
{{Cl|IF}} 2 * x <= 88.02969 {{Cl|AND}} {{Cl|EXP}}(2 * x) + 1 <> 0 {{Cl|THEN}}
TANH = ({{Cl|EXP}}(2 * x) - 1) / ({{Cl|EXP}}(2 * x) + 1)
{{Cl|ELSE}}
{{Cl|BEEP}}
{{Cl|END IF}}
{{Cl|END FUNCTION}} '' ''
FUNCTION SECH (x) ' Hyperbolic Secant or (COSH(x)) ^ -1
IF x <= 88.02969 AND (EXP(x) + EXP(-x)) <> 0 THEN SECH = 2 / ({{Cb|EXP}}(x) + {{Cb|EXP}}(-x)) ELSE BEEP
END FUNCTION '' ''
{{Cl|FUNCTION}} SECH (x) ' Hyperbolic Secant or (COSH(x)) ^ -1
{{Cl|IF}} x <= 88.02969 {{Cl|AND}} ({{Cl|EXP}}(x) + {{Cl|EXP}}(-x)) <> 0 {{Cl|THEN}} SECH = 2 / ({{Cl|EXP}}(x) + {{Cl|EXP}}(-x)) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
FUNCTION CSCH (x) ' Hyperbolic CoSecant or (SINH(x)) ^ -1
IF x <= 88.02969 AND (EXP(x) - EXP(-x)) <> 0 THEN CSCH = 2 / ({{Cb|EXP}}(x) - {{Cb|EXP}}(-x)) ELSE BEEP
END FUNCTION '' ''
{{Cl|FUNCTION}} CSCH (x) ' Hyperbolic CoSecant or (SINH(x)) ^ -1
{{Cl|IF}} x <= 88.02969 {{Cl|AND}} ({{Cl|EXP}}(x) - {{Cl|EXP}}(-x)) <> 0 {{Cl|THEN}} CSCH = 2 / ({{Cl|EXP}}(x) - {{Cl|EXP}}(-x)) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
FUNCTION COTH (x) ' Hyperbolic CoTangent or COSH(x) / SINH(x)
IF 2 * x <= 88.02969 AND EXP(2 * x) - 1 <> 0 THEN
COTH = ({{Cb|EXP}}(2 * x) + 1) / ({{Cb|EXP}}(2 * x) - 1)
ELSE BEEP
END IF
END FUNCTION '' ''
{{Cl|FUNCTION}} COTH (x) ' Hyperbolic CoTangent or COSH(x) / SINH(x)
{{Cl|IF}} 2 * x <= 88.02969 {{Cl|AND}} {{Cl|EXP}}(2 * x) - 1 <> 0 {{Cl|THEN}}
COTH = ({{Cl|EXP}}(2 * x) + 1) / ({{Cl|EXP}}(2 * x) - 1)
{{Cl|ELSE}}
{{Cl|BEEP}}
{{Cl|END IF}}
{{Cl|END FUNCTION}} '' ''
FUNCTION ARCSINH (x) ' Inverse Hyperbolic Sine
IF (x * x) + 1 >= 0 AND x + SQR((x * x) + 1) > 0 THEN
ARCSINH = {{Cb|LOG}}(x + {{Cb|SQR}}(x * x + 1))
ELSE BEEP
END IF
END FUNCTION '' ''
{{Cl|FUNCTION}} ARCSINH (x) ' Inverse Hyperbolic Sine
{{Cl|IF}} (x * x) + 1 >= 0 {{Cl|AND}} x + {{Cl|SQR}}((x * x) + 1) > 0 {{Cl|THEN}}
ARCSINH = {{Cl|LOG}}(x + {{Cl|SQR}}(x * x + 1))
{{Cl|ELSE}}
{{Cl|BEEP}}
{{Cl|END IF}}
{{Cl|END FUNCTION}} '' ''
FUNCTION ARCCOSH (x) ' Inverse Hyperbolic CoSine
IF x >= 1 AND x * x - 1 >= 0 AND x + SQR(x * x - 1) > 0 THEN
ARCCOSH = {{Cb|LOG}}(x + {{Cb|SQR}}(x * x - 1))
ELSE BEEP
END IF
END FUNCTION '' ''
{{Cl|FUNCTION}} ARCCOSH (x) ' Inverse Hyperbolic CoSine
{{Cl|IF}} x >= 1 {{Cl|AND}} x * x - 1 >= 0 {{Cl|AND}} x + {{Cl|SQR}}(x * x - 1) > 0 {{Cl|THEN}}
ARCCOSH = {{Cl|LOG}}(x + {{Cl|SQR}}(x * x - 1))
{{Cl|ELSE}}
{{Cl|BEEP}}
{{Cl|END IF}}
{{Cl|END FUNCTION}} '' ''
FUNCTION ARCTANH (x) ' Inverse Hyperbolic Tangent
IF x < 1 THEN ARCTANH = {{Cb|LOG}}((1 + x) / (1 - x)) / 2 ELSE BEEP
END FUNCTION
{{Cl|FUNCTION}} ARCTANH (x) ' Inverse Hyperbolic Tangent
{{Cl|IF}} x < 1 {{Cl|THEN}} ARCTANH = {{Cl|LOG}}((1 + x) / (1 - x)) / 2 {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}}
FUNCTION ARCSECH (x) ' Inverse Hyperbolic Secant
IF x > 0 AND x <= 1 THEN ARCSECH = {{Cb|LOG}}(({{Cb|SGN}}(x) * {{Cb|SQR}}(1 - x * x) + 1) / x) ELSE BEEP
END FUNCTION '' ''
{{Cl|FUNCTION}} ARCSECH (x) ' Inverse Hyperbolic Secant
{{Cl|IF}} x > 0 {{Cl|AND}} x <= 1 {{Cl|THEN}} ARCSECH = {{Cl|LOG}}(({{Cl|SGN}}(x) * {{Cl|SQR}}(1 - x * x) + 1) / x) {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
FUNCTION ARCCSCH (x) ' Inverse Hyperbolic CoSecant
IF x <> 0 AND x * x + 1 >= 0 AND (SGN(x) * SQR(x * x + 1) + 1) / x > 0 THEN
ARCCSCH = {{Cb|LOG}}(({{Cb|SGN}}(x) * {{Cb|SQR}}(x * x + 1) + 1) / x)
ELSE BEEP
END IF
END FUNCTION '' ''
{{Cl|FUNCTION}} ARCCSCH (x) ' Inverse Hyperbolic CoSecant
{{Cl|IF}} x <> 0 {{Cl|AND}} x * x + 1 >= 0 {{Cl|AND}} ({{Cl|SGN}}(x) * {{Cl|SQR}}(x * x + 1) + 1) / x > 0 {{Cl|THEN}}
ARCCSCH = {{Cl|LOG}}(({{Cl|SGN}}(x) * {{Cl|SQR}}(x * x + 1) + 1) / x)
{{Cl|ELSE}}
{{Cl|BEEP}}
{{Cl|END IF}}
{{Cl|END FUNCTION}} '' ''
FUNCTION ARCCOTH (x) ' Inverse Hyperbolic CoTangent
IF x > 1 THEN ARCCOTH = {{Cb|LOG}}((x + 1) / (x - 1)) / 2 ELSE BEEP
END FUNCTION '' ''
{{TextEnd}}
{{Cl|FUNCTION}} ARCCOTH (x) ' Inverse Hyperbolic CoTangent
{{Cl|IF}} x > 1 {{Cl|THEN}} ARCCOTH = {{Cl|LOG}}((x + 1) / (x - 1)) / 2 {{Cl|ELSE}} {{Cl|BEEP}}
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
{{WhiteStart}}
'''Hyperbolic Function Relationships:'''

View file

@ -10,9 +10,9 @@
:REM [[$STATIC]] 'arrays cannot be resized once dimensioned
===Description===
* QBasic Metacommands are normally used at the program start and are in effect throughout the program.
* QBasic Metacommands are always prefixed with $ and MUST be commented with an apostrophe or [[REM]].
* [[$INCLUDE]] is always followed by a colon and the full text code file name is commented on both sides.
* QBasic metacommands are normally used at the program start and are in effect throughout the program.
* QBasic metacommands are always prefixed with <code>$</code> and MUST be commented with [[apostrophe|']] or [[REM]].
* [[$INCLUDE]] is always followed by a colon and the full filename must be included in single quotes.
* [[$DYNAMIC]] allows larger arrays that are changeable in size at runtime.
* [[$STATIC]] makes all arrays unchangeable in size.
* '''QBasic metacommands should have their own program line because they are commented.'''
@ -20,37 +20,57 @@
==QB64 metacommands==
===Syntax===
:[[$CHECKING]]{OFF|ON} 'disables QB64 C++ event and error checking (no spaces)
:[[$CONSOLE]] 'creates a QB64 console window throughout the program
:[[$ASSERTS]][:CONSOLE] 'enables assertions
:[[$RESIZE]]:{ON|OFF} 'determines if re-sizing of the program screen by the user is allowed(no spaces)
:[[$CHECKING]]:{ON|OFF} 'disables QB64 C++ event and error checking (no spaces)
:[[$COLOR]]:{0|32} 'adds named color constants to the program
:[[$CONSOLE]][:ONLY] 'creates a QB64 console window throughout the program
:[[$ERROR]] message 'triggers a compilation error, useful inside $IF blocks
:[[$EXEICON]]:'iconfile.ico' 'embeds an .ICO file into the final executable (Windows only)
:[[$IF]]...[[$END IF]] 'precompiler conditional directive
:[[$LET]] variable = expression 'defines precompiler flags
:[[$NOPREFIX]] 'allows QB64 keywords without the leading <code>_</code>
:[[$RESIZE]]:{ON|OFF|STRETCH|SMOOTH} 'determines if re-sizing of the program screen by the user is allowed
:[[$SCREENHIDE]] 'hides the QB64 program window throughout the program
:[[$SCREENSHOW]] 'displays the main QB64 program window
:[[$EXEICON]]:'iconfile.ico' 'embeds an .ICO file into the final executable (Windows only)
:[[$VERSIONINFO]]:key=value[, ...] 'embeds version info metadata into the final executable (Windows only)
:[[$VERSIONINFO]]:key=value 'embeds version info metadata into the final executable (Windows only)
:[[$IF]]...[[$END IF]] 'precompiler directive
: [[$ERROR]] MESSAGE 'trigger a compilation error, useful inside $IF blocks
:[[$VIRTUALKEYBOARD]]:{ON|OFF} 'enables the virtual keyboard (Deprecated)
===Description===
* [[$INCLUDE]] can be used at the beginning or at the end of program SUB procedures.
* [[$CHECKING]]:OFF should only be used with '''errorless''' code where every CPU cycle counts! Use '''ON''' to re-enable event checking. Event checking can be turned OFF or ON throughout a program.
* [[$ASSERTS]] enables the [[_ASSERT]] macro.
* [[$CHECKING]] '''OFF''' should only be used with '''errorless''' code where every CPU cycle counts! Use '''ON''' to re-enable event checking. Event checking can be turned OFF or ON throughout a program.
* [[$COLOR]] includes named color constants in a program.
* [[$CONSOLE]] creates a console window which can be turned off later with [[_CONSOLE]] OFF.
* [[$RESIZE]]:ON allows a user to resize the program window. OFF is default.
* [[$SCREENHIDE]] hides the QB64 program window throughout the program until [[$SCREENSHOW]] is used.
* [[$IF]]...[[$END IF]] allows selective inclusion of code in the final program.
* [[$EXEICON]] embeds a designated icon file into the compiled EXE file. (Windows ONLY)
* [[$ERROR]] MESSAGE causes a compilation error whenever QB64 attempts to compile it, displaying MESSAGE to the user. This is useful if inside a $IF block, as the error can be conditional.
* '''Do not comment out with ' or [[REM]] QB64-specific metacommands.'''
* [[$IF]]...[[$END IF]] allows selective inclusion of code in the final program.
* [[$LET]] used to set a flag variable for the precompiler.
* [[$NOPREFIX]] allows all QB64 functions and statements to be used without the leading underscore (_).
* [[$RESIZE]] allows a user to resize the program window. OFF is default.
* [[$SCREENHIDE]] hides the QB64 program window throughout the program until [[$SCREENSHOW]] is used.
* [[$VERSIONINFO]] adds metadata to Windows only binaries for identification purposes across the OS.
* [[$VIRTUALKEYBOARD]] turns the virtual keyboard ON or OFF for use in touch-enabled devices. (DEPRECATED)
* '''Do not comment out with [[apostrophe|']] or [[REM]] QB64-specific metacommands.'''
{{PageSeeAlso}}
* [[OPTION_BASE|OPTION BASE]], [[OPTION_EXPLICIT|OPTION _EXPLICIT]], [[OPTION_EXPLICITARRAY|OPTION _EXPLICITARRAY]]
* [[Statement]], [[Function (explanatory)]]
* [[REM]]
* [[DIM]], [[REDIM]]

View file

@ -22,7 +22,7 @@ The [[OPEN]] statement is used to open a file or [[OPEN_COM|COM]] serial communi
* '''QB64 will allocate 4 bytes of memory for every possible file number up to the highest number used in a program.'''
* {{Parameter|mode}} defaults to RANDOM if the {{Parameter|mode}} or FOR access statement is omitted. (see open modes described below)
* '''Only the {{Parameter|fileName$}}, {{Parameter|fileNumber&}} and LEN = {{Parameter|recordLength}} values can use variable values in the QBasic syntax.'''
* If [[LEN]] = is ommitted, sequential file record sizes default to 512 and [[RANDOM]] to 128 bytes in Qbasic.
* If [[LEN]] = is ommitted, sequential file record sizes default to 512 and [[RANDOM]] to 128 bytes in QBasic.
* {{Parameter|fileName$}} can be up to 255 characters with no limit on file name extension length in '''QB64'''.
* Once a file or port is opened, it can be used in any program procedure using the assigned file number.
* The '''"SCRN:"''' device is supported in '''version 1.000 and up''' (see Example 3).
@ -68,8 +68,8 @@ The [[OPEN]] statement is used to open a file or [[OPEN_COM|COM]] serial communi
''Example 1:'' Function that displays errors and the number of errors in QBasic filenames. Returns 0 when filename is OK.
{{CodeStart}}
file$ = "Hello,~1.mp3" 'example call below
{{Cl|LOCATE}} 20, 30: errors% = CheckName%(file$): {{Cl|COLOR}} 14: {{Cl|PRINT}} " Total Errors ="; errors%
file$ = "Hello,~1.mp3" 'example call below
{{Cl|LOCATE}} 20, 30: errors% = CheckName%(file$): {{Cl|COLOR}} 14: {{Cl|PRINT}} " Total Errors ="; errors%
{{Cl|FUNCTION}} CheckName% (Filename$)
'{{Cl|NOT}}E: Function also displays filename errors so {{Cl|LOCATE}} on screen before call!
@ -101,13 +101,13 @@ The [[OPEN]] statement is used to open a file or [[OPEN_COM|COM]] serial communi
''Example 2:'' When '''OPEN "SCRN:" FOR OUTPUT AS #f''' is used, '''PRINT #f''' will print the text to the screen instead of to a file:
{{CodeStart}} '' ''
f% = {{Cl|FREEFILE}} 'should always be 1 at program start
{{Cl|OPEN}} "SCRN:" {{Cl|FOR...NEXT|FOR}} {{Cl|OUTPUT}} {{Cl|AS}} #f%
{{Cl|OPEN}} "SCRN:" {{Cl|FOR (file statement)|FOR}} {{Cl|OUTPUT}} {{Cl|AS}} #f%
g% = {{Cl|FREEFILE}} 'should always be 2 after 1
{{Cl|OPEN}} "temp.txt" {{Cl|FOR...NEXT|FOR}} {{Cl|OUTPUT}} {{Cl|AS}} #g%
{{Cl|OPEN}} "temp.txt" {{Cl|FOR (file statement)|FOR}} {{Cl|OUTPUT}} {{Cl|AS}} #g%
{{Cl|FOR...NEXT|FOR}} i = 1 {{Cl|TO}} 2
{{Cl|PRINT (file statement)|PRINT}} #i, "Hello World, Screen and File version"
NEXT '' ''
{{Cl|NEXT}} '' ''
{{CodeEnd}}{{small|code by Steve McNeill}}
: ''Note:'' Linux or Mac file names can use a path destination such as ".\SCRN:" to use SCRN: as an actual file name.

View file

@ -35,11 +35,11 @@ Graphic cursor position syntax:
* '''POINT cannot be used in SCREEN 0!''' Use the [[SCREEN (function)|SCREEN]] function to point text character codes and colors in SCREEN 0.
<center>'''POINT in Qbasic Legacy Graphic SCREEN Modes:'''</center>
<center>'''POINT in QBasic Legacy Graphic SCREEN Modes:'''</center>
* The [[INTEGER]] color attributes returned are limited by the number of colors in the legacy SCREEN mode used.
* ''Column'' and ''row'' [[INTEGER]] parameters denote the graphic pixel coordinate to read.
* In '''QB64''' the offscreen or off image value returned is -1. Use IF POINT(x, y) <> -1 THEN...
* In Qbasic the coordinates MUST be on the screen or an [[ERROR Codes|Illegal Function Call error]] will occur.
* In QBasic the coordinates MUST be on the screen or an [[ERROR Codes|Illegal Function Call error]] will occur.
<center>'''POINT in QB64 32 Bit Graphic [[_NEWIMAGE]] or [[_LOADIMAGE]] Modes:'''</center>

View file

@ -11,7 +11,7 @@ As with everything else, this list will be updated to correspond to new progress
==Q: What is QB64?==
A: '''QB64''' is a BASIC compatible Editor and C++ emitter that creates working Executable files from Qbasic BAS files that can be run on 32 or 64 bit PC's using '''Windows''' (XP to 10), '''Linux''' or '''macOS'''. The goal is to be 100% compatible with QuickBasic 4.5 plus add hundreds of new abilities such as program icons and custom sized windows and a great retro Editor with builtin help.
A: '''QB64''' is a BASIC compatible Editor and C++ emitter that creates working Executable files from QBasic BAS files that can be run on 32 or 64 bit PC's using '''Windows''' (XP to 10), '''Linux''' or '''macOS'''. The goal is to be 100% compatible with QuickBASIC 4.5 plus add hundreds of new abilities such as program icons and custom sized windows and a great retro Editor with builtin help.
The '''new keywords''' add some '''new features''' such as playing '''music or sound''' files and instant access to '''32 bit graphics''' file images. Also '''TCP/IP''' internet communication is available to '''download''' files, '''email''' messages over the web or play '''internet games'''. '''DLL Libraries''' can add more programming options and QB64 can access all of the new USB gaming '''controllers''' and '''printers'''.

View file

@ -17,7 +17,7 @@ The '''READ''' statement reads values from a [[DATA]] field and assigns them to
* Use the [[RESTORE]] statement to reread DATA statements from the start, with or without a line label as required.
* [[ACCESS]] READ can be used in an [[OPEN]] statement to limit file access to read only, preserving file data.
* '''WARNING! Do not place DATA fields after [[SUB]] or [[FUNCTION]] procedures! QB64 will FAIL to compile properly!'''
: Qbasic allowed programmers to add DATA fields anywhere because the IDE separated the main code from other procedures.
: QBasic allowed programmers to add DATA fields anywhere because the IDE separated the main code from other procedures.
''Example 1:'' Placing data into an array.
@ -54,7 +54,7 @@ The '''READ''' statement reads values from a [[DATA]] field and assigns them to
------------------------------
DENVER,  COLORADO    80211
{{OutputEnd}}
:''Note:'' String DATA values do not require quotes unless they contain commas, end spaces or Qbasic keywords.
:''Note:'' String DATA values do not require quotes unless they contain commas, end spaces or QBasic keywords.

View file

@ -13,7 +13,7 @@ A {{KW|REDIM}} statement can re-dimension one [[$DYNAMIC|dynamic]](flexible) [[A
* {{Parameter|Array}} is the name of the array to be dimensioned or re-dimensioned.
* {{Parameter|elements}} is the number of elements the array should hold. Use the optional [[TO]] {{Parameter|elements2}} to set a range.
* '''Always use the same array [[TYPE]] suffix ([[AS]] type) or a new array type with the same name may be created.'''
* REDIM cannot change [[$STATIC]] arrays created with a [[DIM]] statement unless the [[$DYNAMIC]] [[Metacommand]] is used.
* REDIM cannot change [[$STATIC]] arrays created with a [[DIM]] statement unless the [[$DYNAMIC]] [[metacommand]] is used.
* To create a dynamic array use the [[$DYNAMIC]] metacommand or use [[REDIM]] rather than [[DIM]] when first creating the array.
* Use REDIM [[_PRESERVE]] to change the range or number of array elements without losing the remaining elements. Data may move up or down to accommodate those boundary changes.
* '''REDIM [[_PRESERVE]] cannot change the number of array dimensions or type.'''
@ -23,7 +23,8 @@ A {{KW|REDIM}} statement can re-dimension one [[$DYNAMIC|dynamic]](flexible) [[A
* When using the '''AS type variable-list''' syntax, type symbols cannot be used.
''Example 1:'' The [[$DYNAMIC]] Metacommand allows an array to be re-sized using [[DIM]] and REDIM.
{{PageExamples}}
''Example 1:'' The [[$DYNAMIC]] metacommand allows an array to be re-sized using [[DIM]] and REDIM.
{{CodeStart}} '' ''
'{{Cl|$DYNAMIC}}

View file

@ -6,10 +6,10 @@
{{PageDescription}}
* Comments cannot be read by Qbasic correctly and may cause syntax and other errors without REM!
* Comments cannot be read by QBasic correctly and may cause syntax and other errors without REM!
* Instead of REM you can use the {{KW|REM|'}} symbol which can be put anywhere.
* Code can also be commented out for program testing purposes.
* Qbasic Metacommands such as {{KW|$DYNAMIC}} and {{KW|$INCLUDE}} require the use of REM or the apostrophe.
* QBasic Metacommands such as {{KW|$DYNAMIC}} and {{KW|$INCLUDE}} require the use of REM or the apostrophe.
''Example:'' Avoiding an END IF error.

View file

@ -12,7 +12,7 @@ The '''RESTORE''' statement is used to reset the DATA pointer to the beginning o
* Use RESTORE to avoid an [[ERROR Codes|"Out of Data" error]] when reading a data field!
* See the [[DATA]] statement for [[STRING]] data value specifications.
* '''Do not place [[DATA]] fields after [[SUB]] or [[FUNCTION]] procedures! QB64 will FAIL to [[RESTORE]] properly!'''
: Qbasic allowed programmers to add DATA fields anywhere because the IDE separated the main code from other procedures.
: QBasic allowed programmers to add DATA fields anywhere because the IDE separated the main code from other procedures.
''Example:'' Restoring a labeled DATA field to avoid going past the end of DATA.
@ -35,7 +35,7 @@ LOOP UNTIL monthnum% < 1 OR monthnum% > 12
Enter a month number(1 to 12): 6
The month June has 30 days.
{{OutputEnd}}
:''Note:'' String DATA values do not require quotes unless they have commas, end spaces or Qbasic keywords in them.
:''Note:'' String DATA values do not require quotes unless they have commas, end spaces or QBasic keywords in them.

View file

@ -11,7 +11,7 @@ The multi-modular technique goes back to when QBasic and QuickBASIC had module s
{{Parameters}}
* ''line number'' specifies a line number in the main module code.
* An optional ''filespec'' specifies a program to load into memory and run.
: * BAS or EXE extensions are assumed to be the same as the calling module's extension, EXE or BAS (Qbasic only).
: * BAS or EXE extensions are assumed to be the same as the calling module's extension, EXE or BAS (QBasic only).
: * ''file names specs'' with other extensions must use the full filename. No extension requires a dot.
* In '''QB64''' ''command line parameters'' can follow the program file name and be read using the [[COMMAND$]] function later.

View file

@ -63,11 +63,11 @@ The [[SCREEN]] statement sets the video display mode and size of the program win
==Legacy Screen Modes==
* '''[[SCREEN]] 0''' (default mode) is a '''text only''' screen mode. 64 (VGA) colors with hi-intensity(blinking) colors 16 to 31. ([[DAC]] attrib 6, 8 to 15). 8 Background colors intensities only(0 - 7). No graphics are possible! Normally runs in a window. ALT-Enter switches from a window to fullscreen. To automatically run in '''Qbasic''' fullscreen, use another Screen mode before using {{KW|SCREEN (statement)|SCREEN}} 0. Can use {{KW|PCOPY}} with video pages 0 to 7. Text is 25, 43 or 50 rows by 40 or 80 columns. Default is 25 by 80. See {{KW|WIDTH}}.
* '''[[SCREEN]] 0''' (default mode) is a '''text only''' screen mode. 64 (VGA) colors with hi-intensity(blinking) colors 16 to 31. ([[DAC]] attrib 6, 8 to 15). 8 Background colors intensities only(0 - 7). No graphics are possible! Normally runs in a window. ALT-Enter switches from a window to fullscreen. To automatically run in '''QBasic''' fullscreen, use another Screen mode before using {{KW|SCREEN (statement)|SCREEN}} 0. Can use {{KW|PCOPY}} with video pages 0 to 7. Text is 25, 43 or 50 rows by 40 or 80 columns. Default is 25 by 80. See {{KW|WIDTH}}.
: '''Note:''' Use [[OUT]] or [[_PALETTECOLOR]] to create higher intensity color backgrounds than [[COLOR]] , 7.
:::'''All other available [[SCREEN]] modes can use text and graphics and are fullscreen in Qbasic ONLY.'''
:::'''All other available [[SCREEN]] modes can use text and graphics and are fullscreen in QBasic ONLY.'''
* '''[[SCREEN]] 1''' has 4 background color attributes. 0 = black, 1 = blue, 2 = green, 3 = grey. White foreground only. Text is 25 by 40. White graphics is 320 by 200.
@ -114,7 +114,7 @@ The [[SCREEN]] statement sets the video display mode and size of the program win
* The minimum on screen graphics pixel coordinates are 0 for columns and rows in the top left corner.
* Maximum pixel coordinates are one less than the maximum dimensions above because the pixel count starts at 0.
* Graphic objects such as [[PSET]], [[PRESET]], [[LINE]], [[CIRCLE]] and [[DRAW]] can be placed partially off of the screen.
* [[GET (graphics statement)|GET]] and [[PUT (graphics statement)|PUT]] screen image operations MUST be located completely on the screen in Qbasic!
* [[GET (graphics statement)|GET]] and [[PUT (graphics statement)|PUT]] screen image operations MUST be located completely on the screen in QBasic!
* [[VIEW]] can be used to designate a graphic view port area of the screen.
* [[WINDOW]] can be used to set the graphics SCREEN coordinates to almost any size needed. Use the SCREEN option for normal row coordinate values. Row coordinates are Cartesian(decrease in value going down the screen) otherwise.
* In '''QB64''' the [[_WIDTH (function)|_WIDTH]] and [[_HEIGHT]] functions will return the graphic pixel dimensions in SCREENs other than 0.
@ -134,7 +134,7 @@ The [[SCREEN]] statement sets the video display mode and size of the program win
==Examples==
:''Example 1:'' Shows an example of each legacy screen mode available to Qbasic and QB64.
:''Example 1:'' Shows an example of each legacy screen mode available to QBasic and QB64.
{{CodeStart}} '' ''
{{Cl|SCREEN}} 0
{{Cl|PRINT}} "This is {{Cl|SCREEN}} 0 - only text is allowed!"

View file

@ -17,7 +17,7 @@ The '''SCREEN''' function returns the [[ASCII]] code of a text character or the
* When the ''flag'' value is greater than 0 in '''SCREEN 0''', the function returns the foreground and background color attribute of text position.
:: * The foreground color(0 to 15) is the returned SCREEN color value AND 15: '''{{text|FG <nowiki>=</nowiki> SCREEN(1, 1, 1) AND 15|green}}'''
:: * The background color(0 to 7) is the returned SCREEN color value \ 16: '''{{text|BG <nowiki>=</nowiki> SCREEN(1, 1, 1) \ 16|green}}'''
* '''QB64''' can return color values in screen modes other than [[SCREEN]] 0. Qbasic returned the wrong color values in graphic screen modes!
* '''QB64''' can return color values in screen modes other than [[SCREEN]] 0. QBasic returned the wrong color values in graphic screen modes!
''Example 1:'' Finding the text foreground and background colors in SCREEN 0 only:
@ -37,7 +37,7 @@ The '''SCREEN''' function returns the [[ASCII]] code of a text character or the
: ''Note:'' How the SCREEN 0 background color can only be changed to colors 0 through 7! 7 * 16 = 112.
''Example 2:'' Reading the [[ASCII]] code and color of a text character using the SCREEN function. Graphic colors were not reliable in Qbasic!
''Example 2:'' Reading the [[ASCII]] code and color of a text character using the SCREEN function. Graphic colors were not reliable in QBasic!
{{CodeStart}} '' ''
{{Cl|SCREEN (statement)|SCREEN}} 12
row = 10: column = 10

View file

@ -33,9 +33,10 @@ The [[SHELL]] statement allows a program to run external programs or command lin
{{Cl|SHELL}} {{Cl|_HIDE}} "dir " + {{Cl|CHR$}}(34) + "free cell.ico" + {{Cl|CHR$}}(34) + " /b > temp.dir" '' ''
{{Cl|SHELL}} "start Notepad temp.dir" ' display temp file contents in Notepad window '' ''
{{CodeEnd}}
:{{small|Contents of ''temp.dir'' text file:}}
{{TextStart}}Free Cell.ico
{{TextEnd}}
:Contents of ''temp.dir'' text file:
{{OutputStart}}
Free Cell.ico
{{OutputEnd}}
''Example 2:'' Opening a Windows program (Notepad) to read or print a Basic created text file.
@ -57,20 +58,20 @@ The [[SHELL]] statement allows a program to run external programs or command lin
''Example 3:'' Function that returns the program's current working path.
{{CodeStart}}
currentpath$ = Path$ ' function call saves a path for later program use
PRINT currentpath$
{{Cl|PRINT}} currentpath$
{{Cl|FUNCTION}} Path$
{{Cl|SHELL}} {{Cl|_HIDE}} "CD > D0S-DATA.INF" 'code to hide window in '''QB64'''
{{Cl|OPEN}} "D0S-DATA.INF" FOR {{Cl|APPEND}} AS #1 'this may create the file
{{Cl|SHELL}} {{Cl|_HIDE}} "CD > D0S-DATA.INF" 'code to hide window in '''QB64'''
{{Cl|OPEN}} "D0S-DATA.INF" {{Cl|FOR (file statement)|FOR}} {{Cl|APPEND}} {{Cl|AS}} #1 'this may create the file
L% = {{Cl|LOF}}(1) 'verify that file and data exist
{{Cl|CLOSE}} #1
{{Cl|IF}} L% {{Cl|THEN}} 'read file if it has data
{{Cl|OPEN}} "D0S-DATA.INF" FOR {{Cl|INPUT (file mode)|INPUT}} AS #1
{{Cl|OPEN}} "DOS-DATA.INF" {{Cl|FOR (file statement)|FOR}} {{Cl|INPUT (file mode)|INPUT}} {{Cl|AS}} #1
{{Cl|LINE INPUT (file statement)|LINE INPUT}} #1, line$ 'read only line in file
Path$ = line$ + "\" 'add slash to path so only a filename needs added later
{{Cl|CLOSE}} #1
{{Cl|ELSE}} : Path = "" 'returns zero length string if path not found
END IF
{{Cl|END IF}}
{{Cl|KILL}} "D0S-DATA.INF" 'deleting the file is optional
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
@ -82,7 +83,7 @@ The [[SHELL]] statement allows a program to run external programs or command lin
''Example 4:'' Determining if a drive or path exists. Cannot use with a file name specification.
{{CodeStart}} '' ''
{{Cl|LINE INPUT}} "Enter a drive or path (no file name): ", DirPath$
{{Cl|IF}} PathExist%(DirPath$) {{Cl|THEN}} PRINT "Drive Path exists!" {{Cl|ELSE}} PRINT "Drive Path does not exist!"
{{Cl|IF}} PathExist%(DirPath$) {{Cl|THEN}} {{Cl|PRINT}} "Drive Path exists!" {{Cl|ELSE}} PRINT "Drive Path does not exist!"
{{Cl|END}}
{{Cl|FUNCTION}} PathExist% (Path$)
@ -91,39 +92,41 @@ PathExist% = 0
{{Cl|IF}} {{Cl|LEN}}({{Cl|ENVIRON$}}("OS")) {{Cl|THEN}} CMD$ = "CMD /C " {{Cl|ELSE}} CMD$ = "COMMAND /C "
{{Cl|SHELL}} {{Cl|_HIDE}} CMD$ + "If Exist " + Path$ + "\nul echo yes > D0S-DATA.INF"
{{Cl|OPEN}} "D0S-DATA.INF" {{Cl|FOR (file statement)|FOR}} {{Cl|APPEND}} {{Cl|AS}} #1
{{Cl|IF}} {{Cl|LOF}}(1) {{Cl|THEN}} PathExist% = -1 'yes will be in file if path exists
{{Cl|IF}} {{Cl|LOF}}(1) {{Cl|THEN}} PathExist% = -1 'yes will be in file if path exists
{{Cl|CLOSE}} #1
{{Cl|KILL}} "D0S-DATA.INF" 'delete data file optional
{{Cl|KILL}} "D0S-DATA.INF" 'delete data file optional
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
{{small|Code by Ted Weissgerber}}
:''Explanation: IF Exist'' checks for the drive path. ''\Nul'' allows an emply folder at end of path. ''Echo'' prints '''yes''' in the file if it exists.
:''Explanation: IF Exist'' checks for the drive path. ''\Nul'' allows an empty folder at end of path. ''Echo'' prints '''yes''' in the file if it exists.
: In '''QB64''' you can simply use the [[_FILEEXISTS]] statement for the same purpose of the example above.
''Snippet 1:'' When looking for '''printers''' this command gives you a file list with the default printer marked as '''TRUE''':
{{TextStart}}{{Cb|SHELL}} {{Cb|_HIDE}} "CMD /C" + "wmic printer get name,default > default.txt"
{{TextEnd}}
'''Created file's text:'''
{{TextStart}}Default Name
{{CodeStart}}
{{Cl|SHELL}} {{Cl|_HIDE}} "CMD /C" + "wmic printer get name,default > default.txt"
{{CodeEnd}}
: Created file's text:
{{OutputStart}}Default Name
FALSE Microsoft XPS Document Writer
TRUE HP Photosmart C7200 series
FALSE HP Officejet Pro 8600
FALSE Fax
{{TextEnd}}
{{OutputEnd}}
: ''Explanation:'' [[LINE INPUT]] could be used to find the printer names as [[STRING]] variables.
''Snippet 2:'' Here is the code to set the default printer to the "HP Officejet Pro 8600":
{{TextStart}}SHELL _HIDE "CMD /C" + "wmic printer where name='HP Officejet Pro 8600' call setdefaultprinter"
{{TextEnd}}
: After executing this program, and then running the first snippet again, we see the following '''contents of the text file:'''
{{TextStart}}Default Name
{{CodeStart}}
{{Cl|SHELL}} {{Cl|_HIDE}} "CMD /C" + "wmic printer where name='HP Officejet Pro 8600' call setdefaultprinter"
{{CodeEnd}}
: After executing this program, and then running the first snippet again, we see the following contents of the text file:
{{OutputStart}}Default Name
FALSE Microsoft XPS Document Writer
FALSE HP Photosmart C7200 series
TRUE HP Officejet Pro 8600
FALSE Fax
{{TextEnd}}
{{OutputEnd}}
===More examples===

View file

@ -15,7 +15,7 @@ The {{KW|SIN}} function returns the vertical component or sine of an angle measu
* Accuracy can be determined as [[SINGLE]] by default or [[DOUBLE]] by following the parameter value with a # suffix.
''Example 1:'' Converting degree angles to radians for Qbasic's trig functions and drawing the line at the angle.
''Example 1:'' Converting degree angles to radians for QBasic's trig functions and drawing the line at the angle.
{{CodeStart}} '' ''
{{Cl|SCREEN}} 12
PI = 4 * {{Cl|ATN}}(1)

View file

@ -12,7 +12,7 @@
* Values returned may be expressed using exponential or [[scientific notation]] using '''E''' for SINGLE or '''D''' for DOUBLE precision.
* Floating decimal point numerical values cannot be [[_UNSIGNED]]!
* Values can be converted to 4 byte [[ASCII]] string values using [[_MKS$]] and back with [[_CVS]].
* '''Warning: Qbasic keyword names cannot be used as numerical variable names with or without the type suffix!'''
* '''Warning: QBasic keyword names cannot be used as numerical variable names with or without the type suffix!'''
{{PageSeeAlso}}

View file

@ -14,7 +14,7 @@
{{PageErrors}}
* Low ''frequency'' values between 0 and 37 will create an [[ERROR Codes|Illegal Function call error]].
* '''Warning:''' SOUND may not work when the program is not in focus. Use SOUND 0, 0 at sound procedure start to set focus.
* '''Note:''' SOUND 0, 0 will not stop previous '''QB64''' sounds like it did in Qbasic!
* '''Note:''' SOUND 0, 0 will not stop previous '''QB64''' sounds like it did in QBasic!
* SOUND may have clicks or pauses between the sounds generated. [[PLAY]] can be used for musical sounds.
{{WhiteStart}}
''' The Seven Music Octaves '''
@ -84,7 +84,7 @@ notes$ = "C C#D D#E F F#G G#A A#B "
Octaves:
{{Cl|DATA}} 32.7,34.65,36.71,38.9,41.2,43.65,46.25,49,51.91,55,58.27,61.74 '' ''
{{CodeEnd}}
{{small|Code adapted by Ted Weissgerber from code in [http://www.amazon.com/Running-MS-DOS-QBASIC-Michael-Halvorson/dp/1556153406 "Running MS-DOS Qbasic"] by Microsoft Press}}
{{small|Code adapted by Ted Weissgerber from code in [http://www.amazon.com/Running-MS-DOS-QBASIC-Michael-Halvorson/dp/1556153406 "Running MS-DOS QBasic"] by Microsoft Press}}
''Example 2:'' Playing a song called "Bonnie" with [[SOUND]] frequencies.
@ -125,7 +125,7 @@ Octaves:
{{Cl|DATA}} 523,8," lies ",587,8,"O-",523,8,"ver ",440,8,"the ",392,8,"O-",330,32,"cean ",392,8,"Oh "
{{Cl|DATA}} 440,8,"bring ",587,8,"back ",523,8,"my ",494,8,"Bon-",440,8,"nie ",494,8,"to ",523,32,"me..!" '' ''
{{CodeEnd}}
{{small|Code adapted by Ted Weissgerber from code [http://www.amazon.com/Running-MS-DOS-QBASIC-Michael-Halvorson/dp/1556153406 "Running MS-DOS Qbasic"] by Microsoft Press}}
{{small|Code adapted by Ted Weissgerber from code [http://www.amazon.com/Running-MS-DOS-QBASIC-Michael-Halvorson/dp/1556153406 "Running MS-DOS QBasic"] by Microsoft Press}}
''See also:''

View file

@ -41,7 +41,7 @@ The {{KW|STATIC}} keyword is used in declaration statements to control where var
{{Cl|IF...THEN|IF}} s$ = "" {{Cl|THEN}} Bin$ = "0" {{Cl|ELSE}} Bin$ = s$
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
: ''Explanation:'' The [[FUNCTION]] above returns a [[STRING]] value representing the bits ON in an [[INTEGER]] value. The string can be printed to the screen to see what is happening in a port register. '''STATIC''' keeps the function from overloading the memory "Stack" and is normally REQUIRED when recursive calls are used in Qbasic! '''QB64 procedures will close without warning or error!'''
: ''Explanation:'' The [[FUNCTION]] above returns a [[STRING]] value representing the bits ON in an [[INTEGER]] value. The string can be printed to the screen to see what is happening in a port register. '''STATIC''' keeps the function from overloading the memory "Stack" and is normally REQUIRED when recursive calls are used in QBasic! '''QB64 procedures will close without warning or error!'''
''Example 2:'' Using a static array to cache factorials, speeding up repeated calculations:

View file

@ -14,12 +14,12 @@ The '''STICK''' function returns the directional axis coordinate move of game po
* ''axis_number'' can be used as the next axis parameter for controllers with multiple axis using the SAME ''directional'' parameters.
* The ''axis_number'' 1 can be omitted for the main stick column and row parameter reads.
* Point of view "hats" also have 2 axis. Slide, turn or twist controls have one. The device determines the order of the axis.
* Returns coordinate values from 1 to 254. Qbasic only returned values from 1 to 200.
* Returns coordinate values from 1 to 254. QBasic only returned values from 1 to 200.
* STICK(0) is required to get values from the other STICK functions. Always read it first!
{{WhiteStart}}'''STICK(0) returns the column coordinate of device 1. Enables reads of the other STICK values.'''
'''STICK(1) returns row coordinate of device 1.'''
STICK(2) returns column coordinate of device 2. (second joystick if used)
STICK(3) returns row coordinate of device 2 if used. (Qbasic maximum was 2 controllers)
STICK(3) returns row coordinate of device 2 if used. (QBasic maximum was 2 controllers)
'''STICK(4) returns column coordinate of device 3. (other joysticks if used in QB64 only!)'''
'''STICK(5) returns row coordinate of device 3 if used.'''
{{WhiteEnd}}

View file

@ -22,7 +22,7 @@ QB64 {{PageSyntax}}
'''STRIG(4) = -1 'upper button 2 on device 1 pressed since last STRIG(4) read'''
'''STRIG(5) = -1 'upper button 2 on device 1 currently pressed'''
STRIG(6) = -1 'upper button 2 on device 2 pressed since last STRIG(6) read
STRIG(7) = -1 'upper button 2 on device 2 currently pressed (maximum in Qbasic)
STRIG(7) = -1 'upper button 2 on device 2 currently pressed (maximum in QBasic)
'''STRIG(8) = -1 'button 3 on device 1 pressed since last STRIG(8) read''' 'QB64 only
'''STRIG(9) = -1 'button 3 on device 1 currently pressed'''
STRIG(10) = -1 'button 3 on device 2 pressed since last STRIG(10) read 'QB64 only

View file

@ -13,10 +13,10 @@
* Literal string ends are designated by quotation marks such as: "text". Use [[CHR$]](34) to add quotes to string values.
* Variable suffix type definition is $ such as: text$.
* STRING values are compared according to the [[ASCII]] code values from left to right until one string code value exceeds the other.
* '''NOTE: Many Qbasic keyword variable names CAN be used with a [[STRING]] suffix($) ONLY! You CANNOT use them without the suffix, use a numerical suffix or use [[DIM]], [[REDIM]], [[_DEFINE]], [[BYVAL]] or [[TYPE]] variable [[AS]] statements!'''
* '''NOTE: Many QBasic keyword variable names CAN be used with a [[STRING]] suffix($) ONLY! You CANNOT use them without the suffix, use a numerical suffix or use [[DIM]], [[REDIM]], [[_DEFINE]], [[BYVAL]] or [[TYPE]] variable [[AS]] statements!'''
:::::'''Creating a fixed length STRING variable in Qbasic:'''
:::::'''Creating a fixed length STRING variable in QBasic:'''
:* Variable$ = " " ' 1 space creates a one [[_BYTE|byte]] string length in a procedure(not fixed)
:* Variable$ = SPACE$(n%) ' defined as a n% length string in a procedure(not fixed)

View file

@ -9,17 +9,17 @@ The {{KW|SYSTEM}} statement immediately closes a program and returns control to
* QB64 allows a ''code'' number to be used after SYSTEM to be read in another program module by the [[SHELL]] or [[_SHELLHIDE]] functions.
''Usage:''
{{PageDescription}}
* This command should be used to close a program quickly instead of pausing with [[END]] or nothing at all.
* A code can be added after the statement to send a value to the [[SHELL (function)]] or [[_SHELLHIDE]] function in another module.
* SYSTEM ends the program and closes the window immediately. The last screen image may not be displayed.
''Qbasic or QuickBasic:''
* '''Qbasic BAS files can be run like compiled programs without returning to the IDE when [[SYSTEM]] is used to [[END|end]] them!'''
==QBasic or QuickBASIC==
* '''QBasic BAS files can be run like compiled programs without returning to the IDE when [[SYSTEM]] is used to [[END|end]] them!'''
* If a program BAS module is run from the IDE, stopped by Ctrl-Break or an error occurs the QB program will exit to the IDE.
* To run a QuickBasic program without the IDE use the following DOS command line: {{text|QB.EXE /L /RUN filename.BAS|green}}
* To run a QuickBASIC program without the IDE use the following DOS command line: {{text|QB.EXE /L /RUN filename.BAS|green}}
{{PageSeeAlso}}

View file

@ -11,7 +11,7 @@ The {{KW|TAB}} function is used in [[PRINT]] and [[LPRINT]] statements to move t
* [[ASCII]] [[CHR$]](9) can be substituted for sequencial 9 space column moves.
* [[Comma]] PRINT spacing is up to 15 column places (IE: TAB(15)) to a maximum column of 57.
* When printing to a file, a carriage return([[CHR$]](13)) and linefeed([[CHR$]](10)) character are output when it moves to the next row.
* '''Note:''' Qbasic did not allow a TAB to be [[concatenation|added]] to a string value. In [[PRINT]] statements the [[+|plus]] would be changed to a [[semicolon]].
* '''Note:''' QBasic did not allow a TAB to be [[concatenation|added]] to a string value. In [[PRINT]] statements the [[+|plus]] would be changed to a [[semicolon]].
: In QB64, TAB [[concatenation]] is allowed instead of [[semicolon]]s. Example: {{text|PRINT "text" + TAB(9) + "here"|green}}

View file

@ -10,10 +10,10 @@ The '''TIMER''' function returns the number of seconds past the previous midnite
* TIMER return values range from 0 at midnight to 86399! A comparison value must stay within that range!
* [[INTEGER]] or [[LONG]] second values range from 0 at midnight to 86399 seconds each day.
* Qbasic can return [[SINGLE]] values down to about .04 or 1/18th (one tick) of a second accurately.
* QBasic can return [[SINGLE]] values down to about .04 or 1/18th (one tick) of a second accurately.
* '''QB64''' can read [[DOUBLE]] ''accuracy'' down to 1 millisecond. Example: {{text|start# <nowiki>=</nowiki> TIMER(.001)|green}}
* Use [[DOUBLE]] variables for millisecond accuracy as [[SINGLE]] values are only accurate to 100ths of a second later in the day!
* TIMER loops should use a midnight adjustment to avoid non-ending loops in Qbasic.
* TIMER loops should use a midnight adjustment to avoid non-ending loops in QBasic.
* TIMER can also be used for timing program Events. See [[ON TIMER(n)]] or the [[TIMER (statement)]]
* '''QB64''' can use a [[_DELAY]] down to .001(one millisecond) or [[_LIMIT]] loops per second. Both help limit program CPU usage.
@ -22,7 +22,7 @@ The '''TIMER''' function returns the number of seconds past the previous midnite
{{CodeStart}} '' ''
{{Cl|DO...LOOP|DO}}
{{Cl|PRINT}} "Hello";
Delay .5 'accuracy down to .05 seconds or 1/18th of a second in Qbasic
Delay .5 'accuracy down to .05 seconds or 1/18th of a second in QBasic
{{Cl|PRINT}} "World!";
{{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} = {{Cl|CHR$}}(27) 'escape key exit

View file

@ -1,4 +1,4 @@
A '''TIMER''' statement enables, turns off or stops timer event trapping. Qbasic only uses the base timer, but '''QB64''' can run many.
A '''TIMER''' statement enables, turns off or stops timer event trapping. QBasic only uses the base timer, but '''QB64''' can run many.
QB {{PageSyntax}}
@ -45,7 +45,7 @@ QB64 {{PageSyntax}}
LOCATE row, col ' return to last print cursor position
{{Cl|RETURN}} '' ''
{{CodeEnd}}
: NOTE: SLEEP will be interrupted in Qbasic.
: NOTE: SLEEP will be interrupted in QBasic.
''See also:''

View file

@ -22,6 +22,7 @@
::'''END TYPE'''
{{PageDescription}}
* Typename is an undefined type name holder as it can hold any variable types.
* TYPE definitions are usually placed in the main module before the start of the program code execution.
* TYPE definitions cam also be placed in [[SUB]] or [[FUNCTION]] procedures.
@ -40,6 +41,7 @@
{{DataTypeTable}}
{{PageExamples}}
''Example 1:'' Creating a mouse [[INTERRUPT]] TYPE definition. Each [[INTEGER]] value is 2 bytes.
{{CodeStart}}
TYPE RegType
@ -159,7 +161,7 @@ PRINT foobar.a, foobar.c.b
{{CodeEnd}}
:''Explanation:'' Use one [[GET]] to read all of the header information from the start of the bitmap file opened AS [[BINARY]]. It reads all 54 bytes as [[STRING]], [[INTEGER]] and [[LONG]] type DOT variable values.
:NOTE: BPP returns 4(16 colors), 8(256 colors) or 24(16 million colors) bits per pixel in Qbasic. 24 bit can only be in greyscale.
:NOTE: BPP returns 4(16 colors), 8(256 colors) or 24(16 million colors) bits per pixel in QBasic. 24 bit can only be in greyscale.
:Then use the DOT variable name values like this [[GET (graphics statement)]] after you load the bitmap image to the screen:
@ -170,7 +172,7 @@ PRINT foobar.a, foobar.c.b
:The bitmap image is now stored in an {{KW|Arrays|array}} to {{KW|BSAVE}} to a file. The RGB color information follows the file header as [[ASCII]] character values read using {{KW|ASC}}. The color values could be indexed at the start of the Array with the image being offset to: index = NumberOfColors * 3. As determined by the {{KW|SCREEN (statement)|SCREEN}} mode used. In SCREEN 13(256 colors) the index would be 768.
''See also:''
{{PageSeeAlso}}
* [[DIM]], [[REDIM]]
* [[INTEGER]], [[SINGLE]], [[DOUBLE]]
* [[LONG]], [[_INTEGER64]], [[_FLOAT]]

View file

@ -16,13 +16,13 @@ The '''VAL''' Function returns the decimal numerical equivalent value of a [[STR
* In QB64 use an [[INTEGER]] return variable to hold integer values returned by VAL [[HEX$|Hex]] strings: '''{{text|value% <nowiki>= VAL("&HFFFF") =</nowiki> -1|green}}'''
''Example 1:'' Differences in values returned with Qbasic and QB64:
''Example 1:'' Differences in values returned with QBasic and QB64:
{{CodeStart}} '' ''
{{Cl|PRINT}} {{Cl|VAL}}("{{Cl|&H}}") '203 in QB, 0 in QB64
{{Cl|PRINT}} {{Cl|VAL}}("{{Cl|&H}}FFFF") ' -1 QB, 65535 in QB64
{{Cl|PRINT}} {{Cl|VAL}}("{{Cl|&H}}FFFF&") '65535 in both '' ''
{{CodeEnd}}
:''Explanation:'' A quirk in Qbasic returned VAL values of 203 for "&" and "&H" that was never fixed until PDS(7.1).
:''Explanation:'' A quirk in QBasic returned VAL values of 203 for "&" and "&H" that was never fixed until PDS(7.1).
''Example 2:'' Converting a string with some number characters

View file

@ -24,7 +24,7 @@ ROW$ = "x"+{{Cl|VARPTR$}}(WIND$)+"x"+{{Cl|VARPTR$}}(WIND$)+"x"+{{Cl|VARPTR$}}(WI
{{Cl|DRAW}} "x" + {{Cl|VARPTR$}}(ROW$)
{{Cl|NEXT}} '' ''
{{CodeEnd}}
:''NOTE:'' '''GWBasic''' allows '''semicolons''' to be used in the ROW$ definition, but Qbasic and '''QB64''' MUST use '''+''' concatenation.
:''NOTE:'' '''GWBasic''' allows '''semicolons''' to be used in the ROW$ definition, but QBasic and '''QB64''' MUST use '''+''' concatenation.
''Example 2:'' Using the function to change a Turn Angle value using DRAW.

View file

@ -8,7 +8,7 @@ The '''VARPTR''' function returns an [[INTEGER]] value that is the offset part o
* If variablename is not defined before VARPTR or [[VARSEG]] is called, the variable is created and it's address is returned.
* Reference index is used to set the offset address of an array index, not necessarily the lowest index.
* When a string variable, VARPTR returns the offset address location of the first byte of the string.
* Because many Qbasic statements change the locations of variables in memory, use the values returned by VARPTR and VARSEG immediately after the functions are used!
* Because many QBasic statements change the locations of variables in memory, use the values returned by VARPTR and VARSEG immediately after the functions are used!
* Integer array sizes are limited to 32767 elements when using [[VARPTR]] in QB and '''QB64'''!. Create a larger array using [[_BYTE]]. Example: [[DIM]] [[SHARED]] Memory (65535) AS [[_UNSIGNED]] [[_BYTE]]
* '''Warning: DEF SEG, VARSEG , VARPTR, PEEK or POKE access QB64's emulated 16 bit conventional memory block!'''
: '''It is highly recommended that QB64's [[_MEM]] memory system be used to avoid running out of memory.'''

View file

@ -9,7 +9,7 @@ The '''VARSEG''' function returns an [[INTEGER]] value that is the segment part
* If variablename is not defined before [[VARPTR]] or VARSEG is called, the variable is created and its address is returned.
* The start index is the lowest index of an array variable when used.
* When a string variable, VARSEG returns the segment location address of the first byte of the string.
* Because many Qbasic statements change the locations of variables in memory, use the values returned by VARPTR and VARSEG immediately after the functions are used!
* Because many QBasic statements change the locations of variables in memory, use the values returned by VARPTR and VARSEG immediately after the functions are used!
* Integer array sizes are limited to 32767 elements when using [[VARSEG]] in QB and '''QB64'''!. Create a larger array using [[_BYTE]]. Example: [[DIM]] [[SHARED]] Memory (65535) AS [[_UNSIGNED]] [[_BYTE]]
* '''Warning: DEF SEG, VARSEG , VARPTR, PEEK or POKE access QB64's emulated 16 bit conventional memory block!'''
: '''It is highly recommended that QB64's [[_MEM]] memory system be used to avoid running out of memory.'''

View file

@ -2,7 +2,7 @@ A '''variable''' is a "container" name that can hold a numerical or string value
<center>'''Variable names'''</center>
Variables in QB64 can be any name except the names of QB64 or Qbasic keywords and may not contain spaces or non-alphabetical/non-numerical characters (except "." and "_"). Numerical characters cannot be used as the first character of a variable or array name! '''QB64 reserves the use of a leading underscore to QB64 procedural or variable type names only!'''
Variables in QB64 can be any name except the names of QB64 or QBasic keywords and may not contain spaces or non-alphabetical/non-numerical characters (except "." and "_"). Numerical characters cannot be used as the first character of a variable or array name! '''QB64 reserves the use of a leading underscore to QB64 procedural or variable type names only!'''
Variable values can be passed to sub-procedures by using the name as a [[SUB]] or [[FUNCTION]] parameter in a [[CALL]]. Variable names in the main program module can be passed to sub-procedures by using [[DIM]] [[SHARED]] without using them as [[CALL]] parameters.

View file

@ -1,4 +1,4 @@
'''QB64 uses more variable types than Qbasic ever did. The variable type determines the size of values that numerical variables can hold.'''
'''QB64 uses more variable types than QBasic ever did. The variable type determines the size of values that numerical variables can hold.'''

View file

@ -12,7 +12,7 @@ The {{KW|WHILE...WEND}} statement is used to repeat a block of statements while
{{PageDescription}}
* {{Parameter|condition}} is a numeric expression used to determine if the loop will execute.
* {{Parameter|statements}} will execute repeatedly while {{Parameter|condition}} is a non-zero value.
* [[EXIT]] WHILE can be used for emergency exits from the loop in QB64 only.
* [[EXIT WHILE]] can be used for emergency exits from the loop in QB64 only.
* A [[DO...LOOP]] can use the same DO WHILE condition to get the same results.
* WHILE loops only run if the WHILE condition is True.
@ -24,11 +24,11 @@ The {{KW|WHILE...WEND}} statement is used to repeat a block of statements while
''Example 1:'' Reading an entire file. Example assumes the program has a [[OPEN|file opened]] as #1
{{CodeStart}} '' ''
{{Cl|OPEN}} "Readme.txt" FOR {{Cl|INPUT (file mode)|INPUT}} AS #1
{{Cl|OPEN}} "Readme.txt" {{Cl|FOR (file statement)|FOR}} {{Cl|INPUT}} {{Cl|AS}} #1
{{Cl|WHILE...WEND|WHILE}} {{Cl|NOT}} {{Cl|EOF}}(1)
{{Cl|_LIMIT}} 1 'limit line prints to one per second
{{Cl|LINE INPUT (file statement)|LINE INPUT #}}1, text$
IF {{Cl|INKEY$}} = {{Cl|CHR$}}(27) THEN {{Cl|EXIT}} {{Cl|WHILE}} 'ESC key exits
{{Cl|IF}} {{Cl|INKEY$}} = {{Cl|CHR$}}(27) {{Cl|THEN}} {{Cl|EXIT WHILE}} 'ESC key exits
{{Cl|PRINT}} text$
{{Cl|WEND}} '' ''
{{CodeEnd}}

View file

@ -14,7 +14,7 @@ The {{KW|WIDTH}} statement changes the text dimensions of certain {{KW|SCREEN (s
''Usage:''
* WIDTH should be used AFTER a program SCREEN statement! It does not affect screen graphics or graphic coordinates.
* Affects SCREEN 0 Window size and alters the text block size of each screen mode listed in Qbasic:
* Affects SCREEN 0 Window size and alters the text block size of each screen mode listed in QBasic:
:* SCREEN 0 can use 80 or 40 columns and 25, 43 or 50 rows. Default is WIDTH 80, 25.
:* SCREEN 9 can use 80 columns and 25 or 43(not supported on many monitors) rows. Default WIDTH 80, 25 fullscreen.
:* SCREEN 10 can use 80 columns and 25 or 43 rows. Default is WIDTH 80, 25 fullscreen.

View file

@ -11,7 +11,7 @@ The '''^''' operation raises a numerical value to an exponential value expressin
* Exponents can be any positive or negative integer or fractional numerical value inside of parenthesis brackets.
* If the exponent is zero, the value returned is 1.
* Fractional(or decimal point) exponents MUST be enclosed in '''() brackets''' and will return the fractional exponential root of a value.
* Exponential operations are done first in the Qbasic order of operations.
* Exponential operations are done first in the QBasic order of operations.
* The square root of a number can be returned by the [[SQR]] function or by using an exponent of (1 [[/]] 2). Brackets required.
* Values returned may be expressed using exponential or [[Scientific notation]] using '''E''' for SINGLE or '''D''' for DOUBLE precision.
* WARNING: Exponential returns may exceed numerical type limitations and create an [[ERROR Codes|overflow error]]!

View file

@ -15,8 +15,8 @@
{{PageDescription}}
* '''When a variable has not been defined or has no type suffix, the value defaults to a [[SINGLE]] precision floating point value.'''
* _DEFINE sets the [[Variable Types|type]] of all variable names with the starting letter(s) or letter ranges when encountered in the progression of the program (even in conditional statement blocks not executed and subsequent [[SUB]] procedures).
* '''NOTE: Many Qbasic keyword variable names CAN be used with a [[STRING]] suffix ($)! You cannot use them without the suffix, use a numerical suffix or use [[DIM]], [[REDIM]], [[_DEFINE]], [[BYVAL]] or [[TYPE]] variable [[AS]] statements.'''
* '''Qbasic's IDE''' added DEF statements before any [[SUB]] or [[FUNCTION]]. '''QB64''' (like QB) will change all variable types in subsequent sub-procedures to that default variable type without giving a [[ERROR Codes|"Parameter Type Mismatch"]] warning or adding the proper DEF statement to subsequent procedures. If you do not want that to occur, either remove that DEF statement or add the proper DEF type statements to subsequent procedures.
* '''NOTE: Many QBasic keyword variable names CAN be used with a [[STRING]] suffix ($)! You cannot use them without the suffix, use a numerical suffix or use [[DIM]], [[REDIM]], [[_DEFINE]], [[BYVAL]] or [[TYPE]] variable [[AS]] statements.'''
* '''QBasic's IDE''' added DEF statements before any [[SUB]] or [[FUNCTION]]. '''QB64''' (like QB) will change all variable types in subsequent sub-procedures to that default variable type without giving a [[ERROR Codes|"Parameter Type Mismatch"]] warning or adding the proper DEF statement to subsequent procedures. If you do not want that to occur, either remove that DEF statement or add the proper DEF type statements to subsequent procedures.
* May also affect [[$INCLUDE]] procedures.
@ -30,7 +30,7 @@
{{Cl|END}}
{{Cl|FUNCTION}} Add2 (one, two)
Add2 = one + two
Add2 = one + two
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
{{OutputStart}}65533

View file

@ -10,7 +10,7 @@
*Runs the command/program specified in {{Parameter|commandline$}} and lets the calling program continue at the same time in its current screen format.
*Especially useful when CMD /C or START is used in a SHELL command line to run another program.
* '''QB64''' automatically uses CMD /C or COMMAND /C when using SHELL.
* '''QB64''' program screens will not get distorted or minimized like Qbasic fullscreen modes would.
* '''QB64''' program screens will not get distorted or minimized like QBasic fullscreen modes would.
{{PageExamples}}

View file

@ -12,7 +12,7 @@ The [[_LIMIT]] statement sets the loop repeat rate of a program to so many per s
* Loop cycle rates of 1000 or less can '''significantly reduce CPU usage''' in programs.
* Do not use it to limit a loop to '''less than once every 60 seconds'''(.0167) or an [[ERROR Codes|ILLEGAL FUNCTION CALL error]] will occur.
* Do not use _LIMIT as a timing delay outside of loops. Use [[_DELAY]] instead.
* Use _LIMIT to slow down old Qbasic program loops that run too fast and use too much CPU.
* Use _LIMIT to slow down old QBasic program loops that run too fast and use too much CPU.
{{PageExamples}}

View file

@ -15,9 +15,9 @@ The [[_PALETTECOLOR (function)|_PALETTECOLOR]] function is used to return the 32
{{PageExamples}}
''Example:'' How _PALETTECOLOR works on 32 bit RGB compared to a 4 BPP(SCREEN 12) Qbasic procedure.
''Example:'' How _PALETTECOLOR works on 32 bit RGB compared to a 4 BPP(SCREEN 12) QBasic procedure.
{{CodeStart}} '' ''
SCREEN 12 'can use any Qbasic legacy screen mode
SCREEN 12 'can use any QBasic legacy screen mode
DIM RGB(0 TO 47) AS INTEGER 'color intensity array
FOR c& = 0 TO 15
'OUT &H3C7, c& 'set color attribute to read