Add support for all the machine config types. Generate include file dependencies and load them into the makefile so .h file changes causes the right files to rebuild. Rework the applescript a bit to load a specific virtual ][ machine and reboot into that machine on launch. Add a DOS 3.3 template disk for the DOS 3.3 machine config types.

This commit is contained in:
Jeremy Rand 2014-09-09 00:18:35 -04:00
parent 003a746bd3
commit 4c9e6ca755
10 changed files with 217 additions and 18 deletions

View File

@ -8,9 +8,10 @@
/* 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>"; };
70E84C2F19B10B3100159159 /* exampleAsm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = exampleAsm.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>"; };
9DE27AEA19BBF98700727AFA /* exampleC.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exampleC.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@ -18,7 +19,8 @@
isa = PBXGroup;
children = (
70E84C2E19B10B3100159159 /* Makefile */,
70E84C2F19B10B3100159159 /* x.s */,
70E84C2F19B10B3100159159 /* exampleAsm.s */,
9DE27AEA19BBF98700727AFA /* exampleC.c */,
9D084B1F19B6ABE40070589C /* make */,
);
sourceTree = "<group>";

View File

@ -33,11 +33,11 @@ PGM=example
# MACHINE = apple2enh-system
# MACHINE = apple2enh-loader
# MACHINE = apple2enh-reboot
MACHINE = apple2enh-system
# Uncomment and set this to your starting address in Apple ][ memory
# if necessary:
# START_ADDR = 6000
START_ADDR = 6000
# Set the default CPU to assemble for. You can change this in the
# body of a .s file using control commands like ".PC02". Uncomment

View File

@ -1,5 +1,5 @@
;
; x.s
; exampleAsm.s
; Apple2BuildPipelineSample
;
; Part of a sample build pipeline for Apple ][ software development
@ -10,8 +10,7 @@
; http://www.quinndunki.com/blondihacks
;
.org $6000
.export _asmFunc
; Reserved locations
@ -31,9 +30,9 @@ COUT = $fded
; Main
; _asmFunc
main:
_asmFunc:
lda #CHAR_FLASH
sta INVERSE

23
exampleC.c Normal file
View File

@ -0,0 +1,23 @@
//
// exampleC.c
// Apple2BuildPipelineSample
//
// Created by Jeremy Rand on 9/6/14.
// Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
//
#include <conio.h>
#include <stdio.h>
extern void asmFunc(void);
int main(void)
{
printf("\n\nHello, world!\n");
cgetc();
//asmFunc();
return 0;
}

Binary file not shown.

158
make/createDiskImage Executable file
View File

@ -0,0 +1,158 @@
#!/bin/sh
if [ $# -lt 4 ]
then
echo USAGE: $0 '<AppleCommander> <machine> <diskimage> <binary>'
exit 1
fi
APPLECOMMANDER=$1
MACHINE=$2
DISKIMAGE=$3
PROGRAM=$4
if [ ! -f "$PROGRAM" ]
then
echo "Cannot file executable $PROGRAM"
exit 1
fi
case "$MACHINE" in
apple2)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=1
RENAMELOADER=0
DELETEBASIC=0
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
apple2enh)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=1
RENAMELOADER=0
DELETEBASIC=0
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
apple2-dos33)
TEMPLATE="make/dos33_template.dsk"
DELETELOADER=0
RENAMELOADER=0
DELETEBASIC=0
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
apple2enh-dos33)
TEMPLATE="make/dos33_template.dsk"
DELETELOADER=0
RENAMELOADER=0
DELETEBASIC=0
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
apple2-system)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=1
RENAMELOADER=0
DELETEBASIC=1
HASHEADER=0
FILETYPE="sys"
TARGETFILE=`basename $PROGRAM`.system
;;
apple2enh-system)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=1
RENAMELOADER=0
DELETEBASIC=1
HASHEADER=0
FILETYPE="sys"
TARGETFILE=`basename $PROGRAM`.system
;;
apple2-loader)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=0
RENAMELOADER=1
DELETEBASIC=1
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
apple2-reboot)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=0
RENAMELOADER=1
DELETEBASIC=1
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
apple2enh-loader)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=0
RENAMELOADER=1
DELETEBASIC=1
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
apple2enh-reboot)
TEMPLATE="make/prodos_template.dsk"
DELETELOADER=0
RENAMELOADER=1
DELETEBASIC=1
HASHEADER=1
FILETYPE="bin"
TARGETFILE=`basename $PROGRAM`
;;
*)
echo "Invalid machine type $MACHINE"
exit 1
;;
esac
if [ ! -f "$TEMPLATE" ]
then
echo "Cannot file template disk image $TEMPLATE"
exit 1
fi
cp "$TEMPLATE" "$DISKIMAGE"
if [ $DELETELOADER -eq 1 ]
then
java -jar "$APPLECOMMANDER" -d "$DISKIMAGE" LOADER.SYSTEM
fi
if [ $RENAMELOADER -eq 1 ]
then
java -jar "$APPLECOMMANDER" -e "$DISKIMAGE" LOADER.SYSTEM | java -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE".system sys
java -jar "$APPLECOMMANDER" -d "$DISKIMAGE" LOADER.SYSTEM
fi
if [ $DELETEBASIC -eq 1 ]
then
java -jar "$APPLECOMMANDER" -d "$DISKIMAGE" BASIC.SYSTEM
fi
if [ $HASHEADER -eq 1 ]
then
STARTADDR=`od -t x2 -N 2 < "$PROGRAM" | head -1 | awk '{print $2}'`
dd if="$PROGRAM" bs=4 skip=1 | java -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE 0x$STARTADDR
else
java -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE < "$PROGRAM"
fi

BIN
make/dos33_template.dsk Normal file

Binary file not shown.

View File

@ -16,6 +16,7 @@ CC65_BIN = /usr/local/bin
CL65=$(CC65_BIN)/cl65
CA65=$(CC65_BIN)/ca65
CC65=$(CC65_BIN)/cc65
AC=make/AppleCommander.jar

Binary file not shown.

View File

@ -13,25 +13,40 @@
export PATH := $(PATH):$(CC65_BIN)
C_OBJS=$(C_SRCS:.c=.o)
C_DEPS=$(C_SRCS:.c=.u)
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=
EXECCMD=
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)
LDFLAGS += --start-addr 0x$(START_ADDR)
endif
ifneq ($(filter $(MACHINE), apple2 apple2enh apple2-dos33 apple2enh-dos33),)
EXECCMD=$(shell echo brun $(PGM) | tr '[a-z]' '[A-Z]')
endif
MACHCONFIG= -t apple2
ifneq ($(filter $(MACHINE), apple2enh apple2apple2enh-dos33 apple2enh-system apple2enh-loader apple2enh-reboot),)
MACHCONFIG= -t apple2enh
endif
ifeq ($(filter $(MACHINE), apple2 apple2enh),)
MACHCONFIG += -C $(MACHINE).cfg
endif
.PHONY: all execute clean
@ -40,25 +55,26 @@ all: execute
clean:
rm -f $(PGM)
rm -f $(OBJS)
rm -f $(C_DEPS)
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)
$(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -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)
make/createDiskImage $(AC) $(MACHINE) $(DISKIMAGE) $(PGM)
execute: $(DISKIMAGE)
osascript make/V2Make.scpt $(PROJECT_DIR) $(PGM)
osascript make/V2Make.scpt $(PROJECT_DIR) $(PGM) $(PROJECT_DIR)/DevApple.vii "$(EXECCMD)"
%.o: %.c
$(CL65) -t $(MACHINE) --create-dep -c -o $@ $<
$(CL65) $(MACHCONFIG) $(CFLAGS) --create-dep -c -o $@ $<
sed -i .bak 's/\.s:/.o:/' $(@:.o=.u)
rm -f $(@:.o=.u).bak
%.o: %.s
$(CL65) -t $(MACHINE) --cpu $(CPU) -l -c -o $@ $<
$(CL65) $(MACHCONFIG) --cpu $(CPU) $(ASMFLAGS) -l -c -o $@ $<
-include $(C_DEPS)