Close

BBC BASIC

A project log for W65C02SXB investigation

Evaluating the W65C02SXB development board

KeithKeith 11/14/2021 at 18:050 Comments

I feel it would be easier to let them stay there and modify BBC BASIC to set the RAMTOP variable slightly lower.

The BBC Micro has the 16K BASIC ROM at 8000 hex and the 16K MOS at C000. This conflicts with the Terbium IDE which sits in the first 1.3K at 8000.

The Acorn Atom's BBC BASIC board for the Acorn Atom moves the I/O space from B000 to 7000 hex, out the way of the Terbium IDE hardware. The firmware might be a good starting point, because it omits most of the BBC Micro peripherals (which the WD65C02SXB doesn't have either). The firmware has routines to drive 256x192 graphics, provided by the 6847 chip. This would be much easier to implement than BBC Micro compatible graphics.

The BBC Micro 6502 second processor used just a 2K for the MOS and I/O, allowing BBC BASIC to be relocated at B800.

This allows the Flash ROM to contain BBC BASIC, and 2K for OS ROM and I/O starting at F800.

So the job is to write a small OS that just implements console I/O. This could be through the 65C51  serial chip (which has a handshaking flag bug), or the USB module (the IDE would have to disconnect), or the 65C22 VIA (maybe talking to another USB module).

I have had a look at J.G. Harston's latest code for the Acorn Atom BBC BASIC conversion board MOS. He has spotted many errors. I have edited it to assemble online at asm80.com, and have tried to make the labels more informative. Although still 4K, it has code for driving the 6522, 8255 and 6847.

J.G. Harston's has code for a tiny 6502 Tube Client in 512 bytes. Implements OSWRCH and OSRDCH via a single I/O port:

https://mdfs.net/Software/Tube/6502/Mini65.bas

It is in BBC BASIC's unconventional assembler. I don't have a BBC micro so I started converting it to a more conventional assembler syntax.

I wondered if the Terbium IDE and BBC BASIC could co-exist. Terbium uses the first four bytes of page zero, but so does BBC BASIC:

00-01 LOMEM (LO-HI) pointer to start of BASIC variables
02-03 VARTOP (LO-HI) pointer to end of BASIC variables

BBC BASIC does have some spare page-zero bytes but that would require modding the IDE code. Or BBC BASIC. This might disrupt either environment.

I feel it might be best that the reset routine reads a switch on an input port, then runs either Terbium IDE or BBC BASIC. 

2021-11-25

When developing 6502 software, you will probably want to change the reset and interrupt vectors at the end of the memory map. With TIDE, it isn't possible. You can tell tide to switch in a new 32K bank of ROM but then TIDE software is switched out. Pulling out the USB cable cuts the power and when plugged in again the board will reset to the TIDE software. 

A way round this may be to start in TIDE, use TIDE to switch in the new ROM, then close TIDE to release the USB connection for a terminal emulator.

It would be a nuisance doing it every time, but this is just a development project to demonstrate the code works. I thought of hacking the PCB but the tracks are very fine and the PLCC sockets are surface mounted! There is no way to tack vero wire to socket pins! I don't think this board was built with enough thought.

For now, I'll just accept having to change the Flash ROM by unplugging, reprogramming, and replugging it.

Discussions