1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-10 19:29:45 +00:00

Merge remote-tracking branch 'upstream/master' into a5200

This commit is contained in:
Christian Groessler 2014-03-20 00:24:11 +01:00
commit f266612697
542 changed files with 817 additions and 2121 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/html/
/joy/
/lib/
/libwrk/
/mou/
/ser/
/targetutil/

View File

@ -1,11 +1,15 @@
language:
- c
install:
- sudo apt-get install linuxdoc-tools linuxdoc-tools-info
- sudo apt-get install linuxdoc-tools linuxdoc-tools-info binutils-mingw-w64-i686 gcc-mingw-w64-i686
script:
- make all doc
- make bin USER_CFLAGS=-Werror
- make lib QUIET=1
- make -C src clean
- make bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32-
- make doc zip
after_success:
- make -C doc gh-pages
- make -f Makefile.gh-pages
env:
global:
- secure: "h+hoQdEHGPLNwaqGKmSaM8NBRDLc2X+W05VsnNG2Feq/wPv/AiBjONNlzN7jRf6D6f3aoPXaQ2Lc3bYWdxGvFRCmwiofdxkJI9n5L8HPHLZ2lf37MQsXmGJzoTFOvjPLj73H6HlbI9Ux0El3zO6hvalxiXj6TfoZ41dbhNyvpYk="

View File

@ -1,8 +1,8 @@
.PHONY: all mostlyclean clean install avail unavail bin lib doc
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc
.SUFFIXES:
all mostlyclean clean install:
all mostlyclean clean install zip:
@$(MAKE) -C src --no-print-directory $@
@$(MAKE) -C libsrc --no-print-directory $@
@$(MAKE) -C doc --no-print-directory $@

21
Makefile.gh-pages Normal file
View File

@ -0,0 +1,21 @@
.PHONY: all
.SUFFIXES:
GH_PAGES = ../gh-pages
all:
echo $(TRAVIS_COMMIT) | zip -z cc65
ifdef GH_TOKEN
git clone --branch=gh-pages https://$(GH_TOKEN)@github.com/cc65/cc65.git $(GH_PAGES)
cd $(GH_PAGES) && git config user.name "Oliver Schmidt"
cd $(GH_PAGES) && git config user.email "ol.sc@web.de"
cd $(GH_PAGES) && git config push.default simple
cd $(GH_PAGES) && $(RM) -r doc download
cd $(GH_PAGES) && mkdir doc download
cp html/*.* $(GH_PAGES)/doc
cp cc65.zip $(GH_PAGES)/download/cc65-snapshot-win32.zip
cd $(GH_PAGES) && git add -A doc download
cd $(GH_PAGES) && git commit -m "Updated from commit $(TRAVIS_COMMIT)."
cd $(GH_PAGES) && git push
endif

View File

@ -1,6 +1,6 @@
[documentation](http://oliverschmidt.github.io/cc65/doc)
[documentation](http://cc65.github.io/cc65/doc)
[![build status](https://travis-ci.org/oliverschmidt/cc65.png)](https://travis-ci.org/oliverschmidt/cc65/builds)
[![build status](https://travis-ci.org/cc65/cc65.png)](https://travis-ci.org/cc65/cc65/builds)
cc65 is a complete cross development package for 65(C)02 systems, including
a powerful macro assembler, a C compiler, linker, librarian and several

40
cfg/atari-cassette.cfg Normal file
View File

@ -0,0 +1,40 @@
FEATURES {
STARTADDRESS: default = $0900;
}
SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__RESERVED_MEMORY__: type = weak, value = $0000;
__STARTADDRESS__: type = export, value = %S;
_cas_hdr: type = import;
}
MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E;
RAM: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
}
SEGMENTS {
CASHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro, define = yes, optional = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, optional = yes;
DATA: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes, optional = yes;
ZEROPAGE: load = ZP, type = zp, optional = yes;
EXTZP: load = ZP, type = zp, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = INIT;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}

View File

@ -12,7 +12,7 @@ MEMORY {
SEGMENTS {
BLLHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, optional = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;

View File

@ -18,7 +18,7 @@ SEGMENTS {
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, optional = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;

View File

@ -20,7 +20,7 @@ SEGMENTS {
BOOTLDR: load = BOOT, type = ro;
DIRECTORY:load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, optional = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;

View File

@ -18,7 +18,7 @@ SEGMENTS {
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, optional = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;

View File

@ -1,8 +1,18 @@
.PHONY: all doc html info gh-pages mostlyclean clean install
ifneq ($(shell echo),)
CMD_EXE = 1
endif
.PHONY: all mostlyclean clean install zip doc html info gh-pages
.SUFFIXES:
ifeq ($(shell echo),)
all mostlyclean install:
ifdef CMD_EXE
clean zip doc:
else # CMD_EXE
SGMLS := $(wildcard *.sgml)
@ -11,9 +21,11 @@ TOC_LEVEL = 0
TOC_LEVEL = 2
GH_PAGES = ../../gh-pages
clean:
$(RM) -r ../html ../info
all:
zip:
@cd .. && zip cc65 html/*.*
doc: html info
@ -21,11 +33,6 @@ html: $(addprefix ../html/,$(SGMLS:.sgml=.html) doc.css doc.png)
info: $(addprefix ../info/,$(SGMLS:.sgml=.info))
mostlyclean:
clean:
$(RM) -r ../html ../info
../html ../info:
@mkdir $@
@ -38,22 +45,4 @@ clean:
../info/%.info: %.sgml | ../info
@cd ../info && linuxdoc -B info ../doc/$<
gh-pages: html
ifdef GH_TOKEN
git clone --branch=gh-pages https://$(GH_TOKEN)@github.com/oliverschmidt/cc65.git $(GH_PAGES)
git --work-tree=$(GH_PAGES) --git-dir=$(GH_PAGES)/.git config user.name "Oliver Schmidt"
git --work-tree=$(GH_PAGES) --git-dir=$(GH_PAGES)/.git config user.email "ol.sc@web.de"
git --work-tree=$(GH_PAGES) --git-dir=$(GH_PAGES)/.git config push.default simple
$(RM) -r $(GH_PAGES)/doc
mkdir $(GH_PAGES)/doc
cp ../html/* $(GH_PAGES)/doc
git --work-tree=$(GH_PAGES) --git-dir=$(GH_PAGES)/.git add -A doc
-git --work-tree=$(GH_PAGES) --git-dir=$(GH_PAGES)/.git commit -m "Updated doc from commit $(TRAVIS_COMMIT)."
git --work-tree=$(GH_PAGES) --git-dir=$(GH_PAGES)/.git push
endif
else # cmd.exe
all doc mostlyclean clean install:
endif # cmd.exe
endif # CMD_EXE

View File

@ -45,7 +45,7 @@ containing DOS 3.3 as well as ProDOS 8.
For ProDOS 8 system programs the load address is fixed to &dollar;2000 so there
is no need for a header. Thus the linker configuration
<htmlurl url="apple2-4.html#ss4.3" name="apple2-system.cfg"> for those programs
<htmlurl url="apple2.html#ss4.3" name="apple2-system.cfg"> for those programs
omits the DOS 3.3 header. The right AppleCommander option to put system files
without a header on a ProDOS 8 disk image is <tt/-p/.
@ -81,7 +81,7 @@ cc65 runtime system takes care of actually moving the code into the Language
Card.
The amount of memory available in the Language Card for generated code depends
on the chosen <htmlurl url="apple2-4.html" name="linker configuration">.
on the chosen <htmlurl url="apple2.html#s4" name="linker configuration">.
@ -231,10 +231,9 @@ range.
The easiest (and for really large programs in fact the only) way to have a cc65
program use the memory from &dollar;800 to &dollar;2000 is to link it as binary
(as opposed to system) program using the linker configuration
<htmlurl url="apple2-4.html#ss4.4" name="apple2-loader.cfg"> with start address
&dollar;800 and load it with <bf/LOADER.SYSTEM - an Apple&nbsp;&rsqb;&lsqb;
ProDOS 8 loader for cc65 programs/. The program then works like a system program
(i.e. quits to the ProDOS dispatcher).
<htmlurl url="apple2.html#ss4.4" name="apple2-loader.cfg"> with start address
&dollar;803 and load it with the targetutil LOADER.SYSTEM. The program then works
like a system program (i.e. quits to the ProDOS dispatcher).
Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the
program to load under name &lt;program&gt;.SYSTEM as a system program. For
@ -244,7 +243,7 @@ example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/.
<sect1>Heap<p>
If the cc65 program can be successfully linked as system program using the linker
configuration <htmlurl url="apple2-4.html#ss4.3" name="apple2-system.cfg"> but
configuration <htmlurl url="apple2.html#ss4.3" name="apple2-system.cfg"> but
uses the heap either explicitly or implicitly (i.e. by loading a driver) then
the memory from &dollar;800 to &dollar;2000 can be added to the heap by calling
<tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/.
@ -487,7 +486,7 @@ url="ca65.html" name="assembler manual">.
<descrip>
<tag/Drive ID/
The function <htmlurl url="dio-1.html" name="dio_open()"> has the single
The function <htmlurl url="dio.html#s1" name="dio_open()"> has the single
parameter <tt/device/ to identify the device to be opened. Therefore an
Apple&nbsp;II slot and drive pair is mapped to that <tt/device/ according
to the formula
@ -499,7 +498,7 @@ url="ca65.html" name="assembler manual">.
so that for example slot 6 drive 2 is mapped to <tt/device/ 14.
<tag/Sector count/
The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns
The function <htmlurl url="dio.html#s3" name="dio_query_sectcount()"> returns
the correct sector count for all ProDOS 8 disks. However for any non-ProDOS 8
disk it simply always returns 280 (which is only correct for a 140 KB disk).
This condition is indicated by the <tt/_oserror/ value 82.

View File

@ -45,7 +45,7 @@ containing DOS 3.3 as well as ProDOS 8.
For ProDOS 8 system programs the load address is fixed to &dollar;2000 so there
is no need for a header. Thus the linker configuration
<htmlurl url="apple2enh-4.html#ss4.3" name="apple2enh-system.cfg"> for those programs
<htmlurl url="apple2enh.html#ss4.3" name="apple2enh-system.cfg"> for those programs
omits the DOS 3.3 header. The right AppleCommander option to put system files
without a header on a ProDOS 8 disk image is <tt/-p/.
@ -81,7 +81,7 @@ cc65 runtime system takes care of actually moving the code into the Language
Card.
The amount of memory available in the Language Card for generated code depends
on the chosen <htmlurl url="apple2enh-4.html" name="linker configuration">.
on the chosen <htmlurl url="apple2enh.html#s4" name="linker configuration">.
@ -231,10 +231,9 @@ range.
The easiest (and for really large programs in fact the only) way to have a cc65
program use the memory from &dollar;800 to &dollar;2000 is to link it as binary
(as opposed to system) program using the linker configuration
<htmlurl url="apple2enh-4.html#ss4.4" name="apple2enh-loader.cfg"> with start address
&dollar;800 and load it with <bf/LOADER.SYSTEM - an Apple&nbsp;&rsqb;&lsqb;
ProDOS 8 loader for cc65 programs/. The program then works like a system program
(i.e. quits to the ProDOS dispatcher).
<htmlurl url="apple2enh.html#ss4.4" name="apple2enh-loader.cfg"> with start address
&dollar;803 and load it with the targetutil LOADER.SYSTEM. The program then works
like a system program (i.e. quits to the ProDOS dispatcher).
Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the
program to load under name &lt;program&gt;.SYSTEM as a system program. For
@ -244,7 +243,7 @@ example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/.
<sect1>Heap<p>
If the cc65 program can be successfully linked as system program using the linker
configuration <htmlurl url="apple2enh-4.html#ss4.3" name="apple2enh-system.cfg"> but
configuration <htmlurl url="apple2enh.html#ss4.3" name="apple2enh-system.cfg"> but
uses the heap either explicitly or implicitly (i.e. by loading a driver) then
the memory from &dollar;800 to &dollar;2000 can be added to the heap by calling
<tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/.
@ -493,7 +492,7 @@ url="ca65.html" name="assembler manual">.
<descrip>
<tag/Drive ID/
The function <htmlurl url="dio-1.html" name="dio_open()"> has the single
The function <htmlurl url="dio.html#s1" name="dio_open()"> has the single
parameter <tt/device/ to identify the device to be opened. Therefore an
Apple&nbsp;II slot and drive pair is mapped to that <tt/drive_id/ according
to the formula
@ -505,7 +504,7 @@ url="ca65.html" name="assembler manual">.
so that for example slot 6 drive 2 is mapped to <tt/device/ 14.
<tag/Sector count/
The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns
The function <htmlurl url="dio.html#s3" name="dio_query_sectcount()"> returns
the correct sector count for all ProDOS 8 disks. However for any non-ProDOS 8
disk it simply always returns 280 (which is only correct for a 140 KB disk).
This condition is indicated by the <tt/_oserror/ value 82.

View File

@ -221,6 +221,16 @@ that the cartridge doesn't prevent the booting of DOS.
The option byte will be located at address &dollar;BFFD. For more information
about its use, see e.g. "Mapping the Atari".
<sect2><tt/atari-cassette.cfg/<p>
This config file can be used to create cassette boot files. It's suited both
for C and assembly language programs.
The size of a cassette boot file is restricted to 32K. Larger programs
would need to be split in more parts and the parts to be loaded manually.
To write the generated file to a cassette, a utility to run
on an Atari is provided in the <tt/targetutil/ directory (<tt/w2cas.com/).
<sect1><tt/atarixl/ config files<p>

View File

@ -1263,14 +1263,14 @@ writable.
Reading this pseudo variable will give the assembler version according to
the following formula:
VER_MAJOR*$100 + VER_MINOR*$10 + VER_PATCH
VER_MAJOR*$100 + VER_MINOR*$10
It may be used to encode the assembler version or check the assembler for
special features not available with older versions.
Example:
Version 2.11.1 of the assembler will return $2B1 as numerical constant when
Version 2.14 of the assembler will return $2E0 as numerical constant when
reading the pseudo variable <tt/.VERSION/.

View File

@ -749,8 +749,8 @@ The compiler defines several macros at startup:
<tag><tt>__CC65__</tt></tag>
This macro is always defined. Its value is the version number of the
compiler in hex. For example, version 2.10.1 of the compiler has this macro
defined as <tt/0x02A1/.
compiler in hex. For example, version 2.14 of the compiler has this macro
defined as <tt/0x02E0/.
<tag><tt>__CC65_STD__</tt></tag>

View File

@ -178,7 +178,7 @@ GEOS support in cc65 is based on the <em/Convert v2.5/ format, well-known in
the GEOS world. It means that each file built with the cc65 package has to be
deconverted in GEOS, before it can be run. You can read a step-by-step
description of that in the <url name="GEOS section of the cc65 Compiler Intro"
url="intro-6.html#ss6.5">.
url="intro.html#ss6.5">.
Each project consists of four parts, two are provided by cc65. Those parts
are:<enum>

View File

@ -129,7 +129,7 @@ extern void c128_reu_emd[];
extern void c128_vdc_emd[];
extern void c128_ptvjoy_joy[];
extern void c128_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void c128_1351_mous[]; /* Referred to by mouse_static_stddrv[] */
extern void c128_1351_mou[]; /* Referred to by mouse_static_stddrv[] */
extern void c128_joy_mou[];
extern void c128_inkwell_mou[];
extern void c128_pot_mou[];

View File

@ -1,3 +1,7 @@
ifneq ($(shell echo),)
CMD_EXE = 1
endif
CBMS = c128 \
c16 \
c64 \
@ -30,6 +34,27 @@ DRVTYPES = emd \
ser \
tgi
OUTPUTDIRS := lib \
$(DRVTYPES) \
targetutil \
asminc \
cfg \
include \
$(subst ../,,$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)))
.PHONY: all mostlyclean clean install zip lib $(TARGETS)
.SUFFIXES:
ifdef CMD_EXE
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
MKDIR = mkdir $(subst /,\,$1)
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
else
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif
# Every target requires its individual vpath setting but the vpath directive
# acts globally. Therefore each target is built in a separate make instance.
@ -39,60 +64,55 @@ ifeq ($(words $(MAKECMDGOALS)),1)
endif
endif
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
ifeq ($(shell echo),)
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
else
MKDIR = mkdir $(subst /,\,$1)
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
endif
.SUFFIXES:
.PHONY: all lib $(TARGETS) mostlyclean clean install
ifndef TARGET
datadir = $(prefix)/share/cc65
INSTALLDIRS = ../asminc ../cfg ../include \
$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)) \
../lib ../targetutil $(addprefix ../,$(DRVTYPES))
INSTALL = install
all lib: $(TARGETS)
$(TARGETS):
@$(MAKE) --no-print-directory $@
mostlyclean:
$(call RMDIR,../wrk)
$(call RMDIR,../libwrk)
clean:
$(call RMDIR,../wrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES)))
$(call RMDIR,../libwrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES)))
ifdef CMD_EXE
install:
$(foreach dir,$(INSTALLDIRS),$(INSTALL_recipe))
##########
else # CMD_EXE
INSTALL = install
define INSTALL_recipe
$(if $(prefix),,$(error variable `prefix' must be set))
$(INSTALL) -d $(subst ..,$(DESTDIR)$(datadir),$(dir))
$(INSTALL) -m644 $(dir)/*.* $(subst ..,$(DESTDIR)$(datadir),$(dir))
$(INSTALL) -d $(DESTDIR)$(datadir)/$(dir)
$(INSTALL) -m644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir)
endef
endef # INSTALL_recipe
##########
install:
$(foreach dir,$(OUTPUTDIRS),$(INSTALL_recipe))
endif # CMD_EXE
define ZIP_recipe
@cd .. && zip cc65 $(dir)/*.*
endef # ZIP_recipe
zip:
$(foreach dir,$(OUTPUTDIRS),$(ZIP_recipe))
$(TARGETS):
@$(MAKE) --no-print-directory $@
else # TARGET
CA65FLAGS =
CC65FLAGS = -Osir -W error
CC65FLAGS = -Or -W error
EXTZP = cbm510 \
cbm610 \
@ -100,9 +120,12 @@ EXTZP = cbm510 \
MKINC = $(GEOS) \
atari \
atarixl \
nes
TARGETUTIL = apple2 \
TARGETUTIL = apple2 \
apple2enh \
atari \
geos-apple
GEOSDIRS = common \
@ -160,7 +183,7 @@ vpath %.c $(SRCDIRS)
OBJS := $(patsubst %.s,%.o,$(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.s)))
OBJS += $(patsubst %.c,%.o,$(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c)))
OBJS := $(addprefix ../wrk/$(TARGET)/,$(sort $(notdir $(OBJS))))
OBJS := $(addprefix ../libwrk/$(TARGET)/,$(sort $(notdir $(OBJS))))
DEPS = $(OBJS:.o=.d)
@ -168,30 +191,28 @@ EXTRA_SRCPAT = $(SRCDIR)/extra/%.s
EXTRA_OBJPAT = ../lib/$(TARGET)-%.o
EXTRA_OBJS := $(patsubst $(EXTRA_SRCPAT),$(EXTRA_OBJPAT),$(wildcard $(SRCDIR)/extra/*.s))
ZPOBJ = ../wrk/$(TARGET)/zeropage.o
ZPOBJ = ../libwrk/$(TARGET)/zeropage.o
ifeq ($(TARGET),$(filter $(TARGET),$(EXTZP)))
ZPOBJ += ../wrk/$(TARGET)/extzp.o
ZPOBJ += ../libwrk/$(TARGET)/extzp.o
endif
ifeq ($(SRCDIR),$(filter $(SRCDIR),$(MKINC)))
ifeq ($(TARGET),$(filter $(TARGET),$(MKINC)))
include $(SRCDIR)/Makefile.inc
endif
ifeq ($(SRCDIR),$(filter $(SRCDIR),$(TARGETUTIL)))
ifeq ($(TARGET),$(filter $(TARGET),$(TARGETUTIL)))
include $(SRCDIR)/targetutil/Makefile.inc
endif
##########
define DRVTYPE_template
$1_SRCDIR = $$(SRCDIR)/$1
$1_OBJDIR = ../wrk/$$(TARGET)/$1
$1_OBJDIR = ../libwrk/$$(TARGET)/$1
$1_DRVDIR = ../$1
$1_OBJPAT = $$($1_OBJDIR)/$$(OBJPFX)%.o
$1_DRVPAT = $$($1_DRVDIR)/$$(DRVPFX)%.$1
$1_STCPAT = ../wrk/$$(TARGET)/$$(DRVPFX)%-$1.o
$1_STCPAT = ../libwrk/$$(TARGET)/$$(DRVPFX)%-$1.o
$1_OBJS := $$(patsubst $$($1_SRCDIR)/%.s,$$($1_OBJDIR)/%.o,$$(wildcard $$($1_SRCDIR)/*.s))
@ -219,9 +240,7 @@ OBJS += $$($1_STCS)
DEPS += $$($1_OBJS:.o=.d)
endef
##########
endef # DRVTYPE_template
$(foreach drvtype,$(DRVTYPES),$(eval $(call DRVTYPE_template,$(drvtype))))
@ -233,31 +252,25 @@ LD65 := $(if $(wildcard ../bin/ld65*),../bin/ld65,ld65)
export CC65_HOME := $(abspath ..)
##########
define ASSEMBLE_recipe
$(if $(TRAVIS),,@echo $(TARGET) - $<)
$(if $(QUIET),,@echo $(TARGET) - $<)
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
endef
##########
endef # ASSEMBLE_recipe
define COMPILE_recipe
$(if $(TRAVIS),,@echo $(TARGET) - $<)
$(if $(QUIET),,@echo $(TARGET) - $<)
@$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
@$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
endef
endef # COMPILE_recipe
##########
../wrk/$(TARGET)/%.o: %.s | ../wrk/$(TARGET)
../libwrk/$(TARGET)/%.o: %.s | ../libwrk/$(TARGET)
$(ASSEMBLE_recipe)
../wrk/$(TARGET)/%.o: %.c | ../wrk/$(TARGET)
../libwrk/$(TARGET)/%.o: %.c | ../libwrk/$(TARGET)
$(COMPILE_recipe)
$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../lib
@ -267,7 +280,7 @@ $(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../lib
../lib/$(TARGET).lib: $(OBJS) | ../lib
$(AR65) a $@ $?
../wrk/$(TARGET) ../lib ../targetutil:
../libwrk/$(TARGET) ../lib ../targetutil:
@$(call MKDIR,$@)
$(TARGET): $(EXTRA_OBJS) ../lib/$(TARGET).lib

View File

@ -1,9 +1,9 @@
DEPS += ../wrk/$(TARGET)/loader.d
DEPS += ../libwrk/$(TARGET)/loader.d
../wrk/$(TARGET)/loader.o: $(SRCDIR)/targetutil/loader.s | ../wrk/$(TARGET)
../libwrk/$(TARGET)/loader.o: $(SRCDIR)/targetutil/loader.s | ../libwrk/$(TARGET)
$(ASSEMBLE_recipe)
../targetutil/loader.system: ../wrk/$(TARGET)/loader.o $(SRCDIR)/targetutil/loader.cfg | ../targetutil
../targetutil/loader.system: ../libwrk/$(TARGET)/loader.o $(SRCDIR)/targetutil/loader.cfg | ../targetutil
$(LD65) -o $@ -C $(filter %.cfg,$^) $(filter-out %.cfg,$^)
$(TARGET): ../targetutil/loader.system

View File

@ -1,80 +0,0 @@
LOADER.SYSTEM - an Apple][ ProDOS 8 loader for cc65 programs (Oliver Schmidt)
=============================================================================
Background
----------
Apple][ ProDOS 8 system programs (filetype SYS) are always loaded into memory
starting at location $2000. This poses the problem of how to make efficient
use of the memory in the range $0800-$2000. The usual approach of relocation
has two downsides:
- Relocating e.g. 30 kB from $2000-$9800 to $0800-$8000 takes a considerable
amount of time.
- Really large programs just don't fit into memory when loaded starting at
location $2000.
The relocation can be eliminated by loading the major part(s) of the program
from disk right to the final location by a rather small system program.
LOADER.SYSTEM is such a small program. In fact it's so small that it fits into
a single block in the ProDOS 8 file system making it a so-called seedling file,
which are loaded really fast. LOADER.SYSTEM can load cc65 programs into memory
anywhere in the range $0800-$BB00 (44,75 kB).
Usage
-----
Link the cc65 program to the start address $0803 (or any other address) and
store it as binary program (filetype BIN). This is in fact no different from
a binary program to be run by BASIC.SYSTEM's BRUN command in the usual way.
If however the cc65 program isn't run by BASIC.SYSTEM but is rather run by
LOADER.SYSTEM then it behaves like a system program which means:
- It uses memory up to the ProDOS 8 system global page located at $BF00.
- It supports the ProDOS 8 startup file mechanism (mapped to argv[1]).
- It quits to the ProDOS 8 dispatcher.
Obviously LOADER.SYSTEM has to be told which cc65 program to run. Unfortunately
the ProDOS 8 dispatcher has no notion of system program parameters so the usual
approach would have been to make LOADER.SYSTEM bring up yet another menu to
select the cc65 program to run.
But to allow to select the cc65 program directly from the ProDOS 8 dispatcher
anyway LOADER.SYSTEM detects the path to the cc65 program from its own path by
just removing the '.SYSTEM' from its name. So if you want to run the cc65
program MYPROGRAM you'll need a copy of LOADER.SYSTEM in the same directory
being renamed to MYPROGRAM.SYSTEM.
This means you will end up with a copy of LOADER.SYSTEM for every cc65 program
to be run by it. But as LOADER.SYSTEM is a ProDOS 8 seedling file using up only
a single block in the ProDOS 8 file system this should be no issue.
Build
-----
In case you want to build 'loader.system' from the source code yourself you can
do so using the following commands:
ca65 loader.s
ld65 -C loader.cfg -o loader.system loader.o
Installation
------------
The file 'loader.system' as generated by the cc65 linker with the command above
does NOT include the 4-byte address/length header that is generated for Apple][
programs by default. This is because ProDOS 8 system programs are always loaded
into memory starting at location $2000.
The recommended way to transfer 'loader.system' from your native file system to
a ProDOS 8 file system disk image is to use AppleCommander which is available at
http://applecommander.sourceforge.net/
If you want to put the file 'loader.system' onto a disk image 'mydisk.dsk' as
system program MYPROGRAM.SYSTEM you can do so using the following command:
java -jar ac.jar -p mydisk.dsk MYPROGRAM.SYSTEM sys < loader.system

37
libsrc/atari/cashdr.s Normal file
View File

@ -0,0 +1,37 @@
;
; Cassette boot file header
;
; Christian Groessler, chris@groessler.org, 2014
;
;DEBUG = 1
.ifndef __ATARIXL__
.include "atari.inc"
.import __BSS_RUN__, __STARTADDRESS__, _cas_init
.export _cas_hdr
.assert ((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) < $101, error, "File to big to load from cassette"
; for a description of the cassette header, see De Re Atari, appendix C
.segment "CASHDR"
_cas_hdr:
.byte 0 ; ignored
.byte <((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) ; # of 128-byte records to read
.word __STARTADDRESS__ ; load address
.word _cas_init ; init address
.ifdef DEBUG
lda #33
ldy #80
sta (SAVMSC),y
.endif
clc
rts
.endif ; .ifdef __ATARIXL__

31
libsrc/atari/casinit.s Normal file
View File

@ -0,0 +1,31 @@
;
; Cassette boot file init routine
;
; Christian Groessler, chris@groessler.org, 2014
;
;DEBUG = 1
.ifndef __ATARIXL__
.include "atari.inc"
.import start
.export _cas_init
.segment "INIT"
_cas_init:
.ifdef DEBUG
lda #34
ldy #81
sta (SAVMSC),y
.endif
lda #<start
sta DOSVEC
lda #>start
sta DOSVEC+1
rts
.endif ; .ifdef __ATARIXL__

View File

@ -100,8 +100,8 @@ start:
; Initialize conio stuff
dey ; Set X to $FF
sty CH
dey ; Set Y to $FF
sty CH ; remove keypress which might be in the input buffer
; Push arguments and call main

View File

@ -0,0 +1,9 @@
DEPS += ../libwrk/$(TARGET)/w2cas.d
../libwrk/$(TARGET)/w2cas.o: $(SRCDIR)/targetutil/w2cas.c | ../libwrk/$(TARGET)
$(COMPILE_recipe)
../targetutil/w2cas.com: ../libwrk/$(TARGET)/w2cas.o ../lib/$(TARGET).lib | ../targetutil
$(LD65) -o $@ -t $(TARGET) $^
$(TARGET): ../targetutil/w2cas.com

View File

@ -0,0 +1,186 @@
/* w2cas.c -- write file to cassette
*
* This program writes a boot file (typically linked with
* 'atari-cassette.cfg') to the cassette.
* Only files < 32K are supported, since the loading of
* larger files requires a special loader inside the program.
*
* Christian Groessler, chris@groessler.org, 2014
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <6502.h>
#include <atari.h>
#include <conio.h>
static int verbose = 1;
static char C_dev[] = "C:";
static struct __iocb *findfreeiocb(void)
{
struct __iocb *iocb = &IOCB; /* first IOCB (#0) */
int i;
for (i = 0; i < 8; i++) {
if (iocb->handler == 0xff)
return iocb;
iocb++;
}
return NULL;
}
int main(int argc, char **argv)
{
char *filename, *x;
char buf[20];
FILE *file;
unsigned char *buffer;
size_t filen, buflen = 32768l + 1;
struct regs regs;
struct __iocb *iocb = findfreeiocb();
int iocb_num;
if (! iocb) {
fprintf(stderr, "couldn't find a free iocb\n");
if (_dos_type != 1)
cgetc();
return 1;
}
iocb_num = (iocb - &IOCB) * 16;
if (verbose)
printf("using iocb index $%02X ($%04X)\n", iocb_num, iocb);
if (argc < 2) {
printf("\nfilename: ");
x = fgets(buf, 19, stdin);
printf("\n");
if (! x)
return 1;
if (*x && *(x + strlen(x) - 1) == '\n')
*(x + strlen(x) - 1) = 0;
filename = x;
}
else {
filename = *(argv+1);
}
/* allocate buffer */
buffer = malloc(buflen);
if (! buffer) {
buflen = _heapmaxavail(); /* get as much as we can */
buffer = malloc(buflen);
if (! buffer) {
fprintf(stderr, "cannot alloc %ld bytes -- aborting...\n", (long)buflen);
if (_dos_type != 1)
cgetc();
return 1;
}
}
if (verbose)
printf("buffer size: %ld bytes\n", (long)buflen);
/* open file */
file = fopen(filename, "rb");
if (! file) {
free(buffer);
fprintf(stderr, "cannot open '%s': %s\n", filename, strerror(errno));
if (_dos_type != 1)
cgetc();
return 1;
}
/* read file -- file length must be < 32K */
if (verbose)
printf("reading input file...\n");
filen = fread(buffer, 1, buflen, file);
if (! filen) {
fprintf(stderr, "read error\n");
file_err:
fclose(file);
free(buffer);
if (_dos_type != 1)
cgetc();
return 1;
}
if (filen > 32767l) {
fprintf(stderr, "file is too large (must be < 32768)\n");
goto file_err;
}
if (filen == buflen) { /* we have a buffer < 32768 and the file fits into it (and is most probably larger) */
fprintf(stderr, "not enough memory\n");
goto file_err;
}
if (verbose)
printf("file size: %ld bytes\n", (long)filen);
/* close input file */
fclose(file);
/* open cassette */
if (verbose)
printf("opening cassette...\n");
iocb->buffer = C_dev;
iocb->aux1 = 8; /* open for output */
iocb->aux2 = 128; /* short breaks and no stop between data blocks */
iocb->command = IOCB_OPEN;
regs.x = iocb_num;
regs.pc = 0xe456; /* CIOV */
_sys(&regs);
if (regs.y != 1) {
fprintf(stderr, "CIO call to open cassette returned %d\n", regs.y);
free(buffer);
if (_dos_type != 1)
cgetc();
return 1;
}
/* write file */
if (verbose)
printf("writing to cassette...\n");
iocb->buffer = buffer;
iocb->buflen = filen;
iocb->command = IOCB_PUTCHR;
regs.x = iocb_num;
regs.pc = 0xe456; /* CIOV */
_sys(&regs);
if (regs.y != 1) {
fprintf(stderr, "CIO call to write file returned %d\n", regs.y);
free(buffer);
iocb->command = IOCB_CLOSE;
regs.x = iocb_num;
regs.pc = 0xe456; /* CIOV */
_sys(&regs);
if (_dos_type != 1)
cgetc();
return 1;
}
/* free buffer */
free(buffer);
/* close cassette */
iocb->command = IOCB_CLOSE;
regs.x = iocb_num;
regs.pc = 0xe456; /* CIOV */
_sys(&regs);
if (regs.y != 1) {
fprintf(stderr, "CIO call to close cassette returned %d\n", regs.y);
if (_dos_type != 1)
cgetc();
return 1;
}
/* all is fine */
printf("success\n");
if (_dos_type != 1)
cgetc();
return 0;
}

View File

@ -2,7 +2,8 @@
; Driver for the 1351 proportional mouse. Parts of the code are from
; the Commodore 1351 mouse users guide.
;
; Ullrich von Bassewitz, 2003-12-29, 2009-09-26
; 2009-09-26, Ullrich von Bassewitz
; 2014-03-17, Greg King
;
.include "zeropage.inc"
@ -83,6 +84,8 @@ YMax: .res 2 ; Y2 value of bounding box
OldValue: .res 1 ; Temp for MoveCheck routine
NewValue: .res 1 ; Temp for MoveCheck routine
INIT_save: .res 1
.rodata
; Default values for above variables
@ -94,8 +97,8 @@ NewValue: .res 1 ; Temp for MoveCheck routine
.word SCREEN_WIDTH/2 ; XPos
.word 0 ; XMin
.word 0 ; YMin
.word SCREEN_WIDTH ; XMax
.word SCREEN_HEIGHT ; YMax
.word SCREEN_WIDTH - 1 ; XMax
.word SCREEN_HEIGHT - 1 ; YMax
.endproc
.code
@ -107,6 +110,14 @@ NewValue: .res 1 ; Temp for MoveCheck routine
INSTALL:
; Disable the BASIC interpreter's interrupt-driven sprite-motion code.
; That allows direct access to the VIC-IIe's sprite registers.
lda INIT_STATUS
sta INIT_save
lda #%11000000
sta INIT_STATUS
; Initialize variables. Just copy the default stuff over
ldx #.sizeof(DefVars)-1
@ -133,13 +144,17 @@ INSTALL:
ldx #$00
txa
rts ; Run into UNINSTALL instead
rts
;----------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
; No return code required (the driver is removed from memory on return).
UNINSTALL = HIDE ; Hide cursor on exit
UNINSTALL:
jsr HIDE ; Hide cursor on exit
lda INIT_save
sta INIT_STATUS
rts
;----------------------------------------------------------------------------
; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages

View File

@ -1,7 +1,8 @@
;
; Driver for a "joystick mouse".
;
; Ullrich von Bassewitz, 2004-04-05, 2009-09-26
; 2009-09-26, Ullrich von Bassewitz
; 2014-03-17, Greg King
;
.include "zeropage.inc"
@ -85,6 +86,8 @@ XMax: .res 2 ; X2 value of bounding box
YMax: .res 2 ; Y2 value of bounding box
Buttons: .res 1 ; Button mask
INIT_save: .res 1
; Temporary value used in the int handler
Temp: .res 1
@ -99,8 +102,8 @@ Temp: .res 1
.word SCREEN_WIDTH/2 ; XPos
.word 0 ; XMin
.word 0 ; YMin
.word SCREEN_WIDTH ; XMax
.word SCREEN_HEIGHT ; YMax
.word SCREEN_WIDTH - 1 ; XMax
.word SCREEN_HEIGHT - 1 ; YMax
.byte 0 ; Buttons
.endproc
@ -113,6 +116,14 @@ Temp: .res 1
INSTALL:
; Disable the BASIC interpreter's interrupt-driven sprite-motion code.
; That allows direct access to the VIC-IIe's sprite registers.
lda INIT_STATUS
sta INIT_save
lda #%11000000
sta INIT_STATUS
; Initialize variables. Just copy the default stuff over
ldx #.sizeof(DefVars)-1
@ -145,7 +156,11 @@ INSTALL:
; UNINSTALL routine. Is called before the driver is removed from memory.
; No return code required (the driver is removed from memory on return).
UNINSTALL = HIDE ; Hide cursor on exit
UNINSTALL:
jsr HIDE ; Hide cursor on exit
lda INIT_save
sta INIT_STATUS
rts
;----------------------------------------------------------------------------
; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages

View File

@ -1,8 +1,9 @@
;
; Driver for a potentiometer "mouse" e.g. Koala Pad
; Driver for a potentiometer "mouse", e.g. Koala Pad
;
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
; Stefan Haubenthal, 2006-08-20
; 2006-08-20, Stefan Haubenthal
; 2009-09-26, Ullrich von Bassewitz
; 2014-03-17, Greg King
;
.include "zeropage.inc"
@ -82,6 +83,8 @@ XMax: .res 2 ; X2 value of bounding box
YMax: .res 2 ; Y2 value of bounding box
Buttons: .res 1 ; Button mask
INIT_save: .res 1
; Temporary value used in the int handler
Temp: .res 1
@ -96,8 +99,8 @@ Temp: .res 1
.word SCREEN_WIDTH/2 ; XPos
.word 0 ; XMin
.word 0 ; YMin
.word SCREEN_WIDTH ; XMax
.word SCREEN_HEIGHT ; YMax
.word SCREEN_WIDTH - 1 ; XMax
.word SCREEN_HEIGHT - 1 ; YMax
.byte 0 ; Buttons
.endproc
@ -110,6 +113,14 @@ Temp: .res 1
INSTALL:
; Disable the BASIC interpreter's interrupt-driven sprite-motion code.
; That allows direct access to the VIC-IIe's sprite registers.
lda INIT_STATUS
sta INIT_save
lda #%11000000
sta INIT_STATUS
; Initialize variables. Just copy the default stuff over
ldx #.sizeof(DefVars)-1
@ -142,7 +153,11 @@ INSTALL:
; UNINSTALL routine. Is called before the driver is removed from memory.
; No return code required (the driver is removed from memory on return).
UNINSTALL = HIDE ; Hide cursor on exit
UNINSTALL:
jsr HIDE ; Hide cursor on exit
lda INIT_save
sta INIT_STATUS
rts
;----------------------------------------------------------------------------
; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages

View File

@ -2,7 +2,7 @@
; Driver for a "joystick mouse".
;
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
; 2010-02-08, Greg King
; 2014-03-17, Greg King
;
; The driver prevents the keyboard from interfering by changing the
; keyboard's output port into an input port while the driver reads its
@ -118,8 +118,8 @@ Temp: .res 1
.word SCREEN_WIDTH/2 ; XPos
.word 0 ; XMin
.word 0 ; YMin
.word SCREEN_WIDTH ; XMax
.word SCREEN_HEIGHT ; YMax
.word SCREEN_WIDTH - 1 ; XMax
.word SCREEN_HEIGHT - 1 ; YMax
.byte 0 ; Buttons
.endproc

View File

@ -1,8 +1,9 @@
;
; Driver for a potentiometer "mouse" e.g. Koala Pad
; Driver for a potentiometer "mouse", e.g. Koala Pad
;
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
; Stefan Haubenthal, 2006-08-20
; 2006-08-20, Stefan Haubenthal
; 2009-09-26, Ullrich von Bassewitz
; 2014-03-17, Greg King
;
.include "zeropage.inc"
@ -96,8 +97,8 @@ Temp: .res 1
.word SCREEN_WIDTH/2 ; XPos
.word 0 ; XMin
.word 0 ; YMin
.word SCREEN_WIDTH ; XMax
.word SCREEN_HEIGHT ; YMax
.word SCREEN_WIDTH - 1 ; XMax
.word SCREEN_HEIGHT - 1 ; YMax
.byte 0 ; Buttons
.endproc

View File

@ -1,14 +1,14 @@
DEPS += ../wrk/$(TARGET)/convert.d
DEPS += ../libwrk/$(TARGET)/convert.d
../wrk/$(TARGET)/convert.o: TARGET = apple2enh
../libwrk/$(TARGET)/convert.o: TARGET = apple2enh
../wrk/$(TARGET)/convert.o: $(SRCDIR)/targetutil/convert.c | ../wrk/$(TARGET)
../libwrk/$(TARGET)/convert.o: $(SRCDIR)/targetutil/convert.c | ../libwrk/$(TARGET)
$(COMPILE_recipe)
../lib/apple2enh.lib:
@$(MAKE) --no-print-directory apple2enh
../targetutil/convert.system: ../wrk/$(TARGET)/convert.o ../lib/apple2enh.lib | ../targetutil
../targetutil/convert.system: ../libwrk/$(TARGET)/convert.o ../lib/apple2enh.lib | ../targetutil
$(LD65) -o $@ -C apple2enh-system.cfg $^
$(TARGET): ../targetutil/convert.system

View File

@ -7,7 +7,7 @@
.import __STARTOFDIRECTORY__
.import __RAM_START__
.import __CODE_SIZE__,__DATA_SIZE__,__RODATA_SIZE__
.import __STARTUP_SIZE__,__INIT_SIZE__
.import __STARTUP_SIZE__,__INIT_SIZE__,__LOWCODE_SIZE__
.import __BLOCKSIZE__
.export __DEFDIR__: absolute = 1
@ -21,7 +21,7 @@ off0=__STARTOFDIRECTORY__+(__DIRECTORY_END__-__DIRECTORY_START__)
blocka=off0/__BLOCKSIZE__
; Entry 0 - first executable
block0=off0/__BLOCKSIZE__
len0=__STARTUP_SIZE__+__INIT_SIZE__+__CODE_SIZE__+__DATA_SIZE__+__RODATA_SIZE__
len0=__STARTUP_SIZE__+__INIT_SIZE__+__CODE_SIZE__+__DATA_SIZE__+__RODATA_SIZE__+__LOWCODE_SIZE__
.byte <block0
.word off0 & (__BLOCKSIZE__ - 1)
.byte $88

View File

@ -1,8 +1,8 @@
../tgi/nes-64-56-2.tgi: ../wrk/nes/clrscr.o \
../wrk/nes/cputc.o \
../wrk/nes/get_tv.o \
../wrk/nes/gotoxy.o \
../wrk/nes/popa.o \
../wrk/nes/ppu.o \
../wrk/nes/ppubuf.o \
../wrk/nes/setcursor.o
../tgi/nes-64-56-2.tgi: ../libwrk/nes/clrscr.o \
../libwrk/nes/cputc.o \
../libwrk/nes/get_tv.o \
../libwrk/nes/gotoxy.o \
../libwrk/nes/popa.o \
../libwrk/nes/ppu.o \
../libwrk/nes/ppubuf.o \
../libwrk/nes/setcursor.o

View File

@ -1,8 +1,6 @@
.SUFFIXES:
.PHONY: all bin $(PROGS) mostlyclean clean install avail unavail
ifeq ($(shell echo),)
ifneq ($(shell echo),)
CMD_EXE = 1
endif
PROGS = ar65 \
ca65 \
@ -16,6 +14,10 @@ PROGS = ar65 \
sim65 \
sp65
.PHONY: all mostlyclean clean install zip avail unavail bin $(PROGS)
.SUFFIXES:
bindir := $(prefix)/bin
datadir := $(if $(prefix),$(prefix)/share/cc65,$(abspath ..))
@ -25,24 +27,77 @@ LD65_LIB = $(datadir)/lib
LD65_OBJ = $(datadir)/lib
LD65_CFG = $(datadir)/cfg
CFLAGS += -MMD -MP -O -std=c89 -I common \
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
-DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
-DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
CFLAGS += $(if $(TRAVIS),-Werror)
ifdef CROSS_COMPILE
$(info CC: $(CC))
$(info AR: $(AR))
endif
ifdef USER_CFLAGS
$(info USER_CFLAGS: $(USER_CFLAGS))
endif
ifndef GIT_SHA
GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD))
ifneq ($(words $(GIT_SHA)),1)
GIT_SHA := N/A
endif
endif
$(info GIT_SHA: $(GIT_SHA))
CFLAGS += -MMD -MP -O -I common \
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
-DGIT_SHA=$(GIT_SHA) -DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
-DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
LDLIBS += -lm
INSTALL = install
ifdef CMD_EXE
EXE_SUFFIX=.exe
endif
ifdef CROSS_COMPILE
EXE_SUFFIX=.exe
endif
ifdef CMD_EXE
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
MKDIR = mkdir $(subst /,\,$1)
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
else
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif
all bin: $(PROGS)
mostlyclean:
$(RM) -r ../wrk
$(call RMDIR,../wrk)
clean:
$(RM) -r ../wrk ../bin
$(call RMDIR,../wrk ../bin)
ifdef CMD_EXE
install avail unavail:
else # CMD_EXE
INSTALL = install
define AVAIL_recipe
ln -s $(abspath ../bin/$(prog)) /usr/local/bin/$(prog)
endef # AVAIL_recipe
define UNAVAIL_recipe
$(RM) /usr/local/bin/$(prog)
endef # UNAVAIL_recipe
install:
$(if $(prefix),,$(error variable `prefix' must be set))
@ -55,23 +110,10 @@ avail:
unavail:
$(foreach prog,$(PROGS),$(UNAVAIL_recipe))
##########
endif # CMD_EXE
define AVAIL_recipe
ln -s $(abspath ../bin/$(prog)) /usr/local/bin/$(prog)
endef
##########
define UNAVAIL_recipe
$(RM) /usr/local/bin/$(prog)
endef
##########
zip:
@cd .. && zip cc65 bin/*
define OBJS_template
@ -80,53 +122,35 @@ $1_OBJS := $$(patsubst %.c,../wrk/%.o,$$(wildcard $1/*.c))
$$($1_OBJS): | ../wrk/$1
../wrk/$1:
@mkdir -p $$@
@$$(call MKDIR,$$@)
DEPS += $$($1_OBJS:.o=.d)
endef
##########
endef # OBJS_template
define PROG_template
$$(eval $$(call OBJS_template,$1))
../bin/$1$(PROGEXT): $$($1_OBJS) ../wrk/common/common.a | ../bin
../bin/$1$(EXE_SUFFIX): $$($1_OBJS) ../wrk/common/common.a | ../bin
$$(CC) $$(LDFLAGS) -o $$@ $$^ $$(LDLIBS)
$1: ../bin/$1$(PROGEXT)
$1: ../bin/$1$(EXE_SUFFIX)
endef
##########
endef # PROG_template
../wrk/%.o: %.c
@echo $<
@$(CC) -c $(CFLAGS) -o $@ $<
../bin:
@mkdir $@
@$(call MKDIR,$@)
$(eval $(call OBJS_template,common))
../wrk/common/common.a: $(common_OBJS)
$(AR) r $@ $?
$(foreach prog,$(PROGS),$(eval $(call PROG_template,$(prog))))
-include $(DEPS)
else # cmd.exe
all bin:
msbuild cc65.sln /p:configuration=release /consoleloggerparameters:disableconsolecolor
mostlyclean:
$(if $(wildcard ../wrk),rmdir /s /q ..\wrk)
clean:
msbuild cc65.sln /p:configuration=release /consoleloggerparameters:disableconsolecolor /target:$@
install avail unavail:
endif # cmd.exe

View File

@ -77,7 +77,3 @@ void AddObjFiles (int argc, char* argv [])
/* Successful end */
exit (EXIT_SUCCESS);
}

View File

@ -52,7 +52,3 @@ void AddObjFiles (int argc, char* argv []);
/* End of add.h */
#endif

View File

@ -78,7 +78,3 @@ void DelObjFiles (int argc, char* argv [])
/* Successful end */
exit (EXIT_SUCCESS);
}

View File

@ -52,7 +52,3 @@ void DelObjFiles (int argc, char* argv []);
/* End of del.h */
#endif

View File

@ -89,6 +89,3 @@ void Internal (const char* Format, ...)
va_end (ap);
exit (EXIT_FAILURE);
}

View File

@ -63,6 +63,3 @@ void Internal (const char* Format, ...) attribute((noreturn, format(printf,1,2))
/* End of error.h */
#endif

View File

@ -147,6 +147,3 @@ const ObjData* ExpFind (const char* Name)
/* Not found */
return 0;
}

View File

@ -67,6 +67,3 @@ const struct ObjData* ExpFind (const char* Name);
/* End of exports.h */
#endif

View File

@ -77,6 +77,3 @@ void ExtractObjFiles (int argc, char* argv [])
/* Successful end */
exit (EXIT_SUCCESS);
}

View File

@ -52,7 +52,3 @@ void ExtractObjFiles (int argc, char* argv []);
/* End of extract.h */
#endif

View File

@ -201,54 +201,3 @@ void* ReadData (FILE* F, void* Data, unsigned Size)
}
return Data;
}

View File

@ -89,6 +89,3 @@ void* ReadData (FILE* F, void* Data, unsigned Size);
/* End of fileio.h */
#endif

View File

@ -40,6 +40,3 @@
/*****************************************************************************/
/* Data */
/*****************************************************************************/

View File

@ -47,6 +47,3 @@
/* End of global.h */
#endif

View File

@ -405,6 +405,3 @@ void LibClose (void)
Error ("Problem deleting temporary library file: %s", strerror (errno));
}
}

View File

@ -83,6 +83,3 @@ void LibClose (void);
/* End of library.h */
#endif

View File

@ -84,6 +84,3 @@ void ListObjFiles (int argc, char* argv [])
/* Successful end */
exit (EXIT_SUCCESS);
}

View File

@ -52,7 +52,3 @@ void ListObjFiles (int argc, char* argv []);
/* End of list.h */
#endif

View File

@ -137,6 +137,3 @@ int main (int argc, char* argv [])
/* Return an apropriate exit code */
return EXIT_SUCCESS;
}

View File

@ -167,6 +167,3 @@ void DelObjData (const char* Module)
/* Not found! */
Warning ("Module `%s' not found in library `%s'", Module, LibName);
}

View File

@ -108,6 +108,3 @@ void DelObjData (const char* Module);
/* End of objdata.h */
#endif

View File

@ -337,6 +337,3 @@ void ObjExtract (const char* Name)
Error ("Cannot set mod time on `%s': %s", Name, strerror (errno));
}
}

View File

@ -74,6 +74,3 @@ void ObjExtract (const char* Name);
/* End of objfile.h */
#endif

View File

@ -79,6 +79,3 @@ int IsAnonName (const StrBuf* Name)
}
return (strncmp (SB_GetConstBuf (Name), AnonTag, sizeof (AnonTag) - 1) == 0);
}

View File

@ -61,7 +61,5 @@ int IsAnonName (const StrBuf* Name);
/* End of anonname.h */
#endif

View File

@ -176,8 +176,3 @@ void WriteAssertions (void)
/* Done writing the assertions */
ObjEndAssertions ();
}

View File

@ -74,6 +74,3 @@ void WriteAssertions (void);
/* End of asserts.h */
#endif

View File

@ -523,7 +523,3 @@ void CleanupIfStack (unsigned SP)
/* Calculate the new overall .IF condition */
CalcOverallIfCond ();
}

View File

@ -80,6 +80,3 @@ void CleanupIfStack (unsigned SP);
/* End of condasm.h */
#endif

View File

@ -527,6 +527,3 @@ void WriteHLLDbgSyms (void)
}
}

View File

@ -67,8 +67,3 @@ void WriteHLLDbgSyms (void);
/* End of dbginfo.h */
#endif

View File

@ -63,6 +63,3 @@ struct EffAddr {
/* End of ea.h */
#endif

View File

@ -200,7 +200,3 @@ void GetEA (EffAddr* A)
/* Apply addressing mode overrides */
A->AddrModeSet &= Restrictions;
}

View File

@ -62,6 +62,3 @@ void GetEA (EffAddr* A);
/* End of ea65.h */
#endif

View File

@ -151,7 +151,3 @@ void DoEnum (void)
/* Free the base expression */
FreeExpr (BaseExpr);
}

View File

@ -52,6 +52,3 @@ void DoEnum (void);
/* End of enum.h */
#endif

View File

@ -400,6 +400,3 @@ void Internal (const char* Format, ...)
exit (EXIT_FAILURE);
}

View File

@ -38,6 +38,12 @@
#if defined( __MINGW32__)
# pragma GCC diagnostic ignored "-Wformat"
#endif
/* common */
#include "attrib.h"
#include "coll.h"
@ -98,7 +104,3 @@ void Internal (const char* Format, ...) attribute((noreturn, format(printf,1,2))
/* End of error.h */
#endif

View File

@ -1942,6 +1942,3 @@ ExprNode* BoundedExpr (ExprNode* (*ExprFunc) (void), unsigned Size)
{
return MakeBoundedExpr (ExprFunc (), Size);
}

View File

@ -179,6 +179,3 @@ ExprNode* BoundedExpr (ExprNode* (*ExprFunc) (void), unsigned Size);
/* End of expr.h */
#endif

View File

@ -125,6 +125,3 @@ feature_t SetFeature (const StrBuf* Key)
/* Return the value found */
return Feature;
}

View File

@ -94,6 +94,3 @@ feature_t SetFeature (const StrBuf* Key);
/* End of feature.h */
#endif

View File

@ -336,5 +336,3 @@ void CreateDependencies (void)
FT_MAIN | FT_INCLUDE | FT_BINARY | FT_DBGINFO);
}
}

View File

@ -90,8 +90,3 @@ void CreateDependencies (void);
/* End of filetab.h */
#endif

View File

@ -66,6 +66,3 @@ Fragment* NewFragment (unsigned char Type, unsigned short Len)
/* And return it */
return F;
}

View File

@ -82,8 +82,5 @@ Fragment* NewFragment (unsigned char Type, unsigned short Len);
/* End of fragment.h */
#endif

View File

@ -90,6 +90,3 @@ extern unsigned char UnderlineInNumbers; /* Allow underlines in numbers */
/* End of global.h */
#endif

View File

@ -44,8 +44,8 @@
SearchPath* IncSearchPath; /* Standard include path */
SearchPath* BinSearchPath; /* Binary include path */
SearchPaths* IncSearchPath; /* Standard include path */
SearchPaths* BinSearchPath; /* Binary include path */
@ -75,13 +75,10 @@ void FinishIncludePaths (void)
AddSubSearchPathFromEnv (IncSearchPath, "CC65_HOME", "asminc");
/* Add some compiled-in search paths if defined at compile time. */
#ifdef CA65_INC
#if defined(CA65_INC) && !defined(_WIN32)
AddSearchPath (IncSearchPath, STRINGIZE (CA65_INC));
#endif
/* Add paths relative to the parent directory of the Windows binary. */
AddSubSearchPathFromWinBin (IncSearchPath, "asminc");
}

View File

@ -49,8 +49,8 @@
extern SearchPath* IncSearchPath; /* Standard include path */
extern SearchPath* BinSearchPath; /* Binary include path */
extern SearchPaths* IncSearchPath; /* Standard include path */
extern SearchPaths* BinSearchPath; /* Binary include path */
@ -71,6 +71,3 @@ void FinishIncludePaths (void);
/* End of incpath.h */
#endif

View File

@ -1521,6 +1521,3 @@ void HandleInstruction (unsigned Index)
/* Call the handler */
InsTab->Ins[Index].Emit (&InsTab->Ins[Index]);
}

View File

@ -179,8 +179,3 @@ void HandleInstruction (unsigned Index);
/* End of instr.h */
#endif

View File

@ -156,6 +156,3 @@ void CheckInputStack (void)
Error ("Open %s", IStack->Desc);
}
}

View File

@ -68,7 +68,3 @@ void CheckInputStack (void);
/* End of istack.h */
#endif

View File

@ -501,6 +501,3 @@ void WriteLineInfos (void)
/* End of line infos */
ObjEndLineInfos ();
}

View File

@ -115,8 +115,5 @@ void WriteLineInfos (void);
/* End of lineinfo.h */
#endif

View File

@ -452,6 +452,3 @@ void CreateListing (void)
/* Close the listing file */
(void) fclose (F);
}

View File

@ -123,6 +123,3 @@ void CreateListing (void);
/* End of listing.h */
#endif

View File

@ -1049,6 +1049,3 @@ void EnableDefineStyleMacros (void)
PRECONDITION (DisableDefines > 0);
--DisableDefines;
}

View File

@ -110,6 +110,3 @@ void EnableDefineStyleMacros (void);
/* End of macro.h */
#endif

View File

@ -1120,6 +1120,3 @@ int main (int argc, char* argv [])
/* Return an apropriate exit code */
return (ErrorCount == 0)? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@ -816,6 +816,3 @@ void LeaveRawTokenMode (void)
PRECONDITION (RawMode > 0);
--RawMode;
}

View File

@ -90,7 +90,3 @@ void LeaveRawTokenMode (void);
/* End of nexttok.h */
#endif

View File

@ -278,6 +278,3 @@ void EmitFill (unsigned long Count)
GenFragment (FRAG_FILL, Chunk);
}
}

View File

@ -94,6 +94,3 @@ void EmitFill (unsigned long Count);
/* End of objcode.h */
#endif

Some files were not shown because too many files have changed in this diff Show More