There has been a recent flousishing in homebrew computer systems such as the 6502 BenEater and the Z80 RC2014. Naturally, some people will think of running BBC BASIC on them and think of porting a version of BASIC. The first point is a step in the wrong direction. If you're building a home-brew system, the correct thing is not to port BASIC, but to port the MOS API, and simple drop a pre-existing BASIC binary straight into the memory map. The bare minimum your MOS needs to do is: BRKV, WRCHV: vectors for BRK and WRCH BRK: point &FD/E to error message, jump via BRKV OSWRCH/WRCHV: print characters OSWORD 0: read input line OSBYTE &83/&84: read bottom of memory/top of memory &0000-&005F: zero page workspace for BASIC &0400-&07FF: fixed workspace for BASIC Enter BASIC at its entry point with A=1 All other API calls can (and must) simply return unchanged until you get around to implementing them. Examples: BenBasic80, BenBasicC0 Porting BBC BASIC to new targets ================================ It is fairly easy to target BBC BASIC to a new platform, as BASIC is written to clearly segragate the language from I/O. If starting a new platform from scratch, the simplest thing to do is simply drop in an existing binary and implement the MOS API and memory layous that BASIC uses. There is no need to change BASIC itself or recreate it. There are some edge cases where an existing binary many need slight modification, for instance, the 6510 has two I/O locations in zero page, and 6502 BASIC needs slight modification to avoid using these. CPU API requirements Workspace 6502 BASIC2 MOS calls at &FFxx, vectors &02xx &00-&5F, &0400-&07FF 6510 MOS calls at &FFxx, vectors &02xx &02-&5F, &0400-&07FF 6809 MOS calls at &FFxx, vectors &02xx &00-&5F, &0400-&07FF Z80 MOS calls at &FFxx, vectors &FFxx within BASIC PDP11 MOS calls via ENT within BASIC ARM MOS calls via SWI within BASIC The minimum the API needs to implement is: * memory layout, PAGE and HIMEM * OSWRCH * OSWORD 0 for INPUT * BRKV to return errors All other calls can return unchanged. 6502 series ----------- Basic2 = 8000 HiBasic2 = B800 Example host 6809 ---- Z80 --- PDP11 ----- ARM --- The simplest way to implement a new host is to take an existing host for the CPU and modify it. The best starting point is the Tube host for that CPU.