Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

152 Commits

Repository files navigation

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:

NameReleaseMS VersionROM9digitINPUTBUFFERextensions.define
Commodore BASIC 11977YYZPCBM
OSI BASIC19771.0 REV 3.2YNZP-CONFIG_10A
AppleSoft I19771.1NY$0200AppleCONFIG_11
KIM BASIC19771.1NYZP-CONFIG_11A
AppleSoft II1978YY$0200AppleCONFIG_2
AIM-65 BASIC19781.1?YNZPAIMCONFIG_2A
SYM-1 BASIC19781.1?YNZPSYMCONFIG_2A
Commodore BASIC 21979YY$0200CBMCONFIG_2A
KBD BASIC1982YN$0700KBDCONFIG_2B
MicroTAN1980YYZP-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.

The following symbols can be defined in addition:

Configuration SymbolDescription
CONFIG_CBM1_PATCHESjump out into CBM1's binary patches instead of doing the right thing inline
CONFIG_CBM_ALLadd all Commodore-specific additions except file I/O
CONFIG_DATAFLG?
CONFIG_EASTER_EGGinclude the CBM2 "WAIT 6502" easter egg
CONFIG_FILEsupport Commodore PRINT#, INPUT#, GET#, CMD
CONFIG_IO_MSBall I/O has bit #7 set
CONFIG_MONCOUT_DESTROYS_YY needs to be preserved when calling MONCOUT
CONFIG_NO_CRterminal doesn't need explicit CRs on line ends
CONFIG_NO_LINE_EDITINGdisable support for Microsoft-style "@", "_", BEL etc.
CONFIG_NO_POKEdon't support PEEK, POKE and WAIT
CONFIG_NO_READ_Y_IS_ZERO_HACKdon't do a very volatile trick that saves one byte
CONFIG_NULLsupport for the NULL statement
CONFIG_PEEK_SAVE_LINNUMpreserve LINNUM on a PEEK
CONFIG_PRINTNULLSwhether PRINTNULLS does anything
CONFIG_PRINT_CRprint CR when line end reached
CONFIG_RAMoptimizations for RAM version of BASIC, only use on 1.x
CONFIG_ROR_WORKAROUNDuse workaround for buggy 6502s from 1975/1976; not safe for CONFIG_SMALL!
CONFIG_SAFE_NAMENOTFOUNDcheck both bytes of the caller's address in NAMENOTFOUND
CONFIG_SCRTCH_ORDERwhere in the init code to call SCRTCH
CONFIG_SMALLuse 6 digit FP instead of 9 digit, use 2 character error messages, don't have GET
CONFIG_SMALL_ERRORuse 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.

About

Microsoft BASIC for 6502 (Commodore, Apple, KIM-1, AIM-65, OSI, ...)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages