Add a plugin to provide cc65 assembly syntax highlighting. Fix the C file template so the guards work. Supporting adding extra directories to look for source files to build.

This commit is contained in:
Jeremy Rand 2018-06-12 23:27:01 -04:00
parent 406b08ece8
commit e9183b8877
14 changed files with 489 additions and 29 deletions

View File

@ -48,13 +48,9 @@ PGM=___PACKAGENAME___
# Note: You can assemble for 65816 in 16-bit mode but the C compiler
# will only produce 8-bit code.
# 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)
# Add any other directories where you are putting C or assembly source
# files to this list:
SRCDIRS+=
# Any *.s files in your main project directory will automatically be
# built. But, if you have subdirectories with assembly files in them,

View File

@ -20,8 +20,7 @@ CC65=$(CC65_BIN)/cc65
AC=make/AppleCommander.jar
C_SRCS=$(wildcard *.c)
ASM_SRCS=$(wildcard *.s)
SRCDIRS=.
MACHINE=apple2
CPU=6502

View File

@ -14,10 +14,14 @@ export PATH := $(PATH):$(CC65_BIN)
CWD=$(shell pwd)
C_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.c, $(SRCDIRS))))
C_OBJS=$(C_SRCS:.c=.o)
C_DEPS=$(C_SRCS:.c=.u)
ASM_SRCS=$(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS))))
ASM_OBJS=$(ASM_SRCS:.s=.o)
ASM_LSTS=$(ASM_SRCS:.s=.lst)
OBJS=$(C_OBJS) $(ASM_OBJS)
MAPFILE=$(PGM).map
@ -79,9 +83,6 @@ clean:
rm -f $(ASM_LSTS)
rm -f "$(DISKIMAGE)"
createPackage:
pkg/createPackage
cleanMacCruft:
rm -rf pkg

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleIdentifier</key>
<string>com.rand-family.xcode.cc65</string>
<key>CFBundleName</key>
<string>cc65 Xcode Plug-in</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>DVTPlugInCompatibilityUUIDs</key>
<array>
<string>DF11C142-1584-4A99-87AC-1925D5F5652A</string>
<string>8A66E736-A720-4B3C-92F1-33D9962C69DF</string>
<string>65C57D32-1E9B-44B8-8C04-A27BA7AAE2C4</string>
<string>DA4FDFD8-C509-4D8B-8B55-84A7B66AE701</string>
<string>E0A62D1F-3C18-4D74-BFE5-A4167D643966</string>
<string>DFFB3951-EB0A-4C09-9DAC-5F2D28CC839C</string>
<string>CA351AD8-3176-41CB-875C-42A05C7CDEC7</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>plug-in</key>
<dict>
<key>extensions</key>
<dict>
<key>Xcode.FileDataType.ca65.Assembly</key>
<dict>
<key>id</key>
<string>Xcode.FileDataType.ca65.Assembly</string>
<key>localizedDescription</key>
<string>ca65 Assembly Source</string>
<key>name</key>
<string>File type for ca65 assembly</string>
<key>point</key>
<string>Xcode.FileDataType</string>
<key>typeConformedTo</key>
<array>
<dict>
<key>typeIdentifier</key>
<string>public.assembly-source</string>
</dict>
</array>
<key>typeIdentifier</key>
<string>com.rand-family.xcode.ca65</string>
<key>version</key>
<string>1.0</string>
</dict>
<key>Xcode.FileDataTypeDetector.ca65.Assembly</key>
<dict>
<key>detectedTypeIdentifier</key>
<string>com.rand-family.xcode.ca65</string>
<key>id</key>
<string>Xcode.FileDataTypeDetector.ca65.Assembly</string>
<key>matchesExtension</key>
<string>s</string>
<key>point</key>
<string>Xcode.FileDataTypeDetector</string>
</dict>
<key>Xcode.SourceCodeLanguage.ca65-Assembly</key>
<dict>
<key>commentSyntax</key>
<array>
<dict>
<key>prefix</key>
<string>;</string>
</dict>
</array>
<key>conformsTo</key>
<array>
<dict>
<key>identifier</key>
<string>Xcode.SourceCodeLanguage.Generic</string>
</dict>
</array>
<key>fileDataType</key>
<array>
<dict>
<key>identifier</key>
<string>com.rand-family.xcode.ca65</string>
</dict>
</array>
<key>id</key>
<string>Xcode.SourceCodeLanguage.ca65-Assembly</string>
<key>languageName</key>
<string>ca65 Assembly</string>
<key>languageSpecification</key>
<string>xcode.lang.asm.ca65</string>
<key>name</key>
<string>ca65 Assembly</string>
<key>point</key>
<string>Xcode.SourceCodeLanguage</string>
<key>supportsIndentation</key>
<string>true</string>
<key>version</key>
<string>1.0</string>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,334 @@
// ca65 Assembler language specs
(
/****************************************************************************/
// MARK: Keywords
/****************************************************************************/
{
Identifier = "xcode.lang.asm.ca65.identifier";
Syntax = {
CaseSensitive = NO;
StartChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@";
Chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Type = "xcode.syntax.identifier";
};
},
{
Identifier = "xcode.lang.asm.ca65.keyword";
Syntax = {
CaseSensitive = NO;
StartChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_~";
Chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~";
Words = (
"adc",
"and",
"asl",
"bcc",
"bcs",
"beq",
"bge",
"bit",
"blt",
"bmi",
"bne",
"bpl",
"bra",
"brk",
"brl",
"bvc",
"bvs",
"clc",
"cld",
"cli",
"clv",
"cmp",
"cop",
"cpa",
"cpx",
"cpy",
"dec",
"dex",
"dey",
"eor",
"inc",
"inx",
"iny",
"jmp",
"jsl",
"jsr",
"lda",
"ldx",
"ldy",
"lsr",
"mvn",
"mvp",
"nop",
"ora",
"pea",
"pei",
"per",
"pha",
"phb",
"phd",
"phk",
"php",
"phx",
"phy",
"pla",
"plb",
"pld",
"plp",
"plx",
"ply",
"rep",
"rol",
"ror",
"rti",
"rtl",
"rts",
"sbc",
"sec",
"sed",
"sei",
"sep",
"sta",
"stp",
"stx",
"sty",
"stz",
"tax",
"tay",
"tcd",
"tcs",
"tdc",
"trb",
"tsb",
"tsc",
"tsx",
"txa",
"txs",
"txy",
"tya",
"tyx",
"wai",
"wdm",
"xba",
"xce",
".asize",
".cpu",
".isize",
".paramcount",
".time",
".version",
".addrsize",
".bank",
".bankbyte",
".blank",
".concat",
".const",
".hibyte",
".hiword",
".ident",
".left",
".lobyte",
".loword",
".match",
".max",
".mid",
".min",
".ref",
".referenced",
".right",
".sizeof",
".strat",
".sprintf",
".string",
".strlen",
".tcount",
".xmatch",
".a16",
".a8",
".addr",
".align",
".asciiz",
".assert",
".autoimport",
".bankbytes",
".bss",
".byt",
".byte",
".case",
".charmap",
".code",
".condes",
".constructor",
".data",
".dbyt",
".debuginfo",
".define",
".delmac",
".delmacro",
".def",
".defined",
".definemacro",
".destructor",
".dword",
".else",
".elseif",
".end",
".endenum",
".endif",
".endmac",
".endmacro",
".endproc",
".endrep",
".endrepeat",
".endscope",
".endstruct",
".endunion",
".enum",
".error",
".exitmac",
".exitmacro",
".export",
".exportzp",
".faraddr",
".fatal",
".feature",
".fileopt",
".fopt",
".forceimport",
".global",
".globalzp",
".hibytes",
".i16",
".i8",
".if",
".ifblank",
".ifconst",
".ifdef",
".ifnblank",
".ifndef",
".ifnref",
".ifp02",
".ifp4510",
".ifp816",
".ifpc02",
".ifpsc02",
".ifref",
".import",
".importzp",
".incbin",
".include",
".interruptor",
".ismnem",
".ismnemonic",
".linecont",
".list",
".listbytes",
".lobytes",
".local",
".localchar",
".macpack",
".mac",
".macro",
".org",
".out",
".p02",
".p4510",
".p816",
".pagelen",
".pagelength",
".pc02",
".popcpu",
".popseg",
".proc",
".psc02",
".pushcpu",
".pushseg",
".reloc",
".repeat",
".res",
".rodata",
".scope",
".segment",
".set",
".setcpu",
".smart",
".struct",
".tag",
".undef",
".undefine",
".union",
".warning",
".word",
".zeropage"
);
Type = "xcode.syntax.keyword";
AltType = "xcode.syntax.identifier";
};
},
/****************************************************************************/
// MARK: Simple Syntax Coloring
/****************************************************************************/
{
Identifier = "xcode.lang.asm.ca65";
Description = "ca65 Assembler Coloring";
BasedOn = "xcode.lang.simpleColoring";
IncludeInMenu = YES;
Name = "Assembly (ca65)";
Syntax = {
Tokenizer = "xcode.lang.asm.ca65.lexer";
IncludeRules = (
"xcode.lang.asm.ca65.codeblock",
);
Type = "xcode.syntax.plain";
};
},
{
Identifier = "xcode.lang.asm.ca65.lexer";
Syntax = {
IncludeRules = (
"xcode.lang.asm.ca65.comment.semi",
"xcode.lang.string",
"xcode.lang.character",
"xcode.lang.number",
"xcode.lang.asm.ca65.keyword",
"xcode.lang.asm.ca65.identifier",
);
};
},
{
Identifier = "xcode.lang.asm.ca65.comment.semi";
Syntax = {
StartAtBOL = YES;
StartAtColumnZero = YES;
Start = ";";
End = "\n";
IncludeRules = ( "xcode.lang.url", "xcode.lang.url.mail", "xcode.lang.comment.mark" );
Type = "xcode.syntax.comment";
};
},
{
Identifier = "xcode.lang.asm.ca65.codeblock";
Syntax = {
Tokenizer = "xcode.lang.asm.ca65.lexer";
Start = ".proc";
End = ".endproc";
Recursive = NO;
Foldable = YES;
Type = "xcode.syntax.definition.function";
IncludeRules = (
);
};
},
)

View File

@ -3,7 +3,7 @@
; ___PROJECTNAME___
;
; Created by ___FULLUSERNAME___ on ___DATE___.
;___COPYRIGHT___
; ___COPYRIGHT___
;
@ -11,7 +11,7 @@ COUT = $fded
KEYBOARD = $c000
STROBE = $c010
main:
.proc main
ldx #$00
loop:
lda msg, X
@ -26,5 +26,6 @@ wait:
bpl wait
lda STROBE
rts
.endproc
msg: .asciiz "HELLO, WORLD"

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<dict>
<key>AllowedTypes</key>
<array>
<string>com.rand-family.xcode.ca65</string>
</array>
<key>DefaultCompletionName</key>
<string>File</string>
<key>Description</key>
@ -12,5 +16,5 @@
<string>___FILEBASENAME___.s</string>
<key>Summary</key>
<string>An assembly source file</string>
</dict>
</dict>
</plist>

View File

@ -3,5 +3,5 @@
; ___PROJECTNAME___
;
; Created by ___FULLUSERNAME___ on ___DATE___.
;___COPYRIGHT___
; ___COPYRIGHT___
;

View File

@ -3,7 +3,7 @@
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
// ___COPYRIGHT___
//
#include <stdio.h>

View File

@ -3,7 +3,7 @@
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
// ___COPYRIGHT___
//
#include "___FILEBASENAME___.h"

View File

@ -3,12 +3,12 @@
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
// ___COPYRIGHT___
//
#ifndef _____PROJECTNAMEASIDENTIFIER________FILEBASENAMEASIDENTIFIER_____
#define _____PROJECTNAMEASIDENTIFIER________FILEBASENAMEASIDENTIFIER_____
#ifndef _GUARD_PROJECT___PROJECTNAMEASIDENTIFIER____FILE___FILEBASENAMEASIDENTIFIER____
#define _GUARD_PROJECT___PROJECTNAMEASIDENTIFIER____FILE___FILEBASENAMEASIDENTIFIER____
#endif /* defined(_____PROJECTNAMEASIDENTIFIER________FILEBASENAMEASIDENTIFIER_____) */
#endif /* define _GUARD_PROJECT___PROJECTNAMEASIDENTIFIER____FILE___FILEBASENAMEASIDENTIFIER____ */

View File

@ -2,16 +2,19 @@
TMPDIR=/tmp/pkg.$$
mkdir $TMPDIR
cp -R pkg/Templates $TMPDIR
cp -R pkg/Specifications $TMPDIR
cp -R pkg/Plug-ins $TMPDIR
cp -R make $TMPDIR/'Apple II/Apple II C Project.xctemplate/'
cp Makefile $TMPDIR/'Apple II/Apple II C Project.xctemplate/'
cp main.c $TMPDIR/'Apple II/Apple II C Project.xctemplate/'
cp -R make $TMPDIR/Templates/'Apple II/Apple II C Project.xctemplate/'
cp Makefile $TMPDIR/Templates/'Apple II/Apple II C Project.xctemplate/'
cp main.c $TMPDIR/Templates/'Apple II/Apple II C Project.xctemplate/'
cp -R make $TMPDIR/'Apple II/Apple II Asm Project.xctemplate/'
cp Makefile $TMPDIR/'Apple II/Apple II Asm Project.xctemplate/'
cp -R make $TMPDIR/Templates/'Apple II/Apple II Asm Project.xctemplate/'
cp Makefile $TMPDIR/Templates/'Apple II/Apple II Asm Project.xctemplate/'
pkgbuild --root $TMPDIR --version 1.4 --identifier com.halcyontouch.Apple2Template.pkg --install-location /Library/Developer/Xcode/Templates/ --scripts pkg/scripts/ AppleXcodeTemplate.pkg
pkgbuild --root $TMPDIR --version 2.0 --identifier com.halcyontouch.Apple2Template.pkg --install-location /Library/Developer/Xcode/ --scripts pkg/scripts/ AppleXcodeTemplate.pkg
productbuild --distribution pkg/Distribution.xml --resource ./pkg temp.pkg
rm AppleXcodeTemplate.pkg
productsign --sign "Developer ID Installer" temp.pkg AppleXcodeTemplate.pkg

3
pkg/scripts/postinstall Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
defaults write ~/Library/Developer/Xcode/Plug-ins/cc65.ideplugin/Contents/Info.plist DVTPlugInCompatibilityUUIDs -array $(defaults read /Applications/Xcode.app/Contents/Info.plist DVTPlugInCompatibilityUUID)