Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Vilnius BASIC
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Numeric variables, operators and functions=== As with most dialects, variable names had to start with a letter and could be followed by more letters or digits. Variable names could be any length, but only the first two characters were stored or matched, meaning that typing {{code|PRT001{{=}}1}} followed {{code|PR{{=}}5}} would result in a single variable in memory known as PR with the value 5. Vilnius BASIC had four basic data types, strings, single and double-precision [[floating point]] numbers, and integers. Unless otherwise denoted, variables were assumed to be double-precision, stored in eight bytes and providing about 17 digits of precision. For comparison, most MS dialects used a [[Microsoft Binary Format|5-byte format]] for floating point. If {{code|!}} was suffixed to the variable name, the value was stored in single-precision using four bytes with about 7 digits of precision. {{code|%}} specified an integer, using a single 16-bit word to store values between -32768 and +32767. If a value with more precision was assigned to a variable with less, any excess was simply discarded; {{code|A%{{=}}1.5}} will result in A% having the value 1. Numeric constants in the [[source code]] could also be specified as a particular type using the same indicators; {{code|50%}} would store the constant as an integer, {{code|0.05!}} or {{code|5E-02}} stores a single-precision value 0.05, and {{code|0.05}} or {{code|5D-02}} stores the same value in the default double-precision format. Vilnius also had the additional ability to allow numeric constants to be typed in as strings of binary, [[octal]] or [[hexadecimal]] characters, by prefixing the string with {{mono|&}} and a single letter indicating the type, B, O, H. For instance, {{code|A{{=}}&H9A8B}} would convert the hexadecimal string H9A8B to the equivalent decimal value 39563 and store that in A. Operators for numerical values included {{code|+, -, *, /, ^}} adding {{code|\}} for integer division and {{code|MOD}} for the remainder. Thus {{code|5\2}} returns 2, while {{code|5 MOD 2}} returns 1. Numeric functions include the standard {{code|ABS, ATN, COS, EXP, INT, LOG, RND, SGN, SIN, SQR, TAN}}. It also included the {{code|FIX}} operator, which is similar to {{code|INT}} but always truncates toward zero so that {{code|FIX(-1.5)}} returns -1 instead of -2 like INT. In addition to [[PEEK and POKE]], which returned 16-bit values, the system also offered {{code|OUT and INP}}, which were similar but applied a [[bit mask]] to the values to allow individual bits to be set or cleared.{{sfn|Manual|p=46}} {{code|CLS}} cleared the screen. System functions include {{code|FRE}} which returned the amount of free memory, and {{code|TAB}} which moved to the given column. {{code|AT (x,y)}} worked in a similar fashion to TAB, but moved the cursor to the given X,Y location.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)