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
Integer 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!
===Strings=== Integer BASIC's string handling was based on the system in HP BASIC. This treated string variables as arrays of characters which had to be {{code|DIM}}ed prior to use. This is similar to the model in [[C programming language|C]]<ref>{{cite web |url=https://www.learn-c.org/en/Strings |title= Strings |website=learn-c.org}}</ref> or [[Fortran 77]].<ref>{{cite web |first=Steve |last=Brooks |url=http://math.hawaii.edu/~dale/190/characters_formats.pdf |website=University of Hawaii |title=Characters & Strings in Fortran}}</ref> This is in contrast to MS-like BASICs where strings are an intrinsic variable-length type.<ref>{{cite book |url=https://www.masswerk.at/nowgobang/2020/commodore-basic-variables |title=C64 Programmer's Manual |publisher=Commodore |chapter=Integer, Floating Point and String Variables}}</ref> Before MS-derived BASICs became the ''de facto'' standard, this style was not uncommon; [[North Star BASIC]]<ref>{{cite book |title=North Star BASIC version 6 |url=http://itelsoft.com.au/north_star_manuals/North_Star_BASIC_Version_6.pdf |publisher=North Star Corporation |date=1977 |access-date=2020-03-03 |archive-date=2020-03-05 |archive-url=https://web.archive.org/web/20200305045335/https://itelsoft.com.au/north_star_manuals/North_Star_BASIC_Version_6.pdf |url-status=dead }}</ref> and [[Atari BASIC]]<ref>{{cite book |title=The ATARI BASIC Reference Manual |publisher=Atari Inc |year=1980 |url=http://www.strotmann.de/twiki/bin/view/Infothek/AtBasicReferenceMa |access-date=2020-04-14 |archive-date=2005-05-01 |archive-url=https://web.archive.org/web/20050501034651/http://www.strotmann.de/twiki/bin/view/Infothek/AtBasicReferenceMa |url-status=dead }}</ref> used the same concept, as did others. Strings in Integer Basic used a fixed amount of memory regardless of the number of characters used within them, up to a maximum of 255 characters.{{sfn|Raskin|1978|p=89}} This had the advantage of avoiding the need for the [[Garbage collection (computer science)|garbage collection]] of the [[Heap (data structure)|heap]] that was notoriously slow in MS BASIC{{efn|And completely broken in some versions.<ref>{{cite web |url=https://www.pagetable.com/?p=46 |title=Create your own Version of Microsoft BASIC}}</ref>}} but meant that strings that were shorter than the declared length resulted in wasted memory. Substring access was provided through [[array slicing]] syntax. For instance, {{code|PRINT A$(0,5)|basic}} printed the first six characters of {{code|A$}}, characters 0 through 5.{{sfn|Raskin|1978|p=88}}{{sfn|Raskin|1978|p=88}}{{efn|HP also allowed [ and ] in place of ( and ).}} Concatenation was provided using the same system, {{code|A$(5){{=}}"ABC"|basic}} replaced any characters starting at position 5 with the string "ABC".{{sfn|Raskin|1978|p=92}} This contrasts with the DEC/MS-style string handling which uses string functions like {{code|MID$}} to access substrings and {{code|+}} for concatenation.<ref>{{cite book |url=http://chiclassiccomp.org/docs/content/computing/MITS/MITS_Altair8800Basic4.1Reference_April1977.pdf |title=altair 8080 basic manual |date=April 1977 |publisher=MITS |page=30}}</ref>{{efn|It also contrasts with [[Dartmouth BASIC]] which used the {{code|CONVERT}} command to convert a string into an array of ASCII values which the user then manipulated and converted back to string format with a second {{code|CONVERT}}.}} As many of the features that would be provided by string functions were instead provided by array slicing, the selection of string functions was reduced. {{code|LEN}} returned the length of a string{{sfn|Raskin|1978|p=89}} and {{code|ASC}} returned the ASCII numeric code for the first letter in a string.{{sfn|Raskin|1978|p=120}} It lacked an equivalent of the {{code|CHR$}} that returned the ASCII character with a given numeric code.{{sfn|Mini|1977|p=17}}
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)