From f79de893c953420d0f927932781f72ecc9235779 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Wed, 10 Sep 2014 01:28:12 -0400 Subject: [PATCH] Some final fixes to handle the fact that the header is not there consistently. So, we need to validate that the first two bytes in the binary is the expected start address and if so, then there is a header which needs to be stripped. --- .../project.pbxproj | 22 +++-------------- Makefile | 1 - exampleC.c | 23 ------------------ DevApple.vii => make/DevApple.vii | Bin make/V2Make.scpt | Bin 4736 -> 4764 bytes make/createDiskImage | 12 ++++++--- make/tail.mk | 16 +++++++++--- exampleAsm.s => x.s | 6 ++--- 8 files changed, 28 insertions(+), 52 deletions(-) delete mode 100644 exampleC.c rename DevApple.vii => make/DevApple.vii (100%) rename exampleAsm.s => x.s (92%) diff --git a/Apple2BuildPipelineSample.xcodeproj/project.pbxproj b/Apple2BuildPipelineSample.xcodeproj/project.pbxproj index 14e34b9..b18f58c 100644 --- a/Apple2BuildPipelineSample.xcodeproj/project.pbxproj +++ b/Apple2BuildPipelineSample.xcodeproj/project.pbxproj @@ -8,10 +8,7 @@ /* Begin PBXFileReference section */ 70E84C2E19B10B3100159159 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - 70E84C2F19B10B3100159159 /* exampleAsm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = exampleAsm.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 = ""; }; - 9DE27AEA19BBF98700727AFA /* exampleC.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exampleC.c; sourceTree = ""; }; + 70E84C2F19B10B3100159159 /* x.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = x.s; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ @@ -19,21 +16,10 @@ isa = PBXGroup; children = ( 70E84C2E19B10B3100159159 /* Makefile */, - 70E84C2F19B10B3100159159 /* exampleAsm.s */, - 9DE27AEA19BBF98700727AFA /* exampleC.c */, - 9D084B1F19B6ABE40070589C /* make */, + 70E84C2F19B10B3100159159 /* x.s */, ); sourceTree = ""; }; - 9D084B1F19B6ABE40070589C /* make */ = { - isa = PBXGroup; - children = ( - 9D084B2119B6AC2F0070589C /* head.mk */, - 9D084B2219B6AC540070589C /* tail.mk */, - ); - name = make; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXLegacyTarget section */ @@ -114,7 +100,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -149,7 +135,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; }; diff --git a/Makefile b/Makefile index 5efbe62..75656c4 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,6 @@ 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: diff --git a/exampleC.c b/exampleC.c deleted file mode 100644 index c13e6f2..0000000 --- a/exampleC.c +++ /dev/null @@ -1,23 +0,0 @@ -// -// exampleC.c -// Apple2BuildPipelineSample -// -// Created by Jeremy Rand on 9/6/14. -// Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved. -// - - -#include -#include - - -extern void asmFunc(void); - - -int main(void) -{ - printf("\n\nHello, world!\n"); - cgetc(); - //asmFunc(); - return 0; -} \ No newline at end of file diff --git a/DevApple.vii b/make/DevApple.vii similarity index 100% rename from DevApple.vii rename to make/DevApple.vii diff --git a/make/V2Make.scpt b/make/V2Make.scpt index f7a98cbe321d9704ec1db4611543f83d3f8c298a..52d451d938406b185f6305c4e11a3010e829738c 100644 GIT binary patch delta 95 zcmZorouj(phah9pH~5d>C9A|8HerVEn%YL~LeYNGwh+Vqj$8`E~E!S^#7894i0- delta 47 zcmbQE+Mv4Ohah9@V!Z diff --git a/make/createDiskImage b/make/createDiskImage index 784212e..4ac697f 100755 --- a/make/createDiskImage +++ b/make/createDiskImage @@ -1,6 +1,6 @@ #!/bin/sh -if [ $# -lt 4 ] +if [ $# -lt 5 ] then echo USAGE: $0 ' ' exit 1 @@ -11,6 +11,7 @@ APPLECOMMANDER=$1 MACHINE=$2 DISKIMAGE=$3 PROGRAM=$4 +STARTADDR=`echo $5 | sed 's/^0*//'` if [ ! -f "$PROGRAM" ] then @@ -151,8 +152,13 @@ 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 + HDR_STARTADDR=`od -t x2 -N 2 < "$PROGRAM" | head -1 | awk '{print $2}' | sed 's/^0*//'` + if [ "$HDR_STARTADDR" = "$STARTADDR" ] + then + dd if="$PROGRAM" bs=4 skip=1 | java -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE 0x$STARTADDR + else + java -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE 0x$STARTADDR < "$PROGRAM" + fi else java -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE < "$PROGRAM" fi diff --git a/make/tail.mk b/make/tail.mk index 6331f35..917fc62 100644 --- a/make/tail.mk +++ b/make/tail.mk @@ -31,8 +31,18 @@ ifneq ($(START_ADDR),) ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),) $(error You cannot change start address with this machine type) endif - LDFLAGS += --start-addr 0x$(START_ADDR) +else + ifneq ($(filter $(MACHINE), apple2 apple2-dos33 apple2enh apple2enh-dos33),) + START_ADDR=803 + endif + ifneq ($(filter $(MACHINE), apple2-system apple2enh-system),) + START_ADDR=2000 + endif + ifneq ($(filter $(MACHINE), apple2-loader apple2-reboot apple2enh-loader apple2enh-reboot),) + START_ADDR=800 + endif endif +LDFLAGS += --start-addr 0x$(START_ADDR) ifneq ($(filter $(MACHINE), apple2 apple2enh apple2-dos33 apple2enh-dos33),) EXECCMD=$(shell echo brun $(PGM) | tr '[a-z]' '[A-Z]') @@ -64,10 +74,10 @@ $(PGM): $(OBJS) $(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o $(PGM) $(OBJS) $(DISKIMAGE): $(PGM) - make/createDiskImage $(AC) $(MACHINE) $(DISKIMAGE) $(PGM) + make/createDiskImage $(AC) $(MACHINE) $(DISKIMAGE) $(PGM) "$(START_ADDR)" execute: $(DISKIMAGE) - osascript make/V2Make.scpt $(PROJECT_DIR) $(PGM) $(PROJECT_DIR)/DevApple.vii "$(EXECCMD)" + osascript make/V2Make.scpt $(PROJECT_DIR) $(PGM) $(PROJECT_DIR)/make/DevApple.vii "$(EXECCMD)" %.o: %.c $(CL65) $(MACHCONFIG) $(CFLAGS) --create-dep -c -o $@ $< diff --git a/exampleAsm.s b/x.s similarity index 92% rename from exampleAsm.s rename to x.s index eb02186..ab71277 100644 --- a/exampleAsm.s +++ b/x.s @@ -10,8 +10,6 @@ ; http://www.quinndunki.com/blondihacks ; - .export _asmFunc - ; Reserved locations INVERSE = $32 @@ -30,9 +28,9 @@ COUT = $fded -; _asmFunc +; Main -_asmFunc: +main: lda #CHAR_FLASH sta INVERSE