Having just finished my annotation of the Supermon64 sources (see viewtopic.php?f=2&t=4385), I'm looking for suggestions about what code I should read next. A few interesting alternatives I'm aware of:
- DurexForth https://github.com/jkotlinski/durexforth
- SpeedScript https://archive.org/details/Computes_Speedscript
- Spindle (Trackmo Loader by LFT) http://www.linusakesson.net/software/spindle/v2.php
- AppleDOS code http://www.computerhistory.org/atchm/ap ... urce-code/
- Microsoft 6502 Basic http://www.pagetable.com/?p=774
- The C64 rom http://www.pagetable.com/c64rom/c64rom_en.html
- Apple I Integer Basic https://github.com/jefftranter/6502/tre ... sm/a1basic
- Price of Persia: https://github.com/jmechner/Prince-of-Persia-Apple-II
- Tiny Basic: https://github.com/jefftranter/6502/tre ... /tinybasic
- Acorn's BBC Basic: http://8bs.com/basic/basic4.htm
I'd prefer to read the code for real applications, not snippets or trivial examples. However, I've found a few things that look interesting enough that I'll make an exception:
- Stuff on Codebase64: http://codebase64.org/doku.php
- 6502 Assembly Language Subroutines by Leventhal and Seville: https://archive.org/details/6502_Assemb ... ubroutines
I've already read through the 256 byte Woz monitor. I'm not necessarily opposed to another annotation project, but after Supermon64 I could stand some "light reading", so things that already have comments are fine too.
I'd really like to look at the source for some C64 demos but I'm not aware of many that have been released. I know I could dissassemble them but I'd rather start with something that at least has labels, and preferably comments to help guide me along.
I'm primarily focused on original 6502 sources for classic computers, but I wouldn't mind looking at newer 65C02 or 65C816 sources if they are noteworthy.
Good 6502 sources for reading
Good 6502 sources for reading
Last edited by jblang on Wed Jan 25, 2017 11:35 pm, edited 1 time in total.
Re: Good 6502 sources for reading
One of my favorites is the source code to Prince of Persia for the Apple IIe.
https://github.com/jmechner/Prince-of-Persia-Apple-II
https://github.com/jmechner/Prince-of-Persia-Apple-II
Cat; the other white meat.
Re: Good 6502 sources for reading
Maybe Tom Pitman's implementation of Tiny Basic which I think uses an inner interpreter:
https://github.com/jefftranter/6502/tre ... /tinybasic
Jeff Tranter has assembled(!) some other sources nearby.
Perhaps Acorn's BBC Basic:
http://8bs.com/basic/basic4.htm
https://github.com/jefftranter/6502/tre ... /tinybasic
Jeff Tranter has assembled(!) some other sources nearby.
Perhaps Acorn's BBC Basic:
http://8bs.com/basic/basic4.htm
Re: Good 6502 sources for reading
Thanks for the suggestions... added them to the list.
- jac_goudsmit
- Posts: 229
- Joined: 23 Jun 2011
- Location: Rancho Cucamonga, California
- Contact:
Re: Good 6502 sources for reading
There are two versions of Space Invaders for the PET: one that has graphics that look like little aliens, and starts up with a screen that shows you how to add sound to your PET.
The other one which I've always known as "space intruders" uses blocks to represent the aliens but has REALLY smooth movements because it uses the various graphics characters with different size blocks to move the aliens around. It also has a screen (written in Assembly if I remember correctly) that lets you adjust parameters (and cheat). See e.g. https://youtu.be/bNAS-fJpKaE?t=4m12s.
It only works on a PET with a v1 or v2 ROM; if you run it on a later CBM, the program stops with an error message because the BASIC part does a PEEK to check which ROM the machine has, uses the value in a calculation and then tries to poke it back, but ROMs other than the PET cause an overflow.
The machine language part of the program was hidden in some smart way: It loads from tape, but you can't see it when you do a LIST and if you try to save the program and load it back from tape, it won't work because a SAVE won't save the machine language part of the program.
I've always wondered how that program was written but right now I can't even find it online for downloading (the other Space Invaders is all over the place).
===Jac
The other one which I've always known as "space intruders" uses blocks to represent the aliens but has REALLY smooth movements because it uses the various graphics characters with different size blocks to move the aliens around. It also has a screen (written in Assembly if I remember correctly) that lets you adjust parameters (and cheat). See e.g. https://youtu.be/bNAS-fJpKaE?t=4m12s.
It only works on a PET with a v1 or v2 ROM; if you run it on a later CBM, the program stops with an error message because the BASIC part does a PEEK to check which ROM the machine has, uses the value in a calculation and then tries to poke it back, but ROMs other than the PET cause an overflow.
The machine language part of the program was hidden in some smart way: It loads from tape, but you can't see it when you do a LIST and if you try to save the program and load it back from tape, it won't work because a SAVE won't save the machine language part of the program.
I've always wondered how that program was written but right now I can't even find it online for downloading (the other Space Invaders is all over the place).
===Jac
Re: Good 6502 sources for reading
Might be interesting to read this recent disassembly of Thrust (for the Beeb)
https://github.com/kieranhj/thrust-disa ... hrust.6502
https://github.com/kieranhj/thrust-disa ... hrust.6502
-
White Flame
- Posts: 704
- Joined: 24 Jul 2012
Re: Good 6502 sources for reading
jac_goudsmit wrote:
The machine language part of the program was hidden in some smart way: It loads from tape, but you can't see it when you do a LIST and if you try to save the program and load it back from tape, it won't work because a SAVE won't save the machine language part of the program.
I've always wondered how that program was written but right now I can't even find it online for downloading (the other Space Invaders is all over the place).
I've always wondered how that program was written but right now I can't even find it online for downloading (the other Space Invaders is all over the place).
To build it, either the assembled binary file is appended onto the end of the BASIC program file as a file operation; or the BASIC and asm portions are both loaded into memory and saved together as 1 file (after POKEing the end of BASIC listing to an exaggerated address to include the ML, or saved from a resident ML monitor); or the assembly source code included the bytes for the BASIC launcher as effectively .byte directives inline. For that era, I would suspect option #2 was the most common.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Good 6502 sources for reading
jac_goudsmit wrote:
The machine language part of the program was hidden in some smart way: It loads from tape, but you can't see it when you do a LIST and if you try to save the program and load it back from tape, it won't work because a SAVE won't save the machine language part of the program.
At the time when the program was created, the save was from the machine language monitor so that memory beyond the end-of-BASIC-text address was saved along with the BASIC text. When a program of any kind is LOADed with LOAD "<prog name>" (tape) or LOAD "<prog name>",8 (disk), a relocating load will occur. Once the load from tape or disk has finished, the BASIC interpreter will set its end-of-text pointer to a null that immediately follows the tokenized form of SYS 2063. This action is part of the normal linking process performed once the program has been read into memory (starting at $0800 in the Commodore 64). Due to these actions on the part of BASIC, the only thing that will be seen when the program is LISTed will be SYS 2063, even though all of the following machine code was LOADed as well. Also, as the end-of-program-text pointer points to the end of the BASIC text, not the entire program, an attempt to SAVE the program will "fail," since only the BASIC text will be saved.
x86? We ain't got no x86. We don't NEED no stinking x86!
- jac_goudsmit
- Posts: 229
- Joined: 23 Jun 2011
- Location: Rancho Cucamonga, California
- Contact:
Re: Good 6502 sources for reading
I know how assembler programs were piggybacked to basic programs on the PET, I imagine many assembler programs were written completely in assembler and just had "org $400" (start of basic RAM on PET/CBM) followed by the bytes that represent the SYS instruction to jump into the machine language.
Space intruders (or whatever the official name is) had quite a few lines of basic preceding the ML part of the program, it wasn't just a single SYS instruction. Anyway in the days when I was interested in saving a version of the program that started with different parameters, I didn't know that "SAVE" in basic wouldn't save the machine language part, so I know I ruined someone's recording of the program at least once (sorry Mr Verschuren). Fortunately he had a backup.
Space intruders (or whatever the official name is) had quite a few lines of basic preceding the ML part of the program, it wasn't just a single SYS instruction. Anyway in the days when I was interested in saving a version of the program that started with different parameters, I didn't know that "SAVE" in basic wouldn't save the machine language part, so I know I ruined someone's recording of the program at least once (sorry Mr Verschuren). Fortunately he had a backup.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Good 6502 sources for reading
Bob Bishop's "AppleVision" mixed a substantial amount of Integer BASIC and ML as well ... it was very clever and a bit tricky ... so tricky that I never completely understood how he did it, although I was able to track down his hi-res character generator code and use it as an inspiration for my own versions.
https://www.youtube.com/watch?v=RiWE-aO-cyU
Mike B.
https://www.youtube.com/watch?v=RiWE-aO-cyU
Mike B.