
Paul Allen’s additional macros for 6502 development made the MACRO-10 assembler output one 36 bit PDP-10 instruction word for every 6502 byte. MOS was first (for the KIM), then OSI, then Commodore/MOS again (this time for the PET), then Apple.
#6502 emulator mac code
Later, the computer companies would get the source from Microsoft and develop themselves – source code of the Apple and Commodore derivatives is available they both contain Microsoft comments.īy the way, the numbering of these targets probably indicated in which order Microsoft signed contracts with computer manufacturers. Features like file I/O and time support seem to have been specifically developed for Commodore, for example. What is interesting is that initially it was Microsoft adapting their source for the different computers, instead of giving source to the different vendors and having them adapt it. The target defines the setting of the configuration constants, but some code is also conditionally compiled depending on a specific target. It has one of the following values: ValueĪll versions except Commodore also print “ COPYRIGHT 1978 MICROSOFT” in a new line. The constant REALIO is used to configure what computer system to generate the binary for. Page of the input buffer if 0, the buffer uses parts of the zero page The RAM version can optionally jetison the SIN, COS, TAN and ATN commands at startup

NULL support, a command to configure the number of NUL characters to print to the terminal after each line break LOAD, SAVE (and on Commodore: VERIFY) support PRINT#, INPUT#, CMD, SYS (!), OPEN and CLOSE support
#6502 emulator mac 32 bit
The BASIC source supports several compile-time configuration options: NameĤ0 bit (9 digit) vs 32 bit (7 digit) floatĮrror message strings instead of two-character codes (The ^O1000 part wraps the byte in a PDP-10 instruction – see below.) This emits a byte value of 0x2C ( BIT absolute), which skips the next instruction. This pushes a 16 bit value from memory (absolute or zero page) onto the stack.Ī compact way to express out-of-bounds branches. This loads an immediate constant into A/Y. Most 16 bit constants are loaded into A/Y with this macro, but macros for A/X and X/Y also exist. Get the next character and make sure it’s Q, otherwise SYNTAX ERROR.

The source defines many macros that make development easier. The following only adds the string to the binary if REALIO is equal to 4: Octal can also be forced with a ^O prefix.Ĭonditional translation is done using the IFE and IFN statements, which test whether the argument is zero. The RADIX statement switches between the two. In the floating point code, all numbers are octal. MACRO-10 did not support hex numbers, which is why most numbers are in decimal format. A set of macros developed by Paul Allen allowed MACRO-10 to understand and translate 6502 assembly, albeit in a modified format to fit the syntax of macros, for example: MOS 6502 Like the 8080 version, the 6502 version was developed on a PDP-10, using the MACRO-10 assembler. This is currently the oldest publicly available piece of source written by Bill Gates. You can find some sample programs in samples directory - these are some sample ROMs I used to test the emulator, including 4-bit operation of the LCD.This is the original 1978 source code of Microsoft BASIC for 6502 with all original comments, documentation and easter eggs: Please note: this is still work in progress: LCD shifting has not yet been implemented, 65C22 operation is currently very limited (just PORTA/PORTB/DDRA/DDRB), but I will be adding remaining features soon. You can also run the program much faster using the 圆502 -r rom.bin (-r switch) - it will prevent use of F5-F8 keys, but program will run much faster. Other keys are arrows and enter (wired to V1PORTA PA0-PA5, generate interrupt on state toggle), and for changing memory region displayed. Use F5 key to step, F6 to toggle to step mode or F7 for slow automatic and F8 for fast automatic mode.

This will start the emulator in single-stepping mode. build script, add the executable (圆502) to the path and run it like that (assuming that rom.bin is the ROM you would normally upload to EEPROM from address 0x8000): Screen initialized (see Bus Trace for details)Ĭompile using.

Sample LED alternating code, using 6522 PORTB to drive the lights: Please note: it's still work in progress, but all the programs so far (+ code using RAM and key-triggered interrupts) works just as it would have on the actual machine. To make things easier, I forked open source 6502 emulator (圆502) and changed it by making it fully binary compatible with the 6502 kit from Ben. As most of you must have noticed, code development for 6502 kit from Ben is actually not that easy - each time you change the code, you need to burn the ROM, test it, see what's wrong and try again.
