Microsoft BASIC for 6502 (Commodore, Apple, KIM-1, AIM-65, OSI, ...)
Go to file
2024-06-23 11:45:42 +02:00
orig added SYM-1 2014-02-14 18:46:36 -08:00
.gitignore Ignore tmp directory 2015-12-08 02:31:56 +01:00
aim65_extra.s added AIM-65 2014-02-13 22:40:56 -08:00
aim65_iscntc.s added AIM-65 2014-02-13 22:40:56 -08:00
aim65_loadsave.s added AIM-65 2014-02-13 22:40:56 -08:00
aim65.cfg added AIM-65 2014-02-13 22:40:56 -08:00
apple_extra.s cleanup 2008-10-17 06:53:38 +00:00
apple_iscntc.s split up ISCNTC 2008-10-18 07:50:47 +00:00
apple_loadsave.s separation... 2008-10-13 02:05:35 +00:00
applesoft.cfg EXTRA segment 2008-10-13 10:42:49 +00:00
array.s cleanup 2008-10-20 00:32:20 +00:00
cbm1_patches.s cleanup 2008-10-19 06:51:22 +00:00
cbm_iscntc.s split up ISCNTC 2008-10-18 07:50:47 +00:00
cbmbasic1.cfg EXTRA segment 2008-10-13 10:42:49 +00:00
cbmbasic2.cfg EXTRA segment 2008-10-13 10:42:49 +00:00
chrget.s cleanup 2008-10-13 03:25:57 +00:00
defines_aim65.s added SYM-1 2014-02-14 18:46:36 -08:00
defines_apple.s cleanup 2008-10-20 08:58:09 +00:00
defines_cbm1.s add some text to msbasic.s 2008-10-19 07:20:41 +00:00
defines_cbm2.s cleanup 2008-10-19 06:20:10 +00:00
defines_kbd.s cleanup 2008-10-18 21:20:15 +00:00
defines_kim.s cleanup 2008-10-18 21:20:15 +00:00
defines_microtan.s cleanup 2008-10-18 21:20:15 +00:00
defines_osi.s cleanup 2008-10-19 06:05:39 +00:00
defines_sym1.s added SYM-1 2014-02-14 18:46:36 -08:00
defines_w65c816sxb.s Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
defines.s Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
error.s added AIM-65 2014-02-13 22:40:56 -08:00
eval.s added SYM-1 2014-02-14 18:46:36 -08:00
extra.s Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
float.s added SYM-1 2014-02-14 18:46:36 -08:00
flow1.s added SYM-1 2014-02-14 18:46:36 -08:00
flow2.s cleanup 2008-10-20 08:58:09 +00:00
header.s Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
init.s added SYM-1 2014-02-14 18:46:36 -08:00
inline.s added SYM-1 2014-02-14 18:46:36 -08:00
input.s added SYM-1 2014-02-14 18:46:36 -08:00
iscntc.s Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
kb9.cfg EXTRA segment 2008-10-13 10:42:49 +00:00
kbd_extra.s cleanup 2008-10-19 06:00:50 +00:00
kbd_iscntc.s split up ISCNTC 2008-10-18 07:50:47 +00:00
kbd_loadsave.s cleanup 2008-10-18 06:38:54 +00:00
kbdbasic.cfg EXTRA segment 2008-10-13 10:42:49 +00:00
kim_extra.s EXTRA segment 2008-10-13 10:42:49 +00:00
kim_iscntc.s split up ISCNTC 2008-10-18 07:50:47 +00:00
kim_loadsave.s zeropage work 2008-10-17 07:34:52 +00:00
loadsave.s added SYM-1 2014-02-14 18:46:36 -08:00
macros.s separated out token and error tables 2008-10-13 00:44:36 +00:00
make.sh Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
memory.s cleanup 2008-10-16 06:53:45 +00:00
message.s added AIM-65 2014-02-13 22:40:56 -08:00
microtan_extra.s cleanup 2008-10-20 08:58:09 +00:00
microtan_iscntc.s split up ISCNTC 2008-10-18 07:50:47 +00:00
microtan_loadsave.s cleanup 2008-10-19 06:20:10 +00:00
microtan.cfg microtan work 2008-10-13 20:26:42 +00:00
misc1.s added AIM-65 2014-02-13 22:40:56 -08:00
misc2.s microtan work 2008-10-13 20:26:42 +00:00
misc3.s cleanup 2008-10-19 06:20:10 +00:00
msbasic.s Fix assembly 2015-12-08 02:40:00 +01:00
osi_iscntc.s cleanup 2008-10-19 21:01:27 +00:00
osi.cfg EXTRA segment 2008-10-13 10:42:49 +00:00
poke.s added AIM-65 2014-02-13 22:40:56 -08:00
print.s added SYM-1 2014-02-14 18:46:36 -08:00
program.s added SYM-1 2014-02-14 18:46:36 -08:00
README.md Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
regress.sh added SYM-1 2014-02-14 18:46:36 -08:00
rnd.s cleanup 2008-10-19 06:00:50 +00:00
string.s added AIM-65 2014-02-13 22:40:56 -08:00
sym1_iscntc.s added SYM-1 2014-02-14 18:46:36 -08:00
sym1_loadsave.s added SYM-1 2014-02-14 18:46:36 -08:00
sym1.cfg added SYM-1 2014-02-14 18:46:36 -08:00
TODO.txt add some text to msbasic.s 2008-10-19 07:20:41 +00:00
token.s added SYM-1 2014-02-14 18:46:36 -08:00
trig.s added SYM-1 2014-02-14 18:46:36 -08:00
var.s microtan work 2008-10-13 20:26:42 +00:00
w65c816sxb_extra.s Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
w65c816sxb_iscntc.s Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
w65c816sxb.cfg Add support for W65C816SXB dev board from WDC 2024-06-23 11:45:42 +02:00
zeropage.s added SYM-1 2014-02-14 18:46:36 -08:00

Microsoft BASIC for 6502

This is a single integrated assembly source tree that can generate nine different versions of Microsoft BASIC for 6502.

By running ./make.sh, this will generate all versions and compare them to the original files byte by byte. The CC65 compiler suite is need to build this project.

These are the first ten (known) versions of Microsoft BASIC for 6502:

Name Release MS Version ROM 9digit INPUTBUFFER extensions .define
Commodore BASIC 1 1977 Y Y ZP CBM
OSI BASIC 1977 1.0 REV 3.2 Y N ZP - CONFIG_10A
AppleSoft I 1977 1.1 N Y $0200 Apple CONFIG_11
KIM BASIC 1977 1.1 N Y ZP - CONFIG_11A
AppleSoft II 1978 Y Y $0200 Apple CONFIG_2
AIM-65 BASIC 1978 1.1? Y N ZP AIM CONFIG_2A
SYM-1 BASIC 1978 1.1? Y N ZP SYM CONFIG_2A
Commodore BASIC 2 1979 Y Y $0200 CBM CONFIG_2A
KBD BASIC 1982 Y N $0700 KBD CONFIG_2B
MicroTAN 1980 Y Y ZP - CONFIG_2C

(Note that this assembly source cannot (yet) build AppleSoft II.)

This lists the versions in the order in which they were forked from the Microsoft source base. Commodore BASIC 1, as used on the original PET is the oldest known version of Microsoft BASIC for 6502. It contains some additions to Microsoft's version, like Commodore-style file I/O.

The CONFIG_n defines specify what Microsoft-version the OEM version is based on. If CONFIG_2B is defined, for example, CONFIG_2A, CONFIG_2, CONFIG_11A, CONFIG_11 and CONFIG_10A will be defined as well, and all bugfixes up to version 2B will be enabled.

Additionally these releases are built for computer originally not having "original" Microsoft BASIC

Name Release .define
W65C816SXB 2014 CONFIG_2C

The following symbols can be defined in addition:

Configuration Symbol Description
CONFIG_CBM1_PATCHES jump out into CBM1's binary patches instead of doing the right thing inline
CONFIG_CBM_ALL add all Commodore-specific additions except file I/O
CONFIG_DATAFLG ?
CONFIG_EASTER_EGG include the CBM2 "WAIT 6502" easter egg
CONFIG_FILE support Commodore PRINT#, INPUT#, GET#, CMD
CONFIG_IO_MSB all I/O has bit #7 set
CONFIG_MONCOUT_DESTROYS_Y Y needs to be preserved when calling MONCOUT
CONFIG_NO_CR terminal doesn't need explicit CRs on line ends
CONFIG_NO_LINE_EDITING disable support for Microsoft-style "@", "_", BEL etc.
CONFIG_NO_POKE don't support PEEK, POKE and WAIT
CONFIG_NO_READ_Y_IS_ZERO_HACK don't do a very volatile trick that saves one byte
CONFIG_NULL support for the NULL statement
CONFIG_PEEK_SAVE_LINNUM preserve LINNUM on a PEEK
CONFIG_PRINTNULLS whether PRINTNULLS does anything
CONFIG_PRINT_CR print CR when line end reached
CONFIG_RAM optimizations for RAM version of BASIC, only use on 1.x
CONFIG_ROR_WORKAROUND use workaround for buggy 6502s from 1975/1976; not safe for CONFIG_SMALL!
CONFIG_SAFE_NAMENOTFOUND check both bytes of the caller's address in NAMENOTFOUND
CONFIG_SCRTCH_ORDER where in the init code to call SCRTCH
CONFIG_SMALL use 6 digit FP instead of 9 digit, use 2 character error messages, don't have GET
CONFIG_SMALL_ERROR use 2 character error messages

Changing symbol definitions can alter an existing base configuration, but it not guaranteed to assemble or work correctly.

More Information

More information on the differences of the respective versions can be found on this blog entry: Create your own Version of Microsoft BASIC for 6502.

Also, Ben Eater has an published excellent video demonstrating how to port BASIC to a new system: Running MSBASIC on my breadboard 6502 computer

License

2-clause BSD

Credits

  • Main work by Michael Steil mist64@mac.com.
  • AIM-65 and SYM-1 by Martin Hoffmann-Vetter
  • Function names and all uppercase comments taken from Bob Sander-Cederlof's excellent AppleSoft II disassembly.
  • Applesoft lite by Tom Greene helped a lot, too.
  • Thanks to Joe Zbicak for help with Intellision Keyboard BASIC
  • This work is dedicated to the memory of my dear hacking pal Michael "acidity" Kollmann.