Difference between revisions of "Locomotive BASIC"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
Line 1: Line 1:
[http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1031?id=atch1138 free midi ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=156 sonyericsson ringtones] [http://www.rso.cmich.edu/prevet/messageboard/000031c4.htm generic paxil] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832221) midi ringtones] [http://sand-stars.blogspot.com valium sale] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1086 ambien online] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$124 free sprint ringtones] [http://orladron.jubiiblog.de/ cheap adipex] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=316 ativan online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1091 nexium online] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/zyxuwu.htm free sagem ringtone] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832199) cheap ativan] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=336 mono ringtones] [http://delricc.blogdiario.com/ cheap lorazepam] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=327 free ringtones] [http://taroelt.jubiiblog.de/ free mono ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=147 free real ringtones] [http://www.rso.cmich.edu/prevet/messageboard/000031b2.htm cheap ativan] [http://discussions.csbsju.edu/general/messages/25/gejobi-229.html buy phentermine] [http://www.hcs.harvard.edu/~twiki/pub/Main/CoyarCharline/popydi.htm norco online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1031?id=atch1142 ericsson ringtones] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$92 cialis online] [http://www.forumhosting.org/forum.php?mforum=acdrago cheap ultram] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832229) nokia ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=129 cheap levitra] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832237) real ringtones] [http://cacorol.blogdiario.com/ free ericsson ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1104 cheap ortho] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832211) free ringtones] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=353 samsung ringtones] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832206) cheap cyclobenzaprine] [http://relgetvar.jubiiblog.de/ cheap wellbutrin] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=349 free punk ringtones] [http://pasorbas.jubiiblog.de/ free cool ringtones] [http://vigetc.jubiiblog.de/ buy clomid] [http://livior.blogdiario.com/ alltel ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1106 lortab online] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832207) diazepam] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1031?id=atch1130 sagem ringtones] [http://www.forumhosting.org/forum.php?mforum=sajohnst ativan online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1123 free motorola ringtones] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$105 free nextel ringtones] [http://racalmon.jubiiblog.de/ meridia online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1115 nokia ringtones] [http://algetca.jubiiblog.de/ cheap paxil] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1031?id=atch1132 sony ericsson ringtones] [http://silly-n.blogspot.com best bonus casino online] [http://delelro.jubiiblog.de/ sprint ringtones] [http://www.forumhosting.org/forum.php?mforum=vipasac free alltel ringtones] [http://www.forumhosting.org/forum.php?mforum=lirolsit buy xenical] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$130 tramadol online] [http://www.forumhosting.org/forum.php?mforum=coeignus fioricet online] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=347 free polyphonic ringtones] [http://www.forumhosting.org/forum.php?mforum=rebangas buy carisoprodol] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$90 buy ativan] [http://getnoel.blogdiario.com/ ambien online] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832196) alltel ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1097 clomid online] [http://www.hcs.harvard.edu/~twiki/pub/Main/CoyarCharline/pecybu.htm generic alprazolam] [http://www.forumhosting.org/forum.php?mforum=notrocvi free samsung ringtones] [http://boeldron.jubiiblog.de/ free nokia ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1078 cheap adipex] [http://basor5or5.blogdiario.com/ free verizon ringtones] [http://www.forumhosting.org/forum.php?mforum=acrolbas kyocera ringtones] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832246) tracfone ringtones] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/votebu.htm free qwest ringtones] [http://www.rso.cmich.edu/prevet/messageboard/000031ad.htm xanax online] [http://www.hcs.harvard.edu/~twiki/pub/Main/CoyarCharline/pyhux.htm generic clonazepam] [http://www.csun.edu/learningnet/discussion/file.php?0,file=133 xenical online] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=319 cingular ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=119 cialis online] [http://www.rso.cmich.edu/prevet/messageboard/000031c1.htm generic alprazolam] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832227) cheap nexium] [http://www.csun.edu/learningnet/discussion/file.php?0,file=116 fioricet online] [http://sitracget.blogdiario.com/ free funny ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=144 free mp3 ringtones] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=362 cheap ultracet] [http://trocgetou.jubiiblog.de/ ativan online] [http://www.csun.edu/learningnet/discussion/file.php?0,file=152 free verizon ringtones] [http://www.rso.cmich.edu/prevet/messageboard/000031b0.htm diazepam online] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=325 free ericsson ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1110 rivotril] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/nini.htm free ringtones] [http://forum.kharkiv.edu/SForums/topic.asp?TOPIC_ID=309&FORUM_ID=3&CAT_ID=3 carisoprodol online] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832255) cheap xanax] [http://cochibas.blogdiario.com/ free free ringtones] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$125 free tracfone ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=125 buy vicodin] [http://pasricac.blogdiario.com/ wwe ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=113 phentermine online] [http://www.csun.edu/learningnet/discussion/file.php?0,file=135 cyclobenzaprine online] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832250) verizon ringtones] [http://bascnadar.blogdiario.com/ hydrocodone online] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=371 buy xenical] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832218) cheap levitra] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=329 hydrocodone online] [http://forum.kharkiv.edu/SForums/topic.asp?TOPIC_ID=316&FORUM_ID=3&CAT_ID=3 cheap meridia] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=343 nokia ringtones] [http://www.rso.cmich.edu/prevet/messageboard/000031af.htm cheap ultram] [http://www.csun.edu/learningnet/discussion/file.php?0,file=111 cheap soma] [http://www.csun.edu/learningnet/discussion/file.php?0,file=138 cheap propecia] [http://eleltrac.blogdiario.com/ ativan online] [http://www.forumhosting.org/forum.php?mforum=lebowles cheap adipex] [http://getsitolo.jubiiblog.de/ cheap lorazepam] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$114 free samsung ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1031?id=atch1133 free mono ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1125 free sprint ringtones] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=355 cheap soma] [http://cagetca.jubiiblog.de/ celexa online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1080 buy vicodin] [http://discussions.csbsju.edu/general/messages/25/gyxex-235.html buy cialis] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=358 sonyericsson ringtones] [http://ryu-jounetsu.blogspot.com canadian casino online] [http://rochili.jubiiblog.de/ cheap cyclobenzaprine] [http://www.forumhosting.org/forum.php?mforum=laoubo free qwest ringtones] [http://ricvicna.blogdiario.com/ free polyphonic ringtones] [http://pasbasor.blogdiario.com/ ultram online] [http://eltc4tric.jubiiblog.de/ xanax online] [http://www.csun.edu/learningnet/discussion/file.php?0,file=142 free tracfone ringtones] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1121 qwest ringtones] [http://ellapas.jubiiblog.de/ lipitor online] [http://forum.kharkiv.edu/SForums/topic.asp?TOPIC_ID=312&FORUM_ID=3&CAT_ID=3 cheap ultram] [http://www.csun.edu/learningnet/discussion/file.php?0,file=136 buy nexium] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$118 sony ericsson ringtones] [http://discussions.csbsju.edu/general/messages/25/xyli-236.html cheap ativan] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832257) cheap xenical] [http://www.rso.cmich.edu/prevet/messageboard/000031b1.htm generic cialis] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$91 cheap carisoprodol] [http://www.forumhosting.org/forum.php?mforum=laerzel sagem ringtones] [http://www.rso.cmich.edu/prevet/messageboard/000031b4.htm meridia online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1120 nextel ringtones] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832194) but tramadol] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=317 carisoprodol online] [http://bondich.blogspot.com mixing valium and xanax] [http://eltaric.blogdiario.com/ cheap norco] [http://www.hcs.harvard.edu/~twiki/pub/Main/CoyarCharline/xikuzo.htm generic valium] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=322 cyclobenzaprine online] [http://pasbasbas.jubiiblog.de/ clonazepam online] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832216) free kyocera ringtones] [http://forum.kharkiv.edu/SForums/topic.asp?TOPIC_ID=317&FORUM_ID=3&CAT_ID=3 cheap adipex] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1031?id=atch1131 free sonyericsson ringtones] [http://www.rso.cmich.edu/prevet/messageboard/000031ac.htm carisoprodol online] [http://www.csun.edu/learningnet/discussion/file.php?0,file=130 hydrocodone online] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/ronut.htm free sony ericsson ringtone] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=334 cheap meridia] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1108 zanaflex online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1031?id=atch1129 free cingular ringtones] [http://raccaelt.jubiiblog.de/ viagra online] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=369 wwe ringtones] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/digesyv.htm free nokia ringtone] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832225) free mtv ringtones] [http://eltvivi.blogdiario.com/ vicodin online] [http://www.hcs.harvard.edu/~twiki/pub/Main/CoyarCharline/bipivu.htm generic meridia] [http://www.forumhosting.org/forum.php?mforum=getcoro sony ericsson ringtones] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832238) sagem ringtones] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832236) free qwest ringtones] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832243) sony ringtones] [http://www.forumhosting.org/forum.php?mforum=coephrai cheap tramadol] [http://www.rso.cmich.edu/prevet/messageboard/000031d2.htm free qwest ringtones] [http://letocoer.jubiiblog.de/ polyphonic ringtones] [http://forum.kharkiv.edu/SForums/topic.asp?TOPIC_ID=310&FORUM_ID=3&CAT_ID=3 cheap xanax] [http://www.csun.edu/learningnet/discussion/file.php?0,file=155 free sagem ringtones] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/ciby.htm free funny ringtone] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=356 free sony ericsson ringtones] [http://www.csun.edu/learningnet/discussion/file.php?0,file=121 cheap viagra] [http://www.csun.edu/learningnet/discussion/file.php?0,file=141 free free ringtones] [http://ricrotroc.blogdiario.com/ free samsung ringtones] [http://eltlili.jubiiblog.de/ ambien online] [http://ouglova.blogspot.com valium half life] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832248) buy ultram] [http://www.csun.edu/learningnet/discussion/file.php?0,file=157 free sony ericsson ringtones] [http://www.hcs.harvard.edu/~twiki/pub/Main/CoyarCharline/rujop.htm generic phentermine] [http://woolygrrl.blogspot.com valium side effects] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$134 cheap valium] [http://www8.vjc.edu/EnvironmentalClub/discuss/msgReader$95 diazepam online] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/tubonyh.htm free samsung ringtone] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1113 cheap hoodia] [http://acdronou.jubiiblog.de/ diazepam online] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832224) mp3 ringtones] [http://alcodom.blogdiario.com/ viagra online] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=370 online xanax] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832241) cheap soma] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=312 but adipex] [https://www-internal.slac.stanford.edu/glast/integrationtest/online/Forum/topic.asp?TOPIC_ID=318 cialis online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1030?id=atch1105 pharmacy online online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1066 cheap soma] [http://coracou.jubiiblog.de/ order hydrocodone] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1094 didrex online] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1087 cheap lorazepam] [http://www.forumhosting.org/forum.php?mforum=covarrel funny ringtones] [http://lasitdron.jubiiblog.de/ cheap sildenafil] [http://src.moffitt.usf.edu/sf/sfmain/do/downloadAttachment/projects.jaffy/tracker.bug_tracker/artf1029?id=atch1084 levitra online] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/nyzihyp.htm free tracfone ringtones] [http://manka-kapak.blogspot.com casino craps online] [http://www.rso.cmich.edu/prevet/messageboard/000031c8.htm free ringtone] [http://www.forumhosting.org/forum.php?mforum=oudronacel cheap didrex] [http://www.hcs.harvard.edu/~twiki/pub/Main/CoyarCharline/kukoti.htm generic cialis] [http://www.hcs.harvard.edu/~twiki/pub/Main/AngelKristofer/sinyfu.htm free mp3 ringtone] [http://pathology.jhu.edu/N/n.web?EP=N&URL=/MCGI/SEND1^WEBUTLTY(200,832228) free nextel ringtones] [http://ervarli.blogdiario.com/ jazz ringtones] {{stub}}
+
{{stub}}
  
 
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]
 
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]
Line 34: Line 34:
 
* Better garbage collection
 
* Better garbage collection
 
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)
 
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)
* FRAME (CALL
+
* FRAME (CALL &BD19)
 +
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)
 +
* GRAPHICS PAPER, GRAPHICS PEN commands
 +
* ON BREAK CONT (disable ESCape)
 +
* CLEAR INPUT (flush keyboard buffer)
 +
* The AUTO command show the whole line if it exist, it only printed a * on the 464
 +
 
 +
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.
 +
 
 +
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become Mallard BASIC, the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.
 +
 
 +
== Command list ==
 +
 
 +
=== Commands and operators ===
 +
 
 +
==== AFTER I[,t] GOSUB Ln ====
 +
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.
 +
 
 +
==== AUTO [Ln, i] ====
 +
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.
 +
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.
 +
: Example:
 +
 
 +
<pre>
 +
AUTO 100,5 - generates line numbers 100, 105, 110...
 +
</pre>
 +
 
 +
==== BORDER color ====
 +
: Changes the color of the border.
 +
 
 +
==== CALL add[,list of parameters] ====
 +
: Allows an externally developed subroutine to be called by BASIC
 +
: Example:
 +
 
 +
<pre>
 +
CALL 0 - resets the computer completely
 +
</pre>
 +
 
 +
==== CAT ====
 +
: Displays the names of all existing programes on the tape or disk.
 +
: Examples:
 +
 
 +
<pre>
 +
CAT [ENTER] - lists all disk files in alpha-numeric order
 +
TAPE [ENTER]
 +
CAT [ENTER] - lists names of all tape files in their storage order
 +
</pre>
 +
 
 +
==== CHAIN "filename"[,ln]====
 +
 
 +
:Enables the specified program to be loaded and RUN automatically. If the optional parameters ln is specified, the program execution will commence from line ln.
 +
 
 +
==== CHAIN MERGE "filename"[,ln][,DELETE1 nl - 1n2]====
 +
 
 +
:Loads the specified program from tape or disk, merges it into the program in memory, and starts execution of the merged program. The parameter DELETE1n1 - 1n2 is used to delete part of the original program before running it, if required.
 +
 
 +
==== CLEAR ====
 +
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.
 +
 
 +
==== CLG [ink] ====
 +
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.
 +
 
 +
==== CLOSEIN ====
 +
: Closes any input file (tape or disk).
 +
 
 +
==== CLOSEOUT ====
 +
: Closes any output file (tape or disk).
 +
 
 +
==== CLS ====
 +
: Clears the screen. The text cursor is moved to the upper left corner.
 +
 
 +
==== CONT ====
 +
 
 +
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program.
 +
 
 +
==== CURSOR ====
 +
: [...]
 +
 
 +
==== DATA x1[,x2,x3...]====
 +
: Defines a data ''section'' to be used by <tt>READ</tt> calls.
 +
: Data values can be of any type (integer, real or string) as long as the corresponding <tt>READ</tt> calls use a variable of the right type.
 +
 
 +
:Example:
 +
 
 +
<pre>
 +
10 DATA "Hello, world!", 42
 +
20 READ message$:PRINT message$
 +
30 READ answer:PRINT "The answer is:";answer
 +
</pre>
 +
 
 +
:''See also:'' <tt>READ</tt>, <tt>RESTORE</tt>
 +
 
 +
==== DEF ====
 +
: [...]
 +
 
 +
==== DEFINT letter range====
 +
 
 +
: Forces all variables(s) starting with the specified letter(s) to be string variables. The s does not need to be added to DEFSTR variable names.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
10 DEFSTR N - sets all variables starting with letter N as strings.
 +
</pre>
 +
 
 +
==== DEFREAL ====
 +
: [...]
 +
 
 +
==== DEFSTR ====
 +
 
 +
: Sets the default for variable(s) with the specified first letter(s) to integer. The letter range could be an inclusive range A-Z
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
10 DEFINT F,S ..... (or 10 DEFINT A-Z)
 +
20 FIRST=111.11:SECOND=22.2
 +
30 PRINT FIRST,SECOND - prints 111                22
 +
</pre>
 +
 
 +
==== DEG ====
 +
: Switch to degrees mode for trigonometric functions (<tt>SIN</tt>, <tt>COS</tt>...).
 +
 
 +
''See also:'' <tt>RAD</tt>
 +
 
 +
==== DELETE [line] ====
 +
: Deletes the current program completely (without argument) or only the given line.
 +
 
 +
==== DI ====
 +
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.
 +
 
 +
==== DIM v[$](i1[,i2]) ====
 +
 
 +
: Specifies storage space to be allocated for list or table v[$]. i1 is number of rows, i2 is number of columns. If a list or a table is not specified by DIM, i1 and i2 default to 10.
 +
 
 +
==== DRAW x,y [,[i1][,i2]] ====
 +
 
 +
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.
 +
 
 +
<pre>
 +
i2 = 0  normal colour  i2 = 2 AND colour
 +
i2 = 1  XOR colour      i2 = 3 OR colour
 +
</pre>
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
CLG 2
 +
DRAW 500,400,0 - draws a line from 0,0 to 500,400
 +
</pre>
 +
 
 +
==== DRAWR xr, yr, [[i1][,i2]] ====
 +
 
 +
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.
 +
:Example:
 +
 
 +
<pre>
 +
Move 200,200
 +
DRAWR 100,100,0 - draws a line from 200,200 to 300,300
 +
</pre>
 +
 
 +
==== EDIT line ====
 +
: Copies one program line to screen in edition mode.
 +
 
 +
==== EI ====
 +
: Enable interrupts which have been disabled by DI
 +
 
 +
==== END ====
 +
: Indicates end of program
 +
 
 +
==== ENT ====
 +
: [...]
 +
 
 +
==== ENV ====
 +
: [...]
 +
 
 +
==== ERASE v[$(i1[,i2]) ====
 +
: Clears the contents of an array that is no longer required.
 +
 
 +
==== ERL ====
 +
 
 +
: Returns the line number of the last error encountered.
 +
 
 +
==== ERROR i ====
 +
: Returns the error message whose error code number is i.
 +
 
 +
==== EVERY i[,t] GOSUB ln ====
 +
 
 +
: BASIC branches to the subroutine at line ln every i/50 seconds.
 +
 
 +
==== FILL i ====
 +
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.
 +
 
 +
==== FN ====
 +
: [...]
 +
 
 +
==== FOR TO STEP NEXT ====
 +
: [...]
 +
 
 +
==== FRAME ====
 +
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &BD19 instead.
 +
 
 +
==== GOSUB i ====
 +
 
 +
: Jumps to subroutine which is given as argument.
 +
: ''Example:''
 +
 
 +
<pre>
 +
10 PRINT "Calling subroutine"
 +
20 GOSUB 100
 +
30 PRINT "Back from subroutine"
 +
40 END
 +
100 REM Begin of the subroutine
 +
110 PRINT "Subroutine started"
 +
120 RETURN
 +
</pre>
 +
 
 +
==== GOTO i ====
 +
: Jumps to the line number which is given as argument.
 +
: ''Example:''
 +
<pre>
 +
10 GOTO 100
 +
20 REM not executed
 +
30 REM not executed
 +
100 PRINT "Hello World!"
 +
</pre>
 +
 
 +
==== GRAPHICS ====
 +
: [...]
 +
 
 +
==== IF THEN ELSE ====
 +
: [...]
 +
 
 +
==== INK ====
 +
: [...]
 +
 
 +
==== INPUT ====
 +
: [...]
 +
 
 +
==== KEY ====
 +
: [...]
 +
 
 +
==== LET ====
 +
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.
 +
: ''Example:''
 +
<pre>
 +
10 LET a$ = "hello world"
 +
20 PRINT a$
 +
</pre>
 +
 
 +
==== LINE ====
 +
: [...]
 +
 
 +
==== LIST ====
 +
: [...]
 +
 
 +
==== LOAD ====
 +
: [...]
 +
 
 +
==== LOCATE x,y ====
 +
 
 +
: Moves the text cursor to the x,y location.
 +
 
 +
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).
 +
 
 +
: y starts at 1 at the top and ends at 25 at the bottom.
 +
 
 +
==== MASK [i1][,i2]====
 +
 
 +
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).
 +
 
 +
:Example:
 +
 
 +
<pre>
 +
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400
 +
20 MASK 15:MOVE 0,0:DRAW 500,400
 +
</pre>
 +
 
 +
==== MEMORY add====
 +
 
 +
: Allocates the amount of memory to be used by BASIC by setting the address of the highest byte it may use.
 +
 
 +
==== MERGE ====
 +
: [...]
 +
 
 +
==== MID$ ====
 +
: [...]
 +
 
 +
==== MODE ====
 +
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.
 +
 
 +
==== MOVE x,y [[,i1][,i2]]====
 +
 
 +
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.
 +
 
 +
==== MOVER ====
 +
: [...]
 +
 
 +
==== NEW ====
 +
: [...]
 +
 
 +
==== ON BREAK CONT ====
 +
 
 +
: Prevents the interruption of program execution by the ESC key.
 +
 
 +
==== ON BREAK GOSUB ln ====
 +
 
 +
: Passes control to subroutine at line ln when ESC ESC pressed.
 +
 
 +
==== ON BREAK STOP ====
 +
 
 +
: Restores normal function of ESC key during program execution.
 +
 
 +
==== ON ERROR GOTO ln ====
 +
 
 +
: Passes the control to line ln if an error is detected in the program.
 +
 
 +
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.
 +
 
 +
==== OPENIN "datafile" ====
 +
 
 +
: Opens the specified data file for reading.
 +
 
 +
==== OPENOUT "datafile" ====
 +
: Opens the specified data file for writing.
 +
 
 +
==== ORIGIN ====
 +
: [...]
 +
 
 +
==== OUT add,i ====
 +
 
 +
: Outputs the value of i (0-255) to the I/O address add.
 +
 
 +
==== PAPER ====
 +
: [...]
 +
 
 +
==== PEN ====
 +
: [...]
 +
 
 +
==== PLOT ====
 +
: [...]
 +
 
 +
==== PLOTR ====
 +
: [...]
 +
 
 +
==== POKE add ====
 +
 
 +
: Alters contents of memory location add to value i (0-255)
 +
 
 +
==== PRINT ====
 +
: [...]
 +
 
 +
==== RAD ====
 +
: Switch to radians mode for trigonometric functions (<tt>SIN</tt>, <tt>COS</tt>...).
 +
 
 +
: ''See also:'' <tt>DEG</tt>
 +
 
 +
==== RANDOMIZE [seed] ====
 +
 
 +
: Resets the pseudo-random generator to the given seed. What is strange is that if no seed is given, one is interactively prompted for.
 +
 
 +
: A common idiom to have a ''random'' random seed is to do:
 +
 
 +
<pre>
 +
RANDOMIZE TIME
 +
</pre>
 +
 
 +
==== READ variable ====
 +
: Gets the next data item (from <tt>DATA</tt> commands), stores it in the given variable and moves to the next item.
 +
The variable must be of the correct type.
 +
 
 +
''See also:'' <tt>DATA</tt>, <tt>RESTORE</tt>
 +
 
 +
==== RELEASE ====
 +
: [...]
 +
 
 +
==== REM [any text]====
 +
: Introduces a comment.
 +
 
 +
==== RENUM [newLine],[oldLine],[step] ====
 +
: Renumbers the lines of the current program.
 +
 
 +
: By default, the whole program is renumbered starting at line 10 with multiples of ten. It is important to note that ''jumps'' (<tt>GOTO</tt>, <tt>GOSUB</tt> and the like) are automatically converted to the new line numbers.
 +
 
 +
: The whole set of parameters can be used to renumber only the last part of a program.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
10 GOTO 20
 +
20 GOTO 30
 +
30 GOTO 10
 +
</pre>
 +
 
 +
: becomes, after calling <tt>RENUM 100,20,5</tt>
 +
 
 +
<pre>
 +
10 GOTO 100
 +
100 GOTO 105
 +
105 GOTO 10
 +
</pre>
 +
 
 +
==== RESTORE [line] ====
 +
 
 +
: Resets the data pointer used by <tt>READ</tt>. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
10 DATA 10,11,12,13,14
 +
20 DATA 20
 +
READ i:PRINT i
 +
10
 +
Ready
 +
READ i:PRINT i
 +
11
 +
Ready
 +
RESTORE
 +
Ready
 +
READ i:PRINT i
 +
10
 +
Ready
 +
RESTORE 20
 +
Ready
 +
READ i:PRINT i
 +
20
 +
Ready
 +
</pre>
 +
 
 +
 
 +
: ''See also:'' <tt>DATA</tt>, <tt>READ</tt>
 +
 
 +
==== RESUME ====
 +
: [...]
 +
 
 +
==== RETURN ====
 +
 
 +
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)
 +
 
 +
==== RUN [line] ====
 +
: Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.
 +
 
 +
==== SAVE ====
 +
: [...]
 +
 
 +
==== SOUND ====
 +
: [...]
 +
 
 +
==== SPC ====
 +
: [...]
 +
 
 +
==== SPEED ====
 +
: [...]
 +
 
 +
==== SQ (channel) ====
 +
 
 +
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C
 +
 
 +
:Bits 0,1 and 2    Number of free entries in the queue
 +
:Bits 3,4 and 5    Redezvous state at head of the queue
 +
:Bit 6              Head of the queue is held
 +
:Bit 7              Channel is currently active
 +
 
 +
==== STOP ====
 +
 
 +
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.
 +
 
 +
==== SUB ====
 +
: [...]
 +
 
 +
==== SWAP ====
 +
: [...]
 +
 
 +
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====
 +
 
 +
: Redefines the appearance of the character at index n.
 +
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.
 +
: Each character fits in an 8x8 pixel grid.
 +
: Missing lines are considered as empty.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
SYMBOL 255,255,129,129,129,129,129,129,255
 +
PRINT CHR$(255)
 +
</pre>
 +
 
 +
: Defines character 255 to look like an empty square and prints it.
 +
 
 +
: Initially, only characters with indices ranging from 240 to 255 can be redefined.
 +
: See also <tt>SYMBOL AFTER</tt> to allow redefinition of arbitrary characters.
 +
 
 +
==== SYMBOL AFTER n ====
 +
: Allows the redefinition of character symbols from index n included.
 +
 
 +
: Symbol redefinitions are made using the SYMBOL command above.
 +
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with <tt>SYMBOL AFTER 240</tt>. Symbol previously redefined are restored to their original appearance.
 +
 
 +
==== TAB ====
 +
: [...]
 +
 
 +
==== TAG [#st] ====
 +
 
 +
: Allows text to print at graphics cursor position.
 +
: see TAGOFF
 +
 
 +
==== TAGOFF [#st] ====
 +
 
 +
: Directs text to stream st printing it at previous text cursor position.
 +
 
 +
==== TROFF ====
 +
 
 +
: Turns off the program flow trace (see TRON)
 +
 
 +
==== TRON ====
 +
 
 +
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.
 +
 
 +
==== USING ====
 +
: [...]
 +
 
 +
==== WAIT add, i1[,i2] ====
 +
 
 +
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.
 +
 
 +
==== WHILE WEND ====
 +
: [...]
 +
 
 +
==== WIDTH ====
 +
: [...]
 +
 
 +
==== WINDOW ====
 +
: [...]
 +
 
 +
==== WRITE [#st,] v[$], v[$] ====
 +
 
 +
: Writes the values of the specified variable to the specified stream.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
10 OPENOUT "DUMMY"
 +
20 INPUT A$,A
 +
30 WRITE #9,A$,A
 +
40 CLOSEOUT
 +
</pre>
 +
 
 +
==== ZONE i====
 +
 
 +
: Changes the width of the print zone. Default is 13.
 +
 
 +
=== Operators ===
 +
 
 +
==== AND ====
 +
: [...]
 +
 
 +
==== MOD ====
 +
: [...]
 +
 
 +
==== NOT ====
 +
: [...]
 +
 
 +
==== OR ====
 +
: [...]
 +
 
 +
==== XOR ====
 +
: [...]
 +
 
 +
=== Functions ===
 +
 
 +
==== ABS (n) ====
 +
: Returns the absolute value of n by ignoring the sign value.
 +
 
 +
: Example
 +
 
 +
<pre>
 +
PRINT ABS(-3.5) - prints 3.5
 +
</pre>
 +
 
 +
==== ASC (s) ====
 +
 
 +
: Returns ASCII code number of first character of string s
 +
 
 +
==== ATN (n) ====
 +
: Returns the arctangent of n.
 +
 
 +
==== BIN$ (i1,[i2]) ====
 +
: Returns binary representation of i1 between -32768 and 65535. The number of binary digits (0s and 1s) is specified by i2 (0-16)
 +
: Example:
 +
 
 +
<pre>
 +
PRINT BIN$(66,8) - prints 01000010
 +
</pre>
 +
 
 +
==== CHR$ (n)====
 +
: Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.
 +
 
 +
: As an example, try the following basic program :
 +
 
 +
<pre>10 print chr$(208+rnd(2));:goto 10</pre>
 +
 
 +
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.
 +
 
 +
==== CINT (n) ====
 +
 
 +
: Returns rounded up integer value of n between -32768 and 32767.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT CINT(3.8) - print 4
 +
</pre>
 +
 
 +
==== COPYCHR$ (st) ====
 +
 
 +
: Copies character from current position in specified stream.
 +
 
 +
==== COS (n) ====
 +
 
 +
: Returns cosine of n in degrees or radians (se DEG and RAD)
 +
 
 +
==== CREAL (n) ====
 +
 
 +
: Converts integer n to real numeric variable.
 +
 
 +
==== DEC$(n, format) ====
 +
 
 +
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)
 +
 
 +
==== DERR ====
 +
 
 +
: Gives the most recent error code number returned by [[Amsdos]].
 +
 
 +
==== EOF ====
 +
 
 +
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)
 +
 
 +
==== ERR ====
 +
 
 +
: Returns the error code number of the last error encountered.
 +
 
 +
==== EXP (i) ====
 +
 
 +
: Returns the result of calculating e to the power i.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT EXP(1) - prints 2.71828183
 +
</pre>
 +
 
 +
==== FIX (n) ====
 +
 
 +
: Removes the fractional part of n (see INT)
 +
 
 +
==== FRE (n/se) ====
 +
 
 +
: Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.
 +
 
 +
: Examples:
 +
 
 +
<pre>
 +
PRINT FRE(o) or PRINT FRE("hello")
 +
</pre>
 +
 
 +
==== HEX$ (i1, i2) ====
 +
 
 +
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)
 +
 
 +
==== HIMEM ====
 +
 
 +
: Returns address of the highest memory address used by BASIC.
 +
 
 +
==== INKEY (i) ====
 +
: Checks to see if key number i is being pressed.
 +
 
 +
<pre>
 +
Value returned          [SHIFT]        [CTRL]      Specified key
 +
-1                      ignored        ignored      up
 +
0                      up            up          down
 +
32                      down          up          down
 +
128                    up            down        down
 +
160                    down          down        down
 +
</pre>
 +
 
 +
==== INKEY$ ====
 +
 
 +
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.
 +
 
 +
==== INP (add) ====
 +
 
 +
: Returns value read from the I/O address add
 +
 
 +
==== INSTR ====
 +
: [...]
 +
 
 +
==== INT (n) ====
 +
 
 +
: As in FIX if n is positive; if n is negative, it rounds it down.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT INT(3.99), INT(-3.99) - prints 3                      -4
 +
</pre>
 +
 
 +
==== JOY (i) ====
 +
 
 +
: Returns bit-significant value from specified joystick. i = 0 or 1.
 +
 
 +
<pre>
 +
Bit            Value returned
 +
0(up)                  1
 +
1(down)                2
 +
2(left)                4
 +
3(right)              8
 +
4(fire 2)              16
 +
5(fire 1)              32
 +
</pre>
 +
 
 +
==== LEFT$ (se, i) ====
 +
 
 +
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
A$="ABCDEFG":PRINT LEFT$(A$,3) - prints ABC
 +
</pre>
 +
 
 +
==== LEN (se) ====
 +
 
 +
: Returns the number of characters in se (0 - 255)
 +
 
 +
==== LOG (n) ====
 +
 
 +
: Returns the natural logarithm (to base e) of n.
 +
 
 +
==== LOG10 (n) ====
 +
 
 +
: Returns the logarithm to base 10 of n.
 +
 
 +
==== LOWER$ (se) ====
 +
 
 +
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)
 +
 
 +
: Example
 +
 
 +
<pre>
 +
PRINT LOWER$("A1B2c3") - print a1b2c3
 +
</pre>
 +
 
 +
==== MAX (list of n) ====
 +
 
 +
: Returns the maximum value from the given list.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT MAX(3,8,25,1,2,9) - prints 25
 +
</pre>
 +
 
 +
==== MIN (list of n) ====
 +
 
 +
: Returns the minimum value from the given list (see MAX)
 +
 
 +
==== PEEK (add) ====
 +
 
 +
: Returns the contents of the specified memory location (0-65535)
 +
 
 +
==== PI ====
 +
 
 +
: Returns value of PI (3.14159265)
 +
 
 +
==== POS (#st) ====
 +
 
 +
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT POS(#0) - prints 1
 +
</pre>
 +
 
 +
==== REMAIN (i) ====
 +
 
 +
: Returns count remaining in delay timer i (0-3) then disables it.
 +
 
 +
==== RIGHT$ (se,i) ====
 +
 
 +
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.
 +
 
 +
: Example
 +
 
 +
<pre>
 +
PRINT RIGHT$("ABCDEFG",3) - prints EFG
 +
</pre>
 +
 
 +
==== RND [(n)] ====
 +
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.
 +
 
 +
==== ROUND (n[,i1]) ====
 +
 
 +
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.
 +
: Example:
 +
 
 +
<pre>
 +
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600
 +
</pre>
 +
 
 +
==== SGN (n) ====
 +
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.
 +
 
 +
==== SIN (n) ====
 +
: Returns sine of n in degree or radian mode (see DEG and RAD)
 +
 
 +
==== SPACE$(i) ====
 +
 
 +
: Creates a string containing i spaces (0-255)
 +
 
 +
==== SQ (channel) ====
 +
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.
 +
<pre>
 +
Bits 0,1 and 2    number of free entries in the queue
 +
Bits 3,4 and 5    redezvous state at head of the queue
 +
Bit 6              head of the queue is held
 +
Bit 7              channel is currently active
 +
</pre>
 +
 
 +
==== SQR (n) ====
 +
: Returns the square root of n.
 +
 
 +
==== STR$(n) ====
 +
 
 +
: Returns the string representation of number n.
 +
 
 +
==== STRING$ ====
 +
 
 +
: Returns i copies of the string character specified by s.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT STRING$(3,"*") - prints ***
 +
</pre>
 +
 
 +
==== TAN (n) ====
 +
 
 +
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.
 +
 
 +
==== TEST (x,y) ====
 +
 
 +
: Moves the graphics cursor by x and y and returns the value of the ink at that position.
 +
 
 +
==== TESTR (x,y) ====
 +
 
 +
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.
 +
 
 +
==== TIME ====
 +
: Returns time elapsed since the computer was switched on or reset.
 +
: One second = TIME/300.
 +
 
 +
==== UNT (add) ====
 +
 
 +
: Returns an integer(-32768 to 32767) which is the two's complement of add.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT UNT(&FF66) - prints -154
 +
</pre>
 +
 
 +
==== UPPER$(se) ====
 +
 
 +
: Gives copy of se with all alphabetic characters in upper case.
 +
 
 +
==== VAL(se) ====
 +
 
 +
: Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number.
 +
 
 +
: Example:
 +
 
 +
<pre>
 +
PRINT VAL("-12.34x", VAL("A-12") - prints -12.34    0
 +
</pre>
 +
 
 +
==== VPOS (#st) ====
 +
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.
 +
 
 +
==== XPOS ====
 +
 
 +
: Returns the current horizontal (x) position of the graphics cursor.
 +
 
 +
==== YPOS ====
 +
 
 +
: Returns the current vertical (y) position of the graphics cursor.
 +
 
 +
''(Please, fill in. Looks like a lot of work ;-) ...)''
 +
 
 +
== Error codes ==
 +
 
 +
* 1 '''Unexpected NEXT''' - Occurs when the FOR of a FOR .. NEXT loop is missing.
 +
* 2 '''Syntax Error''' - Typing error or incorrect punctuation.
 +
* 3 '''Unexpected RETURN''' - Caused by entering a subroutine other than with GOSUB.
 +
* 4 '''DATA exhaused''' - Trying to READ data when data pointer has reached end of data.
 +
* 5 '''Improper argument''' - The argument for a function is not legal (eg. PRINT SQR(--10)).
 +
* 6 '''Overflow''' - The computer cannot handle a number greater than 1.7E38.
 +
* 7 '''Memory full''' - All available RAM is being used or has been reserved. Program to big or control structures too deeply nested.
 +
* 8 '''Line does not exist''' - Attempt to RUN, GOTO or GOSUB a non-existent line number.
 +
* 9 '''Subsript out of range''' - Value of a subscript in an array is greater than DIM declaration.
 +
* 10 '''Array already dimensioned''' - Arrays can only be DIMensioned once within a program.
 +
* 11 '''Division by zero''' - Trying to divide a number by zero.
 +
* 12 '''InvalidDirect command''' - Using a statement as a direct command it is not allowd outside a program.
 +
* 13 '''Type mismatch''' - Trying to assign string data to a numeric variable or vice versa.
 +
* 14 '''String space full''' - String memory area is full.
 +
* 15 '''String to long''' - String may not exceed 256 characters.
 +
* 16 '''String expression too complex''' - A string expression need to be broken down into smaller expressions.
 +
* 17 '''CannotCONTinue''' - CONT can only be used if program was stopped by [ESC] or a STOP in program - not after END.
 +
* 18 '''Unknown user function''' - A DEF FN must be executed before calling an FN function.
 +
* 19 '''RESUMEmissing:''' - End of program has been reached while in error processing mode. Use ON ERROR before RESUME.
 +
* 20 '''UnexpectedRESUME''' - RESUME is only used in error processing mode, ON ERROR GOTO statement must be used first.
 +
* 21 '''Direct Command found''' - A line without a line number has found while loading a file.
 +
* 22 '''Oprand missing''' - An incomplete expression has been found.
 +
* 23 '''Line too long''' - The line contains to many statements.
 +
* 24 '''EOF met''' - Trying to input data beyond end of data file.
 +
* 25 '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).
 +
* 26 '''NEXT missing''' - The NEXT of a FOR ... NEXT loop is missing.
 +
* 27 '''File already open''' - Trying to open an open file. Use CLOSEIN or CLOSEOUT first.
 +
* 28 '''Unknown command''' - Given when an unknown command follows a masterspace.
 +
* 29 '''WEND missing''' - The WEND part of the WHILE ... WEND loop is missing.
 +
* 30 '''UnexpectedWEND''' - WEND encountered without a corresponding active WHILE.
 +
* 31 '''File not open''' - Attempting to read from or write to a file without OPENing it first.
 +
 
 +
== Other Basic Dialects available for the CPC ==
 +
 
 +
*[[BBC Basic]]
 +
*[[C BASIC Compiler|C BASIC]]
 +
*[[E-BASIC]]
 +
 
 +
== Web links ==
 +
 
 +
* [http://www.kjthacker.f2s.com/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]
 +
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]
 +
 
 +
[[Category:Programming]]

Revision as of 03:09, 28 April 2007

Template:Stub

CPC Start Screen showing Locomotive copyright and BASIC version

Locomotive BASIC was a BASIC interpreter for the Amstrad CPC range of computers.

Contents

Description

Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent firmware of the CPC, which lent most of its advanced features to the BASIC.

Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the AY-3-8912 via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.

Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's RSX system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as Radzone and applications such as PowerPage, made use of this technique.

With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of "structured programming", though nowhere near the extent of the PROCedures of BBC BASIC.

All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.

If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article "Technical information about Locomotive BASIC".

History

The CPC implementation of Locomotive BASIC was developed directly from Locomotive Software's existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that Amstrad change the CPC's processor from a 6502 to a Z80.

The 464 shipped with BASIC 1.0 on ROM.

The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:

  • DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)
  • Better handling of string arguments to RSXs (|DIR,"*.BAS" rather than a$="*.BAS":|DIR,@a$)
  • DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line
  • FILL command (fill area with solid colour)
  • COPYCHR$ function (fetch character from screen)
  • Better garbage collection
  • Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)
  • FRAME (CALL &BD19)
  • Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)
  • GRAPHICS PAPER, GRAPHICS PEN commands
  • ON BREAK CONT (disable ESCape)
  • CLEAR INPUT (flush keyboard buffer)
  • The AUTO command show the whole line if it exist, it only printed a * on the 464

Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.

The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become Mallard BASIC, the CP/M language shipped with the PCW. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.

Command list

Commands and operators

AFTER I[,t] GOSUB Ln

Waits for i/50 seconds and then jumps to the subruotine at line Ln.

AUTO [Ln, i]

Automaticaly generates line numbers starting at line Ln with increment i between line numbers.
Use [ESC to leave AUTO mode. Default value for Ln and i is 10.
Example:
AUTO 100,5 - generates line numbers 100, 105, 110...

BORDER color

Changes the color of the border.

CALL add[,list of parameters]

Allows an externally developed subroutine to be called by BASIC
Example:
CALL 0 - resets the computer completely

CAT

Displays the names of all existing programes on the tape or disk.
Examples:
CAT [ENTER] - lists all disk files in alpha-numeric order
TAPE [ENTER]
CAT [ENTER] - lists names of all tape files in their storage order

CHAIN "filename"[,ln]

Enables the specified program to be loaded and RUN automatically. If the optional parameters ln is specified, the program execution will commence from line ln.

CHAIN MERGE "filename"[,ln][,DELETE1 nl - 1n2]

Loads the specified program from tape or disk, merges it into the program in memory, and starts execution of the merged program. The parameter DELETE1n1 - 1n2 is used to delete part of the original program before running it, if required.

CLEAR

Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.

CLG [ink]

Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.

CLOSEIN

Closes any input file (tape or disk).

CLOSEOUT

Closes any output file (tape or disk).

CLS

Clears the screen. The text cursor is moved to the upper left corner.

CONT

CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program.

CURSOR

[...]

DATA x1[,x2,x3...]

Defines a data section to be used by READ calls.
Data values can be of any type (integer, real or string) as long as the corresponding READ calls use a variable of the right type.
Example:
10 DATA "Hello, world!", 42
20 READ message$:PRINT message$
30 READ answer:PRINT "The answer is:";answer
See also: READ, RESTORE

DEF

[...]

DEFINT letter range

Forces all variables(s) starting with the specified letter(s) to be string variables. The s does not need to be added to DEFSTR variable names.
Example:
10 DEFSTR N - sets all variables starting with letter N as strings.

DEFREAL

[...]

DEFSTR

Sets the default for variable(s) with the specified first letter(s) to integer. The letter range could be an inclusive range A-Z
Example:
10 DEFINT F,S ..... (or 10 DEFINT A-Z)
20 FIRST=111.11:SECOND=22.2
30 PRINT FIRST,SECOND - prints 111                 22

DEG

Switch to degrees mode for trigonometric functions (SIN, COS...).

See also: RAD

DELETE [line]

Deletes the current program completely (without argument) or only the given line.

DI

Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.

DIM v[$](i1[,i2])

Specifies storage space to be allocated for list or table v[$]. i1 is number of rows, i2 is number of columns. If a list or a table is not specified by DIM, i1 and i2 default to 10.

DRAW x,y [,[i1][,i2]]

Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.
i2 = 0   normal colour   i2 = 2 AND colour
i2 = 1   XOR colour      i2 = 3 OR colour
Example:
CLG 2
DRAW 500,400,0 - draws a line from 0,0 to 500,400

DRAWR xr, yr, [[i1][,i2]]

Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.
Example:
Move 200,200
DRAWR 100,100,0 - draws a line from 200,200 to 300,300

EDIT line

Copies one program line to screen in edition mode.

EI

Enable interrupts which have been disabled by DI

END

Indicates end of program

ENT

[...]

ENV

[...]

ERASE v[$(i1[,i2])

Clears the contents of an array that is no longer required.

ERL

Returns the line number of the last error encountered.

ERROR i

Returns the error message whose error code number is i.

EVERY i[,t] GOSUB ln

BASIC branches to the subroutine at line ln every i/50 seconds.

FILL i

Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.

FN

[...]

FOR TO STEP NEXT

[...]

FRAME

Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &BD19 instead.

GOSUB i

Jumps to subroutine which is given as argument.
Example:
10 PRINT "Calling subroutine"
20 GOSUB 100
30 PRINT "Back from subroutine"
40 END
100 REM Begin of the subroutine
110 PRINT "Subroutine started"
120 RETURN

GOTO i

Jumps to the line number which is given as argument.
Example:
10 GOTO 100
20 REM not executed
30 REM not executed
100 PRINT "Hello World!"

GRAPHICS

[...]

IF THEN ELSE

[...]

INK

[...]

INPUT

[...]

KEY

[...]

LET

Used to define variables. You don't need to use the LET command because it is just a command which was added for compatibility reasons.
Example:
10 LET a$ = "hello world"
20 PRINT a$

LINE

[...]

LIST

[...]

LOAD

[...]

LOCATE x,y

Moves the text cursor to the x,y location.
x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).
y starts at 1 at the top and ends at 25 at the bottom.

MASK [i1][,i2]

Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).
Example:
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400
20 MASK 15:MOVE 0,0:DRAW 500,400

MEMORY add

Allocates the amount of memory to be used by BASIC by setting the address of the highest byte it may use.

MERGE

[...]

MID$

[...]

MODE

Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.

MOVE x,y [[,i1][,i2]]

Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.

MOVER

[...]

NEW

[...]

ON BREAK CONT

Prevents the interruption of program execution by the ESC key.

ON BREAK GOSUB ln

Passes control to subroutine at line ln when ESC ESC pressed.

ON BREAK STOP

Restores normal function of ESC key during program execution.

ON ERROR GOTO ln

Passes the control to line ln if an error is detected in the program.
ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.

OPENIN "datafile"

Opens the specified data file for reading.

OPENOUT "datafile"

Opens the specified data file for writing.

ORIGIN

[...]

OUT add,i

Outputs the value of i (0-255) to the I/O address add.

PAPER

[...]

PEN

[...]

PLOT

[...]

PLOTR

[...]

POKE add

Alters contents of memory location add to value i (0-255)

PRINT

[...]

RAD

Switch to radians mode for trigonometric functions (SIN, COS...).
See also: DEG

RANDOMIZE [seed]

Resets the pseudo-random generator to the given seed. What is strange is that if no seed is given, one is interactively prompted for.
A common idiom to have a random random seed is to do:
RANDOMIZE TIME

READ variable

Gets the next data item (from DATA commands), stores it in the given variable and moves to the next item.

The variable must be of the correct type.

See also: DATA, RESTORE

RELEASE

[...]

REM [any text]

Introduces a comment.

RENUM [newLine],[oldLine],[step]

Renumbers the lines of the current program.
By default, the whole program is renumbered starting at line 10 with multiples of ten. It is important to note that jumps (GOTO, GOSUB and the like) are automatically converted to the new line numbers.
The whole set of parameters can be used to renumber only the last part of a program.
Example:
10 GOTO 20
20 GOTO 30
30 GOTO 10
becomes, after calling RENUM 100,20,5
10 GOTO 100
100 GOTO 105
105 GOTO 10

RESTORE [line]

Resets the data pointer used by READ. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.
Example:
10 DATA 10,11,12,13,14
20 DATA 20
READ i:PRINT i
 10
Ready
READ i:PRINT i
 11
Ready
RESTORE
Ready
READ i:PRINT i
 10
Ready
RESTORE 20
Ready
READ i:PRINT i
 20
Ready


See also: DATA, READ

RESUME

[...]

RETURN

Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)

RUN [line]

Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.

SAVE

[...]

SOUND

[...]

SPC

[...]

SPEED

[...]

SQ (channel)

Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C
Bits 0,1 and 2 Number of free entries in the queue
Bits 3,4 and 5 Redezvous state at head of the queue
Bit 6 Head of the queue is held
Bit 7 Channel is currently active

STOP

Breaks program execution at line containing the STOP statement. The message BREAK in is output with the line number.

SUB

[...]

SWAP

[...]

SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]

Redefines the appearance of the character at index n.
Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.
Each character fits in an 8x8 pixel grid.
Missing lines are considered as empty.
Example:
SYMBOL 255,255,129,129,129,129,129,129,255
PRINT CHR$(255)
Defines character 255 to look like an empty square and prints it.
Initially, only characters with indices ranging from 240 to 255 can be redefined.
See also SYMBOL AFTER to allow redefinition of arbitrary characters.

SYMBOL AFTER n

Allows the redefinition of character symbols from index n included.
Symbol redefinitions are made using the SYMBOL command above.
Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with SYMBOL AFTER 240. Symbol previously redefined are restored to their original appearance.

TAB

[...]

TAG [#st]

Allows text to print at graphics cursor position.
see TAGOFF

TAGOFF [#st]

Directs text to stream st printing it at previous text cursor position.

TROFF

Turns off the program flow trace (see TRON)

TRON

Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.

USING

[...]

WAIT add, i1[,i2]

Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.

WHILE WEND

[...]

WIDTH

[...]

WINDOW

[...]

WRITE [#st,] v[$], v[$]

Writes the values of the specified variable to the specified stream.
Example:
10 OPENOUT "DUMMY"
20 INPUT A$,A
30 WRITE #9,A$,A
40 CLOSEOUT

ZONE i

Changes the width of the print zone. Default is 13.

Operators

AND

[...]

MOD

[...]

NOT

[...]

OR

[...]

XOR

[...]

Functions

ABS (n)

Returns the absolute value of n by ignoring the sign value.
Example
PRINT ABS(-3.5) - prints 3.5

ASC (s)

Returns ASCII code number of first character of string s

ATN (n)

Returns the arctangent of n.

BIN$ (i1,[i2])

Returns binary representation of i1 between -32768 and 65535. The number of binary digits (0s and 1s) is specified by i2 (0-16)
Example:
PRINT BIN$(66,8) - prints 01000010

CHR$ (n)

Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.
As an example, try the following basic program :
10 print chr$(208+rnd(2));:goto 10
It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.

CINT (n)

Returns rounded up integer value of n between -32768 and 32767.
Example:
PRINT CINT(3.8) - print 4

COPYCHR$ (st)

Copies character from current position in specified stream.

COS (n)

Returns cosine of n in degrees or radians (se DEG and RAD)

CREAL (n)

Converts integer n to real numeric variable.

DEC$(n, format)

Retruns the decimal string representation of n, according to the specified format (see PRINT USING)

DERR

Gives the most recent error code number returned by Amsdos.

EOF

Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)

ERR

Returns the error code number of the last error encountered.

EXP (i)

Returns the result of calculating e to the power i.
Example:
PRINT EXP(1) - prints 2.71828183

FIX (n)

Removes the fractional part of n (see INT)

FRE (n/se)

Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.
Examples:
PRINT FRE(o) or PRINT FRE("hello")

HEX$ (i1, i2)

Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)

HIMEM

Returns address of the highest memory address used by BASIC.

INKEY (i)

Checks to see if key number i is being pressed.
Value returned          [SHIFT]        [CTRL]       Specified key
-1                      ignored        ignored      up
0                       up             up           down
32                      down           up           down
128                     up             down         down
160                     down           down         down

INKEY$

Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.

INP (add)

Returns value read from the I/O address add

INSTR

[...]

INT (n)

As in FIX if n is positive; if n is negative, it rounds it down.
Example:
PRINT INT(3.99), INT(-3.99) - prints 3                      -4

JOY (i)

Returns bit-significant value from specified joystick. i = 0 or 1.
Bit             Value returned
0(up)                  1
1(down)                2
2(left)                4
3(right)               8
4(fire 2)              16
5(fire 1)              32

LEFT$ (se, i)

Returns a substring of se. The substring begins at the left-most character of se and contains i characters.
Example:
A$="ABCDEFG":PRINT LEFT$(A$,3) - prints ABC

LEN (se)

Returns the number of characters in se (0 - 255)

LOG (n)

Returns the natural logarithm (to base e) of n.

LOG10 (n)

Returns the logarithm to base 10 of n.

LOWER$ (se)

Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)
Example
PRINT LOWER$("A1B2c3") - print a1b2c3

MAX (list of n)

Returns the maximum value from the given list.
Example:
PRINT MAX(3,8,25,1,2,9) - prints 25

MIN (list of n)

Returns the minimum value from the given list (see MAX)

PEEK (add)

Returns the contents of the specified memory location (0-65535)

PI

Returns value of PI (3.14159265)

POS (#st)

Returns column number of print position relative to left edge of text window on stream st. st must be specified.
Example:
PRINT POS(#0) - prints 1

REMAIN (i)

Returns count remaining in delay timer i (0-3) then disables it.

RIGHT$ (se,i)

Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.
Example
PRINT RIGHT$("ABCDEFG",3) - prints EFG

RND [(n)]

Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.

ROUND (n[,i1])

Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.
Example:
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600

SGN (n)

Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.

SIN (n)

Returns sine of n in degree or radian mode (see DEG and RAD)

SPACE$(i)

Creates a string containing i spaces (0-255)

SQ (channel)

Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.
Bits 0,1 and 2     number of free entries in the queue
Bits 3,4 and 5     redezvous state at head of the queue
Bit 6              head of the queue is held
Bit 7              channel is currently active

SQR (n)

Returns the square root of n.

STR$(n)

Returns the string representation of number n.

STRING$

Returns i copies of the string character specified by s.
Example:
PRINT STRING$(3,"*") - prints ***

TAN (n)

Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.

TEST (x,y)

Moves the graphics cursor by x and y and returns the value of the ink at that position.

TESTR (x,y)

Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.

TIME

Returns time elapsed since the computer was switched on or reset.
One second = TIME/300.

UNT (add)

Returns an integer(-32768 to 32767) which is the two's complement of add.
Example:
PRINT UNT(&FF66) - prints -154

UPPER$(se)

Gives copy of se with all alphabetic characters in upper case.

VAL(se)

Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number.
Example:
PRINT VAL("-12.34x", VAL("A-12") - prints -12.34     0

VPOS (#st)

Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.

XPOS

Returns the current horizontal (x) position of the graphics cursor.

YPOS

Returns the current vertical (y) position of the graphics cursor.

(Please, fill in. Looks like a lot of work ;-) ...)

Error codes

  • 1 Unexpected NEXT - Occurs when the FOR of a FOR .. NEXT loop is missing.
  • 2 Syntax Error - Typing error or incorrect punctuation.
  • 3 Unexpected RETURN - Caused by entering a subroutine other than with GOSUB.
  • 4 DATA exhaused - Trying to READ data when data pointer has reached end of data.
  • 5 Improper argument - The argument for a function is not legal (eg. PRINT SQR(--10)).
  • 6 Overflow - The computer cannot handle a number greater than 1.7E38.
  • 7 Memory full - All available RAM is being used or has been reserved. Program to big or control structures too deeply nested.
  • 8 Line does not exist - Attempt to RUN, GOTO or GOSUB a non-existent line number.
  • 9 Subsript out of range - Value of a subscript in an array is greater than DIM declaration.
  • 10 Array already dimensioned - Arrays can only be DIMensioned once within a program.
  • 11 Division by zero - Trying to divide a number by zero.
  • 12 InvalidDirect command - Using a statement as a direct command it is not allowd outside a program.
  • 13 Type mismatch - Trying to assign string data to a numeric variable or vice versa.
  • 14 String space full - String memory area is full.
  • 15 String to long - String may not exceed 256 characters.
  • 16 String expression too complex - A string expression need to be broken down into smaller expressions.
  • 17 CannotCONTinue - CONT can only be used if program was stopped by [ESC] or a STOP in program - not after END.
  • 18 Unknown user function - A DEF FN must be executed before calling an FN function.
  • 19 RESUMEmissing: - End of program has been reached while in error processing mode. Use ON ERROR before RESUME.
  • 20 UnexpectedRESUME - RESUME is only used in error processing mode, ON ERROR GOTO statement must be used first.
  • 21 Direct Command found - A line without a line number has found while loading a file.
  • 22 Oprand missing - An incomplete expression has been found.
  • 23 Line too long - The line contains to many statements.
  • 24 EOF met - Trying to input data beyond end of data file.
  • 25 FILE type error - Using a program file instead of a data file to read or write (or vice versa).
  • 26 NEXT missing - The NEXT of a FOR ... NEXT loop is missing.
  • 27 File already open - Trying to open an open file. Use CLOSEIN or CLOSEOUT first.
  • 28 Unknown command - Given when an unknown command follows a masterspace.
  • 29 WEND missing - The WEND part of the WHILE ... WEND loop is missing.
  • 30 UnexpectedWEND - WEND encountered without a corresponding active WHILE.
  • 31 File not open - Attempting to read from or write to a file without OPENing it first.

Other Basic Dialects available for the CPC

Web links