[{"@context":"http:\/\/schema.org\/","@type":"BlogPosting","@id":"https:\/\/wiki.edu.vn\/en\/integer-basic-wikipedia\/#BlogPosting","mainEntityOfPage":"https:\/\/wiki.edu.vn\/en\/integer-basic-wikipedia\/","headline":"Integer BASIC – Wikipedia","name":"Integer BASIC – Wikipedia","description":"before-content-x4 BASIC interpreter of the Apple I and original Apple II computers after-content-x4 Integer BASIC is a BASIC interpreter written","datePublished":"2014-12-14","dateModified":"2014-12-14","author":{"@type":"Person","@id":"https:\/\/wiki.edu.vn\/en\/author\/lordneo\/#Person","name":"lordneo","url":"https:\/\/wiki.edu.vn\/en\/author\/lordneo\/","image":{"@type":"ImageObject","@id":"https:\/\/secure.gravatar.com\/avatar\/cd810e53c1408c38cc766bc14e7ce26a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cd810e53c1408c38cc766bc14e7ce26a?s=96&d=mm&r=g","height":96,"width":96}},"publisher":{"@type":"Organization","name":"Enzyklop\u00e4die","logo":{"@type":"ImageObject","@id":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","url":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","width":600,"height":60}},"image":{"@type":"ImageObject","@id":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/4\/48\/Apple_1_Advertisement_Oct_1976.jpg\/220px-Apple_1_Advertisement_Oct_1976.jpg","url":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/4\/48\/Apple_1_Advertisement_Oct_1976.jpg\/220px-Apple_1_Advertisement_Oct_1976.jpg","height":"285","width":"220"},"url":"https:\/\/wiki.edu.vn\/en\/integer-basic-wikipedia\/","wordCount":19462,"articleBody":" (adsbygoogle = window.adsbygoogle || []).push({});before-content-x4BASIC interpreter of the Apple I and original Apple II computers (adsbygoogle = window.adsbygoogle || []).push({});after-content-x4Integer BASIC is a BASIC interpreter written by Steve Wozniak for the Apple I and Apple II computers. Originally available on cassette for the Apple I in 1976, then included in ROM on the Apple II from its release in 1977, it was the first version of BASIC used by many early home computer owners.The only numeric data type was the integer; floating-point numbers were not supported. Using integers allowed numbers to be stored in a much more compact 16-bit format that could be more rapidly read and processed than the 32- or 40-bit floating-point formats found in most BASICs of the era. This made it so fast that Bill Gates complained when it outperformed Microsoft BASIC in benchmarks. However, this also limited its applicability as a general-purpose language.[a]Another difference with other BASICs of the era is that Integer BASIC treated strings as arrays of characters, similar to the system in C or Fortran 77. Substrings were accessed using array slicing rather than string functions. This style was introduced in HP Time-Shared BASIC, and could also be found in other contemporary BASICs patterned on HP, like North Star BASIC and Atari BASIC. It contrasted with the style found in BASICs derived from DEC, including Microsoft BASIC. (adsbygoogle = window.adsbygoogle || []).push({});after-content-x4The language was initially developed under the name GAME BASIC and referred to simply as Apple BASIC when it was introduced on the Apple I. It became Integer BASIC when it was ported to the Apple II and shipped alongside Applesoft BASIC, a port of Microsoft BASIC which included floating-point support. Integer BASIC was phased out in favor of Applesoft BASIC starting with the Apple II Plus in 1979.Table of ContentsHistory[edit]Description[edit]Program editing[edit]Debugging[edit]Variable names[edit]Mathematics[edit]Strings[edit]Graphics and sound[edit]Input\/output[edit]Other notes[edit]Reserved words[edit]Apple BASIC[edit]Integer BASIC[edit]Implementation[edit]ROM details[edit]SWEET16[edit]Floating point[edit]Performance[edit]Sample code[edit]References[edit]Citations[edit]Bibliography[edit]External links[edit]History[edit]As a senior in high school, Steve Wozniak’s electronics teacher arranged for the leading students in the class to have placements at local electronics companies. Wozniak was sent to Sylvania where he programmed in FORTRAN on an IBM 1130.[4] That same year, General Electric placed a terminal in the high school that was connected to one of their mainframes running their timesharing BASIC service, which they were heavily promoting at the time. After being given three days of access, the students were asked to write letters on why the school should receive a terminal permanently, but their efforts were ultimately unsuccessful. (adsbygoogle = window.adsbygoogle || []).push({});after-content-x4Some years later, Wozniak was working at Hewlett-Packard (HP) running simulations of chip designs and logic layout for calculators. HP made major inroads in the minicomputer market with their HP 2000 series machines running a custom timesharing version of BASIC. For approximately $100,000, one could build up a reasonably equipped machine that could support between 16 and 32 users running BASIC programs.[5] While expensive, it was still a fraction of the cost of the mainframe machines[b] and, for heavy users, less than the timesharing services.[c] HP followed this with the HP 9830, a desktop-sized machine for US$10,000 (equivalent to $70,000 in 2021) that also ran BASIC, which Wozniak had access to.I sniffed the wind and knew that the key to making my computer good (popular) was to include a high-level language and that it had to be BASIC.Steve WozniakIn January 1975 the Altair 8800 was announced and sparked off the microcomputer revolution. In March, Wozniak attended the first meeting of the Homebrew Computer Club and began formulating the design of his own computer. One of the most important pieces of software for the Altair, and one of the most heavily pirated, was Altair BASIC from the recently formed Microsoft.[10] Wozniak concluded that his machine would have to have a BASIC of its own, which would, hopefully, be the first for the MOS Technology 6502 processor. As the language needed 4\u00a0KB RAM, he made that the minimum memory for the design.Wozniak’s references for BASIC were a copy of 101 BASIC Computer Games and an HP BASIC manual. He did not know that HP’s BASIC was very different from the DEC BASIC variety used in 101 Games, which was also the basis of Microsoft BASIC for the Altair. Based on these sources, Wozniak began sketching out a syntax chart for the language. The design initially included floating-point support, but still hoping he might publish the first BASIC on the 6502 and become “a star”, he decided to abandon floating-point and write a separate integer math system to save a few weeks programming time.Wozniak would later describe his language as “intended primarily for games and educational uses”. Referring to it throughout development as “GAME BASIC”, Wozniak wrote the code by hand, translating the assembler code instructions into their machine code equivalents and then uploading the result to his computer.[12] Without any training on how to write a computer language, he used his HP calculator experience to implement a stack machine to interpret expressions. Once the basic routines were up and running, he worked on the other commands one-by-one in a modular fashion. With every visit to the Homebrew club, he demonstrated a few more features added in the last month.It was the most satisfying day of my life… I demonstrated Breakout [at Homebrew]-totally written in BASIC… After designing hardware arcade games, I knew that being able to program them in BASIC was going to change the world.Steve Wozniak Ad for the Apple I computer noting Apple’s policy of providing free or inexpensive software for its computers.In early 1976 ads for its Apple I computer, Apple Inc made the claims that “our philosophy is to provide software for our machines free or at minimal cost”[13] and “yes folks, Apple BASIC is Free”.[14] This was printed shortly after Bill Gates’s infamous Open Letter to Hobbyists that suggested that people were robbing him by copying versions of Altair BASIC.[15]Wozniak had helped Jobs, who worked for Atari, with a redesign of Breakout.[16] At some later point, he decided to see whether one could write the game in BASIC. He added commands to read paddle controllers and over a series of quick edits had a version of the game up and running. To improve its playability, he added a speaker to make clicks when the ball hit things. While showing it to Steve Jobs, Wozniak demonstrated that he could quickly change the colors that his game used, just by altering the source code. Wozniak later wrote that he had proved that “software was much more flexible than hardware”, and that he and Jobs realized that “now, anyone could create arcade games without having to design it in hardware.”Wozniak did complete a floating-point library for the 6502 and published it in the August 1976 edition of Dr. Dobb’s.[17] This library was later made part of the ROMs for the Apple II.[18] Wozniak began work on back-porting the floating-point code into Apple BASIC, but got sidetracked in the task of designing a floppy disk controller for what became the Disk II. Mike Markkula said the company would go to the Consumer Electronics Show in Las Vegas if the disk system was ready in time, so Wozniak and Randy Wigginton worked on it non-stop through the 1977 holidays.When he returned to the topic of floating-point in BASIC, Jobs complained it was taking too long. Without Wozniak being aware, the company had already arranged a license with Microsoft to receive their recently completed 6502 version of the Altair code. Examining the MS code, Wozniak decided that it was easier to add graphics support to their code than add floating-point his own BASIC, as the later required hand-patching of the original machine code while MS’s was written in assembler and more easily modified. The development of Apple’s BASIC ended in favor of what became Applesoft BASIC. Wozniak later noted, “My biggest disappointment was going to the awful string functions like LEFT$(VAR, 5) and MID$(VAR2,5,3) instead of my own”.[d]When the Apple II shipped in the summer of 1977, Integer BASIC was supplied in ROM, while Applesoft BASIC shipped on cassette. This changed with the introduction of the Apple II Plus in 1979, when Applesoft was put in the ROM.Description[edit]Program editing[edit]Like most BASIC implementations of the era, Integer BASIC acted as both the language interpreter as well as the line editing environment. When BASIC was running, a > command prompt was displayed where the user could enter statements.[e] Unlike later home computer platforms, BASIC was not the default environment when the Apple I started, it normally started in the monitor. BASIC was started by pressing Ctrl+BReturn.Statements that were entered with leading numbers are entered into the program storage for “deferred execution”, either as new lines or replacing any that might have had the same number previously. Statements that were entered without a line number were referred to as commands, and ran immediately.[f] Line numbers could be from 0 to 32767,[g] and lines could contain up to 128 characters.Integer BASIC also included the AUTO command to automatically enter line numbers at a given starting number like AUTO 100, adding 10 to the last number with every new line. AUTO 300,5 would begin numbering at line 300 by fives; 300, 305, etc. Automatic numbering was turned off by entering MAN.One interesting feature of the editor was that a section of the screen could be set aside as the “window”, where live updates took place. This was normally the entire screen, but it could be limited to a smaller area by POKEing values into memory locations 32 through 35. This feature could be used to create an editable text area while the rest of the screen was in graphics mode.Debugging[edit]As in most BASICs, programs were started with the RUN command, and as was common, could be directed at a particular line number like RUN 300. Execution could be stopped at any time using Ctrl+C and then restarted with CONtinue, as opposed to the more typical CONT.For step-by-step execution, the TRACE instruction could be used at the command prompt or placed within the program itself. When it was turned on, line numbers were printed out for each line the program visited. The feature could be turned off again with NOTRACE.A somewhat unusual feature was the DSP (for “display”) command. When encountered in a program, from that point on any changes to a variable’s value would be displayed. For instance, DSP X would display the value of X every time it changed, along with the line number where the change occurred. As with TRACE, DSP was turned off with NODSP.Variable names[edit]Where Dartmouth BASIC and HP-BASIC limited variable names to at most two characters (either a single letter or a letter followed by one digit), and where MS-BASIC allowed a letter followed by an optional letter or digit (ignoring subsequent characters), Integer BASIC was unusual in supporting any length variable name (e.g., SUM, GAMEPOINTS, PLAYER2). The only caveat was that variable names could not contain reserved words; for example, THISCOLOR and COLORFUL were invalid variable names because they contained the keyword COLOR, a system command. Additionally, lines were limited to 128 characters, so variable names could not exceed that length.Mathematics[edit]Integer BASIC, as its name implies, uses integers as the basis for its math package. These were stored internally as a 16-bit number, little-endian (as is the 6502). This allowed a maximum value for any calculation between -32767 and 32767; although the format could also store the value -32768, BASIC could not display that number. Calculations that resulted in values outside that range produced a >32767 ERR.Infix operators included + (addition), - (subtraction), * (multiplication), \/ (division), MOD (remainder) and exponent using the ^ character. Binary operators included AND, OR and NOT. Binary comparisons included the standard set of =, >, =, "},{"@context":"http:\/\/schema.org\/","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https:\/\/wiki.edu.vn\/en\/#breadcrumbitem","name":"Enzyklop\u00e4die"}},{"@type":"ListItem","position":2,"item":{"@id":"https:\/\/wiki.edu.vn\/en\/integer-basic-wikipedia\/#breadcrumbitem","name":"Integer BASIC – Wikipedia"}}]}]