Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some improvements to the reverse engineered source and improved firmware #2

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
17ee206
* Improvements to make ROMIO area more readable and understandable, …
dmantione Oct 3, 2017
30c64be
* More Basic ROM adresses converted to more readable symbols
dmantione Oct 3, 2017
6505fcb
* Enhance Makefile
dmantione Oct 4, 2017
927a1c6
* Change hardcoded pointer to basic_keyword into symbol
dmantione Oct 4, 2017
583a903
* Off by 1
dmantione Oct 4, 2017
eb01052
* Document PAL/NTSC timing checks
dmantione Oct 5, 2017
d999bdb
* Document drive code for loading files and also a bit of the C64 I…
dmantione Oct 7, 2017
d1473fe
* Add page boundary check around tuple transmission in drive code.
dmantione Oct 7, 2017
15b973f
+ Better documentation of freezer entry & PSET command.
dmantione Jul 10, 2023
06af427
Merge branch 'master' of https://github.com/mist64/final_cartridge
dmantione Jul 10, 2023
6db41b6
* Make it compile again.
dmantione Jul 10, 2023
c6e3335
+ Document the jump to basic vector at $A000 in cartridge ROM.
dmantione Jul 10, 2023
b71eb3b
* Rearrange labels to correct place.
dmantione Jul 11, 2023
4b79958
* Document new_tokenize
dmantione Aug 19, 2023
a1b310e
+ Better documentation of freezer entry & PSET command.
dmantione Jul 10, 2023
c963042
* Add note where to find FC3 101% code.
dmantione May 25, 2024
9f9a208
* Make tape speeder code readable
dmantione May 25, 2024
175b78d
* Make it generate binary equal to original FC3 again.
dmantione May 25, 2024
c1684b6
* Make it generate binary equal to original FC3 again.
dmantione May 25, 2024
b62416c
+ Reconstruction of source code of bank3 low region ($8000..$9fff) …
dmantione Oct 13, 2024
40a3aec
+ Changes to existing files to get everything build correctly again…
dmantione Oct 13, 2024
dea16af
+ Enhance comments at top of files.
dmantione Oct 13, 2024
cc78606
* Make hard coded jump symbolic
dmantione Oct 13, 2024
1327deb
* Correct comment
dmantione Oct 13, 2024
f74a2e3
* Update README.md
dmantione Oct 13, 2024
37e7cbe
* Make it more symbolic
dmantione Oct 13, 2024
f8300f3
* Add some direct call symbols
dmantione Oct 13, 2024
cd3a5f5
** Make a label descriptive
dmantione Oct 13, 2024
079168d
* First step into decyphering the mysterycode.
dmantione Oct 13, 2024
0bf23c8
The mystery code indeed has to do with writing a reordered directory …
dmantione Oct 16, 2024
5067920
* Fix wrong label
dmantione Oct 16, 2024
7d2a2b8
+ Source code for the freezer menu
dmantione Oct 23, 2024
4fd8d39
+ Improve commenting and symbolization of freezer menu
dmantione Oct 24, 2024
4e8e8f1
* Vector identified as jump to printer settings window
dmantione Oct 25, 2024
d4a6707
+ Source code $A000..$BFFF of bank 3 (screenhot preparation and mys…
dmantione Oct 27, 2024
581e418
* Source code tweaks
dmantione Oct 30, 2024
551e6b8
* Make hardcoded address symbolic
dmantione Oct 31, 2024
164ec2d
* Further symbolization
dmantione Oct 31, 2024
d0e8916
* Fix code after merge.
dmantione Nov 2, 2024
17019be
+ More commenting and symbolization
dmantione Nov 1, 2024
17178e0
* Make hardcoded screenshot code size calculated
dmantione Nov 1, 2024
04ec7ac
* Symbolization of local variables.
dmantione Nov 1, 2024
15bcce5
* Further symbolization and commenting.
dmantione Nov 1, 2024
41be116
* Commenting and symbolization
dmantione Nov 1, 2024
1840b0d
* Make it identical to original firmware again.
dmantione Nov 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 44 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MACHINE ?= c64
AS=ca65
LD=ld65

ASFLAGS=--include-dir core -g
ASFLAGS=-g

ifeq ($(PROJECT), cartridge)
ASFLAGS+=-D CART_FC3=1
Expand All @@ -27,31 +27,59 @@ else
endif
endif

SOURCES=core/header.s core/vectors.s core/init.s core/basic.s core/drive.s core/desktop_helper.s core/speeder.s core/monitor.s core/wrappers.s core/junk.s core/editor.s core/printer.s core/format.s core/freezer.s core/persistent.s
SOURCES_B0=bank0/header.s bank0/vectors.s bank0/init.s bank0/basic.s bank0/drive.s bank0/desktop_helper.s bank0/speeder.s bank0/monitor.s bank0/wrappers.s bank0/editor.s bank0/printer.s bank0/format.s bank0/freezer.s bank0/persistent.s bank0/junk.s
SOURCES_B3=bank3/freezer_entry.s bank3/freezer_reset.s bank3/freezer_game.s bank3/freezer_backup.s bank3/screenshot.s bank3/persistent.s bank3/mysterycode.s bank3/desktop_helper2.s bank3/freezer_menu.s

DEPS=core/kernal.i core/persistent.i
DEPS=core/kernal.i bank0/persistent.i

OBJECTS=$(SOURCES:.s=.o)
OBJECTS_B0=$(SOURCES_B0:.s=.o)
OBJECTS_B3=$(SOURCES_B3:.s=.o)

all: fc3.bin
all: fc3full.crt

clean:
rm -f core/*.o projects/monitor/*.o projects/speeder/*.o *.bin *.prg *.hexdump
rm -f bank0/*.o bank3/*.o projects/monitor/*.o projects/speeder/*.o *.bin *.prg *.hexdump fc3full.bin fc3full.crt
make -C bank3/disk_backload clean
make -C bank3/tape_backload clean

test: fc3.bin
@dd if=bin/Final_Cartridge_3_1988-12.bin bs=16384 count=1 2> /dev/null | hexdump -C > fc3-orig.bin.hexdump
@hexdump -C fc3.bin > fc3.bin.hexdump
@diff -u fc3-orig.bin.hexdump fc3.bin.hexdump
bank3/disk_backload/backup_loader.prg:
make -C bank3/disk_backload

fc3.bin: $(OBJECTS) core/fc3.cfg
$(LD) -C core/fc3.cfg $(OBJECTS) -o $@
bank3/tape_backload/backup_loader.prg:
make -C bank3/tape_backload

monitor.prg: core/monitor.o projects/monitor/monitor_support.o projects/monitor/monitor.cfg
$(LD) -C projects/monitor/monitor.cfg core/monitor.o projects/monitor/monitor_support.o -o $@ -Ln labels.txt
testb0: bank0.bin
@dd if=bin/Final_Cartridge_3_1988-12.bin bs=16384 count=1 2> /dev/null | hexdump -C > fc3b0-orig.bin.hexdump
@hexdump -C bank0.bin > bank0.bin.hexdump
@diff -u fc3b0-orig.bin.hexdump bank0.bin.hexdump

speeder.prg: core/speeder.o projects/speeder/speeder_support.o projects/speeder/speeder.cfg
$(LD) -C projects/speeder/speeder.cfg core/speeder.o projects/speeder/speeder_support.o -o $@
testb3: bank3.bin
@dd if=bin/Final_Cartridge_3_1988-12.bin bs=16384 skip=3 count=1 2> /dev/null | hexdump -C > fc3b3-orig.bin.hexdump
@hexdump -C bank3.bin > bank3.bin.hexdump
@diff -u fc3b3-orig.bin.hexdump bank3.bin.hexdump

bank0.bin: $(OBJECTS_B0) bank0/bank0.cfg
$(LD) -mbank0.map -C bank0/bank0.cfg $(OBJECTS_B0) -o $@

bank3.bin: $(OBJECTS_B3) bank3/bank3.cfg
$(LD) -mbank3.map -C bank3/bank3.cfg $(OBJECTS_B3) -o $@

monitor.prg: bank0/monitor.o projects/monitor/monitor_support.o projects/monitor/monitor.cfg
$(LD) -C projects/monitor/monitor.cfg bank0/monitor.o projects/monitor/monitor_support.o -o $@ -Ln labels.txt

speeder.prg: bank0/speeder.o projects/speeder/speeder_support.o projects/speeder/speeder.cfg
$(LD) -C projects/speeder/speeder.cfg bank0/speeder.o projects/speeder/speeder_support.o -o $@

%.o: %.s $(DEPS)
$(AS) $(ASFLAGS) $< -o $@

bank3/freezer_backup.o: bank3/freezer_backup.s bank3/disk_backload/backup_loader.prg bank3/tape_backload/backup_loader.prg $(DEPS)
$(AS) $(ASFLAGS) $< -o $@

fc3full.bin: bank0.bin bank3.bin
cp bin/Final_Cartridge_3_1988-12.bin fc3full.bin
dd if=bank0.bin of=fc3full.bin bs=16384 count=1 conv=notrunc
dd if=bank3.bin of=fc3full.bin bs=16384 seek=3 count=1 conv=notrunc

fc3full.crt: fc3full.bin
cartconv -i fc3full.bin -o fc3full.crt -t fc3
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Note: The master branch contains source code for the original Final Cartridge III. The Final Cartridge III 101% source code can be found in the development branch.

# Final Cartridge

This project is the reverse-engineered and documented Commodore 64 cc65/ca65/cl65 assembly source code of the first bank of the "*Final Cartridge III*".
This project is the reverse-engineered and documented Commodore 64 cc65/ca65/cl65 assembly source code of the "*Final Cartridge III*". Currently source code of bank 0 and low part of bank 3 has been reconstructed.

When assembled, the resulting binary is identical with the 1988-12 version of bank 0 of the original cartridge ROM.
When assembled, the resulting binary is identical with the 1988-12 version of the original cartridge ROM.

## What is contained?

Bank 0 contains the BASIC and editor extensions, the floppy and tape speeder, fast format, the centronics printer driver, and the monitor. This project does not contain Desktop, the freezer or the BASIC menu bar.
Bank 0 contains the BASIC and editor extensions, the floppy and tape speeder, fast format, the centronics printer driver, and the monitor.

Bank 3 contains the freezer.

## Building

Expand Down
25 changes: 16 additions & 9 deletions core/fc3.cfg → bank0/bank0.cfg
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
MEMORY {
ROM0LO: start = $8000, size = $1E00, fill = yes, fillval = $ff, file = %O;
ROMIO: start = $9E00, size = $0200, fill = yes, fillval = $ff, file = %O;
ROMIO: start = $9E00, size = $01E8, fill = yes, fillval = $ff, file = %O;
ROMIO_BAR_IRQ: start = $9FE8, size = $0018, fill = yes, fillval = $ff, file = %O;
ROM0HI: start = $A000, size = $1FA0, fill = yes, fillval = $ff, file = %O;
ROM0TOP: start = $BFA0, size = $005A, fill = yes, fillval = $ff, file = %O;
ULTIMAX_VECTORS: start = $BFFA, size = $0006, fill = yes, fillval = $ff, file = %O;

L0220: start = $0220, size = $0060;
IO: start = $DE00, size = $0200;
BASIC: start = $0801, size = $97FF;
DRIVE4A: start = $0400, size = $0400;
DRIVE4B: start = $0400, size = $0400;
DRIVE5: start = $0500, size = $0300;
FREEZER: start = $FFA0, size = $005A;
L0100: start = $0100, size = $00FF;
L0220: start = $0220, size = $0060;
IO: start = $DE00, size = $01E8;
IO_BAR_IRQ: start = $DFE8, size = $0018;
BASIC: start = $0801, size = $97FF;
DRIVE4A: start = $0400, size = $0400;
DRIVE4B: start = $0400, size = $0400;
DRIVE5: start = $0500, size = $0300;
FREEZER: start = $FFA0, size = $005A;
L0100: start = $0100, size = $00FF;
}

SEGMENTS {
Expand All @@ -35,6 +37,7 @@ SEGMENTS {
drive_code_load: load = ROM0LO, run = DRIVE4B, type = ro, define = yes;

romio: load = ROMIO, run = IO, type = ro;
romio_bar_irq: load = ROMIO_BAR_IRQ, run = IO_BAR_IRQ, type = ro;

basic_vectors: load = ROM0HI, type = ro;
printer: load = ROM0HI, type = ro;
Expand All @@ -53,3 +56,7 @@ SEGMENTS {
freezer: load = ROM0TOP, run = FREEZER, type = ro;
freezer_vectors: load = ULTIMAX_VECTORS, type = ro;
}

SYMBOLS {
psettings: type=weak, value=$BFFA;
}
Loading