CPCBasic Unchained - Run CPC BASIC in a Browser
- Run old an new BASIC programs in a browser
- "Wrap factor" Speed: Frame Fly and other events in real-time, calculations as fast as possible
- CPC Basic Unchained: Less restrictions, extended by new features, breaking out of the CPC box
- BASIC compiler and not just interpreter
- Lots of memory, no memory full
- Runs locally without a server (even on mobile devices, but without input)
There are several great CPC emulators which emulate a complete CPC with exact timing and allow demos to run, pushing CPC hardware to its limits.
Just open cpcbasic.html in a browser. The user interface shows several boxes, which can be reduced and expanded by pressing the green buttons.
Use the selection field to select a sample program, reset the CPC, and run the program.
If the focus is on the CPC screen, keystrokes will be detected by a running program. The Input window is an alternative way to send input to the CPC. This works also on mobile devices.
The Break button stops the simulation. You can continue with the "Continue" button.
The Reset button resets the CPC.
Textual output is also written to the Console Window. This is useful for copying and pasting the output.
The Variables window allows you to see the variables used by the program.
The Reload button reloads the page with the current settings. (Please note that changes to the script are lost!)
The Help button opens the readme file on the server.
- CPCBasic is still in progress and not complete or accurate
- It is BASIC only and can not execute Z80 machine code
- Unimplemented commands, eg. KEY, KEY DEF, ...
- RESTORE on lines without DATA
- Sound: No ENT (tone envelopes); no hardware volume envelopes or tones with sepcial ENV syntax "="
- No direct input mode for BASIC commands, e.g. LIST, RENUM,...; no visible cursor
- Few checks of the program
- Almost no type checking
- Variables typed with DEFINT, DEFREAL or DEFSTR are different from those with type extension:
defint a: a=1: a%=2: ?a,a%
- Interpreted CPC BASIC may contain lines of arbitrary content if they are not executed, e.g. comments without marking them as comments. The CPCBasic compiler does not allow this.
- That is CPC BASIC:
a(3]=6: ?a[3). Do we really want to allow that?
- A lot more
- [fixed: TEST, TESTR can not distinguish between pens of the same color]
- [fixed: Changing the color with INK, existing drawings will not be changed and the colors will not flash. Currently you have to redraw the screen with another color to get a flashing effect.]
- [fixed: Comparison with equal in assignment is possible now:
a=0: x=(a=0): ?x, returns -1 for true as on the CPC]
- [fixed: No sound]
- MODE 3: High resolution with real 640x400 pixel and 16 colors; 8x8 pixel characters: Rectangles
- Computations are not limited to 16 bits
- Peek&Poke can access "large" memory, not only 64K or 512K.
- It is BASIC with "wrap factor". However, do not use busy waiting. Put in FRAME or CALL &BD19 commands.
Possible Future Enhancements
- Drag and drop BASIC programs (tokenized or ASCII) into CPCBasic
- Separate sample library; sample category
- DSK images support
- Pause key
- Create buttons for the keys that the BASIC program checks (useful for e.g. mobile devices)
- Can we detect Busy Loops and insert FRAME automatically?
- Extension: More colors, e.g. 256
- Further checks during compile time
- Smooth characters from 8x8 to 8x16
CPC 6128 User Instructions - (I have the German version)
ROM-Listing CPC 464/664/6128 - German, excellent information
Das Scheider CPC Systembuch - German, excellent information
Locomotive BASIC - Description of the CPC Basic Dialect
Disassembly of Locomotive BASIC v1.1 - If you do not have the ROM listing at hand
CPCemu - CPC Emulator, currently version 1.7, hopefully there will be an update soon ...
Arnold TNG - The Warp factor - Modified Arnold CPC emulator at various speed levels.
Simple Web Basic - A link collection of basic interpreters for the Web (2010)
Top Down Operator Precedence - Douglas Crockford, 2007-02-21. CPCBasic uses this approach.
BM Benchmark Suite - A collection of simple benchmarks in various programming languages
Locomotive Software - The developer of CPCs BASIC and operating system