Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.inc linguist-language=Assembly
*.s linguist-language=Assembly
*.asm linguist-language=Assembly
Makefile.* linguist-language=Makefile
Makefile linguist-language=Makefile
*.bin linguist-language=Binary
*.prg linguist-language=Binary
*.d64 linguist-language=Binary
*.D64 linguist-language=Binary
*.d81 linguist-language=Binary
*.D81 linguist-language=Binary
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GEOS64.D64
desktop.cvt
.*.swp
*.o
/*.bin
*.prg
*.d64
*.d81
/desktop.cvt
/kernal.map
/GEOS64.D64
/GEOS64.D81
build
45 changes: 42 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ INPUT ?= joydrv
AS = ca65
LD = ld65
C1541 = c1541
EXOMIZER = exomizer
PUCRUNCH = pucrunch
D64_TEMPLATE = GEOS64.D64
D64_RESULT = geos.d64
D81_TEMPLATE = GEOS64.D81
D81_RESULT = geos.d81
DESKTOP_CVT = desktop.cvt

ASFLAGS = -I inc -I .
Expand Down Expand Up @@ -58,6 +61,8 @@ KERNAL_SOURCES= \
kernal/wheels/loadb.s \
kernal/wheels/tobasicb.s \
kernal/wheels/reux.s \
kernal/vars.s \
c65/start.s

DRIVER_SOURCES= \
drv/drv1541.bin \
Expand All @@ -71,6 +76,7 @@ DRIVER_SOURCES= \
input/pcanalog.bin

DEPS= \
Makefile \
config.inc \
inc/c64.inc \
inc/const.inc \
Expand All @@ -95,6 +101,7 @@ ALL_BINS= \
$(BUILD_DIR)/drv/drv1541.bin \
$(BUILD_DIR)/drv/drv1571.bin \
$(BUILD_DIR)/drv/drv1581.bin \
$(BUILD_DIR)/drv/drvf011.bin \
$(BUILD_DIR)/input/joydrv.bin \
$(BUILD_DIR)/input/amigamse.bin \
$(BUILD_DIR)/input/lightpen.bin \
Expand All @@ -103,7 +110,7 @@ ALL_BINS= \
$(BUILD_DIR)/input/pcanalog.bin


all: $(BUILD_DIR)/$(D64_RESULT)
all: $(BUILD_DIR)/$(D64_RESULT) $(BUILD_DIR)/$(D81_RESULT)

regress:
@echo "********** Building variant 'bsw'"
Expand All @@ -129,9 +136,30 @@ $(BUILD_DIR)/$(D64_RESULT): $(BUILD_DIR)/kernal_compressed.prg
echo \*\*\* Created fresh $@.; \
fi;

$(BUILD_DIR)/kernal_compressed.prg: $(BUILD_DIR)/kernal_combined.prg
$(D81_RESULT): compressed.prg compressed_c65.prg
if [ -s $(D81_TEMPLATE) ]; then \
cp $(D81_TEMPLATE) $(D81_RESULT); \
echo 'delete geos geoboot configure "geos kernal"' | $(C1541) $(D81_RESULT) >/dev/null; \
echo write compressed.prg geos | $(C1541) $(D81_RESULT) >/dev/null; \
echo write compressed_c65.prg geos65 | $(C1541) $(D81_RESULT) >/dev/null; \
echo \*\*\* Created $(D81_RESULT) based on $(D81_TEMPLATE).; \
else \
rm -f $(D81_RESULT); \
echo format geos,00 d81 $(D81_RESULT) | $(C1541) >/dev/null; \
echo write compressed.prg geos | $(C1541) $(D81_RESULT) >/dev/null; \
echo write compressed_c65.prg geos65 | $(C1541) $(D81_RESULT) >/dev/null; \
if [ -e desktop.cvt ]; then echo geoswrite desktop.cvt | $(C1541) $(D81_RESULT); fi >/dev/null; \
echo \*\*\* Created fresh $(D81_RESULT).; \
fi;

(BUILD_DIR)/kernal_compressed.prg: $(BUILD_DIR)/kernal_combined.prg
@echo Creating $@
$(PUCRUNCH) -f -c64 -x0x5000 $< $@ 2> /dev/null

compressed_c65.prg: compressed.bin c65/uncrunch.o c65/loader.o
$(LD) -C c65/loader.cfg c65/loader.o c65/uncrunch.o -o $@

compressed.prg: combined.prg
$(PUCRUNCH) +f -c64 -x0x5000 $< $@

$(BUILD_DIR)/kernal_combined.prg: $(ALL_BINS)
@echo Creating $@ from kernal.bin $(DRIVE).bin $(INPUT).bin
Expand All @@ -142,6 +170,9 @@ $(BUILD_DIR)/kernal_combined.prg: $(ALL_BINS)
@cat $(BUILD_DIR)/input/$(INPUT).bin >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@mv $(BUILD_DIR)/tmp.bin $(BUILD_DIR)/kernal_combined.prg

compressed.bin: combined.bin
$(EXOMIZER) mem $<,0x5002 -o $@

$(BUILD_DIR)/drv/drv1541.bin: $(BUILD_DIR)/drv/drv1541.o drv/drv1541.cfg $(DEPS)
$(LD) -C drv/drv1541.cfg $(BUILD_DIR)/drv/drv1541.o -o $@

Expand All @@ -151,6 +182,9 @@ $(BUILD_DIR)/drv/drv1571.bin: $(BUILD_DIR)/drv/drv1571.o drv/drv1571.cfg $(DEPS)
$(BUILD_DIR)/drv/drv1581.bin: $(BUILD_DIR)/drv/drv1581.o drv/drv1581.cfg $(DEPS)
$(LD) -C drv/drv1581.cfg $(BUILD_DIR)/drv/drv1581.o -o $@

$(BUILD_DIR)/drv/drvf011.bin: $(BUILD_DIR)/drv/drvf011.o drv/drvf011.cfg $(DEPS)
$(LD) -C drv/drvf011.cfg $(BUILD_DIR)/drv/drvf011.o -o $@

$(BUILD_DIR)/input/amigamse.bin: $(BUILD_DIR)/input/amigamse.o input/amigamse.cfg $(DEPS)
$(LD) -C input/amigamse.cfg $(BUILD_DIR)/input/amigamse.o -o $@

Expand Down Expand Up @@ -180,3 +214,8 @@ $(BUILD_DIR)/kernal/kernal.bin: $(PREFIXED_KERNAL_OBJS) kernal/kernal_$(VARIANT)
# a must!
love:
@echo "Not war, eh?"
the:
@echo "Just read the .PHONY line in Makefile ;-)"

.PHONY:
clean all the love
4 changes: 4 additions & 0 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

by Berkeley Softworks, reverse engineered by *Maciej Witkowiak*, *Michael Steil*.

## Branch

This branch of the code forms my playground for testing different MEGA65 integration strategies.

## Description

[GEOS](https://en.wikipedia.org/wiki/GEOS_(8-bit_operating_system)) is a **graphical user interface for 6502-based computers**. In the 1980s, it was commercially available for the **Commodore 64**, 128 and Plus/4 as well as the Apple II.
Expand Down
49 changes: 49 additions & 0 deletions c65/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Commodore-65 / Mega65

Now, for C65 build, you need CA65 (from the CC65 package) which knowns about
65CE02/4510 opcodes, maybe the GIT version from github.org. Thus file
`c65/c65.inc` is gone which had some intent to provide several 65CE02 opcodes
for the old CA65 versions.

## Loader

`c65/loader.s` and `c65/loader.cfg` are the source and LD65 linker configuration
file for the C65 loader, which is a standard "BASIC stub" loader must be started
from C65 mode (**not from C64 mode **). It does:

* standard BASIC "SYS stub" stuff, also used BANK 0
* turn fancy C65 memory mappings (`MAP`, VIC-III port $30, std CPU port ...) off
* uses exomizer's decruncher routine to derunch compressed GEOS kernal image.
Exomizer is used, as - at least for me - pucrunch didn't worked because of the
overlap between the compressed kernal and the uncompressing target area (on
C65, the BASIC are starts at a higher address than on C64), I have no idea if
pucrunch supports backward uncrunching at all to avoid this problem. Also
exomizer seems to give a better result of compression, so the situation is
good enough for me. File `uncrunch.s` is simply the source of the Exomizer's
uncrunch routine, with the settings we need.

## Kernal

`c65/start.s` is an extension of the "purgeable init code" from address $5000.
Call to `InitC65` is done from `kernal/start.s`. Because I liked the idea to be
able to be complied with `trap=1` as well in `config.inc`, I used another memory
segment (modified `kernal/kernal.cfg`) and the C65 specific stuff purges itself
after its turn, giving control back to `_ResetHandle` which should found the
original state.

Currently this code does almost nothing, later it can do more (ie, M65 detection
and change disk driver to M65 specific one, so C65 is also supported this way
still).

## Makefile and building

Makefile was modified by me for *my* taste :-) Also the "glue" of binary fragments
done with the assembler itself, so the config.inc can be used to customize this
process, instead of hacking the Makefile ... Modifications: `Makefile` and
new file `constructor.s` in the top directory.

## Disk driver code

Well, that's simply borrowed from here: https://github.com/frehwagen/geos

Source is `c65/drvf011.s`, LD65 linker configuration file is `c65/drvf011.s`.
7 changes: 7 additions & 0 deletions c65/drvf011.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MEMORY {
DISK_BASE: start = $9000, size = $0D80 file = %O;
}

SEGMENTS {
drvf011: load = DISK_BASE, type = ro;
}
Loading