diff --git a/doc/docs b/doc/docs
new file mode 120000
index 000000000..a9594bfe4
--- /dev/null
+++ b/doc/docs
@@ -0,0 +1 @@
+../docs
\ No newline at end of file
diff --git a/doc/process_wiki.py b/doc/process_wiki.py
new file mode 100644
index 000000000..dc8f80cf9
--- /dev/null
+++ b/doc/process_wiki.py
@@ -0,0 +1,111 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from bs4 import BeautifulSoup as BS
+import sys
+import re
+import os
+
+RE_CODE = re.compile('|||||')
+RE_INTERNAL_LINK = re.compile(r'\[\[([^]|]+)(\|[^]]+)?\]\]')
+RE_EXTERNAL_LINK = re.compile(r'\[(http://[^ ]+) ([^]]+)\]')
+
+
+def get_file_names(path):
+ result = set()
+ for root, dir, files in os.walk(path):
+ result.update([os.path.basename(x) for x in files])
+
+ return result
+
+
+def link_to_fname(link):
+ if link.startswith('ZX_BASIC:'):
+ link = link[9:]
+
+ link = link.replace(' ', '_').lower() + '.md'
+ link = link.replace('released_programs_-_', 'released_programs/')
+ return link
+
+
+def write_page(title, text, sha1, already_done):
+ fname = title.replace(' ', '_').lower().replace('released_programs_-_', 'released_programs/') + '.md'
+ if fname in already_done:
+ return
+
+ print('Processing {}'.format(fname))
+
+ with open(fname, 'wt', encoding='utf-8') as fout:
+ fout.write('#{}\n\n'.format(title))
+ started = False
+ verbatim = False
+
+ for line in text.split('\n'):
+ if line == sha1:
+ continue
+
+ started = started or line == 'text/x-wiki'
+ if not started or line == 'text/x-wiki':
+ continue
+
+ prefix = ''
+ if line.startswith(' ') or verbatim:
+ if not verbatim:
+ fout.write('```\n')
+ verbatim = True
+ elif line and not line.startswith(' '):
+ fout.write('\n```')
+ verbatim = False
+
+ if not verbatim:
+ while line and line[0] == line[-1] == '=':
+ line = line[1:-1]
+ prefix = prefix + '#'
+
+ line = line.replace("'''", '**')
+ line = line.replace("''", '_')
+ line = RE_CODE.sub(repl='\n```\n', string=line)
+ line = line.replace('', '_').replace('', '_')
+
+ while True:
+ match = RE_INTERNAL_LINK.search(line)
+ if not match:
+ break
+ lline = list(line)
+ a, b = match.span()
+ fname, txt = match.groups()
+ txt = (txt or fname).lstrip('|')
+ lline[a: b] = list('[{}]({})'.format(txt, link_to_fname(fname)))
+ line = ''.join(lline)
+
+ while True:
+ match = RE_EXTERNAL_LINK.search(line)
+ if not match:
+ break
+ lline = list(line)
+ a, b = match.span()
+ link, txt = match.groups()
+ txt = (txt or link).strip()
+ lline[a: b] = list('[{}]({})'.format(txt, link))
+ line = ''.join(lline)
+
+ line = line.replace('>', '>').replace('<', '<').replace('&', '&')
+ if line.startswith('*') and line[:2] not in ('* ', '**'):
+ line = '* {}'.format(line[1:])
+
+ fout.write(prefix + line + '\n')
+
+
+# given your html as the variable 'html'
+with open(sys.argv[1], 'rt') as f:
+ soup = BS(f.read(), "xml")
+
+already_done = get_file_names('./docs')
+
+pages = soup.find_all('page')
+for page in pages:
+ title = page.title.text
+ if not title.startswith('ZX BASIC:'):
+ continue
+ title = title[9:]
+ write_page(title, page.text, page.sha1.text, already_done)
diff --git a/docs/about.md b/docs/about.md
new file mode 100644
index 000000000..9385b3305
--- /dev/null
+++ b/docs/about.md
@@ -0,0 +1,20 @@
+#About
+
+
+##About the ZX BASIC Project
+
+ZX BASIC is a [BASIC](http://en.wikipedia.org/wiki/BASIC) ''cross compiler''.
+It will compile BASIC programs (in your PC) for your [ZX Spectrum](http://en.wikipedia.org/wiki/Sinclair_ZX_Spectrum).
+ZX BASIC is an SDK entirely written in [python](http://www.python.org).
+The SDK is implemented using the [PLY](http://www.dabeaz.com/ply/) (Python Lex/Yacc) compiler tool.
+It translates BASIC to Z80 assembler code, so it is easily portable to other Z80 platforms (Amstrad, MSX).
+Other non Z80 targets could also be available in the future.
+
+ZX BASIC syntax tries to maintain compatibility as much as possible with
+[Sinclair BASIC](http://en.wikipedia.org/wiki/Sinclair_BASIC), it also have many new features, mostly taken from
+[FreeBASIC](http://www.freebasic.net/wiki) dialect.
+
+###Platform Availability
+Since it is written in python, it is available for many platforms, like Windows, Linux and Mac.
+You only need to have python installed on these. For windows, there also is an installable (.MSI) _compiled_
+version, which does not need python previously installed.
diff --git a/docs/abs.md b/docs/abs.md
new file mode 100644
index 000000000..00c258d32
--- /dev/null
+++ b/docs/abs.md
@@ -0,0 +1,30 @@
+#ABS
+
+##Syntax
+
+
+```
+ABS(numericExpression)
+```
+
+
+##Description
+
+Returns the absolute value of the given argument.
+Argument must be a numeric expression. Returned value has the same type as the input argument.
+
+##Examples
+
+
+```
+REM Absolute value
+LET a = -1
+PRINT "Absolute value of a is "; ABS(a)
+REM 'Will print 1
+```
+
+
+##Remarks
+
+* This function is 100% Sinclair BASIC Compatible
+
diff --git a/docs/acs.md b/docs/acs.md
new file mode 100644
index 000000000..931aa6737
--- /dev/null
+++ b/docs/acs.md
@@ -0,0 +1,32 @@
+#ACS
+
+##Syntax
+
+```
+ACS(numericExpression)
+```
+
+
+##Description
+
+Returns the arc cosine value of the given argument.
+Argument must be a numeric expression. Returned value type is [Float](types#float.md).
+
+##Examples
+
+```
+REM Arc cosine value
+PRINT "Arc Cosine value of a is "; ACS(a)
+```
+
+
+##Remarks
+
+* This function is 100% Sinclair BASIC Compatible
+* If the given argument type is not float, it will be [converted](cast.md) to float before operating with it.
+
+##See also
+
+* [SIN](sin.md) and [ASN](asn.md)
+* [TAN](tan.md) and [ATN](atn.md)
+* [COS](cos.md)
diff --git a/docs/architectures/6502.py.md b/docs/architectures/6502.py.md
new file mode 100644
index 000000000..70bba3e7f
--- /dev/null
+++ b/docs/architectures/6502.py.md
@@ -0,0 +1,171 @@
+#6502.py
+
+```
+ #!/usr/bin/python
+ # -*- coding: utf-8 -*-
+ # vim:ts=4:et:
+ #- important: this code is not acurated yet - needs fixes
+ class Opcode(object):
+ ''' Describes opcodes and other info.
+ '''
+ def __init__(self, asm, time, size, opcode):
+ self.asm = asm
+ self.T = time
+ self.size = size
+ self.opcode = opcode
+ 6502SET = {
+ "BRK": Opcode("BRK", 1, 1, "00"),
+ "ORA (x,X)": Opcode("ORA (x,X)", 1, 1, "01 XX XX"),
+ "ORA x": Opcode("ORA x", 1, 1, "05 XX"),
+ "ASL x": Opcode("ASL x", 1, 1, "06 XX"),
+ "PHP": Opcode("PHP", 1, 1, "08"),
+ "ORA #x": Opcode("ORA #x", 1, 1, "09 XX"),
+ "ASL": Opcode("ASL", 1, 1, "0a"),
+ "ORA ?": Opcode("ORA ?", 1, 1, "0d XX XX"),
+ "ASL ?": Opcode("ASL ?", 1, 1, "0e XX XX"),
+ "BPL x": Opcode("BPL x", 1, 1, "10 XX"),
+ "ORA (x),Y": Opcode("ORA (x),Y", 1, 1, "11 XX"),
+ "ORA x,X": Opcode("ORA x,X", 1, 1, "15 XX"),
+ "ASL x,X": Opcode("ASL x,X", 1, 1, "16 XX"),
+ "CLC": Opcode("CLC", 1, 1, "18"),
+ "ORA ?,Y": Opcode("ORA ?,Y", 1, 1, "19 XX XX"),
+ "ORA ?,X": Opcode("ORA ?,X", 1, 1, "1d XX XX"),
+ "ASL ?,X": Opcode("ASL ?,X", 1, 1, "1e XX XX"),
+ "JSR ?": Opcode("JSR ?", 1, 1, "20 XX XX"),
+ "AND (x,X)": Opcode("AND (x,X)", 1, 1, "21 XX"),
+ "BIT x": Opcode("BIT x", 1, 1, "24 XX"),
+ "AND x": Opcode("AND x", 1, 1, "25 XX"),
+ "ROL x": Opcode("ROL x", 1, 1, "26 XX"),
+ "PLP": Opcode("PLP", 1, 1, "28"),
+ "AND #x": Opcode("AND #x", 1, 1, "29 XX"),
+ "ROL A": Opcode("ROL A", 1, 1, "2a"),
+ "BIT ?": Opcode("BIT ?", 1, 1, "2c XX XX"),
+ "AND ?": Opcode("AND ?", 1, 1, "2d XX XX"),
+ "ROL ?": Opcode("ROL ?", 1, 1, "2e XX XX"),
+ "BMI x": Opcode("BMI x", 1, 1, "30 XX"),
+ "AND (x),Y": Opcode("AND (x),Y", 1, 1, "31 XX"),
+ "AND x,X": Opcode("AND x,X", 1, 1, "35 XX"),
+ "ROL x,X": Opcode("ROL x,X", 1, 1, "36 XX"),
+ "SEC": Opcode("SEC", 1, 1, "38"),
+ "AND ?,Y": Opcode("AND ?,Y", 1, 1, "39 XX XX"),
+ "AND ?,X": Opcode("AND ?,X", 1, 1, "3d XX XX"),
+ "ROL ?,X": Opcode("ROL ?,X", 1, 1, "3e XX XX"),
+ "RTI": Opcode("RTI", 1, 1, "40"),
+ "EOR (x,X)": Opcode("EOR (x,X)", 1, 1, "41 XX"),
+ "EOR x": Opcode("EOR x", 1, 1, "45 XX"),
+ "LSR x": Opcode("LSR x", 1, 1, "46 XX"),
+ "PHA": Opcode("PHA", 1, 1, "48"),
+ "EOR #x": Opcode("EOR #x", 1, 1, "49 XX"),
+ "LSR A": Opcode("LSR A", 1, 1, "4a"),
+ "JMP ?": Opcode("JMP ?", 1, 1, "4c XX XX"),
+ "EOR ?": Opcode("EOR ?", 1, 1, "4d XX XX"),
+ "LSR ?": Opcode("LSR ?", 1, 1, "4e XX XX"),
+ "BVC x": Opcode("BVC x", 1, 1, "50 XX"),
+ "EOR (x),Y": Opcode("EOR (x),Y", 1, 1, "51 XX"),
+ "EOR x,X": Opcode("EOR x,X", 1, 1, "55 XX"),
+ "LSR x,X": Opcode("LSR x,X", 1, 1, "56 XX"),
+ "CLI": Opcode("CLI", 1, 1, "58"),
+ "EOR ?,Y": Opcode("EOR ?,Y", 1, 1, "59 XX XX"),
+ "EOR ?,X": Opcode("EOR ?,X", 1, 1, "5d XX XX"),
+ "LSR ?,X": Opcode("LSR ?,X", 1, 1, "5e XX XX"),
+ "RTS": Opcode("RTS", 1, 1, "60"),
+ "ADC (x,X)": Opcode("ADC (x,X)", 1, 1, "61 XX"),
+ "ADC x": Opcode("ADC x", 1, 1, "65 XX"),
+ "ROR x": Opcode("ROR x", 1, 1, "66 XX"),
+ "PLA": Opcode("PLA", 1, 1, "68"),
+ "ADC #x": Opcode("ADC #x", 1, 1, "69 XX"),
+ "ROR A": Opcode("ROR A", 1, 1, "6a"),
+ "JMP (?)": Opcode("JMP (?)", 1, 1, "6c XX XX"),
+ "ADC ?": Opcode("ADC ?", 1, 1, "6d XX XX"),
+ "ROR ?": Opcode("ROR ?", 1, 1, "6e XX XX"),
+ "BVS x": Opcode("BVS x", 1, 1, "70 XX"),
+ "ADC (x),Y": Opcode("ADC (x),Y", 1, 1, "71 XX"),
+ "ADC x,X": Opcode("ADC x,X", 1, 1, "75 XX"),
+ "ROR x,X": Opcode("ROR x,X", 1, 1, "76 XX"),
+ "SEI": Opcode("SEI", 1, 1, "78"),
+ "ADC ?,Y": Opcode("ADC ?,Y", 1, 1, "79 XX XX"),
+ "ADC ?,X": Opcode("ADC ?,X", 1, 1, "7d XX XX"),
+ "ROR ?,X": Opcode("ROR ?,X", 1, 1, "7e XX XX"),
+ "STA (x,X)": Opcode("STA (x,X)", 1, 1, "81 XX"),
+ "STY x": Opcode("STY x", 1, 1, "84 XX"),
+ "STA x": Opcode("STA x", 1, 1, "85 XX"),
+ "STX x": Opcode("STX x", 1, 1, "86 XX"),
+ "DEY": Opcode("DEY", 1, 1, "88"),
+ "TXA": Opcode("TXA", 1, 1, "8a"),
+ "STY ?": Opcode("STY ?", 1, 1, "8c XX XX"),
+ "STA ?": Opcode("STA ?", 1, 1, "8d XX XX"),
+ "STX ?": Opcode("STX ?", 1, 1, "8e XX XX"),
+ "BCC x": Opcode("BCC x", 1, 1, "90 XX"),
+ "STA (x),Y": Opcode("STA (x),Y", 1, 1, "91 XX"),
+ "STY x,X": Opcode("STY x,X", 1, 1, "94 XX"),
+ "STA x,X": Opcode("STA x,X", 1, 1, "95 XX"),
+ "STX x,Y": Opcode("STX x,Y", 1, 1, "96 XX"),
+ "TYA": Opcode("TYA", 1, 1, "98"),
+ "STA ?,Y": Opcode("STA ?,Y", 1, 1, "99 XX XX"),
+ "TXS": Opcode("TXS", 1, 1, "9a"),
+ "STA ?,X": Opcode("STA ?,X", 1, 1, "9d XX XX"),
+ "LDY #x": Opcode("LDY #x", 1, 1, "a0 XX"),
+ "LDA (x,X)": Opcode("LDA (x,X)", 1, 1, "a1 XX"),
+ "LDX #x": Opcode("LDX #x", 1, 1, "a2 XX"),
+ "LDY x": Opcode("LDY x", 1, 1, "a4 XX"),
+ "LDA x": Opcode("LDA x", 1, 1, "a5 XX"),
+ "LDX x": Opcode("LDX x", 1, 1, "a6 XX"),
+ "TAY": Opcode("TAY", 1, 1, "a8"),
+ "LDA #x": Opcode("LDA #x", 1, 1, "a9 XX"),
+ "TAX": Opcode("TAX", 1, 1, "aa"),
+ "LDY ?": Opcode("LDY ?", 1, 1, "ac XX XX"),
+ "LDA ?": Opcode("LDA ?", 1, 1, "ad XX XX"),
+ "LDX ?": Opcode("LDX ?", 1, 1, "ae XX XX"),
+ "BCS x": Opcode("BCS x", 1, 1, "b0 XX"),
+ "LDA (x),Y": Opcode("LDA (x),Y", 1, 1, "b1"),
+ "LDY x,X": Opcode("LDY x,X", 1, 1, "b4"),
+ "LDA x,X": Opcode("LDA x,X", 1, 1, "b5"),
+ "LDX x,Y": Opcode("LDX x,Y", 1, 1, "b6"),
+ "CLV": Opcode("CLV", 1, 1, "b8"),
+ "LDA ?,Y": Opcode("LDA ?,Y", 1, 1, "b9"),
+ "TSX": Opcode("TSX", 1, 1, "ba"),
+ "LDY ?,X": Opcode("LDY ?,X", 1, 1, "bc"),
+ "LDA ?,X": Opcode("LDA ?,X", 1, 1, "bd"),
+ "LDX ?,Y": Opcode("LDX ?,Y", 1, 1, "be"),
+ "CPY #x": Opcode("CPY #x", 1, 1, "c0 XX"),
+ "CMP (x,X)": Opcode("CMP (x,X)", 1, 1, "c1 XX"),
+ "CPY x": Opcode("CPY x", 1, 1, "c4 XX"),
+ "CMP x": Opcode("CMP x", 1, 1, "c5 XX"),
+ "DEC x": Opcode("DEC x", 1, 1, "c6 XX"),
+ "INY": Opcode("INY", 1, 1, "c8"),
+ "CMP #x": Opcode("CMP #x", 1, 1, "c9 XX"),
+ "DEX": Opcode("DEX", 1, 1, "ca"),
+ "CPY ?": Opcode("CPY ?", 1, 1, "cc XX XX"),
+ "CMP ?": Opcode("CMP ?", 1, 1, "cd XX XX"),
+ "DEC ?": Opcode("DEC ?", 1, 1, "ce XX XX"),
+ "BNE x": Opcode("BNE x", 1, 1, "d0 XX"),
+ "CMP (x),Y": Opcode("CMP (x),Y", 1, 1, "d1 XX"),
+ "CMP x,X": Opcode("CMP x,X", 1, 1, "d5 XX"),
+ "DEC x,X": Opcode("DEC x,X", 1, 1, "d6 XX"),
+ "CLD": Opcode("CLD", 1, 1, "d8"),
+ "CMP ?,Y": Opcode("CMP ?,Y", 1, 1, "d9"),
+ "CMP ?,X": Opcode("CMP ?,X", 1, 1, "dd"),
+ "DEC ?,X": Opcode("DEC ?,X", 1, 1, "de"),
+ "CPX #x": Opcode("CPX #x", 1, 1, "e0 XX"),
+ "SBC (x,X)": Opcode("SBC (x,X)", 1, 1, "e1 XX"),
+ "CPX x": Opcode("CPX x", 1, 1, "e4 XX"),
+ "SBC x": Opcode("SBC x", 1, 1, "e5 XX"),
+ "INC x": Opcode("INC x", 1, 1, "e6 XX"),
+ "INX": Opcode("INX", 1, 1, "e8"),
+ "SBC #x": Opcode("SBC #x", 1, 1, "e9 XX"),
+ "NOP": Opcode("NOP", 1, 1, "ea"),
+ "CPX ?": Opcode("CPX ?", 1, 1, "ec XX XX"),
+ "SBC ?": Opcode("SBC ?", 1, 1, "ed XX XX"),
+ "INC ?": Opcode("INC ?", 1, 1, "ee XX XX"),
+ "BEQ x": Opcode("BEQ x", 1, 1, "f0 XX"),
+ "SBC (x),Y": Opcode("SBC (x),Y", 1, 1, "f1 XX"),
+ "SBC x,X": Opcode("SBC x,X", 1, 1, "f5 XX"),
+ "INC x,X": Opcode("INC x,X", 1, 1, "f6 XX"),
+ "SED": Opcode("SED", 1, 1, "f8"),
+ "SBC ?,Y": Opcode("SBC ?,Y", 1, 1, "f9 XX XX"),
+ "SBC ?,X": Opcode("SBC ?,X", 1, 1, "fd XX XX"),
+ "INC ?,X": Opcode("INC ?,X", 1, 1, "fe XX XX"),
+
+ }
+
+
diff --git a/docs/architectures/68000.py.md b/docs/architectures/68000.py.md
new file mode 100644
index 000000000..c8a45a9f9
--- /dev/null
+++ b/docs/architectures/68000.py.md
@@ -0,0 +1,286 @@
+#68000.py
+
+```
+ #!/usr/bin/python
+ # -*- coding: utf-8 -*-
+ # vim:ts=4:et:
+ #- important - this code is still incomplete and unacurrated
+ class Opcode(object):
+ ''' Describes opcodes and other info.
+ '''
+ def __init__(self, asm, time, size, opcode):
+ self.asm = asm
+ self.T = time
+ self.size = size
+ self.opcode = opcode
+ 68000SET = {
+ "MOVE.B #$N,D0": Opcode("MOVE.B #$N,D0", 1, 1, "10 3C 00 XX"),
+ "MOVE.B #$N,D1": Opcode("MOVE.B #$N,D1", 1, 1, "12 3C 00 XX"),
+ "MOVE.B #$N,D2": Opcode("MOVE.B #$N,D2", 1, 1, "14 3C 00 XX"),
+ "MOVE.B #$N,D3": Opcode("MOVE.B #$N,D3", 1, 1, "16 3C 00 XX"),
+ "MOVE.B #$N,D4": Opcode("MOVE.B #$N,D4", 1, 1, "18 3C 00 XX"),
+ "MOVE.B #$N,D5": Opcode("MOVE.B #$N,D5", 1, 1, "1A 3C 00 XX"),
+ "MOVE.B #$N,D6": Opcode("MOVE.B #$N,D6", 1, 1, "1C 3C 00 XX"),
+ "MOVE.B #$N,D7": Opcode("MOVE.B #$N,D7", 1, 1, "1E 3C 00 XX"),
+ "MOVE.L #$NNNN,D0": Opcode("MOVE.L #$NNNN,D0", 1, 1, "20 3C XX XX XX XX"),
+ "MOVE.L #$NNNN,D1": Opcode("MOVE.L #$NNNN,D1", 1, 1, "22 3C XX XX XX XX"),
+ "MOVE.L #$NNNN,D2": Opcode("MOVE.L #$NNNN,D2", 1, 1, "24 3C XX XX XX XX"),
+ "MOVE.L #$NNNN,D3": Opcode("MOVE.L #$NNNN,D3", 1, 1, "26 3C XX XX XX XX"),
+ "MOVE.L #$NNNN,D4": Opcode("MOVE.L #$NNNN,D4", 1, 1, "28 3C XX XX XX XX"),
+ "MOVE.L #$NNNN,D5": Opcode("MOVE.L #$NNNN,D5", 1, 1, "2A 3C XX XX XX XX"),
+ "MOVE.L #$NNNN,D6": Opcode("MOVE.L #$NNNN,D6", 1, 1, "2C 3C XX XX XX XX"),
+ "MOVE.L #$NNNN,D7": Opcode("MOVE.L #$NNNN,D7", 1, 1, "2E 3C XX XX XX XX"),
+ "MOVE.W #$NN,D0": Opcode("MOVE.W #$NN,D0", 1, 1, "30 3C XX XX"),
+ "MOVE.W #$NN,D1": Opcode("MOVE.W #$NN,D1", 1, 1, "32 3C XX XX"),
+ "MOVE.W #$NN,D2": Opcode("MOVE.W #$NN,D2", 1, 1, "34 3C XX XX"),
+ "MOVE.W #$NN,D3": Opcode("MOVE.W #$NN,D3", 1, 1, "36 3C XX XX"),
+ "MOVE.W #$NN,D4": Opcode("MOVE.W #$NN,D4", 1, 1, "38 3C XX XX"),
+ "MOVE.W #$NN,D5": Opcode("MOVE.W #$NN,D5", 1, 1, "3A 3C XX XX"),
+ "MOVE.W #$NN,D6": Opcode("MOVE.W #$NN,D6", 1, 1, "3C 3C XX XX"),
+ "MOVE.W #$NN,D7": Opcode("MOVE.W #$NN,D7", 1, 1, "3E 3C XX XX"),
+ "MOVE.L #$NNNN,A0": Opcode("MOVE.L #$NNNN,A0", 1, 1, "20 7C XX XX XX XX"),
+ "MOVE.L #$NNNN,A1": Opcode("MOVE.L #$NNNN,A1", 1, 1, "22 7C XX XX XX XX"),
+ "MOVE.L #$NNNN,A2": Opcode("MOVE.L #$NNNN,A2", 1, 1, "24 7C XX XX XX XX"),
+ "MOVE.L #$NNNN,A3": Opcode("MOVE.L #$NNNN,A3", 1, 1, "26 7C XX XX XX XX"),
+ "MOVE.L #$NNNN,A4": Opcode("MOVE.L #$NNNN,A4", 1, 1, "28 7C XX XX XX XX"),
+ "MOVE.L #$NNNN,A5": Opcode("MOVE.L #$NNNN,A5", 1, 1, "2A 7C XX XX XX XX"),
+ "MOVE.L #$NNNN,A6": Opcode("MOVE.L #$NNNN,A6", 1, 1, "2C 7C XX XX XX XX"),
+ "MOVE.L #$NNNN,A7": Opcode("MOVE.L #$NNNN,A7", 1, 1, "2E 7C XX XX XX XX"),
+ "MOVE.W #$NN,A0": Opcode("MOVE.W #$NN,A0", 1, 1, "30 7C XX XX"),
+ "MOVE.W #$NN,A1": Opcode("MOVE.W #$NN,A1", 1, 1, "32 7C XX XX"),
+ "MOVE.W #$NN,A2": Opcode("MOVE.W #$NN,A2", 1, 1, "34 7C XX XX"),
+ "MOVE.W #$NN,A3": Opcode("MOVE.W #$NN,A3", 1, 1, "36 7C XX XX"),
+ "MOVE.W #$NN,A4": Opcode("MOVE.W #$NN,A4", 1, 1, "38 7C XX XX"),
+ "MOVE.W #$NN,A5": Opcode("MOVE.W #$NN,A5", 1, 1, "3A 7C XX XX"),
+ "MOVE.W #$NN,A6": Opcode("MOVE.W #$NN,A6", 1, 1, "3C 7C XX XX"),
+ "MOVE.W #$NN,A7": Opcode("MOVE.W #$NN,A7", 1, 1, "3E 7C XX XX"),
+
+ "MOVE.B D0,D0": Opcode("MOVE.B D0,D0", 1, 1, "10 00"),
+ "MOVE.B D0,D1": Opcode("MOVE.B D0,D1", 1, 1, "12 00"),
+ "MOVE.B D0,D2": Opcode("MOVE.B D0,D2", 1, 1, "14 00"),
+ "MOVE.B D0,D3": Opcode("MOVE.B D0,D3", 1, 1, "16 00"),
+ "MOVE.B D0,D4": Opcode("MOVE.B D0,D4", 1, 1, "18 00"),
+ "MOVE.B D0,D5": Opcode("MOVE.B D0,D5", 1, 1, "1A 00"),
+ "MOVE.B D0,D6": Opcode("MOVE.B D0,D6", 1, 1, "1C 00"),
+ "MOVE.B D0,D7": Opcode("MOVE.B D0,D7", 1, 1, "1E 00"),
+ "MOVE.B D1,D0": Opcode("MOVE.B D1,D0", 1, 1, "10 01"),
+ "MOVE.B D1,D1": Opcode("MOVE.B D1,D1", 1, 1, "12 01"),
+ "MOVE.B D1,D2": Opcode("MOVE.B D1,D2", 1, 1, "14 01"),
+ "MOVE.B D1,D3": Opcode("MOVE.B D1,D3", 1, 1, "16 01"),
+ "MOVE.B D1,D4": Opcode("MOVE.B D1,D4", 1, 1, "18 01"),
+ "MOVE.B D1,D5": Opcode("MOVE.B D1,D5", 1, 1, "1A 01"),
+ "MOVE.B D1,D6": Opcode("MOVE.B D1,D6", 1, 1, "1C 01"),
+ "MOVE.B D1,D7": Opcode("MOVE.B D1,D7", 1, 1, "1E 01"),
+ "MOVE.B D2,D0": Opcode("MOVE.B D2,D0", 1, 1, "10 02"),
+ "MOVE.B D2,D1": Opcode("MOVE.B D2,D1", 1, 1, "12 02"),
+ "MOVE.B D2,D2": Opcode("MOVE.B D2,D2", 1, 1, "14 02"),
+ "MOVE.B D2,D3": Opcode("MOVE.B D2,D3", 1, 1, "16 02"),
+ "MOVE.B D2,D4": Opcode("MOVE.B D2,D4", 1, 1, "18 02"),
+ "MOVE.B D2,D5": Opcode("MOVE.B D2,D5", 1, 1, "1A 02"),
+ "MOVE.B D2,D6": Opcode("MOVE.B D2,D6", 1, 1, "1C 02"),
+ "MOVE.B D2,D7": Opcode("MOVE.B D2,D7", 1, 1, "1E 02"),
+ "MOVE.B D3,D0": Opcode("MOVE.B D3,D0", 1, 1, "10 03"),
+ "MOVE.B D3,D1": Opcode("MOVE.B D3,D1", 1, 1, "12 03"),
+ "MOVE.B D3,D2": Opcode("MOVE.B D3,D2", 1, 1, "14 03"),
+ "MOVE.B D3,D3": Opcode("MOVE.B D3,D3", 1, 1, "16 03"),
+ "MOVE.B D3,D4": Opcode("MOVE.B D3,D4", 1, 1, "18 03"),
+ "MOVE.B D3,D5": Opcode("MOVE.B D3,D5", 1, 1, "1A 03"),
+ "MOVE.B D3,D6": Opcode("MOVE.B D3,D6", 1, 1, "1C 03"),
+ "MOVE.B D3,D7": Opcode("MOVE.B D3,D7", 1, 1, "1E 03"),
+ "MOVE.B D4,D0": Opcode("MOVE.B D4,D0", 1, 1, "10 04"),
+ "MOVE.B D4,D1": Opcode("MOVE.B D4,D1", 1, 1, "12 04"),
+ "MOVE.B D4,D2": Opcode("MOVE.B D4,D2", 1, 1, "14 04"),
+ "MOVE.B D4,D3": Opcode("MOVE.B D4,D3", 1, 1, "16 04"),
+ "MOVE.B D4,D4": Opcode("MOVE.B D4,D4", 1, 1, "18 04"),
+ "MOVE.B D4,D5": Opcode("MOVE.B D4,D5", 1, 1, "1A 04"),
+ "MOVE.B D4,D6": Opcode("MOVE.B D4,D6", 1, 1, "1C 04"),
+ "MOVE.B D4,D7": Opcode("MOVE.B D4,D7", 1, 1, "1E 04"),
+ "MOVE.B D5,D0": Opcode("MOVE.B D5,D0", 1, 1, "10 05"),
+ "MOVE.B D5,D1": Opcode("MOVE.B D5,D1", 1, 1, "12 05"),
+ "MOVE.B D5,D2": Opcode("MOVE.B D5,D2", 1, 1, "14 05"),
+ "MOVE.B D5,D3": Opcode("MOVE.B D5,D3", 1, 1, "16 05"),
+ "MOVE.B D5,D4": Opcode("MOVE.B D5,D4", 1, 1, "18 05"),
+ "MOVE.B D5,D5": Opcode("MOVE.B D5,D5", 1, 1, "1A 05"),
+ "MOVE.B D5,D6": Opcode("MOVE.B D5,D6", 1, 1, "1C 05"),
+ "MOVE.B D5,D7": Opcode("MOVE.B D5,D7", 1, 1, "1E 05"),
+ "MOVE.B D6,D0": Opcode("MOVE.B D6,D0", 1, 1, "10 06"),
+ "MOVE.B D6,D1": Opcode("MOVE.B D6,D1", 1, 1, "12 06"),
+ "MOVE.B D6,D2": Opcode("MOVE.B D6,D2", 1, 1, "14 06"),
+ "MOVE.B D6,D3": Opcode("MOVE.B D6,D3", 1, 1, "16 06"),
+ "MOVE.B D6,D4": Opcode("MOVE.B D6,D4", 1, 1, "18 06"),
+ "MOVE.B D6,D5": Opcode("MOVE.B D6,D5", 1, 1, "1A 06"),
+ "MOVE.B D6,D6": Opcode("MOVE.B D6,D6", 1, 1, "1C 06"),
+ "MOVE.B D6,D7": Opcode("MOVE.B D6,D7", 1, 1, "1E 06"),
+ "MOVE.B D7,D0": Opcode("MOVE.B D7,D0", 1, 1, "10 07"),
+ "MOVE.B D7,D1": Opcode("MOVE.B D7,D1", 1, 1, "12 07"),
+ "MOVE.B D7,D2": Opcode("MOVE.B D7,D2", 1, 1, "14 07"),
+ "MOVE.B D7,D3": Opcode("MOVE.B D7,D3", 1, 1, "16 07"),
+ "MOVE.B D7,D4": Opcode("MOVE.B D7,D4", 1, 1, "18 07"),
+ "MOVE.B D7,D5": Opcode("MOVE.B D7,D5", 1, 1, "1A 07"),
+ "MOVE.B D7,D6": Opcode("MOVE.B D7,D6", 1, 1, "1C 07"),
+ "MOVE.B D7,D7": Opcode("MOVE.B D7,D7", 1, 1, "1E 07"),
+
+ "MOVE.L D0,D0": Opcode("MOVE.L D0,D0", 1, 1, "20 00"),
+ "MOVE.L D0,D1": Opcode("MOVE.L D0,D1", 1, 1, "22 00"),
+ "MOVE.L D0,D2": Opcode("MOVE.L D0,D2", 1, 1, "24 00"),
+ "MOVE.L D0,D3": Opcode("MOVE.L D0,D3", 1, 1, "26 00"),
+ "MOVE.L D0,D4": Opcode("MOVE.L D0,D4", 1, 1, "28 00"),
+ "MOVE.L D0,D5": Opcode("MOVE.L D0,D5", 1, 1, "2A 00"),
+ "MOVE.L D0,D6": Opcode("MOVE.L D0,D6", 1, 1, "2C 00"),
+ "MOVE.L D0,D7": Opcode("MOVE.L D0,D7", 1, 1, "2E 00"),
+ "MOVE.L D1,D0": Opcode("MOVE.L D1,D0", 1, 1, "20 01"),
+ "MOVE.L D1,D1": Opcode("MOVE.L D1,D1", 1, 1, "22 01"),
+ "MOVE.L D1,D2": Opcode("MOVE.L D1,D2", 1, 1, "24 01"),
+ "MOVE.L D1,D3": Opcode("MOVE.L D1,D3", 1, 1, "26 01"),
+ "MOVE.L D1,D4": Opcode("MOVE.L D1,D4", 1, 1, "28 01"),
+ "MOVE.L D1,D5": Opcode("MOVE.L D1,D5", 1, 1, "2A 01"),
+ "MOVE.L D1,D6": Opcode("MOVE.L D1,D6", 1, 1, "2C 01"),
+ "MOVE.L D1,D7": Opcode("MOVE.L D1,D7", 1, 1, "2E 01"),
+ "MOVE.L D2,D0": Opcode("MOVE.L D2,D0", 1, 1, "20 02"),
+ "MOVE.L D2,D1": Opcode("MOVE.L D2,D1", 1, 1, "22 02"),
+ "MOVE.L D2,D2": Opcode("MOVE.L D2,D2", 1, 1, "24 02"),
+ "MOVE.L D2,D3": Opcode("MOVE.L D2,D3", 1, 1, "26 02"),
+ "MOVE.L D2,D4": Opcode("MOVE.L D2,D4", 1, 1, "28 02"),
+ "MOVE.L D2,D5": Opcode("MOVE.L D2,D5", 1, 1, "2A 02"),
+ "MOVE.L D2,D6": Opcode("MOVE.L D2,D6", 1, 1, "2C 02"),
+ "MOVE.L D2,D7": Opcode("MOVE.L D2,D7", 1, 1, "2E 02"),
+ "MOVE.L D3,D0": Opcode("MOVE.L D3,D0", 1, 1, "20 03"),
+ "MOVE.L D3,D1": Opcode("MOVE.L D3,D1", 1, 1, "22 03"),
+ "MOVE.L D3,D2": Opcode("MOVE.L D3,D2", 1, 1, "24 03"),
+ "MOVE.L D3,D3": Opcode("MOVE.L D3,D3", 1, 1, "26 03"),
+ "MOVE.L D3,D4": Opcode("MOVE.L D3,D4", 1, 1, "28 03"),
+ "MOVE.L D3,D5": Opcode("MOVE.L D3,D5", 1, 1, "2A 03"),
+ "MOVE.L D3,D6": Opcode("MOVE.L D3,D6", 1, 1, "2C 03"),
+ "MOVE.L D3,D7": Opcode("MOVE.L D3,D7", 1, 1, "2E 03"),
+ "MOVE.L D4,D0": Opcode("MOVE.L D4,D0", 1, 1, "20 04"),
+ "MOVE.L D4,D1": Opcode("MOVE.L D4,D1", 1, 1, "22 04"),
+ "MOVE.L D4,D2": Opcode("MOVE.L D4,D2", 1, 1, "24 04"),
+ "MOVE.L D4,D3": Opcode("MOVE.L D4,D3", 1, 1, "26 04"),
+ "MOVE.L D4,D4": Opcode("MOVE.L D4,D4", 1, 1, "28 04"),
+ "MOVE.L D4,D5": Opcode("MOVE.L D4,D5", 1, 1, "2A 04"),
+ "MOVE.L D4,D6": Opcode("MOVE.L D4,D6", 1, 1, "2C 04"),
+ "MOVE.L D4,D7": Opcode("MOVE.L D4,D7", 1, 1, "2E 04"),
+ "MOVE.L D5,D0": Opcode("MOVE.L D5,D0", 1, 1, "20 05"),
+ "MOVE.L D5,D1": Opcode("MOVE.L D5,D1", 1, 1, "22 05"),
+ "MOVE.L D5,D2": Opcode("MOVE.L D5,D2", 1, 1, "24 05"),
+ "MOVE.L D5,D3": Opcode("MOVE.L D5,D3", 1, 1, "26 05"),
+ "MOVE.L D5,D4": Opcode("MOVE.L D5,D4", 1, 1, "28 05"),
+ "MOVE.L D5,D5": Opcode("MOVE.L D5,D5", 1, 1, "2A 05"),
+ "MOVE.L D5,D6": Opcode("MOVE.L D5,D6", 1, 1, "2C 05"),
+ "MOVE.L D5,D7": Opcode("MOVE.L D5,D7", 1, 1, "2E 05"),
+ "MOVE.L D6,D0": Opcode("MOVE.L D6,D0", 1, 1, "20 06"),
+ "MOVE.L D6,D1": Opcode("MOVE.L D6,D1", 1, 1, "22 06"),
+ "MOVE.L D6,D2": Opcode("MOVE.L D6,D2", 1, 1, "24 06"),
+ "MOVE.L D6,D3": Opcode("MOVE.L D6,D3", 1, 1, "26 06"),
+ "MOVE.L D6,D4": Opcode("MOVE.L D6,D4", 1, 1, "28 06"),
+ "MOVE.L D6,D5": Opcode("MOVE.L D6,D5", 1, 1, "2A 06"),
+ "MOVE.L D6,D6": Opcode("MOVE.L D6,D6", 1, 1, "2C 06"),
+ "MOVE.L D6,D7": Opcode("MOVE.L D6,D7", 1, 1, "2E 06"),
+ "MOVE.L D7,D0": Opcode("MOVE.L D7,D0", 1, 1, "20 07"),
+ "MOVE.L D7,D1": Opcode("MOVE.L D7,D1", 1, 1, "22 07"),
+ "MOVE.L D7,D2": Opcode("MOVE.L D7,D2", 1, 1, "24 07"),
+ "MOVE.L D7,D3": Opcode("MOVE.L D7,D3", 1, 1, "26 07"),
+ "MOVE.L D7,D4": Opcode("MOVE.L D7,D4", 1, 1, "28 07"),
+ "MOVE.L D7,D5": Opcode("MOVE.L D7,D5", 1, 1, "2A 07"),
+ "MOVE.L D7,D6": Opcode("MOVE.L D7,D6", 1, 1, "2C 07"),
+ "MOVE.L D7,D7": Opcode("MOVE.L D7,D7", 1, 1, "2E 07"),
+
+ "MOVE.W D0,D0": Opcode("MOVE.W D0,D0", 1, 1, "30 00"),
+ "MOVE.W D0,D1": Opcode("MOVE.W D0,D1", 1, 1, "32 00"),
+ "MOVE.W D0,D2": Opcode("MOVE.W D0,D2", 1, 1, "34 00"),
+ "MOVE.W D0,D3": Opcode("MOVE.W D0,D3", 1, 1, "36 00"),
+ "MOVE.W D0,D4": Opcode("MOVE.W D0,D4", 1, 1, "38 00"),
+ "MOVE.W D0,D5": Opcode("MOVE.W D0,D5", 1, 1, "3A 00"),
+ "MOVE.W D0,D6": Opcode("MOVE.W D0,D6", 1, 1, "3C 00"),
+ "MOVE.W D0,D7": Opcode("MOVE.W D0,D7", 1, 1, "3E 00"),
+ "MOVE.W D1,D0": Opcode("MOVE.W D1,D0", 1, 1, "30 01"),
+ "MOVE.W D1,D1": Opcode("MOVE.W D1,D1", 1, 1, "32 01"),
+ "MOVE.W D1,D2": Opcode("MOVE.W D1,D2", 1, 1, "34 01"),
+ "MOVE.W D1,D3": Opcode("MOVE.W D1,D3", 1, 1, "36 01"),
+ "MOVE.W D1,D4": Opcode("MOVE.W D1,D4", 1, 1, "38 01"),
+ "MOVE.W D1,D5": Opcode("MOVE.W D1,D5", 1, 1, "3A 01"),
+ "MOVE.W D1,D6": Opcode("MOVE.W D1,D6", 1, 1, "3C 01"),
+ "MOVE.W D1,D7": Opcode("MOVE.W D1,D7", 1, 1, "3E 01"),
+ "MOVE.W D2,D0": Opcode("MOVE.W D2,D0", 1, 1, "30 02"),
+ "MOVE.W D2,D1": Opcode("MOVE.W D2,D1", 1, 1, "32 02"),
+ "MOVE.W D2,D2": Opcode("MOVE.W D2,D2", 1, 1, "34 02"),
+ "MOVE.W D2,D3": Opcode("MOVE.W D2,D3", 1, 1, "36 02"),
+ "MOVE.W D2,D4": Opcode("MOVE.W D2,D4", 1, 1, "38 02"),
+ "MOVE.W D2,D5": Opcode("MOVE.W D2,D5", 1, 1, "3A 02"),
+ "MOVE.W D2,D6": Opcode("MOVE.W D2,D6", 1, 1, "3C 02"),
+ "MOVE.W D2,D7": Opcode("MOVE.W D2,D7", 1, 1, "3E 02"),
+ "MOVE.W D3,D0": Opcode("MOVE.W D3,D0", 1, 1, "30 03"),
+ "MOVE.W D3,D1": Opcode("MOVE.W D3,D1", 1, 1, "32 03"),
+ "MOVE.W D3,D2": Opcode("MOVE.W D3,D2", 1, 1, "34 03"),
+ "MOVE.W D3,D3": Opcode("MOVE.W D3,D3", 1, 1, "36 03"),
+ "MOVE.W D3,D4": Opcode("MOVE.W D3,D4", 1, 1, "38 03"),
+ "MOVE.W D3,D5": Opcode("MOVE.W D3,D5", 1, 1, "3A 03"),
+ "MOVE.W D3,D6": Opcode("MOVE.W D3,D6", 1, 1, "3C 03"),
+ "MOVE.W D3,D7": Opcode("MOVE.W D3,D7", 1, 1, "3E 03"),
+ "MOVE.W D4,D0": Opcode("MOVE.W D4,D0", 1, 1, "30 04"),
+ "MOVE.W D4,D1": Opcode("MOVE.W D4,D1", 1, 1, "32 04"),
+ "MOVE.W D4,D2": Opcode("MOVE.W D4,D2", 1, 1, "34 04"),
+ "MOVE.W D4,D3": Opcode("MOVE.W D4,D3", 1, 1, "36 04"),
+ "MOVE.W D4,D4": Opcode("MOVE.W D4,D4", 1, 1, "38 04"),
+ "MOVE.W D4,D5": Opcode("MOVE.W D4,D5", 1, 1, "3A 04"),
+ "MOVE.W D4,D6": Opcode("MOVE.W D4,D6", 1, 1, "3C 04"),
+ "MOVE.W D4,D7": Opcode("MOVE.W D4,D7", 1, 1, "3E 04"),
+ "MOVE.W D5,D0": Opcode("MOVE.W D5,D0", 1, 1, "30 05"),
+ "MOVE.W D5,D1": Opcode("MOVE.W D5,D1", 1, 1, "32 05"),
+ "MOVE.W D5,D2": Opcode("MOVE.W D5,D2", 1, 1, "34 05"),
+ "MOVE.W D5,D3": Opcode("MOVE.W D5,D3", 1, 1, "36 05"),
+ "MOVE.W D5,D4": Opcode("MOVE.W D5,D4", 1, 1, "38 05"),
+ "MOVE.W D5,D5": Opcode("MOVE.W D5,D5", 1, 1, "3A 05"),
+ "MOVE.W D5,D6": Opcode("MOVE.W D5,D6", 1, 1, "3C 05"),
+ "MOVE.W D5,D7": Opcode("MOVE.W D5,D7", 1, 1, "3E 05"),
+ "MOVE.W D6,D0": Opcode("MOVE.W D6,D0", 1, 1, "30 06"),
+ "MOVE.W D6,D1": Opcode("MOVE.W D6,D1", 1, 1, "32 06"),
+ "MOVE.W D6,D2": Opcode("MOVE.W D6,D2", 1, 1, "34 06"),
+ "MOVE.W D6,D3": Opcode("MOVE.W D6,D3", 1, 1, "36 06"),
+ "MOVE.W D6,D4": Opcode("MOVE.W D6,D4", 1, 1, "38 06"),
+ "MOVE.W D6,D5": Opcode("MOVE.W D6,D5", 1, 1, "3A 06"),
+ "MOVE.W D6,D6": Opcode("MOVE.W D6,D6", 1, 1, "3C 06"),
+ "MOVE.W D6,D7": Opcode("MOVE.W D6,D7", 1, 1, "3E 06"),
+ "MOVE.W D7,D0": Opcode("MOVE.W D7,D0", 1, 1, "30 07"),
+ "MOVE.W D7,D1": Opcode("MOVE.W D7,D1", 1, 1, "32 07"),
+ "MOVE.W D7,D2": Opcode("MOVE.W D7,D2", 1, 1, "34 07"),
+ "MOVE.W D7,D3": Opcode("MOVE.W D7,D3", 1, 1, "36 07"),
+ "MOVE.W D7,D4": Opcode("MOVE.W D7,D4", 1, 1, "38 07"),
+ "MOVE.W D7,D5": Opcode("MOVE.W D7,D5", 1, 1, "3A 07"),
+ "MOVE.W D7,D6": Opcode("MOVE.W D7,D6", 1, 1, "3C 07"),
+ "MOVE.W D7,D7": Opcode("MOVE.W D7,D7", 1, 1, "3E 07"),
+
+ "ANDI.L #$NNNN,D0": Opcode("ANDI.L #$NNNN,D0", 1, 1, "02 80 XX XX XX XX"),
+ "ANDI.L #$NNNN,D1": Opcode("ANDI.L #$NNNN,D1", 1, 1, "02 81 XX XX XX XX"),
+ "ANDI.L #$NNNN,D2": Opcode("ANDI.L #$NNNN,D2", 1, 1, "02 82 XX XX XX XX"),
+ "ANDI.L #$NNNN,D3": Opcode("ANDI.L #$NNNN,D3", 1, 1, "02 83 XX XX XX XX"),
+ "ANDI.L #$NNNN,D4": Opcode("ANDI.L #$NNNN,D4", 1, 1, "02 84 XX XX XX XX"),
+ "ANDI.L #$NNNN,D5": Opcode("ANDI.L #$NNNN,D5", 1, 1, "02 85 XX XX XX XX"),
+ "ANDI.L #$NNNN,D6": Opcode("ANDI.L #$NNNN,D6", 1, 1, "02 86 XX XX XX XX"),
+ "ANDI.L #$NNNN,D7": Opcode("ANDI.L #$NNNN,D7", 1, 1, "02 87 XX XX XX XX"),
+
+ "LSR.L D0,D0": Opcode("LSR.L D0,D0", 1, 1, "E0 A8"),
+ "LSR.L D0,D1": Opcode("LSR.L D0,D1", 1, 1, "E0 A9"),
+ "LSR.L D0,D2": Opcode("LSR.L D0,D2", 1, 1, "E0 AA"),
+ "LSR.L D0,D3": Opcode("LSR.L D0,D3", 1, 1, "E0 AB"),
+ "LSR.L D0,D4": Opcode("LSR.L D0,D4", 1, 1, "E0 AC"),
+ "LSR.L D0,D5": Opcode("LSR.L D0,D5", 1, 1, "E0 AD"),
+ "LSR.L D0,D6": Opcode("LSR.L D0,D6", 1, 1, "E0 AE"),
+ "LSR.L D0,D7": Opcode("LSR.L D0,D7", 1, 1, "E0 AF"),
+
+ "LSR.L D5,D7": Opcode("LSR.L D5,D7", 1, 1, "EA AF"),
+ "LSR.L D6,D7": Opcode("LSR.L D6,D7", 1, 1, "EC AF"),
+ "LSR.L D7,D7": Opcode("LSR.L D7,D7", 1, 1, "EE AF"),
+
+ "SWAP D0": Opcode("SWAP D0", 1, 1, "48 40"),
+ "SWAP D1": Opcode("SWAP D1", 1, 1, "48 41"),
+ "SWAP D2": Opcode("SWAP D2", 1, 1, "48 42"),
+ "SWAP D3": Opcode("SWAP D3", 1, 1, "48 43"),
+ "SWAP D4": Opcode("SWAP D4", 1, 1, "48 44"),
+ "SWAP D5": Opcode("SWAP D5", 1, 1, "48 45"),
+ "SWAP D4": Opcode("SWAP D4", 1, 1, "48 44"),
+ "SWAP D7": Opcode("SWAP D7", 1, 1, "48 47"),
+
+ }
+
+
diff --git a/docs/architectures/adam.md b/docs/architectures/adam.md
new file mode 100644
index 000000000..fa90ba3b7
--- /dev/null
+++ b/docs/architectures/adam.md
@@ -0,0 +1,5 @@
+#Adam
+
+* http://drushel.cwru.edu/atm/atm.html
+
+
diff --git a/docs/architectures/alphatronicpc.md b/docs/architectures/alphatronicpc.md
new file mode 100644
index 000000000..190a6b6c5
--- /dev/null
+++ b/docs/architectures/alphatronicpc.md
@@ -0,0 +1,5 @@
+#AlphatronicPC
+
+* http://www.old-computers.com/museum/computer.asp?st=1&c=241
+
+
diff --git a/docs/architectures/amiga_500.md b/docs/architectures/amiga_500.md
new file mode 100644
index 000000000..86155490b
--- /dev/null
+++ b/docs/architectures/amiga_500.md
@@ -0,0 +1,17 @@
+#Amiga 500
+
+## Amos
+From http://www.clickteam.com/eng/downloadcenter.php?i=58 (redirecting too fast) some Amos sources are available:
+* http://www.clickteam.com/webftp/files/2/5/AMOSCompiler.zip
+* http://www.clickteam.com/webftp/files/2/5/AMOS1_23.zip
+* http://www.clickteam.com/webftp/files/2/5/AMOS1_3.zip
+* http://www.clickteam.com/webftp/files/2/5/EasyAMOS.zip
+* http://stos.atari.st/theme_2_1.html
+
+## Blitz-Basic
+* http://www.blitz-2000.co.uk/
+
+## Amiga-Basic
+* http://www.amigacoding.com/index.php/AmigaBASIC
+
+
diff --git a/docs/architectures/amstrad_cpc.md b/docs/architectures/amstrad_cpc.md
new file mode 100644
index 000000000..c61a642aa
--- /dev/null
+++ b/docs/architectures/amstrad_cpc.md
@@ -0,0 +1,17 @@
+#Amstrad CPC
+
+## documentation
+* http://cpcwiki.eu/index.php/Technical_documentation
+* www.cpcmania.com/Docs/Programming/Programming.htm
+
+## games with sources
+* http://www.mojontwins.com/juegos_mojonos/uwol-2-cpc/
+* http://www.mojontwins.com/juegos_mojonos/lala-prologue-cpc/
+
+## Locomotive Basic
+* http://www.qsl.net/hb9xch/computer/amstrad/locomotivebasic.html
+* http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start
+* http://www.cpcwiki.eu/index.php/Locomotive_BASIC
+* http://rosettacode.org/wiki/Category:Locomotive_Basic
+
+
diff --git a/docs/architectures/apple_ii.md b/docs/architectures/apple_ii.md
new file mode 100644
index 000000000..25dc7c7cc
--- /dev/null
+++ b/docs/architectures/apple_ii.md
@@ -0,0 +1,5 @@
+#Apple II
+
+* Applesoft Basic: http://www.txbobsc.com/scsc/scdocumentor/
+
+
diff --git a/docs/architectures/aquapluspiece.md b/docs/architectures/aquapluspiece.md
new file mode 100644
index 000000000..c4b1a1a2b
--- /dev/null
+++ b/docs/architectures/aquapluspiece.md
@@ -0,0 +1,8 @@
+#AquaplusPiece
+
+* http://aquaplus.jp/piece
+* http://en.wikipedia.org/wiki/Leaf_(Japanese_company)#P.2FECE
+* http://www.asahi-net.or.jp/~cs8k-cyu/piece/index.html
+* http://www.geocities.co.jp/Playtown/6437/0105.html
+
+
diff --git a/docs/architectures/aquarius.md b/docs/architectures/aquarius.md
new file mode 100644
index 000000000..40ee7f361
--- /dev/null
+++ b/docs/architectures/aquarius.md
@@ -0,0 +1,12 @@
+#Aquarius
+
+* http://www.retro-zone.org/documentation/mattel_aquarius_extendedbasicmanual/complete_manual.html
+* http://tech.groups.yahoo.com/group/mattelaquarius/
+* http://www.vdsteenoven.com/aquarius/malloc.html
+* http://www.vdsteenoven.com/aquarius/mempointer.html
+* http://www.vdsteenoven.com/aquarius/iomap.html
+* http://www.vdsteenoven.com/aquarius/psgprog.html
+* http://www.vdsteenoven.com/aquarius/hndcntrl.html
+* http://archive.kontek.net/aqemu.classicgaming.gamespy.com/aqfaq2.htm
+
+
diff --git a/docs/architectures/atari_800.md b/docs/architectures/atari_800.md
new file mode 100644
index 000000000..28d5070d6
--- /dev/null
+++ b/docs/architectures/atari_800.md
@@ -0,0 +1,6 @@
+#Atari 800
+
+* http://en.wikipedia.org/wiki/Atari_BASIC
+* http://atari.kensclassics.org/a8programming.html
+
+
diff --git a/docs/architectures/atari_st.md b/docs/architectures/atari_st.md
new file mode 100644
index 000000000..83fd17328
--- /dev/null
+++ b/docs/architectures/atari_st.md
@@ -0,0 +1,12 @@
+#Atari ST
+
+* http://dev-docs.atariforge.org/
+* http://dev-docs.atariforge.org/html/search.php?find=_*
+
+## Stos
+From http://www.clickteam.com/eng/downloadcenter.php?i=58 (redirecting too fast) some Stos sources are available:
+* http://www.clickteam.com/webftp/files/2/5/STOSCompiler206.zip
+* http://www.clickteam.com/webftp/files/2/5/STOS206.zip
+* http://stos.atari.st/demo_page.htm
+
+
diff --git a/docs/architectures/ataricentipede.md b/docs/architectures/ataricentipede.md
new file mode 100644
index 000000000..01e53cbfa
--- /dev/null
+++ b/docs/architectures/ataricentipede.md
@@ -0,0 +1,7 @@
+#AtariCentipede
+
+games made for this machine: Centipede, Warlords, Millipede, Maze Invaders, Bulls Eye Darts
+
+* http://mamedev.org/source/src/mame/drivers/centiped.c.html
+
+
diff --git a/docs/architectures/atarilynx.md b/docs/architectures/atarilynx.md
new file mode 100644
index 000000000..ba46b4d64
--- /dev/null
+++ b/docs/architectures/atarilynx.md
@@ -0,0 +1,5 @@
+#AtariLynx
+
+* http://www.atariage.com/Lynx/archives/developer_docs/index.html?SystemID=LYNX
+
+
diff --git a/docs/architectures/bally_astrocade.md b/docs/architectures/bally_astrocade.md
new file mode 100644
index 000000000..b20ab9499
--- /dev/null
+++ b/docs/architectures/bally_astrocade.md
@@ -0,0 +1,7 @@
+#Bally Astrocade
+
+some documentation about developing Bally Astrocade stuff with basic and z80-assembly
+* http://www.ballyalley.com/basic/basic.html
+* http://www.ballyalley.com/ml/ml.html
+
+
diff --git a/docs/architectures/bbc_micro.md b/docs/architectures/bbc_micro.md
new file mode 100644
index 000000000..73e7bdf2b
--- /dev/null
+++ b/docs/architectures/bbc_micro.md
@@ -0,0 +1,6 @@
+#BBC Micro
+
+* http://www.btinternet.com/~lawrence.edwards/bbccomp/bbc.htm
+* http://www.bbcdocs.com/
+
+
diff --git a/docs/architectures/bitwiselogic.md b/docs/architectures/bitwiselogic.md
new file mode 100644
index 000000000..4f9277885
--- /dev/null
+++ b/docs/architectures/bitwiselogic.md
@@ -0,0 +1,118 @@
+#BitWiseLogic
+
+ZX Basic allows Bit Manipulation (bitwise), on every integer type (from 8 to 32 bits).
+
+{| cellspacing="7" style="background-color: rgb(40, 40, 64); border: 2px solid rgb(119, 119, 119); width: 1133px; height: 291px;" class="roundedborders"
+|+ **Table of BITWISE OPERATORS**
+|-
+! bAND
+! bOR
+! bNOT
+! bXOR
+|- valign="top" style="background-color: rgb(144, 21, 0); color: rgb(208, 208, 208);" class="roundedborders"
+| Performs the _Bitwise Conjunction_ and returns 1 for every bit if and only if both bits are 1.
+
+
+{| align="center" style="color: green; background-color: rgb(255, 255, 204); border: 1px solid rgb(0, 0, 0);" class="roundedborders"
+|+ a **AND** b
+|-
+! a
+! b
+! Result
+|-
+| 0
+| 0
+| 0
+|-
+| 0
+| 1
+| 0
+|-
+| 1
+| 0
+| 0
+|-
+| 1
+| 1
+| 1
+|}
+
+
+
+| Performs the _Bitwise Disjunction_ and returns 1 if any of the arguments is 1.
+
+
+{| align="center" style="color: green; background-color: rgb(255, 255, 204); border: 1px solid rgb(0, 0, 0);" class="roundedborders"
+|+ a **OR** b
+|-
+! a
+! b
+! Result
+|-
+| 0
+| 0
+| 0
+|-
+| 0
+| 1
+| 1
+|-
+| 1
+| 0
+| 1
+|-
+| 1
+| 1
+| 1
+|}
+
+
+
+| Performs the _Logical Negation_ and returns _TRUE_ if the arguments is _False_ and vice versa.
+
+
+{| align="center" style="color: green; background-color: rgb(255, 255, 204); border: 1px solid rgb(0, 0, 0);" class="roundedborders"
+|+ **NOT** a
+|-
+! a
+! Result
+|-
+| False
+| True
+|-
+| True
+| False
+|}
+
+
+
+|
+Performs a logical XOR and returns TRUE if one of the arguments is true and one of the arguments is false. In essense, returns true if ONLY one of the arguments is true.
+
+
+
+{| align="center" style="color: green; background-color: rgb(255, 255, 204); border: 1px solid rgb(0, 0, 0);" class="roundedborders"
+|+ a **XOR** b
+|-
+| a
+| b
+| Result
+|-
+| False
+| False
+| False
+|-
+| False
+| True
+| True
+|-
+| True
+| False
+| True
+|-
+| True
+| True
+| False
+|}
+
+
diff --git a/docs/architectures/c128.md b/docs/architectures/c128.md
new file mode 100644
index 000000000..bb431d461
--- /dev/null
+++ b/docs/architectures/c128.md
@@ -0,0 +1,5 @@
+#C128
+
+* http://rvbelzen.tripod.com/128intpt/index.html
+
+
diff --git a/docs/architectures/c64.md b/docs/architectures/c64.md
new file mode 100644
index 000000000..b1772717f
--- /dev/null
+++ b/docs/architectures/c64.md
@@ -0,0 +1,6 @@
+#C64
+
+* http://sta.c64.org/cbm64mem.html
+* http://www.villehelin.com/wla.html
+
+
diff --git a/docs/architectures/camputers_lynx.md b/docs/architectures/camputers_lynx.md
new file mode 100644
index 000000000..ac588b688
--- /dev/null
+++ b/docs/architectures/camputers_lynx.md
@@ -0,0 +1,5 @@
+#Camputers Lynx
+
+* http://camputerslynx.info/
+
+
diff --git a/docs/architectures/capcom1942.md b/docs/architectures/capcom1942.md
new file mode 100644
index 000000000..014a77f77
--- /dev/null
+++ b/docs/architectures/capcom1942.md
@@ -0,0 +1,5 @@
+#Capcom1942
+
+* http://mamedev.org/source/src/mame/drivers/1942.c.html
+
+
diff --git a/docs/architectures/capcom1943.md b/docs/architectures/capcom1943.md
new file mode 100644
index 000000000..cc176e59c
--- /dev/null
+++ b/docs/architectures/capcom1943.md
@@ -0,0 +1,5 @@
+#Capcom1943
+
+* http://mamedev.org/source/src/mame/drivers/1943.c.html
+
+
diff --git a/docs/architectures/coco2.md b/docs/architectures/coco2.md
new file mode 100644
index 000000000..3a9a07b7f
--- /dev/null
+++ b/docs/architectures/coco2.md
@@ -0,0 +1,5 @@
+#CoCo2
+
+* http://koti.mbnet.fi/~atjs/mc6809/
+
+
diff --git a/docs/architectures/colecovision.md b/docs/architectures/colecovision.md
new file mode 100644
index 000000000..676ada59a
--- /dev/null
+++ b/docs/architectures/colecovision.md
@@ -0,0 +1,10 @@
+#Colecovision
+
+* http://www.colecovisionzone.com/page/coleco%20industries/programmers.html
+* http://pdroms.de/news/coleco-vision/
+* http://atarihq.com/danb/files/CV-Tech.txt
+* http://www.colecovision.eu/ColecoVision/development/tutorial1.shtml
+* http://mamedev.org/source/src/mess/drivers/coleco.c.html
+* http://mamedev.org/source/src/mess/machine/coleco.c.html
+
+
diff --git a/docs/architectures/dai.md b/docs/architectures/dai.md
new file mode 100644
index 000000000..feb10e782
--- /dev/null
+++ b/docs/architectures/dai.md
@@ -0,0 +1,7 @@
+#DAI
+
+* http://fjkraan.home.xs4all.nl/comp/dai/
+* http://www.zock.com/8-Bit/D_DAI.HTML
+* http://bruno.vivien.pagesperso-orange.fr/DAI/index.htm
+
+
diff --git a/docs/architectures/elektronika_bk.md b/docs/architectures/elektronika_bk.md
new file mode 100644
index 000000000..16156ae62
--- /dev/null
+++ b/docs/architectures/elektronika_bk.md
@@ -0,0 +1,5 @@
+#Elektronika BK
+
+Some information about Vilnius Basic at http://en.wikipedia.org/wiki/Vilnius_BASIC
+
+
diff --git a/docs/architectures/enterprise.md b/docs/architectures/enterprise.md
new file mode 100644
index 000000000..30fa0fa35
--- /dev/null
+++ b/docs/architectures/enterprise.md
@@ -0,0 +1,10 @@
+#Enterprise
+
+* http://enterpriseforever.com
+* http://enterpriseforever.com/links.html
+* http://enterprise.iko.hu/
+* http://forum.index.hu/Article/showArticle?t=9010641
+* http://www.retrogamingcollector.com/Retro-Computers/Enterprise64.html
+* http://www.ep128.hu/Menu_eng.htm
+
+
diff --git a/docs/architectures/epochsupercassettevision.md b/docs/architectures/epochsupercassettevision.md
new file mode 100644
index 000000000..21251c3a9
--- /dev/null
+++ b/docs/architectures/epochsupercassettevision.md
@@ -0,0 +1,9 @@
+#EpochSuperCassetteVision
+
+* https://github.com/mamedev/mame/blob/master/src/mess/drivers/scv.c
+* http://homepage3.nifty.com/takeda-toshiya/scv
+* http://homepage3.nifty.com/takeda-toshiya/common
+* http://www.old-computers.com/museum/computer.asp?st=2&c=844
+* http://www.videogameconsolelibrary.com/pg80-super_cass_vis.htm
+
+
diff --git a/docs/architectures/galaksija.md b/docs/architectures/galaksija.md
new file mode 100644
index 000000000..a60ccaa2b
--- /dev/null
+++ b/docs/architectures/galaksija.md
@@ -0,0 +1,21 @@
+#Galaksija
+
+* http://github.com/opicron/mame/blob/master/mess/drivers/galaxy.c
+* http://en.wikipedia.org/wiki/Galaksija_BASIC
+* http://www.dejanristanovic.com/rac1/rac1umet.htm (serbian - http://translate.google.com/translate?sl=sr&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.dejanristanovic.com%2Frac1%2Frac1umet.htm&act=url )
+* http://web.archive.org/web/20080121071246/www.paralax.co.yu/pr83.htm
+* http://retro.foing-nova.hr/galutil.htm
+* http://simonowen.com/sam/galemu/
+* http://solair.eunet.rs/~jovkovic/galaxy/
+* http://galaksija.petnica.rs/index.php/
+* http://galaksija.petnica.rs/index.php/Documentation
+* http://www.dejanristanovic.com/rac1/rac1umet.htm
+* http://retrospec.sgn.net/users/tomcat/Galaksija/MagScans/
+* http://www.galaksija.org/
+* http://emulator.galaksija.org/
+* http://www.tablix.org/~avian/blog/articles/galaksija/
+* http://retrospec.sgn.net/users/tomcat/Galaksija/
+* http://retrospec.sgn.net/users/tomcat/yu/Galaksija_list.php
+* http://www.youtube.com/watch?v=LQvS7gsJ0ik
+
+
diff --git a/docs/architectures/galeb.md b/docs/architectures/galeb.md
new file mode 100644
index 000000000..6fc6eebb1
--- /dev/null
+++ b/docs/architectures/galeb.md
@@ -0,0 +1,5 @@
+#Galeb
+
+* http://retro.foing-nova.hr/galebemu.htm
+
+
diff --git a/docs/architectures/gameboy.md b/docs/architectures/gameboy.md
new file mode 100644
index 000000000..d75072997
--- /dev/null
+++ b/docs/architectures/gameboy.md
@@ -0,0 +1,9 @@
+#GameBoy
+
+* http://www.devrs.com/gb/
+* http://www.devrs.com/gba/
+* http://www.gbadev.org/
+* http://www.villehelin.com/wla.html
+* http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html
+
+
diff --git a/docs/architectures/gem-1000.md b/docs/architectures/gem-1000.md
new file mode 100644
index 000000000..f474f0cdb
--- /dev/null
+++ b/docs/architectures/gem-1000.md
@@ -0,0 +1,16 @@
+#GEM-1000
+
+* http://mc-1000.wikispaces.com/BASIC (in portuguese - documentation about a brazilian clone named CCE MC1000 - http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fmc-1000.wikispaces.com%2FBASIC&act=url )
+* http://www.datacassete.com.br/manuais/edicao/MC1000/65.html (MC1000 manuals in portuguese)
+* http://www.old-computers.com/museum/computer.asp?st=1&c=331
+* http://www.old-computers.com/museum/computer.asp?c=420
+* http://mc-1000.wikispaces.com/
+* http://mc-1000.wikispaces.com/Manual+do+BASIC
+* http://mc-1000.wikispaces.com/Modos+de+v%C3%ADdeo (display modes)
+* http://mc-1000.wikispaces.com/Emuladores
+* http://www.ricbit.com/mundobizarro/mc1000.php
+* http://mc-1000.wikispaces.com/Cassete (useful converters between basic (txt, it tokenizes it), binary and wav formats, in java and qbasic, other versions like python are very welcome)
+* http://mc-1000.wikispaces.com/Vari%C3%A1veis+do+sistema
+* http://mc-1000.wikispaces.com/batalha_com_tanques.asm (disassembled z80 example)
+
+
diff --git a/docs/architectures/ibm_pc-xt.md b/docs/architectures/ibm_pc-xt.md
new file mode 100644
index 000000000..e09a7f5cd
--- /dev/null
+++ b/docs/architectures/ibm_pc-xt.md
@@ -0,0 +1,5 @@
+#IBM PC-XT
+
+* http://www.freebasic.net/ may have interesting documentation about cross compiling from basic, and targeting hardware like IBM PC-XT
+
+
diff --git a/docs/architectures/imaginationmachine.md b/docs/architectures/imaginationmachine.md
new file mode 100644
index 000000000..0e17f68cb
--- /dev/null
+++ b/docs/architectures/imaginationmachine.md
@@ -0,0 +1,6 @@
+#ImaginationMachine
+
+* http://en.wikipedia.org/wiki/APF_Imagination_Machine
+* http://www.old-computers.com/museum/computer.asp?c=584&st=1
+
+
diff --git a/docs/architectures/jr100.md b/docs/architectures/jr100.md
new file mode 100644
index 000000000..953346bf3
--- /dev/null
+++ b/docs/architectures/jr100.md
@@ -0,0 +1,6 @@
+#JR100
+
+* http://www.openspc2.org/BASIC/HTML/JR-100%5BBASIC%5D.html
+* http://www.asamomiji.jp/kemusiro/index.php?JR-100
+
+
diff --git a/docs/architectures/jr200.md b/docs/architectures/jr200.md
new file mode 100644
index 000000000..f8a3916f3
--- /dev/null
+++ b/docs/architectures/jr200.md
@@ -0,0 +1,7 @@
+#JR200
+
+* http://www.openspc2.org/BASIC/HTML/JR-200%5BBASIC%5D.html
+* http://www.asamomiji.jp/kemusiro/index.php?JR-200
+* http://armchairarcade.com/neo/node/1598
+
+
diff --git a/docs/architectures/m52.md b/docs/architectures/m52.md
new file mode 100644
index 000000000..cbcad2efb
--- /dev/null
+++ b/docs/architectures/m52.md
@@ -0,0 +1,6 @@
+#M52
+
+* http://mamedev.org/source/src/mame/drivers/m52.c.html
+* http://www.computerarcheology.com/wiki/wiki/Arcade/MoonPatrol
+
+
diff --git a/docs/architectures/m62.md b/docs/architectures/m62.md
new file mode 100644
index 000000000..0fb07d8ec
--- /dev/null
+++ b/docs/architectures/m62.md
@@ -0,0 +1,6 @@
+#M62
+
+* http://mamedev.org/source/src/mame/drivers/m62.c.html
+* http://system16.com/hardware.php?id=737
+
+
diff --git a/docs/architectures/m63.md b/docs/architectures/m63.md
new file mode 100644
index 000000000..580c8cf23
--- /dev/null
+++ b/docs/architectures/m63.md
@@ -0,0 +1,6 @@
+#M63
+
+* http://mamedev.org/source/src/mame/drivers/m63.c.html
+* http://system16.com/hardware.php?id=909
+
+
diff --git a/docs/architectures/memotech_mtx.md b/docs/architectures/memotech_mtx.md
new file mode 100644
index 000000000..34bd8587e
--- /dev/null
+++ b/docs/architectures/memotech_mtx.md
@@ -0,0 +1,6 @@
+#Memotech MTX
+
+* http://www.mtxworld.dk/basiccmd.php
+* http://www.mtxinfo.de/
+
+
diff --git a/docs/architectures/mo5.md b/docs/architectures/mo5.md
new file mode 100644
index 000000000..750fa7901
--- /dev/null
+++ b/docs/architectures/mo5.md
@@ -0,0 +1,7 @@
+#MO5
+
+* http://ct.ghislain.fr/docs/assembleur/page.php#assembleur
+* http://koti.mbnet.fi/~atjs/mc6809/
+* http://hierax.altervista.org/prodest
+
+
diff --git a/docs/architectures/msx.md b/docs/architectures/msx.md
new file mode 100644
index 000000000..52e7d9bd2
--- /dev/null
+++ b/docs/architectures/msx.md
@@ -0,0 +1,153 @@
+#MSX
+
+## References
+* http://map.grauw.nl/resources/msxbios.php
+* http://map.grauw.nl/resources/subrom.php
+* http://map.grauw.nl/resources/msxsystemvars.php
+* http://www.konamiman.com/msx/msx2th/th-ap.txt
+* http://www.angelfire.com/art2/unicorndreams/msx/RR-RAM.html
+* http://www.konamiman.com/msx/msx2th/kunbasic.txt
+* http://www.konamiman.com/msx/msx-e.html#nestorbasic
+* http://www.faq.msxnet.org/gfx9000.html
+* http://www.teambomba.net/gfx9klib.html
+* http://msxbanzai.tni.nl/v9990/manual.html
+* http://www.faq.msxnet.org/suffix.html
+* http://www.gamecastentertainment.com/forum/viewtopic.php?f=3&t=18#p53 (z80 asm code for accessing screen modes)
+
+## Library
+
+for now, this is merelly about a small sketch of the msx1/2 (also 2+) msx-basic command used, and their z80 assembly similars - they are not accuraced and may need fixes and improvements.
+
+* cls - cls
+```
+ call 0x00c3 #-cls
+
+
+```* color
+
+```
+ sub msxcolor(v_ink as ubyte, v_paper as ubyte, v_border as ubyte):
+ poke $F3E9,v_ink
+ poke $F3EA,v_paper
+ poke $F3EB,v_border
+ end sub
+
+
+```* vpoke
+
+```
+ sub msx1vpoke(v_address as uinteger,v_value as uinteger)
+ asm
+ ld h,(ix+5)
+ ld l,(ix+4)
+ ld a,(ix+6)
+ call $004D
+ end asm
+ end sub
+
+ sub msx2vpoke(v_address as uinteger,v_value as uinteger)
+ asm
+ ld h,(ix+5)
+ ld l,(ix+4)
+ ld a,(ix+6)
+ call $0177
+ end asm
+ end sub
+
+
+```* vpeek - v_value= vpeek (v_address)
+```
+ ld hl,v_address
+ call 0x004A #-rdvrm
+ ld v_value,a
+
+
+```* screen - screen v_screenmode,v_spritemode,v_click,v_printflag,v_?,v_?,v_?,v_?,v_?,v_?
+```
+ ld a,v_screenmode;call 0x005F #- chgmod
+ #- ld bc,0xE201:call WRTVDP - v_spritemode - ????
+ ld (0xF3DB),v_click #- cliksw
+ ld (0xF416),v_prtflg #- printflag
+
+
+```* width - width v_width
+```
+ if (v_screenmode=0) then:
+ ld (0xF3AE),v_width
+ ld (0xF3B0),v_width
+ end if
+ if (v_screenmode=1) then:
+ ld (0xF3AF),v_width
+ ld (0xF3B0),v_width
+ end if
+
+
+```* sprite$ - sprite$(v_spriteindex)=s_spritebitpmap$
+```
+ ld hl,(s_spritebitpmap$)
+ ld de,0x3800+(v_spriteindex*32)
+ ld bc,32
+ call 0x005c #- ldirvm
+
+
+```* putsprite - putsprite(v_id,v_x,v_y,v_layer,v_colour) - i don't know how to put sprites in screens 5 to 12
+```
+ vpoke (0x1B00+(v_id*4)+0 ),v_y
+ vpoke (0x1B00+(v_id*4)+1 ),v_x
+ vpoke (0x1B00+(v_id*4)+2 ),v_layer
+ vpoke (0x1B00+(v_id*4)+3 ),v_colour
+
+
+```* cls (msx2) - cls
+```
+ ld ix,0x0115 #- cls (subrom)
+ call 0x015C #- subrom
+
+
+```* setpage (msx2) - setpage v_dpage,v_apage (?)
+```
+ ld [0xFAF5],v_dpage #- dppage
+ ld [0xFAF6],v_apage #- acpage
+ ld ix,0x013D #- setpag (subrom)
+ call 0x015C #- subrom
+
+
+```* palette (gfx9000)
+```
+ sub msxgfx9kpalette(tidx as ubyte,tpr as ubyte,tpg as ubyte,tpb as ubyte):
+ '- this code seems not acuraced yet
+ out $64,14
+ out $63,(tidx mod 64)*4
+ out $61,tpr
+ out $61,tpg
+ out $61,tpb
+ end sub
+
+
+```* screen (gfx9000)
+```
+ sub msxgfx9kscreen(tscm6 as ubyte,tscm7 as ubyte):
+ '- this code seems not acuraced yet
+ out $64,6
+ out $63,tscm6
+ out $64,7
+ out $63,tscm7
+ out $67,1
+ end sub
+
+
+```* vpoke (gfx9000)
+```
+ sub msxgfx9kvpoke(tadr as udouble, tvl as ubyte):
+ '- this code seems not acuraced yet
+ out $64,0
+ tvou=tadr band 255:tvou=int(tvou/256)
+ out $63,tvou
+ tvou=tadr band 255:tvou=int(tvou/256)
+ out $63,tvou
+ tvou=tadr band 255:tvou=int(tvou/256)
+ out $63,tvou
+ out $60,tvl
+ end sub
+
+
diff --git a/docs/architectures/mz700.md b/docs/architectures/mz700.md
new file mode 100644
index 000000000..e96cc3e1c
--- /dev/null
+++ b/docs/architectures/mz700.md
@@ -0,0 +1,36 @@
+#MZ700
+
+## weblinks about mz700
+* http://sharpmz.org/mz-700/dldrom.htm
+* http://www.sharpmz.org/index.html
+* http://www.sharpmz.org/mz-700/dldos.htm
+
+## Basic
+
+### HU-Basic
+* http://www.openspc2.org/BASIC/HTML/MZ-700%5BHu-BASIC%5D.html
+
+### S-Basic
+* http://www.openspc2.org/BASIC/HTML/MZ-700%5BS-BASIC%5D.html
+
+### Disk-Basic
+* http://www.openspc2.org/BASIC/HTML/MZ-700%5BDISK-BASIC%5D.html
+
+### IBASCOMP
+* http://www.sharpmz.org/mz-80k/ibascompdoc1.htm
+
+### XBC-compiler
+### Basic 700/4
+### GDP9-BA
+### SUTAPEBA
+### K-BASIC V5
+### Kuma Interpreter
+### Solo Basic
+### T-BASIC
+### PCG-Basic
+### Cent-2
+
+## Editors
+* CGEdit: http://www.openspc2.org/~bgm/CG700/index.html
+
+
diff --git a/docs/architectures/namcogalaga.md b/docs/architectures/namcogalaga.md
new file mode 100644
index 000000000..a59ff39e6
--- /dev/null
+++ b/docs/architectures/namcogalaga.md
@@ -0,0 +1,5 @@
+#NamcoGalaga
+
+* http://mamedev.org/source/src/mame/drivers/galaga.c.html
+
+
diff --git a/docs/architectures/namcogalaxian.md b/docs/architectures/namcogalaxian.md
new file mode 100644
index 000000000..d06258ffd
--- /dev/null
+++ b/docs/architectures/namcogalaxian.md
@@ -0,0 +1,13 @@
+#NamcoGalaxian
+
+games: Galaxian, Moon Alien Part 2, King and Balloon, Moon Cresta, Moon Shuttle, Frogger, Amidar,
+Turtles, Scramble, The End, Super Cobra, Dark Planet, Lost Tomb, Dambusters
+
+* http://en.wikipedia.org/wiki/Namco_Galaxian
+* http://www.koders.com/c/fid3A82BC24A0AB30BB5AD0413EA2F7BE447FD5F51F.aspx (./drivers/galaxian.c)
+* http://www.koders.com/c/fidBB9EE60046A355F8BCB932F3C0DFB22E5200DE93.aspx (./vidhrdw/vid_galaxian.c )
+* http://mamedev.org/source/src/mame/drivers/galaxian.c.html
+* http://mamedev.org/source/src/mame/video/galaxian.c.html
+* http://mamedev.org/source/src/mame/audio/galaxian.c.html
+
+
diff --git a/docs/architectures/namcopacman.md b/docs/architectures/namcopacman.md
new file mode 100644
index 000000000..d3217b5c0
--- /dev/null
+++ b/docs/architectures/namcopacman.md
@@ -0,0 +1,16 @@
+#NamcoPacMan
+
+* http://mamedev.org/source/src/mame/drivers/pacman.c.html
+* http://www.ascotti.org/programming/pie/hardware.htm
+* http://www.gadgetfactory.net/2012/05/zx-spectrum-manic-miner-on-pacman-hardware/
+* http://www.system16.com/hardware.php?id=514
+* http://www.youtube.com/watch?v=mhbXHCYATbY
+* http://www.bytemaniacos.com/?p=2089
+* http://home.comcast.net/~jpittman2/pacman/pacmandossier.html#Chapter_1
+* http://cubeman.org/arcade-source/pacman.asm
+* http://umlautllama.com/projects/pacdocs/
+* http://www.csh.rit.edu/~jerry/arcade/pacman/
+* http://www.csh.rit.edu/~jerry/arcade/pacman/hangly.html
+* http://www.csh.rit.edu/~jerry/arcade/age/
+
+
diff --git a/docs/architectures/nec_pc6001.md b/docs/architectures/nec_pc6001.md
new file mode 100644
index 000000000..c4814c04c
--- /dev/null
+++ b/docs/architectures/nec_pc6001.md
@@ -0,0 +1,5 @@
+#NEC PC6001
+
+* http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.openspc2.org%2FBASIC%2FHTML%2FPC-6001%255BN60BASIC%255D.html&act=url ( http://www.openspc2.org/BASIC/HTML/PC-6001%5BN60BASIC%5D.html )
+
+
diff --git a/docs/architectures/neogeo.md b/docs/architectures/neogeo.md
new file mode 100644
index 000000000..8c3fc39cb
--- /dev/null
+++ b/docs/architectures/neogeo.md
@@ -0,0 +1,5 @@
+#NeoGeo
+
+* http://wiki.neogeodev.org
+
+
diff --git a/docs/architectures/neogeopocket.md b/docs/architectures/neogeopocket.md
new file mode 100644
index 000000000..c17458ccb
--- /dev/null
+++ b/docs/architectures/neogeopocket.md
@@ -0,0 +1,5 @@
+#NeoGeoPocket
+
+* http://www.devrs.com/ngp/
+
+
diff --git a/docs/architectures/nes.md b/docs/architectures/nes.md
new file mode 100644
index 000000000..e01669ce0
--- /dev/null
+++ b/docs/architectures/nes.md
@@ -0,0 +1,16 @@
+#NES
+
+Some of the information collected here can be sinergically developed with the development team from projects like http://playpower.org
+
+A version of HU-Basic is available for NES (Famicom), and can provide interesting and useful information for a compiler. There is also a clone of HU-Basic named G-Basic (mostly available from famiclones) - http://www.youtube.com/watch?v=S8uYcvqJKWA
+
+More information can be found at http://www.zophar.net/documents/nes.html
+
+At http://playpower.pbworks.com/w/page/23989647/gbasic%20manual i tried to start creating a HU-Basic snippet list, which i think can be useful for a compiler development.
+
+some other links:
+* http://www.villehelin.com/wla.html
+* http://nesdev.parodius.com/
+* http://en.wikibooks.org/wiki/NES_Programming
+
+
diff --git a/docs/architectures/ninjawarriors.md b/docs/architectures/ninjawarriors.md
new file mode 100644
index 000000000..ff8993270
--- /dev/null
+++ b/docs/architectures/ninjawarriors.md
@@ -0,0 +1,5 @@
+#NinjaWarriors
+
+
+
+
diff --git a/docs/architectures/ondra.md b/docs/architectures/ondra.md
new file mode 100644
index 000000000..d7665db7b
--- /dev/null
+++ b/docs/architectures/ondra.md
@@ -0,0 +1,7 @@
+#Ondra
+
+* http://www.old-computers.com/museum/computer.asp?c=612
+* http://www.8bity.cz/2011/tesla-ondra-uzivatelske-prirucky/
+* http://www.sapi.cz/ondra/ondra.php
+
+
diff --git a/docs/architectures/orao.md b/docs/architectures/orao.md
new file mode 100644
index 000000000..e5d43b2c4
--- /dev/null
+++ b/docs/architectures/orao.md
@@ -0,0 +1,9 @@
+#Orao
+
+* http://retro.foing-nova.hr/oraoutil.htm
+* http://retro.foing-nova.hr/oraosoft.htm
+* http://retro.foing-nova.hr/oraoemu.htm
+* http://simonowen.com/sam/oraoemu/
+* http://retrospec.sgn.net/users/tomcat/yu/Orao_list.php
+
+
diff --git a/docs/architectures/p2000.md b/docs/architectures/p2000.md
new file mode 100644
index 000000000..9cff6c587
--- /dev/null
+++ b/docs/architectures/p2000.md
@@ -0,0 +1,9 @@
+#P2000
+
+* http://wcca1.fortunecity.ws/emup2000.html
+* https://github.com/mamedev/mame/blob/master/src/mess/drivers/p2000t.c
+* http://www.old-computers.com/museum/computer.asp?st=1&c=1042
+* http://www.komkon.org/~dekogel/m2000.html
+* ftp://ftp.komkon.org/pub/EMUL8/P2000
+
+
diff --git a/docs/architectures/pasopia5.md b/docs/architectures/pasopia5.md
new file mode 100644
index 000000000..0d68544cb
--- /dev/null
+++ b/docs/architectures/pasopia5.md
@@ -0,0 +1,6 @@
+#Pasopia5
+
+* http://www.openspc2.org/BASIC/HTML/PASOPIA5%5BBASIC%5D*.html
+* http://s-sasaji.ddo.jp/pccata/toshiba.htm
+
+
diff --git a/docs/architectures/pc88.md b/docs/architectures/pc88.md
new file mode 100644
index 000000000..f1634a89d
--- /dev/null
+++ b/docs/architectures/pc88.md
@@ -0,0 +1,6 @@
+#PC88
+
+* http://www.openspc2.org/BASIC/HTML/PC-8801%5BN88-BASIC%28ROM%29%5D.html
+* http://www.openspc2.org/BASIC/HTML/PC-8801%5BN88-BASIC%28DISK%29%5D.html
+
+
diff --git a/docs/architectures/pc98.md b/docs/architectures/pc98.md
new file mode 100644
index 000000000..bc2098256
--- /dev/null
+++ b/docs/architectures/pc98.md
@@ -0,0 +1,7 @@
+#PC98
+
+* http://www.openspc2.org/BASIC/HTML/PC-9801%5BBASIC98%5D.html
+* http://www.openspc2.org/BASIC/HTML/PC-9801%5BN88%2886%29BASIC%5D.html
+* http://www.openspc2.org/BASIC/HTML/PC-9801%5BU-BASIC%5D.html
+
+
diff --git a/docs/architectures/pcengine.md b/docs/architectures/pcengine.md
new file mode 100644
index 000000000..4c0369bbb
--- /dev/null
+++ b/docs/architectures/pcengine.md
@@ -0,0 +1,5 @@
+#PCEngine
+
+* http://www.villehelin.com/wla.html
+
+
diff --git a/docs/architectures/pmd85.md b/docs/architectures/pmd85.md
new file mode 100644
index 000000000..01372d769
--- /dev/null
+++ b/docs/architectures/pmd85.md
@@ -0,0 +1,6 @@
+#PMD85
+
+* http://pmd85.topindex.sk/
+* http://reocities.com/siliconvalley/9723/other.html
+
+
diff --git a/docs/architectures/pv1000.md b/docs/architectures/pv1000.md
new file mode 100644
index 000000000..ea0f0e2fa
--- /dev/null
+++ b/docs/architectures/pv1000.md
@@ -0,0 +1,8 @@
+#PV1000
+
+* https://github.com/mamedev/mame/blob/master/src/mess/drivers/pv1000.c
+* http://homepage3.nifty.com/takeda-toshiya/pv1000
+* http://en.wikipedia.org/wiki/PV-1000
+* http://www.old-computers.com/museum/computer.asp?c=849&st=2
+
+
diff --git a/docs/architectures/pv2000.md b/docs/architectures/pv2000.md
new file mode 100644
index 000000000..fcf6e9411
--- /dev/null
+++ b/docs/architectures/pv2000.md
@@ -0,0 +1,5 @@
+#PV2000
+
+* https://github.com/mamedev/mame/blob/master/src/mess/drivers/pv2000.c
+
+
diff --git a/docs/architectures/rx78.md b/docs/architectures/rx78.md
new file mode 100644
index 000000000..c4268d014
--- /dev/null
+++ b/docs/architectures/rx78.md
@@ -0,0 +1,9 @@
+#RX78
+
+* http://www.old-computers.com/museum/computer.asp?c=478&st=1
+* http://homepage3.nifty.com/takeda-toshiya/rx78/index.html
+* http://homepage3.nifty.com/takeda-toshiya/rx78/tech.html
+* https://github.com/mamedev/mame/blob/master/src/mess/drivers/rx78.c
+* http://www.game-nostalgia.net/rx78/rx78.html
+
+
diff --git a/docs/architectures/sam_coupe.md b/docs/architectures/sam_coupe.md
new file mode 100644
index 000000000..d97803e95
--- /dev/null
+++ b/docs/architectures/sam_coupe.md
@@ -0,0 +1,9 @@
+#Sam Coupe
+
+* http://www.mono.org/~unc/Coupe/Tech/basic.html
+* http://sam.speccy.cz/basic.html
+* http://sam.speccy.cz/systech/sam_coupe_tech-man_v3-0.pdf
+* http://sam.speccy.cz/systech/unofficial_tech-man_v1-0.txt
+* http://www.worldofsam.org
+
+
diff --git a/docs/architectures/sc3000.md b/docs/architectures/sc3000.md
new file mode 100644
index 000000000..489d5e3de
--- /dev/null
+++ b/docs/architectures/sc3000.md
@@ -0,0 +1,5 @@
+#SC3000
+
+* http://www.sc-3000.com
+
+
diff --git a/docs/architectures/sectionz.md b/docs/architectures/sectionz.md
new file mode 100644
index 000000000..32ff30484
--- /dev/null
+++ b/docs/architectures/sectionz.md
@@ -0,0 +1,5 @@
+#SectionZ
+
+* http://www.system16.com/hardware.php?id=789&gid=51#51
+
+
diff --git a/docs/architectures/segamastersystem.md b/docs/architectures/segamastersystem.md
new file mode 100644
index 000000000..3df0771ab
--- /dev/null
+++ b/docs/architectures/segamastersystem.md
@@ -0,0 +1,22 @@
+#SegaMasterSystem
+
+## MarkIII/MasterSystem/GameGear
+* http://www.smspower.org/forums/viewtopic.php?t=12902
+* http://www.smspower.org/uploads/Development/richard.txt
+* http://www.smspower.org/Development/Documents
+* http://www.smspower.org/Development/Index
+* http://www.villehelin.com/wla.html
+* http://www.haroldo-ok.com/
+* http://www.smspower.org/maxim/HowToProgram/Lesson1AllOnOnePage
+* http://mamedev.org/source/src/mess/drivers/sms.c.html
+* http://mamedev.org/source/src/mess/machine/sms.c.html
+
+## SG1000
+* http://mamedev.org/source/src/mess/drivers/sg1000.c.html
+* http://mamedev.org/source/src/mame/drivers/sg1000a.c.html
+
+## System E
+* http://cgfm2.emuviews.com/txt/setech.txt
+* http://mamedev.org/source/src/mame/drivers/segae.c.html
+
+
diff --git a/docs/architectures/segamodel1.md b/docs/architectures/segamodel1.md
new file mode 100644
index 000000000..6b12d18fe
--- /dev/null
+++ b/docs/architectures/segamodel1.md
@@ -0,0 +1,5 @@
+#SegaModel1
+
+* http://mamedev.org/source/src/mame/drivers/model1.c.html
+
+
diff --git a/docs/architectures/segamodel2.md b/docs/architectures/segamodel2.md
new file mode 100644
index 000000000..1792b75de
--- /dev/null
+++ b/docs/architectures/segamodel2.md
@@ -0,0 +1,5 @@
+#SegaModel2
+
+* http://mamedev.org/source/src/mame/drivers/model2.c.html
+
+
diff --git a/docs/architectures/segamodel3.md b/docs/architectures/segamodel3.md
new file mode 100644
index 000000000..e09147869
--- /dev/null
+++ b/docs/architectures/segamodel3.md
@@ -0,0 +1,5 @@
+#SegaModel3
+
+* http://mamedev.org/source/src/mame/drivers/model3.c.html
+
+
diff --git a/docs/architectures/segaoutrun.md b/docs/architectures/segaoutrun.md
new file mode 100644
index 000000000..3ce4bd569
--- /dev/null
+++ b/docs/architectures/segaoutrun.md
@@ -0,0 +1,5 @@
+#SegaOutrun
+
+* http://www.system16.com/hardware.php?id=697&gid=1843#1843
+
+
diff --git a/docs/architectures/segapengo.md b/docs/architectures/segapengo.md
new file mode 100644
index 000000000..4bbb78b2b
--- /dev/null
+++ b/docs/architectures/segapengo.md
@@ -0,0 +1,7 @@
+#SegaPengo
+
+* http://umlautllama.com/projects/pacdocs/text/pengo.mmap
+* http://mamedev.org/source/src/mame/drivers/pengo.c.html
+* http://mamedev.org/source/src/emu/sound/namco.c.html
+
+
diff --git a/docs/architectures/shaolinsroad.md b/docs/architectures/shaolinsroad.md
new file mode 100644
index 000000000..e46590d9a
--- /dev/null
+++ b/docs/architectures/shaolinsroad.md
@@ -0,0 +1,5 @@
+#ShaolinsRoad
+
+* http://mamedev.org/source/src/mame/drivers/shaolins.c.html
+
+
diff --git a/docs/architectures/sharpx1.md b/docs/architectures/sharpx1.md
new file mode 100644
index 000000000..3d38430b2
--- /dev/null
+++ b/docs/architectures/sharpx1.md
@@ -0,0 +1,5 @@
+#SharpX1
+
+* http://sanchome.oriongate.jp/?page_id=35
+
+
diff --git a/docs/architectures/sinclair_ql.md b/docs/architectures/sinclair_ql.md
new file mode 100644
index 000000000..1f2f4524b
--- /dev/null
+++ b/docs/architectures/sinclair_ql.md
@@ -0,0 +1,15 @@
+#Sinclair QL
+
+* http://www.dilwyn.me.uk/docs/basic/index.html
+* http://www.bytemaniacos.com/ql/tiki-index.php?page=QLmaniacos
+* http://www.dilwyn.me.uk/index.html
+* http://www.dilwyn.me.uk/turbo/index.html
+* http://www.quanta.org.uk
+* http://www.qlforum.co.uk
+* http://www.qltoday.com
+* http://ql.bytemaniacos.com/tiki-index.php
+* http://www.rwapadventures.com/ql_wiki/index.php?title=SuperBASIC
+* http://www.rwapadventures.com/ql_wiki/index.php?title=Sinclair%20QL%20Home%20Computer&lang=en
+* (?) http://www.rwapadventures.com/ql_wik...mputer&lang=en
+
+
diff --git a/docs/architectures/snes.md b/docs/architectures/snes.md
new file mode 100644
index 000000000..649547650
--- /dev/null
+++ b/docs/architectures/snes.md
@@ -0,0 +1,8 @@
+#SNES
+
+* http://en.wikibooks.org/wiki/Super_NES_Programming
+* http://gra.dforce3000.de
+* http://www.villehelin.com/wla.html
+* http://aminet.net/package/dev/cross/65816_20
+
+
diff --git a/docs/architectures/sord_m5.md b/docs/architectures/sord_m5.md
new file mode 100644
index 000000000..6307b4e72
--- /dev/null
+++ b/docs/architectures/sord_m5.md
@@ -0,0 +1,8 @@
+#Sord M5
+
+* http://www.retropc.net/mm/m5/io_port.html
+* https://github.com/mamedev/mame/blob/master/src/mess/drivers/m5.c
+* http://www.museo8bits.com/sord_m5.htm
+* http://en.wikipedia.org/wiki/Sord_M5
+
+
diff --git a/docs/architectures/sp2000.md b/docs/architectures/sp2000.md
new file mode 100644
index 000000000..5d76dd188
--- /dev/null
+++ b/docs/architectures/sp2000.md
@@ -0,0 +1,6 @@
+#SP2000
+
+* http://velesoft.speccy.cz/sprinter-cz.htm
+* http://sprinter.winglion.ru/
+
+
diff --git a/docs/architectures/taitoair.md b/docs/architectures/taitoair.md
new file mode 100644
index 000000000..385b455f6
--- /dev/null
+++ b/docs/architectures/taitoair.md
@@ -0,0 +1,5 @@
+#TaitoAir
+
+* http://mamedev.org/source/src/mame/drivers/taitoair.c.html
+
+
diff --git a/docs/architectures/taitob.md b/docs/architectures/taitob.md
new file mode 100644
index 000000000..c808edae6
--- /dev/null
+++ b/docs/architectures/taitob.md
@@ -0,0 +1,7 @@
+#TaitoB
+
+* http://www.system16.com/hardware.php?id=660
+* http://mamedev.org/source/src/mame/drivers/taito_b.c.html
+* http://mamedev.org/source/src/mame/video/taito_b.c.html
+
+
diff --git a/docs/architectures/taitodarius.md b/docs/architectures/taitodarius.md
new file mode 100644
index 000000000..701ba3fef
--- /dev/null
+++ b/docs/architectures/taitodarius.md
@@ -0,0 +1,10 @@
+#TaitoDarius
+
+* http://mamedev.org/source/src/mame/drivers/darius.c.html
+* http://mrjester.hapisan.com/04_MC68/
+* http://www.scm.tees.ac.uk/users/u0000408/CSY/68Kexamples.htm
+* http://tict.ticalc.org/docs/68kguide.txt
+* http://en.wikibooks.org/wiki/68000_Assembly
+* http://68k.hax.com/
+
+
diff --git a/docs/architectures/taitof1.md b/docs/architectures/taitof1.md
new file mode 100644
index 000000000..1b26c1838
--- /dev/null
+++ b/docs/architectures/taitof1.md
@@ -0,0 +1,5 @@
+#TaitoF1
+
+* http://www.system16.com/hardware.php?id=662
+
+
diff --git a/docs/architectures/taitof2.md b/docs/architectures/taitof2.md
new file mode 100644
index 000000000..9dc6e535d
--- /dev/null
+++ b/docs/architectures/taitof2.md
@@ -0,0 +1,5 @@
+#TaitoF2
+
+* http://www.system16.com/hardware.php?id=653&gid=1604#1604
+
+
diff --git a/docs/architectures/taitof3.md b/docs/architectures/taitof3.md
new file mode 100644
index 000000000..cb433493b
--- /dev/null
+++ b/docs/architectures/taitof3.md
@@ -0,0 +1,5 @@
+#TaitoF3
+
+* http://mamedev.org/source/src/mame/drivers/taito_f3.c.html
+
+
diff --git a/docs/architectures/taitoh.md b/docs/architectures/taitoh.md
new file mode 100644
index 000000000..a7c1667f3
--- /dev/null
+++ b/docs/architectures/taitoh.md
@@ -0,0 +1,5 @@
+#TaitoH
+
+* http://mamedev.org/source/src/mame/drivers/taito_h.c.html
+
+
diff --git a/docs/architectures/taitol.md b/docs/architectures/taitol.md
new file mode 100644
index 000000000..4806b0035
--- /dev/null
+++ b/docs/architectures/taitol.md
@@ -0,0 +1,5 @@
+#TaitoL
+
+* http://mamedev.org/source/src/mame/drivers/taito_l.c.html
+
+
diff --git a/docs/architectures/taitox.md b/docs/architectures/taitox.md
new file mode 100644
index 000000000..a1e33c272
--- /dev/null
+++ b/docs/architectures/taitox.md
@@ -0,0 +1,5 @@
+#TaitoX
+
+* http://mamedev.org/source/src/mame/drivers/taito_x.c.html
+
+
diff --git a/docs/architectures/taitoz.md b/docs/architectures/taitoz.md
new file mode 100644
index 000000000..fdc5c1167
--- /dev/null
+++ b/docs/architectures/taitoz.md
@@ -0,0 +1,5 @@
+#TaitoZ
+
+* http://mamedev.org/source/src/mame/drivers/taito_z.c.html
+
+
diff --git a/docs/architectures/tecmo.md b/docs/architectures/tecmo.md
new file mode 100644
index 000000000..f2143cb0b
--- /dev/null
+++ b/docs/architectures/tecmo.md
@@ -0,0 +1,6 @@
+#Tecmo
+
+Tecmo hardware (z80) (games: Rygar, Silkworm, Gemini Wing)
+* http://mamedev.org/source/src/mame/drivers/tecmo.c.html
+
+
diff --git a/docs/architectures/trs80_model1.md b/docs/architectures/trs80_model1.md
new file mode 100644
index 000000000..249b7d475
--- /dev/null
+++ b/docs/architectures/trs80_model1.md
@@ -0,0 +1,6 @@
+#TRS80 Model1
+
+* http://trs-80.com/wordpress2/level-ii-reference/
+* http://ganley.org/software/trs80.html
+
+
diff --git a/docs/architectures/uzebox.md b/docs/architectures/uzebox.md
new file mode 100644
index 000000000..d010be6aa
--- /dev/null
+++ b/docs/architectures/uzebox.md
@@ -0,0 +1,24 @@
+#Uzebox
+
+## technical specifications
+* CPU: ATmega644 at 28.61818 MHz (overclocked from default 20 MHz)
+* Flash Memory (Program Memory): 64kb
+* RAM Memory: 4kb
+* Colours: 256 (same palette as from msx2-screen8, or zxspectrum-ulaplus)
+* Video "Memory": 1 byte (!) - The video display is just a 8bit port, used defaultly from the interrupt video-mode kernels.
+* Tile Display Memory Area: is (defaultly) inside the 4kb RAM memory, size depending on how is it used from the video-mode kernel choosed. Most of the ready video modes can have 256 different tiles available.
+* Pattern Display Memory Area (tiles and sprites): is (defaultly) inside the 64kb Flash memory, size depending on how is it used from the video-mode kernel choosed
+* Sprite Attribute Memory Area: is (defaultly) inside the 4kb RAM memory, size depending on how is it used from the video-mode kernel choosed
+* Video Modes: 9 (up to now) - Since display modes are from interrupt, anyone is welcome on creating new video-modes when needed (and skilled for helping). Theoretically, from 1 cycle from ATmega644 processor, a display resolution like 1440x240 could be obtained. But since at least 4 cycles are needed to display a pixel, the width resolutions available from video modes are 360 (4 cycles), 288 (5), 240 (6), 180 (8), 144 (10) and 120 (12).
+
+## more information
+* http://uzebox.org/wiki/index.php?title=Hello_World
+* http://belogic.com/uzebox/index.asp
+* http://lyons42.com/AVR/Opcodes/AVRSelectedOpcodeBlocks.html
+* http://www.atmel.com/atmel/acrobat/doc0856.pdf
+* http://uzebox.org/wiki/index.php?title=Video_Modes
+* http://uzebox.org/wiki/index.php?title=BBCC
+* https://docs.google.com/file/d/0B5DarBnaVpImS3FtTXJNQVYzRjg/edit
+* http://www.basic-converter.org
+
+
diff --git a/docs/architectures/vanguard.md b/docs/architectures/vanguard.md
new file mode 100644
index 000000000..0530c8cdb
--- /dev/null
+++ b/docs/architectures/vanguard.md
@@ -0,0 +1,6 @@
+#Vanguard
+
+* http://members.aon.at/nkehrer/vantris.html
+* http://mamedev.org/source/src/mame/drivers/snk6502.c.html
+
+
diff --git a/docs/architectures/vektor06c.md b/docs/architectures/vektor06c.md
new file mode 100644
index 000000000..87910a33c
--- /dev/null
+++ b/docs/architectures/vektor06c.md
@@ -0,0 +1,9 @@
+#Vektor06c
+
+* http://en.wikipedia.org/wiki/Vector-06C
+* https://code.google.com/p/vector06cc/
+* http://www.vector06c.narod.ru/
+* http://emu80.org/dev/dev_v.html
+* http://www.youtube.com/watch?v=rlTQQQPUZ2Y&list=PL8750FB243935EDE2
+
+
diff --git a/docs/architectures/vg5000.md b/docs/architectures/vg5000.md
new file mode 100644
index 000000000..8634940b8
--- /dev/null
+++ b/docs/architectures/vg5000.md
@@ -0,0 +1,9 @@
+#VG5000
+
+* http://dcvg5k.free.fr/onlinedoc/index.html
+* http://vg5k.free.fr/index.php?gosub=sEJ-gF15F]dRGHVHpWM9I&lng=EN
+* http://tj.gpa.free.fr
+* http://vg5000.free.fr
+* http://dcvg5k.free.fr/v2/dcvg5kv2en.html
+
+
diff --git a/docs/architectures/wonderswan.md b/docs/architectures/wonderswan.md
new file mode 100644
index 000000000..46d7429d8
--- /dev/null
+++ b/docs/architectures/wonderswan.md
@@ -0,0 +1,6 @@
+#Wonderswan
+
+* http://en.wikipedia.org/wiki/WonderSwan
+* http://www.asahi-net.or.jp/~cs8k-cyu/ww/index.html
+
+
diff --git a/docs/architectures/worldcup90.md b/docs/architectures/worldcup90.md
new file mode 100644
index 000000000..4441df07d
--- /dev/null
+++ b/docs/architectures/worldcup90.md
@@ -0,0 +1,11 @@
+#WorldCup90
+
+* http://mamedev.org/source/src/mame/drivers/wc90.c.html
+* http://mamedev.org/source/src/mame/drivers/wc90b.c.html
+* http://mamedev.org/source/src/mame/video/wc90.c.html
+* http://mamedev.org/source/src/mame/video/wc90b.c.html
+* http://mamedev.org/source/src/emu/sound/2608intf.c.html
+* http://www.koders.com/c/fidB89C064119164D15786137D73E025AB11E6C3D64.aspx
+* http://www.koders.com/c/fidACAD9405AF6265DA3937E5EBF4C3FBB60E30D628.aspx
+
+
diff --git a/docs/architectures/x68000.md b/docs/architectures/x68000.md
new file mode 100644
index 000000000..e47188ac3
--- /dev/null
+++ b/docs/architectures/x68000.md
@@ -0,0 +1,5 @@
+#X68000
+
+* http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.openspc2.org%2FBASIC%2FHTML%2FX68000%255BX-BASIC%255D.html ( http://www.openspc2.org/BASIC/HTML/X68000%5BX-BASIC%5D.html )
+
+
diff --git a/docs/architectures/zx81.md b/docs/architectures/zx81.md
new file mode 100644
index 000000000..8de409f85
--- /dev/null
+++ b/docs/architectures/zx81.md
@@ -0,0 +1,11 @@
+#ZX81
+
+* http://www.scribd.com/doc/56780765/ZX81Assembly
+* http://www.users.waitrose.com/~thunor/mmcoyzx81/index.html
+* http://www.worldofspectrum.org/ZX81BasicProgramming/
+* http://www.larwe.com/museum/download/ts1000_instructions_lowres.pdf
+* http://www.zx81kit.com/online_zx81_manual.htm
+* http://zx81stuff.org.uk
+* http://www.zx81museum.net
+
+
diff --git a/docs/architectures/zxspectrum.md b/docs/architectures/zxspectrum.md
new file mode 100644
index 000000000..ff6be8616
--- /dev/null
+++ b/docs/architectures/zxspectrum.md
@@ -0,0 +1,6 @@
+#ZXSpectrum
+
+* http://www.worldofspectrum.org/documentation.html
+* https://sites.google.com/site/ulaplus
+
+
diff --git a/docs/archive.md b/docs/archive.md
new file mode 100644
index 000000000..8f55e349c
--- /dev/null
+++ b/docs/archive.md
@@ -0,0 +1,61 @@
+#Archive
+
+##Source Code
+You can checkout the latest source code from the repository.
+See [http://bitbucket.org/zxbasic/zxbasic](http://bitbucket.org/zxbasic/zxbasic) for instructions on how to clone the repository (git).
+
+##Download
+This is the official ZX Basic archive. If you require an older ZX BASIC version which is not here, please ask for it in the [forum](http://www.boriel.com/forum/).
+
+###Legacy Version
+ZX Basic legacy version is **1.7.2**. You can always check your installed version with the --version command line parameter.
+
+You can check the [Changelog](https://github.com/boriel/zxbasic/blob/master/Changelog.md) to find out which bugs or improvements
+has undergone each version.
+
+Click on the icon to download the legacy version (**1.7.2**):
+
+* [
http://www.boriel.com/files/zxb/zxbasic-1.7.2-win32.zip](http://www.boriel.com/files/zxb/zxbasic-1.9.2-win32.zip)
+
Windows .exe zip package. No install needed, just uncompress it in a directory of your choice.
+* [
http://www.boriel.com/files/zxb/zxbasic-1.7.2.zip](http://www.boriel.com/files/zxb/zxbasic-1.9.2.zip)
+
Windows, Linux, Mac zip package, with python scripts. Requires python installed in your system.
+* [
http://www.boriel.com/files/zxb/zxbasic-1.7.2.tar.gz](http://www.boriel.com/files/zxb/zxbasic-1.9.2.tar.gz)
+
(Windows, Linux, Mac) tar.gz package, with python scripts. Requires python installed in your system.
+
+
+For even more legacy versions, look at the [Archive](http://www.boriel.com/files/zxb)
+
+----
+
+###Current Stable Version
+Current ZX Basic stable version is **1.8.10**. You can always check your installed version with the --version command line parameter.
+
+You can check the [Changelog](https://github.com/boriel/zxbasic/blob/master/Changelog.md) to find out which bugs or improvements
+has undergone each version.
+
+Click on the icon to download latest stable version (**1.8.10**):
+
+* [
http://www.boriel.com/files/zxb/zxbasic-1.8.10-win32.zip](http://www.boriel.com/files/zxb/zxbasic-1.9.2-win32.zip)
+
Windows .exe zip package. No install needed, just uncompress it in a directory of your choice.
+* [
http://www.boriel.com/files/zxb/zxbasic-1.8.10.zip](http://www.boriel.com/files/zxb/zxbasic-1.9.2.zip)
+
Windows, Linux, Mac zip package, with python scripts. Requires python installed in your system.
+* [
http://www.boriel.com/files/zxb/zxbasic-1.8.10.tar.gz](http://www.boriel.com/files/zxb/zxbasic-1.9.2.tar.gz)
+
(Windows, Linux, Mac) tar.gz package, with python scripts. Requires python installed in your system.
+
+
+----
+
+###Latest Development Version
+_Development_ versions are _Beta_ releases currently in development (as their name says).
+Using these versions is encouraged since they fix many bugs already in the stable version and also add more features.
+You can contribute to ZX BASIC by using devel versions and reporting possible bugs or improvement
+suggestions at the [forum](http://www.boriel.com/forum).
+
+Click on the icon to download latest stable version (**1.9.2**):
+
+* [
http://www.boriel.com/files/zxb/zxbasic-1.9.2-win32.zip](http://www.boriel.com/files/zxb/zxbasic-1.9.2-win32.zip)
+
Windows .exe zip package. No install needed, just uncompress it in a directory of your choice.
+* [
http://www.boriel.com/files/zxb/zxbasic-1.9.2.zip](http://www.boriel.com/files/zxb/zxbasic-1.9.2.zip)
+
Windows, Linux, Mac zip package, with python scripts. Requires python installed in your system.
+* [
http://www.boriel.com/files/zxb/zxbasic-1.9.2.tar.gz](http://www.boriel.com/files/zxb/zxbasic-1.9.2.tar.gz)
+
(Windows, Linux, Mac) tar.gz package, with python scripts. Requires python installed in your system.
diff --git a/docs/asm.md b/docs/asm.md
new file mode 100644
index 000000000..a8abfe327
--- /dev/null
+++ b/docs/asm.md
@@ -0,0 +1,37 @@
+#ASM
+
+
+##Syntax
+
+
+```
+asm
+ (z80 assembler code)
+ ...
+end asm
+```
+
+##Description
+
+Starts immediate inline assembly context using standard z80 opcodes.
+Use with caution.
+
+##Examples
+
+```
+FUNCTION FASTCALL whatLetter (A as uByte) as uByte
+ Asm
+ JP START
+ DATA: DEFB "A Man, A Plan, A Canal, Panama"
+ START: LD HL,DATA
+ LD E, A
+ LD D, 0
+ ADD HL, DE
+ LD A, (HL)
+ End Asm
+END FUNCTION
+```
+
+
+The above function, when called with `whatLetter()` will return the ``-th letter of the phrase
+`"A Man, A Plan, A Canal, Panama"`.
diff --git a/docs/asm/align.md b/docs/asm/align.md
new file mode 100644
index 000000000..0cde3970e
--- /dev/null
+++ b/docs/asm/align.md
@@ -0,0 +1,34 @@
+#ALIGN
+
+
+## Syntax
+
+```
+ASM
+ALIGN
+END ASM
+```
+
+## Description
+
+This works inside the ASM context, and is an assembler directive.
+Moves assembling position forward so the next line begins assembling aligned with a multiple of the given parameter. Useful for aligning data with address and page boundaries. Be aware that this can in theory waste n-1 bytes of memory, as the assembled code can only be moved forwards. Use with caution.
+
+## Examples
+
+```
+ASM
+ ALIGN 256
+ DEFB 0,0,0,0,0,0
+END ASM
+
+ASM
+ ALIGN 16384
+ DEFS 256,0
+END ASM
+```
+
+The first example will move compilation forward to match the next multiple of 256 bytes. This is useful in machine code routines as it matches a new "high byte" position in memory. That is to say that the data can be addressed by address ??00 - the low byte will be zero. This is often a key optimization for data tables and screen addressing routines.
+
+Aligning to a 16K (16384) boundary might be useful in 128K programming.
+
diff --git a/docs/asn.md b/docs/asn.md
new file mode 100644
index 000000000..4ef4ed816
--- /dev/null
+++ b/docs/asn.md
@@ -0,0 +1,33 @@
+#ASN
+
+
+##Syntax
+
+```
+ASN(numericExpression)
+```
+
+##Description
+
+Returns the arc sine value of the given argument.
+Argument must be a numeric expression. Returned value type is [float](types#float.md).
+
+##Examples
+
+```
+REM Arc sine value
+PRINT "Arc Sine value of a is "; ASN(a)
+```
+
+
+##Remarks
+
+* This function is 100% Sinclair BASIC Compatible
+* If the given argument type is not float, it will be [converted](cast.md) to float before operating with it.
+
+##See also
+
+* [COS](cos.md) and [ACS](acs.md)
+* [TAN](tan.md) and [ATN](atn.md)
+* [SIN](sin.md)
+
diff --git a/docs/at.md b/docs/at.md
new file mode 100644
index 000000000..52471ba1e
--- /dev/null
+++ b/docs/at.md
@@ -0,0 +1,19 @@
+#AT
+
+
+##Description
+
+**AT** is not a statement, but a _modifier_.
+It can be used both as a [PRINT modifier](print#modifiers.md) and a [variable declaration modifier](dim.md).
+
+##Remarks
+
+* This identifier is compatible with Sinclair BASIC (see [PRINT](print.md)), but _expands_ it, since it allows positioning at rows 22 and 23 (all 24 rows are available to the programmer). Traditionally, Sinclair BASIC only allows to print at rows 0..21.
+* This identifier _expands_ the Sinclair BASIC version when used with [DIM](dim.md)
+
+##See also
+
+* [PRINT](print.md)
+* [DIM](dim.md) - Variable Declarations
+* [POS](pos.md)
+* [CSRLIN](csrlin.md)
diff --git a/docs/atn.md b/docs/atn.md
new file mode 100644
index 000000000..486b197e0
--- /dev/null
+++ b/docs/atn.md
@@ -0,0 +1,31 @@
+#ATN
+
+##Syntax
+
+```
+ATN(numericExpression)
+```
+
+
+##Description
+
+Returns the arc tangent value of the given argument.
+Argument must be a numeric expression. Returned value type is [float](types#float.md).
+
+##Examples
+
+```
+REM Arc tangent value
+PRINT "Arc Tangent value of a is "; ATN(a)
+```
+
+##Remarks
+
+* This function is 100% Sinclair BASIC Compatible
+* If the given argument type is not float, it will be [converted](cast.md) to float before operating with it.
+
+##See also
+
+* [COS](acs.md) and [ACS](asn.md)
+* [SIN](sin.md) and [ASN](asn.md)
+* [TAN](tan.md)
diff --git a/docs/beep.md b/docs/beep.md
new file mode 100644
index 000000000..761cd6efc
--- /dev/null
+++ b/docs/beep.md
@@ -0,0 +1,22 @@
+#BEEP
+
+
+##Syntax
+
+```
+BEEP ,
+```
+
+##Description
+
+Emits a sound using the ZX Spectrum speaker. The ''duration'' is given in seconds, and the ''pitch'' is given in semitones above middle C using negative numbers for notes below middle C.
+
+##Remarks
+
+* This function is 100% Sinclair BASIC Compatible
+
+##See also
+
+* Example of using BEEP: [FrereGustav.bas](examples/freregustav.bas.md)
+
+
diff --git a/docs/bold.md b/docs/bold.md
new file mode 100644
index 000000000..0a2ba6207
--- /dev/null
+++ b/docs/bold.md
@@ -0,0 +1,41 @@
+#BOLD
+
+##Syntax
+```
+BOLD
+```
+or
+
+```
+PRINT BOLD ;
+```
+
+This can be used to change the permanent print settings, or the temporary ones. When used as a direct command:
+
+```
+BOLD n
+```
+where n is either 0 (false) or 1 (true), then the subsequent print statements will have their INK pixels emphasized,
+making text appear bolder.
+
+This command can be used as temporary colours by combining them with a print statement:
+
+
+```
+Print INK 0;PAPER 7; BOLD 1; "This is BOLD BLACK text on WHITE"
+```
+
+This version does not change the permanent colour settings and only affects
+the characters printed within that print statement.
+
+##Remarks
+* This statement is NOT Sinclair BASIC compatible.
+
+##See also
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [BORDER](border.md)
+* [INVERSE](inverse.md)
+* [INK](ink.md)
+* [ITALIC](italic.md)
+* [OVER](over.md)
diff --git a/docs/border.md b/docs/border.md
new file mode 100644
index 000000000..9aecfb7f4
--- /dev/null
+++ b/docs/border.md
@@ -0,0 +1,39 @@
+#BORDER
+
+##Syntax
+```
+BORDER
+```
+This can be used to change the border colour.
+
+```
+BORDER n
+```
+where n is a number between 0 and 7.
+
+
+As the ZX Spectrum manual states:
+
+```
+0 - black
+1 - blue
+2 - red
+3 - purple, technically called magenta
+4 - green
+5 - pale blue, technically called cyan
+6 - yellow
+7 - white
+```
+
+##Remarks
+* This function is 100% Sinclair BASIC compatible.
+
+##See also
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [INK](ink.md)
+* [BOLD](bold.md)
+* [INVERSE](inverse.md)
+* [ITALIC](italic.md)
+* [OVER](over.md)
+
diff --git a/docs/bright.md b/docs/bright.md
new file mode 100644
index 000000000..0691858c5
--- /dev/null
+++ b/docs/bright.md
@@ -0,0 +1,43 @@
+#BRIGHT
+
+##Syntax
+```
+BRIGHT
+```
+or
+```
+PRINT BRIGHT ;
+```
+This can be used to change the permanent print settings, or the temporary ones.
+When used as a direct command:
+
+```
+BRIGHT n
+```
+where n is either 0 (false) or 1 (true), then the subsequent print statements will have both their `INK` and `PAPER`
+values set to the higher intensity `BRIGHT` mode.
+
+Just as in Sinclair basic, this command can be used as temporary colours by combining them with a print statement:
+
+
+```
+Print INK 0;PAPER 7; BRIGHT 1; "This is BLACK text on BRIGHT WHITE background"
+```
+
+Note that the BRIGHT black and standard black are identical.
+
+This format does not change the permanent colour settings and only affects the characters printed within that print statement.
+
+##Remarks
+* This statement is 100% Sinclair BASIC compatible.
+
+##See also
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [BORDER](border.md)
+* [BOLD](bold.md)
+* [INK](ink.md)
+* [ITALIC](italic.md)
+* [OVER](over.md)
+* [INVERSE](inverse.md)
+* [FLASH](flash.md)
diff --git a/docs/cast.md b/docs/cast.md
new file mode 100644
index 000000000..109298c79
--- /dev/null
+++ b/docs/cast.md
@@ -0,0 +1,25 @@
+#CAST
+
+##Syntax
+
+```
+CAST (type,numeric value)
+CAST (type,variable)
+CAST (type,function(data))
+```
+
+##Description
+
+Returns a value of the [type](types.md) specified with a value equivalent to the item specified, if that is possible.
+
+##Remarks
+
+* This function can lose precision if used indiscriminately.
+For example, CAST(Integer,PI) returns 3, losing precision on the value of PI.
+* This function is NOT Sinclair Compatible.
+
+##See also
+
+* [Types](types.md)
+
+
diff --git a/docs/chr.md b/docs/chr.md
new file mode 100644
index 000000000..f9c72c8c8
--- /dev/null
+++ b/docs/chr.md
@@ -0,0 +1,54 @@
+#CHR
+
+##Syntax
+
+
+```
+chr()
+chr([, ])
+chr$()
+chr$([, ])
+```
+
+##Description
+
+Returns a string containing the ASCII characters whose codes are the given values.
+The arguments must be a numeric expression and, unlike Sinclair BASIC, parenthesis
+are mandatory. Returned value type is [string](types.md#String).
+
+##Examples
+
+```
+REM Char for ASCII code 65 is 'A'
+PRINT "CHR(65) is "; CHR(65)
+```
+
+This function is extended, and several values can be given at once. The result is a concatenation of all the given values:
+
+```
+REM Chars for ASCII codes from 65 to 67 ('A' to 'C')
+PRINT "CHR(65, 66, 67) is "; CHR(65, 66, 67)
+```
+
+The following lines are both equivalent, but the 2nd is faster and takes less memory:
+
+
+```
+REM These two sentences are equivalent
+PRINT "CHR(65, 66, 67) is "; CHR(65) + CHR(66) + CHR(67)
+PRINT "CHR(65, 66, 67) is "; CHR(65, 66, 67)
+```
+
+
+In fact, if the compiler detects the programmer is using `CHR(x) + CHR(y)`, it might compile it as
+`CHR(x, y)` to perform such optimization.
+
+##Remarks
+
+* This function is 100% Sinclair BASIC Compatible, but parenthesis are mandatory
+* This function is expanded comparing to the original Sinclair BASIC
+* As with other functions and variables, the trailing `$` can be omitted.
+
+##See Also
+
+* [STR](str.md)
diff --git a/docs/circle.md b/docs/circle.md
new file mode 100644
index 000000000..4cf45096f
--- /dev/null
+++ b/docs/circle.md
@@ -0,0 +1,43 @@
+#CIRCLE
+
+##Syntax
+
+```
+CIRCLE , ,
+CIRCLE ; , ,
+```
+
+
+##Description
+
+Draws a _circle_ centered on coordinates (x, y) (see [PLOT](plot.md)) with the given radius. Coordinate (0, 0) designates bottom-left screen corner. Drawing coordinates are updated to the last plotted position.
+
+**CIRCLE** is enhanced in ZX BASIC to allow drawing on the last two screen rows (this was not possible in Sinclair BASIC). So now we have 16 lines more (192 in total). Sinclair BASIC only used top 176 scan lines. This means if in Sinclair BASIC you write:
+
+
+```
+CIRCLE x, y, r
+```
+
+
+You must translate it to ZX BASIC as:
+
+
+```
+CIRCLE x, y + 16, r
+```
+
+
+If you want both drawings to show at exactly the same vertical screen position.
+
+Also maximum circle radius size is 96, not 86.
+
+###Remarks
+
+* This function is not strictly Sinclair BASIC compatible since it uses all 192 screen lines instead of top 176. If you translate **PLOT**, **DRAW** & **CIRCLE**, commands from Sinclair BASIC _as is_ your drawing will be _shifted down_ 16 pixels.
+* This primitive uses Bresenham's algorithm for faster drawing instead of ROMs implementation.
+
+###See also
+
+* [PLOT](plot.md)
+* [DRAW](draw.md)
diff --git a/docs/comments.md b/docs/comments.md
new file mode 100644
index 000000000..8da1f48cb
--- /dev/null
+++ b/docs/comments.md
@@ -0,0 +1,64 @@
+#Comments
+
+
+## Introduction
+
+Commenting source code is important as it makes your code more maintainable. You can return back to a code you typed several month ago and recall and understand what it does quickly if your comments are up to date.
+
+## REM lines
+
+Traditional BASIC dialects (e.g. Sinclair BASIC) uses REM to comment lines. REM is an abbreviation of _REMark_. ZX BASIC allows it:
+
+
+```
+10 REM This line has a comment
+20 PRINT "Hello World": REM The following sentence is ignored: PRINT "Hello Again"
+```
+
+
+REM exists for the sake of retrocompatibility with old Sinclair BASIC listings.
+
+## Apostrophe character
+
+Newer dialects uses the apostrophe character (') as a shortened REM. ZX BASIC also allows it, so the above listing could be also rewritten this way:
+
+
+```
+10 ' This line has a comment
+20 PRINT "Hello World": 'The following sentence is ignored: PRINT "Hello Again"
+```
+
+
+Everything beyond the apostrophe char will be ignored. Since line numbers can also be omitted,
+the above listing could be rewritten as:
+
+
+```
+' This line has a comment
+PRINT "Hello World" 'The following sentence is ignored: PRINT "Hello Again"
+```
+
+
+Notice now the missing colon at the end of the [PRINT](print.md) statement. REM, like any other BASIC sentence,
+requires a colon when it is preceded by another one, whilst apostrophe does not.
+
+The apostrophe character was used in Sinclair BASIC as a [PRINT](print.md) modifier. But here, in ZX BASIC,
+it is **always** a commenter char.
+
+## Multi-line comments
+
+Multi-line comments are marked with the tokens `/'` and `'/`. All text between the two markers is considered
+comment text and is not compiled.
+
+Multi-line comments can span several lines, and can also be used in the middle of statements.
+After the end of the comment, the statement will continue to be parsed as normal (even if the comment crosses
+line breaks).
+
+
+```
+/' Multi-line
+comment '/
+
+Print "Hello" /' embedded comment'/ " world"
+```
+
diff --git a/docs/const.md b/docs/const.md
new file mode 100644
index 000000000..072b2ee5f
--- /dev/null
+++ b/docs/const.md
@@ -0,0 +1,24 @@
+#CONST
+
+##Syntax
+
+
+```
+CONST [AS ] =
+```
+
+
+##Description
+
+**CONST** declares a non-modifable variable.
+
+`` can be something like `Integer`, `Byte`, `Float`, etc.
+See the list of [available types](types#types.md). If type is not specified,
+`Float` will be used, unless you use a modifier like `$` or `%`.
+
+##Examples
+
+
+```
+CONST screenAddress as uInteger = 16384
+```
diff --git a/docs/continue.md b/docs/continue.md
new file mode 100644
index 000000000..ad13db54f
--- /dev/null
+++ b/docs/continue.md
@@ -0,0 +1,27 @@
+#CONTINUE
+
+
+##Syntax
+
+
+```
+CONTINUE DO
+CONTINUE FOR
+CONTINUE WHILE
+```
+
+
+##Description
+
+Restarts the current loop at the initial control statement immediately, as though the CONTINUE was an end of loop. While conditions are checked again, and FOR variables are incremented or decremented as appropriate as would be normal for entering the next loop.
+
+##Remarks
+
+* This statement is NOT Sinclair compatible, and is NOT related to the Sinclair BASIC CONTINUE statement.
+
+##See also
+
+* [EXIT](exit.md)
+* [DO ... LOOP](do.md)
+* [FOR ... NEXT](for.md)
+* [WHILE ... END WHILE](while.md)
diff --git a/docs/cos.md b/docs/cos.md
new file mode 100644
index 000000000..08a9163ca
--- /dev/null
+++ b/docs/cos.md
@@ -0,0 +1,34 @@
+#COS
+
+##Syntax
+
+```
+COS(numericExpression)
+```
+
+
+##Description
+
+Returns the cosine value of the given argument.
+Argument must be a numeric expression in radians units. Returned value type is [float](types#float.md).
+
+##Examples
+
+```
+REM Cosine value
+PRINT "Cosine value of a is "; COS(a)
+```
+
+
+##Remarks
+
+* This function is 100% Sinclair BASIC Compatible
+* If the given argument type is not float, it will be [converted](cast.md) to float before operating with it.
+
+##See also
+
+* [SIN](sin.md) and [ASN](asn.md)
+* [TAN](tan.md) and [ATN](atn.md)
+* [ACS](acs.md)
+* Faster library option for lower accuracy trigonometry for games: [FCOS](fsin.bas.md)
+
diff --git a/docs/csrlin.md b/docs/csrlin.md
new file mode 100644
index 000000000..0fb9ccec5
--- /dev/null
+++ b/docs/csrlin.md
@@ -0,0 +1,28 @@
+#CSRLIN
+
+##Syntax
+
+```
+CSRLIN()
+```
+
+##Description
+
+Returns the row (line) position of the text cursor (0 means the top line).
+
+##Requirements
+
+CSRLIN is a library function to be included with the following command:
+
+```
+#include
+```
+
+##Remarks
+
+* This function is not available in Sinclair BASIC.
+
+##See also
+
+* [ POS](pos.md)
+* [ AT ](at.md)
diff --git a/docs/data.md b/docs/data.md
new file mode 100644
index 000000000..8a2cb95dc
--- /dev/null
+++ b/docs/data.md
@@ -0,0 +1,49 @@
+#DATA
+
+##Syntax
+```
+ DATA [, , ...]
+```
+
+**DATA** statement stores values to be retrieved using the [READ](read.md) sentence. These can be numerical or string expressions.
+Instead of using INPUT() function or [LET](let.md) assignments, you can write a sequence (or several of them) of **DATA**
+which might result in a compact and more readable code to initialize data variables.
+
+**DATA** statements can be placed anywhere in the code, but they're usually located at the end for better readability.
+
+##Example
+
+```
+FOR i = 1 TO 2
+ READ a, b, c$
+
+ PRINT "a: "; a
+ PRINT "b: "; b
+ PRINT "c: "; c
+NEXT i
+
+REM notice the a * a expression
+DATA 2, a * a, "Hello"
+DATA b * 5, 32, "World"
+```
+
+This will output:
+
+```
+ a: 2
+ b: 4
+ c: Hello
+ a: 20
+ b: 32
+ c: World
+
+```
+Expressions are read and evaluated one by one. When a **DATA** line is finished, the next one in the listing will be read.
+Traditionally if there's no more data to read, an _OUT of Data_ error happened. In ZX Basic, the read sequence restarts from the beginning.
+
+##Remarks
+* This statement is Sinclair BASIC compatible.
+
+##See also
+* [READ](read.md)
+* [RESTORE](restore.md)
diff --git a/docs/declare.md b/docs/declare.md
new file mode 100644
index 000000000..b89698717
--- /dev/null
+++ b/docs/declare.md
@@ -0,0 +1,52 @@
+#DECLARE
+
+
+ZX BASIC is a single pass compiler - that means it goes through your source code once and only once
+when reading your program code and compiling. Unfortunately, this method does lead to some issues when
+calling [SUB](sub.md) and [FUNCTION](function.md) code. If a FUNCTION is not defined prior to being called,
+the compiler neither knows what its return type nor knows parameter types, or whether you are calling the
+SUB/FUNCTION correctly. The compiler, in this case, assumes the function returns the compiler's largest type:
+a float. This is often incorrect and suboptimal.
+
+Traditionally, in compiler design, there are several ways to fix this problem.
+One is to have the compiler run two passes through the code; picking up the SUB/FUNCTION definitions as it goes,
+then a second pass to compile. On the original ZX spectrum, most BASIC compilers were multipass
+to allow for this information gathering.
+
+ZX BASIC remains single pass, which means there are two options open to you the programmer.
+The first is to define all functions before they are used; for example, at the start of the code.
+This method does work fine, but perhaps limits where you want to put functions in memory.
+
+The second option is to use the DECLARE keyword. This way, the programmer can tell the compiler about a function
+in advance before it is used, and before it is fully defined with the [FUNCTION](function.md) keyword.
+Putting a DECLARE statement at the start of your code tells the compiler about the function that is defined later on.
+In essence, you are making a promise to define it later. This fully defines the return type for the function,
+so the receiving code can be built to work with that. It also, in theory, allows the compiler to have information
+about the function and enable it to trap errors in use of the function.
+
+##Syntax
+
+```
+DECLARE [()] AS
+```
+
+
+##Examples
+
+```
+Declare Function myFunction(n As Ubyte) As Ubyte
+
+REM Now you can call myFunction
+PRINT myFunction(32): REM This print 33
+
+REM Now implements myFunction
+Function myFunction(n As Ubyte) As UByte
+ Return n + 1
+End Function
+```
+
+##See Also
+* [FUNCTION](function.md)
+* [SUB](sub.md)
+
+
diff --git a/docs/dim.md b/docs/dim.md
new file mode 100644
index 000000000..5c4b34c1b
--- /dev/null
+++ b/docs/dim.md
@@ -0,0 +1,209 @@
+#DIM
+
+**DIM** is used in Sinclair BASIC to declare arrays.
+In ZX BASIC, its usage has been extended to declare any variable and its type.
+A [type](types.md) is a name for the kind of data (`Integer`, `Byte`, `String`, etc.) it holds.
+
+##Declaration of variables
+
+###Syntax
+
+```
+DIM [,...] [AS ] [= ]
+```
+
+Where __ can be one of **INTEGER**, **BYTE**, **FLOAT**, etc.
+See the list of [available types](types#types.md). If type is not specified, **FLOAT** will be used, unless you use
+a suffix (usually called _sigil_) like `$` or `%`.
+
+###Default variable values
+
+ZX BASIC will initialize any numeric variable to 0 (like most BASIC flavors), and any string variable to an
+empty string, so you don't need to initialize them, though it's recommended.
+
+###Undeclared variables
+
+ZX BASIC allows you to use undeclared variables. In Sinclair BASIC, using an unassigned variable triggered
+the error _Variable not found_, but in ZX BASIC it will default to 0 value.
+
+You can enforce variable declaration using the `--explicit` [command line option](zxb.md#Command_Line_Options).
+When it's used, the compiler will require every variable to be declared with DIM before being used for the 1st time.
+
+You can also enforce explicit type declaration using the `--strict` [command line option](zxb.md#Command_Line_Options).
+This way, if you use `DIM` you will be required to declare also the type needed.
+
+When you use an undeclared variable, ZX BASIC will try to guess its type by looking at the context in which
+it is being used and then will initialize it with a default value, depending on the type (0 or an empty string).
+If it cannot guess the type (this is usually very difficult), it will fallback to float.
+The float type is the most inefficient (though most flexible) type ZX BASIC supports,
+but it is the Sinclair BASIC compatible one. So if you want the compiler to make an efficient and optimized compilation,
+it is better to declare the variable types you use in advance using the DIM statement
+(Note that languages like C or Pascal requires every used variable to be declared).
+
+Declaring a variable that has already been referenced in previous lines will result in a syntax error.
+
+##Examples
+
+###Examples of variable declarations
+
+```
+REM Declares 'a' as a 16 bit signed integer variable
+DIM a AS INTEGER
+
+REM Declares 'b' as a Float because no type is specified
+DIM b
+
+REM Declares 'c' as String, because of the '$' suffix
+DIM c$
+
+REM Declares 'd' as String, using an explicit type
+DIM d as STRING
+
+REM Declares 'x', 'y' as 32bit unsigned integers in a single line
+DIM x, y as ULONG
+
+REM Here 'S' is declared as String, because 'R' has a '$'
+DIM R$, S
+
+REM initialize an unsigned byte with 5
+DIM b as UBYTE = 5
+
+REM warning: Using default implicit type float for 'a'
+DIM a = 5
+
+REM No warning here, because the compiler knows it is an integer (% suffix)
+DIM c% = 5
+```
+
+###Examples of undeclared variables
+
+```
+REM variable a is not declared, but since you use PI, it must be float
+LET a = PI
+```
+
+However, other examples might be more complex:
+
+```
+REM variable a here is taken as a FIXED not FLOAT. Beware with precision loss!
+LET a = 3.5
+```
+
+For any positive integer, unsigned types will be used, but if an implicit initialization contains a negative value
+the signed type will be used instead.
+
+```
+REM variable a will be declared implicitly as BYTE
+FOR a = -1 TO 10
+ ...
+NEXT
+
+REM Warning, truncation!
+LET a = -3.5
+
+REM variable b will be declared as UByte
+FOR b = 1 TO 10
+ ...
+NEXT
+
+REM Warning, sign overflow!
+LET b = -1
+```
+
+As you might see, using undeclared variables might lead to errors (truncation, overflow).
+The compiler will try to warning about these whenever it can, but sometimes this will be not possible,
+and errors might pass silently... (you might experience strange behaviors in your program).
+
+It might even be difficult for you to guess which type will be implicitly used for an undeclared variable.
+The safest choice is to always declare them.
+
+##Variable mapping
+
+You can declare a variable at a fixed memory address. This is called _variable mapping_.
+
+E.g. in ZX Spectrum Sinclair's ROM address 23675 contains a system variable which points to UDG address.
+You could traditionally read this content by doing:
+
+```
+PRINT "UDG memory address is "; PEEK 23675 + 256 * PEEK 23676
+```
+
+It is a 16 bit unsigned integer value (`Uinteger`). We can map a variable on that address:
+
+```
+DIM UDGaddr AS Uinteger AT 23675
+PRINT "UDG memory address is "; UDGaddr
+```
+
+This is more readable. Also, setting a value to this variable changes UDG address.
+
+##Variable aliasing
+
+A variable is just a memory position containing data. In same cases you might find useful a variable having
+more than one name, for the sake of code readability:
+
+```
+DIM a AS Float = PI
+
+REM Now let's declare an alias of 'a', called 'radians'
+DIM radians AS Float AT @a
+
+PRINT "radians = "; radians
+LET radians = 1.5
+PRINT "a = "; a
+```
+
+As you can see, both _**radians**_ and _**a**_ can be used interchangeably.
+
+##Array Declaration
+
+###Syntax
+
+```
+DIM a([ TO] [, ...]) AS
+```
+
+###Description
+
+By default, array indexes starts from 0, not from 1 as in Sinclair BASIC. You can change this behavior setting
+a different array base index using either a [#pragma option](pragma.md) or a [command line option](zxb.md#Command Line Options).
+
+###Examples
+
+
+```
+REM 'a' is an array of 11 floats, from a(0) to a(10)
+DIM a(10)
+
+REM 'b' has the same size
+DIM b(0 TO 10)
+```
+
+
+###Initialized arrays
+You can also use DIM to declare an array, and promptly fill it with data. At the moment, this is not valid for string arrays, only numerical arrays. One handy way to use this would be to use an array to store a table, such as user defined graphics:
+
+```
+REM udg will be an array of 8 UBytes
+REM Remember, the default in ZX Basic is for arrays to begin at zero, so 0-7 is 8 bytes
+DIM udg(7) AS uByte => {0,1,3,7,15,31,63,127}
+
+REM This sets the System UDG variable to point to the 1st array element:
+POKE UINTEGER 23675,@udg(0): REM udg(0) is the 1st array element
+```
+
+Arrays of 2 or more dimensions can be initialized using this syntax:
+
+```
+DIM udg(1, 7) AS uByte => {{0,1,3,7,15,31,63,127}, _
+ {1,2,4,7,15,31,63,127}}
+
+REM Each row contains an UDG. All bytes are stored in a continuous memory block
+```
+
+Note the usage of `@variable` to denote the location in memory the variable is stored into. Also see the extensions to [POKE](poke.md).
+
+##See also
+
+* [LBOUND](lbound.md)
+* [UBOUND](ubound.md)
diff --git a/docs/do.md b/docs/do.md
new file mode 100644
index 000000000..2a3e64478
--- /dev/null
+++ b/docs/do.md
@@ -0,0 +1,91 @@
+#DO ... LOOP
+
+**DO** ... **LOOP** is a _compound_ statement used to perform loops. The code within the **DO ... LOOP** statement will be repeated if the given condition is _true_. The loop is executed at less once when the loop condition is written at the end, even if the given _condition_ is false at the first iteration.
+
+##Syntax
+The **DO** ... **LOOP** construct is a very powerful sentence and can be used in up to 5 different ways:
+
+###Infinite loops
+Sometimes we want a loop to repeat forever, no matter what, because we need to exit the loop when an external event happens. For example, we want to repeat forever waiting for a key press. Traditionally we use GOTO for this in Sinclair BASIC. Other languages use WHILE (1), etc. The best way to do this in ZX BASIC is this one:
+
+```
+DO
+ []
+LOOP: REM This loop repeats forever.
+```
+
+This form **loops forever**. It's better to use this form instead of using **STEP** 0 in a **FOR** loop, or a **WHILE** 1 condition loop. The generated code is more efficient.
+
+###Looping UNTIL
+
+```
+DO
+ []
+LOOP UNTIL
+```
+
+
+This form repeats _until_ the given condition is met. The loop is guaranteed to execute at least once regardless of loop exit condition - it is only evaluated at the end of the first loop.
+
+You can also put the condition at the beginning, this way:
+
+```
+DO UNTIL
+ []
+LOOP
+```
+
+
+In this case, the condition is checked first, and the program won't enter to the inner _sentences_ if the condition is not satisfied at first.
+
+####Example using UNTIL
+Example: _Loop until the user press a Key_
+
+```
+REM in a single line!
+DO LOOP UNTIL INKEY$ <> ""
+```
+
+
+###Looping WHILE
+
+```
+DO
+ []
+LOOP WHILE
+```
+
+
+This form repeats _while_ the given condition is true.
+The difference with the [WHILE](while.md) sentence is the latter won't execute the inner sentences if _condition_ is false at the start. Remember: **DO**...**LOOP** will execute _sentences_ at least once regardless of the condition upon entry to the loop - it is only evaluated at the end of the first loop.
+
+You can also put the condition at the beginning, this way:
+
+```
+DO WHILE
+ []
+LOOP
+```
+
+
+In this case, the condition is checked first, and the program won't enter to the inner _sentences_ if the condition is not satisfied at first.
+
+####Example using WHILE
+Example: _Loop while there is no key pressed_
+
+```
+REM in a single line!
+DO LOOP WHILE INKEY$ = ""
+```
+
+
+##Remarks
+* This statement does not exist in Sinclair Basic.
+* **WHILE** can also be used with [WHILE ... END WHILE](while.md) loops.
+
+##See Also
+* [IF ... END IF](if.md)
+* [WHILE ... END WHILE](while.md)
+* [FOR ... NEXT](for.md)
+* [EXIT](exit.md)
+* [CONTINUE](continue.md)
diff --git a/docs/draw.md b/docs/draw.md
new file mode 100644
index 000000000..0118f3556
--- /dev/null
+++ b/docs/draw.md
@@ -0,0 +1,48 @@
+#DRAW
+
+
+##Syntax
+
+```
+ DRAW dx, dy [, arc]
+```
+ or
+```
+ DRAW ; dx, dy [, arc]
+```
+Draws a _straight line_ starting from the current drawing coordinates (x, y)
+(see [PLOT](plot.md)) to `(x + dx, y + dy)` position. Coordinate `(0, 0)`
+designates bottom-left screen corner. Drawing coordinates are updated
+to the last position.
+
+**DRAW** is enhanced in ZX BASIC to allow drawing on the last two screen rows (this was not possible in Sinclair BASIC). So now we have 16 lines more (192 in total). Sinclair BASIC only used top 176 scan lines. This means that in Sinclair BASIC
+```
+PLOT x0, y0: DRAW x, y
+```
+
+is equivalent in ZX BASIC to
+```
+PLOT x0, y0 + 16: DRAW x, y
+```
+
+
+**Remark**: This primitive uses Bresenham's algorithm for faster drawing instead of ROMs implementation.
+
+###Drawing Arcs
+When used with 3 parameters it draws arcs the same way the Sinclair BASIC version does,
+but again the 192 scan-lines are available.
+
+```
+DRAW dx, dy, arc
+```
+The above will draw an arc from the current position to (x + dx, y + dy) position, with a curve of ''arc'' radians. This routine also have some strange behaviors. High values of arc draws strange patterns.
+
+###Remarks
+
+* This function is not strictly Sinclair BASIC compatible since it uses all 192 screen lines instead of top 176.
+If you translate **PLOT**, **DRAW** & **CIRCLE**, commands from Sinclair BASIC _as is_
+your drawing will be _shifted down_ 16 pixels.
+
+###See Also
+* [PLOT](plot.md)
+* [CIRCLE](circle.md)
diff --git a/docs/examples/4inarow.bas.md b/docs/examples/4inarow.bas.md
new file mode 100644
index 000000000..4d9fa50fc
--- /dev/null
+++ b/docs/examples/4inarow.bas.md
@@ -0,0 +1,101 @@
+#4 in a Row
+
+ Program: 4inarow.bas
+
+ This program first appeared in MicroHobby ZX Spectrum Spanish magazine. It has a
+ nice AI in BASIC that plays smartly against the human in only 16Kb!
+
+```
+ 0 REM From MicroHOBBY magazine, Num. 18, page 27 :')
+ 1 BORDER 1: PAPER 1: INK 7: CLS : PRINT AT 10,10; FLASH 1;"STOP THE TAPE": PAUSE 200
+ 5 DIM M(8,6): DIM p,pp,n as FLOAT
+ 6 BORDER 1: PAPER 1: INK 6: CLS
+ 10 LET x=0: LET y=0: LET j=0
+ 20 PRINT INK 4;" \ : \: \:'\'' \:'\'.\ : \:'\': \:'\': \:.\.: \:'\': \''\: \:' \: \'. \: \.: \:.\.: \: \:.\.: \: \:.\.. \: \ : \: \'. \: \ : \: \: \ :"; INK 6;AT 21,5;" \* by \{vi}$R\{vn} R.Bernat."
+ 25 PRINT AT 15,3;"Who starts, You or Me? (y/m).": GOSUB 2800: PRINT AT 15,3;" ": GO SUB 2500
+ 30 FOR i=1 TO 8: FOR m=1 TO 6
+ 40 LET M(i,m)=0: NEXT m: NEXT i
+ 100 PLOT 0,16: DRAW 12,16: DRAW 0,100: DRAW 8,0: DRAW 0,-92
+ 110 FOR n=1 TO 8: DRAW 8,0,PI: DRAW 0,92: DRAW 8,0: DRAW 0,-92: NEXT n: DRAW 0,-8: DRAW 12,-16: DRAW -25,0: DRAW 0,9: DRAW -110,0: DRAW 0,-9: DRAW -25,0
+ 120 PRINT AT 5,1;"\{vi} 1 2 3 4 5 6 7 8 \{vn}"
+ 450 IF a$="m" THEN GO TO 700: END IF
+ 480 LET M(5,1)=1: LET xp=5: LET yp=1: LET color=1: GO SUB 3000
+ 490 GO TO 700
+ 500 PRINT AT 12,20; INK 4; FLASH 1;"THINKING ": LET pp=0
+ 510 LET p=0
+ 520 FOR i=1 TO 8
+ 530 LET x=i: GO SUB 2000
+ 540 IF y>6 THEN CONTINUE FOR: END IF: REM NEXT i
+ 550 LET color=1: GO SUB 1030: PRINT FLASH 1;AT 5,i+20;i
+ 560 IF psp>p AND psp<30 THEN GO SUB 1600: END IF
+ 570 IF psp>p THEN LET p=psp: LET xp=x: LET yp=y: END IF
+ 575 IF psp=.05 THEN CONTINUE FOR: END IF: REM NEXT i
+ 580 LET color=2: GO SUB 1030: IF psp>=30 THEN LET psp=29.9: GOTO 590: END IF
+ 585 LET pp=psp:GOSUB 1600:IF psp>=30 THEN LET pp=.05:END IF: LET psp=pp
+ 590 IF psp>p THEN LET p=psp: LET xp=x: LET yp=y: END IF
+ 600 NEXT i: PRINT INK 1; FLASH 0;AT 5,20;" "
+ 610 LET color=1: LET M(xp,yp)=1
+ 620 GO SUB 2500: GO SUB 3000: LET j=j+1
+ 630 IF p>=30 THEN GO TO 3500: END IF
+ 640 IF j=48 THEN PRINT AT 12,20;"-Draw-": GO TO 3600: END IF
+ 700 REM ******************************** YOU PLAY *******************************************
+ 701 PRINT INK 4;AT 12,20;"YOUR MOVE"
+ 710 GOSUB 2700: LET x=VAL a$
+ 720 IF x<1 OR x>8 THEN GO TO 710: END IF
+ 725 LET color=2: GO SUB 2000: IF y>6 THEN PRINT AT 12,20;"Not valid": GO TO 710: END IF
+ 730 LET yp=y: LET xp=x: LET color=2: GO SUB 3000
+ 740 LET M(xp,yp)=2: LET j=j+1
+ 750 REM check if you win
+ 760 GO SUB 1030
+ 770 IF psp>=30 THEN GO TO 3550: END IF
+ 780 IF j=48 THEN PRINT OVER 1;AT 21,0;" ...end": GO TO 3600: END IF
+ 790 GO TO 500
+1030 LET psp=0: LET np=0
+1040 LET dx=1: LET dy=0: GO SUB 1500
+1050 LET psp=ps
+1060 LET dx=-1: LET dy=0: GO SUB 1500
+1070 LET psp=psp+ps
+1080 LET dx=0: LET dy=-1: GO SUB 1500
+1090 IF ps>psp THEN LET psp=ps: END IF
+1100 LET dx=1: LET dy=-1: GO SUB 1500
+1200 LET np=ps
+1210 LET dx=-1: LET dy=1: GO SUB 1500
+1220 LET np=np+ps
+1230 IF np>psp THEN LET psp=np: END IF
+1240 LET dx=1: LET dy=1: GO SUB 1500
+1250 LET np=ps
+1260 LET dx=-1: LET dy=-1: GO SUB 1500
+1270 LET np=np+ps
+1280 IF np>psp THEN LET psp=np: END IF
+1290 RETURN
+1500 LET ps=0: LET xx=x: LET yy=y: LET b=0
+1510 LET xx=xx+dx: LET yy=yy+dy
+1520 IF (xx<1) OR (yy<1) OR (xx>8) OR (yy>6) THEN RETURN: END IF
+1530 IF M(xx,yy)<>color AND M(xx,yy)<>0 THEN RETURN: END IF
+1540 IF M(xx,yy)=color AND b=0 THEN LET ps=ps+10: GO TO 1510: END IF
+1550 LET ps=ps+1: LET b=1: GO TO 1510
+1599 REM ******************************************************
+1600 LET M(x,y)=1: LET color=2: LET y=y+1
+1610 GO SUB 1030
+1620 IF psp>=30 THEN LET psp=0.05: END IF
+1630 LET y=y-1: LET M(x,y)=0: RETURN
+2000 LET cont=0
+2010 LET cont=cont+1
+2020 IF cont>6 THEN LET y=7: RETURN: END IF
+2030 IF M(x,cont)<>0 THEN GO TO 2010: END IF
+2040 LET y=cont: RETURN
+2500 FOR n=1 TO 6: BEEP n*n/100,n: BEEP n/50,n: NEXT n: RETURN
+2700 REM Waits for a Key press since we lack the INPUT sentence
+2710 LET a$=INKEY$: IF a$="" THEN GO TO 2710: END IF
+2720 RETURN
+2800 GOSUB 2700: IF a$ <> "y" AND a$ <> "m" THEN GOTO 2800: END IF
+2810 RETURN
+3000 IF color=1 THEN INK 7: END IF
+3005 IF color=2 THEN INK 2: END IF
+3010 LET xx=((xp*2)+1)*8: LET yy=((yp*2)+3)*8
+3020 FOR n=1 TO 7: CIRCLE xx,yy,n: NEXT n: INK 7
+3030 RETURN
+3500 PRINT INK 2;" \{vi}\ \::\::\ \::\ \ \ \ \::\::\::\ \ \ \:: \:: \.'\::\ \::\ \ \ \::\::\::\::\:: \::\:: \::\:: \::\::\:: \::\::\:: \:: \:: \::\.' \:: \:: \::\::\::\::\::\ \::\::\:: \::\:: \::\::\:: \:: \:: \:: \::\:: \::\ \::\ \::\::\::\::\:: \::\::\:: \::\::\:: \:: \:: \:: \::\:: \::\ \ \ \{vn}": GO TO 3600
+3550 PRINT INK 2;"\::\::\:: \::\ \:: \::\::\:: \::\::\:: \::\'.\ \:: \::\::\:: \::\::\::\ \ \ \::\ \ \::\ \::\ \ \ \::\ \ \ \::\ \::\ \::\ \'.\::\ \::\ \::\ \'.\..\ \ \ \ \::\ \ \:: \:: \:: \:: \::\::\::\ \::\ \ \::\ \::\::\::\ \ \ \'. \:: \::\::\::\ \ \ \::\::\::\ \::\ \::\ \::\ \ \::\ \::\ \::\ \::\::\::"
+3600 PRINT "Play Again? (y/n)": GOSUB 2700: IF a$="y" THEN GO TO 6: END IF: IF a$<>"n" THEN GOTO 3600: END IF
+```
diff --git a/docs/examples/circle.bas.md b/docs/examples/circle.bas.md
new file mode 100644
index 000000000..c68f7e901
--- /dev/null
+++ b/docs/examples/circle.bas.md
@@ -0,0 +1,32 @@
+#Circle.Bas
+
+```
+Program: circle.bas
+```
+
+```
+REM Sample circle drawing without using the CIRCLE command
+
+DIM i, r, x, y, q as FLOAT
+DIM ax, ay, zx, zy, dx, dy as Integer
+
+x = 127
+y = 87
+r = 40
+q = 1 / r
+
+FOR i = 0 TO PI / 2 STEP q
+ dy = SIN(i) * r
+ dx = COS(i) * r
+
+ zx = x - dx
+ zy = y - dy
+ ax = x + dx
+ ay = y + dy
+
+ PLOT ax, ay
+ PLOT zx, ay
+ PLOT ax, zy
+ PLOT zx, zy
+NEXT i
+```
diff --git a/docs/examples/clock.bas.md b/docs/examples/clock.bas.md
new file mode 100644
index 000000000..6c86c88ba
--- /dev/null
+++ b/docs/examples/clock.bas.md
@@ -0,0 +1,41 @@
+#Clock.Bas
+
+```
+ Program: clock.bas
+```
+```
+REM From the ZX Spectrum MANUAL
+REM A Clock program
+
+REM First we draw the Sphere
+CLS
+FOR n = 1 to 12
+ PRINT AT 10 - (10 * COS(n * PI / 6) - 0.5), 16 + (0.5 + 10 * SIN(n * PI / 6)); n
+NEXT n
+PRINT AT 23, 0; "PRESS ANY KEY TO EXIT";
+
+FUNCTION t AS ULONG
+ REM Reads the FRAMES counter
+ RETURN INT((65536 * PEEK(23674) + 256 * PEEK(23673) + PEEK(23672))/50)
+END FUNCTION
+
+DIM t1 as FLOAT
+
+OVER 1
+WHILE INKEY$ = ""
+ LET t1 = t()
+ LET a = t1 / 30 * PI: REM a is the seconds pointer in radians
+ LET sx = 72 * SIN a : LET sy = 72 * COS a
+ PLOT 131, 107: DRAW sx, sy
+
+ LET t2 = t()
+ WHILE (t2 <= t1) AND (INKEY$ = "")
+ REM WARNING: Empty loops might be optimized and removed
+ let t2 = t()
+ END WHILE : REM Wait until the moment to move it
+
+ PLOT 131, 107: DRAW sx, sy
+
+END WHILE
+```
+
diff --git a/docs/examples/clock2.bas.md b/docs/examples/clock2.bas.md
new file mode 100644
index 000000000..2013fa7e7
--- /dev/null
+++ b/docs/examples/clock2.bas.md
@@ -0,0 +1,41 @@
+#Clock2.Bas
+
+```
+ Program: clock2.bas
+```
+```
+REM From the ZX Spectrum MANUAL
+REM A Clock program
+
+REM First we draw the Sphere
+CLS
+CIRCLE 132, 105, 86
+FOR n = 1 to 12
+ PRINT AT 10 - (10 * COS(n * PI / 6) - 0.5), 16 + (0.5 + 10 * SIN(n * PI / 6)); n
+NEXT n
+CIRCLE 132, 105, 70
+
+PRINT AT 23, 0; "PRESS ANY KEY TO EXIT";
+
+FUNCTION t AS ULONG
+ RETURN INT((65536 * PEEK (23674) + 256 * PEEK(23673) + PEEK (23672))/50)
+END FUNCTION
+
+DIM t1 as FLOAT
+
+OVER 1
+WHILE INKEY$ = ""
+ LET t1 = t()
+ LET a = t1 / 30 * PI: REM a is the seconds pointer in radians
+ LET sx = 72 * SIN a : LET sy = 72 * COS a
+ PLOT 131, 107: DRAW sx, sy
+
+ LET t2 = t()
+ WHILE (t2 <= t1) AND (INKEY$ = "")
+ REM WARNING: Empty loops might be optimized and removed
+ let t2 = t()
+ END WHILE : REM Wait until the moment to move it
+
+ PLOT 131, 107: DRAW sx, sy
+END WHILE
+```
diff --git a/docs/examples/colors.bas.md b/docs/examples/colors.bas.md
new file mode 100644
index 000000000..db1dae2fd
--- /dev/null
+++ b/docs/examples/colors.bas.md
@@ -0,0 +1,25 @@
+#Colors.bas
+
+```
+ Program: colors.bas
+```
+```
+REM From the ZX Spectrum 48K Manual
+
+DIM m, n, c AS BYTE
+
+FOR m = 0 TO 1: BRIGHT m
+FOR n = 1 TO 10
+FOR c = 0 TO 7
+PAPER c: PRINT " ";: REM 4 coloured spaces
+NEXT c: NEXT n: NEXT m
+
+FOR m = 0 TO 1: BRIGHT m: PAPER 7
+FOR c = 0 TO 3
+INK c: PRINT c; " ";
+NEXT c: PAPER 0
+FOR c = 4 TO 7
+INK c: PRINT c; " ";
+NEXT c: NEXT m
+PAPER 7: INK 0: BRIGHT 0
+```
diff --git a/docs/examples/fact.bas.md b/docs/examples/fact.bas.md
new file mode 100644
index 000000000..d56aa9fb0
--- /dev/null
+++ b/docs/examples/fact.bas.md
@@ -0,0 +1,22 @@
+#Fact.bas
+
+```
+ Program: fact.bas
+```
+```
+REM Factorial recursive test
+
+function fact(x as ulong) as ulong
+ if x < 2 then
+ return 1
+ end if
+
+ return x * fact(x - 1)
+
+end function
+
+cls
+for x = 1 To 10:
+ print "Fact ("; x; ") = "; fact(x)
+next x
+```
diff --git a/docs/examples/flag.bas.md b/docs/examples/flag.bas.md
new file mode 100644
index 000000000..5258b4d95
--- /dev/null
+++ b/docs/examples/flag.bas.md
@@ -0,0 +1,80 @@
+#Flag.bas
+
+```
+ Program: flag.bas
+```
+
+```
+ 5 REM union flag (from the ZX Spectrum Manual)
+
+ 7 DIM n AS UInteger: REM Needed to avoid overflow at line 530
+ 10 LET r=2: LET w=7: LET b=1
+ 20 BORDER 0: PAPER b: INK w: CLS
+
+ 30 REM black in bottom of screen
+ 40 INVERSE 1
+ 50 FOR n=40 TO 0 STEP -8
+ 60 PLOT PAPER 0;7,n: DRAW PAPER 0;241,0
+ 70 NEXT n: INVERSE 0
+
+100 REM draw in white parts
+105 REM St. George
+110 FOR n=0 TO 7
+120 PLOT 104+n,175: DRAW 0,-35
+130 PLOT 151-n,175: DRAW 0,-35
+140 PLOT 151-n,48: DRAW 0,35
+150 PLOT 104+n,48: DRAW 0,35
+160 NEXT n
+200 FOR n=0 TO 11
+210 PLOT 0,139-n: DRAW 111,0
+220 PLOT 255,139-n: DRAW -111,0
+230 PLOT 255,84+n: DRAW -111,0
+240 PLOT 0,84+n: DRAW 111,0
+250 NEXT n
+
+300 REM St. Andrew
+310 FOR n=0 TO 35
+320 PLOT 1+2*n,175-n: DRAW 32,0
+330 PLOT 224-2*n,175-n: DRAW 16,0
+340 PLOT 254-2*n,48+n: DRAW-32,0
+350 PLOT 17+2*n,48+n: DRAW 16,0
+360 NEXT n
+370 FOR n=0 TO 19
+380 PLOT 185+2*n,140+n: DRAW 32,0
+390 PLOT 200+2*n,83-n: DRAW 16,0
+400 PLOT 39-2*n,83-n: DRAW 32,0
+410 PLOT 54-2*n,140+n: DRAW -16,0
+420 NEXT n
+
+425 REM fill in extra bits
+430 FOR n=0 TO 15
+440 PLOT 255,160+n: DRAW 2*n-30,0
+450 PLOT 0,63-n: DRAW 31-2*n,0
+460 NEXT n
+470 FOR n=0 TO 7
+480 PLOT 0,160+n: DRAW 14-2*n,0
+485 PLOT 255,63-n: DRAW 2*n-15,0
+490 NEXT n
+
+500 REM red stripes
+510 INVERSE 1
+
+520 REM St George
+530 FOR n=96 TO 120 STEP 8
+540 PLOT PAPER r;7,n: DRAW PAPER r;241,0
+550 NEXT n
+560 FOR n=112 TO 136 STEP 8
+570 PLOT PAPER r;n,168: DRAW PAPER r;0,-113
+580 NEXT n
+
+600 REM St Patrick
+610 PLOT PAPER r;170,140: DRAW PAPER r;70,35
+620 PLOT PAPER r;179,140: DRAW PAPER r;70,35
+630 PLOT PAPER r;199,83: DRAW PAPER r;56,-28
+640 PLOT PAPER r;184,83: DRAW PAPER r;70,-35
+650 PLOT PAPER r;86,83: DRAW PAPER r;-70,-35
+660 PLOT PAPER r;72,83: DRAW PAPER r;-70,-35
+670 PLOT PAPER r;56,140: DRAW PAPER r;-56,28
+680 PLOT PAPER r;71,140: DRAW PAPER r;-70,35
+690 INVERSE 0: PAPER 0: INK 7
+```
diff --git a/docs/examples/fractal.bas.md b/docs/examples/fractal.bas.md
new file mode 100644
index 000000000..564bb3b16
--- /dev/null
+++ b/docs/examples/fractal.bas.md
@@ -0,0 +1,81 @@
+#Fractal.bas
+
+```
+Program: fractal.bas by @Britlion
+```
+
+
+```
+#define width 256
+#define height 192
+
+DIM x,y as FIXED
+DIM xstart,xstep,ystart,ystep as FIXED
+DIM xend,yend as FIXED
+DIM z,zi,newz,newzi as FIXED
+DIM colour as byte
+DIM iter as uInteger
+DIM col as uInteger
+DIM i,k as uByte
+DIM j as uInteger
+dim inset as uByte
+
+xstart=-1.6
+xend=0.65
+ystart=-1.15
+yend=-ystart
+iter=24
+
+xstep=(xend-xstart)/width
+ystep=(yend-ystart)/height
+
+'Main loop
+x=xstart
+y=ystart
+
+border 0
+paper 0
+ink 7
+CLS
+
+for i=0 to ( height -1 )/2 +1
+
+ for j=0 to width -1
+ z=0
+ zi=0
+ inset=1
+ for k=0 to iter
+ ';z^2=(a+bi)*(a+bi) = a^2+2abi-b^2
+ newz=(z*z)-(zi*zi)+x
+ newzi=2*z*zi+y
+ z=newz
+ zi=newzi
+
+ if (z*z)+(zi*zi) > 4 then
+ inset=0
+ colour=k
+ goto screen
+ END IF
+ next k
+
+screen:
+
+ if NOT inset then
+ if colour BAND 1 THEN
+ plot j,i
+ plot j,192-i
+ END IF
+ end if
+
+ x=x+xstep
+ next j
+
+ y=y+ystep
+ x=xstart
+
+print at 23,0;CAST(uinteger,i)*200/height;"%"
+next i
+
+BEEP 1,1
+PAUSE 0
+```
diff --git a/docs/examples/freregustav.bas.md b/docs/examples/freregustav.bas.md
new file mode 100644
index 000000000..acf7e083c
--- /dev/null
+++ b/docs/examples/freregustav.bas.md
@@ -0,0 +1,22 @@
+#FrereGustav.bas
+
+```
+ Program: freregustav.bas
+```
+```
+REM Frere Gustav, from the ZX Spectrum 48K Manual, Chapter 19
+
+PRINT "Frere Gustav"
+
+BEEP 1, 0: BEEP 1, 2: BEEP .5, 3: BEEP .5, 2: BEEP 1, 0
+BEEP 1, 0: BEEP 1, 2: BEEP .5, 3: BEEP .5, 2: BEEP 1, 0
+
+BEEP 1, 3: BEEP 1, 5: BEEP 2, 7
+BEEP 1, 3: BEEP 1, 5: BEEP 2, 7
+
+BEEP .75, 7: BEEP .25, 8: BEEP .5, 7: BEEP .5, 5: BEEP .5, 3: BEEP .5, 2: BEEP 1, 0
+BEEP .75, 7: BEEP .25, 8: BEEP .5, 7: BEEP .5, 5: BEEP .5, 3: BEEP .5, 2: BEEP 1, 0
+
+BEEP 1, 0: BEEP 1, -5: BEEP 2, 0
+BEEP 1, 0: BEEP 1, -5: BEEP 2, 0
+```
diff --git a/docs/examples/lines.bas.md b/docs/examples/lines.bas.md
new file mode 100644
index 000000000..a782b5b0d
--- /dev/null
+++ b/docs/examples/lines.bas.md
@@ -0,0 +1,19 @@
+#Lines.bas
+
+```
+ Program: lines.bas
+```
+
+```
+ 5 REM From the ZX Spectrum manual on Drawing primitives
+ 6 DIM x1, y1, x2, y2, c as Integer
+
+10 BORDER 0: PAPER 0: INK 7: CLS: REM turn screen blank
+20 LET x1 = 0: LET y1 = 0: REM line start
+30 LET c = 1: REM Ink color starting from blue
+40 LET x2 = INT(RND * 256): LET y2 = INT(RND * 176): REM Random line end
+50 DRAW INK c; x2 - x1, y2 - y1
+60 LET x1 = x2: LET y1 = y2: REM Next line starts at current one's ending
+70 LET c = c + 1: IF c = 8 THEN LET c = 1: END IF: REM Next color
+80 IF INKEY$ = "" THEN GOTO 40: END IF
+```
diff --git a/docs/examples/snake.bas.md b/docs/examples/snake.bas.md
new file mode 100644
index 000000000..921c5ab7c
--- /dev/null
+++ b/docs/examples/snake.bas.md
@@ -0,0 +1,175 @@
+#Snake.Bas
+
+```
+ Program: snake.bas
+```
+
+```
+ 1 REM ********************************************************************
+ 2 REM ZXSnake by Federico J. Alvarez Valero (2003-02-05)
+ 10 REM This program is free software; you can redistribute it and/or modify
+ 11 REM it under the terms of the GNU General Public License as published by
+ 12 REM the Free Software Foundation; either version 2 of the License, or
+ 13 REM (at your option) any later version.
+ 14 REM This program is distributed in the hope that it will be useful,
+ 15 REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+ 16 REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 17 REM GNU General Public License for more details.
+ 18 REM You should have received a copy of the GNU General Public License
+ 19 REM along with this program; if not, write to the Free Software
+ 20 REM Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ 30 REM ENGLISH VERSION
+ 40 REM ********************************************************************
+
+ 50 BORDER 7 : PAPER 7 : INK 0 : CLS
+ 51 PRINT AT 3,13 ; PAPER 1 ; INK 7 ; "ZXSnake"
+ 52 PRINT AT 5,9 ; PAPER 7 ; INK 0 ; "Q - Up"
+ 53 PRINT AT 6,9 ; PAPER 7 ; INK 0 ; "A - Down"
+ 54 PRINT AT 7,9 ; PAPER 7 ; INK 0 ; "O - Left"
+ 55 PRINT AT 8,9 ; PAPER 7 ; INK 0 ; "P - Right"
+ 56 PRINT AT 10,3 ; PAPER 7 ; INK 0 ; "You have to pick up every"
+ 57 PRINT AT 11,3 ; PAPER 7 ; INK 0 ; "fruit on the screen while"
+ 58 PRINT AT 12,3 ; PAPER 7 ; INK 0 ; "growing up more and more..."
+ 59 PRINT AT 15,3 ; PAPER 7 ; INK 0 ; "Press any key to start"
+ 60 LET j$ = INKEY$
+ 61 IF j$ = "" THEN GOTO 60: END IF
+
+ 70 REM UDG
+ 71 DIM udg(1, 7) AS uByte => { {60, 66, 129, 129, 129, 129, 66, 60}, _
+ {24, 60, 60, 60, 126, 251, 247, 126}}
+ 73 POKE UINTEGER 23675, @udg(0, 0): REM Sets UDG variable to point to the first element
+ 74 LET S$ = CHR$(144): LET F$ = CHR$(145)
+
+ 75 REM Variable declaration
+ 76 DIM p(23,34) AS UBYTE: REM Screen
+ 77 DIM x(23,34) AS UBYTE: REM Xorientations
+ 78 DIM y(23,34) AS UBYTE: REM Yorientations
+ 79 DIM c, f AS UBYTE
+ 80 DIM headx, heady AS UBYTE : REM Head coordinates
+ 81 DIM tailx, taily AS UBYTE : REM Tail coordinates
+ 90 DIM score, eaten as ULONG
+ 95 DIM maxx, maxy, minx, miny as UByte
+
+ 100 REM Variable definition
+ 110 LET headx = 11 : REM head x coordinate
+ 120 LET heady = 5 : REM head y coordinate
+ 130 LET tailx = 5 : REM tail x coordinate
+ 140 LET taily = 5 : REM tail y coordinate
+ 150 LET orientationx = 1
+ 160 LET orientationy = 0
+
+ 165 REM Clear arrays p, x and y
+ 170 FOR c = 1 to 23: FOR f = 1 to 34
+ 180 LET p(c, f) = 0: LET x(c, f) = 0: LET y(c, f) = 0
+ 190 NEXT f: NEXT c
+
+ 200 LET score = 0
+ 210 LET eaten = 0
+ 220 LET maxx = 33
+ 230 LET maxy = 22
+ 240 LET minx = 0
+ 250 LET miny = 0
+
+1000 REM Screen Initialization
+1010 BORDER 1
+1015 CLS
+1020 PRINT AT 21,0 ; PAPER 1 ; INK 7 ; " SCORE : "
+1030 FOR c = minx TO maxx
+1040 LET p(miny+1,c+1) = 4
+1050 LET p(maxy+1,c+1) = 4
+1060 NEXT c
+1070 FOR f = miny TO maxy
+1080 LET p(f+1,minx+1) = 4
+1090 LET p(f+1,maxx+1) = 4
+1100 NEXT f
+
+1500 GOSUB 8000 : REM Place first fruit
+
+2000 REM Draw snake in its initial position
+2001 PAPER 7 : INK 0
+2005 REM Draw the body
+2010 FOR c = tailx TO headx-1
+2020 PRINT AT taily,c ; INK 0 ; "O"
+2025 LET p(taily+2,c+2) = 3
+2026 LET x(taily+2,c+2) = 1
+2027 LET y(taily+2,c+2) = 0
+2030 NEXT c
+2040 REM Draw the Head
+2050 PRINT AT heady,headx ; INK 0 ; S$;
+2055 LET p(heady+2,headx+2) = 2
+2056 LET x(heady+2,headx+2) = 1
+2057 LET y(heady+2,headx+2) = 0
+
+3000 REM Update snake position
+3005 INK 0
+3010 REM Change the orientation if needed
+3015 LET x(heady+2,headx+2) = orientationx
+3020 LET y(heady+2,headx+2) = orientationy
+3025 REM Erase previous head
+3030 PRINT AT heady,headx ; "O"
+3035 LET p(heady+2,headx+2) = 3
+3040 LET headx = headx + orientationx
+3045 LET heady = heady + orientationy
+3050 IF p(heady+2,headx+2) > 1 THEN GOTO 9900: END IF
+3051 IF p(heady+2,headx+2) = 1 THEN
+ LET score = score + 10 : PRINT AT 21,10 ; _
+ PAPER 1 ; INK 7 ; score : LET eaten = 1 : GOSUB 8000: END IF
+3055 REM Print the new head
+3060 PRINT AT heady,headx ; S$;
+3065 LET p(heady+2,headx+2) = 2
+3070 IF eaten = 0 THEN GOSUB 8100: END IF
+3080 LET eaten = 0
+
+3200 REM Read the keyboard
+3210 LET a$ = INKEY$
+3220 IF orientationx < 1 AND (a$ = "O" OR a$ = "o") THEN
+ LET orientationx = -1 : LET orientationy = 0: END IF
+
+3230 IF orientationx > -1 AND (a$ = "P" OR a$ = "p") THEN
+ LET orientationx = 1 : LET orientationy = 0: END IF
+
+3240 IF orientationy < 1 AND (a$ = "Q" OR a$ = "q") THEN
+ LET orientationx = 0 : LET orientationy = -1: END IF
+
+3250 IF orientationy > -1 AND (a$ = "A" OR a$ = "a") THEN
+ LET orientationx = 0 : LET orientationy = 1: END IF
+
+3500 REM Pausa / Delay
+3505 BEEP 0.005, 0
+3510 FOR i = 1 TO 500:
+ NEXT i
+
+7998 GOTO 3000
+
+8000 REM Fruit placement
+8010 LET fruitx = INT(RND*30)+1
+8020 LET fruity = INT(RND*20)+1
+8030 IF p(fruity+2,fruitx+2) = 0 THEN GOTO 8050: END IF
+8040 GOTO 8010
+8050 PRINT AT fruity,fruitx ; INK 2 ; F$;
+8060 LET p(fruity+2,fruitx+2) = 1
+8070 RETURN
+
+8100 REM Erase tail
+8110 PRINT AT taily,tailx ; " "
+8120 LET newtailx = tailx + x(taily+2,tailx+2)
+8130 LET newtaily = taily + y(taily+2,tailx+2)
+8140 LET p(taily+2,tailx+2) = 0
+8150 LET x(taily+2,tailx+2) = 0
+8160 LET y(taily+2,tailx+2) = 0
+8170 LET tailx = newtailx
+8180 LET taily = newtaily
+8190 RETURN
+
+9900 REM Game over
+9910 PRINT AT 10,12 ; INK 2 ; "GAME OVER..."
+9920 PRINT AT 11,10 ; INK 2 ; "SCORE : " ; score
+9930 PRINT AT 13,10 ; INK 0 ; "Press any key"
+9931 REM Mondatory pause so the msg. can be read
+9932 FOR i = 0 TO 100
+
+9933 NEXT i
+9940 LET j$ = INKEY$
+9950 IF j$ <> "" THEN GOTO 100: END IF
+9960 GOTO 9940
+```
diff --git a/docs/exit.md b/docs/exit.md
new file mode 100644
index 000000000..eaeb8e9db
--- /dev/null
+++ b/docs/exit.md
@@ -0,0 +1,22 @@
+#EXIT
+
+##Syntax
+
+```
+EXIT DO
+EXIT FOR
+EXIT WHILE
+```
+
+##Description
+
+Terminates the current loop structure immediately and carries on execution from after the corresponding **LOOP**, **NEXT** or **END WHILE** statement.
+
+##Remarks
+* This is NOT compatible with Sinclair Basic
+
+##See Also
+* [CONTINUE](continue.md)
+* [DO ... LOOP](do.md)
+* [FOR ... NEXT](for.md)
+* [WHILE ... END WHILE](while.md)
diff --git a/docs/external_resources.md b/docs/external_resources.md
new file mode 100644
index 000000000..6a6673e43
--- /dev/null
+++ b/docs/external_resources.md
@@ -0,0 +1,44 @@
+#External Resources
+
+ZX BASIC is an **open compiler toolkit**.
+Other people contribute to it creating alternative IDEs, libraries, tools and utilities. Feel free to browse them, as you might find them useful for your work!
+
+##IDEs
+IDE are integrated source (or bigger projects) editor, sometimes with an integrated debugger and many other tools (e.g. Borland Delphi or Visual Studio are well known IDEs). Some people have developed IDEs usable for ZX BASIC.
+
+###Tommy Gun
+A free IDE created by [Tony Thompson](http://www.users.on.net/~tonyt73). This powerful tool is designed to create
+generic 8-bit and 16-bit projects, and can be set up to be used with ZX Basic.
+Have a look at the [TommyGun files](https://sourceforge.net/projects/tommygun/files/) page.
+
+To integrate ZX Basic with Tommy Gun, please follow this [tutorial](http://www.boriel.com/forum/viewtopic.php?f=14&t=329&start=0).
+
+## Graphics editors
+
+* [SevenUP](http://www.speccy.org/metalbrain/), a ZX Spectrum graphics editor for FreeBSD, GNU/Linux, MacOS and Windows.
+
+* [Multipaint](http://multipaint.kameli.net/), a Java-based graphics editor that allows you to draw pictures with the color limitations of some typical screen formats from 8-bit computer platforms, like ZX Spectrum, C64 and Plus/4 high-resolution and multicolor, MSX 1 and Amstrad CPC0.
+
+##Utilities
+Other generic utilities not above are:
+
+###VIM Syntax Coloring
+If you use [VIM](http://www.vim.org/) (I do) you can now tell vim to highlight your ZX BASIC .bas listings.
+[Programandala](http://programandala.net/) has a nice Spectrum and retro programming site.
+He also created a [VIM Syntax File for ZX BASIC](http://programandala.net/en.program.zx_basic_vim_syntax_file).
+I find this very useful.
+
+##Engines
+There are several external engines that can be used within compiler to achieve effects like multi colour display, or sprite handling.
+
+* [FASE](http://www.boriel.com/forum/zx-basic-compiler/zxodus-engine-t891.html)
+ (or [here](http://www.boriel.com/forum/zx-basic-compiler/fucking-awesome-spectrum-engine-fase-t899.html)),
+ a sprite, tile and map engine.
+* [Nirvana](https://www.ime.usp.br/~einar/bifrost/) A multi-colour timing engine
+* [Nirvana+](https://www.worldofspectrum.org/forums/discussion/45538/a-new-full-screen-bicolor-engine-called-nirvana/p10)
+ (or [https://www.ime.usp.br/~einar/bifrost/ here]) A multi-colour timing engine
+* [Bifrost*](http://www.worldofspectrum.org/infoseekid.cgi?id=0027405) A multi-colour timing engine
+* [Bifrost*2](https://www.ime.usp.br/~einar/bifrost/) A multi-colour timing engine
+* [https://www.facebook.com/zxodus Zxodus][Engine]
+ (or [here](http://www.boriel.com/forum/zx-basic-compiler/zxodus-engine-t891.html))
+ A 3d maze and RPG engine with multicolour support.
diff --git a/docs/fastcall.md b/docs/fastcall.md
new file mode 100644
index 000000000..c2ccedb2a
--- /dev/null
+++ b/docs/fastcall.md
@@ -0,0 +1,37 @@
+#FASTCALL
+
+Fastcall is used to indicate that an assembly function should be jumped into with registers already set.
+
+* If the function takes a Byte (or uByte) parameter, then the A register will be set with this parameter.
+* If it takes an Integer (or uInteger) parameter, then the HL register will be set with the value of that parameter on entry to the function.
+* If it takes a Long (or uLong), or fixed parameter, then the DE and HL registers will hold the 32 bit value of the parameter.
+* If it takes a float type parameter, then the registers C, DE and HL will hold the five bytes for that value.
+
+Return is automatic based on the function return type in the same way:
+* 8 bit returns should be in the A register
+* 16 bit returns should be in HL
+* 32 bit returns should be in DEHL
+* 40 bit FLOAT returns should be in CDEHL.
+
+Fastcall should ONLY be used with functions that take a single parameter. If you use more than one parameter, you'll have to deal with the stack (SP register) and restore it to the previous it had before your function was called.
+
+**Example:**
+
+```
+FUNCTION FASTCALL whatLetter (A as uByte) as uByte
+ Asm
+ JP START
+ DATA: DEFB "A Man, A Plan, A Canal, Panama"
+ START: LD HL,DATA
+ ADD HL,A
+ LD A,(HL)
+ End Asm
+END FUNCTION
+```
+
+The above function, when called with `whatLetter()` will return the ``-th letter of the phrase
+`"A Man, A Plan, A Canal, Panama"`.
+
+###Notes
+* Note that the A register already contains when the inline assembly is reached.
+* Note that we do NOT need to put a ret opcode on the end of the assembly. The compiler will do that for us.
diff --git a/docs/flash.md b/docs/flash.md
new file mode 100644
index 000000000..ab62f5345
--- /dev/null
+++ b/docs/flash.md
@@ -0,0 +1,40 @@
+#FLASH
+
+##Syntax
+```
+FLASH
+```
+or
+```
+PRINT FLASH ;
+```
+This can be used to change the permanent print settings, or the temporary ones.
+When used as a direct command:
+
+```
+FLASH n
+```
+being `n` either 0 (false) or 1 (true), then the subsequent print statements will print characters that have
+their `INK` and `PAPER` values swapped at regular intervals automatically by the Spectrum's ULA.
+
+Just as in Sinclair Basic, this command can be used as temporary colours by combining them with a print statement:
+
+```
+Print INK 0;PAPER 7; FLASH 1; "This is flashing black and white text"
+```
+This format does not change the permanent colour settings and only affects the characters printed within that print statement.
+
+##Remarks
+* This function is 100% Sinclair BASIC compatible.
+
+##See also
+
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [BORDER](border.md)
+* [BOLD](bold.md)
+* [INK](ink.md)
+* [ITALIC](italic.md)
+* [OVER](over.md)
+* [INVERSE](inverse.md)
+* [BRIGHT](bright.md)
diff --git a/docs/for.md b/docs/for.md
new file mode 100644
index 000000000..5ca688e46
--- /dev/null
+++ b/docs/for.md
@@ -0,0 +1,54 @@
+#FOR ... NEXT
+
+##Syntax
+
+```
+ FOR iterator = startvalue TO endvalue [ STEP stepvalue ]
+ [ sentences ]
+ NEXT [ iterator ]
+```
+##Parameters
+
+* _iterator_: a variable identifier that is used to iterate from an initial value to an end value.
+* _datatype_: If specified, the variable iterator will automatically be declared with the type datatype.
+* _startvalue_: an expression that denotes the starting value of the iterator.
+* _endvalue_: an expression used to compare with the value of the iterator.
+* _stepvalue_: an expression that is added to the iterator after every iteration.
+
+##Description
+
+A **For...Next** loop initializes _iterator_ to _startvalue_, then executes the _sentences_, incrementing _iterator_ by _stepvalue_ until it reaches or exceeds _endvalue_. If _stepvalue_ is not explicitly given it will set to 1.
+
+##Examples
+
+```
+FOR i = 1 TO 10: PRINT i: NEXT
+```
+
+##Differences From Sinclair Basic
+* The variable name after the NEXT statement is not required.
+
+* Note that variable types can cause issues with ZX Basic For...Next Loops. If the upper limit of the iterator exceeds the upper limit of the variable type, the loop may not complete.
+For example:
+```
+DIM i as UByte
+
+FOR i = 1 to 300
+ PRINT i
+NEXT i
+```
+
+Clearly, since the largest value a byte can hold is 255, it's not possible for i in the above example to exceed 300.
+The variable will "wrap around" to 0 and as a result, the loop will not ever terminate.
+This can happen in much more subtle ways when STEP is used.
+There has to be "room" within the variable type for the iterator to exceed the terminator when it is being
+incremented by "STEP" amounts.
+
+##See Also
+
+* [WHILE ... END WHILE](while.md)
+* [DO ... LOOP](do.md)
+* [IF ... END IF](if.md)
+* [EXIT](exit.md)
+* [CONTINUE](continue.md)
+* [Sinclair Basic Manual](http://www.worldofspectrum.org/ZXBasicManual/zxmanchap4.html)
diff --git a/docs/function.md b/docs/function.md
new file mode 100644
index 000000000..d2c25ff1d
--- /dev/null
+++ b/docs/function.md
@@ -0,0 +1,75 @@
+#FUNCTION
+
+ZX Basic allows function and subroutines declarations. This feature is new to ZX Basic.
+Sinclair BASIC allowed limited function definitions using `DEF FN`.
+
+A function is a subroutine (like GO SUB) that is invoked directly.
+The subroutine returns a value than can be used later.
+BASIC language already has some predefined functions, like `SIN`, `COS`, `PEEK` or `LEN`.
+The user is now allowed to define his/her own functions.
+
+##Syntax
+Basic function declaration is:
+
+```
+ FUNCTION [()] [AS ]
+
+ ...
+ END FUNCTION
+```
+##Example
+A simple function declaration:
+
+```
+REM This function receives and returns a byte
+FUNCTION PlusOne(x AS Byte) AS Byte
+ RETURN x + 1
+END FUNCTION
+
+REM Using the function
+PRINT x; " plus one is "; PlusOne(x)
+```
+
+If `AS` _type_ is omitted, the function is supposed to return a `Float`.
+
+```
+REM This function returns a float number because its type has been omitted.
+REM Also, the 'x' parameter will be converted to float,
+REM because it's type has been omitted too
+
+FUNCTION Square(x)
+ RETURN x^2
+END FUNCTION
+
+REM Using the function
+PRINT "Square of "; x; " is "; Square(x)
+```
+
+##Recursion
+Recursion is a programming technique in which a function calls itself. A classical recursion example is the factorial function:
+
+```
+FUNCTION Factorial(x)
+ IF x < 2 THEN RETURN 1
+ RETURN Factorial(x - 1) * x
+END FUNCTION
+```
+
+However, not using types explicitly might have a negative impact on performance.
+Better redefine it using data types. Factorial is usually defined on unsigned integers and also returns an unsigned
+integer. Also, keep in mind that factorial numbers tends to _grow up very quickly_ (e.g. Factorial of 10 is 3628800),
+so `ULong` [type](types.md) (32 bits unsigned) seems to be the most suitable for this function.
+
+This version is faster (just the 1st line is changed):
+
+```
+FUNCTION Factorial(x AS Ulong) AS Ulong
+ IF x < 2 THEN RETURN x
+ RETURN Factorial(x - 1) * x
+END FUNCTION
+```
+
+##Memory Optimization
+If you invoke zxbasic using `-O1` (or higher) optimization flag the compiler will detect and ignore unused functions
+(thus saving memory space). It will also issue a warning (perhaps you forgot to call it?),
+that can be ignored.
diff --git a/docs/identifier.md b/docs/identifier.md
new file mode 100644
index 000000000..289e4038e
--- /dev/null
+++ b/docs/identifier.md
@@ -0,0 +1,133 @@
+#Identifier
+
+
+Identifiers are used in your ZX BASIC program to define _variable names_, _function names_, _subroutine names_ and _[labels](labels.md)_. ZX Basic identifiers **must** start with a letter (a..z / A..Z) followed by an arbitrary number of letters and or digits. Original Sinclair BASIC allows spaces within variable names, but ZX BASIC does not (in fact, I found it a bit confusing!)
+
+Some identifiers are **reserved words**. Most of them are either BASIC _statements_ or _functions_. Functions return a value to be used in an _expression_ whilst statements do not.
+
+Note that there are a number of common statements that you may find in ZX BASIC programs that are not technically reserved words, but library functions. Some of the internal libraries form functions that may overlap with your subroutine and function names (such as POS). So while they may not be technically reserved, you should consider the library function names as ones you should avoid. Also, some Sinclair Basic statements are implemented as library functions, so you should be especially aware of identifiers of this type, such as INPUT, POINT and ATTR.
+
+## Reserved Identifiers
+
+The following identifiers are _reserved words_, and can't be used as variables, functions or labels. Reserved identifiers are _case insensitive_ (it doesn't matter whether you write them in upper or lower case letters, or a mix of them). So **PRINT**, **print** and **PrInT** means all the same in ZX BASIC. On the other hand, non-reserved words can be either case sensitive or not (depending on the [options](options.md)) in effect.
+
+Identifiers shown in bold are taken from the Sinclair BASIC (beware their meaning here might be different, however). Some of them has been marked as _statements_, _functions_ or _operators_:
+
+* **[ABS](abs.md)** **(function)**
+* **[ACS](acs.md)** **(function)**
+* **[AND](operators.md#AND)** **(operator)**
+* [ALIGN](align.md) **(special)**
+* [ASM](asm.md) **(special)**
+* **[ASN](asn.md)** **(function)**
+* **[AT](at.md)**
+* **[ATN](atn.md)** **(function)**
+* **[bAND](bitwiselogic.md)** **(operator)**
+* **[bNOT](bitwiselogic.md)** **(operator)**
+* **[bOR](bitwiselogic.md)** **(operator)**
+* **[bXOR](bitwiselogic.md)** **(operator)**
+* **[BEEP](beep.md)** **(statement)**
+* [BOLD](bold.md)
+* **[BORDER](border.md)** **(statement)**
+* **[BRIGHT](bright.md)** **(statement)**
+* [ByRef](byref.md)
+* [ByVal](byval.md)
+* [CAST](cast.md) **(function)**
+* **[CHR](chr.md)** **(function)** (can also be written as **CHR$**)
+* **[CIRCLE](circle.md)** **(statement)**
+* **[CLS](cls.md)** **(statement)**
+* **[CODE](code.md)** **(function)**
+* [CONST](const.md)
+* **[CONTINUE](continue.md)** **(statement)**
+* **[COS](cos.md)** **(function)**
+* **[DECLARE](declare.md)** ****
+* **[DIM](dim.md)** **(statement)**
+* [DO](do.md) **(statement)**
+* **[DATA](data.md)** **(statement)**
+* **[DRAW](draw.md)** **(statement)**
+* [ELSE](if.md)
+* [ELSEIF](if.md)
+* [END](end.md)
+* [EXIT](exit.md) **(statement)**
+* **[EXP](exp.md)** **(function)**
+* [FastCall](fastcall.md)
+* **[FLASH](flash.md)** **(statement)**
+* **[FOR](for.md)** **(statement)**
+* [FUNCTION](function.md)
+* **[GO TO](goto.md)** or [GOTO](goto.md) **(statement)**
+* **[GO SUB](gosub.md)** or [GOSUB](gosub.md) **(statement)**
+* **[IF](if.md)** **(statement)**
+* **[IN](in.md)** **(function)**
+* **[INK](ink.md)** **(statement)**
+* **[INKEY](inkey.md)** **(function)** (can also be written as **INKEY$**)
+* **[INPUT](input.md)** **(function)** (not compatible with ZX BASIC)
+* **[INT](int.md)** **(function)**
+* **[INVERSE](inverse.md)** **(statement)**
+* [ITALIC](italic.md)
+* [LBOUND](lbound.md) ****
+* **[LET](let.md)** **(statement)**
+* **[LEN](len.md)** **(function)**
+* **[LN](ln.md)** **(function)**
+* **[LOAD](load.md)** **(statement)**
+* [LOOP](do.md) **(statement)**
+* [MOD](operators#arithmetic_operators.md) **(operator)**
+* **[NEXT](for.md)** **(statement)**
+* **[NOT](operators.md#NOT)** **(operator)**
+* **[OR](operators.md#OR)** **(operator)**
+* **[OVER](over.md)** **(statement)**
+* **[OUT](out.md)** **(statement)**
+* **[PAPER](paper.md)** **(statement)**
+* **[PAUSE](pause.md)** **(statement)**
+* **[PEEK](peek.md)** **(function)**
+* **[PI](pi.md)** ****
+* **[PLOT](plot.md)** **(statement)**
+* **[POKE](poke.md)** **(statement)**
+* **[PRINT](print.md)** **(statement)**
+* **[RANDOMIZE](randomize.md)** **(statement)**
+* **[READ](read.md)** **(statement)**
+* **[REM](comments.md)** **(commentary)** (can also be written as ')
+* **[RESTORE](restore.md)** **(statement)**
+* **[RETURN](return.md)** **(statement)**
+* **[RND](rnd.md)** **(function)**
+* **[SAVE](load.md)** **(statement)**
+* **[SGN](sgn.md)** **(function)**
+* [SHL or <<](shl.md) (operator)
+* [SHR or >>](shl.md) (operator)
+* **[SIN](sin.md)** **(function)**
+* **[SQR](sqr.md)** **(function)**
+* [StdCall](stdcall.md)
+* **[STEP](for.md)**
+* **[STOP](stop.md)**
+* **[STR](str.md)** **(function)** (Can also be written as **STR$**)
+* **[SUB](sub.md)**
+* **[TAN](tan.md)** **(function)**
+* **[THEN](if.md)**
+* **[TO](to.md)**
+* [UBOUND](ubound.md) **(function)**
+* [UNTIL](do.md) **(statement)**
+* **[VAL](val.md)** **(function)**
+* **[VERIFY](load.md)** **(statement)**
+* [WEND](while.md) **(statement)**
+* [WHILE](while.md) **(statement)**
+* **[XOR](operators#logical_operators.md)** **(operator)**
+
+##Inbuilt library Functions
+You should also avoid defining (with a SUB or FUNCTION command) routines with the following names, as they are available in the internal library for your use, though you are almost certainly going to need to use #include before using them. Note that some Sinclair Basic words are listed here. Some Freebasic commands are also available through #include options for compatibility with freebasic.
+
+* [ASC (Library Function)](asc.bas.md) **(function)**
+* **[ATTR (Library Function)](attr.md)** **(function)**
+* **[CSRLIN (Library Function)](csrlin.md)** **(function)**
+* [HEX (Library Function)](hex.md) **(function)**
+* [HEX16 (Library Function)](hex.md) **(function)**
+* **[INPUT (Library Function)](input.md)** **(function)**
+* **[GetKey (Library Function)](keys.bas.md)** **(function)**
+* **[MultiKeys (Library Function)](keys.bas.md)** **(function)**
+* **[GetKeyScanCode (Library Function)](keys.bas.md)** **(function)**
+* **[LCase (Library Function)](lcase.md)** **(function)**
+* **[UCase (Library Function)](ucase.md)** **(function)**
+* **[POINT (Library Function)](point.md)** **(function)**
+* **[POS (Library Function)](pos.md)** **(function)**
+* **[print42 (Library Subroutine)](print42.bas.md)** **(sub)**
+* **[printat42 (Library Subroutine)](print42.bas.md)** **(sub)**
+* **[print64 (Library Subroutine)](print64.bas.md)** **(sub)**
+* **[printat64 (Library Subroutine)](print64.bas.md)** **(sub)**
+* **[SCREEN(Library Function)](screen.md)** **(function)**
diff --git a/docs/if.md b/docs/if.md
new file mode 100644
index 000000000..56fdb1234
--- /dev/null
+++ b/docs/if.md
@@ -0,0 +1,83 @@
+#IF ... END IF
+
+**IF** is a very powerful control flow sentence that allows you to _make decisions_ under specified contitions.
+
+##Syntax
+```
+ IF expression [THEN] sentences [: END IF]
+
+```
+or
+
+```
+ IF expression [THEN]
+ sentences
+ [ELSEIF expression [THEN] sentences]
+ [ELSEIF expression [THEN] sentences]
+ ...
+ [ELSE sentences]
+ END IF
+
+```
+###Examples
+```
+IF a < 5 THEN PRINT "A is less than five" ELSE PRINT "A is greater than five"
+```
+
+
+Sentences might be in multiple lines:
+
+```
+If a < 5 Then
+ Print "A is less than five"
+ a = a + 5
+Else
+ Print "A is greater than five"
+End If
+```
+
+
+Since **IF** is a _sentence_, it can be nested; however, remember that _every_ **IF** _must be closed with_ **END IF** when the line is splitted after **THEN** (mutiline **IF**):
+```
+If a < 5 Then
+ Print "A is less than five"
+ If a > 2 Then
+ Print "A is less than five but greater than 2"
+ End If
+Else If a < 7 Then
+ Print "A is greater or equal to five, but lower than 7"
+ Else
+ Print "A is greater than five"
+ End If
+End If
+```
+
+
+##Using ELSEIF
+In the example above, you see that nesting an **IF** inside another one could be somewhat verbose and error prone. It's better to use
+the **ELSEIF** construct. So the previous example could be rewritten as:
+
+```
+If a < 5 Then
+ Print "A is less than five"
+ If a > 2 Then
+ Print "A is less than five but greater than 2"
+ End If
+ElseIf a < 7 Then
+ Print "A is greater or equal to five, but lower than 7"
+Else
+ Print "A is greater than five"
+End If
+```
+
+
+##Remarks
+* This sentence is **extended** allowing now multiline IFs and also compatible with the Sinclair BASIC version.
+* Starting from version 1.8 onwards the trailing **END IF** is not mandatory for single-line IFs, for compatibility with Sinclair BASIC
+* The **THEN** keyword can be omitted, but keep in mind this might reduce code legibility.
+
+##See Also
+* [WHILE ... END WHILE](while.md)
+* [DO ... LOOP](do.md)
+* [FOR ... NEXT](for.md)
+
diff --git a/docs/img/driver-down.png b/docs/img/driver-down.png
new file mode 100644
index 000000000..47d3b4dd5
Binary files /dev/null and b/docs/img/driver-down.png differ
diff --git a/docs/img/games/3reyesmagos.gif b/docs/img/games/3reyesmagos.gif
new file mode 100644
index 000000000..d99a10517
Binary files /dev/null and b/docs/img/games/3reyesmagos.gif differ
diff --git a/docs/img/games/abydos.png b/docs/img/games/abydos.png
new file mode 100644
index 000000000..55336909c
Binary files /dev/null and b/docs/img/games/abydos.png differ
diff --git a/docs/img/games/bacaball.png b/docs/img/games/bacaball.png
new file mode 100644
index 000000000..8d582902c
Binary files /dev/null and b/docs/img/games/bacaball.png differ
diff --git a/docs/img/games/bacachase.png b/docs/img/games/bacachase.png
new file mode 100644
index 000000000..42244d3eb
Binary files /dev/null and b/docs/img/games/bacachase.png differ
diff --git a/docs/img/games/berksman.gif b/docs/img/games/berksman.gif
new file mode 100644
index 000000000..3ccf38138
Binary files /dev/null and b/docs/img/games/berksman.gif differ
diff --git a/docs/img/games/bifrost.png b/docs/img/games/bifrost.png
new file mode 100644
index 000000000..40b15d825
Binary files /dev/null and b/docs/img/games/bifrost.png differ
diff --git a/docs/img/games/bifrost2.png b/docs/img/games/bifrost2.png
new file mode 100644
index 000000000..0121becb5
Binary files /dev/null and b/docs/img/games/bifrost2.png differ
diff --git a/docs/img/games/bounty.gif b/docs/img/games/bounty.gif
new file mode 100644
index 000000000..2df035139
Binary files /dev/null and b/docs/img/games/bounty.gif differ
diff --git a/docs/img/games/brokenfriend.gif b/docs/img/games/brokenfriend.gif
new file mode 100644
index 000000000..e5e02c42c
Binary files /dev/null and b/docs/img/games/brokenfriend.gif differ
diff --git a/docs/img/games/cabezooon.png b/docs/img/games/cabezooon.png
new file mode 100644
index 000000000..7cd2dc3ec
Binary files /dev/null and b/docs/img/games/cabezooon.png differ
diff --git a/docs/img/games/chessboardattack.gif b/docs/img/games/chessboardattack.gif
new file mode 100644
index 000000000..4c014a5e7
Binary files /dev/null and b/docs/img/games/chessboardattack.gif differ
diff --git a/docs/img/games/ciclopesysaturno.png b/docs/img/games/ciclopesysaturno.png
new file mode 100644
index 000000000..1df2fbf9c
Binary files /dev/null and b/docs/img/games/ciclopesysaturno.png differ
diff --git a/docs/img/games/coches.png b/docs/img/games/coches.png
new file mode 100644
index 000000000..f4e031d79
Binary files /dev/null and b/docs/img/games/coches.png differ
diff --git a/docs/img/games/dex.gif b/docs/img/games/dex.gif
new file mode 100644
index 000000000..d1e62c3cc
Binary files /dev/null and b/docs/img/games/dex.gif differ
diff --git a/docs/img/games/earthraidingame.gif b/docs/img/games/earthraidingame.gif
new file mode 100644
index 000000000..9bd7f4907
Binary files /dev/null and b/docs/img/games/earthraidingame.gif differ
diff --git a/docs/img/games/eleuterioelmonoserio.gif b/docs/img/games/eleuterioelmonoserio.gif
new file mode 100644
index 000000000..0e9e27c70
Binary files /dev/null and b/docs/img/games/eleuterioelmonoserio.gif differ
diff --git a/docs/img/games/emschristmascarddemo.png b/docs/img/games/emschristmascarddemo.png
new file mode 100644
index 000000000..0e647ab2e
Binary files /dev/null and b/docs/img/games/emschristmascarddemo.png differ
diff --git a/docs/img/games/encuerer.gif b/docs/img/games/encuerer.gif
new file mode 100644
index 000000000..4f1f51a9f
Binary files /dev/null and b/docs/img/games/encuerer.gif differ
diff --git a/docs/img/games/fourspriter.png b/docs/img/games/fourspriter.png
new file mode 100644
index 000000000..261a7c5a4
Binary files /dev/null and b/docs/img/games/fourspriter.png differ
diff --git a/docs/img/games/hobbitel.gif b/docs/img/games/hobbitel.gif
new file mode 100644
index 000000000..a1a7fbb6f
Binary files /dev/null and b/docs/img/games/hobbitel.gif differ
diff --git a/docs/img/games/hobbitel_2.gif b/docs/img/games/hobbitel_2.gif
new file mode 100644
index 000000000..7fd2caafa
Binary files /dev/null and b/docs/img/games/hobbitel_2.gif differ
diff --git a/docs/img/games/hunt_the_wumpus.png b/docs/img/games/hunt_the_wumpus.png
new file mode 100644
index 000000000..d2fb40cf5
Binary files /dev/null and b/docs/img/games/hunt_the_wumpus.png differ
diff --git a/docs/img/games/jrpgtest.png b/docs/img/games/jrpgtest.png
new file mode 100644
index 000000000..c7f9b6dd7
Binary files /dev/null and b/docs/img/games/jrpgtest.png differ
diff --git a/docs/img/games/justsomethingsilly.png b/docs/img/games/justsomethingsilly.png
new file mode 100644
index 000000000..c533cd4d7
Binary files /dev/null and b/docs/img/games/justsomethingsilly.png differ
diff --git a/docs/img/games/knightsdemonsdx.png b/docs/img/games/knightsdemonsdx.png
new file mode 100644
index 000000000..692d00c4e
Binary files /dev/null and b/docs/img/games/knightsdemonsdx.png differ
diff --git a/docs/img/games/lamega.png b/docs/img/games/lamega.png
new file mode 100644
index 000000000..ed4c6e4fe
Binary files /dev/null and b/docs/img/games/lamega.png differ
diff --git a/docs/img/games/lookingforacsscgc2012theme.png b/docs/img/games/lookingforacsscgc2012theme.png
new file mode 100644
index 000000000..04b624115
Binary files /dev/null and b/docs/img/games/lookingforacsscgc2012theme.png differ
diff --git a/docs/img/games/memorama.png b/docs/img/games/memorama.png
new file mode 100644
index 000000000..2b1208a42
Binary files /dev/null and b/docs/img/games/memorama.png differ
diff --git a/docs/img/games/multiioboard.png b/docs/img/games/multiioboard.png
new file mode 100644
index 000000000..f20bac214
Binary files /dev/null and b/docs/img/games/multiioboard.png differ
diff --git a/docs/img/games/nirvana.png b/docs/img/games/nirvana.png
new file mode 100644
index 000000000..2cc4b0c90
Binary files /dev/null and b/docs/img/games/nirvana.png differ
diff --git a/docs/img/games/nirvanaplus.png b/docs/img/games/nirvanaplus.png
new file mode 100644
index 000000000..7885280f2
Binary files /dev/null and b/docs/img/games/nirvanaplus.png differ
diff --git a/docs/img/games/nothingthing_fbzx_ulaplus_b.png b/docs/img/games/nothingthing_fbzx_ulaplus_b.png
new file mode 100644
index 000000000..c6af9a3cc
Binary files /dev/null and b/docs/img/games/nothingthing_fbzx_ulaplus_b.png differ
diff --git a/docs/img/games/o-cman.gif b/docs/img/games/o-cman.gif
new file mode 100644
index 000000000..5acae2b64
Binary files /dev/null and b/docs/img/games/o-cman.gif differ
diff --git a/docs/img/games/o-trix.gif b/docs/img/games/o-trix.gif
new file mode 100644
index 000000000..2d77a2e20
Binary files /dev/null and b/docs/img/games/o-trix.gif differ
diff --git a/docs/img/games/p3efilebrowser.png b/docs/img/games/p3efilebrowser.png
new file mode 100644
index 000000000..d3e143855
Binary files /dev/null and b/docs/img/games/p3efilebrowser.png differ
diff --git a/docs/img/games/pvaprologue.png b/docs/img/games/pvaprologue.png
new file mode 100644
index 000000000..96536bf99
Binary files /dev/null and b/docs/img/games/pvaprologue.png differ
diff --git a/docs/img/games/questforwitchcraft.gif b/docs/img/games/questforwitchcraft.gif
new file mode 100644
index 000000000..b6a7e1710
Binary files /dev/null and b/docs/img/games/questforwitchcraft.gif differ
diff --git a/docs/img/games/ratulzeki.gif b/docs/img/games/ratulzeki.gif
new file mode 100644
index 000000000..f52135553
Binary files /dev/null and b/docs/img/games/ratulzeki.gif differ
diff --git a/docs/img/games/retrobsesion.gif b/docs/img/games/retrobsesion.gif
new file mode 100644
index 000000000..daae81ea3
Binary files /dev/null and b/docs/img/games/retrobsesion.gif differ
diff --git a/docs/img/games/retrobsesionii.gif b/docs/img/games/retrobsesionii.gif
new file mode 100644
index 000000000..2b6050756
Binary files /dev/null and b/docs/img/games/retrobsesionii.gif differ
diff --git a/docs/img/games/saltarin.gif b/docs/img/games/saltarin.gif
new file mode 100644
index 000000000..dc3ead700
Binary files /dev/null and b/docs/img/games/saltarin.gif differ
diff --git a/docs/img/games/solitario.png b/docs/img/games/solitario.png
new file mode 100644
index 000000000..c64cdfb13
Binary files /dev/null and b/docs/img/games/solitario.png differ
diff --git a/docs/img/games/souls.gif b/docs/img/games/souls.gif
new file mode 100644
index 000000000..76f1f0a52
Binary files /dev/null and b/docs/img/games/souls.gif differ
diff --git a/docs/img/games/speccywars.png b/docs/img/games/speccywars.png
new file mode 100644
index 000000000..0dbb76419
Binary files /dev/null and b/docs/img/games/speccywars.png differ
diff --git a/docs/img/games/spectraldungeonsthe.gif b/docs/img/games/spectraldungeonsthe.gif
new file mode 100644
index 000000000..0b4a517c1
Binary files /dev/null and b/docs/img/games/spectraldungeonsthe.gif differ
diff --git a/docs/img/games/splash.gif b/docs/img/games/splash.gif
new file mode 100644
index 000000000..3bb3e836d
Binary files /dev/null and b/docs/img/games/splash.gif differ
diff --git a/docs/img/games/stela.gif b/docs/img/games/stela.gif
new file mode 100644
index 000000000..bdfb51a19
Binary files /dev/null and b/docs/img/games/stela.gif differ
diff --git a/docs/img/games/talesofgruppthe.png b/docs/img/games/talesofgruppthe.png
new file mode 100644
index 000000000..28c6cd94f
Binary files /dev/null and b/docs/img/games/talesofgruppthe.png differ
diff --git a/docs/img/games/thespectrumclient.png b/docs/img/games/thespectrumclient.png
new file mode 100644
index 000000000..6fec7cac4
Binary files /dev/null and b/docs/img/games/thespectrumclient.png differ
diff --git a/docs/img/games/uboothuntingame.gif b/docs/img/games/uboothuntingame.gif
new file mode 100644
index 000000000..c67e00193
Binary files /dev/null and b/docs/img/games/uboothuntingame.gif differ
diff --git a/docs/img/games/uchidanza.png b/docs/img/games/uchidanza.png
new file mode 100644
index 000000000..7842de5d5
Binary files /dev/null and b/docs/img/games/uchidanza.png differ
diff --git a/docs/img/games/vaderetro.gif b/docs/img/games/vaderetro.gif
new file mode 100644
index 000000000..d1a3f6395
Binary files /dev/null and b/docs/img/games/vaderetro.gif differ
diff --git a/docs/img/games/vampe-gotovampe.gif b/docs/img/games/vampe-gotovampe.gif
new file mode 100644
index 000000000..63b9d2b44
Binary files /dev/null and b/docs/img/games/vampe-gotovampe.gif differ
diff --git a/docs/img/games/walkingaroundporto.png b/docs/img/games/walkingaroundporto.png
new file mode 100644
index 000000000..7d487176c
Binary files /dev/null and b/docs/img/games/walkingaroundporto.png differ
diff --git a/docs/img/games/yithm.gif b/docs/img/games/yithm.gif
new file mode 100644
index 000000000..a165b3281
Binary files /dev/null and b/docs/img/games/yithm.gif differ
diff --git a/docs/img/games/zxdestroyer.png b/docs/img/games/zxdestroyer.png
new file mode 100644
index 000000000..6e052e1c9
Binary files /dev/null and b/docs/img/games/zxdestroyer.png differ
diff --git a/docs/img/games/zxstriker.png b/docs/img/games/zxstriker.png
new file mode 100644
index 000000000..5e2c05000
Binary files /dev/null and b/docs/img/games/zxstriker.png differ
diff --git a/docs/img/zip-package-2.png b/docs/img/zip-package-2.png
new file mode 100644
index 000000000..f08b7a45d
Binary files /dev/null and b/docs/img/zip-package-2.png differ
diff --git a/docs/img/zip-package.png b/docs/img/zip-package.png
new file mode 100644
index 000000000..abf547bc9
Binary files /dev/null and b/docs/img/zip-package.png differ
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 000000000..28d41f74b
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,69 @@
+#General
+* [About](about.md)
+
About the ZX BASIC SDK
+
+* [ChangeLog](https://github.com/boriel/zxbasic/blob/master/Changelog.md)
+
A reduced list of changes/bugfixes
+
+* [Installation](installation.md)
+
How to install the ZX Basic SDK in your system, and prerequisites for doing so.
+
+* [SDK tools](tools.md)
+
Tools available in the SDK.
+
+* [Command line options](zxb.md#Command_Line_Options)
+
Command line options table for the compiler (zxb)
+
+# Products
+
+* [Released programs](released_programs.md)
+
A list of third-party released programs (mostly games) for the ZX-Spectrum developed with ZX BASIC.
+
+# Download
+
+Get the latest version of ZX BASIC from the [archive](archive.md).
+
+# Tutorials
+
+* [Programming tutorials](tutorials.md)
+
A collection of third-party tutorials about development with ZX BASIC.
+
+* [Sample Programs](sample_programs.md)
+
Sample programs you can try to see what ZX BASIC looks like and how fast it runs.
+
+* [Sample Games](sample_programs.md#Game Examples)
+
Some little games examples.
+
+#Help and Support
+
+* [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
+
+* 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)
+
Library of functions and subroutines you can use in your programs. You might find them really useful.
+
+# Inline assembler
+Embedding inline assembler in your code is pretty easy. There's a [tutorial](tutorials.md) on it.
+
+# Compiler internals
+Only for true hackers: This explains how the compiler does it job, how to expand it, etc. You must be a bit crazy if you enter here...
+
+# Other Architectures
+ZX Basic was designed from the base as a Retargeable Compiler, so it should be not hard to extend
+it to other architectures. This is `work in progress`. See [other architectures](other_architectures.md) for more info.
diff --git a/docs/ink.md b/docs/ink.md
new file mode 100644
index 000000000..8553ca816
--- /dev/null
+++ b/docs/ink.md
@@ -0,0 +1,49 @@
+#INK
+
+##Syntax
+```
+INK
+```
+or
+```
+PRINT INK ;
+```
+This can be used to change the permanent print settings, or the temporary ones. When used as a direct command:
+
+
+```
+INK n
+```
+being n a number from 0-8, then the subsequent print statements will have a foreground colour based on the number used. As the ZX Spectrum manual states:
+```
+ 0 - black
+ 1 - blue
+ 2 - red
+ 3 - purple, technically called magenta
+ 4 - green
+ 5 - pale blue, technically called cyan
+ 6 - yellow
+ 7 - white
+ 8 - transparent (Do not change the paper value in the square being printed)
+ 9 - Contrast - currently NOT supported.
+```
+Just as in Sinclair basic, this command can be used as temporary colours by combining them with a print statement:
+
+
+```
+Print ink 2; "This is red text"
+```
+
+This format does not change the permanent colour settings and only affects the characters printed within that print statement.
+
+##Remarks
+* This function is Near Sinclair BASIC compatible.
+
+##See also
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [BORDER](border.md)
+* [BOLD](bold.md)
+* [INVERSE](inverse.md)
+* [ITALIC](italic.md)
+* [OVER](over.md)
diff --git a/docs/inkey.md b/docs/inkey.md
new file mode 100644
index 000000000..8f3765f73
--- /dev/null
+++ b/docs/inkey.md
@@ -0,0 +1,28 @@
+#INKEY / INKEY$
+
+The `INKEY` function is used to return a value of a keypress at the moment the function is accessed.
+Inkey does not wait for user input. It returns a single character string containing the key pressed.
+Use of Shift or Caps-Lock makes the character upper case. In some cases, a non-printable string may be returned;
+for example if cursor keys are pressed at the time the function is run.
+
+If no key is pressed, it returns a null string (`""`).
+
+For compatibility with Sinclair Basic, `INKEY$` is also a valid synonym.
+
+
+```
+WHILE INKEY <> CHR(13) : REM CHR(13) is the code for the ENTER key
+ PRINT INKEY; : REM PRINTS A KEYPRESS
+
+ WHILE INKEY<>""
+ REM WAIT Until the key isn't pressed any more.
+ END WHILE
+
+END WHILE
+```
+
+
+The above code will echo keys pressed to the screen. Note that the loop has to be held up to wait until the key is no longer pressed, in order to prevent the same character being reprinted many times.
+
+##Remarks
+* This sentence is 100% Sinclair BASIC Compatible
diff --git a/docs/input.md b/docs/input.md
new file mode 100644
index 000000000..47ece8f3c
--- /dev/null
+++ b/docs/input.md
@@ -0,0 +1,26 @@
+#INPUT
+
+Issues a cursor to the screen, waits for the user to type and returns the user's input when the user presses ENTER.
+
+##Syntax
+```
+variable = INPUT(max_length)
+```
+Max_length is the number of characters the INPUT function will accept as a maximum.
+
+##Requirements
+
+INPUT is a library function that must be included before it can be used. Use the following directive:
+
+```
+#include
+```
+
+##Remarks
+* This function is similar, but not equivalent to the INPUT statement available in Sinclair BASIC.
+* Note that this function ALWAYS RETURNS A STRING, which is very different from Sinclair BASIC's INPUT statement.
+* This function places the Input cursor at the last print position, not at the bottom of the screen. Remember that ZX Basic allows access to all 24 screen lines, so PRINT AT 24,0; sets the PRINT cursor to the bottom of the screen.
+
+##See also
+
+* [ INKEY ](inkey_.md)
diff --git a/docs/installation.md b/docs/installation.md
new file mode 100644
index 000000000..95565fd52
--- /dev/null
+++ b/docs/installation.md
@@ -0,0 +1,40 @@
+#Installation
+
+##Installation of ZX Basic SDK
+ZX Basic SDK comes in two flavours:
+
+* Multiplatform (Linux / Windows / Mac) python scripts. This is the main distribution and recommended for everyone.
+* Windows .MSI Installer.
+
+The latest is only for Windows users who are not able or very lazy to use python scripts directly. This .MSI distribution is not updated as often as the Multiplatform one, but has the advantage of not requiring to have the python interpreter previously installed.
+
+###Prerequisites
+For the _Multi-platform_ bundle, you will need the [python](http://www.python.org) interpreter **version 3.5** or
+higher installed on your system (Linux and Mac OS X users will probably have it already installed since
+it is very common on those operating systems).
+For Windows users, there's also a python interpreter from [ActiveState](http://www.activestate.com),
+the [ActivePython](http://www.activestate.com/store/download.aspx?prdGUID=b08b04e0-6872-4d9d-a722-7a0c2dea2758)
+interpreter, 100% python compatible (Windows users who choose the .ZIP package distribution does not need to install
+any python interpreter).
+
+###Downloading
+To get the latest version of the ZX BASIC SDK, go to the [Download Page](http://www.boriel.com/files/zxb/),
+and get the `tar.gz` or `.ZIP` file you want. The .ZIP files are _Multiplatform_ (Linux / Windows / Mac), except those
+with the `win32` suffix, which are for Windows only.
+
+###Installing
+Installing the .MSI distribution is pretty straightforward:
+They **do not require any installation**. Just uncompress the SDK tree in a directory of your choice and make sure
+that folder is included in your PATH environment variable.
+
+
+##Testing your installation
+For the .ZIP distribution, type **zxb.py** (in windows you can type **zxb**).
+You should see something like:
+```
+ >zxb.py
+ Usage: zxb.py [options]
+
+ zxb.py: error: missing input file. (Try -h)
+```
+Ok, the compiler is working (or it seems so). Now you should proceed to the following section to learn about its usage.
diff --git a/docs/inverse.md b/docs/inverse.md
new file mode 100644
index 000000000..3a79ed147
--- /dev/null
+++ b/docs/inverse.md
@@ -0,0 +1,45 @@
+#INVERSE
+
+##Syntax
+```
+INVERSE
+```
+
+or
+
+```
+PRINT INVERSE ;
+```
+This can be used to change the permanent print settings, or the temporary ones. When used as a direct command:
+
+
+```
+INVERSE n
+```
+
+where n is either 0 (false) or 1 (true), then the subsequent print statements will have their
+INK and PAPER values swapped from the current settings for INK and PAPER.
+
+Just as in Sinclair basic, this command can be used as temporary colours by combining them with a print statement:
+
+```
+Print INK 0;PAPER 7; INVERSE 1; "This WHITE text on BLACK background"
+```
+
+Note that the INK and PAPER are swapped because of the INVERSE 1
+This format does not change the permanent colour settings and only
+affects the characters printed within that print statement.
+
+##Remarks
+* This function is 100% Sinclair BASIC compatible.
+
+##See also
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [BORDER](border.md)
+* [BOLD](bold.md)
+* [INK](ink.md)
+* [ITALIC](italic.md)
+* [OVER](over.md)
+* [BRIGHT](bright.md)
+* [FLASH](flash.md)
diff --git a/docs/italic.md b/docs/italic.md
new file mode 100644
index 000000000..f7f02ddca
--- /dev/null
+++ b/docs/italic.md
@@ -0,0 +1,43 @@
+#ITALIC
+
+##Syntax
+```
+ITALIC
+```
+
+or
+
+```
+PRINT ITALIC ;
+```
+
+This can be used to change the permanent print settings, or the temporary ones.
+When used as a direct command:
+
+```
+ITALIC n
+```
+
+where n is either 0 (false) or 1 (true), then the subsequent print statements will have their `INK`
+pixels slewed left at the top, and right at the bottom, making text appear italicized.
+
+This command can be used as temporary colours by combining them with a print statement:
+
+```
+Print INK 0;PAPER 7; ITALIC 1; "This is ITALIC BLACK text on WHITE"
+```
+
+This version does not change the permanent colour settings and only affects
+the characters printed within that print statement.
+
+##Remarks
+* This statement is NOT Sinclair BASIC compatible.
+
+##See also
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [BORDER](border.md)
+* [INVERSE](inverse.md)
+* [INK](ink.md)
+* [BOLD](bold.md)
+* [OVER](over.md)
diff --git a/docs/labels.md b/docs/labels.md
new file mode 100644
index 000000000..738295be9
--- /dev/null
+++ b/docs/labels.md
@@ -0,0 +1,53 @@
+#Labels
+
+Labels are [identifiers](identifier.md) where the program execution flow can _jump_ into using either [GO TO](goto.md) or [GO SUB](gosub.md).
+Unlike [variables](variable.md) identifiers, their [scope](scope.md) is **always global** (even if declared inside
+functions or subroutines). Usage of labels is discouraged.
+
+In ZX BASIC, line numbers are treated as labels:
+
+```
+10 REM An endless print loop
+20 PRINT "Hello world!"
+30 GO TO 20
+```
+
+Since line numbers are _just labels_, the order sequence is irrelevant.
+The following listing is equivalent to the above one. Notice the
+out-of-order line sequence:
+
+```
+10 REM An endless print loop
+30 PRINT "Hello world!"
+20 GO TO 30
+```
+
+
+###Declaring labels
+
+Identifiers can be used as labels.
+A label identifier is declared by writing it at the beginning of a line, followed by a colon:
+
+```
+REM Declaring a label
+mylabel:
+```
+
+You can _use_ the label with [GO TO](goto.md) and [GO SUB](gosub.md) sentences,
+and with the [@ operator](addroperator.md): the previous example can be rewritten using labels instead of line numbers:
+
+```
+endlessloop:
+ PRINT "Hello world!"
+ GO TO endlessloop
+```
+
+A label can also be referred before it has been declared:
+
+```
+ GO TO EndOfRoutine
+ REM Instructions here are skipped
+
+EndOfRoutine:
+ PRINT "End Of Routine"
+```
diff --git a/docs/lbound.md b/docs/lbound.md
new file mode 100644
index 000000000..7e0fa4313
--- /dev/null
+++ b/docs/lbound.md
@@ -0,0 +1,43 @@
+#LBOUND
+
+##Syntax
+
+```
+LBound()
+LBound(, )
+```
+
+
+##Description
+
+Returns the array lower bound of the given . If the is not specified, it defaults to 1.
+If the specified is 0, then total number of dimensions is returned.
+
+##Examples
+
+```
+DIM a(3 TO 5, 2 TO 8)
+PRINT LBound(a, 2) : REM Prints 2
+PRINT Lbound(a) : REM Prints 3, because dimension defaults to 1
+```
+
+
+The result is always a 16bit integer value.
+
+If the is 0, then the number of dimension in the array is returned
+(useful to guess the number of dimensions of an array):
+
+```
+DIM a(3 TO 5, 2 TO 8)
+PRINT LBound(a, 0): REM Prints 2, since 'a' has 2 dimensions
+```
+
+
+##Remarks
+
+* This function does not exists in Sinclair BASIC.
+
+##See also
+
+* [DIM](dim.md)
+* [UBOUND](ubound.md)
diff --git a/docs/let.md b/docs/let.md
new file mode 100644
index 000000000..5a0a83dd8
--- /dev/null
+++ b/docs/let.md
@@ -0,0 +1,13 @@
+#LET
+
+Let sentence is used to assign a value to a variable or array element. It can be omitted. E.g.:
+```
+LET a = 5
+```
+which can be also written as:
+```
+a = 5
+```
+
+##Remarks
+* This sentence is 100% Sinclair BASIC Compatible
diff --git a/docs/library.md b/docs/library.md
new file mode 100644
index 000000000..34626c77b
--- /dev/null
+++ b/docs/library.md
@@ -0,0 +1,124 @@
+#Library
+
+##Library of Routines and Functions
+
+This is a list of additions to the language that have been produced. They extend the functionality of the compiler by
+effectively adding reserved words to the language. At their heart, they are all SUB or FUNCTION sets.
+
+###How to Include a Library Function
+You can either copy and paste the `SUB` or `FUNCTION` into your code, or, perhaps more easily,
+save the text as the recommended name (e.g. fSqrt.bas) and use `#include "fSqrt.bas"` at the start of the program.
+Note that the file has to be in the same folder or directory as the original in order for the compiler to find it.
+If the code is included in the ZX Basic standard library, this is mentioned in the description.
+It's then possible to add the code simply with a `#include` directive.
+
+####Maths Library
+* [distance.bas](library/distance.bas.md)
+
Fast distance calculation - SQR(x2 + y2) - using taylor series expansion.
+Accuracy tends to drop as x and y get large, but is about 5 times faster even than using iSqrt
+(and about 750 times faster than using the ROM sqr function).
+
+* [Faster Trigonometric Functions - fSin, fCos, fTan](library/fsin.bas.md)
+
Sin giving you a headache? At the cost of a few bytes, here are faster and less accurate versions for quick and
+dirty games calculations.
+
+* [fSqrt.bas](library/fsqrt.bas.md)
+
SQR too slow? Here's a faster (and completely accurate - at least as accurate as Sinclair Basic) replacement for
+the internal SQR function.
+
+* [iSqrt.bas](library/isqrt.bas.md)
+
[fSqrt.bas](library/fsqrt.bas.md) still too slow? Don't need _quite_ so accurate an answer? Try Integer Square roots!
+
+* [randomStream.bas](library/randomstream.bas.md)
+
A random stream generator. Fast and efficient. ZX Basic does use this generator, but it's locked to float output.
+Here are some alternative functions using faster integer and fixed output.
+
+####Graphics Library
+* [attrAddress.bas](library/attraddress.md)
+
Function to get the attribute address for a given X-Y character co-ordinate.
+
+* [clearBox.bas](library/clearbox.md)
+
Sub to clear a subset of the screen - a window defined with a character box.
+
+* [crslin.bas](csrlin.md)
+
Function to get the current cursor vertical co-ordinate.
+
+* [fastPlot.bas](library/fastplot.md)
+
Routine to plot a pixel on screen (without attributes - speed optimized)
+
+* [HRPrint.bas](library/hrprint.bas.md)
+
High Resolution Print
Subroutine to print characters at any pixel level position on the screen,
+instead of just character positions. (Rather slow for sprites, but fine if speed isn't needed)
+
+* [HRPrintFast.bas](library/hrprintfast.bas.md)
+
High Resolution Print
Subroutine to print characters at any pixel level position on the screen,
+instead of just character positions. (20% faster per character, but much larger version using lookup tables)
+
+* [hMirror.bas](library/hmirror.bas.md)
+
Function to mirror the bits in a byte - the basis of printing, say a left facing sprite,
+if all you have are right facing graphics stored.
+
+* [pos.bas](pos.md)
+
Function to get the current cursor horizontal co-ordinate.
+
+* [windowPaint.bas](library/windowpaint.md)
+
Set attributes in a rectangle without changing the bitmap.
+
+* [putchars.bas](library/putchars.bas.md)
+
Subroutines to put graphics data to the screen in a block. Also contains routines for attribute painting as a
+block. Passable for character based sprites.
+
+* [scrAddress.bas](library/scraddress.md)
+
Function to get the top screen address for a given X-Y character co-ordinate.
+
+* [putTile.bas](library/puttile.md)
+
Subroutine to paint a 2X2 character tile to the screen from a given data address, with attributes.
+Uses PUSH/POP to the screen memory for speed.
+
+* [pixelScroll.bas](library/pixelscroll.md)
+
Subroutines to scroll the screen by a specified number of pixel rows. (No attribute scroll)
+
+* [windowScrollUP.bas](library/windowscrollup.md)
+
Subroutine to character scroll a window of screen - good for that sidebar of information.
+Keep status updates scrolling in and sliding up without affecting the game window.
+
+* [windowAttrScrollUP.bas](library/windowattrscrollup.md)
+
Subroutine to character scroll the attributes of a window of screen - really a handy addendum utility
+for [windowScrollUP.bas](library/windowscrollup.md)
+
+####Text Handling Library
+
+* [asc.bas](library/asc.bas.md)
+
Ascii Code of a character in a string. Compatible with FreeBasic
+
+* [doubleSizePrint.bas](library/doublesizeprint.bas.md)
+
Prints to the screen with Double Size Characters
+
+* [HRPrint.bas](library/hrprint.bas.md)
+
High Resolution Print
Subroutine to print characters at any pixel level position on the screen,
+instead of just character positions. (Rather slow for sprites, but fine if speed isn't needed)
+
+* [propPrint.bas](library/propprint.bas.md)
+
Need characters to look more professional? LCD has weighed in with a Proportional Printing routine -
+and one that lets you set text position with Pixel accuracy!
+
+* [print42.bas](library/print42.bas.md)
+
Need more screen space? You could try the 42 Character Printing routine. Text still lines up in columns,
+and attributes are allowed (with limitations).
+
+* [print64.bas](library/print64.bas.md)
+
Need even MORE screen space? Here's a 64 characters per line Subroutine. Works in a very similar way to print42,
+with printat64 and print64 subs.
+
+* [Print64x32.bas](library/print64x32.bas.md)
+
What, just 64 chars to a line not enough? This is 64X32 Character printing.
+Will print 64 characters to a line (grid, not proportional), and 32 lines of text to a screen.
+Upping the standard 768 character screen to 2048 characters of text on one screen at once.
+Works in a similar way to print42. This version uses screen tables.
+
+####Compression / Decompression Library
+
+* [megaLZDepack.bas](library/megalz.bas.md)
+
Routine wrapping the megaLZ decompression algorithm.
+
+
diff --git a/docs/library/asc.bas.md b/docs/library/asc.bas.md
new file mode 100644
index 000000000..44f78fa3f
--- /dev/null
+++ b/docs/library/asc.bas.md
@@ -0,0 +1,32 @@
+#Asc.bas
+
+#ASC
+
+Converts a specified character of a given string into the ASCII code equivalent.
+
+##Syntax
+```
+variable = asc(A$,n)
+```
+Where `A$` is a string variable and `N` defines which character in the string we are interested in.
+
+##Requirements
+
+ASC is a library function that must be included before it can be used. Use the following directive:
+
+```
+#include
+```
+
+
+##Remarks
+
+* This function is for FreeBASIC compatibility. See [FreeBasic - ASC](http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgAsc) for details.
+* The return on this function is generally identical to that of `CODE(A$(n))`, though it will return 0, not an error,
+if invoked to return the ascii code of a character beyond the length of the string.
+
+##See also
+
+* [ CODE ](code.md)
+
+
diff --git a/docs/library/attraddress.md b/docs/library/attraddress.md
new file mode 100644
index 000000000..843d70c91
--- /dev/null
+++ b/docs/library/attraddress.md
@@ -0,0 +1,43 @@
+#AttrAddress
+
+#attrAdress(x,y)
+
+This function will return the address of the byte that controls
+the attributes of a given X-Y print position co-ordinate.
+
+
+```
+FUNCTION attrAddress (x as uByte, y as uByte) as uInteger
+'This function returns the memory address of the Character Position
+'x,y in the attribute screen memory.
+'Adapted from code by Jonathan Cauldwell.
+'Rebuilt for ZX BASIC by Britlion from NA_TH_AN's fourspriter, with permission.
+
+Asm
+ ld a,(IX+7) ;ypos
+ rrca
+ rrca
+ rrca ; Multiply by 32
+ ld l,a ; Pass to L
+ and 3 ; Mask with 00000011
+ add a,88 ; 88 * 256 = 22528 - start of attributes.
+ ld h,a ; Put it in the High Byte
+ ld a,l ; We get y value *32
+ and 224 ; Mask with 11100000
+ ld l,a ; Put it in L
+ ld a,(IX+5) ; xpos
+ add a,l ; Add it to the Low byte
+ ld l,a ; Put it back in L, and we're done. HL=Address.
+
+End Asm
+END FUNCTION
+```
+
+## Usage
+
+Example:
+```
+poke attrAddress(10,10),43
+```
+
+Will change the attributes of print position 10, 10 to 43 - (magenta ink on cyan paper)
diff --git a/docs/library/clearbox.md b/docs/library/clearbox.md
new file mode 100644
index 000000000..f122f2133
--- /dev/null
+++ b/docs/library/clearbox.md
@@ -0,0 +1,88 @@
+#ClearBox
+
+This routine will blank a portion of the screen from character square X, Y of Width and Height defined.
+
+Good for clearing out the portion of the screen you need cleared - e.g. just the game window.
+
+```
+SUB clearBox(x as uByte, y as uByte, width as uByte, height as uByte)
+' This subroutine will blank the pixels for a box, measured in Character Squares
+' from print positions X,Y to X + Width, Y + height.
+'
+' Expected to be useful for clearing a window of space - perhaps in a game.
+' because of this THE ERROR CHECKING IS NONEXISTENT.
+' Please make sure you send sensible data -
+' 0 < x < 32, 0 < y < 23, x + width < 32 and y + height < 23
+' Britlion 2012.
+
+ASM
+ ld b,(IX+5) ;' get x value
+ ld c,(IX+7) ;' get y value
+
+ ld a, c ;' Set HL to screen byte for this character.
+ and 24
+ or 64
+ ld h, a
+ ld a, c
+ and 7
+ rra
+ rra
+ rra
+ rra
+ add a, b
+ ld l, a
+
+ ld b, (IX+11) ;' get height
+ ld c,(IX+9) ;' get width
+
+clearbox_outer_loop:
+ xor a
+ push bc ;' save height.
+ push hl ;' save screen address.
+ ld d, 8 ;' 8 rows to a character.
+
+clearbox_mid_loop:
+ ld e,l ;' save screen byte lower half.
+ ld b,c ;' get width.
+
+clearbox_inner_loop:
+ ld (hl), a ;' write out a zero to the screen.
+
+ inc l ;' go right.
+ djnz clearbox_inner_loop ;' repeat.
+
+ ld l,e ;' recover screen byte
+ inc h ;' down a row
+
+ dec d
+ jp nz, clearbox_mid_loop ;' repeat for this row.
+
+ pop hl ;' get back address at start of line
+ pop bc ;' get back char count.
+
+ ld a, 32 ;' Go down to next character row.
+ add a, l
+ ld l, a
+ jp nc, clearbox_row_skip
+
+ ld a, 8
+ add a, h
+ ld h, a
+
+clearbox_row_skip:
+ djnz clearbox_outer_loop
+END ASM
+END SUB
+```
+
+Example:
+
+```
+cls
+
+for n=1 to 300
+print n;
+next n
+
+clearBox(2,3,18,11)
+```
diff --git a/docs/library/distance.bas.md b/docs/library/distance.bas.md
new file mode 100644
index 000000000..0cfd593f8
--- /dev/null
+++ b/docs/library/distance.bas.md
@@ -0,0 +1,71 @@
+#Distance.bas
+
+This calculates an approximation for the distance formula **r=`SQR`(x2 + y2)**,
+based on two parameters, `x` and `y`. The return value is not guaranteed to be accurate -
+and indeed can be as high as 10% inaccurate as x and y approach 255 (the upper limit for input).
+The return value is an integer - chosen because screen is 256 pixels wide, and the diagonal across the screen
+is bigger than 1 byte can hold.
+
+If you need accurate results, you should go with `iSqrt` or `fSqrt` from this library.
+
+For speed, this can't be beaten, however.
+
+Comparing -
+`answer = distance(i, j)` against
+`answer = iSqrt(i * i + j * j)` shows over a range of `i` and `j` `1..250`:
+
+ * distance 8.98 seconds
+ iSqrt 50.1 seconds
+
+Distance is definitely faster, if you're willing to accept the greater inaccuracy (you probably are).
+
+By the by - standard floating point square root:
+
+ * `fSqrt` function: 44 minutes (2625.14 seconds)
+ * `SQR` (ROM) - 122 minutes. (7336.86 seconds)
+
+Shows how awful that ROM SQR routine really is...
+
+Formula is: in a right angle triangle with sides A and B, and hypotenuse H, as an estimate of length of H,
+it returns (A + B) - (half the smallest of A and B) - (1/4 the smallest of A and B) + (1/16 the smallest of A and B)
+
+
+```
+FUNCTION fastcall distance (a as ubyte, b as ubyte) as uInteger
+
+REM returns a fast approximation of SQRT (a^2 + b^2) - the distance formula, generated from taylor series expansion.
+REM This version fundamentally by Alcoholics Anonymous, improving on Britlion's earlier version - which itself
+REM was suggested, with thanks, by NA_TH_AN.
+
+asm
+ POP HL ;' return address
+ ;' First parameter in A
+ POP BC ;' second parameter -> B
+ PUSH HL ;' put return back
+
+ ;' First find out which is bigger - A or B.
+ cp b
+ ld c,b
+ jr nc, distance_AisMAX
+ ld c,a
+
+distance_AisMAX:
+
+ ;' c = MIN(a,b)
+
+ srl c ;' c = MIN/2
+ sub c ;' a = A - MIN/2
+ srl c ;' c = MIN/4
+ sub c ;' a = A - MIN/2 - MIN/4
+ srl c
+ srl c ;' c = MIN/16
+ add a,c ;' a = A - MIN/2 - MIN/4 + MIN/16
+ add a,b ;' a = A + B - MIN/2 - MIN/4 + MIN/16
+
+ ld l,a
+ ld h,0 ;' hl = result
+ ret nc
+ inc h ;' catch 9th bit
+END ASM
+END FUNCTION
+```
\ No newline at end of file
diff --git a/docs/library/doublesizeprint.bas.md b/docs/library/doublesizeprint.bas.md
new file mode 100644
index 000000000..7c2e7cea5
--- /dev/null
+++ b/docs/library/doublesizeprint.bas.md
@@ -0,0 +1,181 @@
+#DoubleSizePrint.bas
+
+This routine will print out Strings at double size. It will stop if it reaches the end of the screen, however
+- so you have to deal with new rows on your own! (143 bytes long for main routine)
+
+The core subroutine is capable of printing one character on screen at specified location, in double size.
+Of course, this is the basis for the second subroutine, that takes a string and prints it all.
+
+Both routines are capable of printing from the User Definable Graphics locations.
+
+Usage:
+
+```
+REM Requires ascii code of character to print.
+doubleSizePrintChar(y, x, code("a"))
+```
+```
+REM This version calls the first one, and will print a whole string.
+doubleSizePrint(y, x, thingToPrint$)
+```
+
+Code:
+
+```
+SUB doubleSizePrintChar(y as uByte, x as uByte, thingToPrint as uByte)
+' Prints a single character double sized.
+' Takes X and Y values as character positions, like print.
+' takes an ascii code value for a character.
+' By Britlion, 2012.
+
+ASM
+LD A,(IX+5) ;' Y value
+CP 22
+JP NC, doubleSizePrintCharEnd
+
+;' A=y value
+LD E,A
+AND 24 ; calculate
+OR 64 ; screen
+LD H,A ; address
+LD A,E ; for
+AND 7 ; row
+OR a ; Y
+RRA
+RRA
+RRA
+RRA
+LD E,A
+
+LD A,(IX+7) ;' X Value
+CP 30
+JP NC, doubleSizePrintCharEnd
+
+ADD A,E ;' correct address for column value. (add it in)
+LD L,A
+EX DE,HL ;' Save it in DE
+
+LD A,(IX+9) ;'Character
+
+CP 164 ;' > UDG "U" ?
+JP NC, doubleSizePrintCharEnd
+
+CP 32 ;' < space+1?
+JP C, doubleSizePrintCharEnd
+
+CP 144 ;' >144?
+JP NC, doubleSizePrintCharUDGAddress
+
+LD L,A
+LD H,0
+
+ADD HL,HL
+ADD HL,HL
+ADD HL,HL ;' multiply by 8.
+LD BC,(23606) ;' Chars
+ADD HL,BC ;' Hl -> Character data.
+EX DE,HL ;' DE -> character data, HL-> screen address.
+JP doubleSizePrintCharRotateLoopCharStart
+
+doubleSizePrintCharUDGAddress:
+LD HL,(23675) ;'UDG address
+SUB 144
+ADD A,A ;multiply by 8.
+ADD A,A
+ADD A,A
+ADD A,L
+LD L,A
+
+JR NC, doubleSizePrintCharUDGAddressNoCarry
+INC H
+doubleSizePrintCharUDGAddressNoCarry:
+
+;' At this point HL -> Character data in UDG block.
+EX DE,HL ;' DE -> character data, HL-> screen address.
+
+doubleSizePrintCharRotateLoopCharStart:
+LD C,2 ;' 2 character rows.
+doubleSizePrintCharRotateLoopCharRowLoopOuter:
+LD b,4 ;' 4 source bytes to count through per character row.
+doubleSizePrintCharRotateLoopCharRowLoopInner:
+ PUSH BC
+
+ LD A,(DE) ;' Grab a bitmap.
+ PUSH DE
+
+ LD B,4
+ LD C,A ; Copy byte so we can put two into the big version.
+ doubleSizePrintCharRotateLoop1:
+ RRA ; one bit into carry
+ RR E ; one bit into result
+ RR C ; same bit into carry again
+ RR E ; duplicated bit into result
+ DJNZ doubleSizePrintCharRotateLoop1
+
+ LD B,4
+ doubleSizePrintCharRotateLoop2:
+ RRA
+ RR D ; Other register for other half of big 16 bit line.
+ RR C
+ RR D
+ DJNZ doubleSizePrintCharRotateLoop2
+
+ LD (HL),D ;' Output first byte
+ INC HL ;' Move right
+ LD (HL),E ;' Second half.
+ DEC HL ;' Move left
+ INC H ;' Move down
+ LD (HL),D ;' Output second row (copy of first), first byte.
+ INC HL ;' Move right
+ LD (HL),E ; Output second row, second byte
+ DEC HL ; Move left
+ INC H ; Move down.
+ POP DE
+ INC DE
+ POP BC
+
+DJNZ doubleSizePrintCharRotateLoopCharRowLoopInner
+; CALL __DECY+2 ;'Jump into the DRAW next_line_down routine, at a convenient point (accounting for the INC H above)
+; Can't seem to call to this at the moment! Here in longhand form:
+
+ld a, h
+and 7
+jr nz, doubleSizePrintCharRotateNextCharRow
+ld a, l
+add a, 32
+ld l, a
+jr c, doubleSizePrintCharRotateNextCharRow
+ld a, h
+sub 8
+ld h, a
+
+doubleSizePrintCharRotateNextCharRow:
+
+DEC C
+JR NZ, doubleSizePrintCharRotateLoopCharRowLoopOuter
+
+doubleSizePrintCharEnd:
+END ASM
+END SUB
+```
+```
+SUB doubleSizePrint(y as uByte, x as uByte, thingToPrint$ as String)
+'Uses doubleSizePrintChar subroutine to print a string.
+'By Britlion, 2012
+
+ DIM n as uByte
+ for n=0 to LEN thingToPrint - 1
+ doubleSizePrintChar(y,x,CODE thingToPrint$(n) )
+ x=x+2
+ next n
+
+END SUB
+```
+
+Example:
+
+```
+cls
+doubleSizePrintChar(0,0,145)
+doubleSizePrint(10,0,"Hello World")
+```
diff --git a/docs/library/fastplot.md b/docs/library/fastplot.md
new file mode 100644
index 000000000..7e385b409
--- /dev/null
+++ b/docs/library/fastplot.md
@@ -0,0 +1,102 @@
+#FastPlot
+
+This plots a single over0 point on the screen, at speed.
+
+It's been tested at a fill rate of over 8,500 points per second.
+
+```
+SUB fastPlot (x as uByte, y as uByte)
+ASM
+ ld d,(IX+5) ;'X
+ ld e,(IX+7) ;'Y
+
+ ld a, 191
+ sub e
+ ret c
+ ld e, a
+ and a
+ rra
+ scf
+ rra
+ and a
+ rra
+ xor e
+ and 248
+ xor e
+ ld h, a
+ ld a, d
+ rlca
+ rlca
+ rlca
+ xor e
+ and 199
+ xor e
+ rlca
+ rlca
+ ld l, a
+ ld a, d
+ and 7
+ ld b, a
+ inc b
+ ld a, 254
+
+plotPoint_loop:
+ rrca
+ djnz plotPoint_loop
+ ld b, 255
+ xor b
+ ld b, a
+ ld a, (hl)
+ or b
+ ld (hl), a
+END ASM
+END SUB
+```
+
+Even faster, if you want to use the screen tables, is to lookup the screen address.
+`HRPrintFast()` also uses the same table - it's important to only include it once -
+there's absolutely no benefit from including more than one copy.
+There, the magic is `include once` - and just have one copy of the source, to be sure
+it's the same one! You have to include this table (and the label "ScreenTables"
+somewhere in memory so the spectrum can find it.
+
+This version has been tested with a fill rate of about 10,000 pixels per second (over 20% of the screen per second!).
+
+```
+SUB fastPlot (x as uByte, y as uByte)
+ASM
+ ld d,a ;'X
+ ld a, 191
+ sub (IX+7) ;' y
+ jr c, plotPoint_end
+ ld l,a
+ ld h,ScreenTables/256
+ ld a,(HL)
+ inc h
+ ld l,(HL)
+ ld h,a
+ ld a,d
+ RRCA
+ RRCA
+ RRCA
+ AND 31
+ add a,l
+ ld l,a
+
+ ld a, d
+ and 7
+ ld b, a
+ inc b
+ ld a, 1
+
+plotPoint_loop:
+ rrca
+ djnz plotPoint_loop
+ ld b, a
+ ld a, (hl)
+ or b
+ ld (hl), a
+plotPoint_end:
+END ASM
+END SUB
+```
diff --git a/docs/library/fsin.bas.md b/docs/library/fsin.bas.md
new file mode 100644
index 000000000..61df5b596
--- /dev/null
+++ b/docs/library/fsin.bas.md
@@ -0,0 +1,87 @@
+#FSin.bas
+
+##Introduction
+
+`fSin` is the basis for the alternatives, since `COS(x)` can be calculated
+from `SIN(x)` and `TAN(x)` from `COS(x)` and `SIN(x)`.
+
+The functions should be accurate to about 0.25%, and significantly faster.
+If you need a lot of trig in your code, and it doesn't need to be pinpoint accuracy, these are good alternatives.
+Note that they more or less acknowledge they are less accurate by returning values of type `Fixed` instead of type `Float`.
+I did this because it should be fine for the actual accuracy returned,
+and `Fixed` numbers process faster and smaller than `Float` ones.
+
+* Note that you need only include `fSin` if you only want Sines, but you need fSin to use `fCos` or `fTan`.
+
+* Note that these functions use degrees, not radians.
+
+##SINE Function
+
+```
+FUNCTION fSin(num as FIXED) as FIXED
+DIM quad as byte
+DIM est1,dif as uByte
+
+num = num MOD 360
+'This change made now that MOD works with FIXED types.
+'This is much faster than the repeated subtraction method for large angles (much > 360)
+'while having some tiny rounding errors that should not significantly affect our results.
+'Note that the result may be positive or negative still, and for SIN(360) might come out
+'fractionally above 360 (which would cause issued) so the below code still is required.
+
+while num>=360
+ num=num-360
+end while
+
+while num<0
+ num=num+360
+end while
+
+IF num>180 then quad=-1
+ num=num-180
+ ELSE quad=1
+END IF
+
+IF num>90 then num=180-num
+
+num=num/2
+dif=num : rem Cast to byte loses decimal
+num=num-dif : rem so this is just the decimal bit
+
+
+est1=PEEK (@sinetable+dif)
+dif=PEEK (@sinetable+dif+1)-est1 : REM this is just the difference to the next up number.
+
+num=est1+(num*dif): REM base +interpolate to the next value.
+
+return (num/255)*quad
+
+
+sinetable:
+asm
+DEFB 000,009,018,027,035,044,053,062
+DEFB 070,079,087,096,104,112,120,127
+DEFB 135,143,150,157,164,171,177,183
+DEFB 190,195,201,206,211,216,221,225
+DEFB 229,233,236,240,243,245,247,249
+DEFB 251,253,254,254,255,255
+end asm
+END FUNCTION
+```
+
+##COSINE Function
+
+```
+FUNCTION fCos(num as FIXED) as FIXED
+ return fSin(90-num)
+END FUNCTION
+```
+
+##TANGENT Function
+
+```
+FUNCTION fTan(num as FIXED) as FIXED
+ return fSin(num)/fSin(90-num)
+END FUNCTION
+```
+
diff --git a/docs/library/fsqrt.bas.md b/docs/library/fsqrt.bas.md
new file mode 100644
index 000000000..38debbd8c
--- /dev/null
+++ b/docs/library/fsqrt.bas.md
@@ -0,0 +1,81 @@
+#FSqrt.bas
+
+##fSqrt
+
+ZX BASIC uses the ZX Spectrum ROM routine to calculate many of the floating point math functions.
+Unfortunately, some of the functions are notoriously slow. Square root being one of them -
+there wasn't enough space in the original ROM design to do a good routine, so they cheated.
+They calculate x0.5 instead, and roll straight into the exponent routine.
+It turns out that though this works, it's exceptionally slow.
+
+This function uses the Newton Raphson method. It produces exactly the same full floating point result
+(it even uses the ROM calculator), but it does it about six times faster.
+If you have a program that's calculating lots of square roots, this will make a big difference.
+However, note that integer square roots are faster still, and if you are games programming,
+accuracy might not be so critical. See [iSqrt.bas](isqrt.bas.md) for details.
+
+
+```
+REM Fast floating Point Square Root Function
+REM Adapted and modified for Boriel's ZX BASIC
+REM By Britlion
+
+FUNCTION FASTCALL fSqrt (radicand as FLOAT) as FLOAT
+ASM
+ ; FLOAT value arrives in A ED CB
+ ; A is the exponent.
+ AND A ; Test for zero argument
+ RET Z ; Return with zero.
+
+ ;Strictly we should test the number for being negative and quit if it is.
+ ;But let's assume we like imaginary numbers, hmm?
+ ; If you'd rather break it change to a jump to an error below.
+ ;BIT 7,E ; Test the bit.
+ ;JR NZ,REPORT ; back to REPORT_A
+ ; 'Invalid argument'
+ RES 7,E ; Now it's a positive number, no matter what.
+
+ call __FPSTACK_PUSH ; Okay, We put it on the calc stack. Stack contains ABS(x)
+
+ ; Halve the exponent to achieve a good guess.(accurate with .25 16 64 etc.)
+
+ ; Remember, A is the exponent.
+ XOR $80 ; toggle sign of exponent
+ SRA A ; shift right, bit 7 unchanged.
+ INC A ;
+ JR Z,ASIS ; forward with say .25 -> .5
+ JP P,ASIS ; leave increment if value > .5
+ DEC A ; restore to shift only.
+
+ASIS: XOR $80 ; restore sign.
+ call __FPSTACK_PUSH ; Okay, NOW we put the guess on the stack
+ rst 28h ; ROM CALC ;;guess,x
+ DEFB $C3 ;;st-mem-3
+ DEFB $02 ;;delete
+
+SQRLOOP: DEFB $31 ;;duplicate
+ DEFB $E3 ;;get-mem-3
+ DEFB $C4 ;;st-mem-4
+ DEFB $05 ;;div
+ DEFB $E3 ;;get-mem-3
+ DEFB $0F ;;addition
+ DEFB $A2 ;;stk-half
+ DEFB $04 ;;multiply
+ DEFB $C3 ;;st-mem-3
+ DEFB $E4 ;;get-mem-4
+ DEFB $03 ;;subtract
+ DEFB $2A ;;abs
+ DEFB $37 ;;greater-0
+ DEFB $00 ;;jump-true
+
+ DEFB SQRLOOP - $ ;;to sqrloop
+
+ DEFB $02 ;;delete
+ DEFB $E3 ;;get-mem-3
+ DEFB $38 ;;end-calc sqr x.
+
+ jp __FPSTACK_POP
+
+END ASM
+END FUNCTION
+```
diff --git a/docs/library/hmirror.bas.md b/docs/library/hmirror.bas.md
new file mode 100644
index 000000000..3e8a53958
--- /dev/null
+++ b/docs/library/hmirror.bas.md
@@ -0,0 +1,64 @@
+#HMirror.bas
+
+This Function takes a byte in, and returns the byte that has reflected the bits around the x axis,
+such that bits 7,6,5,4,3,2,1,0 become bits 0,1,2,3,4,5,6,7.
+
+This can be useful if you elect to make all your graphics face in one direction -
+you can mirror the bytes (perhaps to a buffer or a UDG) before you print them.
+It's faster to store them facing both ways, but you can make quite a memory saving if you just choose one way.
+
+
+```
+Function fastcall hMirror (number as uByte) as uByte
+asm
+ ld c,a
+; unrolled loop for speed. Still quite small - costs 10 bytes over the loop version, and saves over half the time.
+; 25 bytes and 96 clock cycles
+
+ RR C
+ RLA
+ RR C
+ RLA
+ RR C
+ RLA
+ RR C
+ RLA
+ RR C
+ RLA
+ RR C
+ RLA
+ RR C
+ RLA
+ RR C
+ RLA
+end asm
+END FUNCTION
+```
+
+The above function is basically deprecated, but may be easier to understand than the following.
+This one below is faster, and smaller. You should use this one:
+
+
+```
+Function fastcall hMirror (number as uByte) as uByte
+asm
+;17 bytes and 66 clock cycles
+Reverse:
+ ld b,a ;b=ABCDEFGH
+ rrca ;a=HABCDEFG
+ rrca ;a=GHABCDEF
+ xor b
+ and %10101010
+ xor b ;a=GBADCFEH
+ ld b,a ;b=GBADCFEH
+ rrca ;a=HGBADCFE
+ rrca ;a=EHGBADCF
+ rrca ;a=FEHGBADC
+ rrca ;a=CFEHGBAD
+ xor b
+ and %01100110
+ xor b ;a=GFEDCBAH
+ rrca ;a=HGFEDCBA
+end asm
+end function
+```
diff --git a/docs/library/hrprint.bas.md b/docs/library/hrprint.bas.md
new file mode 100644
index 000000000..4471deed2
--- /dev/null
+++ b/docs/library/hrprint.bas.md
@@ -0,0 +1,339 @@
+#HRprint.bas
+
+The High Resolution printing routine allows standard sized characters to be positioned anywhere on the screen.
+
+##Usage
+There is a an example program that uses this at the end of the page.
+
+```
+HRPrint(x,y,character,attribute,over)
+```
+
+Where
+* x is the x value in pixel co-ordinates
+* y is the y value in pixel co-ordinates
+* character is the memory address of the UDG style bytes for the character being printed.
+ To print standard characters, use the address of the character from the ROM table.
+* attribute is the attribute byte value (As you'd get from the ATTR function)
+* over is 0 or 1, and chooses whether to print in OVER 0 or OVER 1 mode.
+
+
+Prints the character to the screen at the given pixel co-ordinates.
+
+> NOTE: The ZX Spectrum's attribute system is encoded into the hardware as a 32 character grid.
+> HRPrint does its best, but changing the paper/bright/flash colour from the background is likely to
+> look imperfect as the attribute blocks cannot line up well with the character printed unless it overlaps -
+> as a result, the colour of attribute squares nearby is likely to be changed.
+
+
+##CODE
+
+```
+SUB HRPrint (x as uByte, y as uByte, char as uInteger, attribute as uByte, overprint as uByte)
+'High res Printing, based on code produced, with thanks, by Turkwel over on the WOS boards.
+'Brought to ZX Basic by Britlion, June 2010.
+'For overprint use:
+' 0 -> Nop. Direct write
+' 0xB6 -> OR (i.e. Normal "sprite" write)
+' 0xAE -> XOR (i.e. Like PRINT OVER 1)
+
+Asm
+ ld a,(IX+13) ; Get overprint value
+ LD (HRPOver1),a
+ LD (HRPOver2),a
+
+ ld b,(IX+7)
+ ld c,(IX+5)
+ push bc ; save our co-ordinates.
+
+;print_char:
+ ld d,(IX+09)
+ inc d
+ dec d
+ jr z, HRPrint_From_Charset
+ ld e,(IX+08)
+ ex de, hl
+ jp HR_Print
+
+
+HRPrint_From_Charset:
+ ld de,(23606)
+ ld h,0
+ ld l,(IX+8) ; character
+ add hl,hl
+ add hl,hl
+ add hl,hl
+ add hl,de
+
+HR_Print:
+ call HRPat
+
+;convert the Y and X pixel values to the correct Screen Address - Address in DE
+ ld a,8
+
+;set counter to 8 - Bytes of Character Data to put down
+HRPrint0:
+ push af
+ ;save off Counter
+
+ ld a,b
+ cp 192
+ jr c,HRprint1
+ pop af
+ jp HRPrintEnd
+
+;don't print character if > 191 - off the bottom of the screen - restore AF and exit Print routine
+;[this can be removed if you are keeping tight control of your Y values]
+HRprint1:
+ push hl
+ push de
+ push de
+
+;save off Address of Character Data, Screen Address, Screen Address
+ ld a,c
+ and 7
+ ld d,a
+
+;get lowest 3 bits of Screen address
+ ld e,255
+
+;set up E with the Mask to use - 11111111b = All On
+ ld a,(hl)
+ jr z,HRprint3
+
+;get a Byte of Character Data to put down - but ignore the following Mask shifting
+;if the the X value is on an actual Character boundary i.e. there's no need to shift anything
+HRprint2:
+ rrca
+ srl e
+ dec d
+ jp nz,HRprint2
+
+;Rotate the Character Data Byte D times - and Shift the Mask Byte as well, forcing Zeroes into the
+;Left hand side. The Mask will be used to split the Rotated Character Data over a Character boundary
+HRprint3:
+ pop hl
+;POP one of the Screen Addresses (formerly in DE) into HL
+ ld d,a
+ ld a,e
+ and d
+
+HRPOver1:
+ or (hl)
+ ld (hl),a
+
+;take the Rotated Character Data, mask it with the Mask Byte and the OR it with what's already on the Screen,
+;this takes care of the first part of the Byte
+;[remove the OR (HL) if you just want a straight write rather than a merge]
+ inc l
+ ld a,l
+ and 31
+ jr z,HRprint4
+
+;Increment the Screen Address and check to see if it's at the end of a line,
+;if so then there's no need to put down the second part of the Byte
+ ld a,e
+ cpl
+ and d
+
+HRPOver2:
+ or (hl)
+ ld (hl),a
+
+;Similar to the first Byte, we need to Invert the mask with a CPL so we can put down the second part of the Byte
+;in the next Character location
+;[again, remove the OR (HL) if you just want a straight write rather than a merge]
+HRprint4:
+ pop de
+ inc d
+ inc b
+
+;get the Screen Address back into DE, increment the MSB so it points the the Address immediately below
+;it and Increment the Y value in B as well
+ ld a,b
+ and 7
+ call z,HRPat
+
+;now check if the Y value has gone over a Character Boundary i.e. we will need to recalculate the Screen
+;Address if we've jumped from one Character Line to another - messy but necessary especially for lines 7 and 15
+ pop hl
+ inc hl
+
+;get the Address of the Character Data back and increment it ready for the next byte of data
+ pop af
+ dec a
+ jp nz,HRPrint0
+
+;get the Counter value back, decrement it and go back for another write if we haven't reached the end yet
+ jp HRPrintAttributes
+
+;HRPAT is a subroutine to convert pixel values into an absolute screen address
+;On Entry - B = Y Value C = X Value On Exit - DE = Screen Address
+HRPat:
+ ld a,b
+ srl a
+ srl a
+ srl a
+ ld e,a
+ and 24
+ or 64
+ ld d,a
+ ld a,b
+ and 7
+ add a,d
+ ld d,a
+ ld a,e
+ and 7
+ rrca
+ rrca
+ rrca
+ ld e,a
+ ld a,c
+ srl a
+ srl a
+ srl a
+ add a,e
+ ld e,a
+ ret
+
+HRPrintAttributes:
+ pop bc ; recover our X-Y co-ordinates.
+ ld d,0
+ ld a,(IX+11) ; attribute
+ and a
+ jr z, HRPrintEnd ; if attribute=0, then we don't do attributes.
+ ld e,a ; pass to e
+
+;transfer Attribute Byte to e for easier use
+ ld a,b
+ cp 192
+ jr nc, HRPrintEnd
+
+;check Y position and exit if off bottom of screen
+ push bc
+
+;save off Y and X values for later
+ and 248
+ ld h,22
+ ld l,a
+ add hl,hl
+ add hl,hl
+ srl c
+ srl c
+ srl c
+ ld b,d
+ add hl,bc
+
+;calculate the correct Attribute Address for the Y\X values
+ ld (hl),e
+
+;set the Attribute - this is ALWAYS set no matter what the valid Y\X values used
+ pop bc
+
+;get the Y and X values back into BC
+ ;call print_attribute2
+
+;call the subroutine to see if an adjacent Horizontal Attribute needs to be set
+print_attributes1:
+ ld a,c
+ cp 248
+ jr nc,endPrintAttributes1
+
+;check to see if we are at Horizontal character 31 - if so then no need to set adjacent Horizontal Attribute
+ and 7
+ jr z, endPrintAttributes1
+
+;and don't set the adjacent Horizontal Attribute if there's no need to
+ inc l
+ ld (hl),e
+ dec l
+
+;increment the Attribute address - set the adjacent horizontal Attribute - then set the Attribute Address back
+endPrintAttributes1:
+ ld a,b
+ cp 184
+ jr nc, HRPrintEnd
+
+;check to see if we are at Vertical character 23 - if so then no need to set adjacent Vertical Attribute & Exit routine
+ and 7
+ jr z, HRPrintEnd
+
+;and don't set the adjacent Vertical Attribute if there's no need to & Exit routine
+ ld a,l
+ add a,32
+ ld l,a
+ ld a,d
+ adc a,h
+ ld h,a
+ ld (hl),e
+
+;set the Attribute address to the line below - and set the adjacent Vertical Attribute
+;
+;drop through now into adjacent Horizontal Attribute subroutine - all RETs will now Exit the routine completely
+;
+HRPrintAttribute2: ld a,c
+ cp 248
+ jr nc, HRPrintEnd
+
+;check to see if we are at Horizontal character 31 - if so then no need to set adjacent Horizontal Attribute
+ and 7
+ jr z, HRPrintEnd
+
+;and don't set the adjacent Horizontal Attribute if there's no need to
+ inc l
+ ld (hl),e
+ dec l
+
+;increment the Attribute address - set the adjacent horizontal Attribute - then set the Attribute Address back
+ ;ret
+
+HRPrintEnd:
+End Asm
+END SUB
+```
+
+
+## Usage Example
+Here is a short program that demonstrates the HRPrint routine in use - in this case to animate a sprite.
+Four calls to the routine put the four characters of the sprite onto the screen, and similarly erase it.
+
+```
+#include "hrprint.bas"
+
+CLS
+
+DIM x,y AS UBYTE
+DIM xd,yd AS BYTE
+x=100
+y=10
+xd=1
+yd=1
+
+DO
+ PAUSE 2
+ HRPrint(x,y,32,56,0): REM Erase with a space (CHR$ 32)
+ HRPrint(x+8,y,32,56,0)
+ HRPrint(x,y+8,32,56,0)
+ HRPrint(x+8,y+8,32,56,0)
+
+ x=x+xd
+ y=y+yd
+
+ HRPrint(x,y,@gentle,76,0)
+ HRPrint(x+8,y,@gentle+8,76,0xAE)
+ HRPrint(x,y+8,@gentle+16,76,0)
+ HRPrint(x+8,y+8,@gentle+24,76,0xAE)
+
+ IF x<=0 OR x>=247 THEN xd=-xd
+ IF y<=0 OR y>=184 THEN yd=-yd
+LOOP
+END
+
+gentle:
+ASM
+ defb 15,15,15,15,15,15,13,15
+ defb 240,144,208,208,240,240,176,240
+ defb 15,14,63,0,0,12,26,30
+ defb 176,112,252,0,0,24,104,120
+END ASM
+```
diff --git a/docs/library/hrprintfast.bas.md b/docs/library/hrprintfast.bas.md
new file mode 100644
index 000000000..24fc4d91c
--- /dev/null
+++ b/docs/library/hrprintfast.bas.md
@@ -0,0 +1,414 @@
+#HRPrintFast.bas
+
+The High Resolution printing routine allows standard sized characters to be positioned anywhere on the screen.
+
+##Usage
+There is a an example program that uses this at the end of the page.
+
+```
+HRPrint(x,y,character,attribute,over)
+```
+
+Where
+* x is the x value in pixel co-ordinates
+* y is the y value in pixel co-ordinates
+* character is the memory address of the UDG style bytes for the character being printed.
+ To print standard characters, use the address of the character from the ROM table.
+* attribute is the attribute byte value (As you'd get from the ATTR function)
+* over is 0 or 1, and chooses whether to print in OVER 0 or OVER 1 mode.
+
+
+
+Prints the character to the screen at the given pixel co-ordinates.
+
+> NOTE: The ZX Spectrum's attribute system is encoded into the hardware as a 32 character grid.
+> HRPrint does its best, but changing the paper / bright / flash colour from the background is likely to
+> look imperfect as the attribute blocks cannot line up well with the character printed unless it
+> overlaps - as a result, the colour of attribute squares nearby is likely to be changed.
+
+##CODE
+This code is too large to place in full, since it requires Britlion's Screen and Rotate Tables,
+and this wiki does not allow attachments. Please download HRPrintFast from the forum posting:
+http://boriel.com/mybb/showthread.php?tid=532&pid=3318#pid3318
+
+```
+SUB HRPrintFast (x AS UBYTE, y AS UBYTE, char AS UInteger, attribute AS UBYTE, overprint AS UBYTE)
+REM High res Printing, based on code produced, with thanks, by Turkwel over on the WOS boards.
+REM Brought to ZX Basic by Britlion, June 2010.
+
+ASM
+ ld a,(IX+13) ; Get overprint value
+ AND a ; zero?
+ JR Z,HRP_No_Over
+ LD a,182
+ JP HRP_Change_Code
+
+HRP_No_Over:
+ XOR A ; faster than LD a,0
+
+HRP_Change_Code:
+ LD (HRPOver1),a
+ LD (HRPOver2),a
+ ld b,(IX+7)
+ ld c,(IX+5)
+ push BC ; SAVE our co-ordinates.
+
+;print_char:
+ ld d,(IX+09)
+ inc d
+ dec d
+ jr z, HRPrint_From_Charset
+ ld e,(IX+08)
+ jp HR_Print
+
+HRPrint_From_Charset:
+ ld de,(23606)
+ ld h,0
+ ld l,(IX+8) ; character
+ add hl,hl
+ add hl,hl
+ add hl,hl
+ add hl,de
+
+HR_Print:
+ ;call HRPat
+ ;PUSH HL
+ EX DE,HL ; Save HL out in DE
+
+ LD H, HRPScreenTables/256
+ LD L,B
+ LD A,(HL)
+
+ INC H
+ LD L,(HL)
+ LD H,A
+
+ LD A,C
+ SRL A
+ SRL A
+ SRL A
+
+ ADD A,L
+ LD L,A
+ EX DE,HL ; swap HL and DE Back
+
+;convert the Y AND X pixel values TO the correct Screen Address - Address in DE
+ ld a,8
+
+;set counter TO 8 - Bytes of Character Data TO put down
+HRPrint0:
+ push af
+
+;save off Counter
+ ;ld a,b
+ ;cp 192
+ ;jr c,HRprint1
+ ;pop af
+ ;jp HRPrintEnd
+
+;don't print character if > 191 - off the bottom of the screen - restore AF and exit Print routine
+;[this can be removed IF you are keeping tight control of your Y values]
+HRprint1:
+ push hl
+ push de
+ push de
+
+;save off Address of Character Data, Screen Address, Screen Address
+ ld a,c
+ AND 7
+ ld d,a
+
+;get lowest 3 bits of Screen address
+ ;ld e,255
+
+;set up E with the Mask TO use - 11111111b = All On
+ ld a,(hl)
+ jr nz,HRprint2
+
+;get a BYTE of Character Data TO put down - but ignore the following Mask shifting
+;if the the X value is on an actual Character boundary i.e. there's no need to shift anything
+ ; rrca
+ ; srl e
+ ; dec d
+ ; jp nz,HRprint2
+
+ ld e,0
+ jp HRprint3
+
+HRprint2:
+;Rotate the Character Data BYTE D times - AND Shift the Mask BYTE AS well, forcing Zeroes into the
+;Left hand side. The Mask will be used TO split the Rotated Character Data OVER a Character boundary
+
+; New version: Grab into DE, the split rotation values.
+ LD E,A ; Put our working byte safe
+ LD A,D ; Grab our number of rotates
+ EX DE,HL ; Save HL
+ DEC A ; decrease so 1->0
+ SLA A ; Multiply by 2 because we have double tables.
+ ADD A, RotateTables/256 ; Add in the base for rotate tables.
+ LD H,A ; put it into our lookup.
+ LD A,(HL) ; get high byte
+ INC H
+ LD L,(HL) ; get low byte
+ LD H,A
+ EX DE,HL ; put result in DE, and restore HL.
+
+
+HRprint3:
+ pop hl
+
+;POP one of the Screen Addresses (formerly in DE) into HL
+ ;ld d,a
+ ;ld a,e
+ ;AND d
+ ld a,d ; get our first byte
+
+HRPOver1:
+ OR (hl)
+ ld (hl),a
+
+;take the Rotated Character Data, mask it with the Mask BYTE AND the OR it with what's already on the Screen,
+;this takes care of the first part of the BYTE
+;[remove the OR (HL) IF you just want a straight write rather than a merge]
+ inc l
+ ld a,l
+ AND 31
+ jr z, HRprint4
+
+;Increment the Screen Address AND check TO see IF it's at the end of a line,
+;if so THEN there's no need to put down the second part of the Byte
+ ld a,e
+ ;cpl
+ ;AND d
+
+HRPOver2:
+ OR (hl)
+ ld (hl),a
+
+;Similar TO the first BYTE, we need TO Invert the mask with a CPL so we can put down the second part of the BYTE
+;in the NEXT Character location
+;[again, remove the OR (HL) IF you just want a straight write rather than a merge]
+HRprint4:
+ pop de
+ inc d
+ inc b
+
+;get the Screen Address back into DE, increment the MSB so it points the the Address immediately below
+;it AND Increment the Y value in B AS well
+ ld a,b
+ AND 7
+
+ ;call z,HRPat
+ jr nz, HRPatSkip
+
+ EX DE,HL ; Save HL out in DE
+
+ LD H, ScreenTables/256
+ LD L,B
+ LD A,(HL)
+
+ INC H
+ LD L,(HL)
+ LD H,A
+
+ LD A,C
+ SRL A
+ SRL A
+ SRL A
+
+ ADD A,L
+ LD L,A
+ EX DE,HL ; swap HL and DE Back
+
+HRPatSkip:
+
+;now check IF the Y value has gone OVER a Character Boundary i.e. we will need TO recalculate the Screen
+;Address IF we've jumped from one Character Line to another - messy but necessary especially for lines 7 and 15
+ pop hl
+ inc hl
+
+;get the Address of the Character Data back AND increment it ready FOR the NEXT BYTE of data
+ pop af
+ dec a
+ jp nz,HRPrint0
+
+;get the Counter value back, decrement it AND GO back FOR another write IF we haven't reached the end yet
+ ; jp HRPrintAttributes (No need to jump around this now)
+
+HRPrintAttributes:
+ POP BC ; recover our X-Y co-ordinates.
+ ld d,0
+ ld a,(IX+11) ; attribute
+ AND a
+ jp z, HRPrintEnd ; IF attribute=0, THEN we don't do attributes.
+ ld e,a ; pass TO e
+
+;transfer Attribute BYTE TO e FOR easier use
+ ld a,b
+ cp 192
+ jp nc, HRPrintEnd
+
+;check Y position AND EXIT IF off bottom of screen
+ push bc
+
+;save off Y AND X values FOR later
+ AND 248
+ ld h,22
+ ld l,a
+ add hl,hl
+ add hl,hl
+ srl c
+ srl c
+ srl c
+ ld b,d
+ add hl,bc
+
+;calculate the correct Attribute Address FOR the Y\X values
+ ld (hl),e
+
+;set the Attribute - this is ALWAYS set no matter what the valid Y\X values used
+ pop bc
+
+;get the Y AND X values back into BC
+ ;call print_attribute2
+
+;call the subroutine TO see IF an adjacent Horizontal Attribute needs TO be set
+print_attributes1:
+ ld a,c
+ cp 248
+ jr nc,endPrintAttributes1
+
+;check TO see IF we are AT Horizontal character 31 - IF so THEN no need TO set adjacent Horizontal Attribute
+ AND 7
+ jr z, endPrintAttributes1
+
+;and don't set the adjacent Horizontal Attribute if there's no need to
+ inc l
+ ld (hl),e
+ dec l
+
+;increment the Attribute address - set the adjacent horizontal Attribute - THEN set the Attribute Address back
+endPrintAttributes1:
+ ld a,b
+ cp 184
+ jp nc, HRPrintEnd
+
+;check TO see IF we are AT Vertical character 23 - IF so THEN no need TO set adjacent Vertical Attribute & EXIT routine
+ AND 7
+ jp z, HRPrintEnd
+
+;and don't set the adjacent Vertical Attribute if there's no need to & Exit routine
+ ld a,l
+ add a,32
+ ld l,a
+ ld a,d
+ adc a,h
+ ld h,a
+ ld (hl),e
+
+;set the Attribute address TO the line below - AND set the adjacent Vertical Attribute
+;drop through now into adjacent Horizontal Attribute subroutine - all RETs will now EXIT the routine completely
+HRPrintAttribute2:
+ ld a,c
+ cp 248
+ jp nc, HRPrintEnd
+
+;check TO see IF we are AT Horizontal character 31 - IF so THEN no need TO set adjacent Horizontal Attribute
+ AND 7
+ jp z, HRPrintEnd
+
+;and don't set the adjacent Horizontal Attribute if there's no need to
+ inc l
+ ld (hl),e
+ dec l
+
+;increment the Attribute address - set the adjacent horizontal Attribute - THEN set the Attribute Address back
+ ;ret
+ jp HRPrintEnd
+
+#include once "Screentables.asm"
+#include once "RotateTables.asm"
+
+HRPrintEnd:
+
+END ASM
+END SUB
+
+```
+
+##EXAMPLE OF USE
+
+```
+CLS
+
+DIM x,y,x2,y2 as uByte
+DIM xd,yd as fixed
+DIM counter as uInteger
+DIM time,endtime as uLong
+
+x=100
+y=10
+x2=x
+y2=y
+xd=2
+yd=2
+
+
+DO
+
+x2=x+xd
+y2=y+yd
+
+' Timing loop to make the sprite update clean on the screen.
+' Instead of a waste of time loop here, you could go off and do something for the equivalent time span of the loop. and then come back here to update the sprites.
+' You could call subroutines to update numbers in memory, play some sound for a while, see if a key is pressed...all sorts of things!
+' The point is you need to do a halt, and then get to the sprite update bit a little while later - after the electron beam has moved off the screen.
+' This version below clearly wastes over 130,000 T states per frame.
+
+asm
+halt
+halt
+halt
+push hl ;11
+push af ; 11
+
+ld hl,5000 ;10
+quickloop:
+dec hl ;6
+ld a,l ;4
+or h ;4
+
+jr nz, quickloop ; 12 (usually - one iteration of 7)
+pop af ; 10
+pop hl ;10
+end asm
+
+HRPrintFast(x,y,32,56,0)
+HRPrintFast(x+8,y,32,56,0)
+HRPrintFast(x,y+8,32,56,0)
+HRPrintFast(x+8,y+8,32,56,0)
+
+
+HRPrintFast(x2,y2,@gentle,76,0)
+HRPrintFast(x2+8,y2,@gentle+8,76,1)
+HRPrintFast(x2,y2+8,@gentle+16,76,0)
+HRPrintFast(x2+8,y2+8,@gentle+24,76,1)
+
+x=x2
+y=y2
+
+
+IF x<=0 OR x>=245 THEN xd=-xd : END IF
+IF y<=0 OR y>=175 THEN yd=-yd : END IF
+
+LOOP
+end
+
+gentle:
+asm
+ defb 15,15,15,15,15,15,13,15
+ defb 240,144,208,208,240,240,176,240
+ defb 15,14,63,0,0,12,26,30
+ defb 176,112,252,0,0,24,104,120
+end asm
+```
diff --git a/docs/library/isqrt.bas.md b/docs/library/isqrt.bas.md
new file mode 100644
index 000000000..4537fc6b5
--- /dev/null
+++ b/docs/library/isqrt.bas.md
@@ -0,0 +1,174 @@
+#ISqrt.bas
+
+An Integer square root is the nearest whole number smaller than the full square root answer.
+So the integer square root of 10 is 3 instead of 3.162277. You'd get the same answer as `INT(SQR(x))`
+with an integer square root function.
+
+For things like games programming, this is often near enough - for example, the distance formula,
+based on Pythagoras' equation A2 = B2 + C2 only works if you square root the answer.
+If you need to find the distances between your items, then you're going to be doing a lot of square roots,
+and you're going to need to do them FAST (that said the even faster solution might be this one:
+[distance.bas](distance.bas.md) or if you don't need the actual distance just the answer to
+the question _"which one is further away?"_ then not square rooting is needed, and comparing distance12 with
+distance22 still tells you which is nearer.
+[Berksman](http://www.worldofspectrum.org/infoseekid.cgi?id=0027713) written in ZX Basic,
+does this trick of never doing the square root part, for example.
+
+Anyway, this function returns integer square roots. For numbers less than 65536, it's about 100 times faster,
+because it can do 16 bit calculation. For longer numbers, it has to do 32 bit calculations,
+which are less than optimal on an 8 bit processor! It's still about 50 times faster than the ROM routine, however.
+
+If you want completely accurate results, you should use
+the floating point fast routine over at [fSqrt.bas](fsqrt.bas.md).
+
+
+```
+FUNCTION FASTCALL iSqrt (num as uLong) as uInteger
+REM incoming is DEHL
+REM output is HL
+
+asm
+ LD A,D
+ OR E
+ JP Z, sqrtLF16bit ; we're inside a 16 bit number. We can use the faster version.
+
+ LD b,16 ; b times round
+ EXX ; Out to root and rem - we're doing most of this in alternate registers.
+ LD DE,0
+ LD HL,0 ; DEHL = remainder
+ LD BC,0 ; BC = root
+ EXX ;back to num and loop
+sqrtLFasmloop:
+ EXX ; out to root and rem
+
+ SLA C ; root <<= 1
+ RL B ;
+
+ SLA L ; rem=rem<<1
+ RL H ;
+ RL E ;
+ RL D ;
+
+ SLA L ; rem=rem<<1
+ RL H ;
+ RL E ;
+ RL D ;
+ EXX ; back to Num and loop
+
+ LD a,d ; A = inputnum>>30
+ AND 192
+ RLCA
+ RLCA
+
+ SLA L ; num <<= 1
+ RL H
+ RL E
+ RL D
+
+ SLA L ; num <<= 1
+ RL H
+ RL E
+ RL D
+
+ EXX ; out to root and rem
+
+ ADD A,L ; a=a+L ; REM=REM+num>>30
+ LD L,A ; a-> L ;
+ JR NC, sqrtLFasmloophop1 ;
+ INC H
+ JR NC, sqrtLFasmloophop1
+ INC DE ;
+
+sqrtLFasmloophop1:
+ INC BC ; root=root+1
+
+sqrtLFasmloophop2:
+ ; DEHL = Remainder
+ ; BC = root
+
+ ; if rem >= root then
+ LD A,D
+ OR E
+ JR NZ, sqrtLFasmthen ; if rem > 65535 then rem is definitely > root and we go to true
+
+ LD A, H
+ CP B
+ JR C, sqrtLFasmelse ; H=root is false and we go to else
+ JR NZ, sqrtLFasmthen ; H isn't zero though, so we could do a carry from it, so we're good to say HL is larger.
+
+ ; if h is out, then it's down to L and C
+ LD A,L
+ CP C
+ JR C, sqrtLFasmelse ; L=root is false and we go to else
+ ; must be true - go to true.
+
+sqrtLFasmthen:
+ ;remainder=remainder-root
+ AND A ; clear carry flag
+ SBC HL,BC ; take root away from the lower half of rem.
+ JP NC, sqrtLFasmhop3 ; we didn't take away too much, so we're okay to loop round.
+
+ ; if we're here, we did take away too much. We need to borrow from DE
+ DEC DE ; borrow off DE
+
+sqrtLFasmhop3:
+ INC BC ;root=root+1
+ JP sqrtLFasmloopend
+
+ ;else
+sqrtLFasmelse:
+ DEC BC ;root=root-1
+ ;end if
+
+
+sqrtLFasmloopend:
+ EXX ; back to num
+ DJNZ sqrtLFasmloop
+
+ EXX ; out to root and rem
+ PUSH BC
+
+ EXX ; back to normal
+ POP HL
+ SRA H
+ RES 7,H
+ RR L ; Hl=HL/2 - root/2 is the answer.
+ jr sqrtLFexitFunction
+
+sqrtLF16bit:
+
+ ld a,l
+ ld l,h
+ ld de,0040h ; 40h appends "01" to D
+ ld h,d
+ ld b,7
+
+sqrtLFsqrt16loop:
+ sbc hl,de ; IF speed is critical, and you don't mind spending the extra bytes,
+ ; you could unroll this loop 7 times instead of DJNZ.
+
+ ; deprecated because of issues - jr nc,$+3 (note that if you unroll this loop, you'll need 7 labels for the jumps the other way!)
+ jr nc,sqrtLFsqrthop1
+ add hl,de
+
+
+sqrtLFsqrthop1:
+ ccf
+ rl d
+ rla
+ adc hl,hl
+ rla
+ adc hl,hl
+
+ DJNZ sqrtLFsqrt16loop
+
+ sbc hl,de ; optimised last iteration
+ ccf
+ rl d
+ ld h,0
+ ld l,d
+ ld de,0
+sqrtLFexitFunction:
+ end asm
+END FUNCTION
+```
diff --git a/docs/library/megalz.bas.md b/docs/library/megalz.bas.md
new file mode 100644
index 000000000..2d5599f59
--- /dev/null
+++ b/docs/library/megalz.bas.md
@@ -0,0 +1,145 @@
+#MegaLZ.bas
+
+# megaLZDepack.bas
+
+This routine takes a block of data compressed with the [MegaLZ](http://lvd.nm.ru/MegaLZ/) compression
+algorithm at SOURCE location and decompresses it to DESTINATIOn location.
+You should probably save compressed files as direct binaries, and use asm mode incbin commands
+to include the binary into your project.
+
+THIS METHOD IS NOW INCLUDED IN THE ZX BASIC EXTERNAL LIBRARY (the library folder),
+so can and should be included with `#include ` for the latest code.
+
+```
+SUB megaLZDepack (source as uInteger, dest as uInteger)
+ ASM
+ LD E,(IX+6)
+ LD D,(IX+7)
+
+ ;Z80 depacker for megalz V4 packed files (C) fyrex^mhm
+
+ ; DESCRIPTION:
+ ;
+ ; Depacker is fully relocatable, not self-modifying,
+ ;it's length is 110 bytes starting from DEC40.
+ ;Register usage: AF,AF',BC,DE,HL. Must be CALL'ed, return is done by RET.
+ ;Provide extra stack location for store 2 bytes (1 word). Depacker does not
+ ;disable or enable interrupts, as well as could be interrupted at any time
+ ;(no f*cking wicked stack usage :).
+
+ ; USAGE:
+ ;
+ ; - put depacker anywhere you want,
+ ; - put starting address of packed block in HL,
+ ; - put location where you want data to be depacked in DE,
+ ; (much like LDIR command, but without BC)
+ ; - make CALL to depacker (DEC40).
+ ; - enjoy! ;)
+
+ ; PRECAUTIONS:
+ ;
+ ; Be very careful if packed and depacked blocks coincide somewhere in memory.
+ ;Here are some advices:
+ ;
+ ; 1. put packed block to the highest addresses possible.
+ ; Best if last byte of packed block has address #FFFF.
+ ;
+ ; 2. Leave some gap between ends of packed and depacked block.
+ ; For example, last byte of depacked block at #FF00,
+ ; last byte of packed block at #FFFF.
+ ;
+ ; 3. Place nonpackable data to the end of block.
+ ;
+ ; 4. Always check whether depacking occurs OK and neither corrupts depacked data
+ ; nor hangs computer.
+ ;
+
+ ;DEC40
+
+ LD A,80h
+ EX AF,AF'
+ MS: LDI
+ M0: LD BC,2FFh
+ M1: EX AF,AF'
+ M1X: ADD A,A
+ JR NZ,M2
+ LD A,(HL)
+ INC HL
+ RLA
+ M2: RL C
+ JR NC,M1X
+ EX AF,AF'
+ DJNZ X2
+ LD A,2
+ SRA C
+ JR C,N1
+ INC A
+ INC C
+ JR Z,N2
+ LD BC,33Fh
+ JR M1
+
+ X2: DJNZ X3
+ SRL C
+ JR C,MS
+ INC B
+ JR M1
+ X6:
+ ADD A,C
+ N2:
+ LD BC,4FFh
+ JR M1
+ N1:
+ INC C
+ JR NZ,M4
+ EX AF,AF'
+ INC B
+ N5: RR C
+ JP C, END_DEC40
+ RL B
+ ADD A,A
+ JR NZ,N6
+ LD A,(HL)
+ INC HL
+ RLA
+ N6: JR NC,N5
+ EX AF,AF'
+ ADD A,B
+ LD B,6
+ JR M1
+ X3:
+ DJNZ X4
+ LD A,1
+ JR M3
+ X4: DJNZ X5
+ INC C
+ JR NZ,M4
+ LD BC,51Fh
+ JR M1
+ X5:
+ DJNZ X6
+ LD B,C
+ M4: LD C,(HL)
+ INC HL
+ M3: DEC B
+ PUSH HL
+ LD L,C
+ LD H,B
+ ADD HL,DE
+ LD C,A
+ LD B,0
+ LDIR
+ POP HL
+ JR M0
+
+END_DEC40:
+END ASM
+END SUB
+```
+
+
+## Usage
+Example:
+```
+megaLZDepack (32768,16384)
+```
diff --git a/docs/library/pixelscroll.md b/docs/library/pixelscroll.md
new file mode 100644
index 000000000..c1b3c98c3
--- /dev/null
+++ b/docs/library/pixelscroll.md
@@ -0,0 +1,142 @@
+#PixelScroll
+
+# pixelScroll.bas
+
+Does what it says on the tin! Scrolls the screen by the set number of pixels,
+leaving blank pixel rows beyond it. Attributes are untouched.
+
+It's fast - it uses the screen tables method. You'll need the relevant screen tables
+ files - https://dl.dropbox.com/u/4903664/ScreenTables.7z
+
+```
+SUB PixelScrollUp(numOfLines as uByte)
+ASM
+; BLPixelTable is where the table starts
+
+AND A ; Flags off A
+JP Z, BLPixelScrollUpEnd ; We were asked to scroll zero. Quit!
+CP 192
+JP NC, BLPixelScrollUpEnd ; We can't scroll more than 191 lines up. Quit!
+
+LD C,A ; Current Line
+LD B,A ; Jump
+PUSH BC ; Save Line count.
+
+BLPixelScrollUpMainLoop:
+
+; screen address routine
+LD H,BLPixelTable/256
+LD L,C
+LD D,(HL)
+INC H
+LD E,(HL) ; DE is source address
+
+;LD H,BLPixelTable/256
+DEC H ; get H back to pixeltable.
+
+LD A,C
+SUB B ; A is now destination line number
+LD L,A
+LD A,(HL)
+INC H
+LD L,(HL) ; HL: is destination line address
+LD H,A ;
+EX DE,HL ; Swap! ; HL=Source Address. DE=Dest address.
+
+
+```; A small version has these two lines instead of the pile of LDI:
+; ld bc,32 ; 32 bytes to transfer
+; ldir
+
+;(A very small version would calculate screen addresses, instead of use the table!)
+
+; A fast version has these 32 LDIs instead: (About 27% faster) - but uses up 28 bytes more.
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+LDI
+
+POP BC
+INC C
+LD A,C
+CP 192
+PUSH BC ; Save count again.
+
+JP C, BLPixelScrollUpMainLoop ; Not carry? then We hit the bottom of the screen. Need zeroes.
+
+; blank remaining rows
+POP BC ; Balance Stack
+LD C,B ; Push diff into C
+LD A,192
+SUB C ; A now shows row num of the top row to clear.
+CP 192 ; are we done
+JP Z,BLPixelScrollUpEnd
+LD D,0
+
+BLPixelScrollUpClearBigLoop:
+
+LD H,BLPixelTable/256
+LD L,A
+LD C,(HL)
+INC H
+LD L,(HL)
+LD H,C ; HL is current row
+LD B,32 ; 32 bytes
+BLPixelScrollUpClearLoop:
+LD (HL),D
+INC L
+DJNZ BLPixelScrollUpClearLoop
+
+INC A
+CP 192
+
+JP C, BLPixelScrollUpClearBigLoop
+JP BLPixelScrollUpEnd
+
+END ASM
+#include once "ScreenTables.bas"
+ASM
+
+BLPixelScrollUpEnd:
+END ASM
+END SUB
+```
+
+
+## Usage
+
+Example:
+
+```
+PixelScrollUp(2)
+```
+
+Will scroll the screen up by 2 pixels.
diff --git a/docs/library/print42.bas.md b/docs/library/print42.bas.md
new file mode 100644
index 000000000..4fe1ce114
--- /dev/null
+++ b/docs/library/print42.bas.md
@@ -0,0 +1,29 @@
+#Print42.bas
+
+The 42 column printing routine allows text to be 6 pixels wide instead of 8.
+It is NOT proportional printing, but this is still useful for lining things up in columns.
+
+This routine has been adopted as an included library - so you may include it with
+
+```
+#include
+```
+
+##Usage
+
+```
+printat42(y,x)
+```
+
+Moves the print42 system's print cursor to row Y, column X. Note that `0 <= x <= 41` - that is the range of values
+for X can be up to 41. The range of values for Y is the normal 0-23.
+
+```
+printat42(STRING)
+```
+
+Prints the string to the screen at the current Print42 co-ordinates. It does so in the current permanent colours.
+
+NOTE: The ZX Spectrum's attribute system is encoded into the hardware as a 32 character grid. Print42 does its best,
+but changing the `paper`/`bright`/`flash` colour from the background is likely to look imperfect as the attribute blocks
+cannot line up well with the pixel blocks.
diff --git a/docs/library/print64.bas.md b/docs/library/print64.bas.md
new file mode 100644
index 000000000..aad1a1d73
--- /dev/null
+++ b/docs/library/print64.bas.md
@@ -0,0 +1,322 @@
+#Print64.bas
+
+The 64 column printing routine allows text to be 4 pixels wide instead of 8.
+It is NOT proportional printing, but this is still useful for lining things up in columns.
+
+This routine has been adopted as an included library - so you may include it with
+
+```
+#include
+```
+
+##Usage
+
+```
+printat64(y,x)
+```
+
+Moves the print64 system's print cursor to row Y, column X. Note that `0 <= x <= 63` - that is the range of values
+for X can be up to 63. The range of values for Y is the normal 0-23.
+
+* Note that the print64 system's cursor position is independent from that of the ZX Basic Print routine,
+or any other, such as the print42 system.
+
+```
+printat64(STRING)
+```
+
+
+Prints the string to the screen at the current Print64 co-ordinates. It does so in the current permanent colours.
+
+NOTE: The ZX Spectrum's attribute system is encoded into the hardware as a 32 character grid. Print64 does its best,
+but changing the paper/bright/flash colour from the background is likely to look imperfect as the attribute
+blocks cannot line up well with the pixel blocks.
+
+##CODE
+* There is a version of this code included with the compiler
+(though the version listed here may or may not be more recent). Code converted to ZXBasic by Britlion,
+based on Andrew Owen's 64 Character code http://www.worldofspectrum.org/forums/showpost.php?p=167447&postcount=1
+
+
+```
+SUB printat64 (y as uByte, x as uByte)
+ IF y<24 AND x<64 then
+ POKE @p64coords,x
+ POKE @p64coords+1,y
+ ELSE
+ asm
+ rst 8 ; error "5 Out of screen"
+ defb 4
+ end asm
+ END IF
+END SUB
+
+
+SUB print64 (characters$ as String)
+ASM
+
+; This frankencode created by Paul Fisher, Andrew Owen, Chris Born and Einar Saukas
+; TODO:
+; * Inverse
+; * Bold (which will use a Second font)
+
+LD L,(IX+4)
+LD H,(IX+5) ; Get String address of characters$ into HL.
+
+; Load BC with length of string, and move HL to point to first character.
+ ld c, (hl) ; 60020 78
+ inc hl ; 60021 35
+ ld b, (hl) ; 60022 70
+ inc hl ; 60023 35
+
+; Test string length. If Zero, exit.
+ ld a, c ; 60024 121
+ or b ; 60025 176
+ jp z, p64_END ; 60026 200
+
+examineChar:
+ ld a, (hl) ; Grab the character
+ cp 128 ; too high to print?
+ jr nc, nextChar ; then we go to next.
+
+newLine:
+ cp 13 ; Is this a newline character? 60056 254 13
+ jr nz, p64_isPrintable ; If not, hop to testing to see if we can print this 60058 32 13
+ push hl
+ push bc
+ ld b,0
+ ld hl, p64_coords ; Get coords 60060 237 91 68 235
+ call BLp64_NEXT_ROW ; Go to next line. ; 60064 205 58 235
+ pop bc
+ pop hl
+
+ ld (p64_coords), de ; 60067 237 83 68 235
+ jr nextChar ; 60071 24 11
+
+p64_isPrintable:
+ cp 31 ; Bigger than 31? 60073 254 31
+ jr c, nextChar ; If not, get the next one. 60075 56 7
+
+ push hl ; Save position 60077 229
+ push bc ; Save Count 60078 197
+ call p64_PrintChar ; Call Print SubRoutine
+
+
+
+ pop bc ; Recover length count 60082 193
+ pop hl ; Recover Position 60083 225
+
+nextChar:
+ inc hl ; Point to next character 60084 35
+ dec bc ; Count off this character 60085 11
+ ld a, b ; Did we run out? 60086 120
+ or c ; 60087 177
+ jr nz, examineChar ; If not, examine the next one 60088 32 193
+ jp p64_END ; Otherwise hop to END. 60090 201
+
+p64_PrintChar:
+; Arrives with A as a byte to print.
+ ld hl,p64_coords
+ push hl ; save COL address for later
+ ld e, a ; store character value in E
+ ld b,0
+ ld c, (hl) ; store current column in BC
+
+ ; Check if character font must be rotated, self-modifying the code accordingly
+
+ xor c ; compare BIT 0 from character value and column
+ rra
+ ld a, 256-(BLp64_END_LOOP-BLp64_SKIP_RLC) ; instruction DJNZ skipping rotation
+ jr nc, BLp64_NOT_RLC ; decide based on BIT 0 comparison
+ ld a, 256-(BLp64_END_LOOP-BLp64_INIT_RLC) ; instruction DJNZ using rotation
+
+BLp64_NOT_RLC:
+ ld (BLp64_END_LOOP - 1), a ; modify DJNZ instruction directly
+
+; Check the half screen byte to be changed, self-modifying the code accordingly
+ srl c ; check BIT 0 from current column
+ ld a, %00001111 ; mask to change left half of the screen byte
+ jr nc, BLp64_SCR_LEFT ; decide based on odd or even column
+ cpl ; mask to change right half of the screen byte
+
+BLp64_SCR_LEFT:
+ ld (BLp64_SCR_MASK + 1), a ; modify screen mask value directly
+ cpl
+ ld (BLp64_FONT_MASK + 1), a ; modify font mask value directly
+
+; Calculate location of the first byte to be changed on screen
+; The row value is a 5 bits value (0-23), here represented as %000RRrrr
+; The column value is a 6 bits value (0-63), here represented as %00CCCCCc
+; Formula: 0x4000 + ((row & 0x18) << 8) + ((row & 0x07) << 5) + (col >> 1)
+
+ inc hl ; now HL references ROW address
+ ld a, (hl) ; now A = %000RRrrr
+ call 0e9eh ; now HL = %010RR000rrr00000
+ add hl, bc ; now HL = %010RR000rrrCCCCC
+ ex de, hl ; now DE = %010RR000rrrCCCCC
+ ; and e=char -> l=char
+
+; Calculate location of the character font data in p64_charset
+; Formula: p64_charset + 7 * INT ((char-32)/2) - 1
+
+ ld h, b ; now HL = char (because b=0)
+ srl l ; now HL = INT (char/2)
+ ld c, l ; now BC = INT (char/2)
+ add hl, hl ; now HL = 2 * INT (char/2)
+ add hl, hl ; now HL = 4 * INT (char/2)
+ add hl, hl ; now HL = 8 * INT (char/2)
+ sbc hl, bc ; now HL = 7 * INT (char/2)
+ ld bc, p64_charset - 71h
+ add hl, bc ; now HL = p64_charset + 7 * INT (char/2) - 0x71
+
+
+; Main loop to copy 8 font bytes into screen (1 blank + 7 from font data)
+ xor a ; first font byte is always blank
+ ld b, 8 ; execute loop 8 times
+
+BLp64_INIT_RLC:
+ rlca ; switch position between bits 0-3 and bits 4-7
+ rlca
+ rlca
+ rlca
+
+BLp64_SKIP_RLC:
+
+; -----------------------------------------------------------------------------
+; STANDARD OR INVERSE
+;
+BLp64_INV_C: nop ; either 'NOP' or 'CPL' (modified)
+; -----------------------------------------------------------------------------
+
+BLp64_FONT_MASK:
+ and %11110000 ; mask half of the font byte
+ ld c, a ; store half of the font byte in C
+ ld a, (de) ; get screen byte
+
+BLp64_SCR_MASK:
+ and %00001111 ; mask half of the screen byte
+ or c ; combine half screen and half font
+ ld (de), a ; write result back to screen
+ inc d ; next screen location
+ inc hl ; next font data location
+ ld a, (hl) ; store next font byte in A
+ djnz BLp64_INIT_RLC ; repeat loop 8 times (this instruction gets modified)
+
+BLp64_END_LOOP:
+ ; attributes
+ ld de,(p64_coords) ; grab coords
+ and a ; clear carry
+ rr e ; divide x by 2 to get bytes instead of nybbles
+ ld a, d ; Get Y coord
+ sra a ;
+ sra a ;
+ sra a ; Multiply by 8 60155 203 47
+ add a, 88 ; Add to attrbute base address
+ ld h, a ; Put high byte value for attribute into H.
+ ld a, d ; get y value again
+ and 7 ; set within third
+ rrca ;
+ rrca ;
+ rrca ;
+ add a, e ; add in x value
+ ld l, a ; Put low byte for attribute into l
+ ld a, (23693) ; Get permanent Colours from System Variable
+ ld (hl), a ; Write new attribute
+
+ pop hl ; restore AT_COL address
+ inc (hl) ; next column
+ bit 6, (hl) ; column lower than 64?
+ ret z ; return if so
+
+BLp64_NEXT_ROW:
+ ld (hl), b ; reset AT_COL
+ inc hl ; store AT_ROW address in HL
+ inc (hl) ; next row
+ ld a, (hl)
+ cp 24 ; row lower than 23?
+ ret c ; return if so
+ ld (hl), b ; reset AT_ROW
+ ret ; done!
+
+
+end asm
+p64coords:
+asm
+p64_coords:
+ defb 0; X Coordinate store
+ defb 0; Y Coordinate Store
+
+p64_charset: ; 60230
+ DEFB 2,2,2,2,0,2,0 ; Space !
+ DEFB 80,82,7,2,7,2,0 ; " #
+ DEFB 37,113,66,114,20,117,32 ; $ %
+ DEFB 34,84,32,96,80,96,0 ; & '
+ DEFB 36,66,66,66,66,36,0 ; ( )
+ DEFB 0,82,34,119,34,82,0 ; * +
+ DEFB 0,0,0,7,32,32,64 ; , -
+ DEFB 1,1,2,2,100,100,0 ; . /
+ DEFB 34,86,82,82,82,39,0 ; 0 1
+ DEFB 34,85,18,33,69,114,0 ; 2 3
+ DEFB 87,84,118,17,21,18,0 ; 4 5
+ DEFB 55,65,97,82,84,36,0 ; 6 7
+ DEFB 34,85,37,83,85,34,0 ; 8 9
+ DEFB 0,2,32,0,34,2,4 ; : ;
+ DEFB 0,16,39,64,39,16,0 ; < =
+ DEFB 2,69,33,18,32,66,0 ; > ?
+ DEFB 98,149,183,181,133,101,0 ; @ A
+ DEFB 98,85,100,84,85,98,0 ; B C
+ DEFB 103,84,86,84,84,103,0 ; D E
+ DEFB 114,69,116,71,69,66,0 ; F G
+ DEFB 87,82,114,82,82,87,0 ; H I
+ DEFB 53,21,22,21,85,37,0 ; J K
+ DEFB 69,71,71,69,69,117,0 ; L M
+ DEFB 82,85,117,117,85,82,0 ; N O
+ DEFB 98,85,85,103,71,67,0 ; P Q
+ DEFB 98,85,82,97,85,82,0 ; R S
+ DEFB 117,37,37,37,37,34,0 ; T U
+ DEFB 85,85,85,87,39,37,0 ; V W
+ DEFB 85,85,37,82,82,82,0 ; X Y
+ DEFB 119,20,36,36,68,119,0 ; Z [
+ DEFB 71,65,33,33,17,23,0 ; \ ]
+ DEFB 32,112,32,32,32,47,0 ; ^ _
+ DEFB 32,86,65,99,69,115,0 ; £ a
+ DEFB 64,66,101,84,85,98,0 ; b c
+ DEFB 16,18,53,86,84,35,0 ; d e
+ DEFB 32,82,69,101,67,69,2 ; f g
+ DEFB 66,64,102,82,82,87,0 ; h i
+ DEFB 20,4,53,22,21,85,32 ; j k
+ DEFB 64,69,71,71,85,37,0 ; l m
+ DEFB 0,98,85,85,85,82,0 ; n o
+ DEFB 0,99,85,85,99,65,65 ; p q
+ DEFB 0,99,84,66,65,70,0 ; r s
+ DEFB 64,117,69,69,85,34,0 ; t u
+ DEFB 0,85,85,87,39,37,0 ; v w
+ DEFB 0,85,85,35,81,85,2 ; x y
+ DEFB 0,113,18,38,66,113,0 ; z {
+ DEFB 32,36,34,35,34,36,0 ; | {
+ DEFB 6,169,86,12,6,9,6 ; ~ (c)
+
+p64_END:
+End Asm
+End Sub
+```
+
+There's an example of usage here:
+
+```
+REM Example
+
+DIM n,x,y as uInteger
+CLS
+
+FOR n=1 to 1000
+ y=rnd*23
+ x=rnd*62
+
+ ink rnd*8
+
+ printat64(y, x)
+ print64 ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"(n MOD 26 TO n MOD 26))
+NEXT n
+END
+```
diff --git a/docs/library/print64x32.bas.md b/docs/library/print64x32.bas.md
new file mode 100644
index 000000000..c9c6f61de
--- /dev/null
+++ b/docs/library/print64x32.bas.md
@@ -0,0 +1,442 @@
+#Print64x32.bas
+
+This 64 column printing routine allows text to be 4 pixels wide instead of 8.
+It is NOT proportional printing, but this is still useful for lining things up in columns.
+This further enhances the screen by allowing 32 rows of 6 pixels instead of 24 rows of 8 pixels.
+This allows 2048 character positions on the screen.
+
+Note that the screen tables file, needed for inclusion, can be downloaded from the forum
+thread http://www.boriel.com/forum/wishlist/64-char-print-32-lines-version-t680.html
+
+##Usage
+
+```
+Print64x32At(y,x)
+```
+
+Moves the print64 system's print cursor to row Y, column X. Note that 0<= x <= 63 -
+ that is the range of values for X can be up to 63. The range of values for Y is 0-31.
+* Note that the `print64x32` system's cursor position is independent from that of the
+ZX Basic Print routine, or any other, such as the print42 system.
+
+
+```
+Print64x32(STRING)
+```
+
+
+Prints the string to the screen at the current Print64 co-ordinates.
+It does so in the current permanent colours.
+
+```
+Print64x32StringAt(y,x,text$)
+```
+
+
+An All in one function - sets the AT position, and prints the string.
+
+> NOTE: The ZX Spectrum's attribute system is encoded into the hardware as a 32x24 character grid.
+> This current version of print64x32 does not touch the attributes, as they would not line up well
+> with the text.
+
+##CODE
+
+```
+SUB Print64x32At(Y as uByte,X as UByte)
+ Poke(@Print64x32XCoord),X
+ Poke (@Print64x32XCoord+1),Y
+END SUB
+
+SUB Print64x32StringAt(y as ubyte,x as ubyte,text$ as string)
+ Print64x32At(y,x)
+ Print64x32(text$)
+END SUB
+
+SUB Print64x32 (info as String)
+ASM
+; HL Points to string. Length, followed by bytes.
+ LD C,(HL)
+ INC HL
+ LD B,(HL)
+ INC HL
+; BC Now contains our string length.
+; HL Now points to first character.
+
+Print64x32StringLoop:
+ LD A,(HL)
+
+ PUSH BC
+ PUSH HL
+ CALL Print64x32Char
+ POP HL
+ POP BC
+ Call Print64x32UpdateCoordinates
+
+ DEC BC
+ LD A,B
+ OR C
+ JP Z,Print64x32End
+
+ INC HL
+ JP Print64x32StringLoop
+ JP Print64x32End
+
+Print64x32Char:
+; Arrives with Character in A
+ LD L,A ; HL=A*3
+ LD H,0 ; |
+ ADD HL,HL ; |
+ ADD A,L ; |
+ LD L,A ; |
+ JR NC, Print64x32CharHop1 ; |
+ INC H ; |
+
+Print64x32CharHop1: ; v
+ LD DE,Print64x32CharSet-96 ;Offset is because space=32, and it's a 3 byte table - so we go 96 bytes too far forward when mult by 3.
+ ADD HL,DE
+; HL now points to Correct Character.
+
+ LD BC,(Print64x32_X_Coord) ; Loads Y,X into BC
+ LD A,B ; B=B*6
+ ADD A,A ; |
+ LD B,A ; |
+ ADD A,A ; |
+ ADD A,B ; |
+ LD B,A ; v
+; B now has 0-191 value for Y. C has X value in 0-63 format.
+
+ CALL Print64x32ScreenAddress
+; DE now points at the screen address we need.
+ LD A,C
+ AND 1
+ LD A,%00001111
+ JP NZ,Print64x32RightSide
+
+Print64x32LeftSide:
+ EXX
+ LD D,3
+
+Print64x32LeftSideLoop:
+ EXX
+ LD A,(HL)
+ AND %11110000
+ EXX
+ LD E,A
+ EXX
+ LD A,(DE)
+ AND %00001111
+ EXX
+ OR E
+ EXX
+ LD (DE),A
+ INC B
+ CALL Print64x32ScreenAddress
+ ; HL Now has 2nd Line
+
+ LD A,(HL)
+ AND %00001111 ; Grab second four bits.
+ RLCA ; Push to left side of byte.
+ RLCA
+ RLCA
+ RLCA
+
+ EXX
+ LD C,A
+ EXX
+ LD A,(DE)
+ AND %00001111
+ EXX
+ OR C
+ EXX
+ LD (DE),A
+
+ INC HL
+ INC B
+ CALL Print64x32ScreenAddress
+
+ EXX
+ DEC D
+ JR NZ, Print64x32LeftSideLoop
+ EXX
+
+ RET
+
+Print64x32RightSide:
+ EXX
+ LD D,3
+
+Print64x32RightSideLoop:
+ EXX
+
+ LD A,(HL)
+ AND %11110000
+ RRCA ;Push to right side.
+ RRCA
+ RRCA
+ RRCA
+
+ EXX
+ LD E,A
+ EXX
+ LD A,(DE)
+ AND %1111000
+ EXX
+ OR E
+ EXX
+ LD (DE),A
+
+ INC B
+ CALL Print64x32ScreenAddress
+ ; HL Now has 2nd Line
+
+ LD A,(HL)
+ AND %00001111 ; Grab second four bits.
+
+ EXX
+ LD C,A
+ EXX
+ LD A,(DE)
+ AND %11110000
+ EXX
+ OR C
+ EXX
+ LD (DE),A
+
+ INC HL
+ INC B
+ CALL Print64x32ScreenAddress
+
+ EXX
+ DEC D
+ JR NZ, Print64x32RightSideLoop
+ EXX
+RET
+
+
+; Screen address.
+Print64x32ScreenAddress:
+
+ EX DE,HL
+ LD H,ScreenTables/256
+ LD L,B
+ LD A,(HL)
+ INC H
+ LD L,(HL)
+ LD H,A
+
+ LD A,C
+ SRL A ; Divide A(xcoord) by 2.
+ ADD A,L
+ LD L,A
+ EX DE,HL
+ RET
+
+; Update Coordinates
+Print64x32UpdateCoordinates:
+ LD A,(Print64x32_X_Coord)
+ INC A
+ CP 64
+ JR Z,Print64x32OffLine
+ LD (Print64x32_X_Coord),A
+ RET
+
+Print64x32OffLine:
+ XOR A
+
+ LD (Print64x32_X_Coord),A
+ LD A,(Print64x32_Y_Coord)
+ INC A
+ CP 33
+ JR Z, Print64x32OffScreen
+ LD (Print64x32_Y_Coord),A
+ RET
+
+; Could scroll instead? Right now go back to top.
+Print64x32OffScreen:
+ XOR A
+ LD (Print64x32_Y_Coord),A
+ RET
+
+Print64x32End:
+END ASM
+
+RETURN
+
+Print64x32XCoord:
+ASM
+; Variables
+Print64x32_X_Coord:
+DEFB 1
+Print64x32_Y_Coord:
+DEFB 10
+
+#INCLUDE ONCE "ScreenTables.asm"
+
+Print64x32CharSet:
+DEFB 0,0,0 ; SPACE
+DEFB 34,32,32 ; !
+DEFB 85,0,0 ; "
+DEFB 87,87,80 ; #
+DEFB 54,35,96 ; $
+DEFB 65,36,16 ; %
+DEFB 53,37,96 ; &
+DEFB 18,0,0 ; '
+DEFB 36,68,32 ; (
+DEFB 33,17,32 ; )
+DEFB 82,114,80 ; *
+DEFB 2,114,0 ; +
+DEFB 0,2,64 ; ,
+DEFB 0,112,0 ; -
+DEFB 0,0,32 ; .
+DEFB 17,36,64 ; /
+DEFB 37,85,32 ; 0
+DEFB 38,34,112 ; 1
+DEFB 37,18,112 ; 2
+DEFB 97,97,96 ; 3
+DEFB 19,87,16 ; 4
+DEFB 116,97,96 ; 5
+DEFB 52,101,32 ; 6
+DEFB 113,18,64 ; 7
+DEFB 37,37,32 ; 8
+DEFB 37,49,96 ; 9
+DEFB 2,2,0 ; :
+DEFB 2,2,64 ; ;
+DEFB 18,66,16 ; <
+DEFB 7,7,0 ; =
+DEFB 66,18,64 ; >
+DEFB 97,32,32 ; ?
+DEFB 97,53,112 ; @
+DEFB 37,117,80 ; A
+DEFB 101,101,96 ; B
+DEFB 37,69,32 ; C
+DEFB 101,85,96 ; D
+DEFB 116,116,112; E
+DEFB 116,116,64 ; F
+DEFB 37,69,112 ; G
+DEFB 85,117,80 ; H
+DEFB 114,34,112 ; I
+DEFB 17,21,32 ; J
+DEFB 85,102,80 ; K
+DEFB 68,68,112 ; L
+DEFB 87,85,80 ; M
+DEFB 101,85,80 ; N
+DEFB 117,85,112 ; O
+DEFB 101,100,64 ; P
+DEFB 37,85,48 ; Q
+DEFB 101,102,80 ; R
+DEFB 52,33,96 ; S
+DEFB 114,34,32 ; T
+DEFB 85,85,96 ; U
+DEFB 85,85,32 ; V
+DEFB 85,87,80 ; W
+DEFB 85,37,80 ; X
+DEFB 85,34,32 ; Y
+DEFB 113,36,112 ; Z
+DEFB 100,68,96 ; [
+DEFB 68,33,16 ; \
+DEFB 49,17,48 ; ]
+DEFB 39,34,32 ; ^
+DEFB 0,0,15 ; _
+DEFB 37,100,112 ; £
+DEFB 6,53,112 ; a
+DEFB 70,85,96 ; b
+DEFB 3,68,48 ; c
+DEFB 19,85,48 ; d
+DEFB 3,86,48 ; e
+DEFB 37,70,64 ; f
+DEFB 3,83,96 ; g
+DEFB 68,117,80 ; h
+DEFB 64,68,96 ; i
+DEFB 16,17,48 ; j
+DEFB 69,102,80 ; k
+DEFB 68,68,48 ; l
+DEFB 5,117,80 ; m
+DEFB 6,85,80 ; n
+DEFB 7,85,112 ; o
+DEFB 7,87,64 ; p
+DEFB 7,87,16 ; q
+DEFB 7,68,64 ; r
+DEFB 6,66,96 ; s
+DEFB 71,68,48 ; t
+DEFB 5,85,96 ; u
+DEFB 5,85,32 ; v
+DEFB 5,87,80 ; w
+DEFB 5,34,80 ; x
+DEFB 5,113,96 ; y
+DEFB 7,36,112 ; z
+DEFB 50,66,48 ; {
+DEFB 34,34,32 ; |
+DEFB 98,18,96 ; }
+DEFB 2,80,0 ; ~
+DEFB 3,67,0 ; ©
+DEFB 0,0,0 ; <8> (Block Graphics)
+DEFB 51,48,0 ; TR <1> (Block Graphics)
+DEFB 204,192,0 ; TL <2> (Block Graphics)
+DEFB 255,240,0 ; Top <3> (Block Graphics)
+DEFB 0,3,51 ; BR <4> (Block Graphics)
+DEFB 51,51,51 ; Right <5> (Block Graphics)
+DEFB 204,195,51 ; TL&BR <6> (Block Graphics)
+DEFB 255,243,51 ; TL + Right <7> (Block Graphics)
+DEFB 0,12,204 ; BL (Block Graphics)
+DEFB 51,60,204 ; BL&TR (Block Graphics)
+DEFB 204,204,204; Left (Block Graphics)
+DEFB 255,252,204; Left + TR (Block Graphics)
+DEFB 0,15,255 ; Bottom (Block Graphics)
+DEFB 51,63,255 ; BL + Right (Block Graphics)
+DEFB 204,207,255; Left + BR (Block Graphics)
+DEFB 255,255,255; All 4 (Block Graphics)
+END ASM
+Print64x32Udg:
+ASM
+Print64x32Udg:
+DEFB 218,138,175 ; UDG A
+DEFB 154,154,159 ; UDG B
+DEFB 218,186,223 ; UDG C
+DEFB 154,170,159 ; UDG D
+DEFB 139,139,143 ; UDG E
+DEFB 139,139,191 ; UDG F
+DEFB 218,186,143 ; UDG G
+DEFB 170,138,175 ; UDG H
+DEFB 141,221,143 ; UDG I
+DEFB 238,234,223 ; UDG J
+DEFB 170,153,175 ; UDG K
+DEFB 187,187,143 ; UDG L
+DEFB 168,170,175 ; UDG M
+DEFB 154,170,175 ; UDG N
+DEFB 138,170,143 ; UDG O
+DEFB 154,155,191 ; UDG P
+DEFB 218,170,207 ; UDG Q
+DEFB 154,153,175 ; UDG R
+DEFB 203,222,159 ; UDG S
+DEFB 141,221,223 ; UDG T
+DEFB 170,170,159 ; UDG U
+END ASM
+
+END SUB
+```
+
+##Example
+
+```
+CLS
+BORDER 2
+
+Print64x32StringAt(5,05,"T")
+Print64x32StringAt(6,10,"U")
+Print64x32StringAt(7,15,"V")
+Print64x32StringAt(8,20,"W")
+Print64x32StringAt(9,25,"X")
+Print64x32StringAt(10,30,"Y")
+Print64x32StringAt(11,35,"Z")
+
+Print64x32StringAt(31,15,"Hello World! :) ")
+Print64x32StringAt(15,5,"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")
+Print64x32At(0,0)
+
+For n=32 to 164
+Print64x32(CHR$(n)+" ")
+next n
+
+PAUSE 1
+PAUSE 0
+```
diff --git a/docs/library/propprint.bas.md b/docs/library/propprint.bas.md
new file mode 100644
index 000000000..a7f65d75a
--- /dev/null
+++ b/docs/library/propprint.bas.md
@@ -0,0 +1,650 @@
+#PropPrint.bas
+
+This proportional printing routine is ideal for making text more readable.
+Do NOT use it for tables - letter positions move around within the lines depending what the text is. For tables,
+use a fixed width routine - either the system 32 chars per line,
+or the [42 chars per line](print42.bas.md) version listed in the library.
+
+##usage
+
+`propPrint(xPosition, yPosition, SizeOfSpaceCharacter, GapBetweenLetters, "Text")`
+
+> Note: X and Y are pixel positions. Note that unlike Print and Print42, this routine in in the form (x,y), not (y,x). That can easily be changed in the declaration below. [Just swap x and y].
+
+`SizeOfSpaceCharacter` is the width of a space.
+`GapBetweenLetters` can be as small as zero - though the letters crash into each other,
+so it doesn't look wonderful. 1 pixel is probably the most common setting for this.
+Text is anything that's valid as a string - either a `String` literal, or a variable.
+
+
+```
+' Proportional printing anywhere on screen.
+' Original routine by Christoph Odenthal (Odin)
+' ZXBC modification by Leszek Chmielewski (LCD)
+' Thanks to Boriel and Britlion for help and hints
+
+sub propPrint(x as ubyte,y as ubyte,spacesize as ubyte, xgap as ubyte,txt$ as string)
+dim b$ as string '
+b$=txt$+chr(0)
+poke Uinteger @PropPrintTxtadr,PEEK(Uinteger, @b$)+2 'textadr
+poke @PropPrintTxtadr+2,x
+poke @PropPrintTxtadr+3,y
+poke @PropPrintTxtadr+4,spacesize
+poke @PropPrintTxtadr+5,xgap
+PropPrint:
+Asm
+;' --------------------------------
+;' Free Size N Place Text Print
+;' --------------------------------
+;' (c) 14.09.2002 C.Odenthal
+;'
+;' Last Modifications: 15.10.2002
+;' Modification for Boriels ZXBC
+;' By Leszek Chmielewski 02.06.2010
+;' --------------------------------
+;' ORG 32000
+;' DUMP 45000
+;' --------------------------------
+;' Entry point
+;' --------------------------------
+Start:
+ JR Start2
+;' --------------------------------
+;' Parameter
+;' --------------------------------
+end asm
+PropPrintTxtadr:
+asm
+text_addr:
+ DEFW 0 ;' Addr of text
+x_pos:
+ DEFB 4 ;' Pos of text
+y_pos:
+ DEFB 4
+spc_size:
+ DEFB 3 ;' Width of space char
+x_gap:
+ DEFB 1 ;' Gap between chars
+y_gap:
+ DEFB 1 ;' Gap between lines
+end_symb:
+ DEFB 0 ;' End of line char code
+x_start:
+ DEFB 0 ;' Start of window
+y_start:
+ DEFB 0
+x_end:
+ DEFB 255 ;' End of window
+y_end:
+ DEFB 191
+x_zoom:
+ DEFB 1 ;' Zooming factor
+y_zoom:
+ DEFB 1
+
+;' --------------------------------
+;' Main routine
+;' --------------------------------
+
+Start2:
+ LD A,(x_pos) ;' Calc. scr addr.
+ LD B,A
+ LD A,(y_pos)
+ LD C,A
+ CALL PosToScr
+ LD (scr_ad),DE ;' Store scr addr.
+ LD A,L
+ LD (pix_pos),A
+ LD A,(end_symb) ;' Get line ending char
+ LD (poke_here+1),A ;' Poke it into memory below
+ LD HL,(text_addr)
+Main_Loop:
+ LD A,(HL);' Get char
+poke_here:
+ CP 0 ;' End of text? (poked!)
+ JP Z,Exit1
+ INC HL
+ PUSH HL
+ CP 32 ;' Replace ctrl chars
+ JP NC,No_Ctrl
+ LD A,32
+No_Ctrl:
+ CALL Copy_Chr ;' Copy char-gfx to work-buffer
+ CALL Measure ;' Measure left rim + width
+ PUSH BC ;' (Save results)
+ LD A,C ;' No pixel set in char?
+ AND A
+ JP Z,Space_Chr
+ LD A,(pix_pos);' size+bitpos (=1..15)
+ ADD A,C
+ CP 9 ;' > 8 ?
+ JP NC,Overlap ;' Char overlaps
+;' Calculate 8 bit rotation
+ LD A,(pix_pos) ;' bitpos-l_rim (=-7..7)
+ SUB B
+ AND A ;' = 0 ?
+ JP Z,PrintIt8
+ JP C,Neg_8 ;' < 0 ?
+;' --------------------------------
+ CP 5 ;' Not in 1..4 ?
+ JP NC,Left_8
+;' --------------------------------
+ LD B,A
+ CALL Chr_Rgt8 ;' Rotate right 8 bit
+ JP PrintIt8
+;' --------------------------------
+Left_8:
+ NEG ;' = 8 - A
+ ADD A,8
+ LD B,A
+ CALL Chr_Left8 ;' Rotate left 8 bit
+ JP PrintIt8
+;' --------------------------------
+Neg_8:
+ NEG
+ CP 5 ;' Not in 1..4 ?
+ JP NC,Right_8
+;' --------------------------------
+ LD B,A
+ CALL Chr_Left8 ;' Rotate left 8 bit
+ JP PrintIt8
+;' --------------------------------
+Right_8:
+ NEG ;' = 8 - A
+ ADD A,8
+ LD B,A
+ CALL Chr_Rgt8 ;' Rotate right 8 bit
+ JP PrintIt8
+;' --------------------------------
+;' Calculate 16 bit rotation
+;' --------------------------------
+Overlap:
+ LD A,(pix_pos);' bitpos-l_rim (=-7..7)
+ SUB B
+ AND A ;' = 0 ?
+ JP Z,PrintIt8
+;' --------------------------------
+ LD B,A
+ CALL Chr_Rgt16 ;' Rotate right 16 bit
+PrintIt16:
+ LD DE,(scr_ad);' Check for screen end
+ LD A,E
+ AND 31
+ CP 31 ;' (2nd byte outside ?)
+ JP Z,Outside
+ CALL Print16 ;' Display char (16 bit)
+ JP Next_Loc
+;' --------------------------------
+PrintIt8:
+ LD DE,(scr_ad);' Display char (8 bit)
+ CALL Print8
+ JP Next_Loc
+;' --------------------------------
+Space_Chr:
+ LD A,(spc_size);' Skip pixels
+ LD DE,(scr_ad);' Get screen addr.
+ POP BC ;' Throw away values
+ LD B,0
+ LD C,A
+ JP Next_Loc2
+;' --------------------------------
+Next_Loc:
+ POP BC ;' Move to next char location
+Next_Loc2:
+ LD A,(pix_pos);' =bitpos+x_gap+size
+ LD L,A
+ LD A,(x_gap)
+ ADD A,L
+ ADD A ,C
+ LD L ,A
+ AND 7 ;' New pix_pos
+ LD (pix_pos),A
+ LD H,0 ;' =result/8
+ SRL L
+ SRL L
+ SRL L
+ ADD HL,DE ;' New byte pos
+ LD A ,E ;' Check for screen end
+ AND 31
+ LD E,A
+ LD A,L
+ AND 31
+ CP E ;' New pos smaller than old ?
+ JP C ,Exit2 ;' -> End of printing
+ LD (scr_ad),HL ;' Store new scr ad.
+ POP HL ;' Restore text pointer
+ JP Main_Loop
+;' --------------------------------
+Outside:
+ POP BC ;' Stop printing
+ POP HL ;' Char not printed!
+ DEC HL
+ JP Exit1
+;' --------------------------------
+Exit2:
+ POP HL ;' Return nr of printed chars
+Exit1:
+ LD DE,(text_addr)
+ XOR A
+ SBC HL,DE
+ LD B,H ;' Return value in BC to Basic
+ LD C,L
+ jp PropPrintTxtadr2
+;' --------------------------------
+;' Calc. scr adr from x,y
+;' --------------------------------
+;' In : B = x / C = y (preserved)
+;' Out: DE = scr adr / L = pixpos
+;' Usd: A, BC, DE, L
+;' --------------------------------
+PosToScr:
+ LD A,C ;' Range check
+ CP 185
+ JP C,ValOk
+ LD C,184
+ValOk:
+ LD A,B ;' Pix pos
+ AND 7
+ LD L,A
+ LD E,B
+ SRL E
+ SRL E
+ SRL E
+ LD A,C ;' Scr pos
+ AND 7
+ LD D,A
+ LD A,C
+ AND 56
+ RLA
+ RLA
+ OR E
+ LD E,A
+ LD A,C
+ AND 192
+ RRA
+ RRA
+ RRA
+ OR D
+ OR 64
+ LD D,A
+ RET
+;' --------------------------------
+;' Copy char into buffer
+;' --------------------------------
+;' In : A = Char
+;' Out: -
+;' Usd: A, HL, DE, BC
+;' --------------------------------
+Copy_Chr:
+ LD DE,(23606);' SysVar CHARS
+ LD H,0
+ LD L,A
+ ADD HL,HL ;' * 8
+ ADD HL,HL
+ ADD HL,HL
+ ADD HL,DE ;' + Chartable
+ EX DE,HL
+ LD HL,Chr_Buf
+ LD B,8
+Copy_Loop:
+ LD A,(DE);' Double to 16 pixel/row
+ INC DE
+ LD (HL),A ;' Low-byte in memory!
+ INC HL
+ LD (HL),0 ;' High-byte in memory!
+ INC HL
+ DJNZ Copy_Loop
+ RET
+;' --------------------------------
+;' Measure left border and width
+;' --------------------------------
+;' In : -
+;' Out: B = left rim / C = width
+;' Usd: A, HL, BC
+;' --------------------------------
+Measure:
+ LD HL,Chr_Buf ;' "OR" together all 8 bytes
+ LD B,8
+ XOR A
+Msr_Loop:
+ OR (HL)
+ INC HL
+ INC HL
+ DJNZ Msr_Loop
+ LD BC,0
+ AND A ;' Check if zero
+ RET Z
+Msr_Loop2:
+ INC B ;' Measure left border
+ RLCA
+ JP NC,Msr_Loop2
+ RRCA
+ DEC B
+ LD C,9 ;' Measure width
+Msr_Loop3:
+ DEC C
+ RRCA
+ JP NC,Msr_Loop3
+ RET
+;' --------------------------------
+;' Move char to left, 8 bit
+;' --------------------------------
+;' In : B = Nr of bits to shift
+;' Out: -
+;' Usd: A, B, HL
+;' --------------------------------
+Chr_Left8:
+ PUSH BC
+ LD HL,Chr_Buf ;' Rotate char left 8 bit
+ LD C,B ;' 1st row
+ LD A,(HL )
+Chr_LLp1:
+ RLCA
+ DJNZ Chr_LLp1
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 2nd row
+ LD A,(HL)
+Chr_LLp2:
+ RLCA
+ DJNZ Chr_LLp2
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 3rd row
+ LD A ,(HL)
+Chr_LLp3:
+ RLCA
+ DJNZ Chr_LLp3
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 4th row
+ LD A,(HL)
+Chr_LLp4:
+ RLCA
+ DJNZ Chr_LLp4
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 5th row
+ LD A,(HL)
+Chr_LLp5:
+ RLCA
+ DJNZ Chr_LLp5
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 6th row
+ LD A,(HL)
+Chr_LLp6:
+ RLCA
+ DJNZ Chr_LLp6
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 7th row
+ LD A,(HL)
+Chr_LLp7:
+ RLCA
+ DJNZ Chr_LLp7
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 8th row
+ LD A,(HL)
+Chr_LLp8:
+ RLCA
+ DJNZ Chr_LLp8
+ LD (HL),A
+ LD B,C
+ POP BC
+ RET
+;' --------------------------------
+;' Move char to right, 8 bit
+;' --------------------------------
+;' In : B = Nr of bits to shift
+;' Out: -
+;' Usd: A, B, HL
+;' --------------------------------
+Chr_Rgt8:
+ PUSH BC
+ LD HL,Chr_Buf ;' Rotate char right 8 bit
+ LD C,B ;' 1st row
+ LD A,(HL)
+Chr_RLp1:
+ RRCA
+ DJNZ Chr_RLp1
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 2nd row
+ LD A,(HL)
+Chr_RLp2:
+ RRCA
+ DJNZ Chr_RLp2
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 3rd row
+ LD A,(HL)
+Chr_RLp3:
+ RRCA
+ DJNZ Chr_RLp3
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 4th row
+ LD A,(HL)
+Chr_RLp4:
+ RRCA
+ DJNZ Chr_RLp4
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 5th row
+ LD A,(HL)
+Chr_RLp5:
+ RRCA
+ DJNZ Chr_RLp5
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 6th row
+ LD A ,(HL )
+Chr_RLp6:
+ RRCA
+ DJNZ Chr_RLp6
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 7th row
+ LD A,(HL)
+Chr_RLp7:
+ RRCA
+ DJNZ Chr_RLp7
+ LD (HL),A
+ LD B,C
+ INC HL
+ INC HL
+ LD C,B ;' 8th row
+ LD A,(HL)
+Chr_RLp8:
+ RRCA
+ DJNZ Chr_RLp8
+ LD (HL),A
+ LD B,C
+ POP BC
+ RET
+;' --------------------------------
+;' Move char to right 16 bit
+;' --------------------------------
+;' In : B = Nr of bits to shift
+;' Out:
+;' Usd: A, B, HL
+;' --------------------------------
+Chr_Rgt16:
+ LD HL,(Chr_Buf);' Rotate char right 16 bit
+ LD A,B ;' 1st row
+Chr_R2Lp1:
+ SRL L
+ RR H ;' Insert carry
+ DJNZ Chr_R2Lp1
+ LD B,A
+ LD (Chr_Buf),HL
+ LD HL,(Chr_Buf+2);' 2nd row
+ LD A,B
+Chr_R2Lp2:
+ SRL L
+ RR H ;' Insert carry
+ DJNZ Chr_R2Lp2
+ LD B,A
+ LD (Chr_Buf+2),HL
+ LD HL,(Chr_Buf+4);' 3rd row
+ LD A,B
+Chr_R2Lp3:
+ SRL L
+ RR H ;' Insert carry
+ DJNZ Chr_R2Lp3
+ LD B,A
+ LD (Chr_Buf+4),HL
+ LD HL,(Chr_Buf+6);' 4th row
+ LD A,B
+Chr_R2Lp4:
+ SRL L
+ RR H ;' Insert carry
+ DJNZ Chr_R2Lp4
+ LD B,A
+ LD (Chr_Buf+6),HL
+ LD HL,(Chr_Buf+8);' 5th row
+ LD A,B
+Chr_R2Lp5:
+ SRL L
+ RR H ;' Insert carry
+ DJNZ Chr_R2Lp5
+ LD B,A
+ LD (Chr_Buf+8),HL
+ LD HL,(Chr_Buf+10);' 6th row
+ LD A,B
+Chr_R2Lp6:
+ SRL L
+ RR H ;' Insert carry
+ DJNZ Chr_R2Lp6
+ LD B,A
+ LD (Chr_Buf+10),HL
+ LD HL,(Chr_Buf+12);' 7th row
+ LD A,B
+Chr_R2Lp7:
+ SRL L
+ RR H ;' Insert carry
+ DJNZ Chr_R2Lp7
+ LD B,A
+ LD (Chr_Buf+12),HL
+ LD HL,(Chr_Buf+14);' 8th row
+ LD A,B
+Chr_R2Lp8:
+ SRL L
+ RR H ;'Insert carry
+ DJNZ Chr_R2Lp8
+ LD B,A
+ LD (Chr_Buf+14),HL
+ RET
+;' --------------------------------
+;' Print 8 bit wide char on screen
+;' --------------------------------
+;' In : DE = screen adr.
+;' Out: -
+;' Usd: A, HL, DE, B
+;' --------------------------------
+Print8:
+ LD HL,Chr_Buf
+ PUSH DE ;' save scr ad.
+ EX DE,HL
+ LD B,8 ;' 8 lines
+Prt8_L:
+ LD A,(DE);' set 1 byte
+ XOR (HL)
+ LD (HL),A
+ INC DE ;' skip 1 byte
+ INC DE ;' next byte
+ INC H ;' calc. next line
+ LD A,H
+ AND 7
+ JP NZ,Prt8_C
+ LD A,L
+ ADD A,32
+ LD L,A
+ JR C,Prt8_C
+ LD A,H
+ SUB 8
+ LD H,A
+Prt8_C:
+ DJNZ Prt8_L ;' next round
+ POP DE ;' restore scr ad.
+ RET
+;'--------------------------------
+;' Print 16 bit wide char on screen
+;' --------------------------------
+;' In : DE = screen adr.
+;' Out: -
+;' Usd: A, HL, DE, B
+;' --------------------------------
+Print16:
+ LD HL,Chr_Buf
+ PUSH DE ;' save scr ad.
+ EX DE,HL
+ LD B,8 ;' 8 lines
+Prt16_L:
+ LD A,(DE);' set 1 byte
+ XOR (HL)
+ LD (HL),A
+ INC HL ;' next scr pos
+ INC DE ;' next byte
+ LD A,(DE);' set 1 byte
+ XOR (HL)
+ LD (HL),A
+ DEC HL ;' prev scr pos
+ INC DE ;' next byte
+ INC H ;' calc. next line
+ LD A,H
+ AND 7
+ JP NZ,Prt16_C
+ LD A,L
+ ADD A,32
+ LD L,A
+ JR C,Prt16_C
+ LD A,H
+ SUB 8
+ LD H,A
+Prt16_C:
+ DJNZ Prt16_L ;' next round
+ POP DE ;' restore scr ad.
+ RET
+;' --------------------------------
+;' Variables
+;' --------------------------------
+Chr_Buf:
+ DEFS 16
+scr_ad:
+ DEFW 0
+pix_pos:
+ DEFB 0
+;' -----------------
+PropPrintTxtadr2:
+end asm
+end sub
+```
diff --git a/docs/library/putchars.bas.md b/docs/library/putchars.bas.md
new file mode 100644
index 000000000..46fed507a
--- /dev/null
+++ b/docs/library/putchars.bas.md
@@ -0,0 +1,299 @@
+#Putchars.bas
+
+##Putchars
+
+> **WARNING: This subroutine does not check to see if it's writing over the edge of the screen.
+This is done for speed, but it is the user's job to make sure that all data will fit on the screen!**
+
+###Usage
+There is a an example program that uses this at the end of the page.
+
+```
+putChars(x as uByte,y as uByte, width as uByte, height as uByte, dataAddress as uInteger)
+```
+
+Where
+
+* x is the x value in character co-ordinates
+* y is the y value in character co-ordinates
+* width is the width in characters
+* height is the height in characters
+* dataaddress is the memory address of the UDG style bytes for the character being printed. 8 Bytes to a character. The order is top left to bottom right, first column, then second column, and so forth.
+
+
+Prints the graphics data to the screen at the given character co-ordinates.
+
+```
+SUB putChars(x as uByte,y as uByte, width as uByte, height as uByte, dataAddress as uInteger)
+' Copyleft Britlion. Feel free to use as you will. Please attribute me if you use this, however!
+
+Asm
+ BLPutChar:
+ LD a,(IX+5)
+ ;AND 31
+ ld l,a
+ ld a,(IX+7) ; Y value
+ ld d,a
+ AND 24
+ add a,64 ; 256 byte "page" for screen - 256*64=16384. Change this if you are working with a screen address elsewhere, such as a buffer.
+ ld h,a
+ ld a,d
+ AND 7
+ rrca
+ rrca
+ rrca
+ OR l
+ ld l,a
+
+ PUSH HL ; save our address
+
+ LD E,(IX+12) ; data address
+ LD D,(IX+13)
+ LD B,(IX+9) ; width
+ PUSH BC ; save our column count
+
+ BLPutCharColumnLoop:
+
+ LD B,(IX+11) ; height
+
+ BLPutCharInColumnLoop:
+
+ ; gets screen address in HL, and bytes address in DE. Copies the 8 bytes to the screen
+ ld a,(DE) ; First Row
+ LD (HL),a
+
+ INC DE
+ INC H
+ ld a,(DE)
+ LD (HL),a ; second Row
+
+ INC DE
+ INC H
+ ld a,(DE)
+ LD (HL),a ; Third Row
+
+ INC DE
+ INC H
+ ld a,(DE)
+ LD (HL),a ; Fourth Row
+
+ INC DE
+ INC H
+ ld a,(DE)
+ LD (HL),a ; Fifth Row
+
+ INC DE
+ INC H
+ ld a,(DE)
+ LD (HL),a ; Sixth Row
+
+ INC DE
+ INC H
+ ld a,(DE)
+ LD (HL),a ; Seventh Row
+
+ INC DE
+ INC H
+ ld a,(DE)
+ LD (HL),a ; Eigth Row
+
+ INC DE ; Move to next data item.
+
+ DEC B
+ JR Z,BLPutCharNextColumn
+ ;The following code calculates the address of the next line down below current HL address.
+ PUSH DE ; save DE
+ ld a,l
+ and 224
+ cp 224
+ jp z,BLPutCharNextThird
+
+ BLPutCharSameThird:
+ ld de,-1760
+ ;and a
+ add hl,de
+ POP DE ; get our data point back.
+ jp BLPutCharInColumnLoop
+
+ BLPutCharNextThird:
+ ld de,32
+ ;and a
+ add hl,de
+ POP DE ; get our data point back.
+ JP BLPutCharInColumnLoop
+
+ BLPutCharNextColumn:
+ POP BC
+ POP HL
+ DEC B
+ JP Z, BLPutCharsEnd
+
+ INC L ; Note this would normally be Increase HL - but block painting should never need to increase H, since that would wrap around.
+ PUSH HL
+ PUSH BC
+ JP BLPutCharColumnLoop
+
+
+BLPutCharsEnd:
+
+End Asm
+END SUB
+```
+
+
+##Paint
+
+Prints the colour data to the screen at the given character co-ordinates.
+
+## Syntax
+```
+paint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
+```
+
+Where
+* x is the x value in character co-ordinates
+* y is the y value in character co-ordinates
+* width is the width in characters
+* height is the height in characters
+* attribute is the byte value of the attribute to paint to the given co-ordinates. (As one would get from the ATTR function)
+
+###Usage
+There is a an example program after the source code.
+
+
+```
+SUB paint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
+REM Copyleft Britlion. Feel free to use as you will. Please attribute me if you use this, however!
+
+Asm
+ ld a,(IX+7) ;ypos
+ rrca
+ rrca
+ rrca ; Multiply by 32
+ ld l,a ; Pass to L
+ and 3 ; Mask with 00000011
+ add a,88 ; 88 * 256 = 22528 - start of attributes. Change this if you are working with a buffer or somesuch.
+ ld h,a ; Put it in the High Byte
+ ld a,l ; We get y value *32
+ and 224 ; Mask with 11100000
+ ld l,a ; Put it in L
+ ld a,(IX+5) ; xpos
+ add a,l ; Add it to the Low byte
+ ld l,a ; Put it back in L, and we're done. HL=Address.
+
+ push HL ; save address
+ LD A, (IX+13) ; attribute
+ LD DE,32
+ LD c,(IX+11) ; height
+
+ BLPaintHeightLoop:
+ LD b,(IX+9) ; width
+
+ BLPaintWidthLoop:
+ LD (HL),a ; paint a character
+ INC L ; Move to the right (Note that we only would have to inc H if we are crossing from the right edge to the left, and we shouldn't be needing to do that)
+ DJNZ BLPaintWidthLoop
+
+ BLPaintWidthExitLoop:
+ POP HL ; recover our left edge
+ DEC C
+ JR Z, BLPaintHeightExitLoop
+
+ ADD HL,DE ; move 32 down
+ PUSH HL ; save it again
+ JP BLPaintHeightLoop
+
+ BLPaintHeightExitLoop:
+end asm
+END SUB
+```
+
+##PaintData
+Copies the colour data to the screen at the given character co-ordinates.
+The order here is Rows and then Columns; so first row, then second row and so on.
+While this may be awkward, being the other way around to the pixel data, these orders
+are the most efficient speedwise.
+
+Where
+* x is the x value in character co-ordinates
+* y is the y value in character co-ordinates
+* width is the width in characters
+* height is the height in characters
+* address is the address of the data to copy to the screen's attribute area.
+
+###Usage
+There is a an example program that uses this at the end of the page.
+
+```
+paintData (x as uByte,y as uByte, width as uByte, height as uByte, address as uInteger)
+```
+
+```
+SUB paintData (x as uByte,y as uByte, width as uByte, height as uByte, address as uInteger)
+REM Copyleft Britlion. Feel free to use as you will. Please attribute me if you use this, however!
+
+Asm
+ ld a,(IX+7) ;ypos
+ rrca
+ rrca
+ rrca ; Multiply by 32
+ ld l,a ; Pass to L
+ and 3 ; Mask with 00000011
+ add a,88 ; 88 * 256 = 22528 - start of attributes. Change this if you are working with a buffer or somesuch.
+ ld h,a ; Put it in the High Byte
+ ld a,l ; We get y value *32
+ and 224 ; Mask with 11100000
+ ld l,a ; Put it in L
+ ld a,(IX+5) ; xpos
+ add a,l ; Add it to the Low byte
+ ld l,a ; Put it back in L, and we're done. HL=Address.
+
+ push HL ; save address
+ LD D, (IX+13)
+ LD E, (IX+12)
+ LD c,(IX+11) ; height
+
+ BLPaintDataHeightLoop:
+ LD b,(IX+9) ; width
+
+ BLPaintDataWidthLoop:
+ LD a,(DE)
+ LD (HL),a ; paint a character
+ INC L ; Move to the right (Note that we only would have to inc H if we are crossing from the right edge to the left, and we shouldn't be needing to do that)
+ INC DE
+ DJNZ BLPaintDataWidthLoop
+
+ BLPaintDataWidthExitLoop:
+ POP HL ; recover our left edge
+ DEC C
+ JR Z, BLPaintDataHeightExitLoop
+ PUSH DE
+ LD DE,32
+ ADD HL,DE ; move 32 down
+ POP DE
+ PUSH HL ; save it again
+ JP BLPaintDataHeightLoop
+
+ BLPaintDataHeightExitLoop:
+End Asm
+END SUB
+```
+
+##Example Program
+
+```
+goto start
+
+datapoint:
+Asm
+ defb 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
+ defb 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
+ defb 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96
+ defb 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128
+End Asm
+
+start:
+cls
+putChars(10,10,3,3,@datapoint)
+paint(10,10,3,3,79)
+```
diff --git a/docs/library/puttile.md b/docs/library/puttile.md
new file mode 100644
index 000000000..136d84cd8
--- /dev/null
+++ b/docs/library/puttile.md
@@ -0,0 +1,301 @@
+#PutTile
+
+# putTile.bas
+
+This subroutine takes a 2X2 tile of data from the given address and copies
+it to the screen co-ordinates at (x, y) - x and y in character addresses, where 0 <= x <= 31 and 0 <= y < =23.
+
+Note that this uses pushes and pops to move the data, using the fastest known data moving algorithm for the Z80.
+As a consequence, while active it uses ALL the registers, including alternates and IY and IX as well as the
+Stack Pointer SP. It is kind enough to put these back for the purposes of exiting the subroutine
+though - ZX BASIC uses that register quite extensively.
+
+Also, interrupts are disabled while the copying is happening. Considering that the stack pointer
+is likely pointing either at the screen or the tile data, an interrupt would be disastrous.
+If interrupts were enabled when the SUB is called, it should re-enable them again on exit.
+
+Note the data format is across the tile - 2 bytes for the top row, then 2 bytes for the second row...and
+so on until there are 2 bytes for the 16th row. Then two bytes for the top two attributes, and 2 for the bottom.
+It uses 36 bytes of data, starting at the address given.
+
+
+```
+' Routine to place a 16 pixel by 16 pixel "Tile" onto the screen at character position x,y from adddress given.
+' Data must be in the format of 16 bit rows, followed by attribute data.
+' (c) 2010 Britlion, donated to the ZX BASIC project.
+' Thanks to Boriel, LCD and Na_than for inspiration behind this.
+
+' This routine could be used as the basis for a fast sprite system, provided all sprites can be in 4 character blocks.
+' It can also be used to clean up dirty background (erase sprites), or put backgrounds from tiled blocks onto a screen.
+
+' Note the comments about Self Modifying code should be ignored. This has been updated with IX+n methods, which overall are faster than accessing and changing the code.
+' (They would have to be accessed to change the memory anyway - may as well just access them directly.)
+
+SUB putTile(x as uByte, y as uByte, graphicsAddr as uInteger)
+
+ASM
+JP pt_start
+
+ptstackSave:
+defb 0,0
+
+pt_start:
+ld a,i
+push af ; Save interrupt status.
+
+; Routine to save the background to the buffer
+
+ DI ; we really, really, REALLY can NOT be having interrupts while the stack and IX and IY are pointed elsewhere.
+
+ PUSH IX
+ PUSH IY
+ ;ld HL, 65535 ; Self modifying code should load this with the graphics address.
+ LD D,(IX+9)
+ LD E,(IX+8)
+ EX DE,HL
+
+;; Print sprites routine
+ LD (ptstackSave), SP ; Save Stack Pointer
+
+ LD SP,HL ; now SP points at the start of the graphics.
+
+ ; This function returns the address into HL of the screen address
+ ld a,(IX+5) ; Load in x - note the Self Modifying value
+ ld IYH, a ; save it
+ ld l,a
+ ld a,(IX+7) ; Load in y - note the Self Modifying value
+ ld IYL, a ; save it
+ ld d,a
+ and 24
+ add a,64
+ ld h,a
+ ld a,d
+ and 7
+ rrca
+ rrca
+ rrca
+ or l
+ add a,2 ; Need to be to the right so backwards writing pushes land properly.
+ ld l,a
+
+ ; SO now, HL -> Screen address, and SP -> Graphics. Time to start loading.
+
+ POP BC ; Row 0
+ POP DE ; row 1
+ EX AF,AF'
+ POP AF ; row 2
+ EX AF,AF'
+ EXX
+ POP BC ; row 3
+ POP DE ; row 4
+ POP HL ; row 5
+ EXX
+
+ ; All right. We're loaded. Time to dump!
+
+ LD IX,0
+ ADD IX,SP ; Save our stack pointer into IX
+
+ LD SP,HL ; point at the screen.
+ PUSH BC ; row 0
+
+ INC H
+ LD SP,HL
+ PUSH DE ; row 1
+
+ INC H
+ LD SP,HL
+ EX AF,AF'
+ PUSH AF ; row 2
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH BC ; row 3
+ EXX
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH DE ; row 4
+ EXX
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH HL ; ROW 5
+ EXX
+
+ ; We're empty. Time to load up again.
+
+ LD SP,IX
+ POP BC ; ROW 6
+ POP DE ; ROW 7
+ EX AF,AF'
+ POP AF ; ROW 8
+ EX AF,AF'
+ EXX
+ POP BC ; ROW 9
+ POP DE ; ROW 10
+ POP HL ; ROW 11
+ EXX
+
+ ; and we're loaded up again! Time to dump this graphic on the screen.
+
+ LD IX,0
+ ADD IX,SP ; save SP in IX
+
+ INC H
+ LD SP,HL
+ PUSH BC ; ROW 6
+
+ INC H
+ LD SP,HL
+ PUSH DE ; ROW 7
+
+ DEC HL
+ DEC HL
+
+ ; Aha. Snag. We're at the bottom of a character. What's the next address down?
+ ld a,l
+ and 224
+ cp 224
+ jp z,ptSameThird3
+
+ptNextThird3:
+ ld de,1760
+ and a
+ sbc hl,de
+ jp ptAddrDone3
+
+ptSameThird3:
+
+ ld de,32
+ and a
+ adc hl,de
+
+ptAddrDone3:
+
+ INC HL
+ INC HL
+
+ LD SP,HL
+ EX AF,AF'
+ PUSH AF ; ROW 8
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH BC ; ROW 9
+ EXX
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH DE ; ROW 10
+ EXX
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH HL ; ROW 11
+ EXX
+
+ ; Okay. Registers empty. Reload time!
+ LD SP,IX
+ POP BC ; ROW 12
+ POP DE ; ROW 13
+
+ EXX
+ POP BC ; ROW 14
+ POP DE ; ROW 15
+ POP HL ; Top Attrs
+ EXX
+
+ EX AF,AF'
+ POP AF ; Bottom Attrs
+ EX AF,AF'
+
+ ; and the last dump to screen
+
+ INC H
+ LD SP,HL
+ PUSH BC
+
+ INC H
+ LD SP,HL
+ PUSH DE
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH BC
+ EXX
+
+ INC H
+ LD SP,HL
+ EXX
+ PUSH DE
+ EXX
+
+ ; Pixels done. Just need to do the attributes.
+ ; So set HL to the attr address:
+
+ ld a,IYL ;ypos
+
+ rrca
+ rrca
+ rrca ; Multiply by 32
+ ld l,a ; Pass to L
+ and 3 ; Mask with 00000011
+ add a,88 ; 88 * 256 = 22528 - start of attributes.
+ ld h,a ; Put it in the High Byte
+ ld a,l ; We get y value *32
+ and 224 ; Mask with 11100000
+ ld l,a ; Put it in L
+ ld a,IYH ; xpos
+ adc a,l ; Add it to the Low byte
+ ld l,a ; Put it back in L, and we're done. HL=Address.
+ INC HL ; we need to be to the right of the ATTR point as pushes write backwards.
+ INC HL
+
+ ; attr
+ LD SP,HL
+ EXX
+ PUSH HL ; top row
+ EXX
+
+ LD HL,34 ; we need to move down to the next row. We already backed up 2, so we add 34.
+ ADD HL,SP
+ LD SP,HL
+ EX AF,AF' ; bottom row
+ PUSH AF
+
+ptNextSprite2:
+ ; done. Cleanup.
+ LD SP,(ptstackSave) ; put our stack back together.
+
+ ; done all 4 final clean up
+
+ POP IY
+ POP IX
+
+ POP AF ; recover interrupt status
+ JP PO, pt_nointerrupts
+ EI ; Okay. We put everything back. If you need interrupts, you can go with em.
+
+pt_nointerrupts:
+END ASM
+END SUB
+```
+
+## Usage
+
+Example:
+
+```
+putTile (10,10,@sprite)
+```
+
+Will copy a tile of data to print position 10,10 from address at label sprite.
+
diff --git a/docs/library/randomstream.bas.md b/docs/library/randomstream.bas.md
new file mode 100644
index 000000000..e702bf512
--- /dev/null
+++ b/docs/library/randomstream.bas.md
@@ -0,0 +1,149 @@
+#RandomStream.bas
+
+Britlion's Crazy Random Number generators! (Based completely on the stream generator from Patrik Rak,
+and much thanks for his work on this)
+
+Boriel has included a better random function in the code; but this passes through
+floating point numbers, which is potentially fairly slow - and for games we usually
+require integer numbers anyway!
+
+I've written a few functions that are a possible alternative.
+
+This is the base function that does the hard work of generating a random number
+from 0-255 in the A register (or as a return value, conveniently enough).
+This is the same random number generator that Boriel is using, incidentally
+(based pretty much wholly on Patrik Rak's stream random generator, as posted on the World of Spectrum Forums).
+
+Update: Tweaked for Einar Saukas' optimization, September 2012.
+
+The following function, randomBase, returns a pseudorandom value between 0 and 255 - that is a one byte return.
+This is the base of Patrik Rak's random stream generator, and is the fastest function here.
+Other functions will call this one. **They will also call it FROM MACHINE CODE - so expect the ASM context
+label "random" to be there. If you change this label, you will have to also change the calling functions**
+
+
+```
+FUNCTION FASTCALL randomBase () AS UBYTE
+ASM
+random:
+ ld de,$A280 ; xz -> yw
+ ld hl,$C0DE ; yw -> zt
+ ld (random+1),hl ; x = y, z = w
+ ld a,l ; w = w ^ ( w << 3 )
+ add a,a
+ add a,a
+ add a,a
+ xor l
+ ld l,a
+ ld a,d ; t = x ^ (x << 1)
+ add a,a
+ xor d
+ ld h,a
+ rra ; t = t ^ (t >> 1) ^ w
+ xor h
+ xor l
+ ld h,e ; y = z
+ ld l,a ; w = t
+ ld (random+4),hl
+END ASM
+END FUNCTION
+```
+
+This function will update the seed value based on the current frames counter.
+To improve randomness, get the user to have a human interaction that can take a variable
+amount of time and then run this.
+
+```
+SUB FASTCALL updateSeed()
+REM Updates the random generator seed from the FRAMES system variable.
+time()
+ASM
+ LD A,E
+ EX DE,HL
+ LD HL,random+2
+ XOR (HL)
+ AND A
+ JR NZ,updateSeedNotZero
+ INC A
+updateSeedNotZero:
+ LD (HL),A
+ LD HL,random+4
+ LD A,E
+ XOR (HL)
+ LD (HL),A
+ INC HL
+ LD A,D
+ XOR (HL)
+ LD (HL),A
+END ASM
+END SUB
+```
+
+The above function requires the timer function, which simply grabs the time from the
+frames variable and returns is as a unsigned-long variable, in registers DEHL:
+
+
+```
+FUNCTION FASTCALL time() as uLong
+asm
+ DI
+ LD DE,(23674)
+ LD D,0
+ LD HL,(23672)
+ EI
+end asm
+end function
+```
+
+This function returns a value from zero to the specified limit number (limit <= 255).
+You can therefore, for example, roll a dice by calling `randomLimit(5) + 1` to get 1-6.
+
+
+```
+FUNCTION fastcall randomLimit(limit as uByte) as uByte
+ASM
+ AND A
+ RET Z ; Input zero, output zero.
+ LD B,A ; Save A
+
+ LD C,255
+ randomBinLoop:
+ RLA
+ JR C, randomBinLoopExit
+ RR C
+ JR randomBinLoop ; loop back until we find a bit.
+ randomBinLoopExit:
+
+ randomBinRedoCall:
+ call random
+ AND C
+ CP B
+ RET Z
+ JR NC, randomBinRedoCall
+END ASM
+END FUNCTION
+```
+
+It's worth noting that the issue with the above is that it basically rolls a random, and if it's bigger than limit,
+it rolls another one. This could potentially take a while, and isn't guaranteed to be fast.
+Though the probability of failing to hit the zone is kept to 50% at worst, so on average it will roll 1.5
+random numbers, I think, per call. This should usually be faster than a floating point multiply, I believe.
+
+If you want, in a similar way to sinclair basic and ZX BASIC RND function, a number between 0 and 1,
+this function provides that, using a FIXED type return. This is usually good enough for most purposes,
+but is quite a lot faster to process than a full floating point number.
+
+```
+FUNCTION FASTCALL randomFixed() as FIXED
+ASM
+ call random
+ push AF
+ call random
+ ld l,A
+ POP AF
+ ld h,a
+ ld d,0
+ ld e,d
+END ASM
+END FUNCTION
+```
diff --git a/docs/library/scraddress.md b/docs/library/scraddress.md
new file mode 100644
index 000000000..998857540
--- /dev/null
+++ b/docs/library/scraddress.md
@@ -0,0 +1,62 @@
+#ScrAddress
+
+This function returns the address in screen memory of the TOP line of the character in print position X-Y.
+Remember that the next line will be 256 bytes further on, and the 3rd line 256 further again and so forth,
+for 7 more lines.
+
+```
+FUNCTION scrAddress(x as uByte, y as uByte) as Uinteger
+asm
+; This function returns the address into HL of the screen address
+; x,y in character grid notation.
+; Original code was extracted by BloodBaz
+ ; x Arrives in A, y is in stack.
+ and 31
+ ld l,a
+ ld a,(IX+7) ; Y value
+ ld d,a
+ and 24
+ add a,64
+ ld h,a
+ ld a,d
+ and 7
+ rrca
+ rrca
+ rrca
+ or l
+ ld l,a
+end asm
+END FUNCTION
+
+
+FUNCTION attrAddress (x as uByte, y as uByte) as uInteger
+';; This function returns the memory address of the Character Position
+';; x,y in the attribute screen memory.
+';; Adapted from code by Jonathan Cauldwell.
+
+asm
+ ld a,(IX+7) ;ypos
+ rrca
+ rrca
+ rrca ; Multiply by 32
+ ld l,a ; Pass to L
+ and 3 ; Mask with 00000011
+ add a,88 ; 88 * 256 = 22528 - start of attributes.
+ ld h,a ; Put it in the High Byte
+ ld a,l ; We get y value *32
+ and 224 ; Mask with 11100000
+ ld l,a ; Put it in L
+ ld a,(IX+5) ; xpos
+ add a,l ; Add it to the Low byte
+ ld l,a ; Put it back in L, and we're done. HL=Address.
+end asm
+END FUNCTION
+```
+
+Examples of use (though more likely to be used as parameters to other screen handling functions):
+
+
+```
+Print scrAddress(8,15)
+Print attrAddress(8,15)
+```
diff --git a/docs/library/windowattrscrollup.md b/docs/library/windowattrscrollup.md
new file mode 100644
index 000000000..903ee24b2
--- /dev/null
+++ b/docs/library/windowattrscrollup.md
@@ -0,0 +1,89 @@
+#WindowAttrScrollUp
+
+# BLAttrWindowScrollUp.bas
+
+This subroutine specified rectangle of screen and scrolls up just the colour attributes up by a character.
+You might be able to use it for games (though there are probably faster scrolly routines for that);
+but the aim here is to be able to scroll up part of the screen, so that you can split between text on a rectangle
+area and other information elsewhere - e.g. graphic adventures.
+This then is an addendum for [windowScrollUP.bas](windowscrollup.md), and can be called with it -
+probably less useful in its own right. Note that it leaves the last line attributes untouched -
+it can't know inherently what colour to paint this section.
+
+```
+SUB BLAttrWindowScrollUp (X AS UBYTE, Y AS UBYTE, Width AS UBYTE, Height AS UBYTE)
+REM Routine, acting as a pair to BLWindowScrollUp.bas that moves the attributes up - and leaves the last ATTR line untouched (no way)
+ASM
+ LD H,58h ; $5800 = 22528 = Attr start
+ LD L,(IX+5) ; HL now contains correct column, but top row.
+
+ LD A,(IX+7) ; Y
+ CP 8
+ JR C, BLAttrWindowScrollUpGotRightThird
+ INC H
+ CP 16
+ JR C, BLAttrWindowScrollUpGotRightThird
+ INC H
+ BLAttrWindowScrollUpGotRightThird:
+ AND 7
+ RRCA
+ RRCA
+ RRCA ; Three right rotates - same as 5 left rotates = A=A*32
+ ADD A,L
+ LD L,A ; HL now points to correct row, top left corner.
+
+ LD D,H
+ LD E,L ; Copy HL to DE
+
+ LD BC,32
+ ADD HL,BC ; Point HL at one row down.
+ LD C,(IX+9) ; width
+ LD B,(IX+11) ; Height
+ DEC B ; (We don't scroll past the end)
+
+ BLAttrWindowScrollUpHeightLoop:
+ PUSH BC ; Save our width and height
+ PUSH HL
+ LD B,0
+
+ BLAttrWindowScrollUpWidthLoop:
+ LDIR ; A one instruction width loop :P
+
+ POP DE ; Last run's source is now our destination
+ LD H,D
+ LD L,E ; Copy into HL
+ LD BC,32
+ ADD HL,BC ; Move HL down one row
+
+
+ POP BC ; get our counters back
+ DJNZ BLAttrWindowScrollUpHeightLoop ; Dec height, and if we haven't run out of rows, go do another one.
+END ASM
+END SUB
+```
+
+
+## Usage
+```
+BLAttrWindowScrollUp(TopLeftXCoordinate, TopLeftYCoordinate, WidthInCharacters, HeightInCharacters)
+```
+
+The parameters are the X,Y print coordinates of the Top Left corner, width in characters, and height in characters.
+
+Example of use:
+
+```
+REM Put something on screen:
+
+FOR n=1 to 12
+PRINT INK RND *7; PAPER RND * 7; "01234567890123456789012345678901";
+PRINT INK RND *7; PAPER RND * 7; "0ABCDEFGHI0KLMNOPQRS0UVWXYZABC0D";
+NEXT n
+
+REM Scroll it slowly:
+FOR n=1 TO 10
+BLAttrWindowScrollUp (3,3,8,15)
+BLAttrWindowScrollUp (28,10,3,8)
+PAUSE 100
+NEXT n
+```
diff --git a/docs/library/windowpaint.md b/docs/library/windowpaint.md
new file mode 100644
index 000000000..15c21bb9e
--- /dev/null
+++ b/docs/library/windowpaint.md
@@ -0,0 +1,81 @@
+#WindowPaint
+
+##paintWindow
+
+>**WARNING: THIS subroutine does not check to see if it's writing over the edge of the
+> screen. This is done for speed, but it is the user's job to make sure that all
+> data will fit on the screen!**
+
+This subroutine changes the attribute map without actually changing the bitmap that's in it. You can combine this with other routines, such as clearbox, to clear a screen area and reset the attributes, as well as fast plot and draw routines that don't deal with attributes themselves.
+Also ideal (and originally designed for) use with `putChars`, which is a fast graphics print routine, that also doesn't do attributes directly.
+Sprites can be worked up from this basis.
+
+###Usage
+
+```
+windowPaint(x as uByte,y as uByte, width as uByte, height as uByte, inkCol as ubyte, paperCol as uByte, isBright as uByte, isFlash as uByte)
+paint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
+```
+
+`windowPaint` calls paint with the required single attribute byte - it's perfectly reasonable to call it directly,
+if you have the full attribute value ready. windowPaint is really there to make it simpler to construct this byte.
+
+
+Where
+* x is the x value in character co-ordinates
+* y is the y value in character co-ordinates
+* width is the width in characters
+* height is the height in characters
+
+
+```
+SUB windowPaint(x as uByte,y as uByte, width as uByte, height as uByte, inkCol as ubyte, paperCol as uByte, isBright as uByte, isFlash as uByte)
+ paint(x,y,width,height,(isFlash<<7+isBright<<6+paperCol<<3+inkCol))
+END SUB
+
+
+SUB paint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
+ REM Copyleft Britlion. Feel free to use as you will. Please attribute me if you use this, however!
+
+ asm
+ ld a,(IX+7) ;ypos
+ rrca
+ rrca
+ rrca ; Multiply by 32
+ ld l,a ; Pass to L
+ and 3 ; Mask with 00000011
+ add a,88 ; 88 * 256 = 22528 - start of attributes. Change this if you are working with a buffer or somesuch.
+ ld h,a ; Put it in the High Byte
+ ld a,l ; We get y value *32
+ and 224 ; Mask with 11100000
+ ld l,a ; Put it in L
+ ld a,(IX+5) ; xpos
+ add a,l ; Add it to the Low byte
+ ld l,a ; Put it back in L, and we're done. HL=Address.
+
+ push HL ; save address
+ LD A, (IX+13) ; attribute
+ LD DE,32
+ LD c,(IX+11) ; height
+
+ BLPaintHeightLoop:
+ LD b,(IX+9) ; width
+
+ BLPaintWidthLoop:
+ LD (HL),a ; paint a character
+ INC L ; Move to the right (Note that we only would have to inc H if we are crossing from the right edge to the left, and we shouldn't be needing to do that)
+ DJNZ BLPaintWidthLoop
+
+ BLPaintWidthExitLoop:
+ POP HL ; recover our left edge
+ DEC C
+ JR Z, BLPaintHeightExitLoop
+
+ ADD HL,DE ; move 32 down
+ PUSH HL ; save it again
+ JP BLPaintHeightLoop
+
+ BLPaintHeightExitLoop:
+ end asm
+END SUB
+```
diff --git a/docs/library/windowscrollup.md b/docs/library/windowscrollup.md
new file mode 100644
index 000000000..e5450d3b9
--- /dev/null
+++ b/docs/library/windowscrollup.md
@@ -0,0 +1,162 @@
+#WindowScrollUp
+
+# BLWindowScrollUp.bas
+
+This subroutine specified rectangle of screen and scrolls it up by a character.
+You might be able to use it for games (though there are probably faster scrolly routines for that);
+but the aim here is to be able to scroll up part of the screen, so that you can split between text on a rectangle area
+and other information elsewhere - e.g. graphic adventures.
+
+```
+SUB BLWindowScrollUp(X as uByte, Y as uByte, Width as uByte, Height as uByte)
+ASM
+;Routine for printing and scrolling text in any
+;window, anywhere on the screen.
+
+;Main scrolling routine
+BLWindowScrollUp:
+EX AF, AF'
+LD A,(IX+11) ;(ROWS) Store # of Lines in A'
+EX AF,AF'
+
+LD HL,BLWindowScrollUpScreenTable ;Start of address table
+LD C,(IX+7) ;(Y) Move the "pointer" to the
+LD B,0 ;appropriate position in the table
+ADD HL,BC ;and store it in (BLWindowScrollPOINT)
+ADD HL,BC
+LD (BLWindowScrollUpPOINT),HL ;Pointer position stored
+BLWindowScrollUpLOOP:
+
+ LD HL,(BLWindowScrollUpPOINT)
+ LD E,(HL)
+ INC HL
+ LD D,(HL)
+
+ ;Address of start of screen line now in DE
+ LD A,(IX+5) ;(X)
+ ADD A,E
+ LD E,A
+
+ ;Address of left-hand side of window now in DE
+ EX AF,AF'
+ DEC A
+ JP Z,BLWindowScrollUpBLANK ;Quit this loop if we have
+ EX AF,AF'
+ INC HL ;Move the pointer to the next item
+ LD (BLWindowScrollUpPOINT),HL ;in the table. Save position
+ LD C,(HL)
+ INC HL
+ LD B,(HL) ;Start of next line down in BC
+ LD L,(IX+5) ; (X)
+ LD H,0
+ ADD HL,BC
+ ;HL now points to the screen address 8 pixels below
+ ;the one held in DE
+ LD B,8 ;8 pixel lines to be transferred
+ ;Now move 8 pixel lines up the screen by 8 pixels
+
+ BLWindowScrollUpTRANS:
+ LD A,B ; Save B
+ LD C,(IX+9) ;(Cols)
+ LD B,0
+ PUSH HL
+ PUSH DE ;Save all registers
+ LDIR ;Transfer the line of pixels
+ POP DE
+ POP HL
+
+ ;Move HL and DE down one pixel
+ INC D
+ INC H
+
+ LD B,A ; Recover B
+
+ DJNZ BLWindowScrollUpTRANS
+ ;One line of characters has now been transferred
+
+JP BLWindowScrollUpLOOP ;Back for next line of characters
+
+;Scrolling finished. Now erase last character line
+BLWindowScrollUpBLANK:
+LD C,8
+LD L,(IX+9) ; (COLS)
+BLWindowScrollUpLOOP2:
+
+ PUSH DE
+ LD B,L ;(IX+11) - Cols
+ XOR A
+ BLWindowScrollUpLOOP3:
+ LD (DE),A
+ INC E
+ DJNZ BLWindowScrollUpLOOP3
+ POP DE
+ INC D
+ DEC C
+ JR NZ, BLWindowScrollUpLOOP2
+
+;DJNZ BLWindowScrollUpLOOP2
+JP BLWindowScrollEnd
+
+BLWindowScrollUpPOINT: DEFW 0
+
+BLWindowScrollUpScreenTable:
+ DEFW 16384
+ DEFW 16416
+ DEFW 16448
+ DEFW 16480
+ DEFW 16512
+ DEFW 16544
+ DEFW 16576
+ DEFW 16608
+ DEFW 18432
+ DEFW 18464
+ DEFW 18496
+ DEFW 18528
+ DEFW 18560
+ DEFW 18592
+ DEFW 18624
+ DEFW 18656
+ DEFW 20480
+ DEFW 20512
+ DEFW 20544
+ DEFW 20576
+ DEFW 20608
+ DEFW 20640
+ DEFW 20672
+ DEFW 20704
+
+BLWindowScrollEnd:
+END ASM
+END SUB
+```
+
+## Usage
+```
+BLWindowScrollUp(TopLeftXCoordinate, TopLeftYCoordinate, WidthInCharacters, HeightInCharacters)
+```
+
+The parameters are the X,Y print coordinates of the Top Left corner, width in characters, and height in characters.
+
+Example in use:
+
+```
+REM Quick routine to fill the screen with crap so we can demonstrate scrolling.
+SUB fillRubbish()
+ASM
+ LD DE,16384
+ LD HL,0
+ LD BC,6144
+ LDIR
+END ASM
+END SUB
+
+fillRubbish() ' Fill the screen with stuff.
+
+'actual use demo here:
+
+FOR n=1 to 10
+BLWindowScrollUp(3,3,8,15)
+BLWindowScrollUp(28,10,3,8)
+PAUSE 10
+NEXT n
+```
diff --git a/docs/load.md b/docs/load.md
new file mode 100644
index 000000000..8b0a65f1a
--- /dev/null
+++ b/docs/load.md
@@ -0,0 +1,43 @@
+#LOAD
+
+#SAVE, LOAD and VERIFY
+
+##Syntax
+```
+SAVE "xxx" CODE START, LENGTH
+SAVE "xxx" SCREEN$ [Note: This is the functional equivalent of SAVE "xxx" CODE 16384,6912 ]
+
+LOAD "xxx" CODE
+LOAD "xxx" CODE START
+LOAD "xxx" CODE START, LENGTH
+LOAD "xxx" SCREEN$
+
+VERIFY "xxx" CODE
+VERIFY "xxx" SCREEN$
+```
+The above commands work in a manner identical to Sinclair Basic.
+
+```
+SAVE "xxx" DATA ( )
+```
+This behaves like the original Sinclair BASIC, but here you can save/load/verify not only arrays, but single variables.
+Parenthesis can be omitted (in Sinclair BASIC they were mandatory). You can also use `LOAD`/`VERIFY` with this.
+
+```
+ SAVE "xxx" DATA
+```
+
+With no varname saves ALL the entire user variable variable área plus the HEAP memory zone.
+That is, it saves all the program state. You can also use `LOAD`/`VERIFY` with this.
+
+##Remarks
+* The save command should save bytes in a format that is 100% Sinclair BASIC Compatible
+* For `LOAD` and `VERIFY`, when a R-Tape Loading error occurs, the program will not stop.
+ You have to check PEEK 23610 (ERR_NR) for value 26. If that value exists, then the `LOAD`/`VERIFY` operation failed.
+* At this moment, `LOAD`/`SAVE`/`VERIFY` can be interrupted by the user by pressing BREAK/Space,
+ which exits the program and returns to the ROM BASIC. This may be changed in the future to behave like
+ the previous point (signaling the break in `ERR_NR` and returning).
+* When using `LOAD "xxx" DATA...` you won't see the message
+ _"Number array:"_ or _"Char array:"_, but _"Bytes:"_ instead.
+ This is because ZX BASIC always uses bytes (`LOAD`/`SAVE ... CODE`) for storing user variables
+ (ZX BASIC is machine code, so the idea of BASIC variables doesn't apply).
diff --git a/docs/operators.md b/docs/operators.md
new file mode 100644
index 000000000..518ab181d
--- /dev/null
+++ b/docs/operators.md
@@ -0,0 +1,92 @@
+#Operators
+
+Operators in ZX Basic ranges from arithmetical and logical to bitwise ones.
+
+## Arithmetic Operators
+
+Arithmetic operators are _left associative_ (like in Sinclair BASIC) and have the same _precedence_. The following are a list of arithmetic operators (lower precedence operators appears first):
+
+* `+`, `-` (Addition, Subtraction)
Operator `+` (addition) can also be used with
+[strings](types.md#strings) to perform string concatenation.
+
+* `*`, `/`, `mod` (Multiplication, Division and Modulo)
+
+>**Note**: `mod` operator returns the _modulus_ (the reminder) of x / y.
+>E.g. _12 `mod` 5_ = 2. It does not exist in Sinclair BASIC.
+
+
+## Exponentiation
+
+* `^` (Power). x`^`y returns _x y_
+
+>**Note**: Unlike Sinclair Basic, this operator is **right associative**.
+
+This is the usual behavior in mathematics. So in ZX BASIC:
+
+```
+2^3^2 = 2^(3^2) = 512
+```
+
+(notice the right associative parenthesis), whilst in Sinclair BASIC,
+
+```
+2^3^2 = (2^3)^2 = 64
+```
+
+
+which is _wrong_. If in doubt, use always parenthesis to enforce the desired evaluation order.
+
+## Logical Operators
+
+Logicals operators are like in ZX Spectrum Basic. Their result can be either _False_ (which is represented with 0)
+or _True_, which might be any other value. Don't expect _True_ value number to be always **1**.
+If you need 0/1 values for boolean evaluations, use `--strict-boolean` [compiler option](zxb.md#Command Line Options).
+This might add a little overhead to boolean evaluations, tough.
+
+Operator arguments must be numbers and the result is an unsigned byte value. For binary operators,
+if arguments are of different types they are [converted](cast.md) to a common type before being evaluated:
+
+###Table of Logical Operators
+
+#### AND
+ Performs the _Logical Conjunction_ and returns _TRUE_ if and only if both arguments are _TRUE_.
+
+| a | b | result |
+|:----:|:----:|:------:|
+| False | False | False |
+| False | True | False |
+| True | False | False |
+| True | True | True |
+---
+
+#### OR
+Performs the _Logical Disjunction_ and returns _TRUE_ if any of the arguments is _TRUE_.
+
+| a | b | result |
+|:----:|:----:|:------:|
+| False | False | False |
+| False | True | True |
+| True | False | True |
+| True | True | True |
+---
+
+#### XOR
+Performs a logical XOR and returns TRUE if one of the arguments is true and one of the arguments is false.
+In essence, returns true if ONLY one of the arguments is true.
+
+| a | b | result |
+|:----:|:----:|:------:|
+| False | False | False |
+| False | True | True |
+| True | False | True |
+| True | True | False |
+---
+
+### NOT
+Performs the _Logical Negation_ and returns _TRUE_ if the arguments is _False_ and vice versa.
+
+| a | result |
+|:----:|:----:|
+| False | True |
+| True | False |
+
diff --git a/docs/other_architectures.md b/docs/other_architectures.md
new file mode 100644
index 000000000..c4379a55f
--- /dev/null
+++ b/docs/other_architectures.md
@@ -0,0 +1,406 @@
+#Other architectures
+
+## home computers
+
+###[Z80](architectures/z80.md)
+
+* [ZX-Spectrum](architectures/zxspectrum.md)
+* [MSX](architectures/msx.md) 1/2/2+
+* [Amstrad CPC](architectures/amstrad_cpc.md)
+* [TRS 80 Model 1](architectures/trs80_model1.md)
+* Sharp [MZ700](architectures/mz700.md)
+* Mattel [Aquarius](architectures/aquarius.md)
+* Casio [PV-2000](architectures/pv2000.md)
+* Sinclair ZX80 / [ZX81](architectures/zx81.md) / Jupiter Ace
+* [Sam Coupé](architectures/sam_coupe.md)
+* Sord [M5](architectures/sord_m5.md)
+* Bandai [RX-78](architectures/rx78.md)
+* [GEM-1000](architectures/gem-1000.md)/[MC-1000](architectures/gem-1000.md)/[SPC-1000](architectures/gem-1000.md)
+* Philips [VG5000](architectures/vg5000.md)
+* Philips [P2000](architectures/p2000.md)
+* Sega [SC-3000](architectures/sc3000.md)
+* [Galaksija](architectures/galaksija.md)
+* Coleco [Adam](architectures/adam.md)
+* [Memotech MTX](architectures/memotech_mtx.md)
+* [Enterprise 64/128](architectures/enterprise.md)
+* Triumph-Adler [Alphatronic-PC](architectures/alphatronicpc.md)
+* Tesla [Ondra](architectures/ondra.md)
+* [Sharp X1](architectures/sharpx1.md)
+* NEC [PC-6001](architectures/nec_pc6001.md)/[PC-8801](architectures/pc88.md)
+* [Camputers Lynx](architectures/camputers_lynx.md)
+* Vtech Laser-210
+* Exidy Sorcerer
+* Luxor ABC-80/800
+* Nascom
+* Toshiba Pasopia/[Pasopia5](architectures/pasopia5.md)/Pasopia7
+* Hanimex Pencil-II
+* Robotron [KC-85](architectures/kc85.md)
+* Mupid
+* Sega [SG1000/MarkIII/MasterSystem](architectures/segamastersystem.md)
+* [Colecovision](architectures/colecovision.md)
+* [Bally Astrocade](architectures/bally_astrocade.md)
+* Casio [PV-1000](architectures/pv1000.md)
+* Zemmix [(MSX)](architectures/msx.md)
+* [Amstrad GX4000](architectures/amstrad_cpc.md)
+* [Epoch Super-Cassette-Vision](architectures/epochsupercassettevision.md)
+
+###8080
+
+* Interact
+* [DAI](architectures/dai.md)
+* Tesla [PMD-85](architectures/pmd85.md)
+* Orion-128
+* Kvantor BK-1098
+* Krista-2
+* [Vektor-06c](architectures/vektor06c.md)
+* Compucolor 8001/8051
+* Triumph-Adler Alphatronic-PC P1/P2/P3/P4
+
+###Z84C15
+
+* [Sprinter 2000](architectures/sp2000.md)
+
+###[R800](architectures/r800.md)
+
+* MSX Turbo-R
+
+###[6502](architectures/6502.md)
+
+* [BBC-Micro](architectures/bbc_micro.md)
+* [Apple](architectures/apple_ii.md) I/[II](architectures/apple_ii.md)/III/IIe/IIc
+* Commodore PET/[VIC-20](architectures/vic_20.md)
+* Atari 400/[800](architectures/atari_800.md)/XL/XE
+* Acorn Atom/Electron
+* [Orao](architectures/orao.md)
+* [Galeb](architectures/galeb.md)
+* Ohio Scientific
+* Commodore [C64](architectures/c64.md)
+* Commodore Plus4
+* Commodore [C128](architectures/c128.md)
+
+###[6800](architectures/6800.md)
+
+* Goupil-2
+* APF [Imagination-Machine](architectures/imaginationmachine.md)
+* Matsushita [JR-100](architectures/jr100.md)/[JR-200](architectures/jr200.md)
+* Matra-Hachette Alice/Alice-90
+
+###[6809](architectures/6809.md)
+
+* TRS 80 Color Computer (CoCo1/[CoCo2](architectures/coco2.md)/CoCo3/[Dragon32](architectures/coco2.md)/etc.)
+* Thomson/Olivetti [MO5](architectures/mo5.md)/[Prodest](architectures/mo5.md)/TO7
+* Fujitsu FM-7/FM-8
+
+###65816
+
+* Apple IIGS
+
+###65SC12
+
+* BBC-Master
+
+###K1801VM1
+
+* [Elektronika-BK](architectures/elektronika_bk.md)
+
+###Fairchild-F8
+
+* VideoBrain Family-Computer
+
+###TMS7020
+
+* Exelvision
+
+###TMS9900
+
+* TI-99-4A/Geneve/TIM
+* Tomy Pyuuta/Tutor
+
+### TI-74181
+
+* Xerox Alto
+
+###[68000](architectures/68000.md)
+
+* [Sinclair QL](architectures/sinclair_ql.md)
+* [Amiga](architectures/amiga_500.md) 1000/[500](architectures/amiga_500.md)/2000/1500/600
+* [Atari ST](architectures/atari_st.md)/Atari STE
+* Sharp [X68000](architectures/x68000.md)
+* Apple Lisa
+* Apple Macintosh 128k/Plus/Classic
+* Luxor ABC-1600
+* Silicon Graphics Iris 1000
+
+###[68020](architectures/68020.md)
+
+* Amiga 1200
+
+###[68030](architectures/68030.md)
+
+* Atari Falcon
+* Amiga 3000/4000-030
+
+###[68040](architectures/68040.md)
+
+* Amiga 4000-040
+
+###8086
+
+* NEC [PC-9801](architectures/pc98.md)
+* Toshiba Pasopia1600
+
+###8088
+
+* [IBM PC-XT](architectures/ibm_pc-xt.md)
+* Toshiba Pasopia16
+
+###i386
+
+* Fujitsu FM-Towns
+
+###[ARM](architectures/arm.md)
+
+* Acorn Archimedes
+
+## Game Consoles
+###6502
+
+* [NES](architectures/nes.md)
+* Atari 5200/7800/XEGS
+* [PCEngine](architectures/pcengine.md)/[TurboGrafx](architectures/pcengine.md)
+
+###6809
+
+* Vectrex
+
+###6800
+
+* APF-M1000
+
+###CP1600
+
+* Intellivision
+
+###8048
+
+* Odyssey/Videopac
+
+Signetics-2650A
+* Emerson Arcadia-2001
+
+###68000
+
+* Sega Megadrive/Genesis
+* SNK [NeoGeo](architectures/neogeo.md)
+* Amiga [CDTV](architectures/amiga_500.md)
+* Philips CD-i
+
+###68020
+
+* Amiga CD32
+
+i286
+* Tandy Memorex VIS
+
+###i386
+
+* Fujitsu FM-Towns Marty
+
+###65816
+
+* [SNES](architectures/snes.md)
+
+###ARM
+
+* 3DO
+* Ouya
+
+###PowerPC
+
+* Apple/Bandai Pippin
+
+###MIPS
+
+* Atari Jaguar
+* Nintendo64
+* PlayStation1/PSone
+* PlayStation2
+* Gamebox [GBX-1001](architectures/gbx1001.md)
+
+###SuperH
+
+* Casio Loopy
+
+###Atmega
+
+* [Uzebox](architectures/uzebox.md)
+
+## handheld consoles:
+###8048
+
+* Entex [Adventure Vision](architectures/adventurevision.md)
+
+###Z80
+
+* Sega [GameGear](architectures/segamastersystem.md)
+
+###8080
+
+* Nintendo [GameBoy](architectures/gameboy.md)
+
+###6502
+
+* Watara Supervision
+* NEC TurboExpress
+
+###65SC02
+
+* Atari [Lynx](architectures/atarilynx.md)
+
+###TLCS900H
+
+* SNK [NeoGeo Pocket](architectures/neogeopocket.md)
+
+###80186
+
+* Bandai [Wonderswan](architectures/wonderswan.md)
+
+###S1C33209
+
+* Aquaplus [Piece](architectures/aquapluspiece.md)
+
+###ARM
+
+* GP2X
+* Pandora
+
+###MIPS
+
+* Dingoo
+
+## arcade systems:
+
+### Z80
+
+* Capcom [Section-Z](architectures/sectionz.md)
+* Capcom [1942](architectures/capcom1942.md)
+* Capcom [1943](architectures/capcom1943.md)
+* Enerdyne [American SpeedWay](architectures/enerdyneamericanspeedway.md)
+* Irem [M52](architectures/m52.md)
+* Irem [M62](architectures/m62.md)
+* Irem [M63](architectures/m63.md)
+* Komax [Flower](architectures/komaxflower.md)
+* Konami [Ping Pong](architectures/konamipingpong.md)
+* Konami [Scramble](architectures/scramble.md)
+* Konami [Time Pilot](architectures/konamitimepilot.md)
+* Mondial [Lady Frog](architectures/mondialladyfrog.md)
+* Namco [Galaga](architectures/namcogalaga.md)
+* Namco [PacMan](architectures/namcopacman.md)
+* Namco [Galaxian](architectures/namcogalaxian.md)
+* Orca [Marine Boy](architectures/orcamarineboy.md)
+* Poby [News](architectures/pobynews.md)
+* Sega [Appoooh](architectures/segaappoooh.md)
+* Sega [Bank Panic](architectures/segabankpanic.md)
+* Sega [Pengo](architectures/segapengo.md)
+* Sega [Gigas](architectures/segagigas.md)
+* Sega [SG1000](architectures/segamastersystem.md)
+* Sega [System-E](architectures/segamastersystem.md)
+* Sun [Stratovox](architectures/sunstratovox.md)
+* Taito [Chack’n’Pop](architectures/taitochacknpop.md)
+* Taito [Minivader](architectures/taitominivader.md)
+* Taito [Samurai Nihon Ichi](architectures/taitosamurainihonichi.md)
+* Taito [The Fairyland Story](architectures/taitothefairylandstory.md)
+* Taito [The Legend Of Kage](architectures/taitothelegendofkage.md)
+* Taito [L](architectures/taitol.md)
+* [Tecmo](architectures/tecmo.md)
+* Tecmo [WorldCup90](architectures/worldcup90.md)
+* Tehkan [Pinball Action](architectures/tehkanpinballaction.md)
+
+### 6502
+
+* Atari [Centipede](architectures/ataricentipede.md)
+* Irem [M27](architectures/m27.md)
+* Irem [M10](architectures/m10.md)
+* [Vanguard](architectures/vanguard.md)
+
+### 6809
+
+* Konami [Shaolins Road](architectures/shaolinsroad.md)
+* Capcom [GhostsNGoblins](architectures/ghostsngoblins.md)
+
+### TMS34010
+
+* Midway T-Unit/Y-Unit
+
+### 68000
+
+* SNK [NeoGeo](architectures/neogeo.md)
+* Sega MegaTech/System16/[OutRun](architectures/segaoutrun.md)
+* Taito [F1](architectures/taitof1.md)/[F2](architectures/taitof2.md)/[B](architectures/taitob.md)/[H](architectures/taitoh.md)/[X](architectures/taitox.md)/[Z](architectures/taitoz.md)/[Air](architectures/taitoair.md)/Toaplan
+* Atari G1/ArcadeClassics
+* Konami Hornet
+* Konami Nemesis
+* Taito [Darius](architectures/taitodarius.md)
+
+### 68020
+
+* Taito [F3](architectures/taitof3.md)
+* Atari GT
+* Konami Bemani DJ-Main
+
+### NEC V30
+
+* Irem [M90](architectures/m90.md)
+
+### NEC V60
+
+* Sega System32/[Model1](architectures/segamodel1.md)
+
+### i960
+
+* Sega [Model2](architectures/segamodel2.md)
+
+###Hitachi SuperH
+
+* Sega Hikaru/Aurora/Naomi
+* Kaneko SuperNova
+
+###PowerPC
+
+* Sega [Model3](architectures/segamodel3.md)/Triforce
+* Taito Type-Zero
+* Namco 357
+* Konami M2/Viper/Hornet
+
+###MIPS
+
+* SNK Hyper-NeoGeo64
+* Taito FX-1B/G-Net
+* Namco Super256
+* Konami System573
+* Capcom/Sony ZN-1
+* Atari Cojag/Flagstaff/Phoenix/Seattle/Vegas/Denver
+* Konami Bemani 573/Twinkle/Karaoke
+
+###ARM
+
+* DataEast MLC/Simple156
+
+###i586
+
+* Sega Chihiro/Lindbergh
+* Taito Type-X/Type-X-Zero
+* Namco ES-1/N2
+* Konami Bemani PC Type 1/2/3
+* Cave PC
+* Midway Graphite
+
+###amd64
+
+* Sega Europa-R/RingEdge/RingWide/Nu
+* Taito Type-X2
+* Konami Bemani PC Type 4
+
+###Konami Emotion-Engine (128bit)
+
+* Konami Bemani Python
diff --git a/docs/over.md b/docs/over.md
new file mode 100644
index 000000000..199338a5b
--- /dev/null
+++ b/docs/over.md
@@ -0,0 +1,58 @@
+#OVER
+
+##Syntax
+```
+OVER
+```
+
+or
+
+```
+PRINT OVER ;
+```
+
+This can be used to change the permanent print settings, or the temporary ones. When used as a direct command:
+
+```
+ OVER 0
+ OVER 1
+ OVER 2
+ OVER 3
+```
+then the subsequent print statements will overwrite the previous ones with differing effects.
+
+ * After an `OVER 0` command, the characters are simply replaced, as per usual.
+ This behaves just like the Sinclair Basic OVER 0 command.
+
+ * After `OVER 1`, subsequent characters are combined with an Exclusive OR (XOR) - that is
+ to say pixels are flipped by overprinting with another ink pixel, and left alone by overprinting with a paper pixel.
+ This behaves identically to the OVER 1 Sinclair Basic Command.
+
+ * After `OVER 2`, subsequent prints are combined using an AND function - that is only
+ pixels will remain where BOTH characters has pixels before. If either had a paper pixel, what is left is a paper pixel.
+ This is not Sinclair Basic compatible, and is an extension.
+
+ * After `OVER 3`, Subsequent prints are combined using an OR function - that is pixels remain where EITHER
+ character had pixels before. If either had an ink pixel, what is left there is an ink pixel.
+ This is not Sinclair Basic compatible, and is an extension.
+
+Just as in Sinclair basic, these commands can be used as temporary colours by combining them with a print statement:
+
+```
+Print Over 2; "This is combined as an AND function"
+```
+
+This format does not change the permanent colour settings and only affects the characters
+printed within that print statement.
+
+##Remarks
+* This function is Sinclair BASIC compatible.
+* This function _extends_ Sinclair BASIC.
+
+##See also
+* [PRINT](print.md)
+* [PAPER](paper.md)
+* [INK](ink.md)
+* [BOLD](bold.md)
+* [INVERSE](inverse.md)
+* [ITALIC](italic.md)
diff --git a/docs/paper.md b/docs/paper.md
new file mode 100644
index 000000000..72214c83e
--- /dev/null
+++ b/docs/paper.md
@@ -0,0 +1,52 @@
+#PAPER
+
+##Syntax
+```
+PAPER
+```
+
+or
+
+```
+PRINT PAPER ;
+```
+This can be used to change the permanent print settings, or the temporary ones. When used as a direct command:
+
+```
+PAPER n
+```
+
+where n is a number from 1-8, then the subsequent print statements will have a background colour based on
+the number used. As the ZX Spectrum manual states:
+```
+ 0 - black
+ 1 - blue
+ 2 - red
+ 3 - purple, technically called magenta
+ 4 - green
+ 5 - pale blue, technically called cyan
+ 6 - yellow
+ 7 - white
+ 8 - transparent (do not change the paper value in the square being printed)
+```
+
+Just as in Sinclair basic, this command can be used as temporary colours by combining them with a print statement:
+
+```
+Print paper 2; "This is on a red background"
+```
+
+This format does not change the permanent colour settings and only affects the characters printed within
+that print statement.
+
+##Remarks
+* This function is 100% Sinclair BASIC compatible.
+
+##See also
+* [PRINT](print.md)
+* [BORDER](border.md)
+* [INK](ink.md)
+* [BOLD](bold.md)
+* [INVERSE](inverse.md)
+* [ITALIC](italic.md)
+* [OVER](over.md)
diff --git a/docs/peek.md b/docs/peek.md
new file mode 100644
index 000000000..38614e830
--- /dev/null
+++ b/docs/peek.md
@@ -0,0 +1,41 @@
+#PEEK
+
+
+##Syntax
+
+
+```
+peek (address)
+peek (typeToRead, address)
+```
+
+##Description
+
+Returns the memory content (byte) stored at _address_ position. If _address_ is not a 16 bit unsigned integer, it will be [converted](cast.md) to such type before reading the memory.
+
+When _typeToRead_ is specified, the given [type](types.md) is read from memory; otherwise the type of the read value is supposed to be _ubyte_ (8 bit unsigned integer).
+
+The type of the returning value is the _typeToRead_ specified, or _ubyte_ if no type is specified.
+
+##Examples
+
+The following example reads a 16 bit unsigned integer at position 23675 (this is the System Variable for UDG in Sinclair BASIC systems):
+
+```
+print "Address of UDG is "; peek(23675) + 256 * peek(23676)
+```
+
+But it's faster to specify the type of the value:
+
+```
+print "Address of UDG is "; peek(uinteger, 23675)
+```
+
+##Remarks
+
+* This function is Sinclair BASIC compatible.
+* This function extends the Sinclair BASIC version.
+
+##See also
+
+* [poke](poke.md)
diff --git a/docs/plot.md b/docs/plot.md
new file mode 100644
index 000000000..0276fb653
--- /dev/null
+++ b/docs/plot.md
@@ -0,0 +1,36 @@
+#PLOT
+
+##Syntax
+
+```
+PLOT x, y
+```
+
+or
+
+```
+PLOT ; x, y
+```
+Plots a _pixel_ at coordinates (x, y) (pixel column, pixel row). Coordinate (0, 0) designates bottom-left screen corner.
+
+**PLOT** is enhanced in ZX BASIC to allow plotting in the last two screen rows (this was not possible in Sinclair BASIC). So now we have 16 lines more (192 in total). Sinclair BASIC only used top 176 scan-lines. This means that in Sinclair BASIC
+
+```
+PLOT x, y
+```
+
+must be translated to ZX BASIC as
+
+```
+PLOT x, y + 16
+```
+
+if you want your drawing to appear at the same vertical screen position Sinclair BASIC uses.
+
+###Remarks
+
+* This function is not strictly Sinclair BASIC compatible since it uses all 192 screen lines instead of top 176. If you translate **PLOT** & **DRAW** commands from Sinclair BASIC _as is_ your drawing will be _shifted down_ 16 pixels.
+
+###See Also
+* [DRAW](draw.md)
+* [CIRCLE](circle.md)
diff --git a/docs/poke.md b/docs/poke.md
new file mode 100644
index 000000000..82269a812
--- /dev/null
+++ b/docs/poke.md
@@ -0,0 +1,49 @@
+#POKE
+
+##Syntax
+
+```
+poke ,
+poke ,
+```
+
+##Description
+
+Stores the given (numeric) _value_ at the specified memory _address_. If _valueType_ is omitted, it is supposed to be _ubyte_ (8 bit unsigned integer).
+
+The _value_ is [converted](cast.md) to the given _[valueType](zx_basic:types.md)_ and stored at the given _Address_. _Type_ can be any numeric one (like _[float](zx_basic:types#float.md)_ or _[integer](zx_basic:types#integer.md)_).
+
+##Examples
+
+It is possible to _poke a decimal value_ (5 bytes) at a memory position:
+
+```
+poke float 16384, pi
+```
+
+Traditionally, in Sinclair BASIC, to store a 16 bit value the programmer does something like this:
+
+```
+10 LET i = 16384
+20 LET value = 65500
+30 POKE i, value - 256 * INT(value / 256) : REM value MOD 256
+40 POKE i + 1, INT(value / 256)
+```
+
+This can be done in a single sentence in ZX BASIC:
+
+
+```
+poke uinteger 16384, 65500
+```
+
+It's faster and the recommended way.
+
+##Remarks
+
+* This statement is Sinclair BASIC compatible.
+* This statement extends the Sinclair BASIC one.
+* This statement also allows parenthesis and [FreeBASIC syntax](http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgPoke)
+
+##See also
+* [PEEK](peek.md)
diff --git a/docs/pos.md b/docs/pos.md
new file mode 100644
index 000000000..fb4852375
--- /dev/null
+++ b/docs/pos.md
@@ -0,0 +1,20 @@
+#POS
+
+Returns the horizontal (left-right) position of the text cursor (0 means the very left).
+
+##Requirements
+
+POS is a library function to be included with the following directive:
+
+```
+#include
+```
+
+
+##Remarks
+* This function is not available in Sinclair BASIC.
+
+##See also
+
+* [ AT ](at.md)
+* [ CSRLIN](csrlin.md)
diff --git a/docs/read.md b/docs/read.md
new file mode 100644
index 000000000..985a02b04
--- /dev/null
+++ b/docs/read.md
@@ -0,0 +1,50 @@
+#READ
+
+##Syntax
+```
+ '''READ''' ''[, , ...]''
+```
+**READ** gets the next data expression available from a [DATA](data.md) line definition and stores it into a variable (not arrays) or an array element.
+Instead of using INPUT() function or [LET](let.md) assignments, you can write a sequence (or several of them) of **READ** which might result in a compact and more readable code to initialize data variables.
+
+**READ** gets the items one after another. This order can be changed using [RESTORE](restore.md).
+
+##Example
+
+```
+DIM a(9) as UByte
+
+FOR i = 0 TO 9: REM 0 TO 9 => 10 elements
+ READ a(i)
+ PRINT a(i)
+NEXT i
+
+REM notice the a(n) data entries
+DATA 2, 4, 6 * i, 7, 0
+DATA a(0), a(1), a(2), a(3), a(4)
+```
+
+This will output:
+
+```
+ 2
+ 4
+ 12
+ 7
+ 0
+ 2
+ 4
+ 12
+ 7
+ 0
+```
+Expressions are read and evaluated one by one, **when the READ sentence is executed**. When a **DATA** line is finished, the next one in the listing will be read.
+Traditionally if there's no more data to read, an _OUT of Data_ error happened. In ZX Basic, the read sequence restarts from the beginning.
+The reading sequence can be altered with [RESTORE](restore.md)
+
+##Remarks
+* This statement is Sinclair BASIC compatible.
+
+##See also
+* [DATA](data.md)
+* [RESTORE](restore.md)
diff --git a/docs/released_programs.md b/docs/released_programs.md
new file mode 100644
index 000000000..e849ff4dc
--- /dev/null
+++ b/docs/released_programs.md
@@ -0,0 +1,1779 @@
+#Released Programs
+
+This is a list of third-party ZX-Spectrum programs (mostly games) developed with ZX BASIC. Some of them also provide full source code, so they can be used as reference about how to create new programs.
+
+
+##PLAYABLE GAMES
+
+###3 Reyes Magos
+
+
+Author: J.B.G.V.
+
+Type: Arcade Game
+
+Year: 2012
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27998](https://spectrumcomputing.co.uk/index.php?cat=96&id=27998)
+
+
+
+
+
+
+
+###A Broken Friend
+
+Author: Paul Jenkinson
+
+Type: Text Adventure Game
+
+Year: 2012
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27296](https://spectrumcomputing.co.uk/index.php?cat=96&id=27296)
+
+
+
+
+
+
+
+###Abydos
+
+
+
+
+
+Author: J.B.G.V.
+
+Type: Platform Game
+
+Year: 2013
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28165](https://spectrumcomputing.co.uk/index.php?cat=96&id=28165)
+
+
+
+
+
+
+
+###Bacaball
+
+
+
+
+
+Author: Paulo Silva
+
+Type: Sport Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [http://www.mojontwins.com/csscgc2011/nitrofurano-bacaball/](http://www.mojontwins.com/csscgc2011/nitrofurano-bacaball/)
+
+
+
+
+
+
+
+###Bacachase
+
+
+
+
+
+Author: Paulo Silva
+
+Type: Puzzle Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [http://www.mojontwins.com/csscgc2011/nitrofurano-bacachase/](http://www.mojontwins.com/csscgc2011/nitrofurano-bacachase/)
+
+
+
+
+
+
+
+###BerksMan
+
+
+
+
+
+Author: Paul Fisher
+
+Type: Arcade Game
+
+Year: 2012
+
+Source: [ftp://ftp.worldofspectrum.org/pub/sinclair/games-extras/BerksMan_SourceCode.zip Yes]
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27713](https://spectrumcomputing.co.uk/index.php?cat=96&id=27713)
+
+Programming tutorial discussing how this was made: [Link](http://goo.gl/4jPd5)
+
+
+
+
+
+
+###Bounty - The Search for Frooge
+
+
+
+
+
+Author: Paul Jenkinson
+
+Type: Text Adventure Game
+
+Year: 2012
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27876](https://spectrumcomputing.co.uk/index.php?cat=96&id=27876)
+
+
+
+
+
+
+
+###Chessboard Attack
+
+
+
+
+
+Authors: Leszek Chmielewski Daniel (LCD), Kriss
+
+Type: Board Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26121](https://spectrumcomputing.co.uk/index.php?cat=96&id=26121)
+
+
+
+
+
+
+
+###Ciclopes (y Saturno)
+
+
+
+
+
+Authors: Apenao
+
+Type: Sports
+
+Year: 2013
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30024](https://spectrumcomputing.co.uk/index.php?cat=96&id=30024)
+
+
+
+
+
+
+
+###Coches
+
+
+
+
+
+Authors: Apenao
+
+Type: Racing
+
+Year: 2013
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30025](https://spectrumcomputing.co.uk/index.php?cat=96&id=30025)
+
+
+
+
+
+
+
+###Dex
+
+
+
+
+
+Author: Lee Tonks
+
+Type: Arcade Game
+
+Year: 2011
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26574](https://spectrumcomputing.co.uk/index.php?cat=96&id=26574)
+
+
+
+
+
+
+
+###Earthraid
+
+
+
+
+
+Authors: Leszek Chmielewski Daniel (LCD)
+
+Type: Strategy Game
+
+Year: 2012
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27687](https://spectrumcomputing.co.uk/index.php?cat=96&id=27687)
+
+
+
+[Earthraidingame.gif](./img/games/earthraidingame.gif)
+
+
+
+###El Hobbit
+
+
+
+
+
+Author: J.B.G.V.
+
+Type: Arcade (Platform)
+
+Year: 2012
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27993](https://spectrumcomputing.co.uk/index.php?cat=96&id=27993)
+
+
+
+
+
+
+
+###El Hobbit
+
+
+
+
+
+Author: Alejandro Valero
+
+Type: Graphic Adventure
+
+Year: 2012
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27992](https://spectrumcomputing.co.uk/index.php?cat=96&id=27992)
+
+
+
+
+
+
+
+###Eleuterio, el Mono Serio (demo)
+
+
+
+
+
+Author: na_th_an (The Mojon Twins)
+
+Type: Arcade (Platform)
+
+Year: 2012
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27307](https://spectrumcomputing.co.uk/index.php?cat=96&id=27307)
+
+
+
+
+
+
+
+###Encuerer
+
+
+
+
+
+Author: na_th_an (LOKOsoft)
+
+Type: Arcade (Platform)
+
+Year: 2013
+
+Source: Yes
+
+Link: [http://www.csscgc2013.blogspot.com.es/2013/02/encuerer.html](http://www.csscgc2013.blogspot.com.es/2013/02/encuerer.html)
+
+
+
+
+
+
+
+###Escape from Cnossus
+
+
+
+
+
+Author: Felix Plesoianu
+
+Type: Dungeon Game
+
+Year: 2013
+
+Source: Yes
+
+Link: [http://notimetoplay.org/our-games/escape-from-cnossus/](http://notimetoplay.org/our-games/escape-from-cnossus/)
+
+
+
+
+
+
+
+
+###Explorer
+
+
+
+
+
+Author: Luca bordoni
+
+Type: Arcade Game / Shoot-em-up
+
+Year: 2015
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30212](https://spectrumcomputing.co.uk/index.php?cat=96&id=30212)
+
+
+
+
+
+
+
+###H7N9
+
+
+
+
+
+Author: Paulo Silva
+
+Type: Platform
+
+Year: 2015
+
+Source: Yes
+
+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
+
+
+
+
+
+Author: The Mojon Twins
+
+Type: Arcade (Platform)
+
+Year: 2010
+
+Source: Yes
+
+Link: [http://www.mojontwins.com/2010/05/04/mojontwins-en-la-csscgc-2010/](http://www.mojontwins.com/2010/05/04/mojontwins-en-la-csscgc-2010/)
+
+
+
+
+
+
+
+###Hunt the Wumpus
+
+
+
+
+
+Author: Leszek Chmielewski Daniel (LCD)
+
+Type: Maze Game
+
+Year: 2013
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28119](https://spectrumcomputing.co.uk/index.php?cat=96&id=28119)
+
+
+
+
+
+
+
+###Knights & Demons DX
+
+
+
+
+
+Authors: Manuel Gomez, Einar Saukas, Craig Stevenson
+
+Type: Puzzle Game
+
+Year: 2013
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28175](https://spectrumcomputing.co.uk/index.php?cat=96&id=28175)
+
+
+
+
+
+
+
+###Lamega
+
+
+
+
+
+Author: rikokun
+
+Type: Shooter
+
+Year: 2016
+
+Source: no
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30284](https://spectrumcomputing.co.uk/index.php?cat=96&id=30284)
+
+
+
+
+
+
+
+###Looking for a csscgc2012 theme
+
+
+
+
+
+Author: Paulo Silva
+
+Type: Adventure Game
+
+Year: 2012
+
+Source: Yes
+
+Link: [http://cgc.zx.gen.tr/index.php?game=0301180529 - https://www.yoursinclair.co.uk/csscgc/csscgc.cgi?search=0301180542lookingforacsscgc2012theme_20120301145340.zip&year=2012](http://cgc.zx.gen.tr/index.php?game=0301180529 - https://www.yoursinclair.co.uk/csscgc/csscgc.cgi?search=0301180542lookingforacsscgc2012theme_20120301145340.zip&year=2012)
+
+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
+
+
+
+
+
+Author: The Mojon Twins
+
+Type: Arcade Game
+
+Year: 2012
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27953](https://spectrumcomputing.co.uk/index.php?cat=96&id=27953)
+
+
+
+
+
+
+
+###Memorama
+
+
+
+
+
+Author: Paulo Silva
+
+Type: Puzzle Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [http://www.mojontwins.com/csscgc2011/paulo-silva-memorama/](http://www.mojontwins.com/csscgc2011/paulo-silva-memorama/)
+
+
+
+
+
+
+
+###O-CMAN
+
+
+
+
+
+Author: oblo
+
+Type: Arcade Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26598](https://spectrumcomputing.co.uk/index.php?cat=96&id=26598)
+
+
+
+
+
+
+
+###O-TRIX
+
+
+
+
+
+Author: oblo
+
+Type: Puzzle Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26573](https://spectrumcomputing.co.uk/index.php?cat=96&id=26573)
+
+
+
+
+
+
+
+###Pets vs Aliens Prologue
+
+
+
+
+
+Authors: Einar Saukas, Jarrod Bentley, Yerzmyey
+
+Type: Puzzle Game
+
+Year: 2015
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30197](https://spectrumcomputing.co.uk/index.php?cat=96&id=30197)
+
+
+
+
+
+
+
+###Pixel Quest
+
+
+
+
+
+Author: Einar Saukas, MmcM, Craig Stevenson
+
+Type: Puzzle
+
+Year: 2015
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30237](https://spectrumcomputing.co.uk/index.php?cat=96&id=30237)
+
+
+
+
+
+
+
+###Pixel Quest 2000
+
+
+
+
+
+Author: Einar Saukas, MmcM, PheeL
+
+Type: Puzzle
+
+Year: 2017
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=31490](https://spectrumcomputing.co.uk/index.php?cat=96&id=31490)
+
+
+
+
+
+
+
+###Pixel Quest Zero
+
+
+
+
+
+Author: Einar Saukas, MmcM, PheeL
+
+Type: Puzzle
+
+Year: 2018
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=34291](https://spectrumcomputing.co.uk/index.php?cat=96&id=34291)
+
+
+
+
+
+
+
+###Quest for Witchcraft
+
+
+
+
+
+Authors: Leszek Chmielewski Daniel (LCD), Mister Beep
+
+Type: Puzzle Game
+
+Year: 2011
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27261](https://spectrumcomputing.co.uk/index.php?cat=96&id=27261)
+
+
+
+
+
+
+
+###Ratul & Zeki
+
+
+
+
+
+Author: Salvacam (Spain)
+
+Type: Arcade (Platform)
+
+Year: 2011
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27055](https://spectrumcomputing.co.uk/index.php?cat=96&id=27055)
+
+
+
+[RatulZeki.gif](./img/games/ratulzeki.gif)
+
+
+
+###Retrobsesion
+
+
+
+
+
+Author: J.B.G.V.
+
+Type: Arcade Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26193](https://spectrumcomputing.co.uk/index.php?cat=96&id=26193)
+
+
+
+
+
+
+
+###Retrobsesion II
+
+
+
+
+
+Author: J.B.G.V.
+
+Type: Arcade Game
+
+Year: 2012
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27389](https://spectrumcomputing.co.uk/index.php?cat=96&id=27389)
+
+
+
+
+
+
+
+###Saltarin
+
+
+
+
+
+Author: Salvacam (Spain)
+
+Type: Arcade (Platform)
+
+Year: 2011
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27160](https://spectrumcomputing.co.uk/index.php?cat=96&id=27160)
+
+
+
+[Saltarin.gif](./img/games/saltarin.gif)
+
+
+
+###Solitario
+
+
+
+
+
+Author: Paulo Silva
+
+Type: Puzzle Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [http://www.mojontwins.com/csscgc2011/nitrofurano-solitario/](http://www.mojontwins.com/csscgc2011/nitrofurano-solitario/)
+
+
+
+
+
+
+
+###Souls
+
+
+
+
+
+Author: Alxinho
+
+Type: Platform Game
+
+Year: 2013
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28172](https://spectrumcomputing.co.uk/index.php?cat=96&id=28172)
+
+
+
+
+
+
+
+###SpeccyWars
+
+
+
+
+
+Author: Slenkar
+
+Type: Strategy Game
+
+Year: 2013
+
+Source: Yes
+
+Link: [http://www.boriel.com/forum/post4467.html#p4467](http://www.boriel.com/forum/post4467.html#p4467)
+
+
+
+
+
+
+
+###Stela
+
+
+
+
+
+Author: J.B.G.V.
+
+Type: Arcade Game
+
+Year: 2011
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=26527](https://spectrumcomputing.co.uk/index.php?cat=96&id=26527)
+
+
+
+
+
+
+
+###Steroids Sports Diving: Splash
+
+
+
+
+
+Author: apenao
+
+Type: Sports Game
+
+Year: 2012
+
+Source: No
+
+Link: [http://cgc.zx.gen.tr/index.php?game=0628182038](http://cgc.zx.gen.tr/index.php?game=0628182038)
+
+
+
+
+
+
+
+###The Spectral Dungeons
+
+
+
+
+
+Author: Felix Plesoianu
+
+Type: Dungeon Game
+
+Year: 2013
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28173](https://spectrumcomputing.co.uk/index.php?cat=96&id=28173)
+
+
+
+
+
+
+
+###The Tales of Grupp
+
+
+
+
+
+Author: Alxinho
+
+Type: ?
+
+Year: 2015
+
+Source: Yes
+
+Link: [http://retrobytesproductions.blogspot.com.es/2015/02/the-tales-of-grupp.html](http://retrobytesproductions.blogspot.com.es/2015/02/the-tales-of-grupp.html)
+
+
+
+
+
+
+
+###U-Boot Hunt
+
+
+
+
+
+Author: Leszek Chmielewski Daniel (LCD)
+
+Type: Puzzle Game
+
+Year: 2012
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27688](https://spectrumcomputing.co.uk/index.php?cat=96&id=27688)
+
+
+
+
+
+
+
+###Uchi-Danza
+
+
+
+
+
+Author: J.B.G.V.
+
+Type: Action Game
+
+Year: 2011
+
+Source: No
+
+Link: [http://www.mojontwins.com/csscgc2011/jbgv-uchi-danza/](http://www.mojontwins.com/csscgc2011/jbgv-uchi-danza/)
+
+
+
+
+
+
+
+###VADE RETRO
+
+
+
+
+
+Author: J.B.G.V.
+
+Type: Action Game
+
+Year: 2012
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27878](https://spectrumcomputing.co.uk/index.php?cat=96&id=27878)
+
+
+
+
+
+
+
+###Vampe: GOTO Vampe
+
+
+
+
+
+Author: Valdir
+
+Type: Maze Game
+
+Year: 2013
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=28168](https://spectrumcomputing.co.uk/index.php?cat=96&id=28168)
+
+
+
+
+
+
+
+###Walking around Porto
+
+
+
+
+
+Author: Paulo Silva
+
+Type: ?
+
+Year: 2013
+
+Source: Yes
+
+Link: [http://csscgc2013.blogspot.pt/2013/06/walking-around-porto.html](http://csscgc2013.blogspot.pt/2013/06/walking-around-porto.html)
+
+Description: a tour in Porto (or Oporto) city - runs on a 128kb ZX-Spectrum, on a b&w display
+
+
+
+
+
+
+
+###Yumiko in the haunted Mansion
+
+
+
+
+
+Author: Leszek Chmielewski Daniel (LCD)
+
+Type: Action Game
+
+Year: 2012
+
+Source: No
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27988](https://spectrumcomputing.co.uk/index.php?cat=96&id=27988)
+
+
+
+
+
+
+
+###ZEN
+
+
+
+
+
+Author: Einar Saukas, Mister Beep
+
+Type: Puzzle
+
+Year: 2014
+
+Source: Yes
+
+Link: [http://www.worldofspectrum.org/forums/showthread.php?t=49117](http://www.worldofspectrum.org/forums/showthread.php?t=49117)
+
+
+
+
+
+
+
+###ZEN II
+
+
+
+
+
+Author: Einar Saukas, Mister Beep
+
+Type: Puzzle
+
+Year: 2015
+
+Source: Yes
+
+Link: [http://www.worldofspectrum.org/forums/discussion/50404/](http://www.worldofspectrum.org/forums/discussion/50404/)
+
+
+
+
+
+
+
+###ZX Destroyer
+
+
+
+
+
+Author: Alxinho
+
+Type: Shooter
+
+Year: 2014
+
+Source: Yes
+
+Link: [http://retrobytesproductions.blogspot.com.es/2014/03/zx-destroyer.html](http://retrobytesproductions.blogspot.com.es/2014/03/zx-destroyer.html)
+
+
+
+
+
+
+
+###ZX Striker
+
+
+
+
+
+Author: Valdir
+
+Type: Sports Game
+
+Year: 2013
+
+Source: No
+
+Link: [http://www.worldofspectrum.org/forums/showthread.php?t=44210](http://www.worldofspectrum.org/forums/showthread.php?t=44210)
+
+
+
+
+
+
+
+##DEMOS
+
+###EMS Christmas Card Demo
+
+
+
+
+
+Author: Eqx
+
+Type:
+
+Year: 2016
+
+Source: No
+
+Link: [http://www.boriel.com/forum/gallery/ems-christmas-card-demo-t1102.html](http://www.boriel.com/forum/gallery/ems-christmas-card-demo-t1102.html)
+
+
+
+
+
+
+
+###JRPG Test
+
+
+
+
+
+Author: rikokun
+
+Type:
+
+Year: 2016
+
+Source: No
+
+Link: [http://www.boriel.com/forum/gallery/jrpg-test-and-tileeditor-t1082.html](http://www.boriel.com/forum/gallery/jrpg-test-and-tileeditor-t1082.html)
+
+
+
+
+
+
+
+###Just Something Silly
+
+
+
+
+
+Author: emook
+
+Type: Demo
+
+Year: 2016
+
+Source: No
+
+Link: [http://www.boriel.com/forum/gallery/just-something-silly-t1095.html](http://www.boriel.com/forum/gallery/just-something-silly-t1095.html)
+
+Description:
+
+
+
+
+
+
+
+###Nothing Thing
+
+
+
+
+
+Author: Paulo Silva
+
+Type: Demo
+
+Year: 2013
+
+Source: Yes
+
+Link: [http://csscgc2013.blogspot.pt/2013/03/nothing-thing.html](http://csscgc2013.blogspot.pt/2013/03/nothing-thing.html)
+
+Description: optimized for ULA-Plus palette, it will look weird on common ZX-Spectrum machines.
+
+
+
+
+
+
+
+##GAME ENGINES
+
+###BIFROST* ENGINE
+
+
+
+
+
+Authors: Einar Saukas, Dave Hughes
+
+Type: Multicolor Engine
+
+Year: 2012
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27405](https://spectrumcomputing.co.uk/index.php?cat=96&id=27405)
+
+
+
+
+
+
+
+###BIFROST*2 ENGINE
+
+
+
+
+
+Author: Einar Saukas
+
+Type: Multicolor Engine
+
+Year: 2016
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30003](https://spectrumcomputing.co.uk/index.php?cat=96&id=30003)
+
+
+
+
+
+
+
+###Fourspriter Engine
+
+
+
+
+
+Author: The Mojon Twins
+
+Type: Sprite Engine
+
+Year: 2010
+
+Source: Yes
+
+Link: [http://www.mojontwins.com/juegos_mojonos/fourspriter-1-0/](http://www.mojontwins.com/juegos_mojonos/fourspriter-1-0/)
+
+
+
+
+
+
+
+###NIRVANA ENGINE
+
+
+
+
+
+Author: Einar Saukas
+
+Type: Bicolor Engine
+
+Year: 2013
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30001](https://spectrumcomputing.co.uk/index.php?cat=96&id=30001)
+
+
+
+
+
+
+
+###NIRVANA+ ENGINE
+
+
+
+
+
+Author: Einar Saukas
+
+Type: Bicolor Engine
+
+Year: 2015
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=30002](https://spectrumcomputing.co.uk/index.php?cat=96&id=30002)
+
+
+
+
+
+
+
+##UTILITIES
+
+###+3e FileBrowser
+
+
+
+
+
+Author: BCH
+
+Type: Utility
+
+Year: 2013
+
+Source: Yes
+
+Link: [http://www.boriel.com/forum/post4353.html#p4353](http://www.boriel.com/forum/post4353.html#p4353)
+
+
+
+
+
+
+
+](http://www.old-computers.com/museum/computer.asp?st=1&c=459 was in the "Author" field, i wonder why... -->)
+
+###Multi I/O Board
+
+
+
+
+
+Author: Ian Johnston
+
+Type: Utility
+
+Year: 2014
+
+Source: Yes
+
+Link: [http://www.boriel.com/forum/gallery/show-off-your-creativity-t578-45.html#p5341](http://www.boriel.com/forum/gallery/show-off-your-creativity-t578-45.html#p5341)
+
+
+
+
+
+
+
+###The Spectrum Client
+
+
+
+
+
+Author: ardentcrest
+
+Type: Utility
+
+Year: 2015
+
+Source: No
+
+Link: [http://www.boriel.com/forum/gallery/the-spectrum-client-t972.html](http://www.boriel.com/forum/gallery/the-spectrum-client-t972.html)
+
+
+
+
+
+
+
+###ZX7
+
+
+
+
+
+Author: Einar Saukas
+
+Type: Utility
+
+Year: 2012
+
+Source: Yes
+
+Link: [https://spectrumcomputing.co.uk/index.php?cat=96&id=27996](https://spectrumcomputing.co.uk/index.php?cat=96&id=27996)
+
+
+
+
+
+
+
+##HARDWARE ADD-ONS
+
+- [Spectra](released_programs_-_spectra.md)
+
+----
+
+##OTHER HARDWARE
+
+###Home Computers
+
+- Sinclair [ZX-Spectrum](released_programs.md) (default)
+
+- ASCII [MSX](released_programs_-_msx.md)
+
+- Mattel [Aquarius](released_programs_-_mattelaquarius.md)
+
+- [ZX-Evolution/ATM-Turbo](released_programs_-_zxevolutionatmturbo.md)
+
+- Amstrad [CPC](released_programs_-_amstradcpc.md)
+
+- MGT [Sam Coupé](released_programs_-_samcoupe.md)
+
+- CCE [MC-1000](released_programs_-_mc1000.md)
+
+- Sinclair [ZX81](released_programs_-_zx81.md)
+
+- Casio [PV-2000](released_programs_-_pv2000.md)
+
+- Sharp [MZ-700](released_programs_-_mz700.md)
+
+- Sord [M5](released_programs_-_sordm5.md)
+
+- Tandy Radio Shack [TRS-80 Model I](released_programs_-_trs-80.md)
+
+- Bandai [Gundam RX-78](released_programs_-_rx78.md)
+
+- Philips/Radiola [VG5000](released_programs_-_vg5000.md)
+
+- [Enterprise 64/128](released_programs_-_enterprise.md)
+
+###Game Consoles
+
+- Amstrad [GX4000](released_programs_-_amstradcpc.md)
+
+- Bally [Astrocade](released_programs_-_ballyastrocade.md)
+
+- Casio [PV-1000](released_programs_-_pv1000.md)
+
+- Coleco [ColecoVision](released_programs_-_colecovision.md)
+
+- Sega [SG1000](released_programs_-_sg1000.md)
+
+- Sega [Master System](released_programs_-_sms.md)
+
+###Handheld Consoles
+
+- Sega [GameGear](released_programs_-_gamegear.md)
+
+###Arcade Systems
+
+- Ace [Sidewinder](released_programs_-_acesidewinder.md)
+
+- Alphadenshi/Sega [Champion Baseball](released_programs_-_alphadenshisegachampionbaseball.md)
+
+- Bally/Midway [Rampage](released_programs_-_ballymidwayrampage.md)
+
+- Bally/Midway/Zilec [Blue Print](released_programs_-_ballymidwayzilecblueprint.md)
+
+- Barko [One+Two](released_programs_-_barkooneplustwo.md)
+
+- Bordun [Sky Lancer](released_programs_-_bordunskylancer.md)
+
+- Capcom [1942](released_programs_-_capcom1942.md)
+
+- Capcom [BlackTiger](released_programs_-_capcomblacktiger.md)
+
+- Capcom [Higemaru](released_programs_-_capcomhigemaru.md)
+
+- Capcom [Section-Z](released_programs_-_capcomsectionz.md)
+
+- Capcom [Vulgus](released_programs_-_capcomvulgus.md)
+
+- Chuo [Time Limit](released_programs_-_chuotimelimit.md)
+
+- Crawl/Denshi [Dorachan](released_programs_-_crawldenshidorachan.md)
+
+- Daehyun [Pipeline](released_programs_-_daehyunpipeline.md)
+
+- Dyna [Royal Casino](released_programs_-_dynaroyalcasino.md)
+
+- ElectronicDevices [Ping Pong Masters ’93](released_programs_-_electronicdevicespingpongmasters93.md)
+
+- Enerdyne [American SpeedWay](released_programs_-_enerdyneamericanspeedway.md)
+
+- Epos [Megadon](released_programs_-_eposmegadon.md)
+
+- Funai/Gakken [Esh’s Aurunmilla](released_programs_-_funaigakkeneshsaurunmilla.md)
+
+- Funai/Gakken [Interstellar Laser Fantasy](released_programs_-_funaigakkeninterstellarlaserfantasy.md)
+
+- Hoei [Laser Base](released_programs_-_hoeilaserbase.md)
+
+- InChang [Funny Bubble](released_programs_-_inchangfunnybubble.md)
+
+- Invi [Egg Hunt](released_programs_-_inviegghunt.md)
+
+- Irem [M52](released_programs_-_iremm52.md)
+
+- Irem [M62](released_programs_-_iremm62.md)
+
+- Irem/GDI [Oli-Boo-Chu](released_programs_-_iremgdioliboochu.md)
+
+- Jackson [Flipper Jack](released_programs_-_jacksonflipperjack.md)
+
+- Jaleco [D-Day](released_programs_-_jalecodday.md)
+
+- Jaleco [Field Combat](released_programs_-_jalecofieldcombat.md)
+
+- Jaleco [Moero Pro Yakyuu Homerun Kyousou](released_programs_-_jalecomoeroproyakyuuhomerunkyousou.md)
+
+- Jaleco [Naughty Boy](released_programs_-_jaleconaughtyboy.md)
+
+- Kaneko [Fast Freddie](released_programs_-_kanekofastfreddie.md)
+
+- Kaneko [Fighting Roller](released_programs_-_kanekofightingroller.md)
+
+- Kiwako [Mr. Jong](released_programs_-_kiwakomrjong.md)
+
+- Komax [Flower](released_programs_-_komaxflower.md)
+
+- Konami [Green Beret](released_programs_-_konamigreenberet.md)
+
+- Konami [Mogura Desse](released_programs_-_konamimoguradesse.md)
+
+- Konami [Ping Pong](released_programs_-_konamipingpong.md)
+
+- Konami [Pooyan](released_programs_-_konamipooyan.md)
+
+- Konami [Scramble](released_programs_-_scramble.md)
+
+- Konami [Super Cobra](released_programs_-_konamisupercobra.md)
+
+- Konami [Target Panic](released_programs_-_konamitargetpanic.md)
+
+- Konami [Test Board](released_programs_-_konamitestboard.md)
+
+- Konami [Time Pilot](released_programs_-_konamitimepilot.md)
+
+- Meadows [WarpSpeed](released_programs_-_meadowswarpspeed.md)
+
+- Mondial [LadyFrog](released_programs_-_mondialladyfrog.md)
+
+- Namco [PacMan](released_programs_-_pacman.md)
+
+- Nichibutsu [Gomoku Narabe Renju](released_programs_-_nichibutsugomokunaraberenju.md)
+
+- Nichibutsu [Seicross](released_programs_-_nichibutsuseicross.md)
+
+- Nintendo [Donkey Kong](released_programs_-_nintendodonkeykong.md)
+
+- Olympia [D-Day](released_programs_-_olympiadday.md)
+
+- Omori [Car Jamboree](released_programs_-_omoricarjamboree.md)
+
+- Omori [Space Guerrilla](released_programs_-_omorispaceguerrilla.md)
+
+- Orca [Funky Bee](released_programs_-_orcafunkybee.md)
+
+- Orca [Marine Boy](released_programs_-_orcamarineboy.md)
+
+- Orca [Zodiack](released_programs_-_orcazodiack.md)
+
+- Orca/Thunderbolt [Espial](released_programs_-_orcathunderboltespial.md)
+
+- PAL [Chance Thirty Two](released_programs_-_palchance32.md)
+
+- Photon-IK2 [Brodjaga](released_programs_-_photonik2brodjaga.md)
+
+- Poby [News](released_programs_-_pobynews.md)
+
+- San Remo [Number One](released_programs_-_sanremonumberone.md)
+
+- Sanritsu [Dr. Micro](released_programs_-_sanritsudrmicro.md)
+
+- Sega [Appoooh](released_programs_-_segaappoooh.md)
+
+- Sega [Bank Panic](released_programs_-_segabankpanic.md)
+
+- Sega [Dottori Kun](released_programs_-_segadottorikun.md)
+
+- Sega [E](released_programs_-_segae.md)
+
+- Sega [Gigas](released_programs_-_segagigas.md)
+
+- Seibu Kaihatsu [Knuckle Joe](released_programs_-_seibukaihatsuknucklejoe.md)
+
+- Seibu Kaihatsu [Wiz](released_programs_-_seibukaihatsuwiz.md)
+
+- Seoul Coin [Quiz Olympic](released_programs_-_seoulcoinquizolympic.md)
+
+- Seta Kikaku [Hana Awase](released_programs_-_setakikakuhanaawase.md)
+
+- Shoei [Sky Army](released_programs_-_shoeiskyarmy.md)
+
+- Stern [Astro Invader](released_programs_-_sternastroinvader.md)
+
+- Stern [Berzerk](released_programs_-_sternberzerk.md)
+
+- Success/Fujiwara [Super Othello](released_programs_-_successfujiwarasuperothello.md)
+
+- Summit Coin [Push Over](released_programs_-_summitcoinpushover.md)
+
+- Sun [Dai San Wakusei Meteor](released_programs_-_sundaisanwakuseimeteor.md)
+
+- Sun [Markham](released_programs_-_sunmarkham.md)
+
+- Sun [Stratovox](released_programs_-_sunstratovox.md)
+
+- Sun [StrenghtAndSkill](released_programs_-_sunstrenghtandskill.md)
+
+- Taito [Chack'n'Pop](released_programs_-_taitochacknpop.md)
+
+- Taito [Crazy Balloon](released_programs_-_taitocrazyballoon.md)
+
+- Taito [Kusayakyuu](released_programs_-_taitokusayakyuu.md)
+
+- Taito [Marine Date](released_programs_-_taitomarinedate.md)
+
+- Taito [Metal Soldier Isaac II](released_programs_-_taitometalsoldierisaac2.md)
+
+- Taito [Minivader](released_programs_-_taitominivader.md)
+
+- Taito [Pit and Run](released_programs_-_taitopitandrun.md)
+
+- Taito [Samurai Nihon Ichi](released_programs_-_taitosamurainihonichi.md)
+
+- Taito [The Fairyland Story](released_programs_-_taitothefairylandstory.md)
+
+- Taito [The Legend of Kage](released_programs_-_taitothelegendofkage.md)
+
+- Taito [The Pit](released_programs_-_taitothepit.md)
+
+- Taito [WyvernF0](released_programs_-_taitowyvernf0.md)
+
+- Taiyo [ChineseHero](released_programs_-_taiyochinesehero.md)
+
+- Tamtex [Shisensho Joshiryo Hen](released_programs_-_tamtexshisenshojoshiryohen.md)
+
+- Tecfri [Sauro](released_programs_-_tecfrisauro.md)
+
+- [Tecmo](released_programs_-_tecmo.md)
+
+- Tecmo [Solomon’s Key](released_programs_-_tecmosolomonskey.md)
+
+- Tehkan [Bomb Jack](released_programs_-_tehkanbombjack.md)
+
+- Tehkan [Pinball Action](released_programs_-_tehkanpinballaction.md)
+
+- Tehkan [Red Clash](released_programs_-_tehkanredclash.md)
+
+- Teknon Kogyo [Beam Invader](released_programs_-_teknonkogyobeaminvader.md)
+
+- Universal [Cheeky Mouse](released_programs_-_universalcheekymouse.md)
+
+- Universal [Cosmic Alien](released_programs_-_universalcosmicalien.md)
+
+- Universal [Do Castle](released_programs_-_universaldocastle.md)
+
+- Universal [Lady Bug](released_programs_-_universalladybug.md)
+
+- Universal [Mr. Do](released_programs_-_universalmrdo.md)
+
+- Valadon [Bagman](released_programs_-_valadonbagman.md)
+
+- Valadon [Tank Busters](released_programs_-_valadontankbusters.md)
+
+- VEB [Poly-Play](released_programs_-_vebpolyplay.md)
+
+- Wing [Super Wing](released_programs_-_wingsuperwing.md)
+
+- Wonwoo [Domino Block](released_programs_-_wonwoodominoblock.md)
+
+- Zaccaria [Jack Rabbit](released_programs_-_zaccariajackrabbit.md)
+
+- Zilec [Enigma II](released_programs_-_zilecenigma2.md)
+
+
diff --git a/docs/restore.md b/docs/restore.md
new file mode 100644
index 000000000..cc0302b7e
--- /dev/null
+++ b/docs/restore.md
@@ -0,0 +1,46 @@
+#RESTORE
+
+
+##Syntax
+```
+RESTORE [