Sinclair BASIC: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 32:
# Poteva essere avviata l'esecuzione di [[linguaggio macchina]] usando la funzione <code>USR</code> passandogli come valore l'indirizzo di memoria a cui iniziava il codice ed ottenendo come risultato il contenuto dell'intero registro BC (su altri computer basati sullo [[Zilog Z80|Z80]] veniva restituito il valore del registro HL), per cui:<br>&nbsp;&nbsp;&nbsp;<code>LET A=USR 30000</code><br>iniziava l'esecuzione del codice macchina presente all'indirizzo 30000 e, dopo il suo completamento, memorizzava il valore della coppia di byte costituenti il registro BC nella variabile <code>a</code>, che poteva essere utilizzata dal programma chiamante.
 
A differenza dei dialetti BASIC per home computer derivati dal [[Microsoft BASIC]], le funzioni <code>LEFT$()</code>, <code>MID$()</code> e <code>RIGHT$()</code> del Sinclair BASIC accedevano alle stringhe come [[array]]: ad esempio, <code>A$ (5 TO 10)</code> restituiva una sottostringa contenente i caratteri di <code>A$</code> compresi fra il 5° ed il 10°. Come nei moderni linguaggi di programmazione quali il [[Python]], era possibile rimpiazzare i comandi <code>LEFT$()</code> e <code>RIGHT$()</code> semplicemente omettendo la parte sinistra o destra del parametro: per questo motivo <code>A$ ( TO 5)</code> è equivalente a <code>LEFT$(A$,5)</code>.
<!--
Unlike the LEFT$(), MID$() and RIGHT$() functions used in the ubiquitous [[Microsoft BASIC]] dialects for home computers, parts of strings in Sinclair BASIC are accessed in a manner similar to arrays. For example, A$ (5 TO 10) will give a substring starting with the 5th and ending with the 10th character of A$. As with modern programming languages such as Python, it was therefore possible to replace the LEFT$() and RIGHT$() commands simply by omitting the left or right array position respectively; for instance A$ ( TO 5) is equivalent to LEFT$(A$,5).
 
==Timex BASIC==
Il dialetto ''''Timex BASIC''', utilizzato nei compatibili Spectrum come il [[Timex Sinclair 2068]] (ma non nel [[Timex Computer 2048]] che utilizzava il Sinclair BASIC tradizionale) aveva le seguenti parole chiavi aggiuntive:
 
* <code>DELETE</code> cancellava un intervallo di linee del programma BASIC
The '''Timex BASIC''' dialect, used on the Spectrum-compatible [[Timex Sinclair 2068|TS2068]], but not the [[Timex Computer 2048|TC2048]], which used the ordinary Sinclair BASIC, has the following six keywords as well as the ordinary Sinclair BASIC ones:
* <code>FREE</code> era una funzione che restituiva il quantitativo di memoria libera.
* <code>ON ERR</code> era una funzione che intercettava gli errori, utilizzata principalmente per salti condizionali <code>ON ERR GO TO</code> o code>ON ERR GO SUB</code>.
* <code>RESET</code> resettava la macchina e le periferiche.
* <code>SOUND</code> pilotava il chip audio AY-3-8192.
* <code>STICK</code> leggeva la posizione del [[joystick]] interno ([[Timex Sinclair 2090]]).
 
==Voci correlate==
* DELETE deletes BASIC program line ranges. SHIFT + 0 with the K cursor produces the command DELETE.
*[[Beta BASIC]], di ''Andy Wright'': nato come estensione del Sinclair BASIC, alla fine divenne un interprete vero e proprio.
* FREE is a function that gives the amount of free RAM. PRINT FREE will show how much RAM is free.
*[[SuperBASIC]], dialetto BASIC molto avanzato, introdotto con il [[Sinclair QL]]: aveva delle similitudini con il Sinclair BASIC.
* ON ERR is an error detection function mostly used as ON ERR GO TO or ON ERR GO SUB.
* RESET can be used to reset the machine. It was intended to reset peripherals.
* SOUND commands the AY-3-8192 sound chip.
* STICK is a function that gives the position of the internal joystick (Timex Sinclair 2090).
 
==SeeCollegamenti alsoesterni==
*[http://www.worldofspectrum.org/ZXBasicManual/ Sinclair ZX Spectrum BASIC Programming] — TheIl originalmanuale 1982originale manualdel 1982 bydi Steven Vickers (referencedvedi abovenote)
*[[Beta BASIC]], written by Dr. Andy Wright, was originally a [[BASIC extension]], but ended up as a full-fledged interpreter.
*[http://www.worldofspectrum.org/ZX81BasicProgramming/ Sinclair ZX81 Basic Programming] — alsoSempre bydi Vickers
*[[SuperBASIC]], a much more advanced BASIC dialect, introduced with the [[Sinclair QL]] personal computer, with some similarities to the earlier Sinclair BASICs.
*[http://scratchpad.wikia.com/wiki/Sinclair_BASIC_History The History of Sinclair BASIC] — ByDocumenti di Andrew Owen, whosesul Sinclair BASIC documentsospitati aredal hosted by thesito "World of Spectrum website"
 
==ReferencesNote==
*Vickers, Steven (1982).Vickers: ''Sinclar ZX Spectrum BASIC Programming''. - Sinclair Research. ([[1982]])
*Ardley, Neil (1984).Ardley: ''Sinclair ZX Spectrum+ User Guide''. [[- Dorling Kindersley]] in associationassociazione withcon Sinclair Research. ([[1984]]) ISBN 0-86318-080-9.
 
[[CategoryCategoria:ZX Spectrum]]
==External links==
[[Categoria:Intepreti BASIC]]
*[http://www.worldofspectrum.org/ZXBasicManual/ Sinclair ZX Spectrum BASIC Programming] — The original 1982 manual by Steven Vickers (referenced above)
*[http://www.worldofspectrum.org/ZX81BasicProgramming/ Sinclair ZX81 Basic Programming] — also by Vickers
*[http://scratchpad.wikia.com/wiki/Sinclair_BASIC_History The History of Sinclair BASIC] — By Andrew Owen, whose Sinclair BASIC documents are hosted by the World of Spectrum website
 
[[Category:ZX Spectrum]]
[[Category:Sinclair Research]]
[[Category:BASIC interpreters]]
-->
 
[[cs:Sinclair BASIC]]