diff --git a/.gitignore b/.gitignore index fc50ada..464e781 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ /AssemblyTest.xcodeproj/xcuserdata/ - /AssemblyTest.xcodeproj/project.xcworkspace/xcuserdata/ - /Apple2BuildPipelineSample.xcodeproj/xcuserdata/ - /Apple2BuildPipelineSample.xcodeproj/project.xcworkspace/xcuserdata/ +*.lst diff --git a/Apple2BuildPipelineSample.xcodeproj/project.pbxproj b/Apple2BuildPipelineSample.xcodeproj/project.pbxproj index d1ea739..9cbcf69 100644 --- a/Apple2BuildPipelineSample.xcodeproj/project.pbxproj +++ b/Apple2BuildPipelineSample.xcodeproj/project.pbxproj @@ -9,6 +9,8 @@ /* Begin PBXFileReference section */ 70E84C2E19B10B3100159159 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; 70E84C2F19B10B3100159159 /* x.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = x.s; sourceTree = ""; }; + 9D084B2119B6AC2F0070589C /* head.mk */ = {isa = PBXFileReference; lastKnownFileType = text; name = head.mk; path = make/head.mk; sourceTree = ""; }; + 9D084B2219B6AC540070589C /* tail.mk */ = {isa = PBXFileReference; lastKnownFileType = text; name = tail.mk; path = make/tail.mk; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ @@ -17,9 +19,19 @@ children = ( 70E84C2E19B10B3100159159 /* Makefile */, 70E84C2F19B10B3100159159 /* x.s */, + 9D084B1F19B6ABE40070589C /* make */, ); sourceTree = ""; }; + 9D084B1F19B6ABE40070589C /* make */ = { + isa = PBXGroup; + children = ( + 9D084B2119B6AC2F0070589C /* head.mk */, + 9D084B2219B6AC540070589C /* tail.mk */, + ); + name = make; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXLegacyTarget section */ diff --git a/DevApple.vii b/DevApple.vii new file mode 100644 index 0000000..4f487a9 Binary files /dev/null and b/DevApple.vii differ diff --git a/Makefile b/Makefile index 9f613ff..327089e 100644 --- a/Makefile +++ b/Makefile @@ -10,30 +10,82 @@ # http://www.quinndunki.com/blondihacks # -CL65=cl65 +include make/head.mk -# You may need to change this to where your AppleCommander is installed: -AC=AppleCommander.jar +# Customize this file to control what gets built, what machines to +# target, where in memory to put it, etc. -# Change this to your desired starting address in Apple ][ memory: -ADDR=6000 +# The name of your system or binary file to build goes here: +PGM=example -# Put the name of your sourcefile here: -PGM=x +# Set the config you are building for. See these pages for details: +# http://cc65.github.io/cc65/doc/apple2.html#s4 +# http://cc65.github.io/cc65/doc/apple2enh.html#s4 +# +# Uncomment the one you want below (the first one is the default): +# MACHINE = apple2 +# MACHINE = apple2-dos33 +# MACHINE = apple2-system +# MACHINE = apple2-loader +# MACHINE = apple2-reboot +# MACHINE = apple2enh +# MACHINE = apple2enh-dos33 +# MACHINE = apple2enh-system +# MACHINE = apple2enh-loader +# MACHINE = apple2enh-reboot -all: $(PGM) +# Uncomment and set this to your starting address in Apple ][ memory +# if necessary: +# START_ADDR = 6000 +START_ADDR = 6000 -install: $(PGM) +# Set the default CPU to assemble for. You can change this in the +# body of a .s file using control commands like ".PC02". Uncomment +# the one you want below (the first one is the default): +# CPU = 6502 +# CPU = 65SC02 +# CPU = 65C02 +# CPU = 65816 +# Note: You can assemble for 65816 in 16-bit mode but the C compiler +# will only produce 8-bit code. -clean: - rm -f $(PGM) - rm -f $(PGM).o - rm -f $(PGM).lst +# Any *.c files in your main project directory will automatically be +# built. But, if you have subdirectories with C files in them, you +# should add them to the list of C_SRCS to build. Do that by +# uncommenting the following line and changing "someSubDir" to match +# the subdirectory you have created. Add multiple lines like this +# for each subdirectory: +# C_SRCS += $(wildcard someSubDir/*.c) -$(PGM): - @PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh -l$(PGM).lst --start-addr $(ADDR) $(PGM).s - java -jar $(AC) -d $(PGM).dsk $(PGM) - java -jar $(AC) -p $(PGM).dsk $(PGM) BIN 0x$(ADDR) < $(PGM) - rm -f $(PGM) - rm -f $(PGM).o - osascript V2Make.scpt $(PROJECT_DIR) $(PGM) +# Any *.s files in your main project directory will automatically be +# built. But, if you have subdirectories with assembly files in them, +# you should add them to the list of ASM_SRCS to build. Do that by +# uncommenting the following line and changing "someSubDir" to match +# the subdirectory you have created. Add multiple lines like this +# for each subdirectory: +# ASM_SRCS += $(wildcard someSubDir/*.s) + +# If you have a non-standard cc65 install, you may need to change +# some of these. Uncomment the following line and change it to the +# correct path to CC65_HOME if the default is not correct: +# export CC65_HOME := /usr/local/lib/cc65 +# +# If the path to the cc65 binaries is not correct, uncomment this +# line and change it: +# CC65_BIN = /usr/local/bin + +# If you want to add arguments to the compile commandline, add them +# to this variable: +# CFLAGS += -Os + +# If you want to add arguments to the assembly commandline, add them +# to this variable: +# ASMFLAGS += -g + +# If you want to add arguments to the link commandline, add them to +# this variable: +# LDFLAGS += -v + + +# Do not change anything else below here... +include make/tail.mk diff --git a/AppleCommander.jar b/make/AppleCommander.jar similarity index 100% rename from AppleCommander.jar rename to make/AppleCommander.jar diff --git a/V2Make.scpt b/make/V2Make.scpt similarity index 83% rename from V2Make.scpt rename to make/V2Make.scpt index 8b4fd80..4d0852f 100644 Binary files a/V2Make.scpt and b/make/V2Make.scpt differ diff --git a/make/head.mk b/make/head.mk new file mode 100644 index 0000000..dd8922c --- /dev/null +++ b/make/head.mk @@ -0,0 +1,29 @@ +# +# head.mk +# Apple2BuildPipelineSample +# +# Part of a sample build pipeline for Apple ][ software development +# +# Created by Quinn Dunki on 8/15/14. +# One Girl, One Laptop Productions +# http://www.quinndunki.com +# http://www.quinndunki.com/blondihacks +# + +export CC65_HOME := /usr/local/lib/cc65 + +CC65_BIN = /usr/local/bin + +CL65=$(CC65_BIN)/cl65 +CA65=$(CC65_BIN)/ca65 + +AC=make/AppleCommander.jar + +C_SRCS=$(wildcard *.c) +ASM_SRCS=$(wildcard *.s) + +MACHINE=apple2 +CPU=6502 +CFLAGS= +ASMFLAGS= +LDFLAGS= \ No newline at end of file diff --git a/x.dsk b/make/prodos_template.dsk similarity index 99% rename from x.dsk rename to make/prodos_template.dsk index b6dc217..59df075 100644 Binary files a/x.dsk and b/make/prodos_template.dsk differ diff --git a/make/tail.mk b/make/tail.mk new file mode 100644 index 0000000..be684db --- /dev/null +++ b/make/tail.mk @@ -0,0 +1,64 @@ +# +# tail.mk +# Apple2BuildPipelineSample +# +# Part of a sample build pipeline for Apple ][ software development +# +# Created by Quinn Dunki on 8/15/14. +# One Girl, One Laptop Productions +# http://www.quinndunki.com +# http://www.quinndunki.com/blondihacks +# + +export PATH := $(PATH):$(CC65_BIN) + +C_OBJS=$(C_SRCS:.c=.o) +ASM_OBJS=$(ASM_SRCS:.s=.o) +ASM_LSTS=$(ASM_SRCS:.s=.lst) +OBJS=$(C_OBJS) $(ASM_OBJS) + +MAPFILE=$(PGM).map +DISKIMAGE=$(PGM).dsk +DEPSFILE=$(PGM).deps + +LINK_ARGS= + +ifneq ($(START_ADDR),) +# If the MACHINE is set to an option which does not support a variable start +# address, then error. + ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),) + $(error You cannot change start address with this machine type) + endif + LINK_ARGS += --start-addr $(START_ADDR) +endif + + +.PHONY: all execute clean + +all: execute + +clean: + rm -f $(PGM) + rm -f $(OBJS) + rm -f $(MAPFILE) + rm -f $(ASM_LSTS) + rm -f $(DISKIMAGE) + rm -f $(DEPSFILE) + +$(PGM): $(OBJS) + $(CL65) -t $(MACHINE) --mapfile $(MAPFILE) $(LINK_ARGS) -o $(PGM) $(OBJS) + +$(DISKIMAGE): $(PGM) + cp make/prodos_template.dsk $(DISKIMAGE) + java -jar $(AC) -d $(DISKIMAGE) $(PGM) + java -jar $(AC) -p $(DISKIMAGE) $(PGM) BIN 0x$(START_ADDR) < $(PGM) + +execute: $(DISKIMAGE) + osascript make/V2Make.scpt $(PROJECT_DIR) $(PGM) + +%.o: %.c + $(CL65) -t $(MACHINE) --create-dep -c -o $@ $< + +%.o: %.s + $(CL65) -t $(MACHINE) --cpu $(CPU) -l -c -o $@ $< + diff --git a/x.lst b/x.lst deleted file mode 100644 index f376a12..0000000 --- a/x.lst +++ /dev/null @@ -1,51 +0,0 @@ -ca65 V2.13.3 - (C) Copyright 1998-2012 Ullrich von Bassewitz -Main file : x.s -Current file: x.s - -000000r 1 ; -000000r 1 ; x.s -000000r 1 ; Apple2BuildPipelineSample -000000r 1 ; -000000r 1 ; Part of a sample build pipeline for Apple ][ software development -000000r 1 ; -000000r 1 ; Created by Quinn Dunki on 8/15/14. -000000r 1 ; One Girl, One Laptop Productions -000000r 1 ; http://www.quinndunki.com -000000r 1 ; http://www.quinndunki.com/blondihacks -000000r 1 ; -000000r 1 -000000r 1 -000000r 1 .org $6000 -006000 1 -006000 1 ; Reserved locations -006000 1 -006000 1 INVERSE = $32 -006000 1 -006000 1 -006000 1 ; Constants -006000 1 -006000 1 CHAR_NORMAL = $ff -006000 1 CHAR_INVERSE = $3f -006000 1 CHAR_FLASH = $7f -006000 1 -006000 1 -006000 1 ; ROM entry points -006000 1 -006000 1 COUT = $fded -006000 1 -006000 1 -006000 1 -006000 1 ; Main -006000 1 -006000 1 main: -006000 1 ;lda #CHAR_FLASH -006000 1 ;sta INVERSE -006000 1 -006000 1 loop: -006000 1 A9 D8 lda #'X' + $80 -006002 1 20 ED FD jsr COUT -006005 1 4C 00 60 jmp loop ; OMG so many Xs -006008 1 -006008 1 -006008 1 -006008 1