1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-05-12 08:00:12 +00:00
66 Supported Keywords
boxgaming edited this page 2024-01-22 13:58:24 -06:00

The following table lists the QBasic and QB64 keywords that are currently supported by QBJS. This page will be updated as additional keyword support is added.

QBasic 4.5 Keywords

Keyword Support Notes
Abs Full
Asc Full
Atn Full
Beep Full
Call Full
ChDir Full
CDbl Full
Chr$ Full
CInt Full
Circle Full
CLng Full
Close Full
Cls Partial No support for optional method parameter. Entire screen will be cleared regardless of selected method.
CSng Full
Color Partial RGB colors only supported when created with one of the supported RGB functions.
Legacy 256 color table supported regardless of screen mode.
Command$ Limited Always returns an empty string
Cos Full
Csrlin Full
Cvi Full
Cvl Full
Data Full
Date$ Full
Dim Full
Draw Full
ReDim Full
Do...Loop Full
End Partial Optional return code parameter is ignored
Environ Limited No-op. Included for compatibility
Environ$ Limited Always returns empty string "". Included for compatibility
EOF Full
Error Partial Calling this method will trigger an error and halt execution. Unlike the QB/QB64 implementation, errors will be reported as "Unhandled Error #{errorNumber}" regardless of the error number passed to the method.
Exit Full
Exp Full
Files Full
Fix Full
For...Next Full
FreeFile Full
Function Full
Get Full
Hex$ Full
If...Then Partial No support for "IF (condition) GOTO"
InKey$ Full
Input Full
Input (file statement) Full
InStr Full
Int Full
Kill Full
LBound Full
LCase$ Full
Left$ Full
Len Full
Let Full
Line Full
Line Input Full
Line Input (file statement) Full
Loc Partial Returns the present file byte position. No COM usage is supported.
Locate Partial Only monotype font 16 supported at present
LOF Full
Log Full
LTrim$ Full
Mid$ Partial Only the Mid$ function is supported at present
MkDir Full
Mki$ Full
Mkl$ Full
Name Full
Oct$ Full
Open Full
Paint Partial Tiling patterns are not currently supported for the fillColor parameter
Point Full
Pos Full
PReset Full
Print Full
Print (file statement) Full
PSet Full
Put Full
Randomize Full
Read Full
Restore Full
Rem Full
Right$ Full
RmDir Full
RTrim$ Full
Rnd Partial
Screen Partial Optional active_page and visual_page parameters are not supported.
Shared Partial Declaration of shared variables in the main module when used in combination with DIM is supported. Declaring shared variables inside SUBs or FUNCTIONs (without DIM) is supported for syntax compatibility. However, because implicit variable declaration is not yet supported, shared variables must be declared in the main module.
Seek Full
Select Case Partial No support currently for "SELECT EVERYCASE" or "CASE [lowerValue] TO [upperValue]
Sound Full In addition to the required frequency and duration parameters, the following option parameters are also available:
SOUND frequency, duration, shape, decay, gain
shape - the sound waveform to use. Valid options are: "square", "sine", "sawtooth", and "triangle"
decay - the rate at which the sound fades to silence. Valid values are in the range 0.0-1.0.
gain -
Space$ Full
Static Partial Static variable declarations within SUBs and FUNCTIONs are supported. At present using the STATIC keyword after a function or sub definition to force all variables to be static is not supported.
String$ Full
Sgn Full
Sin Full
Sleep Full
Sqr Full
Str$ Full
Sub Full
Swap Full
System Partial Optional return code parameter is ignored
Tan Full
Time$ Full
Timer Partial Not currently supporting the optional accuracy parameter.
UBound Full
UCase$ Full
Val Full
VarPtr$ Full
While...WEnd Full
Window Full
Write Full
Write (file statement) Full

QB64 Keywords

Keyword Support Notes
_Acos Full
_Acosh Full
_Alpha Partial Optional imageHandle parameter is not supported
_Alpha32 Full
_Arccot Full
_Arccsc Full
_Arcsec Full
_Asin Full
_Asinh Full
_Atan2 Full
_Atanh Full
_AutoDisplay Limited Always returns true (-1).
QBJS display refresh is always handled automatically. This method is included for compatibility.
_BackgroundColor Full
_Blue Partial Optional imageHandle parameter is not supported
_Blue32 Full
_Capslock Partial Statement version not supported as browser security prevents changing the button state.
_Ceil Full
_CommandCount Limited Always returns 0. Included for compatibility.
_Continue Full
_Cosh Full
_Cot Full
_Coth Full
_CopyImage Full
_Csc Full
_Csch Full
_CWD$ Full
_D2G Full
_D2R Full
_DefaultColor Partial Optional imageHandle parameter is not supported
_Deflate$ Full
_Delay Full
_DesktopHeight Full
_DesktopWidth Full
_Dest Full
_Dir$ Limited Always returns "./". Included for compatibility.
_DirExists Full
_Display Limited Sub version of this method has no effect. Function always returns 0.
QBJS display refresh is handled automatically. This method is included for compatibility.
_Echo Partial Messages passed to this method will be displayed in the browser's debug console. This is equivalent to calling console.log("message text"); in Javascript
_EnvironCount Limited Always returns 0. Included for compatibility.
_FileExists Full
_Font Partial Optional imageHandle parameter is not supported
_FontHeight Full
_FontWidth Full
_FreeFont Full
_FreeImage Full
_FullScreen Partial At present _STRETCH and _SQUAREPIXELS and _SMOOTH keywords are ignored.
All calls to _FullScreen except for _FullScreen _OFF are equivalent to the following in QB64:
_FullScreen _SQUAREPIXELS _SMOOTH
_G2D Full
_G2R Full
_Green Partial Optional imageHandle parameter is not supported
_Green32 Full
_Height Full
_Hypot Full
_Inflate$ Full
_InStrRev Full
_KeyClear Partial Option 3 has no effect for buffer parameter as there is no support for INP(&H60) buffer.
_KeyDown Full
_KeyHit Full
_Limit Full
_LoadFont Partial Optional style parameter is not supported
_LoadImage Full
_MouseButton Full
_MouseHide Full
_MouseInput Full
_MouseShow Full In addition to the cursorShape options from QB64, the following cursor shape options are also available: "PROGRESS", "WAIT", "MOVE", "NOT_ALLOWED", "GRAB", "GRABBING", "ZOOM_IN", "ZOOM_OUT"
_MouseWheel Full
_MouseX Full
_MouseY Full
_NewImage Full
_Numlock Partial Statement version not supported as browser security prevents changing the button state.
_OS$ Full Returns WEB as the OS and the name of the browser instead of the compiler bit format (e.g. [WEB][CHROME])
_Pi Full
_PrintMode Partial Optional imageHandle parameter is not supported
_PrintString Partial Optional imageHandle parameter is not supported
_PrintWidth Full
_PutImage Partial Images are not reversed when dx2 and dy2 are greater than dx1 and dy1.
_R2D Full
_Red Partial The optional imageHandle parameter is not supported
_Red32 Full
_Resize Full
_ResizeHeight Full
_ResizeWidth Full
_R2G Full
_ReadBit Full
_ResetBit Full
_RGB Partial The optional imageHandle parameter is not supported
_RGBA Partial The optional imageHandle parameter is not supported
_RGB32 Full
_RGBA32 Full
_Round Full
_ScreenExists Limited Always returns true
_ScrollLock Partial Statement version not supported as browser security prevents changing the button state.
_ScreenMove Limited No-op. Included for compatibility.
_ScreenX Full
_ScreenY Full
_Sec Full
_Sech Full
_SetBit Full
_Shl Full
_Shr Full
_Sinh Full
_SndClose Full
_SndLoop Full
_SndOpen Full
_SndPause Full
_SndPlay Full
_SndStop Full
_SndVol Full
_Source Full
_StartDir Full
_StrCmp Full
_StriCmp Full
_Tanh Full
_Title Full
_Title$ Full
_ToggleBit Full
_Trim Full
_Width Full

QBJS Keywords

Keyword Description
Export Specifies a Sub, Function or Const that will be accessible in an exported module.
Import Imports an external module for use in the calling program.
IncludeJS Includes a javascript library for use by the current program.

QBJS Standard Modules

In an effort to provide the ability for the language to grow in a scalable, modular manner beyond the original QBasic and QB64 built-in keywords, QBJS has introduced the concept of importable modules. The bulk of features added beyond the original core keywords will be provided as standard, optional library modules which can be imported as needed.

2D Graphics

Provides extended 2D graphics functionality.

Import G2D From "lib/graphics/2d.bas"
Keyword Description
G2D.Bezier Draws a bezier curve.
G2D.Curve Draws a quadratic curve.
G2D.Ellipse Draws an ellipse.
G2D.FillCircle Draws a filled circle.
G2D.FillRoundRect Draws a filled rectangle with rounded corners.
G2D.FillTriangle Draws a filled triangle.
G2D.InvertRect Inverts the colors of a specified rectangle.
G2D.LineCap Gets or sets the current line cap style.
G2D.LineDash Sets a dashed style for line drawing methods.
G2D.LineDashOff Turns off the dashed line style for subsequent drawing methods.
G2D.LineWidth Gets or sets the current line width.
G2D.RotoZoom Rotates and zooms an image.
G2D.RoundRect Draws a rectangle with rounded corners.
G2D.SaveImage Saves an image to the virtual filesystem in PNG format.
G2D.Shadow Applies a shadow effect to subsequent drawing methods.
G2D.ShadowOff Turns off the shadow effect for subsequent drawing methods.

Console

Provides access to the console output.

Import Console From "lib/web/console.bas"
Keyword Description
Console.Echo Prints a message to the console.
Console.Log Logs a message to the console. The log level and current program source line will prefix the written log message.
Console.LogLevel Gets or sets the current console log level.

Dom

Provides access to the current web page's document object model.

Import Dom From "lib/web/dom.bas"
Keyword Description
Dom.Add Adds an existing html element to a new parent element.
Dom.Alert Instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog.
Dom.Confirm Instructs the browser to display a dialog with an optional message, and to wait until the user either confirms or cancels the dialog.
Dom.Container Returns the outermost containing html element for the QBJS application.
Dom.Create Creates a new html element and adds it to the current page.
Dom.Event Registers an event handler method that will be triggered when the specified event is fired.
Dom.Get Returns an html element for a specified id.
Dom.GetImage Returns the html canvas element associated with a QB image.
Dom.Remove Removes an html element from the page.
Dom.Prompt Instructs the browser to display a dialog with an optional message prompting the user to input some text, and to wait until the user either submits the text or cancels the dialog.

FileSystem

Extended functionality for input/output related to the virtual filesystem.

Import FS From "lib/io/fs.bas"
Keyword Description
FS.DownloadFile Downloads a file from the virtual file system.
FS.ListDirectory Lists the contents of a directory in the virtual file system.
FS.UploadFile Upload a file to the virtual file system.

Storage

Provides access to the browser local and session storage.

Import Storage From "lib/web/storage.bas"
Keyword Description
Storage.Clear Clears all values from the browser storage.
Storage.Get Returns a value from browser storage identified by the storage key.
Storage.Key Returns the key from browser storage identified by the key's index.
Storage.Length Returns the number of values stored in browser storage.
Storage.Remove Removes a value from browser storage identified by the storage key.
Storage.Set Sets value in browser storage identified by the storage key.