Break up the Makefile into a header, footer and a user customizable body which drives the configuration of the build. This helps to hide some of the nastiness of the rules which isn’t that important to the average developer. Support more than one C file and more than one assembly file and link it all together. Put the disk image into a template file and change the rule to copy and modify it as necessary. Add a Virtual ][ machine to the repository which will (eventually) be launched by the Applescript rather than just using the top window in the app.

This commit is contained in:
Jeremy Rand 2014-09-05 00:10:59 -04:00
parent d859ecf470
commit 003a746bd3
10 changed files with 178 additions and 74 deletions

4
.gitignore vendored
View File

@ -1,7 +1,5 @@
/AssemblyTest.xcodeproj/xcuserdata/
/AssemblyTest.xcodeproj/project.xcworkspace/xcuserdata/
/Apple2BuildPipelineSample.xcodeproj/xcuserdata/
/Apple2BuildPipelineSample.xcodeproj/project.xcworkspace/xcuserdata/
*.lst

View File

@ -9,6 +9,8 @@
/* Begin PBXFileReference section */
70E84C2E19B10B3100159159 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
70E84C2F19B10B3100159159 /* x.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = x.s; sourceTree = "<group>"; };
9D084B2119B6AC2F0070589C /* head.mk */ = {isa = PBXFileReference; lastKnownFileType = text; name = head.mk; path = make/head.mk; sourceTree = "<group>"; };
9D084B2219B6AC540070589C /* tail.mk */ = {isa = PBXFileReference; lastKnownFileType = text; name = tail.mk; path = make/tail.mk; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@ -17,9 +19,19 @@
children = (
70E84C2E19B10B3100159159 /* Makefile */,
70E84C2F19B10B3100159159 /* x.s */,
9D084B1F19B6ABE40070589C /* make */,
);
sourceTree = "<group>";
};
9D084B1F19B6ABE40070589C /* make */ = {
isa = PBXGroup;
children = (
9D084B2119B6AC2F0070589C /* head.mk */,
9D084B2219B6AC540070589C /* tail.mk */,
);
name = make;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */

BIN
DevApple.vii Normal file

Binary file not shown.

View File

@ -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

Binary file not shown.

29
make/head.mk Normal file
View File

@ -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=

Binary file not shown.

64
make/tail.mk Normal file
View File

@ -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 $@ $<

51
x.lst
View File

@ -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