Giter Club home page Giter Club logo

msbasic's Introduction

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.

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 [email protected].
  • 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.

msbasic's People

Contributors

hofmar avatar mist64 avatar nils-eilers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

msbasic's Issues

where is the entry point?

I guessed it had to be PR_WRITTEN because at least that seems relevant, but thats at some random address. I assume on the ones that get loaded to ram (kim1 is my example) the 'OS' loads to a well known address, it then has to know where to enter the code. Its not at the load address for sure.

4 times ZP_STARTn ?

Hey, sorry for this most likely dumb question, but..

Why are there 4 Zero-Page start addresses?
e.g. in the File "define_cbm2.s" for the Commodore Basic 2 are 4 ZP addresses configured.

I do know that the ZP is the memory where the address-space starts and was usually used for registers etc. since you could access those bytes really fast.
Therefore I am confused where the 4 ZP-Pointers are pointing to.

Im trying to create a custom "define_custom.s" file for my own project, but I'm unaware of these 4 Pages (since there only should be one???)
(I may figured out that this is cause of 4 different memory selects that the 6510 has, but how to remove the errors from 6502 cpus?)

Also, when using the define_cmb2.s (copied into define_custom.s) im getting on executing ./make.sh:
us

er@DESKTOP-RJE8QP3:/mnt/c/Users/User/Downloads/msbasic-master$ ./make.sh
custom
print.s(104): Error: Illegal addressing mode
cbmbasic1
cbmbasic2
kbdbasic
osi
kb9
applesoft
microtan
aim65
sym1

print.s in line 104 - Why is that? It should be the same config?

And yes i did add the case to the define.s file.

LIST/RUN not working on OSI version

For example,
PRINT "Hello"
work fine, but
10 PRINT "Hello"
RUN
doesn't work.
The line appears to be tokenized and stored to RAMSTART2 correctly,
but LINGET never seems to work.
FNDLIN always seems to look for LINNUM 00 00, even when it's 0A 00.
However, even doing:
00 PRINT "Hello"
RUN
Doesn't work.
I haven't dug further.

Current source relies on odd (perhaps broken) behaviour of (an older release of) ca65

See cc65/cc65#2208

The current source does some (rather complex and hard to follow) magic things to figure out the location of certain variables. This broke due to a recent fix in ca65 (arguable the behaviour was broken before AND after the fix - but its now broken in a different way, while another case was fixed).

However, to properly deal with this, the source should be changed to use less magic instead, perhaps use different linker configs for each target binary.

Obviously the problem should ideally be fixed in ca65 as well - but i don't see that happening anytime soon (it's really not trivial to do). I don't see that recent fix being reverted either for that matter, as it fixed a much more relevant problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.