├── .gitignore ├── LICENSE.md ├── README.md ├── basic.js ├── bell.js ├── bs.html ├── cm ├── basic.css └── basic.js ├── display.css ├── dos.js ├── favicon.ico ├── hires.js ├── index.html ├── index.js ├── lores.js ├── printer.js ├── reference.html ├── res ├── bell.wav ├── font-40col.png ├── font-80col.png ├── font.png └── lpt.jpg ├── samples ├── TRADER C.txt ├── index.txt ├── sample.10print.txt ├── sample.3dhat.txt ├── sample.3drectangle.txt ├── sample.adventure.txt ├── sample.aritm.txt ├── sample.artillery.txt ├── sample.basic.txt ├── sample.bite.txt ├── sample.bitmaps.txt ├── sample.blackhole.txt ├── sample.bodymass.txt ├── sample.boys_surface.txt ├── sample.building.txt ├── sample.calculatedimage.txt ├── sample.charset.txt ├── sample.chase.txt ├── sample.codabar.txt ├── sample.coloredserpinski.txt ├── sample.colorrings.txt ├── sample.columns.txt ├── sample.connections.txt ├── sample.dbconverge.txt ├── sample.dbpendulum.txt ├── sample.dbvectorship.txt ├── sample.dbvectortext.txt ├── sample.default.txt ├── sample.dicegame.txt ├── sample.doordetector.txt ├── sample.dragon.txt ├── sample.dragonsmaze.txt ├── sample.dye.txt ├── sample.enterprise.txt ├── sample.enterprise2.txt ├── sample.factors.txt ├── sample.february.txt ├── sample.fsim.txt ├── sample.functiongraphing.txt ├── sample.gaussian.txt ├── sample.hacker.txt ├── sample.hangman.txt ├── sample.hellosine.txt ├── sample.hgrblends.txt ├── sample.hireswalk.txt ├── sample.jobs.txt ├── sample.jot.txt ├── sample.keyboard.txt ├── sample.logo.txt ├── sample.loresdrawing.txt ├── sample.loreswalk.txt ├── sample.mandelbrot.txt ├── sample.mandelbrot2.txt ├── sample.miniindy.txt ├── sample.moire.txt ├── sample.ninjaturtle.txt ├── sample.nuclear.txt ├── sample.onelinetrain.txt ├── sample.pacman.txt ├── sample.paint.txt ├── sample.piglatin.txt ├── sample.platformer.txt ├── sample.pretzel.txt ├── sample.primecheck.txt ├── sample.primes.txt ├── sample.protonelectron.txt ├── sample.puzzler.txt ├── sample.quine.txt ├── sample.radar.txt ├── sample.raindrops.txt ├── sample.randommaze.txt ├── sample.readsector.txt ├── sample.rodscolorpattern.txt ├── sample.scribble.txt ├── sample.sectorgen.txt ├── sample.sierpinski.txt ├── sample.sierpinski2.txt ├── sample.snowflakes.txt ├── sample.spaceattack.txt ├── sample.squiggle.txt ├── sample.stellar7.txt ├── sample.steve.txt ├── sample.stringart.txt ├── sample.stringfns.txt ├── sample.tetris.txt ├── sample.thunderclock.txt ├── sample.unfinishedmaze.txt ├── sample.unittests.txt ├── sample.vdt.txt ├── sample.wizardscastle.txt ├── sample.xmastree.txt ├── sample.zhorelay.txt └── simple.pong.txt ├── script.js ├── script.md ├── styles.css ├── tools └── make_styles.js ├── tty.js └── vfs ├── DATAFILE.txt ├── JABBERWOCKY.txt ├── OD JUMP.txt ├── SHIPS.txt ├── SHIPS@.txt ├── SOLOMANI.txt ├── SOLOMANI@.txt ├── SOLOMANI_MAP.txt ├── SPINWARD.txt ├── SPINWARD@.txt └── SPINWARD_MAP.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Applesoft BASIC in Javascript 2 | 3 | Source Code Copyright (C) 2009-2013 Joshua Bell 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | https://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | 17 | 18 | Sample files are Copyright (C) the original submitters 19 | 20 | 21 | The following files are Copyright (C) 1977-2013 Far Future Enterprises: 22 | * samples/sample.sectorgen.txt 23 | * samples/sample.zhorelay.txt 24 | * samples/sample.readsector.txt 25 | * samples/TRADER C.txt 26 | * vfs/OD JUMP.txt 27 | * vfs/SHIPS.txt 28 | * vfs/SHIPS@.txt 29 | * vfs/SOLOMANI.txt 30 | * vfs/SOLOMANI@.txt 31 | * vfs/SOLOMANI_MAP.txt 32 | * vfs/SPINWARD.txt 33 | * vfs/SPINWARD@.txt 34 | * vfs/SPINWARD_MAP.txt 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jsbasic - Applesoft BASIC in JavaScript 2 | ======================================= 3 | 4 | This is hosted for playing with at https://inexorabletash.github.io/jsbasic/ 5 | 6 | Notes & Known Issues 7 | -------------------- 8 | * The BASIC program is compiled to JavaScript before execution. Syntax errors are therefore detected at compile-time rather than at run-time as on a traditional interpreter. For example, the following program would run without errors on an Apple since the erroneous second statement is never reached. `10 END : CHR$(PRINT)` 9 | * Handling of BASIC code that does not match the canonical `LIST` output format may not behave as on an Apple: 10 | * Keyword parsing differs from Applesoft command line. For example `FOR I = S TO P` doesn't collapse into `FOR I = STOP`. 11 | * Limitations: 12 | * Floating point overflow is only detected on variable assignment. 13 | * Only a subset of DOS 3.3 and ProDOS useful for basic file I/O are implemented. 14 | * Only a small number of common `PEEK`, `POKE` and `CALL` locations are supported. 15 | * Commands that refer to assembly routines (`&`, `USR()` etc.), shape tables, and tape I/O are not implemented. 16 | * Commands that operate on the program itself (`LIST`, `RUN`, `DEL`, etc.) are not implemented. 17 | * A handful of extensions are made beyond Applesoft BASIC: 18 | * To improve readability, lines may start with `:` and continue the previously numbered line. 19 | * `DEF FN` can define string functions 20 | * `==` can be used as `=` 21 | * `CHR$()` values > 255 do interesting things 22 | * `HSCRN(x, y)` allows probing the hi-res screen 23 | * hexadecimal literals e.g. `$C010` can be used as numbers 24 | -------------------------------------------------------------------------------- /bs.html: -------------------------------------------------------------------------------- 1 | 2 | BasicScript demo 3 |

Something important

4 | 5 | 6 | 15 | 16 | 34 | -------------------------------------------------------------------------------- /cm/basic.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-basic-statement { 2 | color: #00007f; 3 | } 4 | 5 | .cm-s-default span.cm-basic-unsupported { 6 | color: #00007f; 7 | background-color: #ff7f7f 8 | } 9 | 10 | .cm-s-default span.cm-basic-function { 11 | color: teal; 12 | } 13 | 14 | .cm-s-default span.cm-basic-identifier { 15 | color: #7f7f00; 16 | } 17 | 18 | .cm-s-default span.cm-basic-string { 19 | color: #007f00; 20 | } 21 | 22 | .cm-s-default span.cm-basic-number { 23 | color: #0000ff; 24 | } 25 | 26 | .cm-s-default span.cm-basic-operator { 27 | color: #7f007f; 28 | } 29 | 30 | .cm-s-default span.cm-basic-separator { 31 | color: #7f7f7f; 32 | } 33 | 34 | .cm-s-default span.cm-basic-linenumber { 35 | color: orange; 36 | } 37 | 38 | .cm-s-default span.cm-basic-comment { 39 | color: #cc00ff; 40 | font-style: italic; 41 | } 42 | 43 | .cm-s-default span.cm-basic-error { 44 | color: black; 45 | background-color: red; 46 | } 47 | -------------------------------------------------------------------------------- /cm/basic.js: -------------------------------------------------------------------------------- 1 | 2 | // Really just a lexer 3 | 4 | CodeMirror.defineMode('basic', function(config, parserConfig) { 5 | 6 | var STATEMENT = 'basic-statement', 7 | OPERATOR = 'basic-operator', 8 | FUNCTION = 'basic-function', 9 | UNSUPPORTED = 'basic-unsupported'; 10 | 11 | var reserved = { 12 | "ABS": FUNCTION, 13 | "AND": OPERATOR, 14 | "ASC": FUNCTION, 15 | "ATN": FUNCTION, 16 | "AT": STATEMENT, 17 | "CALL": STATEMENT, 18 | "CHR$": FUNCTION, 19 | "CLEAR": STATEMENT, 20 | "COLOR=": STATEMENT, 21 | "CONT": UNSUPPORTED, 22 | "COS": FUNCTION, 23 | "DATA": STATEMENT, 24 | "DEF": STATEMENT, 25 | "DEL": UNSUPPORTED, 26 | "DIM": STATEMENT, 27 | "DRAW": UNSUPPORTED, 28 | "END": STATEMENT, 29 | "EXP": FUNCTION, 30 | "FLASH": STATEMENT, 31 | "FN": STATEMENT, 32 | "FOR": STATEMENT, 33 | "FRE": FUNCTION, 34 | "GET": STATEMENT, 35 | "GOSUB": STATEMENT, 36 | "GOTO": STATEMENT, 37 | "GR": STATEMENT, 38 | "HCOLOR=": STATEMENT, 39 | "HGR2": STATEMENT, 40 | "HGR": STATEMENT, 41 | "HIMEM:": UNSUPPORTED, 42 | "HLIN": STATEMENT, 43 | "HOME": STATEMENT, 44 | "HPLOT": STATEMENT, 45 | "HTAB": STATEMENT, 46 | "IF": STATEMENT, 47 | "IN#": STATEMENT, 48 | "INPUT": STATEMENT, 49 | "INT": FUNCTION, 50 | "INVERSE": STATEMENT, 51 | "LEFT$": FUNCTION, 52 | "LEN": FUNCTION, 53 | "LET": STATEMENT, 54 | "LIST": UNSUPPORTED, 55 | "LOAD": UNSUPPORTED, 56 | "LOG": FUNCTION, 57 | "LOMEM:": UNSUPPORTED, 58 | "MID$": FUNCTION, 59 | "NEW": UNSUPPORTED, 60 | "NEXT": STATEMENT, 61 | "NORMAL": STATEMENT, 62 | "NOTRACE": STATEMENT, 63 | "NOT": OPERATOR, 64 | "ONERR": STATEMENT, 65 | "ON": STATEMENT, 66 | "OR": OPERATOR, 67 | "PDL": FUNCTION, 68 | "PEEK": FUNCTION, 69 | "PLOT": STATEMENT, 70 | "POKE": STATEMENT, 71 | "POP": STATEMENT, 72 | "POS": FUNCTION, 73 | "PRINT": STATEMENT, 74 | "PR#": STATEMENT, 75 | "READ": STATEMENT, 76 | "RECALL": UNSUPPORTED, 77 | "REM": STATEMENT, 78 | "RESTORE": STATEMENT, 79 | "RESUME": STATEMENT, 80 | "RETURN": STATEMENT, 81 | "RIGHT$": FUNCTION, 82 | "RND": FUNCTION, 83 | "ROT=": UNSUPPORTED, 84 | "RUN": UNSUPPORTED, 85 | "SAVE": UNSUPPORTED, 86 | "SCALE=": UNSUPPORTED, 87 | "SCRN": FUNCTION, 88 | "SGN": FUNCTION, 89 | "SHLOAD": UNSUPPORTED, 90 | "SIN": FUNCTION, 91 | "SPC": FUNCTION, 92 | "SPEED=": STATEMENT, 93 | "SQR": FUNCTION, 94 | "STEP": STATEMENT, 95 | "STOP": STATEMENT, 96 | "STORE": UNSUPPORTED, 97 | "STR$": FUNCTION, 98 | "TAB": FUNCTION, 99 | "TAN": FUNCTION, 100 | "TEXT": STATEMENT, 101 | "THEN": STATEMENT, 102 | "TO": STATEMENT, 103 | "TRACE": STATEMENT, 104 | "USR": FUNCTION, 105 | "VAL": FUNCTION, 106 | "VLIN": STATEMENT, 107 | "VTAB": STATEMENT, 108 | "WAIT": UNSUPPORTED, 109 | "XDRAW": UNSUPPORTED, 110 | "&": UNSUPPORTED, 111 | "?": STATEMENT 112 | }; 113 | var reservedKeys = (function() { 114 | // Need longer stems first: ATN/AT, ONERR/ON, NOTRACE/NOT 115 | var keys = [], name; 116 | for (name in reserved) { 117 | if (Object.prototype.hasOwnProperty.call(reserved, name)) { 118 | keys.push(name); 119 | } 120 | } 121 | keys.sort(); 122 | keys.reverse(); 123 | return keys; 124 | } ()); 125 | 126 | // states are 'normal' and 'comment' 127 | 128 | return { 129 | startState: function() { 130 | return { 131 | state: 'normal' 132 | }; 133 | }, 134 | 135 | token: function(stream, state) { 136 | var name, i; 137 | 138 | if (state.state === 'normal') { 139 | if (stream.eatSpace()) { 140 | return null; 141 | } 142 | 143 | if (stream.match(/^[0-9]*\.?[0-9]+(?:[eE]\s*[\-+]?\s*[0-9]+)?/, true)) { 144 | return 'basic-number'; 145 | } 146 | if (stream.match(/^\$[0-9A-Fa-f]+/, true)) { 147 | return 'basic-number'; 148 | } 149 | if (stream.match(/^[;=<>+\-*\/\^(),]/, true)) { 150 | return 'basic-operator'; 151 | } 152 | if (stream.match(/^:/, true)) { 153 | return 'basic-separator'; 154 | } 155 | if (stream.match(/^"([^"]*?)(?:"|(?=\n|\r|$))/, true)) { 156 | return 'basic-string'; 157 | } 158 | if (stream.match('REM', true, true)) { 159 | stream.eatWhile(/[ \u00a0]/); 160 | if (!stream.eol()) { 161 | state.state = 'comment'; 162 | } 163 | return 'basic-statement'; 164 | } 165 | 166 | // TODO: Applesoft-style space ignoring within reserved words 167 | 168 | for (i = 0; i < reservedKeys.length; i += 1) { 169 | name = reservedKeys[i]; 170 | if (stream.match(name, true, true)) { 171 | return reserved[name]; 172 | } 173 | } 174 | 175 | if (stream.match(/[A-Za-z][A-Za-z0-9]*(\$|%)?/, true)) { 176 | return 'basic-identifier'; 177 | } 178 | 179 | stream.next(); 180 | return 'basic-error'; 181 | } 182 | 183 | if (state.state === 'comment') { 184 | while (!stream.eol()) { 185 | stream.next(); 186 | } 187 | state.state = 'normal'; 188 | return 'basic-comment'; 189 | } 190 | 191 | throw 'WTF!?'; 192 | } 193 | }; 194 | }); 195 | 196 | CodeMirror.defineMIME("text/x-basic", "basic"); 197 | CodeMirror.defineMIME("text/x-applesoft", "basic"); 198 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inexorabletash/jsbasic/bff32795f65d19527b8d96f60e22734d119262dd/favicon.ico -------------------------------------------------------------------------------- /hires.js: -------------------------------------------------------------------------------- 1 | // 2 | // High Resolution Graphics (HiRes) Emulation 3 | // 4 | 5 | // This variation does not rely on a canvas element with the same dimensions 6 | // as the pixel buffer; instead, it paints pixels on the canvas using rectangles. 7 | // This works even if the underlying canvas implementation does not support 8 | // scaling (e.g. fallbacks for IE using VML or Flash) 9 | 10 | // Usage: 11 | // 12 | // var hires = new HiRes( element, width, height ) 13 | // hires.clear( [color_index] ) 14 | // hires.setColor( color_index ) 15 | // hires.plot( x, y ) 16 | // hires.plot_to( x, x ) 17 | // hires.getPixel( x, x ) // for "HSCRN" 18 | // hires.show( bool ) 19 | // { width: w, height: h } = hires.getScreenSize() 20 | 21 | function HiRes(element, width, height) { 22 | var COLORS, // Apple II to HTML color table 23 | last_x = 0, 24 | last_y = 0, 25 | pixels = [], 26 | color = 7, 27 | context = element.getContext("2d"); 28 | 29 | pixels.length = width * height; 30 | 31 | // From: Apple ][ Colors at MROB 32 | // https://mrob.com/pub/xapple2/colors.html 33 | 34 | COLORS = [ 35 | '#000000', // 0 = Black 1 36 | '#14f53c', // 1 = Green 37 | '#ff44fd', // 2 = Purple 38 | '#ffffff', // 3 = White 1 39 | '#000000', // 4 = Black 2 40 | '#ff6a3c', // 5 = Orange 41 | '#14cffd', // 6 = Medium Blue 42 | '#ffffff' // 7 = White 2 43 | ]; 44 | 45 | this.clear = function(opt_color) { 46 | var i; 47 | context.clearRect(0, 0, element.width, element.height); 48 | pixels = []; 49 | pixels.length = width * height; 50 | if (arguments.length >= 1) { 51 | context.fillStyle = COLORS[opt_color]; 52 | context.fillRect(0, 0, element.width, element.height); 53 | for (i = 0; i < pixels.length; i += 1) { 54 | pixels[i] = opt_color; 55 | } 56 | } 57 | }; 58 | 59 | 60 | this.setColor = function(newColor) { 61 | color = Math.floor(newColor) % COLORS.length; 62 | }; 63 | 64 | 65 | function drawPixel(x, y) { 66 | var sx = element.width / width, 67 | sy = element.height / height; 68 | context.fillRect((x * sx)|0, (y * sy)|0, sx|0, sy|0); 69 | pixels[x + y * width] = color; 70 | } 71 | 72 | this.plot = function(x, y) { 73 | context.fillStyle = COLORS[color]; 74 | drawPixel(x, y); 75 | 76 | last_x = x; 77 | last_y = y; 78 | 79 | }; 80 | 81 | this.plot_to = function(x, y) { 82 | var x0 = last_x, y0 = last_y, x1 = x, y1 = y, 83 | dx = Math.abs(x1 - x0), 84 | dy = Math.abs(y1 - y0), 85 | sx = (x0 < x1) ? 1 : -1, 86 | sy = (y0 < y1) ? 1 : -1, 87 | err = dx - dy, 88 | e2; 89 | 90 | last_x = x; 91 | last_y = y; 92 | 93 | for (;;) { 94 | this.plot(x0, y0); 95 | 96 | if (x0 === x1 && y0 === y1) { return; } 97 | e2 = 2 * err; 98 | if (e2 > -dy) { 99 | err -= dy; 100 | x0 += sx; 101 | } 102 | if (e2 < dx) { 103 | err += dx; 104 | y0 += sy; 105 | } 106 | } 107 | }; 108 | 109 | this.getPixel = function(x, y) { 110 | return pixels[y * width + x] >>> 0; 111 | }; 112 | 113 | this.getScreenSize = function() { 114 | return { width: width, height: height }; 115 | }; 116 | 117 | this.show = function(state) { 118 | element.style.visibility = state ? "visible" : "hidden"; 119 | }; 120 | } 121 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | Applesoft BASIC in JavaScript 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 25 |

Applesoft BASIC in Javascript

26 |

27 | By Joshua Bell 28 | | Source 29 | | README 30 | — Applesoft BASIC Quick Reference 31 | 32 |

Related projects: 33 | Logo in Javascript 34 | | Streaming video to an Apple II - vnIIc 35 |

36 | 37 |
38 | 39 | 40 |
41 |
42 |
43 | 44 | 45 |
46 |
47 |
48 | 49 | 50 |
51 | Enter code:    52 | 53 | 54 | 55 | 58 | 89 | 90 | 91 | 92 | 93 |
94 | 95 |
96 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 |
106 | 107 |
108 | 109 |
110 | 111 | 112 | 126 | 127 |
128 |
129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /lores.js: -------------------------------------------------------------------------------- 1 | // 2 | // Low Resolution Graphics (LoRes) Emulation 3 | // 4 | 5 | // Usage: 6 | // 7 | // var lores = new LoRes( element, width, height ) 8 | // lores.clear() 9 | // lores.setColor( color_index ) 10 | // lores.plot( x, y ) 11 | // lores.hlin( x1, x2, y ) 12 | // lores.vlin( x1, x2, y ) 13 | // lores.show( bool ) 14 | // color_index = lores.getPixel( x, y ) 15 | // { width: w, height: h } = lores.getScreenSize() 16 | 17 | function LoRes(element, width, height) { 18 | 19 | var COLORS, // Apple II to HTML color table 20 | loresPixel = [], // element references 21 | pixels = [], // color values 22 | color = 0; // current color 23 | 24 | 25 | // From: Apple ][ Colors at MROB 26 | // https://mrob.com/pub/xapple2/colors.html 27 | 28 | COLORS = [ 29 | '#000000', // 0 = Black 30 | '#e31e60', // 1 = Deep Red 31 | '#604ebd', // 2 = Dark Blue 32 | '#ff44fd', // 3 = Purple 33 | '#00a360', // 4 = Dark Green 34 | '#9c9c9c', // 5 = Gray 1 35 | '#14cffd', // 6 = Medium Blue 36 | '#d0c3ff', // 7 = Light Blue 37 | '#607203', // 8 = Brown 38 | '#ff6a3c', // 9 = Orange 39 | '#9c9c9c', // 10 = Gray 2 40 | '#ffa0d0', // 11 = Pink 41 | '#14f53c', // 12 = Light Green 42 | '#d0dd8d', // 13 = Yellow 43 | '#72ffd0', // 14 = Aquamarine 44 | '#ffffff' // 15 = White 45 | ]; 46 | 47 | function init() { 48 | var x, y, table, tbody, tr, td; 49 | 50 | pixels = []; 51 | pixels.length = width * height; 52 | loresPixel = []; 53 | loresPixel.length = width * height; 54 | 55 | table = document.createElement('table'); 56 | 57 | tbody = document.createElement('tbody'); 58 | for (y = 0; y < height; y += 1) { 59 | tr = document.createElement('tr'); 60 | for (x = 0; x < width; x += 1) { 61 | td = document.createElement('td'); 62 | td.style.backgroundColor = 'black'; 63 | 64 | loresPixel[y * width + x] = td; 65 | pixels[y * width + x] = 0; 66 | 67 | tr.appendChild(td); 68 | } 69 | tbody.appendChild(tr); 70 | } 71 | table.appendChild(tbody); 72 | 73 | element.innerHTML = ""; 74 | element.appendChild(table); 75 | } 76 | 77 | this.clear = function() { 78 | var x, y, pixel; 79 | for (y = 0; y < height; y += 1) { 80 | for (x = 0; x < width; x += 1) { 81 | pixel = loresPixel[y * width + x]; 82 | pixel.style.backgroundColor = "black"; 83 | pixels[y * width + x] = 0; 84 | } 85 | } 86 | 87 | }; 88 | 89 | this.setColor = function(newColor) { 90 | color = Math.floor(newColor) % COLORS.length; 91 | }; 92 | 93 | function plot(x, y) { 94 | var pixel = loresPixel[y * width + x]; 95 | if (pixel) { 96 | pixel.style.backgroundColor = COLORS[color]; 97 | pixels[y * width + x] = color; 98 | } 99 | } 100 | 101 | this.plot = function(x, y) { 102 | plot(x, y); 103 | }; 104 | 105 | this.getPixel = function(x, y) { 106 | if (0 <= x && x < width && 107 | 0 <= y && y < height) { 108 | 109 | return pixels[y * width + x]; 110 | } else { 111 | return 0; 112 | } 113 | }; 114 | 115 | this.hlin = function(x1, x2, y) { 116 | var x; 117 | if (x1 > x2) { 118 | x = x1; 119 | x1 = x2; 120 | x2 = x; 121 | } 122 | 123 | for (x = x1; x <= x2; x += 1) { 124 | plot(x, y); 125 | } 126 | }; 127 | 128 | this.vlin = function(y1, y2, x) { 129 | var y; 130 | if (y1 > y2) { 131 | y = y1; 132 | y1 = y2; 133 | y2 = y; 134 | } 135 | 136 | for (y = y1; y <= y2; y += 1) { 137 | plot(x, y); 138 | } 139 | }; 140 | 141 | this.getScreenSize = function() { 142 | return { width: width, height: height }; 143 | }; 144 | 145 | this.show = function(state) { 146 | element.style.visibility = state ? "visible" : "hidden"; 147 | 148 | }; 149 | 150 | //---------------------------------------------------------------------- 151 | // Constructor Logic 152 | //---------------------------------------------------------------------- 153 | 154 | init(); 155 | } 156 | -------------------------------------------------------------------------------- /printer.js: -------------------------------------------------------------------------------- 1 | // 2 | // Printer (for copying output) 3 | // 4 | 5 | function Printer(tty, paper) { 6 | var tty_writeChar = tty.writeChar; 7 | tty.writeChar = function(c) { 8 | 9 | tty_writeChar(c); 10 | 11 | switch (c.charCodeAt(0)) { 12 | case 0: 13 | case 1: 14 | case 2: 15 | case 3: 16 | case 4: // DOS hook 17 | case 5: 18 | case 6: 19 | case 7: // (BEL) bell 20 | case 8: // (BS) backspace 21 | case 9: 22 | case 11: // (VT) clear EOS 23 | case 12: // (FF) clear 24 | case 14: // (SO) normal 25 | case 15: // (SI) inverse 26 | case 16: 27 | case 17: // (DC1) 40-column 28 | case 18: // (DC2) 80-column 29 | case 19: // (DC3) stop list 30 | case 20: 31 | case 21: // (NAK) quit (disable 80-col card) 32 | case 22: // (SYN) scroll 33 | case 23: // (ETB) scroll up 34 | case 24: // (CAN) disable mousetext 35 | case 25: // (EM) home 36 | case 26: // (SUB) clear line 37 | case 27: // (ESC) enable mousetext 38 | case 28: // (FS) forward space 39 | case 29: // (GS) clear EOL 40 | case 30: // (RS) gotoXY 41 | case 31: 42 | break; 43 | 44 | case 10: // (LF) line feed 45 | case 13: // (CR) return 46 | paper.appendChild(document.createTextNode('\n')); 47 | break; 48 | 49 | default: 50 | paper.appendChild(document.createTextNode(c)); 51 | break; 52 | } 53 | 54 | if ('normalize' in paper) { 55 | paper.normalize(); 56 | } 57 | paper.scrollTop = paper.scrollHeight; 58 | }; 59 | 60 | this.close = function() { 61 | tty.writeChar = tty_writeChar; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /res/bell.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inexorabletash/jsbasic/bff32795f65d19527b8d96f60e22734d119262dd/res/bell.wav -------------------------------------------------------------------------------- /res/font-40col.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inexorabletash/jsbasic/bff32795f65d19527b8d96f60e22734d119262dd/res/font-40col.png -------------------------------------------------------------------------------- /res/font-80col.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inexorabletash/jsbasic/bff32795f65d19527b8d96f60e22734d119262dd/res/font-80col.png -------------------------------------------------------------------------------- /res/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inexorabletash/jsbasic/bff32795f65d19527b8d96f60e22734d119262dd/res/font.png -------------------------------------------------------------------------------- /res/lpt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inexorabletash/jsbasic/bff32795f65d19527b8d96f60e22734d119262dd/res/lpt.jpg -------------------------------------------------------------------------------- /samples/index.txt: -------------------------------------------------------------------------------- 1 | # ____________________________________________ 2 | # Tests & Demos 3 | 4 | sample.basic Feature Demos 5 | sample.unittests Unit Tests 6 | sample.keyboard Keyboard Test 7 | sample.charset Charset Test 8 | 9 | # ____________________________________________ 10 | # Games 11 | 12 | simple.pong SIMPLE.PONG 13 | sample.adventure Text Adventure (Floyd McWilliams) 14 | sample.dragon The Horrible Rotten Dancing Dragon (Softline by Ken Rose) 15 | sample.pacman (Not Really) ASCII Pac-Man (Michael Kemp) 16 | sample.puzzler Puzzler (Gregg Buntin) 17 | sample.hangman Hangman (Mike Gleason) 18 | sample.raindrops Catch the Raindrop (Nicholas Merchant) 19 | sample.jot JOT (Mike Gleason) 20 | sample.miniindy Mini Indy (Gregg Buntin) 21 | sample.doordetector Door Detector (Jeff) 22 | sample.columns Columns (Arthur Allen) 23 | sample.tetris Tetris (Arthur Allen) 24 | sample.dicegame Colorful Dice (Gregory Lewis) 25 | sample.aritm Aritm - Mental calculation (Mikael O. Bonnier) 26 | sample.unfinishedmaze Unfinished Maze (Alexander G. Tozzi) 27 | sample.dragonsmaze Dragon's Maze (Russell Hokanson) 28 | sample.blackhole Black Hole Maze (S.M.Compton c/o Melody Ayres-Griffiths) 29 | sample.chase Chase (Dominik Heidler) 30 | sample.spaceattack Space Attack! (Alan Ratliff) 31 | sample.building Building (Melvin Rosario) 32 | sample.artillery Artillery (Michael "Moose" O'Malley) 33 | sample.platformer Platformer (Beckett Bylsma & Brendan Ghareeb) 34 | sample.randommaze Maze Generator (Alan Ratliff) 35 | 36 | # ____________________________________________ 37 | # Graphics 38 | 39 | sample.rodscolorpattern Rod's Color Pattern 40 | sample.hacker Hacker Logo (markwstock) 41 | sample.loreswalk Random LoRes (John Melesky) 42 | sample.hireswalk Random HiRes (John Melesky) 43 | sample.sierpinski Sierpinski Triangles (Kevin Miller) 44 | sample.sierpinski2 Sierpinski Triangles (Helen Edgar) 45 | sample.stringart String Art (Chris Heric) 46 | sample.paint Drawing Program (Brian Broker) 47 | sample.scribble Scribble (William Simms) 48 | sample.connections Connections (Gregg Buntin) 49 | sample.squiggle Squiggle (Gregg Buntin) 50 | sample.boys_surface Boy's Surface (Lukas Innig) 51 | sample.gaussian Gaussian Distribution 2D (John Russ) 52 | sample.bitmaps Bitmap Images (Brian Broker) 53 | sample.mandelbrot Mandelbrot Set (c/o Gregory Lewis) 54 | sample.mandelbrot2 Mandelbrot Set in Color 55 | sample.steve Steve (Nicola Foggi) 56 | sample.logo Apple Logo (Brendan Robert) 57 | sample.loresdrawing Graphics Drawing (Gregg Buntin) 58 | sample.calculatedimage Calculated Image (Gregg Buntin) 59 | sample.xmastree Christmas Tree (Gregg Buntin and Rich Orde) 60 | sample.snowflakes Snowflakes (Kevin Riordan) 61 | sample.ninjaturtle Ninja Turtle (Chris Whong) 62 | 63 | sample.3dhat 3D Hat (Micro, the 6502 magazine, may 1981 c/o Golden Child) 64 | sample.dbconverge Double-Buffered Value Convergence (Golden Child) 65 | sample.dbpendulum Double-Buffered Physics Pendulum Simulation (Golden Child) 66 | sample.dbvectorship Double-Buffered Asteroids Ship Demo (Golden Child) 67 | sample.dbvectortext Double-Buffered Vector Font (Golden Child) 68 | sample.stellar7 STELLAR 7 Rotate 3d Objects (Golden Child) 69 | sample.functiongraphing Function Graphing (Golden Child) 70 | sample.codabar Codabar Generator (Golden Child) 71 | 72 | sample.coloredserpinski Colored Serpinski Triangles (Gregory Lewis) 73 | sample.radar Radar (Josiah Keller) 74 | sample.moire Moiré (Sylvie Breaud) 75 | sample.jobs Steve Jobs (Nick McMillen / CJBaird) 76 | sample.dye Will You Dye (Brett Edwards) 77 | sample.pretzel Pretzel (Zee) 78 | sample.3drectangle 3D Rectangle (Tomo Wa) 79 | sample.enterprise Original Series Enterprise (Gil Keidar) 80 | sample.enterprise2 Original Series Enterprise (Alan Ratliff) 81 | sample.colorrings Colored Rings (Miika Oja) 82 | sample.bite Apple Bite (Michael "Moose" O'Malley) 83 | 84 | # ____________________________________________ 85 | # Other 86 | 87 | sample.primes Prime Sieve (Kevin Miller) 88 | sample.february February Surprise (Antti Pirskanen) 89 | sample.hellosine Hello World Sine Wave (Jamie Beu) 90 | sample.bodymass Body Mass Index Calculator (Tim Dwyer) 91 | sample.quine Quine (Nikolay Mirin) 92 | sample.10print 10 PRINT MAZE (translated by Rich Hanes) 93 | sample.primecheck Prime Check (Tony Hill) 94 | sample.vdt Velocity/Distance/Time (feman1977) 95 | sample.protonelectron Proton/Electron Mass Ratio (Mark Rohrbaugh) 96 | sample.onelinetrain One Liner Train (Chris ten Den) 97 | sample.piglatin Pig Latin Translator (Gregg Buntin) 98 | sample.nuclear Nuclear Power Plant (Stephen R. Berggren c/o Kevin Riggle) 99 | sample.factors Prime Factors (Cristiano Trabuio) 100 | 101 | # ____________________________________________ 102 | # Feature Demos 103 | 104 | sample.thunderclock Thunderclock 105 | sample.stringfns STRING$ and SPACE$ Demo (Alan Ratliff) 106 | 107 | # ____________________________________________ 108 | # Traveller RPG Utilities 109 | 110 | TRADER C TRADER 111 | sample.sectorgen Traveller Sector Generator 112 | sample.zhorelay Zhodani Relay Station Placement 113 | sample.readsector Read Sector File 114 | -------------------------------------------------------------------------------- /samples/sample.10print.txt: -------------------------------------------------------------------------------- 1 | 10 PRINT CHR$(47+(45*INT(2*RND(1)))); : GOTO 10 -------------------------------------------------------------------------------- /samples/sample.3dhat.txt: -------------------------------------------------------------------------------- 1 | 1 rem MTU 80 Column 3D HAT Program 2 | 2 REM Micro, the 6502 magazine, may 1981 page 2 3 | 3 REM http://archive.6502.org/publications/micro/micro_36_may_1981.pdf 4 | 4 rem https://archive.org/details/creativecomputing-1981-05/page/n67 5 | 10 HGR2 : HCOLOR=3 6 | 20 P=140 : Q=100 : rem original was 160 but 140 is centered on Apple II 7 | 30 XP=120:XR=1.5*3.1415927 8 | 40 YP=56:YR=1:ZP=64 9 | 50 XF=XR/XP:YF=YP/YR:ZF=XR/ZP 10 | 60 FOR ZI=-Q TO Q-1 11 | 70 IF ZI<-ZP OR ZI>ZP GOTO 150 12 | 80 ZT=ZI*XP/ZP:ZZ=ZI 13 | 90 XL=INT(.5+SQR(XP*XP-ZT*ZT)) 14 | 100 FOR XI=-XL TO XL 15 | 110 XT=SQR(XI*XI+ZT*ZT)*XF:XX=XI 16 | 120 YY=(SIN(XT)+.4*SIN(3*XT))*YF 17 | 130 GOSUB 170 18 | 140 NEXT XI 19 | 150 NEXT ZI 20 | 160 END 21 | 170 X1=XX+ZZ+P 22 | 180 Y1=YY-ZZ+Q 23 | 181 IF Y1<1 THEN Y1=1 : REM MUST BE 1 OR ERROR IN 210 24 | 182 IF Y1>191 THEN Y1=191 25 | 183 IF X1<0 THEN X1=0 26 | 184 IF X1>279 THEN X1=279 27 | 190 HCOLOR=3:HPLOT X1,191-Y1 28 | 210 HCOLOR=0:HPLOT X1,191-(Y1-1) TO X1,191-0 29 | 220 RETURN -------------------------------------------------------------------------------- /samples/sample.3drectangle.txt: -------------------------------------------------------------------------------- 1 | 10 A=0 2 | 20 B=90 3 | 30 C=179 4 | 40 D=269 5 | 50 M=0.015 6 | 55 HCOLOR=1 7 | 60 E=cos(A) 8 | 70 F=sin(A) 9 | 80 G=cos(B) 10 | 90 H=sin(B) 11 | 100 I=cos(C) 12 | 110 J=sin(C) 13 | 120 K=cos(D) 14 | 130 L=sin(D) 15 | 140 HGR 16 | 150 Hplot E/(F+2)*60+100,-1/(F+2)*60+100 to E/(F+2)*60+100,1/(F+2)*60+100 17 | 160 Hplot G/(H+2)*60+100,-1/(H+2)*60+100 to G/(H+2)*60+100,1/(H+2)*60+100 18 | 170 Hplot I/(J+2)*60+100,-1/(J+2)*60+100 to I/(J+2)*60+100,1/(J+2)*60+100 19 | 180 Hplot K/(L+2)*60+100,-1/(L+2)*60+100 to K/(L+2)*60+100,1/(L+2)*60+100 20 | 190 Hplot E/(F+2)*60+100,1/(F+2)*60+100 to G/(H+2)*60+100,1/(H+2)*60+100 21 | 200 Hplot G/(H+2)*60+100,1/(H+2)*60+100 to I/(J+2)*60+100,1/(J+2)*60+100 22 | 210 Hplot I/(J+2)*60+100,1/(J+2)*60+100 to K/(L+2)*60+100,1/(L+2)*60+100 23 | 220 Hplot K/(L+2)*60+100,1/(L+2)*60+100 to E/(F+2)*60+100,1/(F+2)*60+100 24 | 230 Hplot E/(F+2)*60+100,-1/(F+2)*60+100 to G/(H+2)*60+100,-1/(H+2)*60+100 25 | 240 Hplot G/(H+2)*60+100,-1/(H+2)*60+100 to I/(J+2)*60+100,-1/(J+2)*60+100 26 | 250 Hplot I/(J+2)*60+100,-1/(J+2)*60+100 to K/(L+2)*60+100,-1/(L+2)*60+100 27 | 260 Hplot K/(L+2)*60+100,-1/(L+2)*60+100 to E/(F+2)*60+100,-1/(F+2)*60+100 28 | 270 A=M+A 29 | 280 B=M+B 30 | 290 C=M+C 31 | 300 D=M+D 32 | 310 If A=360 Then A=0 33 | 320 If B=360 Then B=0 34 | 330 If C=360 Then C=0 35 | 340 If D=360 Then D=0 36 | 350 goto 60 37 | -------------------------------------------------------------------------------- /samples/sample.aritm.txt: -------------------------------------------------------------------------------- 1 | 1000 REM ARITM V0.3.4 FOR APPLESOFT BASIC IN JAVASCRIPT IS FOSS. 2 | 1020 REM (C) 1992-2022 BY MIKAEL O. BONNIER, LUND, SWEDEN. 3 | 1030 REM E-MAIL: . 4 | 1040 REM ABSOLUTELY NO WARRANTY. 5 | 1050 REM LICENSE GPLV3+, SEE 6 | 1060 REM . 7 | 1070 REM MORE PROGRAMS AT 8 | 1080 REM . ~ IS TILDE. 9 | 1090 REM DOCUMENTATION: 10 | 1100 REM 876543210, 8:TYPE, 7-5:OP1, 4-3:OP2, 2:RES'D, 1-0:#TODO. 11 | 1110 REM PROGRAM: 12 | 1112 GOTO 1115 13 | 1113 STOP 14 | 1114 STOP 15 | 1115 LET R=RND(-PEEK(78)-PEEK(79)*256) 16 | 1116 TEXT:PR#3:PRINT CHR$(17);CHR$(12); 17 | 1117 DIM A(590) 18 | 1118 DEF FN MD(Y)=INT((X/Y-INT(X/Y))*Y+.5) 19 | 1119 DEF FN DIV(Y)=INT(X/Y+.5) 20 | 1120 REM LBL C 21 | 1130 GOSUB 3410:REM CLS 22 | 1140 LET A=0 23 | 1150 IF L>0 AND M GOTO 3000:REM CONTMENU 24 | 1160 IF 0=M THEN LET M=10 25 | 1170 GOTO 3030:REM MENU 26 | 1180 REM LBL S 27 | 1190 GOSUB 3410:REM CLS 28 | 1200 PRINT "GENERATING" 29 | 1210 PRINT "PROBLEMS..." 30 | 1220 LET U=1 31 | 1230 REM DIM A(N) 32 | 1240 REM LBL ADD1 33 | 1250 X=M:Y=10:X=FN DIV(Y) 34 | 1255 IF 0=FN MD(Y) GOTO 1320:REM ADD2 35 | 1260 FOR I=0 TO 9 36 | 1270 FOR J=0 TO 9 37 | 1280 LET A(U)=100000000+I*100000+J*1000+1 38 | 1290 LET U=U+1 39 | 1300 NEXT J 40 | 1310 NEXT I 41 | 1320 REM LBL ADD2 42 | 1330 X=M:X=FN DIV(100) 43 | 1335 IF 0=FN MD(10) GOTO 1410:REM SUB1 44 | 1340 FOR I=0 TO 9 45 | 1350 FOR J=0 TO 9 46 | 1360 LET T=10*(INT(8*RND(1))+1) 47 | 1370 LET A(U)=200000000+(T+I)*100000+J*1000+1 48 | 1380 LET U=U+1 49 | 1390 NEXT J 50 | 1400 NEXT I 51 | 1410 REM LBL SUB1 52 | 1420 X=M:X=FN DIV(1000) 53 | 1425 IF 0=FN MD(10) GOTO 1490:REM SUB2 54 | 1430 FOR I=0 TO 9 55 | 1440 FOR J=I TO 9+I 56 | 1450 LET A(U)=300000000+J*100000+I*1000+1 57 | 1460 LET U=U+1 58 | 1470 NEXT J 59 | 1480 NEXT I 60 | 1490 REM LBL SUB2 61 | 1500 X=M:X=FN DIV(10000) 62 | 1505 IF 0=FN MD(10) GOTO 1580:REM MUL 63 | 1510 FOR I=0 TO 9 64 | 1520 FOR J=I TO 9+I 65 | 1530 LET T=10*(INT(9*RND(1))+1) 66 | 1540 LET A(U)=400000000+(T+J)*100000+I*1000+1 67 | 1550 LET U=U+1 68 | 1560 NEXT J 69 | 1570 NEXT I 70 | 1580 REM LBL MUL 71 | 1590 X=M:X=FN DIV(100000) 72 | 1595 IF 0=FN MD(10) GOTO 1660:REM DIV 73 | 1600 FOR I=0 TO 9 74 | 1610 FOR J=0 TO 9 75 | 1620 LET A(U)=500000000+I*100000+J*1000+1 76 | 1630 LET U=U+1 77 | 1640 NEXT J 78 | 1650 NEXT I 79 | 1660 REM LBL DIV 80 | 1670 X=M:X=FN DIV(1000000) 81 | 1675 IF 0=FN MD(10) GOTO 1750:REM ENDIF 82 | 1680 FOR I=0 TO 9 83 | 1690 FOR J=1 TO 9 84 | 1700 LET T=I*J+INT(J*RND(1)) 85 | 1710 LET A(U)=600000000+T*100000+J*1000+1 86 | 1720 LET U=U+1 87 | 1730 NEXT J 88 | 1740 NEXT I 89 | 1750 REM LBL ENDIF 90 | 1760 LET U=U-1 91 | 1770 LET L=U 92 | 1780 REM LBL U 93 | 1790 PRINT "SHUFFLING..." 94 | 1800 FOR I=U TO 2 STEP -1 95 | 1810 LET J=INT(I*RND(1))+1 96 | 1820 LET TF=A(I) 97 | 1830 LET A(I)=A(J) 98 | 1840 LET A(J)=TF 99 | 1850 NEXT I 100 | 1860 LET K=1 101 | 1870 REM LBL K 102 | 1880 GOSUB 3410:REM CLS 103 | 1890 PRINT MID$(STR$(L),1); 104 | 1895 PRINT " PROBLEMS LEFT. -1 ESC" 105 | 1900 LET TF=A(K) 106 | 1910 X=TF 107 | 1915 LET C=FN DIV(100000000) 108 | 1920 IF 6=C THEN PRINT "INTEGER PART OF "; 109 | 1930 X=TF:X=FN DIV(100000) 110 | 1935 LET I=FN MD(1000) 111 | 1940 PRINT MID$(STR$(I),1); 112 | 1950 GOSUB 3280:REM SIGN 113 | 1960 X=TF:X=FN DIV(1000) 114 | 1965 LET J=FN MD(100) 115 | 1970 PRINT MID$(STR$(J),1); 116 | 1980 PRINT " = ";:INPUT "";A$:A=VAL(A$) 117 | 1985 PRINT 118 | 1990 IF -1=A OR ".1"=A$ OR ",1"=A$ OR "01"=A$ GOTO 1120:REM C 119 | 2000 IF 1=C OR 2=C THEN LET R=I+J:GOTO 2040:REM ENDIF 120 | 2010 IF 3=C OR 4=C THEN LET R=I-J:GOTO 2040:REM ENDIF 121 | 2020 IF 5=C THEN LET R=I*J:GOTO 2040:REM ENDIF 122 | 2030 IF 6=C THEN LET R=INT(I/J):REM ENDIF 123 | 2040 REM LBL ENDIF 124 | 2050 IF ABS(R-A)>1E-6 GOTO 2140:REM WRONG 125 | 2060 PRINT "RIGHT! "; 126 | 2070 X=TF 127 | 2075 IF 0>=FN MD(100) GOTO 2100:REM ENDIF 128 | 2080 LET L=L-1 129 | 2090 LET A(K)=TF-1 130 | 2100 REM LBL ENDIF 131 | 2110 LET K=K+1 132 | 2120 IF 0=L GOTO 2390:REM W 153 | 2280 PRINT "CHECKING..." 154 | 2290 LET N=1 155 | 2300 FOR K=1 TO U 156 | 2310 LET TF=A(K) 157 | 2320 X=TF 158 | 2325 IF 0=FN MD(100) GOTO 2350:REM ENDIF 159 | 2330 LET A(N)=TF 160 | 2340 LET N=N+1 161 | 2350 REM ENDIF 162 | 2360 NEXT K 163 | 2370 LET U=N-1 164 | 2380 GOTO 1780:REM U 165 | 2390 REM LBL W 166 | 2400 PRINT "GOOD!!! WELL DONE!" 167 | 2410 LET D=5000:GOSUB 3402:REM DELAY 168 | 2420 GOTO 1120:REM C 169 | 2430 REM LBL E 170 | 2440 GOSUB 3410:REM CLS 171 | 2450 LET A=0 172 | 2460 LET N=0 173 | 2470 LET TF=M 174 | 2480 GOSUB 2640:REM SUB 175 | 2490 PRINT "ADDITION 1" 176 | 2500 GOSUB 2640:REM SUB 177 | 2510 PRINT "ADDITION 2" 178 | 2520 GOSUB 2640:REM SUB 179 | 2530 PRINT "SUBTRACTION 1" 180 | 2540 GOSUB 2640:REM SUB 181 | 2550 PRINT "SUBTRACTION 2" 182 | 2560 GOSUB 2640:REM SUB 183 | 2570 PRINT "MULTIPLICATION" 184 | 2580 GOSUB 2640:REM SUB 185 | 2590 PRINT "DIVISION | -1 ESC" 186 | 2600 PRINT "0 OK AND GO "; 187 | 2605 PRINT STR$(N) 188 | 2610 GOTO 2780:REM INPUT 189 | 2640 REM SUB 190 | 2650 LET A=A+1 191 | 2660 X=TF 192 | 2665 LET TF=FN DIV(10) 193 | 2670 PRINT MID$(STR$(A),1); 194 | 2680 X=TF 195 | 2685 IF 0=FN MD(10) GOTO 2720:REM ELSE 196 | 2690 PRINT "*"; 197 | 2700 LET N=N+100-10*(6=A) 198 | 2710 GOTO 2740:REM ENDIF 199 | 2720 REM LBL ELSE 200 | 2730 PRINT " "; 201 | 2740 REM LBL ENDIF 202 | 2750 RETURN 203 | 2780 REM LBL INPUT 204 | 2790 PRINT "TOGGLE ITEM 1-6, OR CHOOSE 0 OR -1: ";:INPUT "";A$:A=VAL(A$) 205 | 2800 IF -1>A OR 60)),1); 242 | 3134 PRINT ": "; 243 | 3140 INPUT "";A$:S=VAL(A$) 244 | 3145 PRINT 245 | 3150 IF 1>S OR 4+(L>0)0 263 | 3360 LET R=1 264 | 3370 FOR I=1 TO A 265 | 3380 LET R=R*10 266 | 3390 NEXT I 267 | 3400 RETURN 268 | 3402 REM DELAY 269 | 3404 LET T1=0 270 | 3405 LET D=D*3:REM 60*D/1000 271 | 3406 T1=T1+1:IF T1." 284 | 3520 LET D=5000:GOSUB 3402:REM DELAY 285 | 3530 RETURN 286 | 3540 REM SUB ABOUT 287 | 3550 GOSUB 3410:REM CLS 288 | 3560 PRINT "ABOUT" 289 | 3570 PRINT "ARITM 0.3 (C) 1992-2022 BY" 290 | 3575 PRINT "MIKAEL O. BONNIER, LUND, SWEDEN." 291 | 3580 PRINT "ABSOLUTELY NO WARRANTY." 292 | 3585 PRINT "FOSS, SEE LICENSE GPLV3+." 293 | 3590 LET D=5000:GOSUB 3402:REM DELAY 294 | 3600 RETURN 295 | 3610 REM SUB SOUND 296 | 3665 PRINT CHR$(7);CHR$(7); 297 | 3670 FOR X=1 TO 250:NEXT 298 | 3690 RETURN 299 | -------------------------------------------------------------------------------- /samples/sample.artillery.txt: -------------------------------------------------------------------------------- 1 | 5 REM ARTILLERY #01 2 | 10 TEXT : HOME : SPEED= 255: NORMAL 3 | 15 HOME : VTAB (10): INPUT "INSTRUCTIONS?";A9$ 4 | 16 IF LEFT$ (A9$,1) = "N" THEN 19 5 | 17 HOME : GOTO 20 6 | 19 HOME : TEXT : GOTO 150 7 | 20 PRINT TAB( 15): PRINT : PRINT : PRINT "ARTILLERY": PRINT : PRINT : PRINT : PRINT 8 | 21 PRINT " ARTILLERY IS A SIMULATION OF AN" 9 | 30 PRINT "ARTILLERY DUEL BETWEEN TWO SETS OF GUNS" 10 | 40 PRINT "ON EITHER SIDE OF A MOUNTAIN. BY USING" 11 | 50 PRINT "THE ANGLE OF THE GUN AND THE MILLEMETER" 12 | 60 PRINT "SIZE,YOU WILL BE ABLE TO DESTROY YOUR" 13 | 70 PRINT "OPPONANT. EACH OF YOU IN TURN WILL TAKE" 14 | 80 PRINT "A SHOT AT YOUR OPPONANT WHILE TAKING" 15 | 90 PRINT "INTO ACCOUNT THE WIND SPEED. YOU WILL" 16 | 100 PRINT "ENTER THE DEGREE MEASURE(BETWEEN" 17 | 110 PRINT "20 AND 100 DEGREES).THIS WILL BE 18 | 120 PRINT "FOLLOWED BY THE MILLIMETER SIZE(45 TO" 19 | 130 PRINT "150 MM)" 20 | 131 PRINT 21 | 132 PRINT " -HIT RETURN TO CONTINUE-" 22 | 140 GET LOST$ 23 | 150 HGR 24 | 160 HCOLOR= 6 25 | 170 G(1) = RND (1) * 117 + 8 26 | 180 G(2) = RND (1) * 117 + 125 27 | 190 IF G(2) - G(1) < 140 THEN 170 28 | 200 W1 = INT ( RND (1) * 41) 29 | 210 W2 = INT ( RND (1) + .5) - 1 30 | 220 IF W2 < 0 THEN 240 31 | 230 W2 = 1 32 | 240 HPLOT G(2) + 8,149 TO G(2),145 33 | 250 X = 1 34 | 260 HPLOT G(X) - 8,149 TO G(X),145 35 | 270 HPLOT G(2) + 8,150 TO G(2),146 36 | 280 HPLOT G(X) - 8,150 TO G(X),146 37 | 290 HPLOT G(2) + 4,145 TO G(2) - 3,137 38 | 300 HPLOT G(X) - 4,145 TO G(X) + 3,137 39 | 310 HPLOT G(2) + 5,144 TO G(2) - 7,136 40 | 320 HPLOT G(X) - 5,144 TO G(X) + 7,136 41 | 330 HPLOT G(2) + 2,135 TO G(2) - 2,150 42 | 340 HPLOT G(X) - 2,135 TO G(X) + 2,150 43 | 350 P1 = W2 44 | 360 GOSUB 1440 45 | 370 GOSUB 1630 46 | 380 FOR X8 = 1 TO 20 47 | 390 P2 = 0 48 | 400 P1 = P1 * ( - 1) 49 | 410 GOSUB 1290 50 | 420 PRINT : PRINT : PRINT : GOSUB 1580 51 | 430 PRINT "ENTER DEGREE (20-100) & MM SIZE (45-150) TO DESTROY THE OPPOSING CANNON" 52 | 440 INPUT A1,V1 53 | 441 IF A1 > 100 OR A1 < 20 THEN 445 54 | 442 IF V1 > 150 OR V1 < 45 THEN 445 55 | 443 GOTO 450 56 | 445 PRINT "": INVERSE : PRINT "ILLEGAL QUANTITY-TRY AGAIN": NORMAL : GOTO 430 57 | 450 A1 = A1 * 3.1415926 / 180 58 | 460 X1 = COS (A1) * V1 59 | 470 Y1 = SIN (A1) * V1 60 | 480 T1 = Y1 / 16 61 | 490 T2 = T1 / 24 62 | 500 W3 = W1 * T2 * P1 63 | 510 W5 = 0 64 | 520 FOR Y8 = 0 TO T1 STEP T2 65 | 530 W5 = W5 + W3 66 | 540 X = X1 * Y8 67 | 550 X = X + (W5 * W2) 68 | 560 X = INT (X + .5) 69 | 570 Y = Y1 * Y8 - 16 * Y8 ^ 2 70 | 580 Y = INT (Y + .5) 71 | 590 IF Y < 9 THEN 750 72 | 600 IF P1 < 0 THEN 680 73 | 610 G4 = G(1) + X 74 | 620 IF G4 < 1 OR G4 > 254 THEN 670 75 | 630 IF Y > 149 THEN 670 76 | 640 HCOLOR= 5 77 | 650 HPLOT X2,Y2 TO G4,150 - Y 78 | 660 X2 = G4:Y2 = 150 - Y 79 | 670 GOTO 750 80 | 680 G4 = G(2) - X 81 | 690 IF G4 < 0 OR G4 > 254 THEN 750 82 | 700 IF Y > 149 THEN 750 83 | 710 HCOLOR= 3 84 | 720 HPLOT X2,Y2 TO G4,150 - Y 85 | 730 X2 = G4:Y2 = 150 - Y 86 | 740 IF Y8 = 0 THEN 770 87 | 750 GOSUB 1060 88 | 760 IF P2 = 5 THEN 800 89 | 770 NEXT Y8 90 | 780 Y6 = 150 91 | 790 GOSUB 1160 92 | 800 IF G4 > G(1) + 5 OR G4 < G(1) - 5 THEN 850 93 | 810 PRINT : PRINT : PRINT 94 | 820 PRINT "GOOD WORK! RIGHT GUN SURVIVES." 95 | 830 T3 = T3 + 1 96 | 840 GOTO 930 97 | 850 IF G4 > G(2) + 5 OR G4 < G(2) - 5 THEN 900 98 | 860 PRINT : PRINT : PRINT 99 | 870 PRINT "NICE SHOOTING! LEFT GUN SURVIVES." 100 | 880 T4 = T4 + 1 101 | 890 GOTO 930 102 | 900 P2 = 0 103 | 910 G4 = 0 104 | 920 NEXT X8 105 | 930 PRINT : PRINT "DO YOU WANT TO PLAY AGAIN"; 106 | 940 INPUT A$ 107 | 950 IF A$ = "Y" THEN 150 108 | 951 IF A$ = "YES" THEN 150 109 | 960 HGR 110 | 970 TEXT 111 | 980 HOME 112 | 990 PRINT "SCORE" 113 | 1000 PRINT "-----" 114 | 1010 PRINT "LEFT ";T4 115 | 1020 PRINT "RIGHT ";T3 116 | 1045 D9$ = "CHR$(13)": PRINT D$ 117 | 1050 END 118 | 1060 Y6 = 150 119 | 1070 G8 = Y7 + 2 * G3 120 | 1080 Y7 = G(1) + G2 121 | 1090 IF Y > G3 THEN 1280 122 | 1100 IF G4 < Y7 + Y THEN 1280 123 | 1110 IF G4 > G8 - Y THEN 1280 124 | 1120 P2 = 5 125 | 1130 P2 = 5 126 | 1140 Y6 = 150 - Y 127 | 1150 Y6 = 150 - Y 128 | 1160 FOR Z = 1 TO 5 129 | 1170 IF G4 < 0 OR G4 > 253 THEN 1240 130 | 1180 HPLOT G4,Y6 - Z 131 | 1190 HPLOT G4 + Z,Y6 - Z 132 | 1200 HPLOT G4 - Z,Y6 - Z 133 | 1210 HPLOT G4 + Z,Y6 - 1 134 | 1220 HPLOT G4 - Z,Y6 - 1 135 | 1230 X5 = PEEK ( - 16336) 136 | 1240 NEXT Z 137 | 1250 Y = 0 138 | 1260 X = 0 139 | 1270 GOSUB 1630 140 | 1280 RETURN 141 | 1290 IF P1 < 0 THEN 1360 142 | 1300 HPLOT 1,152 TO 4,152 143 | 1310 HPLOT 1,153 TO 4,153 144 | 1320 HPLOT 1,154 TO 4,154 145 | 1330 HPLOT 1,155 TO 4,155 146 | 1340 IF P1 < 0 THEN 1420 147 | 1350 HCOLOR= 0 148 | 1360 HPLOT 250,152 TO 254,152 149 | 1370 HPLOT 250,153 TO 254,153 150 | 1380 HPLOT 250,154 TO 254,154 151 | 1390 HPLOT 250,155 TO 254,155 152 | 1400 HCOLOR= 0 153 | 1410 IF P1 < 0 THEN 1300 154 | 1420 HCOLOR= 2 155 | 1430 RETURN 156 | 1440 G1 = (G(2) - G(1)) / 2 157 | 1450 G2 = RND (1) * (G1 - 1) + 1 158 | 1460 G3 = RND (1) * G1 / 2 + 10 159 | 1470 IF G3 < 30 THEN 1460 160 | 1480 IF G(2) - (G(1) + G2) > 2 * G3 THEN 1510 161 | 1490 G3 = G3 - 1 162 | 1500 GOTO 1480 163 | 1510 FOR M1 = 1 TO 252 164 | 1520 HCOLOR= 1 165 | 1530 HPLOT M1,150 166 | 1540 NEXT M1 167 | 1550 HPLOT G(1) + G2,150 TO G(1) + G2 + G3,150 - G3 168 | 1560 HPLOT G(1) + G2 + 2 * G3,150 TO G(1) + G2 + G3,150 - G3 169 | 1570 RETURN 170 | 1580 IF W2 < 0 THEN 1610 171 | 1590 PRINT "THE WIND IS TO THE RIGHT AT ";W1 172 | 1600 GOTO 1620 173 | 1610 PRINT "THE WIND IS TO THE LEFT AT ";W1 174 | 1620 RETURN 175 | 1630 IF P1 < 0 THEN 1660 176 | 1640 X2 = G(2):Y2 = 150 177 | 1650 GOTO 1670 178 | 1660 X2 = G(1):Y2 = 150 179 | 1670 RETURN 180 | -------------------------------------------------------------------------------- /samples/sample.bite.txt: -------------------------------------------------------------------------------- 1 | 10 REM ----------------------- 2 | 11 REM Source: HELLO on disk: Dark the Disk Repair Kit (v2.2), Beyond Wolfenstein Editor.dsk 3 | 4 | 12 REM Extracted and slightly modified by Moose 5 | 6 | 13 REM ----------------------- 7 | 8 | 60 TEXT : HOME : GR :D$ = CHR$ (13) + CHR$ (4) 9 | 10 | 70 COLOR= 12: VLIN 1,4 AT 24: VLIN 2,7 AT 23: VLIN 3,8 AT 22: VLIN 4,9 AT 21: VLIN 6,10 AT 20 11 | 12 | 80 HLIN 13,16 AT 10: HLIN 24,27 AT 10: HLIN 12,18 AT 11: HLIN 22,28 AT 11: HLIN 11,29 AT 12: HLIN 11,29 AT 13 13 | 14 | 90 COLOR= 13: FOR I = 14 TO 17: HLIN 10,30 AT I: NEXT I 15 | 16 | 100 FOR I = 18 TO 25 17 | 18 | 110 IF I = 19 THEN COLOR= 9 19 | 20 | 120 IF I = 24 THEN COLOR= 1 21 | 22 | 130 HLIN 9,31 AT I: NEXT I 23 | 24 | 140 FOR I = 26 TO 30 25 | 26 | 150 IF I = 29 THEN COLOR= 3 27 | 28 | 160 HLIN 10,30 AT I: NEXT I 29 | 30 | 170 FOR I = 31 TO 33: HLIN 11,29 AT I: NEXT I 31 | 32 | 180 COLOR= 2: FOR I = 34 TO 36: HLIN 12,28 AT I: NEXT I 33 | 34 | 190 HLIN 13,27 AT 37: HLIN 14,19 AT 38: HLIN 21,26 AT 38: HLIN 15,18 AT 39: HLIN 22,25 AT 39 35 | 36 | 200 VTAB 24: PRINT " PRESS ANY KEY TO TAKE A 'BITE' ";: GET TZ$ 37 | 38 | 205 HOME 39 | 40 | 210 FOR C = 1 TO 20:K = PEEK ( - 16336): NEXT C 41 | 42 | 220 COLOR= 0: HLIN 28,30 AT 14: HLIN 28,30 AT 15: HLIN 27,30 AT 16: HLIN 27,30 AT 17: HLIN 26,31 AT 18: HLIN 26,31 AT 19: HLIN 26,31 AT 20: HLIN 25,31 AT 21: HLIN 25,31 AT 22: HLIN 25,31 AT 23: HLIN 25,31 AT 24: HLIN 26,31 AT 25 43 | 44 | 230 HLIN 26,30 AT 26: HLIN 26,30 AT 27: HLIN 27,30 AT 28: HLIN 27,30 AT 29: HLIN 29,30 AT 30 45 | 46 | 240 FOR PAUSE = 1 TO 1000: NEXT PAUSE 47 | 48 | 250 REM PRINT D$;"RUN MENU" 49 | 50 | 260 TEXT : HOME 51 | 52 | 270 PRINT: PRINT "HAVE A NICE DAY ! MOOSE :) 53 | 54 | 910 REM ----------------------- 55 | 56 | 911 REM Source: HELLO on disk: Dark the Disk Repair Kit (v2.2), Beyond Wolfenstein Editor.dsk 57 | 58 | 912 REM Extracted and slightly modified by Moose 59 | 60 | 913 REM ----------------------- 61 | 62 | -------------------------------------------------------------------------------- /samples/sample.blackhole.txt: -------------------------------------------------------------------------------- 1 | 100 REM *********************** 2 | 110 REM S.M.COMPTON. 3 | 120 REM BLACKHOLE. 4 | 130 REM 12-12-79. 5 | 140 REM *********************** 6 | 150 DIM EX(34),EY(34) 7 | 160 XOLD = 139:YOLD = 76 8 | 170 T1 = 0:T2 = 0 9 | 180 GOSUB 2570: REM NAME AND DATE PRINTER. 10 | 190 GOSUB 2300: REM INSTRUCTIONS. 11 | 200 GOSUB 280: REM CONSTRUCT SCREEN. 12 | 210 GOSUB 480: REM DRAW NEW BALL. 13 | 220 GOSUB 650: REM OBTAIN FIRE COORDINATES. 14 | 230 GOSUB 920: REM CHECK FOR HIT 15 | 240 IF HIT = 0 THEN 210: REM RESTART. 16 | 250 GOSUB 1650: REM CONSTRUCT EXPLOSION. 17 | 260 GOSUB 1910: REM TALLY SCORE. 18 | 270 GOTO 210: REM RESTART. 19 | 280 REM *********************** 20 | 290 REM CONSTRUCT SCREEN 21 | 300 REM *********************** 22 | 310 HGR 23 | 320 HCOLOR= 6 24 | 330 FOR I = 0 TO 278 STEP 2 25 | 340 HPLOT I,0 TO I,159 26 | 350 NEXT I 27 | 360 HCOLOR= 4 28 | 370 HPLOT 84,159 TO 96,159 29 | 380 HPLOT 86,158 TO 94,158 30 | 390 HPLOT 88,157 TO 92,157 31 | 400 HPLOT 182,159 TO 194,159 32 | 410 HPLOT 184,158 TO 192,158 33 | 420 HPLOT 186,157 TO 190,157 34 | 430 HOME 35 | 440 FOR I = 1 TO 21: PRINT : NEXT I 36 | 450 PRINT TAB( 10)"BATTERY 1"; TAB( 24)"BATTERY 2" 37 | 460 PRINT TAB( 13)T1, TAB( 27)T2 38 | 470 RETURN 39 | 480 REM *********************** 40 | 490 REM DRAW NEW BALL 41 | 500 REM *********************** 42 | 510 X = INT (139 * RND (1) + 1) 43 | 520 X = 2 * X - 1 44 | 530 Y = INT (156 * RND (1) + 1) 45 | 540 HCOLOR= 6 46 | 550 HPLOT XOLD - 1,YOLD - 1 TO XOLD - 1,YOLD + 1 47 | 560 HPLOT XOLD + 1,YOLD - 1 TO XOLD + 1,YOLD + 1 48 | 570 HCOLOR= 6 49 | 580 HPLOT XOLD - 1,YOLD - 1 TO XOLD - 1,YOLD + 1 50 | 590 HPLOT XOLD + 1,YOLD - 1 TO XOLD + 1,YOLD + 1 51 | 600 HCOLOR= 4 52 | 610 HPLOT X - 1,Y - 1 TO X - 1,Y + 1 53 | 620 HPLOT X + 1,Y - 1 TO X + 1,Y + 1 54 | 630 XOLD = X:YOLD = Y 55 | 640 RETURN 56 | 650 REM *********************** 57 | 660 REM OBTAIN FIRE COORDINATES 58 | 670 REM *********************** 59 | 680 FOR I = 1 TO 50 60 | 690 IF PEEK ( - 16287) > 127 THEN 740 61 | 700 IF PEEK ( - 16286) > 127 THEN 830 62 | 710 NEXT I 63 | 720 B1 = 0:B2 = 0 64 | 730 RETURN 65 | 740 B1 = 180 - PDL (0) / 1.417 66 | 750 IF B1 < 0 THEN B1 = 0 67 | 760 IF B1 > 180 THEN B1 = 180 68 | 770 B2 = 0 69 | 780 IF B1 < > 90 THEN 800 70 | 790 B1 = 89.9999 71 | 800 M = TAN (B1 / 180 * 3.14159) 72 | 810 B = 156 + M * 90 73 | 820 RETURN 74 | 830 B2 = 180 - PDL (1) / 1.417 75 | 840 IF B2 < 0 THEN B2 = 0 76 | 850 IF B2 > 180 THEN B2 = 180 77 | 860 B1 = 0 78 | 870 IF B2 < > 90 THEN 890 79 | 880 B2 = 89.9999 80 | 890 M = TAN (B2 / 180 * 3.14159) 81 | 900 B = 156 + M * 188 82 | 910 RETURN 83 | 920 REM *********************** 84 | 930 REM CHECK FOR HIT 85 | 940 REM *********************** 86 | 950 IF B1 < > 0 THEN 990 87 | 960 IF B2 < > 0 THEN 1320 88 | 970 HIT = 0 89 | 980 RETURN 90 | 990 HCOLOR= 5 91 | 1000 IF (( - M * (X + 4) + B) > Y) AND (( - M * (X - 4) + B) < Y) THEN 1250 92 | 1010 HIT = 0 93 | 1020 IF B1 > 39.5361906 THEN 1100 94 | 1030 XS = 279 95 | 1040 YS = INT ( - M * 279 + B) 96 | 1050 HPLOT 90,156 TO XS,YS 97 | 1060 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I 98 | 1070 HCOLOR= 6 99 | 1080 HPLOT 90,156 TO XS,YS 100 | 1090 RETURN 101 | 1100 IF B1 > 119.981589 THEN 1180 102 | 1110 YS = 0 103 | 1120 XS = INT (B / M) 104 | 1130 HPLOT 90,156 TO XS,YS 105 | 1140 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I 106 | 1150 HCOLOR= 6 107 | 1160 HPLOT 90,156 TO XS,YS 108 | 1170 RETURN 109 | 1180 XS = 0 110 | 1190 YS = INT (B) 111 | 1200 HPLOT 90,156 TO XS,YS 112 | 1210 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I 113 | 1220 HCOLOR= 6 114 | 1230 HPLOT 90,156 TO XS,YS 115 | 1240 RETURN 116 | 1250 HIT = 1 117 | 1260 HPLOT 90,156 TO X,Y 118 | 1270 FOR I = 1 TO 5:SB = PEEK ( - 16336): NEXT I 119 | 1280 HCOLOR= 6 120 | 1290 FOR I = 1 TO 10: NEXT I 121 | 1300 HPLOT 90,156 TO X,Y 122 | 1310 RETURN 123 | 1320 HCOLOR= 5 124 | 1330 IF (( - M * (X + 4) + B) > Y) AND (( - M * (X - 4) + B) < Y) THEN 1580 125 | 1340 HIT = 0 126 | 1350 IF B2 > 59.7436134 THEN 1430 127 | 1360 XS = 279 128 | 1370 YS = INT ( - M * 279 + B) 129 | 1380 HPLOT 188,156 TO XS,YS 130 | 1390 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I 131 | 1400 HCOLOR= 6 132 | 1410 HPLOT 188,156 TO XS,YS 133 | 1420 RETURN 134 | 1430 IF B2 > 140.314512 THEN 1510 135 | 1440 YS = 0 136 | 1450 XS = INT (B / M) 137 | 1460 HPLOT 188,156 TO XS,YS 138 | 1470 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I 139 | 1480 HCOLOR= 6 140 | 1490 HPLOT 188,156 TO XS,YS 141 | 1500 RETURN 142 | 1510 XS = 0 143 | 1520 YS = B 144 | 1530 HPLOT 188,156 TO XS,YS 145 | 1540 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I 146 | 1550 HCOLOR= 6 147 | 1560 HPLOT 188,156 TO XS,YS 148 | 1570 RETURN 149 | 1580 HIT = 1 150 | 1590 HPLOT 188,156 TO X,Y 151 | 1600 FOR I = 1 TO 5:SB = PEEK ( - 16336): NEXT I 152 | 1610 FOR I = 1 TO 10: NEXT I 153 | 1620 HCOLOR= 6 154 | 1630 HPLOT 188,156 TO X,Y 155 | 1640 RETURN 156 | 1650 REM ********************** 157 | 1660 REM CONSTRUCT EXPLOSION 158 | 1670 REM ********************** 159 | 1680 FOR I = 1 TO 10 160 | 1690 ES = PEEK ( - 16336) - PEEK ( - 16336) 161 | 1700 NEXT I 162 | 1710 HCOLOR= 6 163 | 1720 HPLOT X,Y 164 | 1730 HPLOT X + 1,Y - 1 165 | 1740 HCOLOR= 4 166 | 1750 FOR J = 4 TO 33 167 | 1760 RX = ( - 1) ^ INT (6 * RND (1) + 1) 168 | 1770 RY = ( - 1) ^ INT (6 * RND (1) + 1) 169 | 1780 XE = X + RX * INT (J / 2 * RND (1) + 1) 170 | 1790 YE = Y + RY * INT (J / 2 * RND (1) + 1) 171 | 1800 IF XE < 0 OR XE > 279 THEN 1780 172 | 1810 IF YE < 0 OR YE > 156 THEN 1790 173 | 1820 HPLOT XE,YE 174 | 1830 EX(J) = XE 175 | 1840 EY(J) = YE 176 | 1850 NEXT J 177 | 1860 HCOLOR= 6 178 | 1870 FOR J = 4 TO 33 179 | 1880 HPLOT EX(J),EY(J) 180 | 1890 NEXT J 181 | 1900 RETURN 182 | 1910 REM ********************** 183 | 1920 REM TALLY SCORE. 184 | 1930 REM ********************** 185 | 1940 IF B1 < > 0 THEN 2100 186 | 1950 T2 = T2 + 1 187 | 1960 IF T2 = 10 THEN 1990 188 | 1970 GOSUB 2250 189 | 1980 RETURN 190 | 1990 HOME 191 | 2000 FOR I = 1 TO 21: PRINT : NEXT I 192 | 2010 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2" 193 | 2020 PRINT TAB( 10)"** BATTERY 2 WINS !! **" 194 | 2030 FOR I = 1 TO 2000: NEXT I 195 | 2040 HOME 196 | 2050 FOR I = 1 TO 21: PRINT : NEXT I 197 | 2060 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2" 198 | 2070 T1 = 0:T2 = 0 199 | 2080 PRINT TAB( 13)T1 TAB( 27)T2 200 | 2090 RETURN 201 | 2100 T1 = T1 + 1 202 | 2110 IF T1 = 10 THEN 2140 203 | 2120 GOSUB 2250 204 | 2130 RETURN 205 | 2140 HOME 206 | 2150 FOR I = 1 TO 21: PRINT : NEXT I 207 | 2160 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2" 208 | 2170 PRINT TAB( 10)"** BATTERY 1 WINS !! **" 209 | 2180 FOR I = 1 TO 2000: NEXT I 210 | 2190 T1 = 0:T2 = 0 211 | 2200 HOME 212 | 2210 FOR I = 1 TO 21: PRINT : NEXT I 213 | 2220 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2" 214 | 2230 PRINT TAB( 13)T1 TAB( 27)T2 215 | 2240 RETURN 216 | 2250 HOME 217 | 2260 FOR I = 1 TO 21: PRINT : NEXT I 218 | 2270 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2" 219 | 2280 PRINT TAB( 13)T1 TAB( 27)T2 220 | 2290 RETURN 221 | 2300 REM ********************** 222 | 2310 REM INSTRUCTIONS 223 | 2320 REM ********************** 224 | 2330 HOME 225 | 2340 PRINT TAB( 11)"** BLACKHOLE **" 226 | 2350 PRINT 227 | 2360 PRINT "BLACKHOLE IS A GAME FOR ONE OR TWO PLA-" 228 | 2370 PRINT "YERS USING THE PADDLES. PADDLE 0 IS " 229 | 2380 PRINT "ASSIGNED TO ARTILLARY BATTERY #1 AND" 230 | 2390 PRINT "PADDLE 1 IS ASSIGNED TO ARTILLARY BAT-" 231 | 2400 PRINT "TERY #2. EACH PADDLE CONTROLS THE ANGLE" 232 | 2410 PRINT "OF FIRE AS WELL AS THE FIRING OF A LAS-" 233 | 2420 PRINT "ER FROM ITS RESPECTIVE BATTERY. THE OB-" 234 | 2430 PRINT "JECT IS TO FIRE YOUR LASER THROUGH ONE" 235 | 2440 PRINT "OF THE BLACKHOLES THAT APPEAR AT RANDOM" 236 | 2450 PRINT "ABOVE THE BATTERIES." 237 | 2460 PRINT 238 | 2470 PRINT "RATHER THAN COMPETE FOR THE OPPORTUNITY" 239 | 2480 PRINT "TO FIRE YOUR LASER, IT IS RECOMMENDED" 240 | 2490 PRINT "THAT THE PLAYERS AGREE TO FIRE TEN" 241 | 2500 PRINT "ROUNDS APIECE IN SEQUENCE." 242 | 2510 PRINT 243 | 2520 PRINT "PRESS TO TERMINATE EXECUTION." 244 | 2530 PRINT 245 | 2540 PRINT "PRESS ANY KEY TO BEGIN." 246 | 2550 GET ZZ$ 247 | 2560 RETURN 248 | 2570 REM ********************** 249 | 2580 REM NAME AND DATE PRINTER 250 | 2590 REM ********************** 251 | 2600 HOME 252 | 2610 FOR WZ = 1 TO 22 253 | 2620 IF (WZ = 1) OR (WZ = 22) THEN 2650 254 | 2630 PRINT "*" TAB( 40)"*"; 255 | 2640 GOTO 2660 256 | 2650 FOR MZ = 1 TO 40: PRINT "*";: NEXT MZ 257 | 2660 NEXT WZ 258 | 2670 NZ$ = "S.M.COMPTON" 259 | 2680 DZ$ = "12-12-79" 260 | 2690 GZ$ = "BLACKHOLE" 261 | 2700 SZ = - 16336 262 | 2710 VTAB 9 263 | 2720 HTAB 15 264 | 2730 FOR WZ = 1 TO 11 265 | 2740 PRINT MID$ (NZ$,WZ,1); 266 | 2750 SOUND = PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) 267 | 2760 FOR MZ = 1 TO 150: NEXT MZ 268 | 2770 NEXT WZ 269 | 2780 VTAB 11 270 | 2790 HTAB 16 271 | 2800 FOR WZ = 1 TO 8 272 | 2810 PRINT MID$ (DZ$,WZ,1); 273 | 2820 SOUND = PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) 274 | 2830 FOR MZ = 1 TO 150: NEXT MZ 275 | 2840 NEXT WZ 276 | 2850 VTAB 13 277 | 2860 HTAB 16 278 | 2870 FOR WZ = 1 TO 9 279 | 2880 PRINT MID$ (GZ$,WZ,1); 280 | 2890 SOUND = PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) 281 | 2900 FOR MZ = 1 TO 150: NEXT MZ 282 | 2910 NEXT WZ 283 | 2920 FOR WZ = 1 TO 500: NEXT WZ 284 | 2930 RETURN -------------------------------------------------------------------------------- /samples/sample.bodymass.txt: -------------------------------------------------------------------------------- 1 | 10 REM A Simple Body Mass Index Calculator. 2 | 20 REM Written by Tim Dwyer on 5 July 2011. 3 | 30 HOME 4 | 40 DIM height 5 | 50 DIM weight 6 | 60 DIM bmiCalc 7 | 70 DIM keepGoing$ 8 | 80 PRINT "***************************" 9 | 90 PRINT "* *" 10 | 100 PRINT "* Simple BMI Calculator *" 11 | 110 PRINT "* *" 12 | 120 PRINT "***************************" 13 | 130 PRINT "" 14 | 140 PRINT "" 15 | 150 INPUT "Input your height (inches): "; height 16 | 160 INPUT "Input your weight (lbs): ";weight 17 | 170 bmiCalc = (weight/(height*height))*703 18 | 180 PRINT "" 19 | 190 PRINT "Your BMI is ";bmiCalc 20 | 200 PRINT "" 21 | 210 PRINT "" 22 | 220 INPUT "Calculate another? (y/n): ";keepGoing$ 23 | 230 IF keepGoing$ = "y" or keepGoing$ = "Y" GOTO 130 24 | 240 IF keepGoing$ = "n" or keepGoing$ = "N" GOTO 300 25 | 250 IF keepGoing$ <> "y" or keepGoing$ <> "Y" GOTO 270 26 | 260 IF keepGoing$ <> "n" or keepGoing$ <> "N" GOTO 270 27 | 270 PRINT "" 28 | 280 PRINT "That is not a valid selection." 29 | 290 GOTO 200 30 | 300 PRINT "" 31 | 310 PRINT "Goodbye!" 32 | 320 END 33 | -------------------------------------------------------------------------------- /samples/sample.boys_surface.txt: -------------------------------------------------------------------------------- 1 | 10 REM Boy's Surface 2 | 20 REM From the book "Topologicon" by Jean-Pierre Petit 3 | 100 PI=3.141592:P3=PI/3:P6=PI/6:P8=PI/8 4 | 110 HGR : POKE 49234,0 5 | 120 HCOLOR=3 6 | 130 FOR MU = 0 TO PI STEP 0.1 7 | 140 D=34+4.79*SIN(6*MU-P) 8 | 150 E=6.73*SIN(3*MU-P6) 9 | 160 A=D+E 10 | 170 B=D-E 11 | 180 AL=(P8)*SIN(3*MU) 12 | 190 C1=A*A-B*B 13 | 200 C2=SQR(A*A+B*B) 14 | 210 CM=COS(MU) 15 | 220 SM=SIN(MU) 16 | 230 FOR TE=0 TO 6.282 STEP .03 17 | 240 X1=C1/C2+A*COS(TE)-B*SIN(TE) 18 | 250 Z1=C2+A*COS(TE)+B*SIN(TE) 19 | 260 REM KOORDINATEN 20 | 270 X=X1*CM-Z1*SIN(AL)*SM 21 | 280 Y=X1*SM+Z1*SIN(AL)*SM 22 | 300 REM ZEICHNUNG 23 | 310 HPLOT 140+X,96+Y 24 | 320 NEXT TE 25 | 330 NEXT MU 26 | -------------------------------------------------------------------------------- /samples/sample.building.txt: -------------------------------------------------------------------------------- 1 | 0 clear : text : normal : home 2 | 1 rem BUILDING GAME BY MELVIN ROSARIO 3 | 2 rem Use Arrow keys to look around, Use wasd to move 4 | 3 rem Press E to place a block and Q to remove one 5 | 4 rem Use N and M to scroll through block type 6 | 7 | 5 inverse : htab 3 : vtab 3 : print " BUILDING GAME " : normal : htab 3 : vtab 5 : print "press any key to start" : get unused$ : gr 8 | 6 etp = 4 : ctp = 0 9 | 7 if unused$="0" or unused$="U" then blk=5000 10 | 8 if unused$><"U" then elevation=20 11 | 9 if unused$="U" then elevation=10 12 | 10 px=20 : py=1 : pr=0 : bkg=6 : for i = 0 to 39 : color=4 : vlin 1,38 at i : next i 13 | 11 for i = 0 to 39 : color=bkg : vlin 1,elevation at i : color=13 : vlin elevation+3,38 at i 14 | 12 rand=val(mid$(str$(rnd(-1*(peek(78)+256*peek(79)))*10),1,1)) 15 | 13 if unused$><"U" and rand = 8 and elevation < 34 then elevation=elevation+2 : goto 20 16 | 14 if unused$><"U" and rand > 2 and elevation < 34 then elevation=elevation+1 : goto 20 17 | 15 if unused$><"U" and rand = 1 then elevation=elevation-2 : goto 20 18 | 16 if unused$><"U" and rand < 4 then elevation=elevation-1 19 | 20 next i 20 | 21 | 30 home : rand=val(mid$(str$(rnd(-1*(peek(78)+256*peek(79)))*10),1,1)) 22 | 40 gosub 350 23 | 50 if pr=0 then print "facing left |" 24 | 51 if pr=1 then print "facing right|" 25 | 52 if pr=2 then print "facing up |" 26 | 53 if pr=3 then print "facing down |" 27 | 100 if ctp=0 then ptb$ = "grass" : pldtp = 4 28 | 101 if ctp=1 then ptb$ = "dirt" : pldtp = 13 29 | 102 if ctp=2 then ptb$ = "brick" : pldtp = 11 30 | 103 if ctp=3 then ptb$ = "platform" : pldtp = 2 31 | 104 if ctp=4 then ptb$ = "glass" : pldtp = 15 32 | 300 htab 15 : vtab 21 : print "blocks:" ; blks : print "block type: [" ; ctp ; "] " ; ptb$ : get btn$ : goto 30 33 | 34 | 350 color=bkg: plot px, py 35 | 351 if btn$="D" and px=39 and scrn(0,py) = bkg then px=0 : goto 500 36 | 352 if btn$="A" and px=0 and scrn(39,py) = bkg then px=39 : goto 500 37 | 401 if btn$=chr$(21) then pr=1 38 | 402 if btn$=chr$(8) then pr=0 39 | 403 if btn$=chr$(10) then pr=3 40 | 404 if btn$=chr$(11) then pr=2 41 | 405 if btn$="E" and pr=0 and px><0 and scrn(px-1,py) = bkg and blks>0 then color=pldtp: plot px-1,py : blks=blks-1 42 | 406 if btn$="E" and pr=1 and px><39 and scrn(px+1,py) = bkg and blks>0 then color=pldtp: plot px+1,py : blks=blks-1 43 | 407 if btn$="E" and pr=2 and scrn(px,py-1) = bkg and blks>0 then color=pldtp: plot px,py-1 : blks=blks-1 44 | 408 if btn$="E" and pr=3 and scrn(px,py+1) = bkg and blks>0 then color=pldtp: plot px,py+1 : blks=blks-1 45 | 409 if btn$="Q" and pr=1 and px><39 and scrn(px+1,py) >< bkg and scrn(px+1,py) >< 0 then color=bkg: plot px+1,py : blks=blks+1 46 | 410 if btn$="Q" and pr=2 and scrn(px,py-1) >< bkg and scrn(px,py-1) >< 0 then color=bkg: plot px,py-1 : blks=blks+1 47 | 411 if btn$="Q" and pr=3 and scrn(px,py+1) >< bkg and scrn(px,py+1) >< 0 then color=bkg: plot px,py+1 : blks=blks+1 48 | 412 if btn$="Q" and pr=0 and px><0 and scrn(px-1,py) >< bkg and scrn(px-1,py) >< 0 then color=bkg: plot px-1,py : blks=blks+1 49 | 413 if btn$="D" and px><39 and scrn(px+1,py) = bkg then px=px+1 : goto 415 50 | 414 if btn$="D" and px><39 and scrn(px+1,py) >< bkg and scrn(px+1,py-1) = bkg then px=px+1 : py=py-1 51 | 415 if btn$="S" and scrn(px,py+1) = 2 and scrn(px,py+2) = bkg then py=py+2 52 | 418 if btn$="A" and px><0 and scrn(px-1,py) = bkg then px=px-1 : goto 420 53 | 419 if btn$="A" and px><0 and scrn(px-1,py) >< bkg and scrn(px-1,py-1) = bkg then px=px-1 : py=py-1 54 | 420 if btn$="M" then ctp = ctp + 1 55 | 421 if btn$="N" then ctp = ctp - 1 56 | 489 if ctp > etp then ctp = 0 57 | 490 if ctp < 0 then ctp = etp 58 | 497 if btn$="W" and py><0 and scrn(px,py-1) = 2 and scrn(px,py-2) = bkg then py=py-2 : goto 500 59 | 498 if scrn(px,py+1) = bkg then py=py+1 : goto 500 60 | 499 if btn$="W" and scrn(px,py-1) = bkg then py=py-1 61 | 500 color=0: plot px, py : return -------------------------------------------------------------------------------- /samples/sample.calculatedimage.txt: -------------------------------------------------------------------------------- 1 | 10 TEXT : HOME : REM Clear the screen 2 | 20 VTAB 4 : HTAB 14 : PRINT "Calculated Image" 3 | 30 VTAB 10 : HTAB 7 : PRINT "By Gregg Buntin - Dec 2, 2016" 4 | 40 VTAB 12 : HTAB 5 : PRINT "Adapted from an ancient one liner" 5 | 50 VTAB 19 : PRINT "Type a number from 2 to 9" 6 | 60 GET NUM$ : REM read input 7 | 70 IF NUM$ < "2" OR NUM$ > "9" THEN 10 : REM Check for 2 through 9 8 | 200 P = VAL(NUM$) / 10 : REM Divide by 10 because we want a decimal 9 | 210 HGR2 : REM Hires screen 2 10 | 220 FOR Y = -95 TO 0 : REM roughly half the screen height 11 | 230 Y2 = Y * Y : REM used in the math 12 | 240 FOR X = -139 TO 0 : REM roughly half the screen width 13 | 250 R = (1E7 - INT ((Y2 + X * X) ^ P)) / 2 : REM Math is fun 14 | 260 HCOLOR= 3 * (R < > INT (R)) : REM White or Black 15 | 270 X1 = X + 139 : REM so we plot X > 0 and start at the outsides 16 | 280 Y1 = Y + 95 : REM so we plot Y > 0 and start at the top 17 | 290 HPLOT X1,Y1 : REM Plot a dot from left to right (TOP) 18 | 300 HPLOT 278 - X1,Y1 : REM Plot a dot from right to left (TOP) 19 | 310 HPLOT X1,190 - Y1 : REM Plot a dot from left to right (Bottom) 20 | 320 HPLOT 278 - X1,190 - Y1 : REM Plot a dot from right to left (Bottom) 21 | 330 NEXT : REM next X 22 | 340 NEXT : REM next Y 23 | -------------------------------------------------------------------------------- /samples/sample.charset.txt: -------------------------------------------------------------------------------- 1 | 100 PR#0 : HOME 2 | 110 PRINT "80 Col Firmware Inactive" 3 | 120 GOSUB 1000 4 | 130 PRINT : PRINT "Press any key "; : GET A$ 5 | 6 | 200 PR#3 : PRINT CHR$(17); : HOME 7 | 210 PRINT "80 Col Firmware Active" 8 | 220 GOSUB 1000 9 | 230 PRINT : PRINT "Press any key "; : GET A$ 10 | 11 | 300 PR#3 : HOME 12 | 310 PRINT "80 Col Firmware Active" 13 | 320 GOSUB 1000 14 | 330 PRINT : PRINT "Press any key "; : GET A$ 15 | 16 | 999 GOTO 100 17 | 18 | 1000 PRINT : PRINT "Normal" : NORMAL : GOSUB 2000 : NORMAL 19 | 1010 PRINT : PRINT "Inverse" : INVERSE : GOSUB 2000 : NORMAL 20 | 1020 PRINT : PRINT "Flash" : FLASH : GOSUB 2000 : NORMAL 21 | 1030 PRINT : PRINT "Mousetext" : PRINT CHR$(27);CHR$(15); : GOSUB 2000 : PRINT CHR$(14);CHR$(24) 22 | 1040 RETURN 23 | 24 | 2000 FOR I = 32 TO 127 STEP 32 25 | 2010 : FOR J = 0 TO 31 26 | 2020 :: PRINT CHR$(I+J); 27 | 2030 : NEXT : PRINT 28 | 2040 NEXT 29 | 2050 RETURN 30 | -------------------------------------------------------------------------------- /samples/sample.chase.txt: -------------------------------------------------------------------------------- 1 | 100 PR#0:TEXT:HOME::PRINT "THIS IS THE GAME OF CHASE" 2 | 110 PRINT "WANT INSTRUCTIONS"; 3 | 120 INPUT C$ 4 | 130 IF LEFT$(C$,1)="N" THEN VTAB 7:GOTO 280 5 | 140 IF LEFT$(C$,1)<>"Y" THEN 110 6 | 150 HOME:PRINT "YOU'RE '*' IN A HIGH VOLTAGE MAZE WITH 5"; 7 | 160 PRINT "SECURITY MACHINES '+' TRYING TO DESTROY" 8 | 170 PRINT "YOU. YOU MUST MANEUVER THE SECURITY" 9 | 180 PRINT "MACHINES INTO A MAZE 'X' TO SURVIVE." 10 | 190 PRINT:PRINT "YOU WILL OFTEN FIND YOURSELF DROPPED" 11 | 200 PRINT "INTO A GENUINELY IMPOSSIBLE SITUATION." 12 | 210 PRINT "WHEN THAT HAPPENS, JUST QUIT THAT GAME" 13 | 220 PRINT "AND TRY ANOTHER. GOOD LUCK !!!" 14 | 280 VTAB 11:HTAB 23:PRINT "MOVES ARE 7,8,9" 15 | 290 HTAB 33:PRINT "4,5,6" 16 | 300 HTAB 33:PRINT "1,2,3":PRINT 17 | 310 HTAB 23:PRINT "0 TO END THE GAME" 18 | 320 DIM A(10,20),E(5),F(5) 19 | 330 B=RND(-PEEK(79)*999-PEEK(78)) 20 | 340 LET G=0 21 | 350 FOR B=1 TO 10 22 | 360 FOR C=1 TO 20 23 | 370 LET A(B,C)=B=1 OR B=10 OR C=1 OR C=20 24 | 380 NEXT C 25 | 390 NEXT B 26 | 400 VTAB 20:CALL -958:VTAB 11 27 | 410 POKE 33,20:CALL -958:POKE 33,40 28 | 420 FOR D=1 TO 21 29 | 430 LET B=INT(RND(1)*8)+2 30 | 440 LET C=INT(RND(1)*18)+2 31 | 450 IF A(B,C) THEN 430 32 | 460 LET A(B,C)=(D<7)*3+SGN(D-6) 33 | 470 IF D<6 THEN E(D)=B:F(D)=C 34 | 480 IF D=6 THEN X=C:Y=B 35 | 490 NEXT D: D=0 36 | 500 VTAB 10:PRINT 37 | 510 FOR B=1 TO 10 38 | 520 FOR C=1 TO 20 39 | 530 PRINT MID$(" X+*",A(B,C)+1,1); 40 | 630 NEXT C 41 | 640 IF B<10 OR D>6 THEN PRINT 42 | 650 NEXT B:ON 9-D GOTO 1080,1100 43 | 680 PRINT " ?"; 44 | 690 GET C$: V=VAL(C$): IF C$<>"0" AND NOT V THEN PRINT CHR$(7);:GOTO 690 45 | 700 PRINT:ON NOT V GOTO 1040: IF V=5 GOTO 830 46 | 710 LET A(Y,X)=0 47 | 730 D=INT((6-V)/3) 48 | 740 LET Y=Y+D 49 | 750 LET X=V-(2-D)*3+1+X 50 | 780 ON A(Y,X) GOTO 1060,1080 51 | 800 LET A(Y,X)=3 52 | 830 FOR D=1 TO 5 53 | 840 IF A(E(D),F(D))<>2 THEN 1030 54 | 850 LET A(E(D),F(D))=0 55 | 870 LET E(D)=SGN(Y-E(D))+E(D) 56 | 920 LET F(D)=SGN(X-F(D))+F(D) 57 | 960 IF A(E(D),F(D))=3 THEN D=7:GOTO 1030 58 | 970 IF A(E(D),F(D)) THEN G=G+1:GOTO 1030 59 | 980 A(E(D),F(D))=2 60 | 1030 NEXT D: D=(G=5)+D: GOTO 500 61 | 1040 PRINT "YOU RESIGNED TO YOUR FATE" 62 | 1050 GOTO 1110 63 | 1060 PRINT "ZAP!!! YOU TOUCHED THE FENCE !!!!!" 64 | 1070 GOTO 1110 65 | 1080 PRINT "** YOU HAVE BEEN DESTROYED BY A LUCKY":PRINT "MACHINE **" 66 | 1090 GOTO 1110 67 | 1100 PRINT "YOU ARE LUCKY":PRINT "**YOU DESTROYED ALL THE ENEMY**" 68 | 1110 PRINT "WANT TO PLAY AGAIN"; 69 | 1120 INPUT C$ 70 | 1130 IF LEFT$(C$,1)="Y" THEN 330 71 | 1140 IF LEFT$(C$,1)<>"N" THEN VTAB PEEK(37):PRINT CHR$(7);:GOTO 1110 72 | 1150 VTAB 21:CALL -958:PRINT 73 | 1160 PRINT "SORRY TO SEE YOU QUIT" 74 | 1170 PRINT "HOPE YOU DON'T FEEL FENCED IN." 75 | 1180 PRINT "TRY AGAIN SOMETIME"; -------------------------------------------------------------------------------- /samples/sample.codabar.txt: -------------------------------------------------------------------------------- 1 | 1 REM CODABAR BARCODE GENERATOR BY GOLDEN CHILD 2 | 2 REM ALL INFO NEEDED FROM WIKIPEDIA ARTICLE ON CODABAR 3 | 3 TEXT : HOME 4 | 4 PRINT "CODABAR GENERATOR" : ? 5 | 5 PRINT "LEGAL CHARACTERS ARE: " 6 | 6 PRINT " 0123456789 ./+-$: ABCD" : ? 7 | 7 PRINT " BEGIN AND END WITH ABCD STOP CODES" : ? 8 | 8 PRINT " ADD # AS FIRST CHAR FOR CHECK DIGIT" : ? 9 | 9 PRINT "EXAMPLES: A1234A A5678B" : ? " #A1234A (WITH CHECK DIGIT)":? 10 | 10 DIM HB$(4),HS$(6) 11 | 20 DIM CB(128),CS(128),CK(128) 12 | 13 | 100 FOR I = 1 TO 4 : READ HB$(I) : NEXT : REM HORIZ BAR PATTERN 14 | 105 FOR I = 1 TO 4 : READ IB$(I) : NEXT : REM INVERT BAR PATTERN 15 | 110 FOR I = 1 TO 6 : READ HS$(I) : NEXT : REM HORIZ SPACE PATTERN 16 | 120 READ CH$ : IF CH$ = "END" THEN GOTO 150 17 | 130 C = ASC(CH$) : READ CB(C),CS(C),CK(C) 18 | 140 GOTO 120 19 | 150 REM DONE READING 20 | 160 FOR I = 1 TO 128 21 | 165 REM IF CB(I)<>0 OR CS(I) <> 0 THEN PRINT CHR$(I),CB(I),CS(I) 22 | 170 NEXT 23 | 24 | 176 X0 = 20 : X=X0 : Y0 = 5 : Y=Y0 : Y1=20 : Y2 = 20 25 | 180 W0 = 1 : REM DEFAULT WIDTH 26 | 200 PRINT " (# FOR CHECK DIGIT, USE | FOR :)":INPUT "BARCODE:";A$ : CS = 0 27 | 205 IF MID$(A$,1,1)<>"#" THEN GOTO 210 : REM SKIP CHECKSUM 28 | 206 A$=MID$(A$,2,LEN(A$)-1) : FOR I = 1 TO LEN(A$) : C = ASC(MID$(A$,I,1)) : ? "CHAR="C" CHECKSUM="CS : CS=CS+CK(C) : NEXT 29 | 207 IF CS > 16 THEN CS = CS - 16 : GOTO 207 30 | 208 A$ = MID$(A$,1,LEN(A$)-1) + MID$("0123456789-$:/.+",(16-CS)+1,1) + MID$(A$,LEN(A$),1) : REM ADD CHECKSUM DIGIT JUST BEFORE END 31 | 210 F$ = MID$(A$,1,1) : IF F$ <> "A" AND F$ <> "B" AND F$ <> "C" AND F$ <> "D" THEN PRINT "NEED START CODES (ABCD)" : GOTO 200 32 | 211 F$ = MID$(A$,LEN(A$),1) : IF F$ <> "A" AND F$ <> "B" AND F$ <> "C" AND F$ <> "D" THEN PRINT "NEED END CODES (ABCD)" : GOTO 200 33 | 215 IF SF=0 THEN HGR: HCOLOR=3 : FOR I = 0 TO 191 : HPLOT 0,I TO 279,I : NEXT : SF=1 : VTAB 23 34 | 216 FOR I = 1 TO LEN(A$) : C = ASC(MID$(A$,I,1)) : ? "CHAR="C 35 | 220 B = CB(C) : S = CS(C) : REM B=BAR TYPE, SPACE= SPACE TYPE 36 | 230 FOR BI = 1 TO 4 37 | 235 W = W0 : BA$ = HB$(B) : IF HS$(S)="0000" THEN BA$=IB$(B) : REM IB IS INVERT BARCODE PATTERN 38 | 240 IF MID$(BA$,BI,1)="1" THEN W = W0 * 3 39 | 250 X1 = X : X2 = X1 + W : FOR X = X1 TO X2-1 : HCOLOR=0: HPLOT X,Y TO X,Y+Y1 : NEXT : X = X2 40 | 41 | 260 W = W0 : IF MID$(HS$(S),BI,1)="1" THEN W = W0 * 3 42 | 270 X = X + W 43 | 280 NEXT 44 | 290 NEXT 45 | 300 ? "BARCODE="A$ 46 | 47 | 350 X=X0 : Y=Y+Y1+Y2 48 | 360 IF Y > 160-Y2 THEN SF=0 : Y=Y0 : REM CHECK TO SEE IF WE ARE AT BOTTOM 49 | 50 | 400 GOTO 200 51 | 52 | 2000 REM BAR PATTERN DATA 53 | 2001 DATA 0001,0010,0100,1000 54 | 2002 REM INVERT BAR PATTERN DATA FOR WHEN SPACES = 0000 55 | 2003 DATA 1110,1101,1011,0111 56 | 2009 REM SPACE PATTERN DATA 57 | 2010 DATA 0010,0100,1000,0110,1100,0000 58 | 59 | 2020 DATA 0,1,1,0 : REM CHAR 0 IS BAR 1 SPACE 1 CHECKSUM 0 60 | 2021 DATA 1,2,1,1 : REM CHAR 1 IS BAR 2 SPACE 1 CHECKSUM 1 61 | 2022 DATA 4,3,1,4 62 | 2023 DATA 5,4,1,5 63 | 2024 DATA 2,1,2,2 64 | 2025 DATA -,2,2,10 65 | 2026 DATA "$",3,2,11 66 | 2027 DATA 9,4,2,9 67 | 2028 DATA 6,1,3,6 68 | 2029 DATA 7,2,3,7 69 | 2030 DATA 8,3,3,8 70 | 2031 DATA 3,4,3,3 71 | 2032 DATA C,1,4,18 72 | 2033 DATA D,2,4,19 73 | 2034 DATA A,3,4,16 74 | 2035 DATA F,4,4,17 : REM EFGH IS ABCD REVERSE 75 | 2036 DATA B,1,5,17 76 | 2037 DATA E,2,5,16 77 | 2038 DATA H,3,5,19 78 | 2039 DATA G,4,5,18 79 | 2040 DATA ".",1,6,14 80 | 2041 DATA /,2,6,13 81 | 2042 DATA ":",3,6,12 82 | 2043 DATA +,4,6,15 83 | 2044 DATA "|",3,6,12 : REM APPLESOFT DOESN'T LET YOU TYPE COLONS 84 | 2050 DATA END -------------------------------------------------------------------------------- /samples/sample.coloredserpinski.txt: -------------------------------------------------------------------------------- 1 | 100 REM COLORED SERPINSKI TRIANGLES 2 | 110 CLEAR:HGR:POKE 49234,0 3 | 120 seed=RND(-PEEK(78)-PEEK(79)*256) 4 | 130 REM SCREEN SIZE AND MAIN TRIANGLE VERTICES 5 | 140 w=279:w2=139:h=192:h2=96:DIM x(2),y(2) 6 | 150 x(0)=0:y(0)=h:x(1)=w2:y(1)=0:x(2)=w:y(2)=h 7 | 160 REM ARRAY OF RANDOM HI-RES COLOURS 8 | 170 DIM c(3):c(0)=1:c(1)=2:c(2)=5:c(3)=6 9 | 180 FOR i=0 TO 3:j=INT(RND(1)*4) 10 | 190 t=c(i):c(i)=c(j):c(j)=t:NEXT 11 | 200 REM START POINT AND NUMBER OF DOTS 12 | 210 x=0:y=191:dots=40000 13 | 220 REM PLOT POINTS HALFWAY TOWARDS RANDOM VERTICES 14 | 230 FOR i=0 to dots 15 | 240 v=rnd(1)*3:x=(x+x(v))/2:y=(y+y(v))/2 16 | 250 IF y =>h THEN y=191 17 | 260 REM PICK COLOR FOR EACH TRIANGLE 18 | 270 HCOLOR=c(0):IF y>h2 THEN HCOLOR=c(1) 19 | 280 IF y>h2 AND x>w2 THEN HCOLOR=c(2) 20 | 290 HPLOT x,y:NEXT 21 | 300 PRINT CHR$(7):END 22 | -------------------------------------------------------------------------------- /samples/sample.colorrings.txt: -------------------------------------------------------------------------------- 1 | 210 hgr2 2 | 212 hcolor=1 3 | 240 A = 65 4 | 250 B = 10 5 | 260 R = 80 6 | 290 for sq=80to0 step -3.14159 7 | 292 u=360 8 | 293 co=int(rnd(1)*7)+1 9 | 295 if co=4 then goto 293 10 | 296 hcolor=co 11 | 300 FOR ALPHA = 0 TO 360 step 1 12 | 301 u=u+3.1411 13 | 310 X1 = INT(R-sq * COS(ALPHA-u) + 0.5) 14 | 320 Y1 = INT(R+sq * SIN(ALPHA+u) - 0.5) 15 | 330 HPLOT A + X1, B + Y1 16 | 340 NEXT ALPHA 17 | 350 next sq -------------------------------------------------------------------------------- /samples/sample.connections.txt: -------------------------------------------------------------------------------- 1 | 10 TEXT : HOME : INPUT "NUMBER OF POINTS:";A: HCOLOR= 3 2 | 20 HGR : POKE -16302,0 3 | 30 FOR T1 = 0 TO (2 * 3.14) - .001 STEP ((2 * 3.14) / A) 4 | 40 FOR T2 = (T1 + (2 * 3.14) / A) TO (2 * 3.14) - .001 STEP (2 * 3.14) / A 5 | 50 HPLOT ( COS (T1) * 95 + 127),( SIN (T1) * 95 + 95) TO ( COS (T2) * 95 + 127),( SIN (T2) * 95 + 95) 6 | 60 NEXT 7 | 70 NEXT 8 | 80 GET A$ 9 | 90 GOTO 10 10 | -------------------------------------------------------------------------------- /samples/sample.dbconverge.txt: -------------------------------------------------------------------------------- 1 | 10 rem Converge on a value demo 2 | 15 rem Testing a routine that will smoothly converge on a value, easing into a stop 3 | 20 rem by Golden Child 4 | 100 hgr 5 | 110 c=0:d=100 :gosub 5000 : ct=0 6 | 120 co=3:x1=c:y1=0:x2=cl:y2=50:gosub 5100:x1=c2:y1=100:gosub 5100:gosub 5500 :c2=cl::c2=cl:cl=c:gosub 9000 7 | 125 if abs(c-d)<.1 then ? "DIST="di" FRAMES="ct:d=rnd(1)*279 : ct=0 : di=d-c:?d,c,di 8 | 130 ct=ct+1:goto 120 9 | 10 | 9000 rem converge c=cur value, d=desired value, mr=max rate, md=max dist, ch=change, cd=dist to go 11 | 9010 mr=10:md=100 12 | 9020 cd=d-c 13 | 9030 if cd>md then cd=md 14 | 9040 if abs(cd)<0.1 then c=d 15 | 9045 ch = cd/md*mr 16 | 9050 c=c+ch: rem ?"c="c" d="d" ch="ch" ct="ct 17 | 9051 if abs(ch)<0.1 then c=d 18 | 9060 return 19 | 20 | 5000 rem init display list : rem SC = screen to draw 21 | 5001 dim dl(2,100,5):hgr2:hgr 22 | 5002 SC=0 : DL(0,0,0)=0 : DL(1,0,0)=0 :gosub 5500: rem DL(X,0,0) = NUM OF POINTS 23 | 5003 return 24 | 25 | 5100 rem draw line on other screen 26 | 5110 poke 230,(SC+1) * 32 : rem forgot the +1 part 27 | 5111 if not(x1>=0 and x1 <=279 and x2 >=0 and x2<=279 and y1>=0 and y1 <=159 and y2>=0 and y2<=159) then return 28 | 5120 rem bug should be DL SP = DL(SC,0,0) + 1 : SL(SC,0,0)=SP : ? sp 29 | 5120 SP = DL(SC,0,0) + 1 : DL(SC,0,0)=SP : rem ? sp 30 | 5130 DL(SC,SP,0)=CO 31 | 5131 DL(SC,SP,1)=X1 32 | 5132 DL(SC,SP,2)=Y1 33 | 5133 DL(SC,SP,3)=X2 34 | 5134 DL(SC,SP,4)=Y2 35 | 5140 HCOLOR=CO : HPLOT X1,Y1 TO X2,Y2 36 | 5190 RETURN 37 | 38 | 5400 rem erase lines 39 | 5410 for SP = 1 TO DL(SC,0,0) : HCOLOR=0 : rem ? "erase" sc ,sp 40 | 5411 HPLOT DL(SC,SP,1),DL(SC,SP,2) TO DL(SC,SP,3),DL(SC,SP,4) : NEXT 41 | 5412 DL(SC,0,0)=0 : rem clear the list after erasing 42 | 5420 RETURN 43 | 44 | 5500 rem swap screens 45 | 5510 SC = NOT SC 46 | 5511 POKE 49236+(NOT SC),0 : rem select page that we're drawing to 47 | 5514 rem ? "SC="sc 48 | 5515 poke 230,32*(sc+1):gosub 5400 : rem forgot to switch the drawing page 49 | 5520 RETURN 50 | -------------------------------------------------------------------------------- /samples/sample.dbpendulum.txt: -------------------------------------------------------------------------------- 1 | 1 rem Physics Pendulum Simulation by Golden Child 2 | 2 rem A simple demo to show double buffering 3 | 3 rem GOSUB 5000 to initialize 4 | 4 rem GOSUB 5100 to draw a line 5 | 5 rem GOSUB 5500 to switch pages 6 | 10 text:home:PRINT "Hello - Pendulum Simulation" 7 | 15 print "Double Buffering Demo by Golden Child" : 8 | 20 fi=fi+1 : if fi>1 then home : rem first run don't clear screen 9 | 25 vtab 23: print "Enter Gravity "+chr$(13)+"(between 0.1 and 2 work best) ";:input g : if g=0 then g=1 10 | 26 print"GRAVITY=";g ", press a key for new gravity:" 11 | 100 gosub 5000 12 | 200 xv=0 : yv=0:x1=140:x2=140+80*cos(10/180*3.14)::y1=0:y2=sin(10/180*3.14)*80 13 | 210 xa=0 : ya=+10.5:ya=g : if peek(49152)>128 then goto 20 14 | 215 xd=x1-x2: yd=y1-y2 : al=sqr(xa^2+ya^2):dl=sqr(xd^2+yd^2):dp=(xd*xa+yd*ya)/dl:el=sqr(xv^2+yv^2):ep=(xd*xv+yd*yv)/dl 15 | 216 rem ? "al="al" dl="dl" dp="dp " xa="xa" ya="ya" xd="xd" yd="yd" xv="xv" yv="yv 16 | 217 xz=xd/dl*(dp):yz=yd/dl*(dp): xx=xa-xz:yx=ya-yz 17 | 218 xv=xv+xx-xd/dl*ep*2 18 | 219 yv=yv+yx-yd/dl*ep*2 : rem my physics routines are terrible, why *2 here? 19 | 230 co=3:gosub 5100 : 20 | 231 x3=x1:y3=y1:x1=x2+50*xv/sqr(xv^2+yv^2): 21 | 232 co=5:y1=y2+50*yv/sqr(xv^2+yv^2):gosub 5100:x1=x3:y1=y3 : rem orange 22 | 233 x3=x1:y3=y1:x1=x2+50*xa/sqr(xa^2+ya^2): 23 | 234 co=6:y1=y2+50*ya/sqr(xa^2+ya^2):gosub 5100:x1=x3:y1=y3 : rem blue 24 | 235 x3=x1:y3=y1:x1=x2-50*xz/sqr(xz^2+yz^2): 25 | 236 co=1:y1=y2-50*yz/sqr(xz^2+yz^2):gosub 5100:x1=x3:y1=y3 : rem green 26 | 237 x3=x1:y3=y1:x1=x2+50*xx/sqr(xx^2+yx^2): 27 | 238 co=2:y1=y2+50*yx/sqr(xx^2+yx^2):gosub 5100:x1=x3:y1=y3 : rem purple 28 | 240 gosub 5500 29 | 241 x2=x2+xv:y2=y2+yv 30 | 242 ct=ct+1:if ct>150 then ct=1:? dl : rem every 150 frames show length of pendulum 31 | 250 goto 210 32 | 33 | 5000 rem init display list : rem SC = screen to draw 34 | 5001 IF NOT (dk) then dim dl(2,100,5) : dk=1 35 | 5002 hgr2:hgr 36 | 5003 SC=0 : DL(0,0,0)=0 : DL(1,0,0)=0 :gosub 5500: rem DL(X,0,0) = NUM OF POINTS 37 | 5004 return 38 | 39 | 5100 rem draw line on other screen 40 | 5110 poke 230,(SC+1) * 32 41 | 5111 if not(x1>=0 and x1 <=279 and x2 >=0 and x2<=279 and y1>=0 and y1 <=159 and y2>=0 and y2<=159) then return 42 | 5120 SP = DL(SC,0,0) + 1 : DL(SC,0,0)=SP : rem ? sp 43 | 5130 DL(SC,SP,0)=CO 44 | 5131 DL(SC,SP,1)=X1 45 | 5132 DL(SC,SP,2)=Y1 46 | 5133 DL(SC,SP,3)=X2 47 | 5134 DL(SC,SP,4)=Y2 48 | 5140 HCOLOR=CO : HPLOT X1,Y1 TO X2,Y2 49 | 5190 RETURN 50 | 51 | 5400 rem erase lines 52 | 5410 for SP = 1 TO DL(SC,0,0) : HCOLOR=0 53 | 5411 HPLOT DL(SC,SP,1),DL(SC,SP,2) TO DL(SC,SP,3),DL(SC,SP,4) : NEXT 54 | 5412 DL(SC,0,0)=0 : rem clear the list after erasing 55 | 5420 RETURN 56 | 57 | 5500 rem swap screens 58 | 5510 SC = NOT SC 59 | 5511 POKE 49236+(NOT SC),0 : rem select visible page that we're not drawing to 60 | 5515 poke 230,32*(sc+1):gosub 5400 : rem switch drawing page and erase lines 61 | 5520 RETURN 62 | -------------------------------------------------------------------------------- /samples/sample.dbvectorship.txt: -------------------------------------------------------------------------------- 1 | 10 rem Asteroids Ship Demo 2 | 20 rem Double Buffering Demo by Golden Child 3 | 4 | 500 dim a(10,4) 5 | 510 read p 6 | 520 for i = 1 to p:read x,y:a(i,1)=x:a(i,2)=y:? p,i,a(p,1),a(p,2):next 7 | 530 hgr :hcolor=3 : VTAB 23: PRINT "Double Buffering Demo:" 8 | 531 print "END/PAGE DOWN to turn":PRINT "HOME/PAGE UP for thrust" 9 | 532 print "click on window to set input focus"; 10 | 533 x0=139:y0=79:gosub 5000:goto 4000 11 | 12 | 540 rem draw ship 13 | 590 x2=-999 : rem dont draw first segment 14 | 601 sz=2:for i = 1 to p:x=a(i,1)*sz:y=a(i,2)*sz:x1=x0+x*cos(a0)-y*sin(a0):y1=y0+y*cos(a0)+x*sin(a0) 15 | 610 if x2<>-999 then if x1 > 0 and x1 < 279 and x2 > 0 and x2< 279 and y1 > 0 and y1 < 191 and y2 > 0 and y2<191 then c=3:gosub 5100 16 | 615 x2=x1:y2=y1 17 | 620 next 18 | 19 | 621 g=0.04 :yv=yv+g : rem gravity 20 | 622 fr=0.01 : rem friction 21 | 623 if sqr(xv^2 + yv^2) < fr then xv=0 : yv=0: goto 630 22 | 624 xd = xv / sqr(xv^2 + yv^2):yd=yv / sqr(xv^2 + yv^2) 23 | 625 xv = xv - xd * fr : yv=yv - yd * fr 24 | 630 return 25 | 26 | 1000 data 5,3,0,-2,2,0,0,-2,-2,3,0,-999 27 | 28 | 4000 co=3:gosub 540:gosub 5500 29 | 4001 t=3.14/24 30 | 4010 if peek(49248)>=128 then a0=a0+t 31 | 4020 if peek(49250)>=128 then a0=a0-t 32 | 4021 if peek(49249)>=128 then xv=xv+0.5*cos(a0):yv=yv+0.5*sin(a0) 33 | 4022 if peek(49251)>=128 then xv=xv-0.5*cos(a0):yv=yv-0.5*sin(a0) 34 | 4023 if x0 < 20 then x0=280-20 35 | 4024 if x0 > 280-20 then x0=20 36 | 4025 if y0<20 then y0=160-20 37 | 4026 if y0>160-20 then y0=20 38 | 4030 x0=x0+xv : y0=y0+yv 39 | 4040 rem ? xv,yv 40 | 4050 goto 4000 41 | 42 | 43 | 44 | 5000 rem init display list : rem SC = screen to draw 45 | 5001 IF NOT (dk) then dim dl(2,100,5) : dk=1 46 | 5002 hgr2:hgr 47 | 5003 SC=0 : DL(0,0,0)=0 : DL(1,0,0)=0 :gosub 5500: rem DL(X,0,0) = NUM OF POINTS 48 | 5004 return 49 | 50 | 5100 rem draw line on other screen 51 | 5110 poke 230,(SC+1) * 32 52 | 5111 if not(x1>=0 and x1 <=279 and x2 >=0 and x2<=279 and y1>=0 and y1 <=159 and y2>=0 and y2<=159) then return 53 | 5120 SP = DL(SC,0,0) + 1 : DL(SC,0,0)=SP : rem ? sp 54 | 5130 DL(SC,SP,0)=CO 55 | 5131 DL(SC,SP,1)=X1 56 | 5132 DL(SC,SP,2)=Y1 57 | 5133 DL(SC,SP,3)=X2 58 | 5134 DL(SC,SP,4)=Y2 59 | 5140 HCOLOR=CO : HPLOT X1,Y1 TO X2,Y2 60 | 5190 RETURN 61 | 62 | 5400 rem erase lines 63 | 5410 for SP = 1 TO DL(SC,0,0) : HCOLOR=0 64 | 5411 HPLOT DL(SC,SP,1),DL(SC,SP,2) TO DL(SC,SP,3),DL(SC,SP,4) : NEXT 65 | 5412 DL(SC,0,0)=0 : rem clear the list after erasing 66 | 5420 RETURN 67 | 68 | 5500 rem swap screens 69 | 5510 SC = NOT SC 70 | 5511 POKE 49236+(NOT SC),0 : rem select visible page that we're not drawing to 71 | 5515 poke 230,32*(sc+1):gosub 5400 : rem switch drawing page and erase lines 72 | 5520 RETURN 73 | -------------------------------------------------------------------------------- /samples/sample.default.txt: -------------------------------------------------------------------------------- 1 | 10 PRINT "Hello World" 2 | -------------------------------------------------------------------------------- /samples/sample.dicegame.txt: -------------------------------------------------------------------------------- 1 | 100 REM DICE GAME 2 | 110 PR#0:DIM RW$(11) 3 | 120 FOR I=0 to 11:READ ST$:RW$(I)=ST$:NEXT 4 | 130 DATA "Fabulous!","Oh yeah!" 5 | 140 DATA "Impressive!","Sensational!" 6 | 150 DATA "You are a star!","Excellent!" 7 | 160 DATA "My hero!","Top student!" 8 | 170 DATA "Stunning!","What a brain!" 9 | 180 DATA "Terrific work!","Too easy for you!" 10 | 190 DIM SR$(9) 11 | 200 FOR I=0 to 9:READ ST$:SR$(I)=ST$:NEXT 12 | 210 DATA "Sorry,","Hmmm,","Not quite," 13 | 220 DATA "Try again,","Keep at it," 14 | 230 DATA "Careful,","Steady," 15 | 240 DATA "Next time,","Stay calm,","D'oh," 16 | 17 | 300 REM MAIN LOOP 18 | 310 SC=0:DG=0:SD=RND(-PEEK(78)-PEEK(79)*256) 19 | 320 HOME:GR:X=1:Y=9 20 | 330 IF SC=5 THEN HOME:SC=0 21 | 340 GOSUB 500:AN=RN:X=14 22 | 350 GOSUB 500:AN=AN+RN:X=27 23 | 360 GOSUB 500:AN=AN+RN 24 | 370 HOME:VTAB 21:HTAB 7 25 | 380 INPUT "Add the dice together = ";IN:VTAB 23 26 | 390 IF IN=AN THEN GOSUB 8000:HTAB HT:PRINT A$ 27 | 400 IF IN<>AN THEN HTAB 17:GOSUB 9000:HTAB HT:PRINT A$ 28 | 410 VTAB 24:HTAB 7 29 | 420 PRINT "Press any key to continue. "; 30 | 430 GET IN$:GOTO 320 31 | 32 | 500 REM DRAW DICE 33 | 510 C1=INT(RND(1)*15)+1:C2=INT(RND(1)*16) 34 | 520 IF C1=C2 THEN GOTO 510 35 | 530 IF C1=5 OR C1=10 THEN C1=15:C2=1 36 | 540 COLOR=C1:HLIN X+1,X+10 AT Y 37 | 550 FOR V=1 TO 20:HLIN X,X+11 AT Y+V:NEXT 38 | 560 HLIN X+1,X+10 AT Y+21:COLOR=C2 39 | 570 RN=INT(RND(1)*6)+1:DG=1-DG 40 | 580 ON RN GOSUB 1000,2000,3000,4000,5000,6000:RETURN 41 | 42 | 1000 REM ONE 43 | 1010 DX=X+5:DY=Y+9:GOSUB 7000:RETURN 44 | 45 | 2000 REM TWO 46 | 2010 IF DG THEN DX=X+3:DY=Y+5:GOSUB 7000:DX=X+7:DY=Y+12:GOSUB 7000 47 | 2020 IF NOT DG THEN DX=X+7:DY=Y+5:GOSUB 7000:DX=X+3:DY=Y+12:GOSUB 7000 48 | 2030 RETURN 49 | 50 | 3000 REM THREE 51 | 3010 IF DG THEN DX=X+2:DY=Y+4:GOSUB 7000:DX=X+8:DY=Y+14:GOSUB 7000 52 | 3020 IF NOT DG THEN DX=X+8:DY=Y+4:GOSUB 7000:DX=X+2:DY=Y+14:GOSUB 7000 53 | 3030 GOSUB 1000:RETURN 54 | 55 | 4000 REM FOUR 56 | 4010 DX=X+2:DY=Y+4:GOSUB 7000 57 | 4020 DX=X+8:DY=Y+4:GOSUB 7000 58 | 4030 DX=X+2:DY=Y+14:GOSUB 7000 59 | 4040 DX=X+8:DY=Y+14:GOSUB 7000 60 | 4050 RETURN 61 | 62 | 5000 REM FIVE 63 | 5010 GOSUB 4000:GOSUB 1000:RETURN 64 | 65 | 6000 REM SIX 66 | 6010 GOSUB 4000 67 | 6020 IF DG THEN DX=X+5:DY=Y+4:GOSUB 7000:DX=X+5:DY=Y+14:GOSUB 7000 68 | 6030 IF NOT DG THEN DX=X+2:DY=Y+9:GOSUB 7000:DX=X+8:DY=Y+9:GOSUB 7000 69 | 6040 RETURN 70 | 71 | 7000 REM DRAW SPOT 72 | 7010 FOR V=0 TO 3:HLIN DX,DX+1 AT DY+V:NEXT:RETURN 73 | 74 | 8000 REM GIVE REWARD 75 | 8010 SC=SC+1 76 | 8020 A$=RW$(RND(1)*10) + " " + STR$(SC) + "/5" 77 | 8030 HT=20-INT((LEN(A$)/2)):RETURN 78 | 79 | 9000 REM GIVE ENCOURAGEMENT 80 | 9010 A$=SR$(RND(1)*10) + " answer is " + STR$(AN) 81 | 9020 HT=19-INT((LEN(A$)/2)):RETURN -------------------------------------------------------------------------------- /samples/sample.doordetector.txt: -------------------------------------------------------------------------------- 1 | 4 PR# 0:TEXT: HOME 2 | 5 HTAB 15: INVERSE: PRINT "DOOR DETECTOR": NORMAL 3 | 6 PRINT: PRINT: PRINT "DO YOU WANT INSTRUCTIONS? Y/N" 4 | 7 GET P$: IF P$="Y" THEN 610 5 | 8 IF P$<>"N" GOTO 7 6 | 7 | 10 E=200: R=1: F=0: Q=0 8 | 20 A=RND(-PEEK(79)*999-PEEK(78)): A=20: B=20 9 | 10 | 30 FOR I=1 TO 2: V=H: H=INT (RND(1)*(40-R*2))+R: NEXT 11 | 40 REM Line 50: If prior room's exit was next to Death Zone, you'd now be IN Death Zone — step out of it! 12 | 50 A=(A39-R)+A: B=(B39-R)+B 13 | 60 GR: HOME: VTAB 21: PRINT "ENERGY:";E;: HTAB 34: PRINT "ROOM #";R 14 | 65 E=E-1 15 | 70 COLOR=15: PLOT A,B: Q=13: GOSUB 180 16 | 17 | 80 Q=0: FOR I=0 TO 128: I=PEEK(49152): NEXT: POKE 49168,0: I=I - 203: I=I-(I>21) * 32 18 | 90 HOME 19 | 100 VTAB 21: PRINT "ENERGY:";E: VTAB 21: HTAB 34: PRINT "ROOM #";R 20 | 110 IF SGN(I)=I OR I=3 THEN COLOR=0: PLOT A,B: COLOR=15: A=(I=1)+A-NOT I: B=INT(I/3)+B: PLOT A,B: E=E-1 21 | 150 IF B39-R OR B>39-R THEN GOSUB 300 22 | 23 | 180 IF (A-V) * (B-H) > 0 THEN VTAB 23: I=A>V: HTAB I+10: PRINT "YOU ARE IN THE " MID$("COLDHOT",I*4 + 1,4) " ZONE" 24 | 190 ON A<>V OR B<>H GOTO 220:IF Q=13 THEN POP 25 | 200 HOME: FLASH: PRINT "YOU FOUND THE EXIT!!!": NORMAL 26 | 210 Q=15:FOR I=1 TO 20: COLOR=Q: PLOT A,B: Q=15-Q: FOR C=1 TO 300: NEXT C,I: R=R+1: ON R/2 GOTO 30,30,520 27 | 220 IF Q=13 THEN RETURN 28 | 230 IF E>=0 GOTO 80 29 | 240 HOME: INVERSE: VTAB 21: PRINT "YOU RAN OUT OF ENERGY": NORMAL 30 | 250 F=7: GOSUB 310 31 | 32 | 260 FOR PAUSE=1 TO 5000: NEXT PAUSE 33 | 270 HOME: VTAB 21: PRINT "THE DOOR WAS IN THE RED AREA" 34 | 280 COLOR=1: PLOT V,H 35 | 290 GOTO 570 36 | 37 | 300 HOME: INVERSE: VTAB 21: PRINT "YOU HAVE ENTERED THE DEATH ZONE": NORMAL 38 | 39 | 310 FOR I=1 TO 250 40 | 320 COLOR=G 41 | 330 PLOT A,B 42 | 340 G=G+1: IF G>15 THEN G=0 43 | 350 NEXT I 44 | 360 FOR C=1 TO 4 45 | 370 W=A: X=A: Y=B: Z=B 46 | 380 COLOR=0: PLOT A,B 47 | 390 FOR D=1 TO 10: COLOR=G 48 | 400 W=(W<39)+W: X=X-(X>0): Y=(Y<39)+Y: Z=Z-(Z>0) 49 | 450 PLOT W,B: PLOT X,B: PLOT A,Y: PLOT A,Z 50 | 455 FOR PAUSE=1 TO 250: NEXT PAUSE 51 | 460 COLOR=0: PLOT W,B: PLOT X,B: PLOT A,Y: PLOT A,Z 52 | 470 FOR PAUSE=1 TO 250: NEXT PAUSE 53 | 480 G=(G+1) * (G<15): NEXT D 54 | 490 NEXT C: IF F=7 THEN RETURN 55 | 500 GR: GOTO 260 56 | 57 | 520 TEXT: HOME 58 | 530 PRINT "WELL DONE!" 59 | 540 PRINT: PRINT "YOU HAVE ESCAPED FROM ALL FIVE ROOMS" 60 | 550 PRINT "SUCCESSFULLY, WITH ";E;" UNITS OF" 61 | 560 PRINT "ENERGY LEFT.": PRINT 62 | 63 | 570 PRINT "WANT TO PLAY AGAIN? Y/N" 64 | 580 GET A$: IF A$="Y" THEN 10 65 | 590 IF A$="N" THEN PRINT: PRINT "SO LONG!": END 66 | 600 PRINT CHR$(7);: GOTO 580 67 | 68 | 610 HOME 69 | 620 PRINT "The object of this game is to escape" 70 | 630 PRINT "from a series of five rooms before you" 71 | 640 PRINT "run out of energy. Each room contains" 72 | 650 PRINT "an invisible door you must locate to" 73 | 660 PRINT "advance to the next room." 74 | 680 PRINT: PRINT "Use the I, J, K and M keys to move" 75 | 690 PRINT "around the rooms." 76 | 700 PRINT: PRINT "Each room is made up of different zones:" 77 | 710 PRINT "All the area ABOVE and to the LEFT of" 78 | 720 PRINT "the door is called the COLD ZONE." 79 | 730 PRINT: PRINT "All the area BELOW and to the RIGHT of" 80 | 740 PRINT "the door is called the HOT ZONE." 81 | 750 PRINT: PRINT "When you enter one of these zones, a" 82 | 760 PRINT "message on the screen will tell you so." 83 | 770 PRINT "Use this information to help you locate each door." 84 | 780 VTAB 24: PRINT "PRESS ANY KEY TO CONTINUE "; 85 | 790 GET P$ 86 | 800 HOME: PRINT "You must also beware of the invisible" 87 | 810 PRINT "DEATH ZONE, which surrounds the border" 88 | 820 PRINT "of each room. In each room, this zone isa little bit wider than in the previous room." 89 | 840 PRINT: PRINT "If you ever enter this zone, the game" 90 | 850 PRINT "will end immediately!" 91 | 860 PRINT: PRINT "You have 200 units of energy." 92 | 870 PRINT "Every time you move one space, one unit" 93 | 880 PRINT "is used up." 94 | 890 PRINT: PRINT "If you make it through all five rooms," 95 | 900 PRINT "you win. But if you run out of energy orenter the DEATH ZONE, the game is over." 96 | 920 PRINT: PRINT "Good luck!" 97 | 930 VTAB 23: PRINT "PRESS ANY KEY TO START THE GAME "; 98 | 940 GET P$: GOTO 10 -------------------------------------------------------------------------------- /samples/sample.dragonsmaze.txt: -------------------------------------------------------------------------------- 1 | 1 TEXT: HOME 2 | 2 PRINT "WELCOME TO THE DRAGON'S MAZE" 3 | 3 PRINT "YOU MAY WATCH WHILE I BUILD A MAZE," 4 | 4 PRINT "BUT WHEN IT'S COMPLETE, I'LL ERASE" 5 | 5 PRINT "THE PICTURE. THEN YOU'LL ONLY SEE THE WALLS AS YOU BUMP INTO THEM." 6 | 6 PRINT "TO MOVE, YOU HIT 'R' FOR RIGHT," 7 | 7 PRINT "'L' FOR LEFT, 'U' FOR UP, AND" 8 | 8 PRINT "'D' FOR DOWN. DO NOT HIT RETURN!" 9 | 9 PRINT 10 | 10 PRINT "THE OBJECT IS FOR YOU (THE GREEN DOT" 11 | 11 PRINT "TO GET TO THE DOOR ON THE RIGHT SIDE" 12 | 12 PRINT "BEFORE THE DRAGON (THE RED DOT) EATS" 13 | 13 PRINT "YOU." 14 | 14 PRINT "BEWARE!!!!!!!!! SOMETIMES THE DRAGON" 15 | 15 PRINT "GETS REAL MAD, AND CLIMBS OVER A WALL." 16 | 16 PRINT "BUT MOST OF THE TIME, HE CAN'T GO OVER" 17 | 17 PRINT "AND HAS TO GO AROUND." 18 | 18 PRINT 19 | 19 PRINT "(HINT: YOU CAN OFTEN TELL WHERE A WALL" 20 | 20 PRINT "IS, EVEN BEFORE YOU CAN SEE IT, BY" 21 | 21 PRINT "THE FACT THAT THE DRAGON CAN'T GET" 22 | 22 PRINT "THROUGH IT!)" 23 | 23 PRINT 24 | 99 DIM A$(3), M(169), T(169) 25 | 26 | 100 PRINT "ENTER GAME # TO BEGIN ";: INPUT A: IF A<=0 THEN 100 27 | 110 A=RND(-ABS(A)): BL=0: WH=15: RD=1: GN=12 28 | 120 GR: COLOR=WH 29 | 130 HOME: VTAB (21): PRINT "DRAGON MAZE" TAB(25) "GARY J. SHANNON": PRINT TAB(4) "(Applesoft port) RUSSELL A. HOKANSON" 30 | 140 FOR I=0 TO 39 STEP 3: VLIN 0,39 AT I: HLIN 0,39 AT I: NEXT I 31 | 150 COLOR=BL 32 | 160 S=1000 33 | 34 | 1000 REM INITIALIZE ARRAYS, STARTING POINT AND PROCESSED COUNT 35 | 1000 FOR I=1 TO 169: T(I)=0: M(I)=11: NEXT I 36 | 1010 X=INT(RND(1)*13)+1: Y=INT(RND(1)*13)+1: C=169 37 | 38 | 1035 IF C=1 THEN 1200 39 | 1040 R=0: D=0: L=0: U=0: K=X+13*(Y-1): M(K)=-ABS(M(K)): C=C-1 40 | 1050 IF X=13 THEN 1060 41 | 1051 R=M(K+1)>0 42 | 1060 IF Y=13 THEN 1070 43 | 1061 D=M(K+13)>0 44 | 1070 IF X=1 THEN 1080 45 | 1071 L=M(K-1)>0 46 | 1080 IF Y=1 THEN 1090 47 | 1081 U=M(K-13)>0 48 | 1090 Q=R+D+L+U 49 | 1100 IF (Q<3 AND INT(RND(1)*10)<2) OR Q=0 THEN 1170 50 | 51 | 1110 DR=INT(RND(1)*4): REM CHOOSE A DIRECTION (0-RIGHT, 1-DOWN, 2-LEFT, 3-UP) 52 | 1121 IF DR=1 THEN 1140 53 | 1122 IF DR=2 THEN 1150 54 | 1123 IF DR=3 THEN 1160 55 | 56 | 1130 IF NOT R THEN 1110: REM R-RIGHT 57 | 1131 M(K)=M(K)+1: X=X+1 58 | 1135 VLIN 3*Y-2,3*Y-1 AT 3*(X-1) 59 | 1136 GOTO 1035 60 | 61 | 1140 IF NOT D THEN 1110: REM D-DOWN 62 | 1141 M(K)=M(K)+10: Y=Y+1 63 | 1145 HLIN 3*X-2,3*X-1 AT 3*(Y-1) 64 | 1146 GOTO 1035 65 | 66 | 1150 IF NOT L THEN 1110: REM L-LEFT 67 | 1151 M(K-1)=M(K-1)-1: X=X-1 68 | 1155 VLIN 3*Y-2,3*Y-1 AT 3*X 69 | 1156 GOTO 1035 70 | 71 | 1160 IF NOT U THEN 1110: REM U-UP 72 | 1161 M(K-13)=M(K-13)-10: Y=Y-1 73 | 1165 HLIN 3*X-2,3*X-1 AT 3*Y: GOTO 1035 74 | 75 | 1170 X=INT(RND(1)*13)+1: Y=INT(RND(1)*13)+1: REM SELECT RANDOM POSITION 76 | 1180 IF M(X+13*(Y-1))>0 THEN 1170 77 | 1190 C=C+1: GOTO 1035 78 | 79 | 1200 GOSUB 5000: PRINT "THE MAZE IS READY" 80 | 1205 GR: COLOR=WH 81 | 1210 VLIN 0,39 AT 0: VLIN 0,39 AT 39: HLIN 0,39 AT 0: HLIN 0,39 AT 39 82 | 1220 X=1: Y=INT(RND(1)*13)+1: HX=3*X-2: HY=3*Y-2: FOR K=0 TO 1: FOR L=0 TO 1: COLOR=GN: PLOT HX+K,HY+L: NEXT L,K 83 | 1230 WY=INT(RND(1)*13)+1 84 | 1240 COLOR=BL: VLIN 3*WY-2,3*WY-1 AT 39 85 | 1250 SX=13: SY=WY 86 | 1260 QX=3*SX-2: QY=3*SY-2 87 | 88 | 1500 K= PEEK(-16384): IF K<128 THEN 1500 89 | 1510 POKE -16368,0 90 | 1515 QQ=K: GOSUB 7000: K=QQ 91 | 1516 IF SX=X AND SY=Y THEN 8000 92 | 1520 IF K=ASC("R") THEN 2000 93 | 1521 IF K=210 THEN 2000 94 | 1522 IF K=242 THEN 2000 95 | 1530 IF K=ASC("L") THEN 2500 96 | 1531 IF K=204 THEN 2500 97 | 1532 IF K=236 THEN 2500 98 | 1540 IF K=ASC("U") THEN 3000 99 | 1541 IF K=213 THEN 3000 100 | 1542 IF K=245 THEN 3000 101 | 1550 IF K=ASC("D") THEN 3500 102 | 1551 IF K=196 THEN 3500 103 | 1552 IF K=228 THEN 3500 104 | 1560 GOSUB 5000: GOTO 1500 105 | 1999 END 106 | 107 | 2000 DX=1: DY=0: REM RIGHT 108 | 2005 IF X=13 THEN 4000 109 | 2010 P1=M(X+13*(Y-1)): GOSUB 9000: IF MOD>0 THEN 4000 110 | 111 | 2020 FX=3*X-2: FY=3*Y-2: FOR I=1 TO 3 112 | 2030 FX=FX+DX: FY=FY+DY 113 | 2040 COLOR=BL 114 | 2060 FOR K=0 TO 1: FOR L=0 TO 1: PLOT HX+K,HY+L: NEXT L,K: COLOR=GN: FOR K=0 TO 1: FOR L=0 TO 1: PLOT FX+K,FY+L: NEXT L,K: HX=FX: HY=FY 115 | 2110 NEXT I 116 | 2115 X=X+DX: Y=Y+DY 117 | 2116 IF X=13 AND Y=WY THEN 6000 118 | 2120 GOTO 1500 119 | 120 | 2500 DX=-1: DY=0: REM LEFT 121 | 2505 IF X=1 THEN 4100 122 | 2510 P1=M(X+13*(Y-1)-1): GOSUB 9000: IF MOD>0 THEN 4100 123 | 2520 GOTO 2020 124 | 125 | 3000 DX=0: DY=-1: REM UP 126 | 3005 IF Y=1 THEN 4200 127 | 3010 IF INT(ABS(M(X+13*(Y-2)))/10)>0 THEN 4200 128 | 3020 GOTO 2020 129 | 130 | 3500 DX=0: DY=1: REM DOWN 131 | 3505 IF Y=13 THEN 4300 132 | 3510 IF INT(ABS(M(X+13*(Y-1)))/10)>0 THEN 4300 133 | 3520 GOTO 2020 134 | 135 | 4000 GOSUB 5000 136 | 4010 COLOR=WH 137 | 4020 VLIN 3*(Y-1),3*Y AT 3*X 138 | 4030 GOTO 1500 139 | 140 | 4100 GOSUB 5000 141 | 4110 COLOR=WH 142 | 4120 VLIN 3*(Y-1),3*Y AT 3*(X-1) 143 | 4130 GOTO 1500 144 | 145 | 4200 GOSUB 5000 146 | 4210 COLOR=WH 147 | 4220 HLIN 3*(X-1),3*X AT 3*(Y-1) 148 | 4230 GOTO 1500 149 | 150 | 4300 GOSUB 5000 151 | 4310 COLOR=WH 152 | 4320 HLIN 3*(X-1),3*X AT 3*Y 153 | 4330 GOTO 1500 154 | 155 | 5000 S=S-1: FOR I=1 TO 20: A=PEEK(-16336) + PEEK(-16336) + PEEK(-16336) + PEEK(-16336): NEXT I: RETURN 156 | 157 | 6000 PRINT "YOU WIN!" 158 | 6010 GOSUB 5000: GOSUB 5000: GOSUB 5000 159 | 6020 PRINT "SCORE=";S+3 160 | 6030 END 161 | 162 | 7000 REM DRAGON SUB ROUTINE 163 | 7000 IF X>SX THEN 7050: REM RIGHT 164 | 7001 IF Y>SY THEN 7100: REM DOWN 165 | 7002 IF X9 THEN 7080 171 | 7070 P1=M(SX+13*(SY-1)): GOSUB 9000: IF MOD>0 THEN 7100 172 | 7080 DX=1: DY=0: GOTO 7300 173 | 174 | 7100 REM DOWN 175 | 7100 IF SY=13 THEN 7150 176 | 7110 IF T(SX+13*(SY-1))>9 THEN 7130 177 | 7120 IF INT(ABS(M(SX+13*(SY-1)))/10) THEN 7150 178 | 7130 DX=0: DY=1: GOTO 7300 179 | 180 | 7150 REM LEFT 181 | 7150 IF SX=1 THEN 7200 182 | 7160 IF T(SX+13*(SY-1))>9 THEN 7180 183 | 7170 P1=M(SX+13*(SY-1)-1): GOSUB 9000: IF MOD>0 THEN 7200 184 | 7180 DX=-1: DY=0: GOTO 7300 185 | 186 | 7200 REM UP 187 | 7200 IF SY=1 THEN 7050 188 | 7210 IF T(SX+13*(SY-1))>9 THEN 7230 189 | 7220 IF INT(ABS(M(SX+13*(SY-1)-13))/10) THEN 7050 190 | 7230 DX=0: DY=-1: GOTO 7300 191 | 192 | 7300 REM DRAW WALLS/DRAGON 193 | 7300 COLOR=BL 194 | 7310 RX=3*SX-2: RY=3*SY-2 195 | 7320 FOR I=1 TO 3: RX=RX+DX: RY=RY+DY 196 | 7330 COLOR=BL: FOR K=0 TO 1: FOR L=0 TO 1: PLOT QX+K,QY+L: NEXT L,K 197 | 7340 COLOR=RD: FOR K=0 TO 1: FOR L=0 TO 1: PLOT RX+K,RY+l: NEXT L,K: QX=RX: QY=RY 198 | 7350 NEXT I 199 | 200 | 7360 REM UPDATE DRAGON WALLS 201 | 7360 SX=SX+DX: SY=SY+DY 202 | 7370 T(SX+13*(SY-1))=T(SX+13*(SY-1))+1 203 | 7380 RETURN 204 | 205 | 8000 GOSUB 5000: GOSUB 5000: GOSUB 5000: GOSUB 5000: PRINT "THE DRAGON GON GOT YOU!": END 206 | 207 | 9000 REM MOD: Remainder of P1 is returned in MOD 208 | 9000 MOD=ABS(P1)-10*INT(ABS(P1)/10): RETURN 209 | -------------------------------------------------------------------------------- /samples/sample.dye.txt: -------------------------------------------------------------------------------- 1 | 1 normal 2 | 10 home: gr 3 | 11 Print "You Will Dye" 4 | 12 for t = 1 to 3000 : next t 5 | 13 Print "No I will colour in the screen 6 | 14 for t = 1 to 3000 : next t 7 | 15 Print "Not If I rub You Out" 8 | 19 color = 0 9 | 20 plot 10,10 10 | 30 x = 3: y = 3: dx = 1: dy = 1 11 | 35 a = 3: b = 3: da = 1: db = 1 12 | 40 x = x + dx: y = y + dy 13 | 41 if rnd(1) < 0.8 then dx = -dx 14 | 50 if x > 35 then dx = -1 15 | 51 if x < 5 then dx = 1 16 | 52 if y > 35 then dy = -1 17 | 53 if y < 5 then dy = 1 18 | 55 color = 14: plot x,y 19 | 58 color = rnd(1)*10: : plot x,y 20 | 140 a = a + da: b = b + db 21 | 141 if rnd(1) < 0.01 then da = -da 22 | 150 if a > 35 then da = -1 23 | 151 if a < 5 then da = 1 24 | 152 if b > 35 then db = -1 25 | 153 if b < 5 then db = 1 26 | 155 color = 2: plot a,b 27 | 156 for t = 1 to 200: next t 28 | 158 color = 0: : plot a,b 29 | 170 goto 40 -------------------------------------------------------------------------------- /samples/sample.enterprise.txt: -------------------------------------------------------------------------------- 1 | 5 HOME 2 | 10 GR 3 | 20 COLOR=5 4 | 30 HLIN 10,20 AT 15 5 | 40 HLIN 12,18 AT 14 6 | 50 COLOR=13 7 | 60 HLIN 15,16 AT 13 8 | 65 COLOR=5 9 | 70 HLIN 13,17 AT 16 10 | 80 COLOR=13 11 | 90 HLIN 15,15 AT 17 12 | 95 COLOR=5 13 | 100 HLIN 18,20 AT 16 14 | 110 HLIN 19,21 AT 17 15 | 120 HLIN 20,22 AT 18 16 | 130 HLIN 21,23 AT 19 17 | 140 HLIN 21,26 AT 20 18 | 150 HLIN 21,25 AT 21 19 | 160 HLIN 21,24 AT 22 20 | 170 COLOR=8 21 | 180 HLIN 20,20 AT 21 22 | 190 COLOR=5 23 | 200 HLIN 25,26 AT 19 24 | 210 HLIN 26,27 AT 18 25 | 220 HLIN 27,28 AT 17 26 | 230 HLIN 24,30 AT 16 27 | 240 HLIN 24,31 AT 15 28 | 250 COLOR=9 29 | 260 HLIN 24,24 AT 15 30 | 265 HLIN 24,24 AT 16 31 | 270 PRINT "THE ORIGINAL SERIES ENTERPRISE" -------------------------------------------------------------------------------- /samples/sample.enterprise2.txt: -------------------------------------------------------------------------------- 1 | 5 PR#0:HOME 2 | 10 GR 3 | 20 COLOR=7 4 | 22 HLIN 10,12 AT 17 5 | 25 HLIN 8,16 AT 16 6 | 30 HLIN 5,17 AT 15 7 | 40 HLIN 7,15 AT 14 8 | 45 HLIN 10,12 AT 13 9 | 50 COLOR=13 10 | 60 PLOT 11,12 11 | 90 PLOT 11,18 12 | 100 COLOR=7 13 | 110 HLIN 15,17 AT 17 14 | 120 HLIN 16,18 AT 18 15 | 130 HLIN 17,27 AT 19 16 | 140 HLIN 17,28 AT 20 17 | 150 HLIN 17,25 AT 21 18 | 160 HLIN 17,22 AT 22 19 | 170 COLOR=1 20 | 180 PLOT 16,21 21 | 190 COLOR=7 22 | 200 VLIN 15,18 AT 23 23 | 210 VLIN 15,18 AT 24 24 | 230 HLIN 20,31 AT 14 25 | 240 HLIN 20,32 AT 13 26 | 250 COLOR=9 27 | 260 VLIN 13,14 AT 20 28 | 270 COLOR=5 29 | 280 VLIN 15,18 AT 22 30 | 290 HLIN 20,21 AT 15 31 | 300 HLIN 25,30 AT 15 32 | 310 COLOR=1 33 | 320 VLIN 14,15 AT 19 34 | 330 PRINT "THE ORIGINAL SERIES ENTERPRISE" -------------------------------------------------------------------------------- /samples/sample.factors.txt: -------------------------------------------------------------------------------- 1 | 90 text: pr#0: home 2 | 95 print "Enter a number to find its factors!" 3 | 97 print "(Zero to quit.)" 4 | 100 print: input a: a=abs(a) 5 | 110 print: if not a then print "Bye!";: end 6 | 120 s=2: e=1 7 | 130 n=0: for i=s to e step 2 8 | 150 f=a/i 9 | 160 if int(f)=f then let a=f: n=n+1: goto 150 10 | 170 if n then print i;: s=i: i=e 11 | 180 next 12 | 190 if n>1 then print "^"; n; 13 | 200 if n and a>1 then print " x "; 14 | 210 rem print a;" "; n;" "; i;" "; e;" ";f 15 | 220 s=(s>2)+s+1: n=(s>3)*2+not n 16 | 230 if n<3 and a>1 then e=sqr(a): goto 130 17 | 240 if n=1 or a>1 then print a; 18 | 250 print: goto 100 -------------------------------------------------------------------------------- /samples/sample.february.txt: -------------------------------------------------------------------------------- 1 | 1 REM 25 THINGS 2 | 2 TEXT 3 | 3 HOME 4 | 4 GR 5 | 5 LET E = 0 6 | 6 LET V = 100 7 | 7 HTAB V/10 - 1 8 | 8 VTAB 23 9 | 9 COLOR = V/100 10 | 10 FOR L = 0 TO V + E 11 | 11 LET V = E 12 | 12 LET E = L/10 13 | 13 VLIN 20,20+(L/100)*20 AT (E)+10 14 | 14 VLIN 20,20+(L/100)*20 AT 30-(E) 15 | 15 VLIN (SIN((L+27.1)/10)*7)+12,20 AT L/5+10 16 | 16 LET E = V 17 | 17 LET E = E + 1 18 | 18 IF E = 4 THEN GOSUB 21 19 | 19 NEXT 20 | 20 END 21 | 21 LET V = INT(L/E)+1 22 | 22 PRINT V" "; 23 | 23 LET E = 0 24 | 24 RETURN 25 | 25 REM BY API 26 | -------------------------------------------------------------------------------- /samples/sample.fsim.txt: -------------------------------------------------------------------------------- 1 | 2 | 0 REM Sky palette: 3 | 0 REM Clouds 6/1 (light blue) 4 | 0 REM Sky 6/6 (blue) 5 | 0 REM Dusk 6/2 (purple) 6 | 0 REM Night 6/0 (dark blue) 7 | 8 | 0 REM Ground palette: 9 | 0 REM Water 6/0 (dark blue) 10 | 0 REM Water (night) 0/0 (black) 11 | 0 REM Water 6/1 (turquoise) 12 | 0 REM Cement 1/2 (gray) 13 | 0 REM Grass 1/1 (green) 14 | 0 REM Forest 1/0 (dark green) 15 | 0 REM Sand 5/1 (khaki) 16 | 0 REM Tundra 1/3 (light green) 17 | 0 REM Ice 3/3 (white) 18 | 19 | 10 HGR : HGR2 : PG = 0 20 | 20 DIM SC(192), GC(192) 21 | 30 FOR Y = 0 TO 191 STEP 2 22 | : SC(Y) = 6 : SC(Y+1) = 6 23 | : GC(Y) = 5 : GC(Y+1) = 1 24 | : NEXT 25 | 26 | 100 POKE 49236 + (1-PG), 0 : POKE 230, 32 + 32 * PG 27 | 28 | 120 M = 2 * ( 0.5 - (PDL(0) / 255) ) 29 | 121 B = 192 * (PDL(1) / 255) - 96 30 | 122 B = B * 2 31 | 32 | 140 GOSUB 1000 33 | 150 PG = PG + 1 : IF PG > 1 THEN PG = 0 34 | 160 GOTO 100 35 | 36 | 999 END 37 | 38 | 39 | 40 | 1000 REM Draw sky/horizon; call w/ M, B (y=Mx + B); 0,0 is center 41 | 42 | 1010 Y1 = ( M * -140 ) + B + 96 43 | 1011 Y2 = ( M * 140 ) + B + 96 44 | 1012 IF Y1 < 0 AND Y2 < 0 THEN FOR Y = 0 TO 191 45 | : HCOLOR= GC(Y) : HPLOT 0,Y TO 279,Y 46 | : NEXT : RETURN 47 | 48 | 1013 IF Y1 > 279 AND Y2 > 279 THEN FOR Y = 0 TO 191 49 | : HCOLOR= SC(Y) : HPLOT 0,Y TO 279,Y 50 | : NEXT : RETURN 51 | 52 | 1014 IF Y1 = Y2 THEN Y1 = INT(Y1) 53 | : FOR Y = 0 TO Y1 - 1 54 | : HCOLOR= SC(Y) : HPLOT 0,Y TO 279,Y 55 | : NEXT 56 | : FOR Y = Y1 TO 191 57 | : HCOLOR= GC(Y) : HPLOT 0,Y TO 279,Y 58 | : NEXT 59 | : RETURN 60 | 61 | 1015 REM TODO: Optimize for near-horizontal lines with solid above/below 62 | 63 | 64 | 65 | : REM (y-b)/m = x 66 | 67 | 1020 X1 = ( -96 - B ) / M + 140 68 | 1021 X2 = ( 96 - B ) / M + 140 69 | 1022 DX = (X2 - X1) / 192 70 | 71 | : REM TODO: flip colors if DX is negative 72 | 73 | 74 | 1040 XF = X1 : FOR Y = 0 TO 191 : X = INT(XF) : XF = XF + DX 75 | 76 | 1041 IF DX <= 0 THEN C1 = SC(Y) : C2 = GC(Y) 77 | 1042 IF DX > 0 THEN C1 = GC(Y) : C2 = SC(Y) 78 | 79 | 1050 IF X < 1 THEN HCOLOR= C2 : HPLOT 0,Y TO 279,Y : GOTO 1080 80 | 1051 IF X > 279 THEN HCOLOR= C1 : HPLOT 0,Y TO 279,Y : GOTO 1080 81 | 1052 HCOLOR= C1 : HPLOT 0,Y TO X-1, Y : HCOLOR= C2 : HPLOT X,Y TO 279,Y 82 | 83 | 1080 NEXT : RETURN 84 | -------------------------------------------------------------------------------- /samples/sample.functiongraphing.txt: -------------------------------------------------------------------------------- 1 | 10 rem Function Graphing 2 | 20 rem by Golden Child 3 | 25 rem 4 | 30 rem Use Basic as your graphing calculator 5 | 31 rem 6 | 35 rem To graph a function, have a loop that iterates over every x on screen 7 | 36 rem calculate the x coordinate from the x screen coordinate 8 | 37 rem calculate y (your function value), set color and gosub 500 9 | 38 rem 10 | 40 rem for sx=0 to wx-1 : rem for screenx = 0 to 279 11 | 50 rem x=(sx-cx)/(wx/2)*rx : rem calculate x for screenx 12 | 60 rem y = x^2 : rem calculate y (here we calc x^2) 13 | 70 rem hcolor=1:gosub 500 : rem set color and draw 14 | 80 rem next sx 15 | 16 | 90 hgr 17 | 100 wx=280:wy=140 : rem windowx windowy (screen size) 18 | 120 cx=wx/2:cy=wy/2 : rem centerx centery (screen center point) 19 | 130 hcolor=6:hplot cx,cy : rem draw centerpoint 20 | 21 | 140 rx=4:ry=rx/2 : rem rangex and rangey 22 | 141 gx=1:gy=gx : rem gridx and gridy spacing 23 | 24 | 142 for x=int(-rx) to int(rx) step gx : rem draw grid 25 | 143 for y=int(-ry) to int(ry) step gy 26 | 144 sx=cx+x*(wx/2)/rx:hcolor=6:gosub 500 : ? x,y 27 | 145 next:next 28 | 29 | 150 for sx=0 to wx-1 : rem for screenx = 0 to 279 30 | 160 x=(sx-cx)/(wx/2)*rx : rem calculate x for screenx 31 | 200 y = x^2 : rem calculate y 32 | 201 hcolor=1:gosub 500 : rem set hcolor, gosub 500 (calculate screeny and plot) 33 | 205 y = sin(x*2) : rem can draw as many functions as you like 34 | 260 hcolor=3:gosub 500 : rem just calc y, set hcolor, gosub 500 35 | 265 y=sin(x*3) 36 | 270 hcolor=2:gosub 500 37 | 271 y=0:hcolor=5:gosub 500 : rem draw x axis, set y=0, gosub 500 38 | 39 | 272 if (4-x^2)>=0 then y=sqr(4-x^2):gosub 500: y=-sqr(4-x^2):gosub 500:rem circle 40 | 41 | 273 rem tangent line to x^2 at x=1 : derivative=2x so slope = m = 2x 42 | 274 rem manually calculated formula for tangent line at x=1 43 | 275 y=1+(x-1)*(2) : gosub 500 44 | 276 rem calculating tangent line from x1 coordinate 45 | 277 x1=-1 : y1=x1^2 : m=2*x1 : y=y1 + (x-x1)*m : hcolor=1:gosub 500 46 | 400 next sx 47 | 48 | 499 print "end" : END 49 | 500 sy=cy-y*(wy/2)/ry : rem calculate screeny 50 | 505 print sx,sy 51 | 510 if sy>=0 and sy<=159 and sx>=0 and sx<=279 then hplot sx,sy 52 | 520 return 53 | -------------------------------------------------------------------------------- /samples/sample.gaussian.txt: -------------------------------------------------------------------------------- 1 | 5 rem Plot Gaussian distribution in two dimensions 2 | 10 text: home: PRINT "Standard Deviation = ";: input s1 3 | 20 hgr: hcolor = 3 4 | 30 w = 278: h = 155: p2 = atn(1) * 8 5 | 40 w0 = w - 100: w1 = w0/10 6 | 45 h1 = h - 100: h2 = h - 60 7 | 50 k = 0.5: m = 1 / (p2 * s1 * s1) 8 | 60 for i = 0 to 10 step k 9 | 70 x = 10 * i + 1: y = 10 * i + h1 10 | 75 hplot x,y 11 | 80 for j = 0 to w0 12 | 85 j1 = 10 * j / w0 13 | 90 d1 = abs(5 - i) 14 | 100 d2 = abs(5 - j1) 15 | 110 r2 = (d1*d1+d2*d2)/(2*s1*s1) 16 | 120 g = exp(-r2)/(p2*s1*s1) 17 | 130 a = int((h2 * g)/ m) 18 | 140 x = 10 * i + w1 * j1 + 1 19 | 150 y = 10 * i + h1 - a 20 | 160 hplot to x,y 21 | 170 if not i goto 265 22 | 175 if j = w0 goto 190 23 | 180 j2 = j/10: if int(j2) <> j2 goto 290 24 | 190 d1 = abs(5 - i + k) 25 | 200 d2 = abs(5 - j1) 26 | 210 r2 = (d1*d1+d2*d2)/(2*s1*s1) 27 | 220 u = exp(-r2)/(p2*s1*s1) 28 | 225 a1 = int(h2 * u / m) 29 | 230 x1 = 10 * (i - k) + w1 * j1 + 1 30 | 240 y1 = 10 * (i - k) + h1 - a1 31 | 245 rem if y <= y1 goto 290 32 | 250 hplot to x1,y1 33 | 260 hplot x,y 34 | 265 if not j goto 310 35 | 270 if i < 10 goto 290 36 | 275 if j = w0 goto 295 37 | 280 j2 = j/10: if int(j2) = j2 goto 295 38 | 290 hcolor = 0 39 | 295 hplot to x,10 * i + h1 40 | 300 hcolor = 3 41 | 305 hplot x,y 42 | 310 next j 43 | 320 next i 44 | 330 hplot w+1,h: hplot to 100+1,h: hplot to 0+1,h1 45 | 340 vtab 21: print "Gaussian (std. dev. = ";s1;")" 46 | 350 print "Plot from -5.0 to + 5.0" 47 | 360 print "Peak value = "m -------------------------------------------------------------------------------- /samples/sample.hacker.txt: -------------------------------------------------------------------------------- 1 | 5 REM http://www.geocities.com/mmphosis/apple2/contest/2007/old-computer-challenge.html 2 | 10 GR 3 | 20 POKE 49234,0 : rem fullscreen 4 | 30 COLOR= 15 5 | 40 FOR I = 0 TO 39 6 | 50 VLIN 0,47 AT I 7 | 60 NEXT 8 | 100 COLOR= 5 9 | 110 S = 21 10 | 120 W = S 11 | 130 H = 27 12 | 140 X = INT ((40 - W) / 2) 13 | 150 Y = INT ((48 - H) / 2) 14 | 160 D = INT (W / 3) 15 | 161 DX = D 16 | 170 Y2 = Y + H 17 | 180 X2 = X + W 18 | 200 FOR I = 0 TO 3 19 | 210 VLIN Y,Y2 AT X + I * D 20 | 220 NEXT 21 | 240 D = INT (H / 3) 22 | 250 FOR I = 0 TO 3 23 | 260 HLIN X,X2 AT Y + I * D 24 | 270 NEXT 25 | 280 YH = INT (D / 2) 26 | 281 YM = Y + H - YH 27 | 290 XH = INT (DX / 2) 28 | 300 COLOR= 0 29 | 310 FOR I = 0 TO 2 30 | 320 YY = YM 31 | 330 XX = X + XH + I * DX 32 | 340 GOSUB 500 33 | 350 NEXT 34 | 400 YY = YY - D 35 | 410 GOSUB 500 36 | 420 YY = YY - D 37 | 430 XX = XX - DX 38 | 440 GOSUB 500 39 | 450 K = PEEK ( - 16384) 40 | 460 IF K < 128 THEN 450 41 | 470 K = PEEK ( - 16368) 42 | 480 TEXT : HOME 43 | 490 END 44 | 500 VLIN YY + 1,YY - 2 AT XX 45 | 510 VLIN YY + 1,YY - 2 AT XX + 1 46 | 520 VLIN YY,YY - 1 AT XX - 1 47 | 530 VLIN YY,YY - 1 AT XX + 2 48 | 540 RETURN 49 | -------------------------------------------------------------------------------- /samples/sample.hellosine.txt: -------------------------------------------------------------------------------- 1 | 0 PR#3 2 | 5 x = 0 3 | 7 sp = int(30 + (30* sin(x* 3.14159 / 180 ) )) 4 | 10 PRINT spc(sp);"Hello World" 5 | 20 x = x + 15 6 | 30 goto 7 7 | -------------------------------------------------------------------------------- /samples/sample.hgrblends.txt: -------------------------------------------------------------------------------- 1 | 0 DIM C(5) : FOR I = 0 TO 5 : READ X : C(I) = X : NEXT : DATA 0,1,2,5,6,7 2 | 3 | 5 HGR2 4 | 5 | 10 FOR X = 0 TO 5 : FOR Y = 0 TO 5 6 | 20 SX = INT(X / 6 * 279) 7 | : EX = INT((X+1) / 6 * 279) 8 | : SY = INT(Y / 6 * 190) 9 | : EY = INT((Y+1) / 6 * 190) 10 | 30 FOR PY = SY TO EY 11 | : HCOLOR= C(X) : HPLOT SX,PY TO EX,PY : PY = PY + 1 12 | : HCOLOR= C(Y) : HPLOT SX,PY TO EX,PY 13 | 14 | 40 NEXT : NEXT : NEXT -------------------------------------------------------------------------------- /samples/sample.hireswalk.txt: -------------------------------------------------------------------------------- 1 | 10 HGR 2 | 20 X=140: Y=80 3 | 30 C=INT(RND(1)*8) 4 | 40 BR=3 5 | 40 HCOLOR=C: HPLOT X,Y: HPLOT X-1,Y-1: HPLOT X+1,Y+1 6 | 50 HPLOT X+1,Y-1: HPLOT X-1,Y+1 7 | 60 HPLOT X+1,Y: HPLOT X-1,Y: HPLOT X,Y+1: HPLOT X,Y-1 8 | 70 IF RND(1)>=.9 THEN C=INT(RND(1)*8) 9 | 80 IF RND(1)>=.9 THEN BR=BR + INT(RND(1)*3) - 1 10 | 90 IF BR<1 THEN BR=1 11 | 100 IF BR>7 THEN BR=7 12 | 110 NX = X + INT(RND(1)*15) - 7 13 | 120 NY = Y + INT(RND(1)*15) - 7 14 | 130 IF NX > 279 THEN NX=279 15 | 140 IF NX < 0 THEN NX=0 16 | 150 IF NY > 159 THEN NY=159 17 | 160 IF NY < 0 THEN NY=0 18 | 170 HCOLOR=C 19 | 180 FOR I=-INT(BR/2) TO INT((BR+1)/2) 20 | 190 FOR J=-INT(BR/2) TO INT((BR+1)/2) 21 | 200 X1=X+I: X2=NX+I: Y1=Y+J: Y2=NY+J 22 | 210 IF X1>279 THEN X1=279 23 | 220 IF X1<0 THEN X1=0 24 | 230 IF X2>279 THEN X2=279 25 | 240 IF X2<0 THEN X2=0 26 | 250 IF Y1>159 THEN Y1=159 27 | 260 IF Y1<0 THEN Y1=0 28 | 270 IF Y2>159 THEN Y2=159 29 | 280 IF Y2<0 THEN Y2=0 30 | 290 HPLOT X1,Y1 TO X2,Y2 31 | 300 NEXT: NEXT 32 | 310 X=NX: Y=NY 33 | 320 GOTO 70 34 | 35 | -------------------------------------------------------------------------------- /samples/sample.jot.txt: -------------------------------------------------------------------------------- 1 | 1 TEXT : HOME : PRINT "THIS GAME IS PLAYED ENTIRELY WITH" 2 | 2 FLASH : PRINT "3";: NORMAL : PRINT "-LETTER WORDS. ALL LETTERS IN A WORD" 3 | 3 PRINT "MUST BE UNIQUE (FOR EXAMPLE, 'POP' IS" 4 | 4 PRINT "*NOT* A VALID WORD).": PRINT 5 | 5 PRINT "TO BEGIN THE GAME, BOTH YOU AND I WILL" 6 | 6 PRINT "CHOOSE A SECRET WORD. THE FIRST PLAYER" 7 | 7 PRINT "TO GUESS THE OTHER'S WORD WINS.": PRINT 8 | 8 PRINT "AFTER EACH GUESS, THE ASKER IS TOLD" 9 | 9 PRINT "HOW MANY LETTERS WERE CORRECT. THE" 10 | 10 PRINT "POSITION OF THE LETTERS DOES *NOT*" 11 | 11 PRINT "MATTER (FOR EXAMPLE, IF THE WORD WAS" 12 | 12 PRINT "'OWN' A GUESS OF 'WHO' WOULD HAVE 2" 13 | 13 PRINT "HITS.": PRINT 14 | 95 INPUT "READY? ";Q$ 15 | 99 M1 = 0:M2 = 0 16 | 100 REM : JOT 17 | 110 REM : COPYRIGHT 1980 BY PHIL FELDMAN AND TOM RUGG 18 | 150 M = 25:N = 406 19 | 160 DIM A$(N) 20 | 170 DIM G1$(M),G2$(M),H1(M),H2(M) 21 | 200 G1 = 0:G2 = 0 22 | 210 L = N:Q = PEEK (78) + 256 * PEEK (79):Q = RND ( - Q) 23 | 250 TEXT : HOME : PRINT TAB(17);"J O T": PRINT 24 | 260 PRINT "JUST A MOMENT PLEASE .....": GOSUB 3000:Q = INT(RND (1) * N) + 1: PRINT 25 | 270 PRINT "THANKS, NOW LET'S EACH THINK": PRINT "OF OUR SECRET WORD" 26 | 280 PRINT : PRINT "(THIS TAKES ME A WHILE ...)" 27 | 290 GOSUB 2200:M$ = A$(Q): PRINT : PRINT "OK, "; 28 | 300 INPUT "DO YOU WANT TO GO FIRST? ";Q$ 29 | 310 Q$ = LEFT$ (Q$,1): IF Q$ = "N" THEN 600 30 | 320 IF Q$ = "Y" THEN 500 31 | 330 PRINT : PRINT "YES OR NO PLEASE": PRINT : GOTO 300 32 | 500 M2 = M2 + 1: IF M2 = 1 THEN PRINT : PRINT "TYPE S FOR LIST OF PREVIOUS GUESSES." 33 | 502 PRINT : INPUT "YOUR GUESS (OR S)? ";P$: IF P$ = "S" THEN GOSUB 1000: GOTO 500 34 | 510 IF P$ = "Q" THEN 1200 35 | 520 IF P$ = M$ THEN G1 = G1 + 1:G1$(G1) = P$:H1(G1) = 9: GOTO 3400 36 | 530 GOSUB 1800: IF F = 0 THEN PRINT "THAT'S NOT A LEGAL WORD -- TRY AGAIN": GOTO 500 37 | 540 Q$ = M$: GOSUB 2600:Q$ = P$: GOSUB 1500 38 | 550 PRINT "# OF HITS IS ";Q 39 | 560 G1 = G1 + 1:G1$(G1) = Q$:H1(G1) = Q 40 | 570 IF G1 = M THEN 3600 41 | 600 Q$ = A$(L):G2 = G2 + 1:G2$(G2) = Q$ 42 | 610 PRINT : PRINT "MY GUESS IS -- ";Q$ 43 | 615 M1 = M1 + 1: IF M1 = 1 THEN PRINT : PRINT "IF I AM RIGHT, TYPE R." 44 | 620 INPUT "HOW DID I DO (0-3 OR R)? ";P$ 45 | 630 P$ = LEFT$ (P$,1) 46 | 640 IF P$ = "R" THEN H2(G2) = 9: GOTO 3200 47 | 650 P = VAL (P$): IF P > 3 OR (P = 0 AND P$ < > "0") THEN PRINT "BAD ANSWER": GOTO 610 48 | 660 IF L > 100 THEN PRINT : PRINT "I'M THINKING ..." 49 | 670 H2(G2) = P: GOSUB 800 50 | 680 GOTO 500 51 | 800 Q$ = G2$(G2):H = H2(G2):J = 0: GOSUB 2600:L = L - 1: IF L < 1 THEN 900 52 | 810 J = J + 1: IF J > L THEN 870 53 | 820 Q$ = A$(J): GOSUB 1500 54 | 830 IF Q = H THEN 810 55 | 840 A = J:B = L: GOSUB 2400:L = L - 1 56 | 850 IF L < 1 THEN 900 57 | 860 IF L > = J THEN 820 58 | 870 RETURN 59 | 900 PRINT : PRINT "SOMETHING'S WRONG !!" 60 | 910 PRINT : INPUT "WHAT'S YOUR SECRET WORD? ";P$: GOSUB 1800 61 | 920 IF F = 0 THEN PRINT : PRINT "ILLEGAL WORD -- I NEVER HAD A CHANCE": GOTO 1200 62 | 930 PRINT : PRINT "YOU GAVE A BAD ANSWER SOMEWHERE --" 63 | 940 PRINT "CHECK THE SUMMARY": GOSUB 1000 64 | 950 GOTO 1200 65 | 1000 PRINT :Q = G1: IF G2 > G1 THEN Q = G2 66 | 1010 IF Q = 0 THEN PRINT "NO GUESSES YET": RETURN 67 | 1020 PRINT TAB(1);: FOR J = 1 TO 37: PRINT "-";: NEXT : PRINT "-" 68 | 1030 PRINT TAB(1);: INVERSE : PRINT "YOUR GUESSES";: NORMAL 69 | 1040 PRINT " SUMMARY ";: INVERSE 70 | 1050 PRINT "MY GUESSES";: NORMAL : PRINT " " 71 | 1060 PRINT "WORD HITS"; TAB(29);"WORD HITS" 72 | 1070 FOR J = 1 TO Q:K = 1: IF J > 9 THEN K = 0 73 | 1080 IF J > G1 THEN PRINT TAB(19 + K);J; TAB(30);G2$(J); TAB(36);H2(J): GOTO 1110 74 | 1090 IF J > G2 THEN PRINT TAB(2);G1$(J); TAB(9);H1(J); TAB(19 + K);J: GOTO 1110 75 | 1100 PRINT TAB(2);G1$(J); TAB(9);H1(J); TAB(19 + K);J; TAB(30);G2$(J); TAB(36);H2(J) 76 | 1110 NEXT : RETURN 77 | 1200 PRINT : INPUT "HOW ABOUT ANOTHER GAME? ";Q$ 78 | 1210 Q$ = LEFT$ (Q$,1): IF Q$ = "Y" THEN 200 79 | 1220 IF Q$ = "N" THEN END 80 | 1230 PRINT : PRINT "YES OR NO PLEASE": GOTO 1200 81 | 1500 P$ = LEFT$ (Q$,1):Q = 0: GOSUB 1600 82 | 1510 P$ = MID$ (Q$,2,1): GOSUB 1600 83 | 1520 P$ = RIGHT$ (Q$,1): GOSUB 1600: RETURN 84 | 1600 IF P$ = M1$ OR P$ = M2$ OR P$ = M3$ THEN Q = Q + 1 85 | 1610 RETURN 86 | 1800 F = 0 87 | 1810 FOR J = 1 TO N 88 | 1820 IF A$(J) = P$ THEN F = 1: RETURN 89 | 1830 NEXT : RETURN 90 | 2200 FOR A = N TO 100 STEP - 1:B = INT ( RND (1) * A) + 1 91 | 2210 GOSUB 2400: NEXT 92 | 2220 PRINT : PRINT "I'VE ALMOST GOT IT ..." 93 | 2230 FOR A = 99 TO 2 STEP - 1:B = INT ( RND (1) * A) + 1 94 | 2240 GOSUB 2400: NEXT : RETURN 95 | 2400 Q$ = A$(B):A$(B) = A$(A):A$(A) = Q$: RETURN 96 | 2600 M1$ = LEFT$ (Q$,1):M2$ = MID$ (Q$,2,1) 97 | 2610 M3$ = RIGHT$ (Q$,1): RETURN 98 | 3000 RESTORE : FOR P = 1 TO N: READ A$(P): NEXT : RETURN 99 | 3200 PRINT : PRINT "IT SURE FEELS GOOD" 100 | 3210 PRINT : PRINT "MY WORD WAS -- ";M$ 101 | 3220 GOTO 1200 102 | 3400 PRINT : PRINT "CONGRATULATIONS - THAT WAS IT": PRINT 103 | 3410 INPUT "WHAT WAS YOUR WORD? ";P$: GOSUB 1800:J = 1 104 | 3420 IF F = 0 THEN PRINT : PRINT "ILLEGAL WORD - I HAD NO CHANCE": GOTO 1200 105 | 3430 IF A$(J) = P$ THEN PRINT : PRINT "NICE WORD": GOTO 1200 106 | 3440 J = J + 1: IF J < = L THEN 3430 107 | 3450 PRINT : PRINT "YOU MADE AN ERROR SOMEWHERE": PRINT "-- CHECK THE SUMMARY" 108 | 3460 GOSUB 1000: GOTO 1200 109 | 3600 PRINT : PRINT "SORRY, I'M OUT OF MEMORY": PRINT 110 | 3610 PRINT "MY WORD WAS - ";M$: GOTO 1200 111 | 5000 DATA ACE,ACT,ADE,ADO,ADS,AFT,AGE 112 | 5010 DATA AGO,AID,AIL,AIM,AIR,ALE,ALP 113 | 5020 DATA AND,ANT,ANY,APE,APT,ARC,ARE 114 | 5030 DATA ARK,ARM,ART,ASH,ASK,ASP,ATE 115 | 5040 DATA AWE,AWL,AXE,AYE,BAD,BAG,BAN 116 | 5050 DATA BAR,BAT,BAY,BED,BEG,BET,BID 117 | 5060 DATA BIG,BIN,BIT,BOA,BOG,BOW,BOX 118 | 5070 DATA BOY,BUD,BUG,BUM,BUN,BUS,BUT 119 | 5080 DATA BUY,BYE,CAB,CAD,CAM,CAN,CAP 120 | 5090 DATA CAR,CAT,COB,COD,COG,CON,COP 121 | 5100 DATA COT,COW,COY,CRY,CUB,CUD,CUE 122 | 5110 DATA CUP,CUR,CUT,DAB,DAM,DAY,DEN 123 | 5120 DATA DEW,DIE,DIG,DIM,DIN,DIP,DOE 124 | 5130 DATA DOG,DON,DOT,DRY,DUB,DUE,DUG 125 | 5140 DATA DYE,DUO,EAR,EAT,EGO,ELK,ELM 126 | 5150 DATA END,ELF,ERA,FAD,FAG,FAN,FAR 127 | 5160 DATA FAT,FED,FEW,FIG,FIN,FIR,FIT 128 | 5170 DATA FIX,FLY,FOE,FOG,FOR,FOX,FRY 129 | 5180 DATA FUN,FUR,GAP,GAS,GAY,GEM,GET 130 | 5190 DATA GIN,GNU,GOB,GOD,GOT,GUM,GUN 131 | 5200 DATA GUT,GUY,GYP,HAD,HAG,HAM,HAS 132 | 5210 DATA HAT,HAY,HEN,HEX,HID,HIM,HIP 133 | 5220 DATA HIS,HIT,HER,HEM,HOE,HOG,HOP 134 | 5230 DATA HOT,HOW,HUB,HUE,HUG,HUM,HUT 135 | 5240 DATA ICE,ICY,ILK,INK,IMP,ION,IRE 136 | 5250 DATA IRK,ITS,IVY,JAB,JAR,JAW,JAY 137 | 5260 DATA JOB,JOG,JOT,JOY,JUG,JAG,JAM 138 | 5270 DATA JET,JIB,JIG,JUT,KEG,KEY,KID 139 | 5280 DATA KIN,KIT,LAB,LAD,LAG,LAP,LAW 140 | 5290 DATA LAY,LAX,LED,LEG,LET,LID,LIE 141 | 5300 DATA LIP,LIT,LOB,LOG,LOP,LOT,LOW 142 | 5310 DATA LYE,MAD,MAN,MAP,MAR,MAT,MAY 143 | 5320 DATA MEN,MET,MID,MOB,MOP,MOW,MUD 144 | 5330 DATA MIX,MUG,NAB,NAG,NAP,NAY,NET 145 | 5340 DATA NEW,NIL,NIP,NOD,NOT,NOR,NOW 146 | 5350 DATA NUT,OAF,OAK,OAR,OAT,ODE,OIL 147 | 5360 DATA OLD,ONE,OPT,ORE,OUR,OUT,OVA 148 | 5370 DATA OWE,OWL,OWN,PAD,PAL,PAN,PAR 149 | 5380 DATA PAT,PAW,PAY,PEA,PEG,PEN,PET 150 | 5390 DATA PEW,PIE,PIG,PIT,PLY,POD,POT 151 | 5400 DATA POX,PER,PIN,PRO,PRY,PUB,PUN 152 | 5410 DATA PUS,PUT,RAG,RAM,RAN,RAP,RAT 153 | 5420 DATA RAW,RAY,RED,RIB,RID,REV,RIG 154 | 5430 DATA RIM,RIP,ROB,ROD,ROE,ROT,ROW 155 | 5440 DATA RUB,RUE,RUG,RUM,RUN,RUT,RYE 156 | 5450 DATA SAD,SAG,SAP,SAT,SAW,SAY,SET 157 | 5460 DATA SEW,SEX,SHY,SEA,SIN,SHE,SIP 158 | 5470 DATA SIR,SIT,SIX,SKI,SKY,SLY,SOB 159 | 5480 DATA SOD,SON,SOW,SOY,SPA,SPY,STY 160 | 5490 DATA SUE,SUM,SUN,TAB,TAD,TAG,TAN 161 | 5500 DATA TAP,TAX,TAR,TEA,TEN,THE,THY 162 | 5510 DATA TIC,TIE,TIN,TIP,TOE,TON,TOP 163 | 5520 DATA TOW,TOY,TRY,TUB,TUG,TWO,URN 164 | 5530 DATA USE,UPS,VAN,VAT,VEX,VIA,VIE 165 | 5540 DATA VIM,VOW,YAK,YAM,YEN,YES,YET 166 | 5550 DATA YOU,WAD,WAG,WAN,WAR,WAS,WAX 167 | 5560 DATA WAY,WEB,WED,WET,WHO,WHY,WIG 168 | 5570 DATA WIN,WIT,WOE,WON,WRY,ZIP,FIB -------------------------------------------------------------------------------- /samples/sample.keyboard.txt: -------------------------------------------------------------------------------- 1 | 0 text : home : pr#0 2 | 1 c = peek(49152) : poke 49168,0 3 | : htab 1 : vtab 20 : normal 4 | 2 if c >= 128 then c = c - 128 : inverse 5 | 4 y = int(c/16) : x = c - y * 16 6 | : htab x * 2 + 1 : vtab y + 1 7 | 5 if c >= 32 then print chr$(c); 8 | 6 if c < 32 then print chr$(127); 9 | 9 goto 1 10 | -------------------------------------------------------------------------------- /samples/sample.logo.txt: -------------------------------------------------------------------------------- 1 | 10 gr:poke -16302,0 2 | 15 i=0:x1 = 15:x2=1:x3 = 1 3 | 20 for y=7 to 47:i=i-1 : if (i <= 0) then i=7: read c: color=c 4 | 30 if (y < 21) then x1=x1-((21-y)/12) : goto 40 5 | 31 x1 = x1 + x2 - 1: x2 = x2 * x3: x3 = x3 + 0.002 6 | 40 hlin x1,39-x1 at y 7 | 50 next y 8 | 60 data 12,13,9,1,3,6 9 | 70 color=0 10 | 80 hlin 16,22 at 7: hlin 18,20 at 8: hlin 16,22 at 47: hlin 18,20 at 46 11 | 90 vlin 14,34 at 32: vlin 15,33 at 31: vlin 16,32 at 30 12 | 100 vlin 18,30 at 29: vlin 22, 26 at 28 13 | 110 color = 12: for a=0 to 3:vlin a,a+4 at 22-a:next a 14 | -------------------------------------------------------------------------------- /samples/sample.loresdrawing.txt: -------------------------------------------------------------------------------- 1 | 10 TEXT : HOME : REM Clear the screen 2 | 20 VTAB 4 : HTAB 14 : PRINT "LoRes Drawing" 3 | 30 VTAB 10 : HTAB 7 : PRINT "By Gregg Buntin - Dec 2, 2016" 4 | 40 VTAB 12 : HTAB 2 : PRINT "Adapted from ancient code (circa 1985)" 5 | 50 VTAB 19 : PRINT "Do you want instructions?" 6 | 60 GET ANS$ : REM read input 7 | 70 IF ANS$ = "Y" OR ANS$ = "y" THEN 500 8 | 200 X = 1:Y = 1:C = 2 : REM Set x,y and color defaults 9 | 210 TEXT : HOME : GR : REM Clear screen and set graphics mode 10 | 220 MESS$ = "Not Plotting" : GOSUB 800 11 | 230 GOTO 400 : REM Jump to plot current dot then continue 12 | 240 K = PEEK ( - 16384): IF K < 128 THEN 240 : REM Read Keyboard 13 | 250 X1 = X:Y1 = Y: POKE - 16368,0 : REM Save last position 14 | 260 IF K = 155 THEN TEXT : HOME : END : REM Esc 15 | 270 IF K = 136 THEN X = X - 1: IF X < 0 THEN X = 39 : REM Left 16 | 280 IF K = 149 THEN X = X + 1: IF X > 39 THEN X = 0 : REM Right 17 | 290 IF K = 139 THEN Y = Y - 1: IF Y < 0 THEN Y = 39 : REM Up 18 | 300 IF K = 138 THEN Y = Y + 1: IF Y > 39 THEN Y = 0 : REM Down 19 | 310 IF K = 195 THEN VTAB 24: INPUT "COLOR:";C: COLOR= C : HOME : REM Color 20 | 320 IF K = 208 THEN PL = 1 : MESS$ = "Plotting" : REM P (Plot) 21 | 330 IF K = 206 THEN PL = 0 : MESS$ = "Not Plotting" :REM N (No Plot) 22 | 340 IF K = 197 THEN PL = 2 : MESS$ = "Erasing" : REM E (Erase) 23 | 350 IF K = 210 THEN GOSUB 700 : REM R (Reset / Clear) 24 | 360 GOSUB 800 25 | 370 IF PL = 0 THEN COLOR= OC: PLOT X1,Y1 : REM Plot the current position non destuctively 26 | 380 IF PL = 2 THEN COLOR= 0: PLOT X1,Y1 : REM Erase the current positon 27 | 390 OC = SCRN( X,Y) : REM Save current position Color 28 | 400 COLOR= C: PLOT X,Y : REM Plot the current position 29 | 410 GOTO 240 : REM go read another key 30 | 500 TEXT : HOME 31 | 510 PRINT "Arrow keys move up, down, left, right" 32 | 520 PRINT "C key changes color" 33 | 530 PRINT " (valid values are from 0 to 15)" 34 | 540 PRINT "P plot dots (draw)" 35 | 550 PRINT "N No plot dots (don't draw)" 36 | 560 PRINT "E Erase dots" 37 | 570 PRINT "R Reset (clear screen)" 38 | 580 PRINT "Esc Quits" 39 | 590 PRINT : PRINT "Press any key to continue" 40 | 600 GET ANS$ 41 | 610 GOTO 200 42 | 700 VTAB 23 : HTAB 1 : PRINT "Really clear screen?"; : GET ANS$ : IF ANS$ = "Y" OR ANS$ = "y" THEN TEXT : HOME : GR 43 | 710 RETURN 44 | 800 HOME : VTAB 23 : HTAB 1 : PRINT MESS$ : RETURN 45 | 46 | -------------------------------------------------------------------------------- /samples/sample.loreswalk.txt: -------------------------------------------------------------------------------- 1 | 10 GR 2 | 20 X=20: Y=20 3 | 30 C=INT(RND(1)*16) 4 | 40 COLOR=C: PLOT X,Y 5 | 50 IF RND(1)>=.9 THEN C=INT(RND(1)*16) 6 | 60 X = X + INT(RND(1)*3) - 1 7 | 70 Y = Y + INT(RND(1)*3) - 1 8 | 80 IF X > 39 THEN X=0 9 | 90 IF X < 0 THEN X=39 10 | 100 IF Y > 39 THEN Y=0 11 | 110 IF Y < 0 THEN Y=39 12 | 120 GOTO 40 -------------------------------------------------------------------------------- /samples/sample.mandelbrot.txt: -------------------------------------------------------------------------------- 1 | 100 REM Mandelbrot Set in B & W 2 | 110 HGR:POKE 49234,0:HCOLOR=3 3 | 120 FOR x = 0 TO 279:FOR y = 0 TO 95 4 | 130 x1 = x / 280 * 3 - 2:y1 = y / 191 * 2 - 1 5 | 140 i = 0:s = x1:t = y1:c = 0 6 | 150 s1 = s * s - t * t + x1 7 | 160 t = 2 * s * t + y1:s = s1:c = 1 - c:i = i + 1 8 | 170 IF s * s + t * t < 4 AND i < 117 THEN GOTO 150 9 | 180 IF c = 0 THEN HPLOT x,y:HPLOT x,191 - y 10 | 190 NEXT:NEXT -------------------------------------------------------------------------------- /samples/sample.mandelbrot2.txt: -------------------------------------------------------------------------------- 1 | 0 REM Mandelbrot Set - in color 2 | 1 REM This picks random points to draw, so it will run forever 3 | 2 REM and may never fill in the full plane, but it is fast! 4 | 10 HGR : POKE 49234,0 5 | 20 DIM co(10) : FOR c = 0 TO 10 : READ d : co(c) = d : NEXT 6 | 30 DATA 1, 2, 3, 5, 6, 1, 2, 3, 5, 6, 0 7 | 100 x = INT(RND(1) * 280) : y = INT(RND(1) * 96) 8 | 110 x1 = x / 280 * 3 - 2 : y1 = y / 191 * 2 - 1 9 | 120 i = 0:s = x1:t = y1 10 | 130 s1 = s * s - t * t + x1 11 | 140 t = 2 * s * t + y1:s = s1: i = i + 1 12 | 150 IF s * s + t * t < 4 AND i < 20 THEN GOTO 130 13 | 160 c = co(i/2) : IF c THEN HCOLOR= c : HPLOT x,y : HPLOT x,191 - y 14 | 170 GOTO 100 15 | -------------------------------------------------------------------------------- /samples/sample.miniindy.txt: -------------------------------------------------------------------------------- 1 | 10 TEXT : HOME : REM Clear the screen 2 | 20 VTAB 4 : HTAB 15 : PRINT "Mini Indy" 3 | 30 VTAB 10 : HTAB 7 : PRINT "By Gregg Buntin - Dec 2, 2016" 4 | 40 VTAB 12 : HTAB 5 : PRINT "Adapted from an ancient one liner" 5 | 50 VTAB 18 : HTAB 6 : PRINT "Left & Right Arrow Keys move" 6 | 60 VTAB 19 : HTAB 7 : PRINT "any other key goes straight" 7 | 70 VTAB 21 : PRINT "Press any key to play" 8 | 80 GET KEY$ : TEXT : HOME : REM wait for keypress then clear screen and begin 9 | 90 DIM RL(13) : DIM RR(13) : FOR X = 1 TO 13 : RL(X) = 1 : RR(X) = 35 : NEXT : REM Set default road width 10 | 100 REM left & right arrow keys, any other straight 11 | 110 W = (W = 0) * 10 + W - .01 + (W < 0) : REM determine width of road 12 | 120 K = PEEK (49152) : REM read the keyboard 13 | 130 X = X - (K = 136) + (K = 149) + (X = 0) * 10 : REM determine "car" position 14 | 140 L = (L < 4) * 2 + L + SGN ( RND (1) - .5) - (L + W > 30) : REM Determine where road begins 15 | 150 VTAB 23 : HTAB 1 : FOR I = 1 TO L : PRINT "@"; : NEXT : REM Draw left "grass" 16 | 160 RS = L + W + 1 : REM deterine right start position 17 | 170 VTAB 23 : HTAB RS : FOR I = RS TO 34 : PRINT "@"; : NEXT : REM Draw right "grass" 18 | 180 C = 0 : IF X < RL(1) OR X > RR(1) THEN C = 1 : REM check for collision 19 | 190 HTAB (X) : VTAB 10 : PRINT "V" : REM Draw "car" 20 | 200 T = T + 1 : REM Increment score 21 | 210 HTAB 35 : VTAB 24 : PRINT T : REM display score 22 | 220 FOR MY = 2 TO 13 : RL(MY-1) = RL(MY) : RR(MY-1) = RR(MY) : NEXT : REM for collision detection 23 | 230 RL(13) = L : RR(13) = RS : REM newest road position 24 | 240 FOR MY = 1 TO 1000 : NEXT MY : REM Slow the emulator down some 25 | 250 IF C = 0 THEN 100 : REM check if still on the road 26 | 260 HOME : PRINT "YOUR SCORE WAS:"T : REM And you're done 27 | -------------------------------------------------------------------------------- /samples/sample.moire.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8200 HGR 4 | 5 | 8210 W = 279 : H = 159 6 | 8220 FOR I = 0 TO 1 STEP 0.01 7 | 8230 HCOLOR= 1 : HPLOT 0,H * I TO W* (1-I),0 8 | 9 | 8232 HCOLOR= 6 : HPLOT W,H * I TO W * I,0 10 | 8233 HCOLOR= 2 : HPLOT W,H * (1-I) TO W * I,H 11 | 8234 NEXT 12 | 13 | 8310 W = 200 : H = 50 14 | 8320 FOR I = 0 TO 1 STEP 0.01 15 | 8330 HCOLOR= 1 : HPLOT 40,H * I TO W* (1-I),40 16 | 17 | 8332 HCOLOR= 6 : HPLOT W,H * I TO H * I,0 18 | 8333 HCOLOR= 3 : HPLOT W,H * (1-I) TO W * I,H 19 | 8334 NEXT 20 | 21 | 8410 W = 230 : H = 100 22 | 8420 FOR I = 0 TO 1 STEP 0.01 23 | 8230 HCOLOR= 1 : HPLOT 140,H * I TO W* (1-I),140 24 | 25 | 8432 HCOLOR= 6 : HPLOT W,H * I TO W * I,0 26 | 8433 HCOLOR= 3 : HPLOT W,H * (1-I) TO W * I,H 27 | 8434 NEXT 28 | -------------------------------------------------------------------------------- /samples/sample.ninjaturtle.txt: -------------------------------------------------------------------------------- 1 | 5 GR 2 | 6 COLOR= 4 3 | 10 HLIN 9,20 AT 5 4 | 15 HLIN 8,21 AT 6 5 | 20 HLIN 25,26 AT 6 6 | 25 HLIN 7,22 AT 7 7 | 80 PLOT 24,7 8 | 85 PLOT 27,7 9 | 40 HLIN 6,23 AT 8 10 | 45 PLOT 28,8 11 | 50 VLIN 9,16 AT 6 12 | 55 VLIN 9,23 AT 23 13 | 60 PLOT 24,9 14 | 65 PLOT 28,8 15 | 70 PLOT 27,9 16 | 75 HLIN 25,27 AT 10 17 | 80 VLIN 11,12 AT 24 18 | 85 HLIN 26,27 AT 14 19 | 90 PLOT 25,13 20 | 95 PLOT 28,13 21 | 100 PLOT 29,12 22 | 105 PLOT 28,11 23 | 110 VLIN 14,23 AT 24 24 | 115 VLIN 15,22 AT 25 25 | 120 VLIN 16,21 AT 26 26 | 125 VLIN 14,17 AT 22 27 | 130 VLIN 14,16 AT 21 28 | 135 VLIN 14,16 AT 20 29 | 140 VLIN 15,17 AT 19 30 | 145 VLIN 15,18 AT 18 31 | 150 VLIN 15,19 AT 16 32 | 155 VLIN 15,18 AT 17 33 | 160 VLIN 13,19 AT 15 34 | 165 VLIN 13,19 AT 14 35 | 170 VLIN 13,19 AT 13 36 | 175 VLIN 14,19 AT 16 37 | 180 VLIN 18,19 AT 15 38 | 185 VLIN 14,19 AT 12 39 | 190 VLIN 15,18 AT 11 40 | 195 VLIN 15,18 AT 10 41 | 200 VLIN 15,18 AT 9 42 | 205 VLIN 14,17 AT 8 43 | 210 VLIN 14,16 AT 7 44 | 255 VLIN 14,23 AT 5 45 | 260 VLIN 15,22 AT 4 46 | 265 VLIN 16,21 AT 3 47 | 270 VLIN 20,23 AT 6 48 | 275 VLIN 21,23 AT 7 49 | 280 VLIN 20,23 AT 8 50 | 285 VLIN 20,23 AT 9 51 | 290 VLIN 20,22 AT 10 52 | 295 VLIN 20,22 AT 11 53 | 300 VLIN 21,23 AT 12 54 | 305 VLIN 21,23 AT 13 55 | 310 VLIN 21,24 AT 14 56 | 315 VLIN 21,24 AT 15 57 | 320 VLIN 21,23 AT 16 58 | 325 VLIN 20,23 AT 17 59 | 330 VLIN 20,22 AT 18 60 | 335 VLIN 20,22 AT 19 61 | 340 VLIN 20,23 AT 20 62 | 345 VLIN 21,23 AT 21 63 | 350 VLIN 20,23 AT 22 64 | 555 COLOR= 0: VLIN 7,13 AT 6: VLIN 7,13 AT 23 65 | 557 COLOR= 7 66 | 560 PLOT 23,8 67 | 565 PLOT 6,8 68 | 570 HLIN 6,22 AT 9 69 | 575 HLIN 6,8 AT 11 70 | 580 HLIN 6,8 AT 10 71 | 585 HLIN 6,8 AT 12 72 | 590 HLIN 6,12 AT 13 73 | 595 HLIN 11,18 AT 10 74 | 600 HLIN 12,17 AT 11 75 | 605 HLIN 13,16 AT 12 76 | 610 HLIN 17,19 AT 14 77 | 615 HLIN 16,23 AT 13 78 | 620 HLIN 21,24 AT 12 79 | 625 HLIN 21,24 AT 11 80 | 630 HLIN 21,23 AT 10 81 | 635 HLIN 9,11 AT 14 82 | 640 HLIN 25,27 AT 10 83 | 645 HLIN 26,27 AT 14 84 | 650 PLOT 23,9 85 | 655 HLIN 25,26 AT 6 86 | 660 COLOR= 15 87 | 665 PLOT 10,11 88 | 670 PLOT 19,11 89 | 675 COLOR= 7 90 | 680 PLOT 24,7 91 | 685 PLOT 27,7 92 | 690 PLOT 28,8 93 | 695 PLOT 27,9 94 | 700 PLOT 24,9 95 | 705 PLOT 28,11 96 | 720 PLOT 25,13 97 | 725 PLOT 28,13 98 | 730 PLOT 29,12 99 | 735 COLOR= 15 100 | 740 HLIN 6,7 AT 17 101 | 745 HLIN 6,8 AT 18 102 | 750 HLIN 6,11 AT 19 103 | 755 PLOT 7,20 104 | 760 HLIN 12,16 AT 20 105 | 765 HLIN 17,22 AT 19 106 | 770 HLIN 19,22 AT 18 107 | 775 HLIN 20,21 AT 17 108 | 780 PLOT 21,20 109 | 785 COLOR= 0 110 | 790 HLIN 16,20 AT 12 111 | 795 VLIN 10,11 AT 20 112 | 800 PLOT 19,10 113 | 805 PLOT 18,11 114 | 810 HLIN 9,12 AT 12 115 | 815 VLIN 10,11 AT 9 116 | 820 PLOT 11,11 117 | 825 PLOT 10,10 118 | 830 COLOR= 7 119 | 835 PLOT 16,12 120 | 840 COLOR= 0 121 | 845 VLIN 17,20 AT 21 122 | 850 VLIN 18,19 AT 19 123 | 855 PLOT 17,19 124 | 860 PLOT 15,20 125 | 865 PLOT 13,20 126 | 870 PLOT 11,19 127 | 875 PLOT 9,19 128 | 880 VLIN 17,20 AT 7 129 | 885 COLOR= 7 130 | 890 HLIN 25,26 AT 7 131 | 895 HLIN 24,27 AT 8 132 | 900 HLIN 25,26 AT 9 133 | 905 HLIN 25,27 AT 11 134 | 910 HLIN 25,28 AT 12 135 | 915 HLIN 26,27 AT 13 136 | 920 COLOR= 0 137 | 930 PLOT 10,11 138 | 940 PLOT 19,11 139 | 950 COLOR= 15 140 | 960 HLIN 9,12 AT 12 141 | 970 HLIN 17,20 AT 12 142 | 980 HLIN 9,10 AT 10 143 | 990 HLIN 19,20 AT 10 144 | 1000 PLOT 9,11 145 | 1010 PLOT 11,11 146 | 1020 PLOT 18,11 147 | 1030 PLOT 20,11 148 | 1040 REM EUGENE WHONG MADE ALL THE PROGRAM CHANGES 149 | -------------------------------------------------------------------------------- /samples/sample.onelinetrain.txt: -------------------------------------------------------------------------------- 1 | 1 HOME:FORG=1TO6:READG$(G):NEXT:FORQ=1TO16:FORI=1TO40:FORG=1TO6:VTABG+Q:HTABI:PRINTG$(G):NEXT:K=PEEK(49200):VTAB1:HTAB12:?"CHUGGA CHUGGA":NEXT:VTAB1:HTAB12:?" TOOT TOOT ":?CHR$(7):FORJ=1TO150:NEXT:?CHR$(7):NEXT 2 | 2 DATA " ( @"," /-\ @"," ! ( !-I!"," NIBBLE \_/ !:O!"," ------ ---- !--!\"," 0-00-0 0--0 0--0_\" -------------------------------------------------------------------------------- /samples/sample.paint.txt: -------------------------------------------------------------------------------- 1 | 0 REM *** Drawing program using mixed 280x160 mode *** 2 | 10 LX = 0 : LY = 0 : PEN = 3 : GOSUB 100 3 | 20 GOSUB 300 4 | 30 VTAB 21 : HTAB 70 : PRINT "("X","Y") " 5 | 40 IF X <> LX OR Y <> LY THEN HPLOT TO X, Y : LX = X : LY = Y 6 | 50 A = PEEK(49152)-128 : IF A > 0 THEN A$ = CHR$(A) : POKE 49168,0 7 | 60 IF A$ >= "1" AND A$ <= "6" THEN PEN = ASC(A$) - ASC("0") : GOSUB 200 8 | 70 IF A$ = " " THEN GOSUB 100 9 | 80 IF A$ = CHR$(27) THEN END 10 | 90 A$ = CHR$(0) : GOTO 20 11 | 100 REM ** Show Menu ** 12 | 110 PR#3 : HOME : HGR : HCOLOR= 3 : FOR Y = 150 TO 160 : HPLOT 0,Y TO 279,Y : NEXT Y 13 | 120 FOR HC = 1 TO 6 : HCOLOR= HC 14 | 130 FOR Y = 152 TO 159 : HPLOT 10+14*HC,Y TO 23+14*HC,Y : NEXT Y 15 | 140 NEXT HC 16 | 150 VTAB 21 : PRINT "COLOR: 1 2 3 4 5 6"; 17 | 160 HTAB 60 : PRINT "POSITION:" : FOR N = 1 TO 8 : PRINT "=========="; : NEXT N 18 | 170 PRINT "Instructions: Joystick draws. 1-6 chooses colors. Space clears. Esc quits."; 19 | 200 HCOLOR= PEN : FOR Y = 154 TO 157 : HPLOT 5,Y TO 15,Y : NEXT Y 20 | 210 GOSUB 300 : HPLOT X, Y : RETURN 21 | 22 | 300 X = INT(PDL(0)/255*279) : Y = INT(PDL(1)/255*191) : IF Y > 149 THEN Y = 149 23 | 310 RETURN 24 | -------------------------------------------------------------------------------- /samples/sample.piglatin.txt: -------------------------------------------------------------------------------- 1 | 10 REM PIG LATIN TRANSLATOR 2 | 3 | 20 REM BY Gregg Buntin 4 | 5 | 30 REM OCT. 10, 1984 6 | 7 | 40 GOTO 140 8 | 9 | 50 REM THINGS TO WATCH FOR 10 | 11 | 60 CK$ = " .,;:> 141 THEN 290 58 | 59 | 300 POKE - 16368,0 60 | 61 | 310 REM GET SENTENCE 62 | 63 | 320 HOME : VTAB 10 64 | 65 | 330 PRINT : PRINT : PRINT 66 | 67 | 340 INPUT "ENGLISH SENTENCE :";ES$ 68 | 69 | 350 IF ES$ = "" THEN 320 70 | 71 | 360 GOSUB 60 72 | 73 | 370 REM ARE THEY DONE? 74 | 75 | 380 IF ES$ = "FINISHED" THEN TEXT : HOME :A$ = "ATSTHA ALLA OLKSFA": GOSUB 120:A$ = "(THATS ALL FOLKS)": GOSUB 120: END 76 | 77 | 390 REM TRANSLATE THE SENTENCE 78 | 79 | 400 PRINT : PRINT : PRINT 80 | 81 | 410 HOME : FLASH :A$ = "TRANSLATING": VTAB 6: GOSUB 120: NORMAL 82 | 83 | 420 REM ISOLATE WORDS & GARBAGE 84 | 85 | 430 X = 1: FOR I = 1 TO LEN (ES$) 86 | 87 | 440 Q$ = MID$ (ES$,I,1): FOR J = 1 TO LEN (CK$): IF Q$ = MID$ (CK$,J,1) THEN X = X + 1:X$(X) = Q$: GOTO 460 88 | 89 | 450 GOTO 480 90 | 91 | 460 IF X$(X) = " " THEN X = X + 1 92 | 93 | 470 GOTO 500 94 | 95 | 480 NEXT J 96 | 97 | 490 X$(X) = X$(X) + Q$ 98 | 99 | 500 NEXT I 100 | 101 | 510 REM CONVERT TO PIG LATIN 102 | 103 | 520 FOR I = 1 TO X: IF LEN (X$(I)) < 3 THEN 610 104 | 105 | 530 FOR J = 1 TO LEN (X$(I)): FOR K = 1 TO LEN (CV$) 106 | 107 | 540 IF MID$ (X$(I),J,1) = MID$ (CV$,K,1) THEN 560 108 | 109 | 550 NEXT K,J 110 | 111 | 560 IF J = 1 THEN X$(I) = X$(I) + "A": GOTO 610 112 | 113 | 570 IF J - 1 = > LEN (X$(I)) THEN X$(I) = X$(I) + "A": GOTO 610 114 | 115 | 580 T$ = LEFT$ (X$(I),J - 1) 116 | 117 | 590 T$ = RIGHT$ (X$(I), LEN (X$(I)) - (J - 1)) + T$ + "A" 118 | 119 | 600 X$(I) = T$ 120 | 121 | 610 NEXT I 122 | 123 | 620 REM PRINT OUT RESULT 124 | 125 | 630 HOME : VTAB 6: PRINT "YOUR SENTENCE:": PRINT : PRINT ES$ 126 | 127 | 640 PRINT : INVERSE : PRINT "PIG LATIN TRANSLATION:": NORMAL : PRINT : FOR I = 1 TO X: PRINT X$(I);: NEXT 128 | 129 | 650 REM GET SET FOR MORE 130 | 131 | 660 PRINT : PRINT : PRINT 132 | 133 | 670 VTAB 20:A$ = "PRESS RETURN TO CONTINUE": GOSUB 120 134 | 135 | 680 K = PEEK ( - 16384): IF K < > 141 THEN 680 136 | 137 | 690 POKE - 16368,0: CLEAR : PRINT : PRINT : PRINT : GOTO 320 138 | 139 | -------------------------------------------------------------------------------- /samples/sample.pretzel.txt: -------------------------------------------------------------------------------- 1 | 0 GR:y=10:x=0 2 | 6 COLOR = int(RND(1) * 6) + 2 3 | 7 sp = int(20 + (10* sin(x* 3.14159 / 180 ) )) / 2 4 | 8 y=y + 1: IF y > 25 then y = 10 5 | 10 PLOT y,sp:x=x + 15:goto 6 6 | -------------------------------------------------------------------------------- /samples/sample.primecheck.txt: -------------------------------------------------------------------------------- 1 | 990 print "ENTER A NUMBER AND SEE IF IT'S PRIME" 2 | 1000 input n 3 | 1002 if n<>int(n) then print "ENTER AN INTEGER":GOTO 1000 4 | 1004 if n<2 then print "ENTER AN INTEGER GREATER THAN 1":GOTO 1000 5 | 1010 for d=2 to n-1 6 | 1020 if n/d = int(n/d) then print "NOT PRIME; MULTIPLE OF "; d:GOTO 1000 7 | 1030 next d 8 | 1040 print n; " IS PRIME" 9 | 1050 goto 1000 10 | -------------------------------------------------------------------------------- /samples/sample.primes.txt: -------------------------------------------------------------------------------- 1 | 10 text : home 2 | 20 print "Prime numbers" 3 | 30 print " "; 4 | 40 for x = 1 to 1000 5 | 50 gosub 1000 6 | 60 if p == 1 then print x;" "; 7 | 70 next 8 | 80 print 9 | 90 end 10 | 1000 rem ** subroutine to check for prime ** 11 | 1010 rem number to be checked is stored in x 12 | 1020 rem d is used for divisor 13 | 1030 rem q is used for quotient 14 | 1040 rem p is used for return value, if x is prime, p will be 1, else 0 15 | 1050 p = 0 16 | 1060 if x < 2 OR x <> int(x) goto 1180 17 | 1070 if x == 2 OR x == 3 OR x == 5 then p=1 : goto 1180 18 | 1080 if x/2 == int(x/2) goto 1180 19 | 1090 if x/3 == int(x/3) goto 1180 20 | 1100 d = 5 21 | 1110 q = x/d : if q == int(q) goto 1180 22 | 1120 d = d + 2 23 | 1130 if d*d> x goto 1170 24 | 1140 q = x/d : if q == int(q) goto 1180 25 | 1150 d = d + 4 26 | 1160 if d*d <= x goto 1110 27 | 1170 p = 1 28 | 1180 return 29 | 1190 rem ** end of subroutine to check for prime ** 30 | -------------------------------------------------------------------------------- /samples/sample.protonelectron.txt: -------------------------------------------------------------------------------- 1 | 101 count = 0 2 | 105 for i = 0 to 20 3 | 106 print 4 | 107 next i 5 | 110 Dim x2(7),sign(7), dx(7) 6 | 120 Rem Init some vars 7 | 125 aminerr=1000 8 | 130 rem res = 8.5e-17 9 | 132 res = 1e-4 10 | 200 xpi=3.14159265358979323846 11 | 250 rem 8 coefs here 12 | 255 Rem elementary charge (e)-0 13 | 260 x2(0)=1.60217662e-19 14 | 265 Rem Planck's constant (h)-1 15 | 300 x2(1)=6.62607004e-34 16 | 350 rem eletron mass (Me)-2 17 | 400 x2(2)=9.109383560899034e-31 18 | 450 Rem Proton radius (Rp)-3 19 | 500 x2(3)=8.41235640479985e-16 20 | 550 Rem Rydberg Constant (R_H or R_{\infty})-4 21 | 600 x2(4)=10973731.5685083 22 | 610 Rem Permittivity of free space (e0)-5 23 | 620 x2(5)=8.854187817e-12 24 | 701 Rem Speed of Light (c)-6 25 | 702 x2(6)=299792458.0 26 | 703 Rem Proton mass (Mp)-7 27 | 704 x2(7)=1.672621898209999e-27 28 | 710 For i = 0 to 6 29 | 720 sign(i)=0 30 | 730 dx(i) = 0.01*res*(x2(i)) 31 | 740 next i 32 | 750 Rem define bit to be twiddled here 33 | 755 sign(0)=1 34 | 760 sign(1)=1 35 | 770 sign(2)=1 36 | 780 sign(3)=1 37 | 790 sign(4)=1 38 | 795 sign(5)=1 39 | 797 sign(6)=1 40 | 1000 rem starting error 41 | 1010 xerr1=x2(2)*x2(0)^4/(8*x2(6)*x2(5)^2*x2(1)^3*x2(4)) 42 | 1015 yerr2=-xpi*x2(3)*x2(6)*x2(2)/(2*x2(1)) 43 | 1017 err = xerr1 + yerr2 - 1.0 44 | 1020 digits=int(-log(abs(yerr+0.00001))/log(10)+0.5) 45 | 1030 Print "Starting err is: ";err 46 | 1032 Print "Starting xerr1 is: ";xerr1 47 | 1034 Print "Starting yerr2 is: ";yerr2 48 | 1040 print "Digits resolution ";digits 49 | 1050 print "aminerr error is: ";aminerr 50 | 1060 for i = 0 to 6 51 | 1061 print "i= ";i, x2(i) 52 | 1062 next i 53 | 1100 print "pi= ";xpi 54 | 1111 rem end 55 | 2000 Rem Main Loop 56 | 2010 For i = 0 to 6 57 | 2020 x2(i)=x2(i)+sign(i)*dx(i) 58 | 2030 xerr1=x2(2)*x2(0)^4/(8*x2(6)*x2(5)^2*x2(1)^3*x2(4)) 59 | 2032 yerr2=-xpi*x2(3)*x2(6)*x2(2)/(2*x2(1))-1.0 60 | 2034 err=abs(xerr1+yerr2) 61 | 2035 if err>aminerr then sign(i)=-1*sign(i) 62 | 2037 if err xresstop then res = res/10.0 71 | 5010 For i = 0 to 6 72 | 5030 dx(i) = 0.01*res*(x2(i)) 73 | 5040 next i 74 | 5100 if res > xresstop then goto 2000 75 | 5106 Print "Done." 76 | 5107 print "Coef " 77 | 5109 for i = 0 to 7 78 | 5110 print x2(i);" " 79 | 5120 next i 80 | 6000 rem Final error 81 | 6010 xerr1=(x2(2)*x2(0)^4)/(8*x2(6)*x2(5)^2*x2(1)^3*x2(4)) 82 | 6012 yerr2=-xpi*x2(3)*x2(6)*x2(2)/(2*x2(1)) - 1.0 83 | 6014 err=abs(xerr1+yerr2) 84 | 6020 digits=int(-log(abs(err+1e-16))/log(10)+0.5) 85 | 6030 Print "Starting err is: ";err 86 | 6040 print "Digits resolution ";digits 87 | 6050 print "Final error is: ";aminerr 88 | 6060 print "Iterations= ";count 89 | 6070 print xpi;" <-ideal" 90 | 6080 print xpi+err;" <-calc'd 91 | 6085 print "Calc'd proton mass= ";2*x2(1)/(xpi*x2(3)*x2(6)) 92 | 6087 print "Input proton mass= ";x2(7) 93 | 6090 print "Proton/electron mass ratio=";x2(7)/x2(2) 94 | 6100 end 95 | -------------------------------------------------------------------------------- /samples/sample.puzzler.txt: -------------------------------------------------------------------------------- 1 | 0 PR#0 2 | 10 DEF FN R(X) = INT ( RND (1) * X) + 1: DEF FN M4(Y) = Y - INT (Y / 4) * 4: DIM NU(16) 3 | 15 R$ = "4567RTYUFGHJVBNM":P$ = "ABCD..........N...IJK.L..PO...E.FHM..G" 4 | 20 POKE - 16368,0 5 | 30 TEXT : HOME : VTAB 4: HTAB 14: PRINT "THE PUZZLER" 6 | 40 VTAB 15: HTAB 12: PRINT "by Gregg Buntin" 7 | 50 FOR I = 1 TO 2000: NEXT I 8 | 60 VTAB 20: PRINT "Do you wish instructions";: INPUT I$ 9 | 70 IF LEFT$ (I$,1) < > "Y" THEN 190 10 | 80 HOME : VTAB 2: HTAB 14: PRINT "THE PUZZLER" 11 | 90 VTAB 4: PRINT "The object of this game is to get all ofthe numbers in order from 1 to 15." 12 | 100 PRINT : PRINT "The basic command keys are:";: HTAB 36: INVERSE : PRINT "A": NORMAL : HTAB 36: PRINT ":": HTAB 36: PRINT ":" 13 | 110 HTAB 33: INVERSE : PRINT "<-";: NORMAL : PRINT " + ";: INVERSE : PRINT "->";: NORMAL : PRINT 14 | 120 PRINT "By means of these keys you" TAB( 36) ":": PRINT "will exchange the blank" TAB( 36) ":" 15 | 130 PRINT "space with the number in the";: INVERSE : HTAB 36: PRINT "Z": NORMAL 16 | 140 PRINT "up,down,left or right positions." 17 | 145 PRINT : PRINT : PRINT "Alternatively, use the [mouse] and [END]key, or any highlighted key in the" 18 | 148 PRINT "displayed diagram, to move up to ALL thetiles in a row or column at once!" 19 | 150 VTAB 24: PRINT SPC( 7)"Press to start game"; 20 | 160 K = PEEK ( - 16384): IF K < > 155 THEN 160 21 | 190 POKE - 16368,0: HOME : VTAB 4: HTAB 14: PRINT "THE PUZZLER": VTAB 12 22 | 200 PRINT "Type N to start a (N)EW GAME" 23 | 220 K = PEEK ( - 16384): IF K = 155 GOTO 480 24 | 230 ON K < > 206 GOTO 220: POKE - 16368,0 25 | 260 HOME : PRINT "SCRAMBLING PUZZLE.............." 26 | 262 I = RND ( - PEEK (79) * 999 - PEEK (78)): REM RANDOM SEED 27 | 265 FOR I = 1 TO 16:NU(I) = I: NEXT 28 | 270 FOR I = 1 TO 40:Q = FN R(15) 29 | 280 K = FN R(14):K = (K > = Q) + K 30 | 290 X = NU(Q):NU(Q) = NU(K):NU(K) = X: NEXT 31 | 292 A = FN R(16):Y = 16: X = 4: ON A < 13 GOSUB 580 32 | 295 X = 1: ON A < Y GOSUB 580 33 | 300 TEXT : HOME : GR : COLOR= 12 34 | 310 FOR I = 0 TO 18: Q = 38 - I: HLIN I,Q AT I: HLIN I,Q AT Q 35 | 320 VLIN I,Q AT I: VLIN I,Q AT Q: NEXT : PLOT 19,19 36 | 330 COLOR= 1: FOR I = 9 TO 29 STEP 10: HLIN 0,38 AT I: VLIN 0,38 AT I: NEXT 37 | 350 FOR PL = 1 TO 16: GOSUB 380: REM DISPLAY WHOLE GRID 38 | 360 NEXT :PL = A: PRINT "At any time,": PRINT "press ": PRINT "to exit.": GOTO 440 39 | 365 REM 370-430, 840-930 - ROUTINE TO DISPLAY NUMBERS 40 | 370 COLOR= 12: GOTO 390 41 | 380 COLOR= 2 42 | 390 IF NU(PL) = 16 THEN RETURN 43 | 400 Q = PL - 1: GOSUB 600 44 | 410 Q = NU(PL) > 9: ON Q GOSUB 870 45 | 420 X = Q * 2 + X + 2 46 | 430 Q = NU(PL) - Q * 10: ON Q + 1 GOTO 840,870,880,850,890,900,910,920,840,930 47 | 435 REM DISPLAY ACTIVE-KEY GRID 48 | 440 VTAB 21: GOSUB 825: I = I + 1: FOR Y = 0 TO 3: IF Y THEN PRINT 49 | 450 HTAB 17: FOR X = 1 TO 4: K = (X = I) + (Y = Q): IF K THEN INVERSE 50 | 460 PRINT MID$ (R$,Y * 4 + X,K < 2);: NORMAL : PRINT TAB( X * 2 + 17): NEXT : NEXT 51 | 465 REM GET KEY, MOVE TILE TO EMPTY SPACE 52 | 470 K = ( PEEK (49250) > 127) * 301 + PEEK ( - 16384): IF K < 128 THEN 470 53 | 480 POKE - 16368,0 54 | 490 IF K = 155 THEN TEXT : HOME : PRINT "BYE-BYE": END 55 | 500 IF K > 300 GOTO 610: REM "BUTTON" ([END] KEY) PRESSED 56 | 510 IF K > 179 AND K < 218 THEN Q = ASC ( MID$ (P$,K - 179,1)) - 65: IF Q > = O THEN GOSUB 600: GOTO 630 57 | 520 K = INT ((K = 193 OR K = 218 OR K = 136 OR K = 149) * K / 7) 58 | 530 IF NOT K GOTO 470 59 | 540 I = K < 22:A = (K - 29) * 2 60 | 550 IF K < 20 = FN M4(PL) AND I OR (A + 8.5 - PL) * A * NOT I < 0 GOTO 470 61 | 560 IF I THEN A = K - 20 62 | 570 GOSUB 770: GOTO 810 63 | 580 FOR Y = Y TO A + X STEP -X:NU(Y) = NU(Y - X): NEXT : NU(Y) = 16: RETURN 64 | 600 GOSUB 830:X = I * 10 + 1:Y = Q * 10 + 2: RETURN 65 | 605 REM HANDLE "JOYSTICK" (MOUSE) AND MULTIPLE TILES 66 | 606 REM INTERPRET TRUE MOUSE POSITION (PC) BASED ON ITS CURSOR 67 | 610 X = PDL (0) / 6.4: Y = PDL(1) * .1875: K = SCRN (X,Y) 68 | 620 IF K < > 2 AND K < > 12 OR Y > 38 GOTO 470 69 | 630 GOSUB 825: X = INT (X / 10) - I 70 | 640 Y = INT (Y / 10) - Q 71 | 650 IF NOT X = NOT Y GOTO 470 72 | 660 A = SGN(Y) * 4 + SGN (X): FOR K = 1 TO ABS (X + Y): GOSUB 770: NEXT 73 | 670 ON PEEK (49250) > 127 GOTO 670: GOTO 810 74 | 770 PL = PL + A: GOSUB 370 75 | 780 NU(PL - A) = NU(PL):NU(PL) = 16:PL = PL - A 76 | 790 GOSUB 380:PL = PL + A: RETURN 77 | 800 REM TEST FOR SOLVED PUZZLE 78 | 810 Q = 0: FOR I = 1 TO 16: Q = NU(I) < > I OR Q: NEXT : IF Q GOTO 440 79 | 820 HOME : PRINT "CONGRATULATIONS!": PRINT : GOTO 200 80 | 825 Q = PL - 1 81 | 830 I = FN M4(Q):Q = INT (Q / 4): RETURN 82 | 840 VLIN Y,Y + 4 AT X 83 | 850 IF Q THEN PLOT X + 1,Y + 2 84 | 860 HLIN X,X + 1 AT Y: HLIN X,X + 2 AT Y + 5: VLIN Y,Y + 4 AT X + 2: RETURN 85 | 870 VLIN Y,Y + 5 AT X + 1: PLOT X,Y + 1: HLIN X,X + 2 AT Y + 5: RETURN 86 | 880 HLIN X,X + 2 AT Y: VLIN Y,Y + 2 AT X + 2: PLOT X + 1,Y + 2: VLIN Y + 3,Y + 5 AT X: HLIN X,X + 2 AT Y + 5: RETURN 87 | 890 VLIN Y,Y + 5 AT X + 2: VLIN Y,Y + 3 AT X: PLOT X + 1,Y + 3: RETURN 88 | 900 HLIN X,X + 2 AT Y: VLIN Y,Y + 2 AT X: PLOT X + 1,Y + 2: VLIN Y + 3,Y + 4 AT X + 2: HLIN X,X + 1 AT Y + 5: RETURN 89 | 910 VLIN Y + 1,Y + 5 AT X: HLIN X + 1,X + 2 AT Y: VLIN Y + 2,Y + 5 AT X + 2: PLOT X + 1,Y + 2: PLOT X + 1,Y + 5: RETURN 90 | 920 HLIN X,X + 2 AT Y: VLIN Y,Y + 5 AT X + 2: RETURN 91 | 930 VLIN Y,Y + 5 AT X + 2: VLIN Y,Y + 2 AT X: PLOT X + 1,Y: PLOT X + 1,Y + 2: HLIN X,X + 1 AT Y + 5: RETURN -------------------------------------------------------------------------------- /samples/sample.quine.txt: -------------------------------------------------------------------------------- 1 | 5 REM QUINE program 2 | 10 FOR i = 5 TO 55 STEP 5 3 | 15 READ a$ 4 | 20 PRINT a$ 5 | 25 NEXT i 6 | 30 RESTORE 7 | 35 FOR i = 105 TO 155 STEP 5 8 | 40 READ a$ 9 | 45 PRINT i; " DATA "; a$ 10 | 50 NEXT i 11 | 55 PRINT 12 | 105 DATA 5 REM QUINE program 13 | 110 DATA 10 FOR i = 5 TO 55 STEP 5 14 | 115 DATA 15 READ a$ 15 | 120 DATA 20 PRINT a$ 16 | 125 DATA 25 NEXT i 17 | 130 DATA 30 RESTORE 18 | 135 DATA 35 FOR i = 105 TO 155 STEP 5 19 | 140 DATA 40 READ a$ 20 | 145 DATA 45 PRINT i; " DATA "; a$ 21 | 150 DATA 50 NEXT i 22 | 155 DATA 55 PRINT -------------------------------------------------------------------------------- /samples/sample.radar.txt: -------------------------------------------------------------------------------- 1 | 10 HGR2 2 | 13 R = 4.76 3 | 15 HCOLOR= 3 4 | 20 GOSUB 300 5 | 25 HCOLOR= 3 6 | 30 LX = 140 + 93 * COS (R) 7 | 40 LY = 96 + 93 * SIN (R) 8 | 45 HCOLOR= 3 9 | 48 GOSUB 200 10 | 49 FOR W = 1 TO 100 11 | 50 NEXT W 12 | 51 R = R + 0.02 13 | 52 SX = 140 + 93 * COS (R) 14 | 53 SY = 96 + 93 * SIN (R) 15 | 55 HCOLOR = 0 16 | 57 GOSUB 200 17 | 60 LX = SX 18 | 65 LY = SY 19 | 70 GOTO 45 20 | 200 HPLOT 140,96 TO LX,LY 21 | 210 RETURN 22 | 300 FOR D = 1 TO 30 23 | 310 CX = 140 + 95 * COS (C) 24 | 320 CY = 96 + 95 * SIN (C) 25 | 330 HPLOT CX,CY 26 | 335 C = C + 0.21 27 | 336 FOR Q = 1 TO 100 28 | 337 NEXT Q 29 | 340 NEXT D 30 | 350 RETURN -------------------------------------------------------------------------------- /samples/sample.raindrops.txt: -------------------------------------------------------------------------------- 1 | 0 REM Nicdem25's awesome game 2 | 100 REM Catch the raindrop 3 | 101 rem Game design by Nicholas Merchant, age 10 4 | 102 rem Programming mostly by his dad with Nicholas 5 | 103 rem version 1.7, August 2011 6 | 111 PR# 0:TEXT: home 7 | 8 | 9 | 115 print " Nicdem25games":?:?" CATCH THE RAINDROP":? 10 | 116 print " Version 1.7":? " August 2011":? 11 | 117 rem print " Programmed by JRM":? 12 | 118 rem print " Concept by Nicholas Merchant" 13 | 14 | 121 ?:?"Game controls: ":? 15 | 122 ?" Left arrow (move left)" 16 | 123 ?" Right arrow (move right)":?" Down arrow (stop movement)" 17 | 124 ?" (pause game) 18 | 125 ?" Q (quit)." 19 | 126 ? 20 | 21 | 130 ?"Powerdrops:" 22 | 131 ?" + = extra life" 23 | 132 ?" E = expanded paddle":REM WAS NOT LISTED BECAUSE DISABLED 24 | 133 ?" $ = 10 points" 25 | 134 ?" s = slow down" 26 | 140 ?: Input "Press to begin.";A$ 27 | 28 | 150 home:a = RND (-PEEK(79)*999 - PEEK(78)):REM RESEED RANDOM NUMBER AT START OF GAME 29 | 151 let level = 1:score = 0 30 | 152 let lives = 4:REM RENUMBER lives 4 TO 1 INSTEAD OF 3 TO 0 31 | 155 let D$="*": rem default raindrop character 32 | 156 let pwl = 2:pdec = 0: rem length of paddle expansion when "E" powerup is caught 33 | 34 | 170 let bottomofscreen = 17: rem variable for how far the rain falls 35 | 180 let sp = 2000: rem sp is the variable that controls speed of rain 36 | 182 REM draw the bottom of screen 37 | 184 vtab bottomofscreen +1:for a = 1 to 40:?"^";:next a 38 | 186 vtab bottomofscreen +3:?" Nicdem25: Catch the raindrop" 39 | 188 vtab 23:print "Score: "score" Level: "level" Lives: "lives; 40 | 41 | 42 | 191 REM Initial paddle position variable: p1 is the horizontal offset 43 | 192 REM PL is the paddle length in characters 44 | 193 let p1 = 18 45 | 194 let oldpos = p1 46 | 195 let PL = 10:let OPL = PL: rem OPL is the original paddle length 47 | 48 | 49 | 200 REM ++++++++++++++++++++++++++++ 50 | 201 rem subroutine: falling raindrop 51 | 202 rem ++++++++++++++++++++++++++++ 52 | 53 | 220 REM LINES 135, 230, 316-317, 400-410, 515-600, 1212-1550 DELETED 54 | 55 | 240 let x = int(rnd(1)*31)+5:REM OLD MULTIPLIER 30 MADE x=35 IMPOSSIBLE 56 | 241 rem assign a random x axis value for drop, 5<=x<=35 57 | 58 | 250 for y = 1 to bottomofscreen - 1 59 | 260 htab x: vtab y + 1 60 | 270 print D$;:rem draw drop at position 61 | 62 | 271 rem delay loop controls speed: speed increases with level up to max 63 | 275 for n = 1 to sp: next n 64 | 65 | 276 gosub 900: rem do paddle subroutine 66 | 67 | 278 htab x: vtab y + 1: ?" ":rem erase old drop 68 | 279 next y 69 | 70 | 71 | 280 REM did you catch the raindrop? 72 | 284 rem missed the drop 73 | 285 if x < p1 or x > p1+PL then lives = lives -1:goto 340 74 | 75 | 290 rem caught the drop 76 | 291 print chr$(7): REM make a sound for catching the drop 77 | 292 let score = score + 1 78 | 293 if D$ = "+" then let lives = lives + 1 79 | 294 if D$ = "E" then gosub 2000: rem expand paddle, set power timer 80 | 295 if D$ = "s" then let sp=sp+350: rem s slows down drops 81 | 296 if D$ = "$" then let score = score + 9: if score/10 <> int(score/10) then let level = level + 1 82 | 83 | 84 | 300 rem check if score is a multiple of 10: if so, level up 85 | 303 if score/10 = int(score/10) then let level = level + 1:let counter=1 86 | 87 | 304 rem every five levels, add a life 88 | 305 if counter =1 and level/5 = int(level/5) then let counter=0:gosub 700 89 | 90 | 309 rem speed up if score is a multiple of 10 91 | 310 if score/10 = int(score/10) then gosub 800 92 | 93 | 314 rem powertime counter: expanded paddle length lasts five raindrops 94 | 315 if ptime then ptime = ptime - pdec: if ptime < pdec then VTAB bott:HTAB p1:?SPC(1):HTAB p1 + PL:?" ":p1 = p1 + 1:PL = PL - pwl:pdec = pdec - 6 ^ ((PL - OPL) / pwl) 95 | 96 | 340 vtab 23 97 | 350 print "Score: "score" Level: "level" Lives: "lives" "; 98 | 99 | 360 if NOT lives goto 9000:rem lost last life: go to end routine 100 | 101 | 420 let n = INT(RND(1)*10+.5):REM CONVERT RANDOM NUMBER TO INTEGERS 0-10 (NEW LINE #420 FROM #511) 102 | 425 REM OLD LOGIC EXCLUDED "E" EXPANSION POWER-UP OWING TO BUGS THEREWITH (NOW FIXED) 103 | 430 powerup = (n < (sp < 990) + 4) * n + NOT n:REM NEW IN-LINE FORMULATION, INCLUDING powerup FOR "E", "SLOW DOWN" ONLY WHEN FAST 104 | 440 D$ = MID$("*+$Es",powerup + 1,1):GOTO 200:REM SET CHAR FROM STRING, GO BACK TO START NEW RAINDROP 105 | 106 | 107 | 700 rem ++++++ 108 | 710 rem lives up subroutine 109 | 720 rem ++++++ 110 | 730 if (int(score/10)+1)/5 = (int(int(score/10)+1))/5 then let lives = lives +2 111 | 750 return 112 | 113 | 114 | 800 rem +++++++ 115 | 810 rem speed up subroutine 116 | 820 rem ++++++ 117 | 850 let sp = sp - ((level-1)*100) 118 | 855 if sp < 400 then let sp = 400 119 | 890 return 120 | 121 | 122 | 900 REM ++++++++++++++++ 123 | 901 REM GET PLAYER INPUT 124 | 902 REM ++++++++++++++++ 125 | 903 IF PEEK (49152) > 127 THEN K$=CHR$(PEEK (49152)-128): REM SEE IF KEY(S) PRESSED 126 | 904 IF K$ = "Q" THEN goto 9000 127 | 905 if K$ = " " then gosub 5000 128 | 924 let oldpos = p1 129 | 935 if K$ = CHR$(8) then let p1 = p1 - 1 130 | 946 if K$ = CHR$(21) then let p1 = p1 + 1 131 | 950 if p1 < 1 then let p1 = 1 132 | 965 if p1 > 40-PL then let p1 = 40-PL 133 | 979 POKE 49168,0: REM reset keyboard input address (clear keyboard strobe) 134 | 135 | 999 REM +++++++++++ 136 | 1000 REM Draw paddle 137 | 1001 rem +++++++++++ 138 | 139 | 1200 vtab bottomofscreen: b = oldpos < p1:htab p1 - b:?SPC(b) 140 | 1205 for b = 0 to PL:?"-"; 141 | 1210 next b:?SPC(oldpos > p1):RETURN 142 | 143 | 144 | 2000 REM increase paddle length; set power timer to five drops 145 | 2010 let PL=PL+pwl 146 | 2020 let ptime = ptime * 6 + 5:pdec = 6 ^ ((PL - OPL) / pwl - 1) + pdec:REM HANDLE MULTIPLE EXPANSION 147 | 2025 p1 = p1 - (p1 > 1) - (p1 + PL = 40):REM REPOSITION PADDLE LEFTWARD AS NEEDED 148 | 2030 return 149 | 150 | 5000 rem pause 151 | 5010 htab 4:vtab 4:input "Paused: press to resume";K$ 152 | 5020 htab 4:vtab 4: CALL -868:?:REM ERASE PAUSE-MESSAGE LINE 153 | 5040 let K$ = "" 154 | 5050 return 155 | 156 | 9000 vtab 11:htab 16:print "GAME OVER":? 157 | 9010 print " Play again (Y/N)?" 158 | 9015 get A$ 159 | 9020 if A$ = "Y" then goto 150 160 | 9030 if A$ = "N" then ?" Bye!":end 161 | 9040 goto 9000 162 | -------------------------------------------------------------------------------- /samples/sample.randommaze.txt: -------------------------------------------------------------------------------- 1 | 1 TEXT :PR# 3:PRINT :PRINT CHR$ (17);:POKE 230,2 ^ ( PEEK (49183) > 127) * 32:PRINT CHR$ (21);:IF PEEK (230) < 40 THEN POKE 32 + 73,0:POKE 33 + 73,64:CLEAR :CALL 64500 - 63498 2 | 2 Z = PEEK (230) > 40:A = Z:E = 32 + 43589 * NOT Z:DEF FN X(V) = (V - 2) * NOT NOT V:DEF FN P(K) = INT (Z%(X,K) / 4):DEF FN N(V) = 1 - V * 2:DEF FN D(K) = Z%(X,Y) * K + FN P(Y) * 4 * FN N(K) 3 | 3 DEF FN Y(V) = (V - 1) * (V < 3):DEF FN Q(K) = Z%(X,K) > 23:DEF FN V(K) = FN P(Y) + V * K - FN Q(Y) * (4 - K) - 4:N = PEEK (E) / 4:DIM Z%(70,48):POKE E,0:IF N - INT (N) > .4 THEN N = PEEK (E + 11):GOTO 15 4 | 4 INPUT "SEED#, OR 0:NEW,1:STRINGS:";N: IF N - 1 GOTO 15 5 | 10 IF LEN (Z$(3)) - 230 THEN PRINT "STRINGS ABSENT" CHR$ (7): GOTO 4 6 | 15 HGR :POKE 49234,0:HCOLOR= 1:FOR X = 3 TO 279 STEP 4:HPLOT X,0 TO X,188:IF X < 194 THEN Y = X - 3:HPLOT 3,Y TO 279,Y 7 | 20 NEXT : HCOLOR= 0: FOR X = 1 TO 69:Z%(X,0) = 16:Z%(X,48) = 16:IF X < 48 THEN Z%(0,X) = 16:Z%(70,X) = 16 8 | 30 NEXT : ON N = 1 GOTO 160: IF NOT N THEN N = - PEEK (79) * 391 - PEEK (78) 9 | 40 X=RND(N):K=INT(RND(1)*2795)+129:X=INT(K/43):Y=K-X*43+3:Z%(X,Y)=16:J=4:FOR U=1 TO 3242:V$="":L=0:FOR V=0 TO 3:IF Z%(FN X(V)+X,FN Y(V)+Y)<16 THEN V$=V$+STR$(V):L=J=V OR L 10 | 50 NEXT :V = LEN (V$):IF NOT V THEN U = U - 1:V = FN D(1):X = X - FN X(V):J = 4:Y = Y - FN Y(V):NEXT 11 | 60 IF V > 1 THEN V$ = V$ + STR$ (J):V = INT ( RND (1) * (V + L)) + 1 12 | 70 V = VAL ( MID$ (V$,V,1)):J = V: GOSUB 260:Z%(X + P,Y + Q) = V + 16:L = V < 2:K = P * L + X:L = Q * L + Y:Z%(K,L) = Z%(K,L) + 4 + 4 * NOT P:X = X + P:Y = Y + Q:NEXT 13 | 80 Z = 3:Z%(0,1) = 20:Z%(69,47) = 24:HCOLOR= 0:HPLOT 276,188 TO 278,188:X = 0:Y = 1:HPLOT 3,1 TO 3,3:HCOLOR= 3:FOR V = 1 TO 3:HPLOT 0,V TO 2,V:NEXT :FOR U = 0 TO 1:K = PEEK (49152):IF K < 128 THEN U = 0:NEXT 14 | 90 POKE 49168,0:P = (K = 149) - (K = 136 AND X > 1):Q = (K = 138) - (K = 139) 15 | 95 IF Q AND X OR P THEN L=P+Q<0:V=INT(Z%(P*L+X,Q*L+Y)/(4+4*NOT P))/2:IF INT(V)0)*2+Q+1:E=ABS(Z-K)=2:F=NOT P=NOT FN Y(Z):Z=SGN(1.5-Z):FOR L=0 TO 3:V=7:GOSUB 270:V=4:GOSUB 270:NEXT:X=X+P:Y=Y+Q:Z=FN D(1):IF NOT E THEN Z%(X,Y)=FN D(0)+K:Z=K 16 | 100 U = K = 155 OR Y = 48: NEXT : IF A = N THEN END 17 | 110 IF Y = 48 THEN GET V$: IF ASC(V$) = 10 GOTO 110 18 | 120 POKE 49235,0: VTAB 22: IF N - 1 THEN PRINT N" SHOW STRINGS? ";:GET V$:PRINT V$ 19 | 130 IF N = 1 OR V$ = "N" THEN END 20 | 140 TEXT : PRINT CHR$ (4) "PR#3": PRINT SPC(1): FOR Y = 1 TO 47:L = (Y - 1) / 10: K = INT (L): IF L = K THEN PRINT : PRINT : PRINT " " K + 5 "Z$(" K ")=" CHR$ (34); 21 | 150 FOR L = 1 TO 67 STEP 3:V = 0:FOR X = L TO L + 2:V = FN V(4): NEXT : PRINT CHR$ (V + 59);: NEXT : NEXT : PRINT : END 22 | 160 Z = 1:C = 0:FOR Y = 1 TO 47:X = 0:FOR Z = Z TO Z + 22:U = ASC ( MID$ (Z$((Y - 1) / 10),Z,1)) - 59: FOR D = 1 TO 3:X = X + 1:IF U > 31 THEN V = 2:GOSUB 256:U = U - 32 23 | 170 IF U > 15 THEN V = 3: GOSUB 256:U = U - 16 24 | 180 U = U * 4: NEXT : NEXT 25 | 190 C = (C + 1) * (C < 9):Z = Z ^ NOT NOT C: NEXT : GOTO 80 26 | 256 Z%(X,Y) = Z%(X,Y) - V * 4 + 16 27 | 260 P = FN X(V):Q = FN Y(V):K = 1 + NOT Q:L = 1 + NOT P:E = X * 4 + 1:F = Y * 4 - 2: HPLOT FN N(V < 3) * K + E, FN N(V < > 2) * L + F TO FN N(V = 1) * K + E, FN N( NOT V) * L + F: RETURN 28 | 270 HCOLOR= V:J = V = 7:V = V + L - 5:U = V * P + X * 4 + 1:V = V * Q + Y * 4 - 2: IF F AND NOT L OR J OR E THEN HPLOT U - Q,V - P TO U + Q,V + P:RETURN 29 | 280 C = Z * NOT P:D = Z * NOT Q: FOR J = -1 TO 2 STEP 0:IF (L = 1 AND F) = J THEN HCOLOR= 5 30 | 290 HPLOT C * J + U,D * J + V:J = (J < 1) + FN N(J > 0) + J: NEXT : RETURN 31 | -------------------------------------------------------------------------------- /samples/sample.readsector.txt: -------------------------------------------------------------------------------- 1 | 10 PR#0 : TEXT : HOME 2 | 20 INPUT "Sector filename: "; FI$ 3 | 30 HOME 4 | 5 | 100 PRINT CHR$(4);"OPEN ";FI$;",L50" 6 | 110 PRINT CHR$(4);"READ ";FI$;",R0" 7 | 120 INPUT R : REM Number of records 8 | 130 FOR A = 1 TO R 9 | 140 PRINT CHR$(4);"READ ";FI$;",R";A 10 | 150 INPUT A$ : PRINT A$ 11 | 160 NEXT 12 | -------------------------------------------------------------------------------- /samples/sample.rodscolorpattern.txt: -------------------------------------------------------------------------------- 1 | 0 REM Rod's Color Pattern 2 | 10 GR : ONERR GOTO 99 3 | 20 FOR W = 3 TO 50 4 | 30 FOR I = 1 TO 19 5 | 40 FOR J = 0 TO 19 6 | 50 K = I + J 7 | 60 COLOR= J * 3 / (I + 3) + I * W / 12 8 | 70 PLOT I,K: PLOT K,I: PLOT 40 - I,40 - K: PLOT 40 - K,40 - I 9 | 80 PLOT K,40 - I: PLOT 40 - I,K: PLOT I,40 - K: PLOT 40 - K,I 10 | 90 NEXT : NEXT : NEXT : GOTO 20 11 | 99 TEXT : HOME : END 12 | -------------------------------------------------------------------------------- /samples/sample.scribble.txt: -------------------------------------------------------------------------------- 1 | 10 HOME:VTAB21:HTAB16:?"SCRIBBLE" 2 | 14 M=200 3 | 15 HGR:DIM OX(M),OY(M):I=0:J=1-M 4 | 20 OX(I)=140:OY(I)=80:X=OX(I):Y=OY(I):SX=0:SY=0 5 | 30 C=1+3*RND(1):IF RND(1)<0.5 THEN C=C+4 6 | 31 HCOLOR=C 7 | 33 HPLOT OX(I),OY(I) TO X,Y 8 | 35 SX=SX+1-2*RND(1):SY=SY+1-2*RND(1) 9 | 36 IF SX < 0 AND X<70 THEN SX=SX*X/50 10 | 37 IF SX > 0 AND X>210 THEN SX=SX*(279-X)/50 11 | 38 IF SY < 0 AND Y<40 THEN SY=SY*Y/30 12 | 39 IF SY > 0 AND Y>120 THEN SY=SY*(159-Y)/30 13 | 41 J=J+1:IF J>M THEN J=0 14 | 42 I=I+1:IF I>M THEN I=0 15 | 43 IF J<0 THEN 45 16 | 44 HCOLOR=0:HPLOT OX(I),OY(I) TO OX(J),OY(J):HCOLOR=3 17 | 45 OX(I)=X:OY(I)=Y 18 | 46 X=X+SX:Y=Y+SY 19 | 50 IF X>=0 THEN 70 20 | 60 X=0:GOTO 80 21 | 70 IF X>=280 THEN X=279 22 | 80 IF Y>=0 THEN 100 23 | 90 IF Y>=160 THEN Y=159 24 | 100 GOTO 30 25 | -------------------------------------------------------------------------------- /samples/sample.sierpinski.txt: -------------------------------------------------------------------------------- 1 | 10 TEXT : HOME 2 | 20 PRINT "Sierpinski triangle using random number generation" 3 | 30 PRINT "Press any key to continue" 4 | 40 GET A$ 5 | 100 HGR : HCOLOR=3 : HOME 6 | 110 REM set up three points to form a triangle 7 | 120 DIM x(3), y(3) 8 | 130 x(0) = 0 : y(0) = 160 9 | 140 x(1) = 90 : y(1) = 0 10 | 150 x(2) = 180 : y(2) = 160 11 | 160 REM plot the vertices of the triangle 12 | 170 FOR i= 0 to 2 13 | 180 HPLOT x(i), y(i) 14 | 190 NEXT i 15 | 200 REM pick a random starting point 16 | 210 x = int(RND(1)*180) : y = int(RND(1)*150) 17 | 220 hplot x,y 18 | 230 FOR i = 1 to 2000 19 | 240 REM randomly pick one of the triangle vertices 20 | 250 v = int(rnd(1)*3) 21 | 260 REM move the point half way to the triangle vertex 22 | 270 x = (x + x(v)) / 2 : y = (y + y(v)) / 2 23 | 280 HPLOT x,y 24 | 290 NEXT 25 | -------------------------------------------------------------------------------- /samples/sample.sierpinski2.txt: -------------------------------------------------------------------------------- 1 | 10 Hgr 2 | 15 Hcolor = 3 3 | 20 let xa=140 : let ya=0 4 | 30 let xb=0 : let yb = 159 5 | 40 let xc=279 : let yc = 159 6 | 50 Hplot xa,ya : Hplot xb,yb : Hplot xc,yc 7 | 60 let x=INT(rnd(1)*40) : LET Y = INT(RND(1)*40) 8 | 70 HPLOT X,Y 9 | 80 D=(INT(RND(1)*3)) + 1 10 | 85 PRINT D 11 | 90 ON D GOTO 100,200,300 12 | 100 X=INT((X + XA)/2) : Y=INT((Y + YA)/2) 13 | 110 GOTO 70 14 | 200 X=INT((X + XB)/2) : Y=INT((Y + YB)/2) 15 | 210 GOTO 70 16 | 300 X=INT((X + XC)/2) : Y=INT((Y + YC)/2) 17 | 310 GOTO 70 -------------------------------------------------------------------------------- /samples/sample.snowflakes.txt: -------------------------------------------------------------------------------- 1 | 100 REM ***************************************************************** 2 | 110 REM * * 3 | 120 REM * SNOWFLAKE * 4 | 130 REM * A GRAPHICS NONSENSE FOR APPLE II * 5 | 140 REM * KEVIN RIORDAN 1985 * 6 | 150 REM * * 7 | 160 REM ***************************************************************** 8 | 170 : 9 | 10 | 180 REM THIS PROGRAM DRAWS SUCCESSIVE AND INCREASINGLY 11 | 190 REM INTRICATE SYMMETRICAL DESIGNS ON THE HIRES 12 | 200 REM SCREEN. 13 | 210 REM SINCE IT RUNS IN AN ETERNAL LOOP, THE ONLY 14 | 220 REM WAY TO STOP IT IS TO RESET OR POWER OFF - 15 | 230 REM BUT IT'S VERY RESTFUL TO STARE AT! 16 | 240 : 17 | 18 | 250 X=3:S=140:T=95:HGR2:HCOLOR=2 19 | 260 FORY=0TOINT((X-2)/2):GOSUB280:GOSUB410 20 | 270 HGR2:NEXT:X=X+1:GOTO260 21 | 280 A1=2*(22/7)/X:A2=A1*(Y+1) 22 | 290 C=1/SIN((22/7)*(Y+1)/X) 23 | 300 D=X:E=Y+1 24 | 310 D=D-INT(D/E)*E:IFABS(D)>0.5THENF=E:E=D:D=F:GOTO310 25 | 320 E=INT(E+0.5):D=X/E 26 | 330 IFD-INT(D/2)*2>0.5THENC=C+COS((22/7)*E/(2*X)) 27 | 340 G=X+0.5:K=D-0.5 28 | 350 FORL=1TOINT(G):M=0:N=0:R=(L-1)*A1 29 | 30 | 360 FORQ=1TOINT(K):M=M+COS(R)/C:N=N+SIN(R)/C 31 | 370 U=140+INT(95*M+0.5):V=95+INT(95*N+0.5) 32 | 380 HPLOT S,T TO U,V:S=U:T=V:R=R+A2:NEXT 33 | 390 U=140:V=95:HPLOT S,T TO U,V 34 | 400 S=140:T=95:NEXT:RETURN 35 | 410 FORJ=1TO1000:NEXT:RETURN 36 | -------------------------------------------------------------------------------- /samples/sample.spaceattack.txt: -------------------------------------------------------------------------------- 1 | 10 GOTO 100: REM SPACE ATTACK! BY ALAN RATLIFF, (C) 1979 & 2020 2 | 15 REM ADAPTED FOR "Applesoft BASIC in Javascript" 3 | 20 T = SCRN( U,V) = W: COLOR= 12 - R * 3: PLOT U,V 4 | 25 IF U = E AND V = E THEN PRINT B$;:BR = BR - I: VTAB 22: HTAB 40: PRINT BR;: POKE 49233,0: FOR T = I TO 800: NEXT: POKE 49232,0: ON 1 + NOT BR GOTO 155,220 5 | 30 IF T THEN COLOR= W: PLOT U,V: GOTO 190 6 | 40 X = INT ( PDL(Z) * D):Y = INT ( PDL(I) * D2): IF Y > 38 THEN Y = 38 7 | 50 IF X < > P OR Y < > Q THEN COLOR= Z: GOSUB 95:P = X:Q = Y: GOSUB 90: IF SCRN( U,V) = W GOTO 190 8 | 55 L = (L + I) * (L < H): IF L GOTO 40 9 | 58 N = (NN = I) + N:NN = NN - NOT NOT NN:K = K + WV:K = (K < N) * K:U = ABS (U(K)) - I:V = V(K):R = (U(K) < Z) + I 10 | 60 B = (R - ( ABS (E - U) < R)) * SGN (E - U):C = (R - (ABS (E - V) < R)) * SGN (E - V) 11 | 70 IF B AND C THEN B = ( ABS ((E - V) / (E - U)) < J) * B:C = ( ABS ((E - U) / (E - V)) < J) * C 12 | 80 COLOR= Z: PLOT U,V:U = U + B:V = V + C:U(K) = SGN(U(K)) * (U + I):V(K) = V: GOTO 20 13 | 90 COLOR= G: PLOT E,E: COLOR= W 14 | 95 HLIN P,P + I AT Q: HLIN P,P + I AT Q + I: RETURN 15 | 100 PR# 0: TEXT : HOME : VTAB 2: HTAB 13: DEF FN M(T) = ( PEEK (49250) > 127) * 2 + ( PEEK (49249) > 127) 16 | 105 INVERSE : PRINT " SPACE ATTACK! ": NORMAL : PRINT : HTAB 13: PRINT "BY ALAN RATLIFF" 17 | 110 VTAB 7: PRINT " USE THE [MOUSE] TO HIT THE ENEMY": PRINT " MISSILES BEFORE THEY HIT YOUR GREEN": PRINT " BASE---WATCH OUT FOR THE FAST BLUE": PRINT " MISSILES! (WHICH SCORE DOUBLE)" 18 | 115 VTAB 12: PRINT " THE FARTHER FROM BASE YOU HIT THE": PRINT " MISSILES, THE MORE YOU SCORE." 19 | 120 VTAB 15: PRINT " GET A BONUS BASE EVERY 2000 POINTS!" 20 | 122 PRINT " (BUT THE MISSILES COME FASTER....": HTAB 9: PRINT "AND SCORE MORE POINTS!)" 21 | 125 VTAB 19: PRINT "THE GAME ENDS WHEN THE MISSILES HAVE HITFIVE BASES (PLUS BONUS BASES)." 22 | 130 VTAB 23: PRINT "PRESS [HOME] FOR THE FIRST ATTACK WAVE;": PRINT "PRESS [END] FOR THE SECOND ATTACK WAVE."; 23 | 135 T = FN M(0): IF NOT T GOTO 135 24 | 140 Z = 0:I = 1:D = I / 6.7:D2 = I / 5.5:G = 12:W = 15:E = 20:J = 2:F = 58.5:B$ = CHR$ (7) 25 | 142 HOME : VTAB 11: HTAB 19: PRINT "BOOM!" 26 | 145 GR : HOME :WV = T = 2:S = Z:M = 5:H = 80:P = INT (PDL (Z) * D):Q = INT ( PDL (I) * D2): IF Q > 38 THEN Q = 38 27 | 150 VTAB 22: PRINT "SCORE: 0" TAB( 28)"BASES LEFT: 5";:BR = 5 28 | 152 R = RND ( - PEEK (79) * 999 - PEEK (78)):N = I:K = Z 29 | 155 GOSUB 90 30 | 165 VTAB 22: HTAB 15: PRINT SPC( 10):T = Z 31 | 170 FOR X = Z TO T:R = INT ( RND (I) * 156):U = (F - ABS (R - F)) * (R < 117): IF U > 39 THEN U = 39 32 | 175 V = (F - ABS (R - 97.5)) * (R > 39): IF V > 39 THEN V = 39 33 | 185 R = INT ( RND (I) * 1.1) + I:T = N * X + K * NOT X: U(T) = (3 - R * 2) * (U + I):V(T) = V: NEXT : GOTO 20 34 | 190 U = U - E:V = V - E:SC = INT ( SQR (U * U + V * V) - I) * R * M 35 | 195 S = S + SC: VTAB 22: HTAB 8: PRINT S;B$ 36 | 205 IF INT (S / 2E3) = INT ((S - SC) / 2E3) GOTO 165 37 | 210 FLASH : VTAB 22: HTAB 15: PRINT "BONUS BASE"B$;: NORMAL 38 | 215 BR = BR + I: HTAB 40: PRINT BR;:H = INT ((WV / 10 + .8) * H * N / (N + WV)):M = M + WV + I:NN = (N + 10) * WV:T = WV: GOTO 170 39 | 220 PRINT "PRESS [HOME] FOR NEW FIRST WAVE, [END]": PRINT "FOR NEW SECOND WAVE; ANY OTHER KEY:EXIT"; 40 | 225 T = FN M(Z): IF T GOTO 145 41 | 230 IF PEEK (49152) < 128 GOTO 225 42 | 235 POKE 49168,Z: HTAB I: VTAB 23: CALL - 958: PRINT : PRINT "BYE FOR NOW!"; 43 | -------------------------------------------------------------------------------- /samples/sample.squiggle.txt: -------------------------------------------------------------------------------- 1 | 5 REM Squiggle by Gregg Buntin 2 | 10 TEXT 3 | 20 HOME 4 | 30 INPUT "Enter a number from 1 to 8:";N 5 | 40 IF N > 0 AND N < 8 THEN F = 128 6 | 50 E = 0 7 | 60 K = 4 ^ N 8 | 70 FOR X = 1 TO N 9 | 80 U = F 10 | 90 F = - E / 2 11 | 100 E = U / 2 12 | 110 NEXT 13 | 120 HGR 14 | 130 HCOLOR= 3 15 | 140 X = 80 16 | 150 Y = 70 17 | 160 HPLOT X,Y 18 | 170 FOR M = 1 TO K 19 | 180 Z = M 20 | 190 X = X + F 21 | 200 Y = Y + E 22 | 210 HPLOT TO X,Y 23 | 220 FOR A = 0 TO 1 24 | 230 Z = Z / 2 25 | 240 Q = INT (Z) 26 | 250 A = Z - Q 27 | 260 NEXT 28 | 270 A = (Q / 2 = INT (Q / 2)) * 2 - 1 29 | 280 U = F 30 | 290 F = A * E 31 | 300 E = - A * U 32 | 310 NEXT 33 | 320 GOTO 10 34 | 35 | 36 | -------------------------------------------------------------------------------- /samples/sample.steve.txt: -------------------------------------------------------------------------------- 1 | 1 REM In honor of Steve Jobs passing I went 2 | 2 REM back to my Apple BASIC roots. I learned 3 | 3 REM on an Apple IIe in my library and over 4 | 4 REM the summer at summer school. 5 | 5 REM It was then that I learned I wasnt a coder 6 | 6 REM and still am not today but it was my start 7 | 7 REM in learning technology outside of the slide 8 | 8 REM and film projectors. 9 | 9 REM 10 | 10 REM If I have more time maybe I'll bust out 11 | 11 REM something more exciting. 12 | 12 13 | 13 REM You can run this program via the URL below 14 | 14 REM https://inexorabletash.github.io/jsbasic/ 15 | 16 REM 16 | 18 HOME 17 | 19 HGR 18 | 20 HCOLOR=2 19 | 25 REM R 20 | 30 HPLOT 90,70 TO 90,0 TO 125,0 TO 125,35 TO 90,35 TO 125,70 21 | 100 REM I 22 | 110 HPLOT 130,0 TO 165,0 23 | 120 HPLOT 130,70 TO 165,70 24 | 130 HPLOT 147,0 TO 147,70 25 | 150 REM P 26 | 160 HPLOT 170,70 TO 170,0 TO 205,0 TO 205,35 TO 170,35 27 | 200 REM S 28 | 210 HPLOT 23,82 TO 0,82 TO 0,94 TO 23,94 TO 23,106 TO 0,106 29 | 300 REM T 30 | 310 HPLOT 27,82 TO 51,82 31 | 320 HPLOT 39,82 TO 39,106 32 | 350 REM E 33 | 360 HPLOT 79,82 TO 55,82 TO 55,106 TO 79,106 34 | 380 HPLOT 55,94 TO 67,94 35 | 400 REM V 36 | 410 HPLOT 83,82 TO 95,106 TO 107,82 37 | 450 REM E 38 | 460 HPLOT 134,82 TO 110,82 TO 110,106 TO 134,106 39 | 480 HPLOT 110,94 TO 122,94 40 | 500 REM J 41 | 510 HPLOT 168,82 TO 190,82 42 | 520 HPLOT 178,82 TO 178,106 TO 168,106 TO 168,98 43 | 550 REM O 44 | 560 HPLOT 194,82 TO 218,82 TO 218,106 TO 194,106 TO 194,82 45 | 600 REM B 46 | 610 HPLOT 222,82 TO 240,82 TO 246,84 TO 246,104 TO 240,106 TO 222,106 TO 222,82 47 | 650 HPLOT 222,94 TO 246,94 48 | 700 REM S 49 | 710 HPLOT 274,82 TO 250,82 TO 250,94 TO 274,94 TO 274,106 TO 250,106 50 | 800 REM 1 51 | 810 HPLOT 2,120 TO 14,116 TO 14,140 52 | 820 HPLOT 2,140 TO 25,140 53 | 850 REM 9 54 | 860 HPLOT 57,116 TO 33,116 TO 33,128 TO 57,128 55 | 890 HPLOT 57,116 TO 57,140 56 | 900 REM 5 57 | 910 HPLOT 89,116 TO 65,116 TO 65,128 TO 85,128 TO 89,132 TO 89,138 TO 87,140 TO 65,140 58 | 1000 REM 5 59 | 1010 HPLOT 121,116 TO 97,116 TO 97,128 TO 117,128 TO 121,132 TO 121,138 TO 119,140 TO 97,140 60 | 1070 REM - 61 | 1080 HPLOT 131,128 TO 151,128 62 | 1100 REM 2 63 | 1110 HPLOT 161,116 TO 185,116 TO 185,128 TO 161,128 TO 161,140 TO 185,140 64 | 1200 REM 0 65 | 1210 HPLOT 217,116 TO 193,116 TO 193,140 TO 217,140 TO 217,116 66 | 1250 REM 1 67 | 1260 HPLOT 235,140 TO 235,116 TO 223,120 68 | 1270 HPLOT 223,140 TO 247,140 69 | 1300 REM 1 70 | 1310 HPLOT 265,140 TO 265,116 TO 253,120 71 | 1320 HPLOT 253,140 TO 277,140 72 | -------------------------------------------------------------------------------- /samples/sample.stringart.txt: -------------------------------------------------------------------------------- 1 | 10 HGR 2 | 20 hcolor=1 3 | 30 y=191 4 | 40 for x=1 to 191 step 5 5 | 50 c=c+1 6 | 60 if c=>6 then c=1 7 | 70 hcolor=c 8 | 80 hplot x,1 to 1,y 9 | 90 y=y-5 10 | 100 next x 11 | 110 goto 30 12 | -------------------------------------------------------------------------------- /samples/sample.stringfns.txt: -------------------------------------------------------------------------------- 1 | 5 REM FN STRING$/SPACE$ function demo by Alan Ratliff (C) 2021 2 | 10 DEF FN S2$(Y$) = MID$(FN V1$("51")+FN V1$("102")+FN V1$("153")+FN V1$("204")+Y$,1,VAL(T$)) 3 | 20 DEF FN V1$(X$) = MID$(Y$,1,(VAL(T$)>VAL(X$))*51) : DEF FN S3$(T$) = FN S2$(Z$+Z$+Z$+Z$+Z$+Z$+Z$+U$+U$) 4 | 30 DEF FN S4$(U$) = FN S5$(U$+U$+U$+U$+U$+U$+U$) : DEF FN S5$(Z$) = FN S3$(MID$(X3$,VAL(X4$)*2+1)) 5 | 40 DEF FN S6$(X4$) = FN S4$(MID$(" "+X3$,VAL(X4$)+1,1)) : DEF FN ST$(X3$) = FN S6$(STR$(MID$(X3$,2,1)=";")) 6 | 7 | 50 TEXT : PR#0 : HOME : ?"Demo of FN ST$() that acts like SPACE$()or STRING$() in other BASICs!":? 8 | 60 ?"The entry you type will be the argument for FN ST$() to make the desired result." 9 | 70 ?"TYPE A CHARACTER YOU WANT TO REPLICATE": ?"+SEMICOLON+NUMBER OF CHARACTERS [<=255].IF YOU WANT SPACES, TYPE JUST THE NUMBERTO EXIT, JUST PRESS ":? 10 | 80 INPUT "==>";S$ : IF S$>"" THEN PRINT CHR$(34) FN ST$(S$) CHR$(34) CHR$(8) : GOTO 80 11 | 90 PRINT "THANKS! -- BYE"; -------------------------------------------------------------------------------- /samples/sample.thunderclock.txt: -------------------------------------------------------------------------------- 1 | 10 PRINT "Mountain Clock Format" 2 | 20 PRINT CHR$(4);"PR#4" 3 | 30 PRINT CHR$(4);"IN#4" 4 | 40 INPUT " ";T$ 5 | 50 PRINT CHR$(4);"PR#0" 6 | 60 PRINT CHR$(4);"IN#0" 7 | 70 PRINT T$ 8 | 80 PRINT 9 | 10 | 100 PRINT "Numeric Format" 11 | 110 PRINT CHR$(4);"PR#4" 12 | 120 PRINT CHR$(4);"IN#4" 13 | 130 INPUT "#";MO,DW,DT,HR,MN,SEC 14 | 140 PRINT CHR$(4);"PR#0" 15 | 150 PRINT CHR$(4);"IN#0" 16 | 160 PRINT "Month: ";MO 17 | 161 PRINT "Day: ";DW 18 | 162 PRINT "Date: ";DT 19 | 163 PRINT "Hours: ";HR 20 | 164 PRINT "Minutes: ";MN 21 | 165 PRINT "Seconds: ";SEC 22 | 166 PRINT 23 | 24 | 210 PRINT "12-Hour Format" 25 | 220 PRINT CHR$(4);"PR#4" 26 | 230 PRINT CHR$(4);"IN#4" 27 | 240 INPUT ">";T$ 28 | 250 PRINT CHR$(4);"PR#0" 29 | 260 PRINT CHR$(4);"IN#0" 30 | 270 PRINT T$ 31 | 280 PRINT 32 | 33 | 310 PRINT "24-Hour Format" 34 | 320 PRINT CHR$(4);"PR#4" 35 | 330 PRINT CHR$(4);"IN#4" 36 | 340 INPUT "<";T$ 37 | 350 PRINT CHR$(4);"PR#0" 38 | 360 PRINT CHR$(4);"IN#0" 39 | 370 PRINT T$ 40 | 380 PRINT 41 | -------------------------------------------------------------------------------- /samples/sample.unfinishedmaze.txt: -------------------------------------------------------------------------------- 1 | 10 home : text 2 | 20 dim maze(39,39) 3 | 30 c=1 : d=1 : e=1 : f=1 4 | 5 | 40 htab(11) : vtab(4) : print "'AN UNFINISHED MAZE'" 6 | 50 htab(11) : vtab(5) : print "-------------------" 7 | 60 htab(5) : vtab(8) : print "* Programmed by Alexander G. Tozzi" 8 | 70 htab(5) : vtab(9) : print "* www.wumpustales.com" 9 | 80 htab(5) : vtab(10) : print "- - - - - - - - - - - - - - - - -" 10 | 90 flash : htab(9) : vtab(16) : print "(PRESS ANY KEY TO BEGIN)" : normal 11 | 100 key=peek(49152) : if key<128 then 100 12 | 110 poke 49168,0 : gr 13 | 14 | 15 | 140 gosub 1000 16 | 150 gosub 2000 17 | 160 gosub 3000 18 | 170 htab(1) : vtab(21) : print "A: UP" 19 | 180 htab(1) : vtab(22) : print "Z: DOWN" 20 | 190 htab(10) : vtab(21) : print "J: LEFT Q: QUIT" 21 | 200 htab(10) : vtab(22) : print "K: RIGHT" 22 | 210 goto 160 23 | 24 | 1000 for y=0 to 39 25 | 1100 for x=0 to 39 26 | 1200 read a : maze(x,y)=a 27 | 1300 next x : next y 28 | 1999 return 29 | 30 | 2000 for y=0 to 39 31 | 2100 for x=0 to 39 32 | 2200 a=maze(x,y) 33 | 2300 if a=1 then color=2 : plot x,y 34 | 2400 if a=0 then color=9 : plot x,y 35 | 2500 if a=2 then color=1 : plot x,y 36 | 2500 next x : next y 37 | 2999 return 38 | 39 | 3000 key=peek(49152) : if key<128 then key=128 40 | 3100 poke 49168,0 41 | 3200 button$=chr$(key-128) 42 | 3300 if key<>128 then gosub 7000 43 | 3400 if button$="A" then if maze(e,f-1)<>1 then f=f-1 44 | 3500 if button$="Z" then if maze(e,f+1)<>1 then f=f+1 45 | 3600 if button$="J" then if maze(e-1,f)<>1 then e=e-1 46 | 3700 if button$="K" then if maze(e+1,f)<>1 then e=e+1 47 | 3800 if button$="Q" then end 48 | 3900 if maze(e,f)=2 then gosub 8000 49 | 3950 color=15 : plot e,f 50 | 3999 return 51 | 52 | 7000 c=e : d=f 53 | 7100 color=9 : plot c,d 54 | 7999 return 55 | 56 | 8000 text : home 57 | 8100 htab(10) : vtab(5) : print "YOU ESCAPED MY MAZE!" 58 | 8200 htab(10) : vtab(6) : print "--------------------" 59 | 8300 htab(10) : vtab(10): print "NEXT TIME YOU WON'T" 60 | 8400 htab(14) : vtab(11) : PRINT "BE SO LUCKY!" 61 | 8500 htab(14) : vtab(12) : print "------------" 62 | 8400 flash 63 | 8500 htab(9) : vtab(16) : print "(PRESS ANY KEY TO END)" 64 | 8600 normal 65 | 8700 end 66 | 67 | 50000 data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 68 | 50001 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1 69 | 50002 data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1 70 | 50003 data 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1 71 | 50004 data 1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1 72 | 50005 data 1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,2,1,0,0,0,1,0,1 73 | 50006 data 1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0,1,0,1 74 | 50007 data 1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1 75 | 50008 data 1,1,0,1,0,0,0,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1,1,1,0,1 76 | 50009 data 1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1 77 | 50010 data 1,0,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1,0,1,1,1 78 | 50011 data 1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,1,0,1 79 | 50012 data 1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,1 80 | 50013 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,1,0,1 81 | 50014 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1 82 | 50015 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1 83 | 50016 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1 84 | 50017 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1 85 | 50018 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1 86 | 50019 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1 87 | 50020 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1 88 | 50021 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1 89 | 50022 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1 90 | 50023 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1 91 | 50024 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1 92 | 50025 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 93 | 50026 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 94 | 50027 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 95 | 50028 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 96 | 50029 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 97 | 50030 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 98 | 50031 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 99 | 50032 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 100 | 50033 data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 101 | 50034 data 1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1 102 | 50035 data 1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1 103 | 50036 data 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1 104 | 50037 data 1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1 105 | 50038 data 1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1 106 | 50039 data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 -------------------------------------------------------------------------------- /samples/sample.vdt.txt: -------------------------------------------------------------------------------- 1 | 10 PRINT "V,D,T" 2 | 3 | 20 INPUT "What do you want to solve? ( V,D,T,)"; A$ 4 | 5 | 30 IF A$ = "V" THEN GOTO 60 6 | 7 | 40 IF A$ = "D" THEN GOTO 70 8 | 9 | 50 IF A$ = "T" THEN GOTO 80 10 | 11 | 60 PRINT " V= D/T" 12 | 13 | 61 PRINT "Distance=": INPUT D 14 | 15 | 62 PRINT "Time =":INPUT T 16 | 17 | 63 LET V = D/T 18 | 19 | 64 PRINT "Velocity =" 20 | 21 | 65 PRINT V 22 | 23 | 66 END 24 | 25 | 70 PRINT " D= V*T" 26 | 27 | 71 PRINT "Velocity=": INPUT V 28 | 29 | 72 PRINT "Time =":INPUT T 30 | 31 | 73 LET D = V*T 32 | 33 | 74 PRINT "Distance =" 34 | 35 | 75 PRINT D 36 | 37 | 76 END 38 | 39 | 80 PRINT " T= D/V" 40 | 41 | 81 PRINT "Distance=": INPUT D 42 | 43 | 82 PRINT "Velocity=":INPUT V 44 | 45 | 83 LET T = D/V 46 | 47 | 84 PRINT "Time =" 48 | 49 | 85 PRINT T 50 | 51 | 86 END -------------------------------------------------------------------------------- /samples/sample.xmastree.txt: -------------------------------------------------------------------------------- 1 | 10 REM Change Log 2 | 11 REM 1983ish - Rich Orde & Gregg Buntin - First Version 3 | 12 REM 12/2/2016 - Gregg - adapt code for JSBasic by Joshua Bell, add lots of comments 4 | 13 REM 12/2/2016 - Gregg - Bug fix for get key 5 | 14 REM 12/3/2016 - Rich - Add blinky lights, blinky star 6 | 15 REM 12/6/2016 - Rich - make snow fall anywhere, including in front of tree and accumulate on ground 7 | 16 REM 12/6/2016 - Gregg - code cleanup, move 'data' statements to end, create 'lights' subroutine, setup to reuse star drawing routine, more comments 8 | 98 REM ----------------------------------------------------------------------------------------------------------------------------------------------------- 9 | 99 REM Credits screen 10 | 110 TEXT : HOME : REM Clear the Bogi screen 11 | 120 VTAB 4 : HTAB 14 : PRINT "Christmas Tree" 12 | 130 VTAB 10 : HTAB 1 : PRINT "By Rich Orde and Gregg Buntin (1983ish)" 13 | 140 VTAB 12 : HTAB 5 : PRINT "Adapted for JSBasic Dec 2, 2016" 14 | 150 VTAB 19 : PRINT "Press any key to continue" 15 | 160 GET KEY$ : REM read input 16 | 198 REM ----------------------------------------------------------------------------------------------------------------------------------------------------- 17 | 199 REM Initial Setup 18 | 200 DIM X(28),Y(28), Z(28), V(28), A(10), B(10), R(28) : Rem setup variables 19 | 210 F = 160 : G = 0 : D = 0 : REM ground 20 | 220 HGR : POKE-16302,0 : HCOLOR= 1 : REM Set Hires, full screen, color Bogi green 21 | 230 FOR I = 40 TO 140 STEP 10: FOR J = 0 TO 9 : REM Loops for Tree 22 | 240 HPLOT 140 - J * 1.4 + 20 - I / 2,I + J TO 140 + J * 1.4 - 20 + I / 2,I + J: NEXT : NEXT : REM Draw Tree 23 | 250 HCOLOR= 0: HPLOT 100,149 TO 180,149: HPLOT 105,148 TO 175,148: HPLOT 125,147 TO 155,147 : REM Bottom of tree 24 | 260 HCOLOR= 5: FOR I = 147 TO 160: HPLOT 132,I TO 148,I: NEXT : REM Tree Trunk 25 | 270 HCOLOR= 2 : FOR I = 161 TO 163: HPLOT 0,I TO 279,I: NEXT : REM Ground 26 | 280 ST = 1 : H = 6 : GOSUB 460 : ST = 0 : REM Draw a white star 27 | 290 FOR I = 1 TO 10 : READ A(I), B(I) : Z = I : GOSUB 600 : NEXT : REM 10 lights 28 | 300 FOR I = 1 TO 28: READ R(I) : X(I) = INT(RND (1) * 10) + R(I): Y(I)=INT(RND(1)*60): Z(I) = INT(RND(1)*3)+2 : V(I)=0 : NEXT : REM get snow starting locations 29 | 398 REM ----------------------------------------------------------------------------------------------------------------------------------------------------- 30 | 399 REM Main Loop 31 | 400 FOR I = 1 TO 28: HCOLOR = V(I): HPLOT X(I),Y(I):Y(I) = Y(I) + Z(I) : IF Y(I) > F - 2 THEN Y(I) = F : REM restore snowflake pixel to original background color 32 | 410 C = C + 1 : IF C / 150 <> INT (C / 150) THEN 440 : REM lights blink every 150 cycles 33 | 420 C = 0 : D = NOT D : Z = Z + D : IF Z = 11 THEN Z = 1: REM cycle through 10 lights to blink 34 | 430 TZ = Z : GOSUB 600 : REM Draw or ease a light 35 | 440 IF C / 100 <> INT(C / 100) THEN 470 : REM star changes color every 100 cycles 36 | 450 H = H + 1 + (H = 3): IF H = 8 THEN H = 1 : REM color change for star, skipping 4 (black) 37 | 460 HCOLOR= H: HPLOT 140,28 TO 140,40: HPLOT 133,35 TO 147,35: HPLOT 135,30 TO 145,40: HPLOT 135,40 TO 145,30 : IF 1 = ST THEN RETURN : REM flashing star 38 | 470 V(I) = HSCRN(X(I), Y(I)) : HCOLOR= 3 : HPLOT X(I),Y(I) : REM white snowflake 39 | 480 IF Y(I)= F THEN HPLOT TO X(I), 160 : G = G + 1 : Y(I) = INT(RND(1)*4): S = S + 1: X(I) = INT(RND(1)*10) + R(S) : V(I) = 0: Z(I) = INT(RND(1)*3)+2 : IF 28 = S THEN S = 0 : REM flake hit ground, create new one 40 | 490 IF G > 799 THEN G = 0: HPLOT 0, F TO 279, F : F = F - 1 : REM raise ground for snow accumulation every 800 snowflakes that fall 41 | 500 NEXT : REM Next snowflake 42 | 510 GOTO 400 : REM Start the loop over again 43 | 598 REM ----------------------------------------------------------------------------------------------------------------------------------------------------- 44 | 599 REM Draw light 45 | 600 HCOLOR = 2 - D 46 | 610 HPLOT A(Z) + 1,B(Z) TO A(Z) + 3,B(Z): HPLOT A(Z) + 1,B(Z) + 4 TO A(Z) + 3,B(Z) + 4: REM top & bottom of lights 47 | 620 FOR J = B(Z) + 1 TO B(Z) + 3: HPLOT A(Z),J TO A(Z) + 4,J: NEXT J : REM middle of lights 48 | 630 RETURN 49 | 898 REM ----------------------------------------------------------------------------------------------------------------------------------------------------- 50 | 900 DATA 140,50,135,95,145,135,110,100,160,111 : REM Data for Lights 51 | 910 DATA 102,135,127,120,128,75,150,85,170,133 : REM Data for Lights 52 | 920 DATA 60,10,140,210,180,130,20,270,240,90,40,80,100,30,220,250,160,50,110,190,260,70,120,150,200,170,0,230 : REM data for 28 snowflake zones to avoid collision 53 | -------------------------------------------------------------------------------- /samples/sample.zhorelay.txt: -------------------------------------------------------------------------------- 1 | 0 REM 5090 Added VTAB 2 to correct display 2 | 0 REM Added 5005 to correct display 3 | 0 REM 7020 Added PRINT to break lines 4 | 0 REM 4892 IF expression will never be true (condition checked earlier) 5 | 6 | 100 TEXT : HOME : PRINT "Zhodani Relay Station Placement." 7 | 110 PRINT " This program examines an existing sector file and determines the need for, and locations of, Zhodani relay stations (which must be placed between Zhodani naval bases more than four hexes distant)." 8 | 120 PRINT " This program originally appeared in Challenge Magazine No. 26." : PRINT 9 | 10 | 500 DIM PO(32,40),PP(32,40),OD(13,13) 11 | 510 DIM F2(169),F3(169),F4(169),F5(169) 12 | 520 DIM F1(169) 13 | 14 | 531 NA$(1) = "WORLD " 15 | 532 NA$(2) = "ZHO WORLD " 16 | 533 NA$(3) = "NAVAL BASE" 17 | 534 NA$(4) = "DEPOT " 18 | 535 NA$(5) = "RELAY " 19 | 20 | 2000 INPUT "Filename? > ";FI$ 21 | 2010 PRINT CHR$(4);"OPEN ";FI$;",L50" 22 | 2020 PRINT CHR$(4);"READ ";FI$;",R0" 23 | 2030 INPUT R 24 | 2031 DIM HX$(R) 25 | 2040 FOR A = 1 TO R 26 | 2050 PRINT CHR$(4);"READ ";FI$;",R";A 27 | 2060 INPUT A$ 28 | 29 | 3000 X = VAL(LEFT$(A$,2)):Y = VAL(MID$(A$,3,2)) 30 | 3001 HX$(A) = LEFT$(A$,4) 31 | 3005 Z = 1 32 | 3010 IF MID$(A$,33,1) = "Z" THEN Z = 2 33 | 3020 IF MID$(A$,16,1) = "Z" THEN Z = 3 34 | 3040 IF MID$(A$,16,1) = "Y" THEN Z = 4 35 | 3050 IF MID$(A$,16,1) = "X" THEN Z = 5 36 | 3060 PO(X,Y) = Z : PP(X,Y) = A 37 | 3070 NEXT A 38 | 39 | 40 | 4000 HOME : FOR X = 1 TO 32 41 | 4005 FOR Y = 1 TO 40 : VTAB 1 42 | 4010 IF PO(X,Y) < 1 THEN 6000 43 | 4012 PRINT "World Hex ";RIGHT$("0"+STR$(X),2);RIGHT$("0"+STR$(Y),2);" ";NA$(PO(X,Y)) 44 | 4020 REM 45 | 4025 F1 = 0 : F2 = 0 : F3 = 0 : F4 = 0 : F5 = 0 46 | 4027 PRINT "Worlds within jump-4: "; 47 | 4028 PRINT : PRINT 48 | 4029 FOR N = Y-5 TO Y+5 : FOR M = X-5 to X+5 49 | 4040 IF M < 1 OR M > 32 THEN 4900 50 | 4055 IF N < 1 OR N > 40 THEN 4894 51 | 4056 IF X = M AND N = Y THEN FLASH : PRINT PO(X,Y); : NORMAL : GOTO 4894 52 | 4057 IF X = M AND N <> Y THEN Z1 = ABS(Y-N) : GOTO 4080 53 | 4060 IF Y = N AND X <> M THEN Z1 = ABS(X-M) : GOTO 4080 54 | 4063 EV = 0 : OD = 0 : IF (X/2 = INT(X/2)) AND (M/2 = INT (M/2)) THEN EV=1 55 | 4064 IF (X/2 <> INT(X/2)) AND (M/2 <> INT(M/2)) THEN EV = 1 56 | 4065 IF EV <> 1 THEN OD = 1 57 | 4070 X1 = X - M : Y1 = Y - N : Z1 = SQR((X1*X1)+((.857)*Y1*Y1)) 58 | 4071 IF OD = 1 THEN Z1 = Z1 + .5 59 | 4080 IF Z1 > 4 THEN 4890 60 | 4089 IF PO(M,N) = 1 THEN F1 = F1 + 1 : F1(F1) = PP(M,N) 61 | 4090 IF PO(M,N) = 2 THEN F2 = F2 + 1 : F2(F2) = PP(M,N) 62 | 4100 IF PO(M,N) = 3 THEN F3 = F3 + 1 : F3(F3) = PP(M,N) 63 | 4110 IF PO(M,N) = 4 THEN F4 = F4 + 1 : F4(F4) = PP(M,N) 64 | 4120 IF PO(M,N) = 5 THEN F5 = F5 + 1 : F5(F5) = PP(M,N) 65 | 4180 REM 66 | 67 | 4890 IF PO(M,N) = 0 THEN PRINT "."; : GOTO 4894 68 | 4891 PRINT PO(M,N); 69 | 4892 IF X = M AND N = Y THEN PRINT "*"; 70 | 4894 REM 71 | 72 | 4900 NEXT M : PRINT 73 | 4902 NEXT N : PRINT 74 | 75 | 5000 REM 76 | 77 | 5005 VTAB 16 : PRINT : PRINT : PRINT : PRINT : PRINT : PRINT : VTAB 16 78 | 79 | 5010 REM 80 | 5011 IF F1 > 0 THEN PRINT NA$(1);": ";F1;"; "; : FOR J = 1 TO F1 : PRINT HX$(F1(J));" "; : NEXT : PRINT 81 | 5012 IF F2 > 0 THEN PRINT NA$(2);": ";F2;"; "; : FOR J = 1 TO F2 : PRINT HX$(F2(J));" "; : NEXT : PRINT 82 | 5013 IF F3 > 0 THEN PRINT NA$(3);": ";F3;"; "; : FOR J = 1 TO F3 : PRINT HX$(F3(J));" "; : NEXT : PRINT 83 | 5014 IF F4 > 0 THEN PRINT NA$(4);": ";F4;"; "; : FOR J = 1 TO F4 : PRINT HX$(F4(J));" "; : NEXT : PRINT 84 | 5015 IF F5 > 0 THEN PRINT NA$(5);": ";F5;"; "; : FOR J = 1 TO F5 : PRINT HX$(F5(J));" "; : NEXT : PRINT 85 | 5016 IF F2 = 0 THEN 6010 86 | 5017 IF (F3+F4+F5)<>0 THEN 6010 87 | 5018 PRINT "Relay station needed." 88 | 89 | 5019 R1 = F2(INT(RND(90)*F2+1)) 90 | 5020 PRINT CHR$(4);"OPEN ";FI$;",L50" 91 | 5030 PRINT CHR$(4);"READ ";FI$;",R";R1 92 | 5040 INPUT A$ 93 | 5050 A$ = LEFT$(A$,15) + "X" + MID$(A$+" ",17,31) 94 | 5060 PRINT CHR$(4);"WRITE ";FI$;",R";R1 95 | 5070 PRINT A$ 96 | 5080 PRINT CHR$(4);"CLOSE ";FI$ 97 | 5090 PO(VAL(LEFT$(A$,2)),VAL(MID$(A$,3,2))) = 5 : VTAB 2 : GOTO 4020 98 | 99 | 6000 REM 100 | 6010 NEXT Y 101 | 6020 NEXT X 102 | 103 | 7000 FOR Y = 1 TO 40 : FOR X = 1 TO 32 104 | 7010 IF PO(X,Y) = 0 THEN PRINT "."; : GOTO 7020 105 | 7015 PRINT PO(X,Y); 106 | 7020 NEXT X : PRINT : NEXT Y 107 | 7030 END 108 | -------------------------------------------------------------------------------- /samples/simple.pong.txt: -------------------------------------------------------------------------------- 1 | 1 REM Newsgroups: comp.sys.apple2 2 | 2 REM From: mad.scientist.jr@gmail.com 3 | 3 REM Message-ID: <1193160910.224728.270640@z24g2000prh.googlegroups.com> 4 | 4 REM Subject: Re: woz' original "brick out" - source code , paddles 5 | 5 REM Date: Tue, 23 Oct 2007 17:35:10 -0000 6 | 7 | 10 REM APPLE II SIMPLE PONG V4 8 | 20 REM PASTE INTO Joshua Bell's EMULATOR AT inexorabletash.github.io/jsbasic/ 9 | 25 REM ++++++++++++++++++++++++++++++++++++++++ 10 | 30 REM TITLE SCREEN + PROMPT FOR CONTROLS 11 | 35 REM ++++++++++++++++++++++++++++++++++++++++ 12 | 40 TEXT : PR#0 : HOME : REM ENTER TEXT MODE, CLEAR SCREEN 13 | 45 DEF FN pd(k) = (26 * pdl(k)) / 255 + 2 : REM DEFINE PADDLE-READING FUNCTION 14 | 46 REM DEF FN pr(k) = SGN(INT((pdl(k) - 55) / 146)) : REM (non-absolute) paddle function 15 | 49 PRINT "APPLE II SIMPLE PONG V4.1" 16 | 50 PRINT 17 | 51 PRINT "version 1 by aiiadict" 18 | 52 PRINT "tweaks by Mad Scientist Jr" 19 | 53 PRINT "and Alan Ratliff (2020)" 20 | 54 PRINT 21 | 55 PRINT "During game press Q to quit." 22 | 56 PRINT : HTAB 18 : PRINT "^ # ^" SPC(5) "^ # ^" 23 | 58 PRINT "TYPE K FOR KEYS" SPC(2) "A/S/D" SPC(5) "J/K/L" : HTAB 19 : PRINT "Z/X" SPC(7) "M/," 24 | 59 PRINT " (# = STOP)" TAB(19) "v v" SPC(7) "v v" : PRINT : PRINT "OR P FOR PADDLES OR Q TO QUIT? "; 25 | 60 GET C$ : IF C$ <> "K" AND C$ <> "P" AND C$ <> "Q" GOTO 60 26 | 62 IF C$ = "Q" THEN VTAB 22 : GOTO 9000 27 | 65 REM 28 | 70 REM ++++++++++++++++++++++++++++++++++++++++ 29 | 75 REM DRAW FIELD AND INITIALIZE GAME 30 | 80 REM ++++++++++++++++++++++++++++++++++++++++ 31 | 85 HOME : GR: REM ENTER GRAPHIC MODE 32 | 90 COLOR= 7: VLIN 0,39 AT 0: VLIN 0,39 AT 39 33 | 95 HLIN 0,39 AT 0: HLIN 0,39 AT 39 34 | 100 bx = 10:by = 10:ox = 10:oy = 10: REM BALL START POSITION 35 | 102 dx = 1: dy = - 1: REM BALL DIRECTION 36 | 104 p1 = 10: o1 = 10: REM PLAYER 1 START POSITION 37 | 106 p2 = 10: o2 = 10: REM PLAYER 2 START POSITION 38 | 120 v1 = 0 : v2 = 0 : s1 = 0 : s2 = 0 : u1 = 0 : u2 = 0 : 39 | 125 PL = 8: REM PADDLE LENGTH 40 | 130 REM 41 | 145 REM ++++++++++++++++++++++++++++++++++++++++ 42 | 150 REM BEGIN MAIN GAME LOOP 43 | 155 REM ++++++++++++++++++++++++++++++++++++++++ 44 | 196 REM ++++++++++++++++++++++++++++++++++++++++ 45 | 197 REM DRAW PADDLE1 46 | 198 REM ++++++++++++++++++++++++++++++++++++++++ 47 | 200 IF o1 <> p1 THEN COLOR= 0: VLIN o1,o1 + PL AT 3 48 | 210 COLOR= 7: VLIN p1,p1 + PL AT 3 49 | 296 REM ++++++++++++++++++++++++++++++++++++++++ 50 | 297 REM DRAW PADDLE2 51 | 298 REM ++++++++++++++++++++++++++++++++++++++++ 52 | 300 IF o2 <> p2 THEN COLOR= 0: VLIN o2,o2 + PL AT 36 53 | 310 COLOR= 7: VLIN p2,p2 + PL AT 36 54 | 399 REM ++++++++++++++++++++++++++++++++++++++++ 55 | 400 REM DRAW AND MOVE BALL 56 | 401 REM ++++++++++++++++++++++++++++++++++++++++ 57 | 402 IF ox <> bx OR oy <> by THEN COLOR= 0: VLIN oy,oy + 1 AT ox 58 | 410 COLOR= 11: VLIN by,by + 1 AT bx 59 | 420 ox = bx : oy = by : bb = 1 60 | 470 bx = bx + dx 61 | 490 IF SCRN( bx,by) OR SCRN( bx, by + 1) THEN dx = -dx : k = (bx=3)*p1+(bx=36)*p2 : IF bx*2=39-dx*33 AND ((k>0)*by-PL/2-k+1)*dy > 0 THEN bb = 0 62 | 500 IF bx = 7 THEN u1 = 1 63 | 510 IF bx = 33 THEN u2 = 1 64 | 520 IF bx = 1 AND u1 THEN s2 = s2 + 1 : u1 = 0 : VTAB 22 : HTAB 41 - LEN(STR$(s2)) : PRINT s2; 65 | 530 IF bx = 38 AND u2 THEN s1 = s1 + 1 : u2 = 0 : VTAB 22 : HTAB 1 : PRINT s1 66 | 540 by = by + dy 67 | 840 IF (SCRN( bx,by) OR SCRN( bx, by + 1)) AND bb THEN dy = -dy 68 | 850 IF bx < 1 THEN bx = 1 69 | 860 IF bx > 38 THEN bx = 38 70 | 870 IF by < 1 THEN by = 1 71 | 880 IF by > 37 THEN by = 37 72 | 890 o1 = p1 : o2 = p2 73 | 900 REM ++++++++++++++++++++++++++++++++++++++++ 74 | 901 REM GET PLAYER INPUT 75 | 902 REM ++++++++++++++++++++++++++++++++++++++++ 76 | 903 IF PEEK ( - 16384) > 127 THEN GET K$: IF K$ = "Q" GOTO 9000 : REM SEE IF KEY PRESSED/Q FOR QUIT 77 | 904 IF C$ <> "K" THEN GOTO 921 78 | 905 REM 79 | 906 REM ---------------------------------------- 80 | 907 REM KEYBOARD INPUT 81 | 909 REM ---------------------------------------- 82 | 912 IF K$ = "A" OR K$ = "D" THEN v1 = -1 83 | 913 IF K$ = "S" THEN v1 = 0 84 | 914 IF K$ = "Z" OR K$ = "X" THEN v1 = 1 85 | 916 IF K$ = "J" OR K$ = "L" THEN v2 = -1 86 | 917 IF K$ = "K" THEN v2 = 0 87 | 918 IF K$ = "M" OR K$ = "," THEN v2 = 1 88 | 920 K$ = "" : p1 = p1 + v1 : p2 = p2 + v2 : GOTO 955 89 | 921 IF C$ <> "P" THEN GOTO 947 90 | 922 REM 91 | 923 REM ---------------------------------------- 92 | 925 REM PADDLE INPUT 93 | 927 REM ---------------------------------------- 94 | 930 REM simple (non-absolute) paddle input: 95 | 932 REM p1 = FN pr(0) + p1 96 | 934 REM p2 = FN pr(1) + p2 97 | 940 REM realtime (absolute position) paddle input: 98 | 944 p1 = FN pd(0) 99 | 945 p2 = FN pd(1) 100 | 947 REM 101 | 955 REM ++++++++++++++++++++++++++++++++++++++++ 102 | 956 REM MAKE SURE PADDLES DON'T GO OFF SCREEN 103 | 958 REM ++++++++++++++++++++++++++++++++++++++++ 104 | 960 IF p1 < 2 THEN p1 = 2 105 | 970 IF p1 > 28 THEN p1 = 28 106 | 980 IF p2 < 2 THEN p2 = 2 107 | 990 IF p2 > 28 THEN p2 = 28 108 | 999 GOTO 150 109 | 9000 REM 110 | 9010 REM ++++++++++++++++++++++++++++++++++++++++ 111 | 9020 REM QUIT GAME 112 | 9030 REM ++++++++++++++++++++++++++++++++++++++++ 113 | 9040 TEXT : REM HOME 114 | 9045 PRINT 115 | 9050 PRINT "FINISHED APPLE II SIMPLE PONG V4.1" 116 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | 2 | (function () { 3 | var $ = function (s) { return document.querySelector(s); }; 4 | var $$ = function (s) { return document.querySelectorAll(s); }; 5 | 6 | var ss = $$('script'), cs = ss[ss.length - 1], baseURL = /^.*\/|/.exec(cs.src)[0]; 7 | 8 | document.write(''); 9 | 10 | function load(url) { document.write(''); } 11 | load('https://cdn.rawgit.com/inexorabletash/polyfill/v0.1.25/polyfill.min.js'); 12 | load('https://cdn.rawgit.com/inexorabletash/polyfill/v0.1.25/keyboard.js'); 13 | load('tty.js'); 14 | load('lores.js'); 15 | load('hires.js'); 16 | load('bell.js'); 17 | load('dos.js'); 18 | load('basic.js'); 19 | 20 | function createInstance(src) { 21 | function ce(element, attributes, children) { 22 | var e = document.createElement(element); 23 | if (attributes) { 24 | Object.keys(attributes).forEach(function(key) { 25 | e[key] = attributes[key]; 26 | }); 27 | } 28 | if (children) { 29 | children.forEach(function(child) { 30 | e.appendChild(child); 31 | }); 32 | } 33 | return e; 34 | } 35 | 36 | // DOM 37 | var lores_elem = ce('div', {className: 'jsb-lores'}); 38 | var hgr1_elem = ce('canvas', {className: 'jsb-hires', width: 560, height: 384}); 39 | var hgr2_elem = ce('canvas', {className: 'jsb-hires', width: 560, height: 384}); 40 | var tty_elem = ce('div', {className: 'jsb-tty'}); 41 | var wrapper_elem = ce('div', {className: 'jsb-wrapper'}, [lores_elem, hgr1_elem, hgr2_elem, tty_elem]); 42 | var frame = ce('div', {className: 'jsb-frame', tabIndex: 0}, [wrapper_elem]); 43 | 44 | // JS OM 45 | var bell = new Bell(baseURL); 46 | var tty = new TTY(tty_elem, frame, bell.play.bind(bell)); 47 | var dos = new DOS(tty); 48 | var lores = new LoRes(lores_elem, 40, 48); 49 | var hires = new HiRes(hgr1_elem, 280, 192); 50 | var hires2 = new HiRes(hgr2_elem, 280, 192); 51 | var display = { 52 | state: { graphics: false, full: true, page1: true, lores: true }, 53 | setState: function (state, value /* ... */) { 54 | var args = [].slice.call(arguments); 55 | while (args.length) { 56 | state = args.shift(); 57 | value = args.shift(); 58 | this.state[state] = value; 59 | } 60 | 61 | if (this.state.graphics) { 62 | lores.show(this.state.lores); 63 | hires.show(!this.state.lores && this.state.page1); 64 | hires2.show(!this.state.lores && !this.state.page1); 65 | tty.splitScreen(tty.getScreenSize().height - (this.state.full ? 0 : 4)); 66 | } else { 67 | lores.show(false); 68 | hires.show(false); 69 | hires2.show(false); 70 | tty.splitScreen(0); 71 | } 72 | }, 73 | getState: function() { 74 | return Object.assign({}, this.state); 75 | } 76 | }; 77 | var pdl = [0, 0, 0, 0]; 78 | 79 | // Mouse-as-Joystick 80 | wrapper_elem.addEventListener('mousemove', function (e) { 81 | var rect = wrapper_elem.getBoundingClientRect(), 82 | x = e.clientX - rect.left, y = e.clientY - rect.top; 83 | function clamp(n, min, max) { return n < min ? min : n > max ? max : n; } 84 | pdl[0] = clamp(x / (rect.width - 1), 0, 1); 85 | pdl[1] = clamp(y / (rect.height - 1), 0, 1); 86 | }); 87 | 88 | var program; 89 | dos.reset(); 90 | tty.reset(); 91 | tty.autoScroll = true; 92 | 93 | try { 94 | program = basic.compile(src); 95 | } catch (e) { 96 | if (e instanceof basic.ParseError) { 97 | tty.writeString(e.message + '\r'); 98 | tty.writeString('Source line: ' + e.line + ', column: ' + e.column); 99 | } else { 100 | tty.writeString(e.message); 101 | } 102 | return frame; 103 | } 104 | 105 | var stopped = false; 106 | 107 | program.init({ 108 | tty: tty, 109 | hires: hires, 110 | hires2: hires2, 111 | lores: lores, 112 | display: display, 113 | paddle: function (n) { return pdl[n]; } 114 | }); 115 | setTimeout(driver, 0); 116 | 117 | var NUM_SYNCHRONOUS_STEPS = 37; 118 | function driver() { 119 | var state = basic.STATE_RUNNING; 120 | var statements = NUM_SYNCHRONOUS_STEPS; 121 | 122 | while (!stopped && state === basic.STATE_RUNNING && statements > 0) { 123 | try { 124 | state = program.step(driver); 125 | } catch (e) { 126 | tty.writeString(e.message); 127 | stopped = true; 128 | return; 129 | } 130 | 131 | statements -= 1; 132 | } 133 | 134 | if (state === basic.STATE_STOPPED || stopped) { 135 | stopped = true; 136 | } else if (state === basic.STATE_BLOCKED) { 137 | // Fall out 138 | } else { // state === basic.STATE_RUNNING 139 | setTimeout(driver, 0); // Keep going 140 | } 141 | } 142 | 143 | return frame; 144 | } 145 | 146 | window.addEventListener('load', function() { 147 | [].forEach.call($$('script'), function(script) { 148 | if (script.type === 'text/applesoft-basic') { 149 | var source = script.innerText || script.textContent; 150 | var elem = createInstance(source); 151 | script.parentElement.insertBefore(elem, script.nextSibling); 152 | } 153 | }); 154 | }); 155 | 156 | }()); 157 | -------------------------------------------------------------------------------- /script.md: -------------------------------------------------------------------------------- 1 | Web Page Embedding 2 | ================== 3 | 4 | Want to show off your BASIC creation on your own web site? Now you can with just a tiny bit of HTML. 5 | There are two parts: 6 | 1. Insert `` on your page to enable it 7 | 2. Add `` 8 | 9 | Like this: 10 | ```html 11 | 12 | My BASIC example 13 |

Look what I did!

14 | 15 | 16 | 23 | ``` 24 | 25 | Wherever you have the BASIC program, a simulated screen will appear and the program will run. 26 | 27 | Notes: 28 | 29 | * If the program stops, the user will need to re-load the page to re-run it, so this works best with interactive programs or programs that run as loops. 30 | * You can have more than one `