TRS-80 Color Computer-дің ROM-ындағы Microsoft BASIC тілі: түсінік, мүмкіндіктері, 1980-1991 жылдарғы даму тарихы. Программалауға арналған қарапайым тіл.
Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Color BASIC — 1980-1991 жылдар аралығында шығарылған Tandy/Radio Shack TRS 80 Color компьютерлерінің ROM-ында кіріктірілген Microsoft BASIC-тің нұсқасы. BASIC (Beginner's All-purpose Symbolic Instruction Code) — қарапайым синтаксисы бар жоғары деңгейдегі бағдарламалау тілі, ол қарапайым бағдарламаларды жазуды жеңілдетеді. Color BASIC интерпретацияланады, яғни, орындалу барысында код шешіледі.
Color BASIC is the implementation of Microsoft BASIC that is included in the ROM of the Tandy/Radio Shack TRS 80 Color Computers manufactured between 1980 and 1991. BASIC (Beginner's All purpose Symbolic Instruction Code) is a high level language with simple syntax that makes it easy to write simple programs. Color BASIC is interpreted, that is, decoded as it is run.
Өмірбаян
Color BASIC ядросы Microsoft BASIC 69 болды, оны Tandy Microsoft-тен лицензиялады. Color BASIC 1.0 1980 жылы түпнұсқа 4к TRS 80 Color Computer-мен бірге шығарылды. Ол 8 килобайт ROM-да орналасқан және жүйедегі барлық «үй шаруашылығы» жұмыстарын атқарады. Бұған аппараттық инициализация, жадты басқару, үзілістерді өңдеу және т.б. жатады. BASIC-тің көптеген нұсқаларындағыдай, кодтың әрбір жолы жол нөмірімен басталады және айнымалылар мен операторлардан тұратын бір немесе бірнеше оператордан құралады. Extended Color BASIC ("ECB") келесі деңгейдегі BASIC үшін 16 килобайт жад қажет. Флоппи-дискілік контроллер үшін кеңейтілген BASIC қажет, содан кейін Disk Extended Color BASIC ("DECB") пайда болады. Бұл интерпретаторды және басқаларын іске қосатын Color Computer эмуляторлары қазіргі заманғы компьютерлер үшін қолжетімді, олардың кейбіреулеріне физикалық машинаның «суреті» файлы қажет.
The nucleus of Color BASIC was Microsoft BASIC 69 which Tandy licensed from Microsoft. Color BASIC 1.0 was released with the original 4k TRS 80 Color Computer in 1980. It resides on 8k bytes of ROM, and is responsible for all 'housekeeping' duties on the system. This includes hardware initialization, memory management, interrupt processing, etc. Like most implementations of BASIC, each line of code starts with a line number and consists of one or more statements with variables and operators. 16k of memory is required for the next level of BASIC, Extended Color BASIC. ("ECB") Extended BASIC is required for the floppy disk controller, which then gives you Disk Extended Color BASIC. ("DECB") Emulators of the Color Computers running this interpreter and the others are available for modern computers, some of which require a "snapshot" file of the physical machine.
Өзгергіштер
Color BASIC сандық және жол типтес айнымалыларды түсінеді. Color BASIC-тегі айнымалы атауларының алғашқы екі әрпі маңызды. Айнымалы атауының бірінші әрпі міндетті түрде әріп болуы керек. Екінші әрпі әріп немесе сан болуы мүмкін. Жол айнымалылары айнымалы атауынан кейін доллар белгісін ($) қосу арқылы белгіленеді.
Color BASIC understands one type of numeric variable and string variables. Variable names in Color BASIC have the first two characters significant. The first character of the variable name must be a letter. The second can be either a letter or number. String variables are indicated by adding a dollar sign ($) after the variable name.
Кілт
num сандық өрнек қажет екенін көрсетеді. Бұл тұрақты сан, айнымалы немесе сандық шаманы қайтаратын кез келген операция немесе функция болуы мүмкін. str - мәтіндік өрнек қажет екенін көрсетеді. Бұл тікелей мәтіндік мән (тырнақшалар ішінде), мәтіндік айнымалы немесе таңбалар тізбесін қайтаратын кез келген функция немесе өрнек болуы мүмкін. Құрылғы нөмірі құрылғыны білдіреді. Дәстүрлі түрде 0 нөміріндегі құрылғы (экран және пернетақта) қолданылады. Color BASIC-те бағдарламашыға 1 нөміріндегі (кассета) және 2 нөміріндегі (принтер) құрылғылар қол жетімді.
num indicates a numeric expression is required. This can be a fixed number, a variable, or other operation or function that returns a numeric quantity. str indicates a string expression is required. This can be a static string value (in quotes), a string variable, or other function or expression that returns a string of characters. device number indicates a device. By default, device 0 (screen and keyboard) is assumed. In Color BASIC, device # 1 (cassette) and # 2 (printer) are available to the programmer.
Өңдеу режімі
Егер бір жолды қате жазсаңыз, оны бастапқыдан қайта теруге (немесе DEL арқылы жоюға) болады немесе EDIT-пен өңдеуге болады. EDIT режимінде жол қайтадан басылып шығады, содан кейін таңбалар бойынша SPACEbar арқылы өңдеуге болатын екінші көшірме пайда болады. Жебе пернелерін қолдануға болмайды. Backspace сізді солға жылдырады, бірақ буферде жойылмайды. 'i' пернесі енгізу режиміне көшіреді. Enter пернесін басу арқылы одан шығуға болады. 'c' бір таңбаны өзгертеді, 'd' бір таңбаны жояды. 'x' жолдың соңына көшіреді, оны ұзартуға мүмкіндік береді. 'l' жолды қайтадан көрсетеді. 's' таңбаның келесі кездесуін іздейді. 's', 'c' және 'd' командалары үшін оларды басудан бұрын санды (#) енгізуге болады, ол: 's' – таңбаның # кездесуін іздейді, 'c' – # таңбаны өзгертуге мүмкіндік береді, 'd' – # таңбаны жояды.
If you make a mistake typing in a line, you can either retype it from scratch (or DEL it) or you can EDIT it. When in EDIT mode, you get a reprint of the line, and a second copy that you SPACEbar across chars. You cannot use arrow keys. backspace takes you left, but does not actually erase it in the buffer. 'i' puts you in insert mode. pressing return gets you out of it. 'c' changes one char, 'd' deletes one char. 'x' takes you to end of line, allowing you to e'x'tend it. 'l' redraws the line. 's' searches for the next instance of a character. For the 's', 'c' and 'd' commands you can also enter a number (#) before pressing any of them which will: 's' search for the # instance of the character, 'c' allow you to change # of characters, 'd' delete # amount characters.