HP Time-Shared BASIC

HP Time-Shared BASIC
Paradigmimperative
DeveloperMike Green
First appearedbefore 1969; 56 years ago (1969)
OSHP 2100
Influenced by
Dartmouth BASIC
Influenced
Cf. SDS BASIC, Integer BASIC, Atari BASIC, many others

HP Time-Shared BASIC (HP TSB) is a BASIC programming language interpreter for Hewlett-Packard's HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as the platform that released the first public versions of the game Star Trek.

The system implements a dialect of BASIC as well as a rudimentary user account and program library that allows multiple people to use the system at once. The systems were a major force in the early-to-mid 1970s and generated a large number of programs. HP maintained a database of contributed-programs and customers could order them on punched tape for a nominal fee.

Most BASICs of the 1970s trace their history to the original Dartmouth BASIC of the 1960s, but early versions of Dartmouth did not handle string variables or offer string manipulation features. Vendors added their own solutions; HP used a system similar to Fortran and other languages with array slicing, while DEC later introduced the MID/LEFT/RIGHT functions.

As microcomputers began to enter the market in the mid-1970s, many new BASICs appeared that based their parsers on DEC's or HP's syntax. Altair BASIC, the original version of what became Microsoft BASIC, was patterned on DEC's BASIC-PLUS. Others, including Apple's Integer BASIC, Atari BASIC and North Star BASIC were patterned on the HP style. This made conversions between these platforms somewhat difficult if string handling was encountered.

Nomenclature

The software was also known by its versioned name, tied to the hardware version on which it ran, such as HP 2000C Time-Shared BASIC and the operating system came in different varieties — 2000A, 2000B, 2000C, High-Speed 2000C, 2000E, and 2000F.

HP also referred to the language as "Access BASIC" in some publications. This matched the naming of the machines on which it ran, known as the "2000/Access" in some publications. This terminology appears to have been used only briefly when the platform was first launched.

Platform details

Except for the 2000A and 2000E systems, the system is implemented using a dual-processor architecture. One fully configured HP 2100-series processor is used for the execution of most of the system code and all of the user code, while a second, smaller HP 2100-series processor is used to handle the RS-232 serial lines through which the time-sharing users connected. Depending on the hardware configuration, the system supports up to 16 or up to 32 simultaneous remote users.

The usual terminal for a TSB system was a Teletype Model 33 ASR and connected directly to the I/O processor or through a modem or acoustic coupler. Account names are a combination of one alphabetic character, followed by three decimal digits, e.g., B001. Privileged accounts started with the letter "A" and had some additional command and program storage capabilities. The superuser account is A000. This scheme allows up to 26,000 user accounts.

During execution, user programs are swapped to a fixed head drive — physically a disk, but operating like a magnetic drum. When not executing, user programs are stored on moving-head cartridge- or pack-loaded disk storage. Privileged users can also store programs on the much-faster drum. The hard drive was backed up to magnetic tape.

Program and file names consist of a mix of up to six alphabetic characters (A-Z) and numbers (0-9). Programs are stored in a tokenized format, using the SAVE command. They can also be stored in a semi-compiled format, using the CSAVE command, which allows them to start quicker. Since the system was closely tied to the use of commonly available teleprinters, line endings in files consisted of the carriage return character (ASCII CR, 0D hexadecimal), followed by the linefeed character (ASCII LF, 0A hexadecimal).

Syntax

The language is a fairly standard implementation of BASIC, providing an integrated editing and runtime environment. Statements are analyzed for correct syntax as they are entered and then stored in tokenized form. Each BASIC statement has to be on a uniquely numbered line, e.g.

10 PRINT "HELLO WORLD"

Line numbers are mandatory, and statements are automatically placed in ascending numeric sequence. TSB lines can contain one statement; chaining multiple statements with the colon as in MS BASIC is not supported. Multiple variable assignments are allowed, e.g., 20 LET A=B=C=42. As in most versions of BASIC, use of the word "LET" was optional.

In the earliest version (2000A), the language supported the following features.[1] Later versions added many more features.[2]

  • Unconditional program flow-control via GOTO statements, and subroutines via the GOSUB and RETURN statements
  • Conditional flow-control via IF/THEN statement
  • Calculated flow-control via the GOTO/OF and GOSUB/OF statements
  • Variable-based block loop FOR and NEXT statements
  • In-code data storage via DATA, READ, and RESTORE statements
  • Input from and output to the user or a disc file via INPUT, READ #, PRINT, PRINT #, and IF END # statements
  • Numeric variables of the form "A" or "An" (where A is a single letter and n is a single, optional digit).
  • String variables of the form "A$" (where A is a single letter), storing from 1 to 255 characters as-dimensioned. (See below.) (Or: variable-names "A0$" or "A1$," but never more than these two digits.)
  • One- or two-dimensional matrix (array) variables of the form "A[x]" or "A[x,y]"
  • Matrix operations via statements (MAT READ, MAT INPUT, MAT PRINT, MAT=) and operations (+, -, *, ZER, CON, IDN, INV, TRN)
  • Boolean operators (AND, OR, NOT) and relational operators (<, <=, =, #, <>, >=, and >)
  • Built-in mathematical functions including trigonometric (SIN, COS, TAN, ATN), logarithms (LOG, EXP), square root (SQR), random number generator (RND), others (ABS, INT, SGN, MIN, MAX), and user-defined functions
  • Punched tape operations using Teletype Model 33 electromechanical teleprinter remote terminals

String handling

Strings in TSB are treated as an array of characters, rather than a single multi-character object. By default, they are allocated one character in memory, and if a string of longer length is needed, they have to be mentioned before use. For instance, DIM A$[10] will set up a string that can hold a maximum of 10 characters. The maximum length of a string in TSB is 255 characters.[3]

Substrings within strings are accessed using a "slicing" notation: A$(L,R) or A$[L,R], where the substring begins with the leftmost character specified by the index L and continues to the rightmost character specified by the index R, or the A$[L] form where the substring starts at the leftmost character specified by the index L and continues to the end of the string. TSB accepts () or [] interchangeably. Array and substring indices start with 1.

This is in sharp contrast to BASICs following the DEC pattern that use functions such as LEFT$(), MID$(), and RIGHT$() to access substrings, although ANSI BASIC continues to use a similar substring syntax to that introduced by Hewlett-Packard. HP's notation can also be used on the destination side of a LET or INPUT statement to modify part of an existing string value, for example 100 A$[3,5]="XYZ" or 120 B$[3]="CHANGE ALL BUT FIRST TWO CHARS", which cannot be done with early implementations of LEFT/MID/RIGHT.

The main advantage to this style of string access is that it eliminates the need for complex memory management that is otherwise required when string lengths change. MS BASIC had a lengthy library to handle the compression of memory by removing dead space in the string heap when the system ran out of memory. It was also notoriously slow, and was modified several times over its lifetime in order to improve performance or fix bugs.[4] The downside to the TSB style is that the string always takes up the full amount of DIMed space even if the string inside is empty, and simple tasks like concatenation can potentially overflow the string unless it was set to a large size to begin with.

Later versions of Dartmouth BASIC did include string variables, based on the same pattern found in BASIC-PLUS and MS BASIC. However, this version did not use the LEFT/MID/RIGHT functions for manipulating strings, but instead used the CHANGE command which converted the string to and from equivalent ASCII values. HP included identical functionality, changing only the name to CONVERT.[5][a] Additionally, one could use the single-quote to convert a numeric constant to an ASCII character, allowing one to build up a string in parts; A$='23 '64 '49 "DEF" produced the string "ABCDEF", without the need for the CHR$() function.[6]

MAT commands

Later versions of Dartmouth BASIC included a suite of MAT commands that allowed operations on entire arrays (matrices) with a single statement. These were also available in later versions of TSB. In their simplest form, the MAT is used like an alternate form of LET, applying an expression to all the elements in an array. For instance:

100 DIM A(20),B(20)
...
200 MAT A=A+B

Will add the value of every value in B to every entry in A, in the same fashion as:

100 DIM A(20),B(20)
...
200 FOR I=1 TO 20
210 A[I]=A[I]+B[I]
220 NEXT I

As well as making the code shorter and more obvious, these commands also have the advantage of being highly optimized, easily outperforming the use of FOR/NEXT.[7] Additional functions and statements modify PRINT and INPUT, invert arrays, and build identity matrixes and such in a single statement.[8]

Other differences

TSB also includes a number of more minor differences with other dialects. Among the most important are:

  • # is an optional form of the not-equal comparison, identical to <>[9]
  • computed-goto using the ON...GOTO/GOSUB syntax is not supported. Instead, the GOTO expression OF 1,2,3... performs the same function by picking a line number from the list based on its ordinal position. For instance, GOTO 1 OF 10,20,30 will always go to line 10, whereas GOTO A OF 100,200,300 will branch to different lines if the value of A is 1, 2 or 3.[10]
  • Boolean and relational operators can be used in any mathematical expression, returning 0 for false or 1 for true, which was unusual for BASIC languages of that time, but popular in languages like C. For instance, IF C+D THEN 1600 will branch to line 1600 if either C or D are greater than zero, because the expression C+D will evaluate to 'true' in the IF. If C and D are both zero, the IF will evaluate it to 'false' and the branch will not be taken.
  • TSB includes ENTER, a variation on the standard INPUT statement that continues after a time limit is reached. ENTER has three inputs, a time limit in seconds, a return variable containing the actual time elapsed (or a status code), and then finally the user input. For instance, ENTER 15,T,A$[1,1] will wait 15 seconds for the user to type in a single character. T will contain the actual time they took, -256 if the timer expired, or -257 or -258 to indicate problems with the terminal.[11]
  • When printing string constants (literals), semicolons are not needed within the line. For instance, PRINT "THE NUMBER IS"A", TRY A LARGER VALUE." does not require semicolons between the string constants and the variable A.[12] Some other BASICs, including MS, also supported this syntax. Others, like Atari or Integer, did not.
  • Commas in PRINT use tab stops every 15 characters, leaving 12 at the end of the line to total 72.[13]
  • The LIN function operates as a vertical counterpart to TAB. LIN(3) will insert three carriage returns, potentially on the existing line if a trailing semicolon or comma was active, while the special-case LIN(-1) will always advance to the next line.[14] Integer BASIC had a similar feature, called VTAB.

See also

Notes

  1. ^ Wang BASIC also used CONVERT, but it converted numbers in strings, like the VAL function.

References

Citations

  1. ^ HP 2000A - User's Guide, August 1969 Part Number 02000-90002, [1]. Retrieved 2016-05-09
  2. ^ HP 2000/Access BASIC - Reference Manual Part No. 22687-90001, [2]. Retrieved 2016-05-09
  3. ^ Ref 1976, p. 4-3.
  4. ^ "Create your own Version of Microsoft BASIC".
  5. ^ Ref 1976, p. 4-6.
  6. ^ Ref 1976, p. 4-2.
  7. ^ Ref 1976, p. 11-50.
  8. ^ Ref 1976, pp. 11–49, 11–55.
  9. ^ Ref 1976, p. 2-5.
  10. ^ Ref 1976, p. F-4.
  11. ^ Ref 1976, p. 2-15.
  12. ^ Ref 1976, p. 2-10.
  13. ^ Ref 1976, p. 2-9.
  14. ^ Ref 1976, p. 2-11.

Bibliography

Read other articles:

2013 single by The Wah Wah CollectiveTell Me WhySingle by The Wah Wah Collectivefrom the album Cry Baby Soul B-sideGordo, Along The Ganges(Vinyl Version)ReleasedNew Version (November 2013) Original Version (March 2004)RecordedJanuary 2004 (Original Vocals)GenreNu jazz, neo soulLength4:06 (Radio Edit) 5:22 (Album Version)LabelI-innovate (UK)Songwriter(s)Fiona FayeProducer(s)George Eyo, Mel Glynn (Arranger) and Najero OkenabirhieThe Wah Wah Collective singles chronology Conceptual Love (2010) T...

 

ГородСинковильясCincovillas Герб 41°12′19″ с. ш. 2°49′10″ з. д.HGЯO Страна  Испания Автономное сообщество Кастилия-Ла-Манча Провинция Гвадалахара Район Ла-Серрания Глава Мария дель Кармен Мартин Мартинес[d] История и география Площадь 16,4 км² Высота 1012 м Часовой п...

 

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (يونيو 2022) يوميات الحزن العادي معلومات الكتاب المؤلف محمود درويش(13 مارس 1941 - 9 أغسطس 2008) البلد  لبنان اللغة اللغة العربية الناشر مركز الأبحاث الفلسطيني تاريخ النشر 1973 ...

I Made Mangku PastikaAnggota Dewan Perwakilan DaerahRepublik IndonesiaPetahanaMulai menjabat 1 Oktober 2019Perolehan suara269.790 (2019)Daerah pemilihanBaliGubernur Bali ke-ke-8Masa jabatan28 Agustus 2008 – 29 Agustus 2018WakilA.A. Ngurah Puspayoga (2008–13) I Ketut Sudikerta (2013–18)PendahuluDewa Made BerathaPenggantiHamdani (Pj.) I Wayan KosterKepala Kepolisian Daerah BaliMasa jabatan25 April 2003 – 11 Desember 2005PendahuluIrjen Pol. Budi SetiawanPenggant...

 

В защиту науки Країна видання  РосіяМова російськаРедактор Eduard Kruglyakovd klnran.ru/bulletin/ «На захист науки» — бюлетень, друкований орган Комісії з боротьби зі лженаукою[ru]. На своїх сторінках критикує шарлатанів у науці та бізнесі, які пропонують державі або громадянам витра

 

Чорноліська культура Археологічні культури Східної та Центральної Європи в середині VIII століття до н. е. Чорноліська культура виділена синім кольоромРозташування УкраїнаЧас існування прибл. XI-VIII ст. до н. е.Попередня культура Білогрудівська культураҐава-голіград...

American college football season 1923 Cornell Big Red footballCo-national champion (Sagarin)ConferenceIndependentRecord8–0Head coachGil Dobie (4th season)Offensive schemeSingle-wingBase defense6–3–2CaptainGeorge PfannHome stadiumSchoellkopf FieldUniformSeasons← 19221924 → 1923 Eastern college football independents records vte Conf Overall Team W   L   T W   L   T Cornell   –   8 – 0 – 0 Yale  ...

 

The British International School BratislavaБританська міжнародна школа в Братиславі Кампус на Пекнікова, 6Тип приватна міжнародна школаКраїна  СловаччинаРозташування Дубравка 48°11′14″ пн. ш. 17°02′03″ сх. д. / 48.18725500002777551° пн. ш. 17.034355000027780136° сх. д. / 48.18725500002777...

 

SM83 redirects here. For the airliner, see Savoia-Marchetti SM.83. This article needs attention from an expert in Norway or Trains. The specific problem is: Stockholm closed 1967 not -57, door arrangement obviously 1-2-2 not 2-1-2; it doesn't belong to the Mustang tram family, (Hägglunds just built the motors), if that's wrong, how much more?. WikiProject Norway or WikiProject Trains may be able to help recruit an expert. (June 2017) SM53SM53 in Holtegata on the Briskeby Line in 19...

Dice game by Milton Bradley This article is about the dice game. For the video game journalist, see Ben Yahtzee Croshaw. Not to be confused with the similar, but different game of Yatzy. YahtzeeUK release of the game from the 1980sOther namesCassyDesignersEdwin LoweIllustratorsFiore GmbH Taavi OolbergPeyo Charles M. SchulzPublishersMilton BradleyPublication1956; 67 years ago (1956)Years active1956 –Players2–10Playing time30 minutesChanceHighAge range8+Skillsluckprobabili...

 

佛教 基本教義 四圣谛 八正道 十二因缘 五蘊 緣起 空性 因果 業 戒律 毗奈耶 尸羅 五戒 禪那 业处 轮回 波罗密 涅槃 真如 佛性 皈依 三寶 三法印 佛教共識宣言 修行成就/果位 佛 菩萨 辟支佛 四向四果 阿罗汉 阿那含 斯陀含 須陀洹 人物(英语:List_of_Buddhists) 释迦牟尼 十大弟子 迦多衍尼子 馬鳴 龍樹 提婆 无著 世亲 覺音 鸠摩罗什 慧遠 菩提达摩 智顗 玄奘 惠能 蓮花生 宗...

 

Pemilihan Umum Kongres Rakyat Nasional2017-20182012-20132022-2023Oktober 2017 - Februari 2018Semua 2.980 kursi di Kongres Rakyat Nasional1.491 kursi untuk meraih status mayoritasKandidat   Ketua Xi Jinping Aliansi Front Persatuan Pemilu sebelumnya 100% Kursi sebelumnya 2.157 Kursi yang dimenangkan 2.095 Perubahan kursi 72 Ketua petahanaZhang Dejiang Partai Komunis Ketua terpilih Li Zhanshu Partai Komunis Sunting kotak info • L • BBantuan penggunaan ...

School district in Pennsylvania South Eastern School DistrictAddress377 Main Street Fawn Grove, Pennsylvania, 17321United StatesDistrict informationTypePublicOther informationWebsitesesdweb.net/sesd/site/default.asp The South Eastern School District is a midsized, rural, public school district in southern York County, Pennsylvania. It serves the boroughs of Cross Roads, Stewartstown, Delta, and Fawn Grove, plus the townships of Hopewell Township, East Hopewell Township, Fawn Township, and Pea...

 

Ministry of the government of Argentina Ministry of DefenseMinisterio de DefensaLibertador Building, headquarters of the MinistryMinistry overviewFormed1854; 169 years ago (1854)Preceding MinistryMinistry of War (Argentine Confederation; first creation)JurisdictionGovernment of ArgentinaHeadquartersLibertador Building, Azopardo 250, Buenos AiresAnnual budget$ 246,143,974,961 (2021)[1]Minister responsibleJorge TaianaWebsiteargentina.gob.ar/defensa Politics of Argentin...

 

Binary relation over a set and itself In mathematics, a homogeneous relation (also called endorelation) on a set X is a binary relation between X and itself, i.e. it is a subset of the Cartesian product X × X.[1][2][3] This is commonly phrased as a relation on X[4] or a (binary) relation over X.[5][6] An example of a homogeneous relation is the relation of kinship, where the relation is between people. Common types of endorelations include orde...

Railway station in Hampshire, England For other uses, see Winchester railway station (disambiguation). WinchesterWinchester railway stationGeneral informationLocationWinchester, City of WinchesterEnglandGrid referenceSU477300Managed bySouth Western RailwayPlatforms2Other informationStation codeWINClassificationDfT category C1HistoryOpened10 June 1839Passengers2017/18 5.092 million2018/19 5.242 million2019/20 4.872 million2020/21 1.111 million2021/22 2.960 million Interchange  38,476...

 

1988 single by Ronnie Milsap and Mike ReidOld FolksSingle by Ronnie Milsap and Mike Reidfrom the album Heart & Soul B-sideEarthquakeReleasedMarch 5, 1988GenreCountryLength4:02LabelRCA NashvilleSongwriter(s)Mike ReidProducer(s)Ronnie Milsap, Rob GalbraithRonnie Milsap singles chronology Where Do the Nights Go (1988) Old Folks (1988) Button Off My Shirt (1988) Mike Reid singles chronology Old Folks(1988) Walk on Faith(1991) Old Folks is a song recorded by American country music arti...

 

Ten artykuł dotyczy 1 Pułku Szwoleżerów-Lansjerów Gwardii Cesarskiej. Zobacz też: 1 Pułk Szwoleżerów – stronę ujednoznaczniającą. 1 Pułk Szwoleżerów-Lansjerów Gwardii Cesarskiej Somosierra, mal. January Suchodolski (Szwadron Łubieńskiego zajmuje ostatnią baterię, na ziemi przygnieciony koniem Niegolewski) Historia Państwo Francja Sformowanie 6 kwietnia 1807 Rozformowanie 1815 Dowódcy Pierwszy Wincenty Krasiński Ostatni Paweł Jerzmanowski Działania zbrojne wojny napo...

1966 novel by Bernard Malamud For other uses, see The Fixer (disambiguation). This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: The Fixer novel – news · newspapers · books · scholar · JSTOR (January 2012) (Learn how and when to remove this template message) The Fixer (novel) First editionAuthorBernard Mal...

 

Bola api atau bola cahaya abad ke-17 dari Veste Coburg, Jerman. Bom pembakar yang dijatuhkan di Southend-on-Sea tahun 1916. Perangkat pembakar, senjata pembakar, amunisi pembakar, atau bom pembakar adalah senjata yang dirancang untuk menyalakan api atau menghancurkan peralatan sensitif dengan api (dan kadang-kadang digunakan sebagai senjata anti-personel), yang menggunakan bahan-bahan seperti napalm, termit, bubuk magnesium, klorin trifluorida, atau fosfor putih. Meskipun dalam bahasa sehari-...

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!