diff --git a/docs/cls.md b/docs/cls.md new file mode 100644 index 000000000..947f24809 --- /dev/null +++ b/docs/cls.md @@ -0,0 +1,39 @@ +#CLS + +##Syntax + +``` + CLS +``` + +##Description + +`CLS` is short for *CLear Screen*, and will do just that: it will clear the screen, setting the background +with the current [PAPER](paper.md) color, and placing the Screen Cursor at (0, 0) - screen top-leftmost corner. + + +##Examples + +``` +REM sets the screen black, and INK white +BORDER 0: PAPER 0: INK 7 +CLS +PRINT "White text on black background" +``` + + +##Remarks + +* This sentence is compatible with Sinclair BASIC + +##See also + +* [PRINT](print.md) +* [AT](at.md) +* [PAPER](paper.md) +* [BORDER](border.md) +* [INVERSE](inverse.md) +* [INK](ink.md) +* [ITALIC](italic.md) +* [BOLD](bold.md) +* [OVER](over.md) diff --git a/docs/img/games/cuadragon.png b/docs/img/games/cuadragon.png new file mode 100644 index 000000000..c2295688d Binary files /dev/null and b/docs/img/games/cuadragon.png differ diff --git a/docs/index.md b/docs/index.md index 28d41f74b..a3b323920 100644 --- a/docs/index.md +++ b/docs/index.md @@ -14,17 +14,27 @@ * [Command line options](zxb.md#Command_Line_Options)
Command line options table for the compiler (zxb) -# Products +# Download + +Get the latest version of ZX BASIC from the [archive](archive.md). + +# Released prorams * [Released programs](released_programs.md)
A list of third-party released programs (mostly games) for the ZX-Spectrum developed with ZX BASIC. -# Download +# Learning ZX BASIC +## Language Reference +* [Language syntax](syntax.md) +
Language Syntax is very close to the original Sinclair BASIC, but it's expanded and enhanced. -Get the latest version of ZX BASIC from the [archive](archive.md). +* [Data types](types.md) +
Language data types: Instead of working always with Floating Point numbers (also available), there are also some integer types which are faster an take less memory. -# Tutorials + * [Reserved words](identifier.md) +
Comprehensive list (alphabetically ordered) of identifiers you shouldn't use as a ''variable name''. E.g. `FOR`, `PRINT`. If you want usage instructions on a statement, also look here. +## Tutorials * [Programming tutorials](tutorials.md)
A collection of third-party tutorials about development with ZX BASIC. @@ -39,20 +49,10 @@ Get the latest version of ZX BASIC from the [archive](archive.md). * [Community Forum](http://www.boriel.com/forum)
Have a question? Need help or comment a report a bug? Go to the [ZX BASIC forum](http://www.boriel.com/forum) -#External resources +# External resources * Here you are [external resources](external_resources.md): other tools, IDEs, graphic designers and projects related to ZX BASIC. Have a look! -#Language Reference -* [Language syntax](syntax.md) -
Language Syntax is very close to the original Sinclair BASIC, but it's expanded and enhanced. - -* [Data types](types.md) -
Language data types: Instead of working always with Floating Point numbers (also available), there are also some integer types which are faster an take less memory. - - * [Reserved words](identifier.md) -
Comprehensive list (alphabetically ordered) of identifiers you shouldn't use as a ''variable name''. E.g. `FOR`, `PRINT`. If you want usage instructions on a statement, also look here. - # External libraries * [Library](library.md) diff --git a/docs/print.md b/docs/print.md new file mode 100644 index 000000000..d9f65f893 --- /dev/null +++ b/docs/print.md @@ -0,0 +1,124 @@ +#PRINT + +##Syntax + +``` + PRINT [][;] +``` + +##Description + +`PRINT` is a sentence used to output information on the screen. The ZX Spectrum screen is divided in 24 rows (numbered +from 0 to 23), and 32 columns (numbered from 0 to 31). So it's composed of 24 x 32 = 96 cells. Cells are referred by +its coordinate (row, column), being (0, 0) the top-leftmost cell, and (23, 31) the bottom-rightmost one. + +There's a _hidden cursor_ on the screen that points to the coordinate where the next character will be printed. +Each time something is printed, a _carriage return_ is also printed and the screen cursor is advanced to +the next line (row): + +``` +PRINT "I'M ON ONE LINE" +PRINT "I'M ON THE NEXT ONE" +``` + +If you don't want this to happen, you can add a semicolon (;) at the end of the `PRINT` sentence, and the next +printed expression will still be on the same line: + +``` +PRINT "I'M ON ONE LINE"; +PRINT "... AND I'M ALSO ON THE SAME LINE" +PRINT "AND I'M ON A NEW LINE" +``` +Notice the first `PRINT` ends with a semicolon to avoid _carriage return_. Executing a single `PRINT` will just +advance the cursor to the next line. + +> **NOTE**: when the cursor reaches the end of the screen, it will **scroll upwards** all rows 1 position. + +Let's prints numbers from 0 to 25 and see what happens: + +``` +CLS: REM Clears screeen and puts the cursor at the top-leftmost corner +FOR i = 0 TO 25 + PRINT i +NEXT i +``` +You'll see that number 0 and 1 are gone (they were shifted up and went out of the screen). + +> **NOTE**: When the screen is cleared with [CLS](cls.md), the cursor is set to its default position (0, 0), +> that is, the top-leftmost screen corner. + +`PRINT` can print everything that is a _single_ expression (also called an _item_). +That is, strings (like in the previous example), numbers, variable values, and array elements +(it can not print an entire array; that's not a `single` element but a collection): + +For example: + +``` +LET a = 5 +PRINT "Variable 'a' contains the value: "; +PRINT a +``` + +Indeed, if you want to chain several expressions one after another you can _chain_ them in a single PRINT sentence +using semicolons: +``` +LET a = 5 +PRINT "Variable 'a' contains the value: "; a +``` + +## Changing the print position +You can change the current _cursor_ position using the [AT](at.md) modifier: + +``` +PRINT AT 5, 0; "This message starts at ROW 5" +PRINT AT 10, 10; "This message starts at ROW 10, COLUMN 10" +``` + +Again, you can chain all `PRINT` _items_ using semicolon: + +``` +PRINT AT 5, 0; "ROW 5"; AT 10, 10; "ROW 10, COLUMN 10" +``` + +## Changing appearance +You can temporarily override the aspect of the items printed using them inline: + +``` +CLS +FOR i = 1 to 7 + PRINT AT i, 0; PAPER 0; INK i; "PRINT AT ROW "; i; " WITH INK "; i +NEXT i +``` + +See the related commands section for further info. + +##Examples + +``` +REM Prints a letter in the 10th row of the screen moving from left to right +CLS +FOR i = 0 TO 31 + PRINT AT 10, i; "A" + PAUSE 10 + PRINT AT 10, i; " ": REM Erases the letter +NEXT i +``` + + +##Remarks + +* This sentence is compatible with Sinclair BASIC but _expands_ it, since it allows printing at rows 22 and 23 + (all 24 rows are available to the programmer). Traditionally, Sinclair BASIC only allows to print at rows 0..21. +* You can use [ITALIC](italic.md) and [BOLD](bold.md) modifiers (not available in Sinclair BASIC) + +##See also + +* [CLS](cls.md) +* [AT](at.md) +* [PAPER](paper.md) +* [BORDER](border.md) +* [INVERSE](inverse.md) +* [INK](ink.md) +* [ITALIC](italic.md) +* [BOLD](bold.md) +* [OVER](over.md) diff --git a/docs/released_programs.md b/docs/released_programs.md index 117c51d4b..3eb155c62 100644 --- a/docs/released_programs.md +++ b/docs/released_programs.md @@ -5,6 +5,21 @@ This is a list of third-party ZX-Spectrum programs (mostly games) developed with ##PLAYABLE GAMES +### Cuadragon + +Author: [Duefectu](http://duefectucorp.com/) + +Type: Adventure Game + +Year: 2020 + +Source: No + +Link: [http://duefectucorp.com/Productos/Cuadragon](http://duefectucorp.com/Productos/Cuadragon) + +![cuadragon.png](./img/games/cuadragon.png) + +--- ### AD LUNAM Author: [Alessandro Grussu](https://www.alessandrogrussu.it/profilo.html) @@ -20,6 +35,8 @@ Link: [https://www.alessandrogrussu.it/Adlunam.html](https://www.alessandrogruss ![ad_lunam.png](./img/games/ad_lunam.png) + +--- ### ZX Connection Author: [Antonio Silva](https://avlixa.itch.io/) @@ -35,6 +52,8 @@ Link: [https://avlixa.itch.io/zx-connection](https://avlixa.itch.io/zx-connectio ![zxconnection.png](./img/games/zxconnection.png) + +--- ### Binary Land Author: [Joflof](https://www.joflof.com) @@ -50,6 +69,8 @@ Link: [https://www.joflof.com/binary.html](https://www.joflof.com/binary.html) ![binaryland.png](./img/games/binaryland.png) + +--- ###3 Reyes Magos @@ -66,6 +87,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27998](https://spectr ![3ReyesMagos.gif](./img/games/3reyesmagos.gif) + +--- ###A Broken Friend Author: Paul Jenkinson @@ -81,6 +104,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27296](https://spectr ![BrokenFriend.gif](./img/games/brokenfriend.gif) + +--- ###Abydos Author: J.B.G.V. @@ -97,6 +122,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28165](https://spectr ![Abydos.png](./img/games/abydos.png) + +--- ###Bacaball Author: Paulo Silva @@ -112,6 +139,8 @@ Link: [http://www.mojontwins.com/csscgc2011/nitrofurano-bacaball/](http://www.mo ![Bacaball.png](./img/games/bacaball.png) + +--- ###Bacachase Author: Paulo Silva @@ -127,6 +156,8 @@ Link: [http://www.mojontwins.com/csscgc2011/nitrofurano-bacachase/](http://www.m ![Bacachase.png](./img/games/bacachase.png) + +--- ###BerksMan Author: Paul Fisher @@ -146,6 +177,8 @@ Programming tutorial discussing how this was made: [Link](http://goo.gl/4jPd5) + +--- ###Bounty - The Search for Frooge Author: Paul Jenkinson @@ -164,6 +197,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27876](https://spectr + +--- ###Chessboard Attack Authors: Leszek Chmielewski Daniel (LCD), Kriss @@ -182,6 +217,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26121](https://spectr + +--- ###Ciclopes (y Saturno) @@ -204,6 +241,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30024](https://spectr + +--- ###Coches @@ -226,6 +265,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30025](https://spectr + +--- ###Dex @@ -248,6 +289,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26574](https://spectr + +--- ###Earthraid Authors: Leszek Chmielewski Daniel (LCD) @@ -266,6 +309,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27687](https://spectr + +--- ###El Hobbit @@ -288,6 +333,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27993](https://spectr + +--- ###El Hobbit @@ -310,6 +357,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27992](https://spectr + +--- ###Eleuterio, el Mono Serio (demo) @@ -332,6 +381,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27307](https://spectr + +--- ###Encuerer @@ -354,6 +405,8 @@ Link: [http://www.csscgc2013.blogspot.com.es/2013/02/encuerer.html](http://www.c + +--- ###Escape from Cnossus @@ -377,6 +430,8 @@ Link: [http://notimetoplay.org/our-games/escape-from-cnossus/](http://notimetopl + +--- ###Explorer @@ -399,6 +454,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30212](https://spectr + +--- ###H7N9 @@ -419,6 +476,8 @@ Link: [http://nitrofurano.itch.io/h5n1](http://nitrofurano.itch.io/h5n1) + +--- ###He had such a big head that if he were a cat he would have to toss the mice from under the bed with a brow @@ -441,6 +500,8 @@ Link: [http://www.mojontwins.com/2010/05/04/mojontwins-en-la-csscgc-2010/](http: + +--- ###Hunt the Wumpus @@ -463,6 +524,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28119](https://spectr + +--- ###Knights & Demons DX @@ -485,6 +548,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28175](https://spectr + +--- ###Lamega @@ -507,6 +572,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30284](https://spectr + +--- ###Looking for a csscgc2012 theme @@ -531,6 +598,8 @@ Description: optimized for ULA-Plus palette + +--- ###Maritrini, Freelance Monster Slayer en: Las Increibles Vicisitudes de Despertarse Resacosa con Fred en la Cama y Tener que Llegar Mas o Menos Puntual a la Prueba de "Monstruos Vigorosos de Pechos Lustrosos" featuring Los Fratelli @@ -553,6 +622,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27953](https://spectr + +--- ###Memorama @@ -575,6 +646,8 @@ Link: [http://www.mojontwins.com/csscgc2011/paulo-silva-memorama/](http://www.mo + +--- ###O-CMAN @@ -597,6 +670,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26598](https://spectr + +--- ###O-TRIX @@ -619,6 +694,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26573](https://spectr + +--- ###Pets vs Aliens Prologue @@ -641,6 +718,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30197](https://spectr + +--- ###Pixel Quest @@ -663,6 +742,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30237](https://spectr + +--- ###Pixel Quest 2000 @@ -685,6 +766,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=31490](https://spectr + +--- ###Pixel Quest Zero @@ -707,6 +790,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=34291](https://spectr + +--- ###Quest for Witchcraft @@ -729,6 +814,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27261](https://spectr + +--- ###Ratul & Zeki @@ -751,6 +838,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27055](https://spectr + +--- ###Retrobsesion @@ -773,6 +862,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26193](https://spectr + +--- ###Retrobsesion II @@ -795,6 +886,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27389](https://spectr + +--- ###Saltarin @@ -817,6 +910,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27160](https://spectr + +--- ###Solitario @@ -839,6 +934,8 @@ Link: [http://www.mojontwins.com/csscgc2011/nitrofurano-solitario/](http://www.m + +--- ###Souls @@ -861,6 +958,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28172](https://spectr + +--- ###SpeccyWars @@ -883,6 +982,8 @@ Link: [http://www.boriel.com/forum/post4467.html#p4467](http://www.boriel.com/fo + +--- ###Stela @@ -905,6 +1006,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26527](https://spectr + +--- ###Steroids Sports Diving: Splash @@ -927,6 +1030,8 @@ Link: [http://cgc.zx.gen.tr/index.php?game=0628182038](http://cgc.zx.gen.tr/inde + +--- ###The Spectral Dungeons @@ -949,6 +1054,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28173](https://spectr + +--- ###The Tales of Grupp @@ -971,6 +1078,8 @@ Link: [http://retrobytesproductions.blogspot.com.es/2015/02/the-tales-of-grupp.h + +--- ###U-Boot Hunt @@ -993,6 +1102,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27688](https://spectr + +--- ###Uchi-Danza @@ -1015,6 +1126,8 @@ Link: [http://www.mojontwins.com/csscgc2011/jbgv-uchi-danza/](http://www.mojontw + +--- ###VADE RETRO @@ -1037,6 +1150,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27878](https://spectr + +--- ###Vampe: GOTO Vampe @@ -1059,6 +1174,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28168](https://spectr + +--- ###Walking around Porto @@ -1083,6 +1200,8 @@ Description: a tour in Porto (or Oporto) city - runs on a 128kb ZX-Spectrum, on + +--- ###Yumiko in the haunted Mansion @@ -1105,6 +1224,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27988](https://spectr + +--- ###ZEN @@ -1127,6 +1248,8 @@ Link: [http://www.worldofspectrum.org/forums/showthread.php?t=49117](http://www. + +--- ###ZEN II @@ -1149,6 +1272,8 @@ Link: [http://www.worldofspectrum.org/forums/discussion/50404/](http://www.world + +--- ###ZX Destroyer @@ -1171,6 +1296,8 @@ Link: [http://retrobytesproductions.blogspot.com.es/2014/03/zx-destroyer.html](h + +--- ###ZX Striker @@ -1195,6 +1322,8 @@ Link: [http://www.worldofspectrum.org/forums/showthread.php?t=44210](http://www. ##DEMOS + +--- ###EMS Christmas Card Demo @@ -1217,6 +1346,8 @@ Link: [http://www.boriel.com/forum/gallery/ems-christmas-card-demo-t1102.html](h + +--- ###JRPG Test @@ -1239,6 +1370,8 @@ Link: [http://www.boriel.com/forum/gallery/jrpg-test-and-tileeditor-t1082.html]( + +--- ###Just Something Silly @@ -1263,6 +1396,8 @@ Description: + +--- ###Nothing Thing @@ -1289,6 +1424,8 @@ Description: optimized for ULA-Plus palette, it will look weird on common ZX-Spe ##GAME ENGINES + +--- ###BIFROST* ENGINE @@ -1311,6 +1448,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27405](https://spectr + +--- ###BIFROST*2 ENGINE @@ -1333,6 +1472,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30003](https://spectr + +--- ###Fourspriter Engine @@ -1355,6 +1496,8 @@ Link: [http://www.mojontwins.com/juegos_mojonos/fourspriter-1-0/](http://www.moj + +--- ###NIRVANA ENGINE @@ -1377,6 +1520,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30001](https://spectr + +--- ###NIRVANA+ ENGINE @@ -1401,6 +1546,8 @@ Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30002](https://spectr ##UTILITIES + +--- ###+3e FileBrowser @@ -1425,6 +1572,8 @@ Link: [http://www.boriel.com/forum/post4353.html#p4353](http://www.boriel.com/fo ](http://www.old-computers.com/museum/computer.asp?st=1&c=459 was in the "Author" field, i wonder why... -->) + +--- ###Multi I/O Board @@ -1447,6 +1596,8 @@ Link: [http://www.boriel.com/forum/gallery/show-off-your-creativity-t578-45.html + +--- ###The Spectrum Client @@ -1469,6 +1620,8 @@ Link: [http://www.boriel.com/forum/gallery/the-spectrum-client-t972.html](http:/ + +--- ###ZX7 diff --git a/docs/return.md b/docs/return.md new file mode 100644 index 000000000..55d444b2d --- /dev/null +++ b/docs/return.md @@ -0,0 +1,47 @@ +#RESTORE + + +##Syntax +``` +RETURN [] +``` +**RETURN** statement is used in 3 cases: + +1. When returning from a [GO SUB](gosub.md) sentence +2. When returning (exiting) from a [SUB](sub.md) (a subroutine) +3. When returning (exiting) from a [FUNCTION](function.md). In this case a return value must be specified. + + +Returns in the global scope (that is, outside any function or sub) are treated as return from [GO SUB](gosub.md). +Otherwise they are considered as returning from the function or sub they are into. + +> **WARNING**: Using RETURN in global scope without a GOSUB will mostly crash your program.
+> Use `--stack-check` if you suspect you have this bug, to detect it. + +### Example with GO SUB + +``` +10 LET number = 10 +20 GOSUB 1000 : REM calls the subroutine +30 LET number = 20 +40 GOSUB 1000 : REM calls the subroutine again +100 END : REM the program must end here to avoid entering the subroutine without using GOSUB +1000 REM Subroutine that prints number + 1 +1010 PRINT "number + 1 is "; number + 1 +1020 RETURN : REM return to the caller +``` + +This will output: + +``` +number + 1 is 11 +number + 1 is 21 +``` + +##Remarks +* This statement is Sinclair BASIC compatible. + +##See also +* [GO SUB](gosub.md) +* [FUNCTION](function.md) +* [SUB](sub.md) diff --git a/library/memcopy.bas b/library/memcopy.bas index 6e72c152b..6a9471786 100644 --- a/library/memcopy.bas +++ b/library/memcopy.bas @@ -59,7 +59,7 @@ end sub ' ' Copies block of memory from source to dest. ' Source and destiny blocks should not overlap. -' This sub is slighly faster than memmove +' This sub is slightly faster than memmove ' ---------------------------------------------------------------- sub fastcall MemCopy(source as uinteger, dest as uinteger, length as uinteger) asm