http://www.breakintoprogram.co.uk/projects/spectrum-next-projects/bbc-basic-for-the-spectrum-next-introduction | JAVASCRIPT IS DISABLED. Please enable JavaScript on your browser to best view this site. L Break Into Program Retro Programming Made Simple * [icon_] * [icon_] * [icon_] * [icon_] L Break Into Program * Home * Programming + BASIC o Part 1: Hello! o Part 2: Variables o Part 3: IF... o Part 4: Loops o Part 5: Subroutines + Assembly Language o Primer # Part 1: Numbers # Part 2: Maths # Part 3: Branching and Loops o Z80 # Z80 Opcodes * Computers + ZX Spectrum o Hardware o Memory Map o Keyboard o Screen Memory Layout o Interrupts o Sound o Character Set o Assembly Language # Z80 Development Toolchain # Z80 Tutorials # Z80 Library Routines # Z80 Demos + ZX Spectrum Next o Assembly Language # Z80 Development Toolchain # Z80 Library Routines # Z80 Demos + ZX81 o Hardware * Links * Area 51 + Run Demos * About Me Post navigation BBC Basic for the Spectrum Next (Introduction) L Break Into Program I've been looking for a decent project to get my teeth into on the Spectrum Next. Apart from my Next Z80 library routines, I've dabbled with a few demos, and considered writing a drawing package similar to Deluxe Paint. But on the whole have felt rather unenthusiastic about starting that project. Last week inspiration hit me. I've already started porting the Z80 version of BBC Basic (by R.T.Russell) to my homebrew Z80 computer, the BSX. Why not port it to the Next? Why BBC Basic? BBC Basic is, in my honest opinion, a best-in-class BASIC interpreter. The original, written by Sophie Wilson, is fast, even on a 2Mhz BBC Micro, feels modern, and has a built-in 6502 assembler. The Z80 version of BBC Basic was written by R.T.Russell. It picks up the mantle and provides equivalent levels of functionality and performance. And yes, it has a built-in Z80 assembler. Whilst I love Sinclair BASIC, I feel that BBC Basic addresses many of its shortcomings, including the clunky editor, variable name limitations for strings and arrays, and performance. "Ah", I hear you say. "I can load a BBC Micro Core in my Next to run BBC Basic". Yes of course you can do that, and it is an excellent core. You will of course be restricted to BBC Model B hardware in doing so. The advantage of running BBC Basic native on the Next is that it can potentially take advantage of the Next's advanced graphics and sound capabilities; hardware sprites, Layer 2 graphics, multiple AY chips, and of course the legendary 28Mhz Turbo mode. The challenges The main challenges I forsee are: * Time: I work full time, so will only be able to spend the odd hour here and there on this project * Memory: BBC Basic and MOS occupy 32K of ROM. Ideally I need to fit this into 16K ROM banks To put this into some context, the open source version of BBC Basic is for CP/M only - with no support for graphics and sound, and for the BSX version I've gone further and stripped out the CP/M support. To create a minimally viable product, I'll need to add graphics, sound, and file I/O support. And to match the richness of Next BASIC I'll also need to add some Next-specific commands. The benefits It's a cool way to learn how to code the Next, and I can re-use some of the code, and much of the overall structure as I continue to port BBC Basic to my homebrew computer. I've also written a few library routines for the Next that I can re-use. It is also a good project to nibble away at. Adding extra features often involves no more than a couple of pages of Z80, and there will always be a functional version I can run. The state of play Thankfully, as I'd already done a lot of the legwork porting this to the BSX, and have already set up my Spectrum Next toolchain, there was very little that needed to be done to get the core of BBC BASIC for Z80 up and running on the Next. I think it took me an afternoon to get it to compile, accept keyboard input, and run a BASIC program. The project has got off to a good start, with the following features: * Input: Interrupt driven keyboard scanning routine * Graphics: + Text output + Hardware text scrolling + MODE, CLS, CLG, GCOL and COLOUR commands + PLOT (single point to ULA and Layer 2) + Vertical sync command (*FX 19) + Next Turbo CPU speed command (*RUN) * Debugging: A memory dump command (*MEMDUMP) * Next Specific: + Extended BASIC PUT and GET commands to read NEXTREG registers Gallery * [bbc_basic_boot-1024x939]Boot Screen * [bbc_basic_attributes]Running on the MiSTer Next Core * [bbc_basic_fedora_1-1024x939]Fedora Graph * [bbc_basic_fedora_2-1024x939]Text and Graphics What next I'm currently working on a memory map so that I can start to use memory paging, and am looking at getting some basic file I/O up and running. Just getting the "*." command working would be a win at this point. In addition, I'm trying to work out the best way to integrate the graphics modes into BASIC. The most obvious solution is to use MODE to switch between ULA and Layer 2 graphics, and support several discrete graphics modes. The latest build is available here in my github account; this code is distributed under the terms of a zlib license as requested by R.T.Russell. And as ever, I'll be posting regular updates on Twitter as @breakintoprogram. Post navigation Comments are closed. Search Search for: [ ] Recent Posts * BBC Basic for the Spectrum Next (Introduction) * Composite Video on the Raspberry Pi Pico * Fixing a Poorly Commodore 64 (Part 3) * Fixing a Poorly Commodore 64 (Part 2) * Fixing a Poorly Commodore 64 (Part 1) * Fixing a Poorly Commodore 64 (Intro) * Electronic Dice project for Beginners * Homebrew Z80 Computer (Part 6) * Homebrew Z80 Computer (Part 5) * Homebrew Z80 Computer (Part 4) Categories * Hardware (41) + Acorn BBC Micro (3) o Repairs (3) + Commodore 64 (4) o Repairs (4) + Spectrum Next (1) + ZX Spectrum (17) o Repairs (10) + ZX81 (2) o Repairs (1) * Musings (18) * Projects (12) + Harlequin (1) + High Altitude Balloon (1) + Homebrew Z80 (8) + Pico (1) + Spectrum Next (1) o BBC Basic (1) * Reviews (3) * Software Development (27) + Code (13) Tags 6502 Assembly AY-3-8912 Bare Metal BASIC BBC Micro C++ Cassette Clock CoderDojo Commodore 64 Debugging Emulator Game GitHub Goat Hardware Homebrew Interrupts Maths Networking Power Supply Programming PyGame Python RAM Raspberry PI Recap Repair Review Scouts Screen Scrolling SD Card Self Modifying Sound Spectrum Spectrum Next Sprites Tim Follin USB WiFi YouTube Z80 ZX81 (c)2021 - L Break Into Program |