1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-27 09:31:18 +00:00

Renamed import to #include. #169

This commit is contained in:
jespergravgaard 2020-04-07 12:43:31 +02:00
parent d8138615ac
commit 682757b10c
161 changed files with 2526 additions and 2401 deletions

View File

@ -62,9 +62,7 @@ ASSIGN: '=' ;
ASSIGN_COMPOUND : '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '&=' | '|=' | '^=' ; ASSIGN_COMPOUND : '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '&=' | '|=' | '^=' ;
// Keywords // Keywords
IMPORT: 'import' { importEnter=true; } ;
TYPEDEF: 'typedef' ; TYPEDEF: 'typedef' ;
PRAGMA: '#pragma' ;
RESERVE:'reserve' ; RESERVE:'reserve' ;
PC:'pc'; PC:'pc';
TARGET:'target'; TARGET:'target';
@ -123,7 +121,10 @@ KICKASM_BODY: '{{' .*? '}}';
STRING : '"' ('\\"' | ~'"')* '"' [z]?([ps][mu]?)?[z]? { if(importEnter) { importEnter=false; cParser.loadCFile(getText()); } } ; STRING : '"' ('\\"' | ~'"')* '"' [z]?([ps][mu]?)?[z]? { if(importEnter) { importEnter=false; cParser.loadCFile(getText()); } } ;
CHAR : '\'' ('\\'['"rfn] | ~'\'' ) '\''; CHAR : '\'' ('\\'['"rfn] | ~'\'' ) '\'';
// Macros // Preprocessor
IMPORT: '#import' { importEnter=true; } ;
INCLUDE: '#include' { importEnter=true; } ;
PRAGMA: '#pragma' ;
DEFINE: '#define' ; DEFINE: '#define' ;
DEFINE_CONTINUE: '\\\n' | '\\\r\n'; DEFINE_CONTINUE: '\\\n' | '\\\r\n';
UNDEF: '#undef' ; UNDEF: '#undef' ;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -35,122 +35,123 @@ LOGIC_AND=34
LOGIC_OR=35 LOGIC_OR=35
ASSIGN=36 ASSIGN=36
ASSIGN_COMPOUND=37 ASSIGN_COMPOUND=37
IMPORT=38 TYPEDEF=38
TYPEDEF=39 RESERVE=39
PRAGMA=40 PC=40
RESERVE=41 TARGET=41
PC=42 LINK=42
TARGET=43 CPU=43
LINK=44 CODESEG=44
CPU=45 DATASEG=45
CODESEG=46 ENCODING=46
DATASEG=47 CONST=47
ENCODING=48 EXTERN=48
CONST=49 EXPORT=49
EXTERN=50 ALIGN=50
EXPORT=51 INLINE=51
ALIGN=52 VOLATILE=52
INLINE=53 STATIC=53
VOLATILE=54 INTERRUPT=54
STATIC=55 REGISTER=55
INTERRUPT=56 ADDRESS=56
REGISTER=57 ADDRESS_ZEROPAGE=57
ADDRESS=58 ADDRESS_MAINMEM=58
ADDRESS_ZEROPAGE=59 FORM_SSA=59
ADDRESS_MAINMEM=60 FORM_MA=60
FORM_SSA=61 CALLING=61
FORM_MA=62 CALLINGCONVENTION=62
CALLING=63 VARMODEL=63
CALLINGCONVENTION=64 IF=64
VARMODEL=65 ELSE=65
IF=66 WHILE=66
ELSE=67 DO=67
WHILE=68 FOR=68
DO=69 SWITCH=69
FOR=70 RETURN=70
SWITCH=71 BREAK=71
RETURN=72 CONTINUE=72
BREAK=73 ASM=73
CONTINUE=74 DEFAULT=74
ASM=75 CASE=75
DEFAULT=76 STRUCT=76
CASE=77 ENUM=77
STRUCT=78 SIZEOF=78
ENUM=79 TYPEID=79
SIZEOF=80 DEFINED=80
TYPEID=81 KICKASM=81
DEFINED=82 RESOURCE=82
KICKASM=83 USES=83
RESOURCE=84 CLOBBERS=84
USES=85 BYTES=85
CLOBBERS=86 CYCLES=86
BYTES=87 LOGIC_NOT=87
CYCLES=88 SIGNEDNESS=88
LOGIC_NOT=89 SIMPLETYPE=89
SIGNEDNESS=90 BOOLEAN=90
SIMPLETYPE=91 KICKASM_BODY=91
BOOLEAN=92 STRING=92
KICKASM_BODY=93 CHAR=93
STRING=94 IMPORT=94
CHAR=95 INCLUDE=95
DEFINE=96 PRAGMA=96
DEFINE_CONTINUE=97 DEFINE=97
UNDEF=98 DEFINE_CONTINUE=98
IFDEF=99 UNDEF=99
IFNDEF=100 IFDEF=100
IFIF=101 IFNDEF=101
ELIF=102 IFIF=102
IFELSE=103 ELIF=103
ENDIF=104 IFELSE=104
NUMBER=105 ENDIF=105
NUMFLOAT=106 NUMBER=106
BINFLOAT=107 NUMFLOAT=107
DECFLOAT=108 BINFLOAT=108
HEXFLOAT=109 DECFLOAT=109
NUMINT=110 HEXFLOAT=110
BININTEGER=111 NUMINT=111
DECINTEGER=112 BININTEGER=112
HEXINTEGER=113 DECINTEGER=113
NAME=114 HEXINTEGER=114
WS=115 NAME=115
COMMENT_LINE=116 WS=116
COMMENT_BLOCK=117 COMMENT_LINE=117
ASM_BYTE=118 COMMENT_BLOCK=118
ASM_MNEMONIC=119 ASM_BYTE=119
ASM_IMM=120 ASM_MNEMONIC=120
ASM_COLON=121 ASM_IMM=121
ASM_COMMA=122 ASM_COLON=122
ASM_PAR_BEGIN=123 ASM_COMMA=123
ASM_PAR_END=124 ASM_PAR_BEGIN=124
ASM_BRACKET_BEGIN=125 ASM_PAR_END=125
ASM_BRACKET_END=126 ASM_BRACKET_BEGIN=126
ASM_DOT=127 ASM_BRACKET_END=127
ASM_SHIFT_LEFT=128 ASM_DOT=128
ASM_SHIFT_RIGHT=129 ASM_SHIFT_LEFT=129
ASM_PLUS=130 ASM_SHIFT_RIGHT=130
ASM_MINUS=131 ASM_PLUS=131
ASM_LESS_THAN=132 ASM_MINUS=132
ASM_GREATER_THAN=133 ASM_LESS_THAN=133
ASM_MULTIPLY=134 ASM_GREATER_THAN=134
ASM_DIVIDE=135 ASM_MULTIPLY=135
ASM_CURLY_BEGIN=136 ASM_DIVIDE=136
ASM_CURLY_END=137 ASM_CURLY_BEGIN=137
ASM_NUMBER=138 ASM_CURLY_END=138
ASM_NUMFLOAT=139 ASM_NUMBER=139
ASM_BINFLOAT=140 ASM_NUMFLOAT=140
ASM_DECFLOAT=141 ASM_BINFLOAT=141
ASM_HEXFLOAT=142 ASM_DECFLOAT=142
ASM_NUMINT=143 ASM_HEXFLOAT=143
ASM_BININTEGER=144 ASM_NUMINT=144
ASM_DECINTEGER=145 ASM_BININTEGER=145
ASM_HEXINTEGER=146 ASM_DECINTEGER=146
ASM_CHAR=147 ASM_HEXINTEGER=147
ASM_MULTI_REL=148 ASM_CHAR=148
ASM_MULTI_NAME=149 ASM_MULTI_REL=149
ASM_NAME=150 ASM_MULTI_NAME=150
ASM_WS=151 ASM_NAME=151
ASM_COMMENT_LINE=152 ASM_WS=152
ASM_COMMENT_BLOCK=153 ASM_COMMENT_LINE=153
ASM_COMMENT_BLOCK=154
';'=8 ';'=8
'..'=11 '..'=11
'?'=12 '?'=12
@ -169,64 +170,65 @@ ASM_COMMENT_BLOCK=153
'&&'=34 '&&'=34
'||'=35 '||'=35
'='=36 '='=36
'import'=38 'typedef'=38
'typedef'=39 'reserve'=39
'#pragma'=40 'pc'=40
'reserve'=41 'target'=41
'pc'=42 'link'=42
'target'=43 'cpu'=43
'link'=44 'code_seg'=44
'cpu'=45 'data_seg'=45
'code_seg'=46 'encoding'=46
'data_seg'=47 'const'=47
'encoding'=48 'extern'=48
'const'=49 'export'=49
'extern'=50 'align'=50
'export'=51 'inline'=51
'align'=52 'volatile'=52
'inline'=53 'static'=53
'volatile'=54 'interrupt'=54
'static'=55 'register'=55
'interrupt'=56 '__address'=56
'register'=57 '__zp'=57
'__address'=58 '__mem'=58
'__zp'=59 '__ssa'=59
'__mem'=60 '__ma'=60
'__ssa'=61 'calling'=61
'__ma'=62 'var_model'=63
'calling'=63 'if'=64
'var_model'=65 'else'=65
'if'=66 'while'=66
'else'=67 'do'=67
'while'=68 'for'=68
'do'=69 'switch'=69
'for'=70 'return'=70
'switch'=71 'break'=71
'return'=72 'continue'=72
'break'=73 'asm'=73
'continue'=74 'default'=74
'asm'=75 'case'=75
'default'=76 'struct'=76
'case'=77 'enum'=77
'struct'=78 'sizeof'=78
'enum'=79 'typeid'=79
'sizeof'=80 'defined'=80
'typeid'=81 'kickasm'=81
'defined'=82 'resource'=82
'kickasm'=83 'uses'=83
'resource'=84 'clobbers'=84
'uses'=85 'bytes'=85
'clobbers'=86 'cycles'=86
'bytes'=87 '!'=87
'cycles'=88 '#import'=94
'!'=89 '#include'=95
'#define'=96 '#pragma'=96
'#undef'=98 '#define'=97
'#ifdef'=99 '#undef'=99
'#ifndef'=100 '#ifdef'=100
'#if'=101 '#ifndef'=101
'#elif'=102 '#if'=102
'#else'=103 '#elif'=103
'#endif'=104 '#else'=104
'.byte'=118 '#endif'=105
'#'=120 '.byte'=119
'#'=121

View File

@ -35,7 +35,8 @@ declOrImport
; ;
importDecl importDecl
: IMPORT STRING : IMPORT STRING #importFile
| INCLUDE STRING #includeFile
; ;
decl decl

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -35,122 +35,123 @@ LOGIC_AND=34
LOGIC_OR=35 LOGIC_OR=35
ASSIGN=36 ASSIGN=36
ASSIGN_COMPOUND=37 ASSIGN_COMPOUND=37
IMPORT=38 TYPEDEF=38
TYPEDEF=39 RESERVE=39
PRAGMA=40 PC=40
RESERVE=41 TARGET=41
PC=42 LINK=42
TARGET=43 CPU=43
LINK=44 CODESEG=44
CPU=45 DATASEG=45
CODESEG=46 ENCODING=46
DATASEG=47 CONST=47
ENCODING=48 EXTERN=48
CONST=49 EXPORT=49
EXTERN=50 ALIGN=50
EXPORT=51 INLINE=51
ALIGN=52 VOLATILE=52
INLINE=53 STATIC=53
VOLATILE=54 INTERRUPT=54
STATIC=55 REGISTER=55
INTERRUPT=56 ADDRESS=56
REGISTER=57 ADDRESS_ZEROPAGE=57
ADDRESS=58 ADDRESS_MAINMEM=58
ADDRESS_ZEROPAGE=59 FORM_SSA=59
ADDRESS_MAINMEM=60 FORM_MA=60
FORM_SSA=61 CALLING=61
FORM_MA=62 CALLINGCONVENTION=62
CALLING=63 VARMODEL=63
CALLINGCONVENTION=64 IF=64
VARMODEL=65 ELSE=65
IF=66 WHILE=66
ELSE=67 DO=67
WHILE=68 FOR=68
DO=69 SWITCH=69
FOR=70 RETURN=70
SWITCH=71 BREAK=71
RETURN=72 CONTINUE=72
BREAK=73 ASM=73
CONTINUE=74 DEFAULT=74
ASM=75 CASE=75
DEFAULT=76 STRUCT=76
CASE=77 ENUM=77
STRUCT=78 SIZEOF=78
ENUM=79 TYPEID=79
SIZEOF=80 DEFINED=80
TYPEID=81 KICKASM=81
DEFINED=82 RESOURCE=82
KICKASM=83 USES=83
RESOURCE=84 CLOBBERS=84
USES=85 BYTES=85
CLOBBERS=86 CYCLES=86
BYTES=87 LOGIC_NOT=87
CYCLES=88 SIGNEDNESS=88
LOGIC_NOT=89 SIMPLETYPE=89
SIGNEDNESS=90 BOOLEAN=90
SIMPLETYPE=91 KICKASM_BODY=91
BOOLEAN=92 STRING=92
KICKASM_BODY=93 CHAR=93
STRING=94 IMPORT=94
CHAR=95 INCLUDE=95
DEFINE=96 PRAGMA=96
DEFINE_CONTINUE=97 DEFINE=97
UNDEF=98 DEFINE_CONTINUE=98
IFDEF=99 UNDEF=99
IFNDEF=100 IFDEF=100
IFIF=101 IFNDEF=101
ELIF=102 IFIF=102
IFELSE=103 ELIF=103
ENDIF=104 IFELSE=104
NUMBER=105 ENDIF=105
NUMFLOAT=106 NUMBER=106
BINFLOAT=107 NUMFLOAT=107
DECFLOAT=108 BINFLOAT=108
HEXFLOAT=109 DECFLOAT=109
NUMINT=110 HEXFLOAT=110
BININTEGER=111 NUMINT=111
DECINTEGER=112 BININTEGER=112
HEXINTEGER=113 DECINTEGER=113
NAME=114 HEXINTEGER=114
WS=115 NAME=115
COMMENT_LINE=116 WS=116
COMMENT_BLOCK=117 COMMENT_LINE=117
ASM_BYTE=118 COMMENT_BLOCK=118
ASM_MNEMONIC=119 ASM_BYTE=119
ASM_IMM=120 ASM_MNEMONIC=120
ASM_COLON=121 ASM_IMM=121
ASM_COMMA=122 ASM_COLON=122
ASM_PAR_BEGIN=123 ASM_COMMA=123
ASM_PAR_END=124 ASM_PAR_BEGIN=124
ASM_BRACKET_BEGIN=125 ASM_PAR_END=125
ASM_BRACKET_END=126 ASM_BRACKET_BEGIN=126
ASM_DOT=127 ASM_BRACKET_END=127
ASM_SHIFT_LEFT=128 ASM_DOT=128
ASM_SHIFT_RIGHT=129 ASM_SHIFT_LEFT=129
ASM_PLUS=130 ASM_SHIFT_RIGHT=130
ASM_MINUS=131 ASM_PLUS=131
ASM_LESS_THAN=132 ASM_MINUS=132
ASM_GREATER_THAN=133 ASM_LESS_THAN=133
ASM_MULTIPLY=134 ASM_GREATER_THAN=134
ASM_DIVIDE=135 ASM_MULTIPLY=135
ASM_CURLY_BEGIN=136 ASM_DIVIDE=136
ASM_CURLY_END=137 ASM_CURLY_BEGIN=137
ASM_NUMBER=138 ASM_CURLY_END=138
ASM_NUMFLOAT=139 ASM_NUMBER=139
ASM_BINFLOAT=140 ASM_NUMFLOAT=140
ASM_DECFLOAT=141 ASM_BINFLOAT=141
ASM_HEXFLOAT=142 ASM_DECFLOAT=142
ASM_NUMINT=143 ASM_HEXFLOAT=143
ASM_BININTEGER=144 ASM_NUMINT=144
ASM_DECINTEGER=145 ASM_BININTEGER=145
ASM_HEXINTEGER=146 ASM_DECINTEGER=146
ASM_CHAR=147 ASM_HEXINTEGER=147
ASM_MULTI_REL=148 ASM_CHAR=148
ASM_MULTI_NAME=149 ASM_MULTI_REL=149
ASM_NAME=150 ASM_MULTI_NAME=150
ASM_WS=151 ASM_NAME=151
ASM_COMMENT_LINE=152 ASM_WS=152
ASM_COMMENT_BLOCK=153 ASM_COMMENT_LINE=153
ASM_COMMENT_BLOCK=154
';'=8 ';'=8
'..'=11 '..'=11
'?'=12 '?'=12
@ -169,64 +170,65 @@ ASM_COMMENT_BLOCK=153
'&&'=34 '&&'=34
'||'=35 '||'=35
'='=36 '='=36
'import'=38 'typedef'=38
'typedef'=39 'reserve'=39
'#pragma'=40 'pc'=40
'reserve'=41 'target'=41
'pc'=42 'link'=42
'target'=43 'cpu'=43
'link'=44 'code_seg'=44
'cpu'=45 'data_seg'=45
'code_seg'=46 'encoding'=46
'data_seg'=47 'const'=47
'encoding'=48 'extern'=48
'const'=49 'export'=49
'extern'=50 'align'=50
'export'=51 'inline'=51
'align'=52 'volatile'=52
'inline'=53 'static'=53
'volatile'=54 'interrupt'=54
'static'=55 'register'=55
'interrupt'=56 '__address'=56
'register'=57 '__zp'=57
'__address'=58 '__mem'=58
'__zp'=59 '__ssa'=59
'__mem'=60 '__ma'=60
'__ssa'=61 'calling'=61
'__ma'=62 'var_model'=63
'calling'=63 'if'=64
'var_model'=65 'else'=65
'if'=66 'while'=66
'else'=67 'do'=67
'while'=68 'for'=68
'do'=69 'switch'=69
'for'=70 'return'=70
'switch'=71 'break'=71
'return'=72 'continue'=72
'break'=73 'asm'=73
'continue'=74 'default'=74
'asm'=75 'case'=75
'default'=76 'struct'=76
'case'=77 'enum'=77
'struct'=78 'sizeof'=78
'enum'=79 'typeid'=79
'sizeof'=80 'defined'=80
'typeid'=81 'kickasm'=81
'defined'=82 'resource'=82
'kickasm'=83 'uses'=83
'resource'=84 'clobbers'=84
'uses'=85 'bytes'=85
'clobbers'=86 'cycles'=86
'bytes'=87 '!'=87
'cycles'=88 '#import'=94
'!'=89 '#include'=95
'#define'=96 '#pragma'=96
'#undef'=98 '#define'=97
'#ifdef'=99 '#undef'=99
'#ifndef'=100 '#ifdef'=100
'#if'=101 '#ifndef'=101
'#elif'=102 '#if'=102
'#else'=103 '#elif'=103
'#endif'=104 '#else'=104
'.byte'=118 '#endif'=105
'#'=120 '.byte'=119
'#'=121

View File

@ -1,4 +1,4 @@
// Generated from C:/c64/kickc/src/main/java/dk/camelot64/kickc/parser\KickCParser.g4 by ANTLR 4.7.2 // Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.7.2
package dk.camelot64.kickc.parser; package dk.camelot64.kickc.parser;
@ -66,13 +66,25 @@ public class KickCParserBaseListener implements KickCParserListener {
* *
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void enterImportDecl(KickCParser.ImportDeclContext ctx) { } @Override public void enterImportFile(KickCParser.ImportFileContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitImportDecl(KickCParser.ImportDeclContext ctx) { } @Override public void exitImportFile(KickCParser.ImportFileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIncludeFile(KickCParser.IncludeFileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIncludeFile(KickCParser.IncludeFileContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@ -1,4 +1,4 @@
// Generated from C:/c64/kickc/src/main/java/dk/camelot64/kickc/parser\KickCParser.g4 by ANTLR 4.7.2 // Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.7.2
package dk.camelot64.kickc.parser; package dk.camelot64.kickc.parser;
@ -47,7 +47,14 @@ public class KickCParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> imple
* <p>The default implementation returns the result of calling * <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitImportDecl(KickCParser.ImportDeclContext ctx) { return visitChildren(ctx); } @Override public T visitImportFile(KickCParser.ImportFileContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIncludeFile(KickCParser.IncludeFileContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@ -1,4 +1,4 @@
// Generated from C:/c64/kickc/src/main/java/dk/camelot64/kickc/parser\KickCParser.g4 by ANTLR 4.7.2 // Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.7.2
package dk.camelot64.kickc.parser; package dk.camelot64.kickc.parser;
@ -50,15 +50,29 @@ public interface KickCParserListener extends ParseTreeListener {
*/ */
void exitDeclOrImport(KickCParser.DeclOrImportContext ctx); void exitDeclOrImport(KickCParser.DeclOrImportContext ctx);
/** /**
* Enter a parse tree produced by {@link KickCParser#importDecl}. * Enter a parse tree produced by the {@code importFile}
* labeled alternative in {@link KickCParser#importDecl}.
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void enterImportDecl(KickCParser.ImportDeclContext ctx); void enterImportFile(KickCParser.ImportFileContext ctx);
/** /**
* Exit a parse tree produced by {@link KickCParser#importDecl}. * Exit a parse tree produced by the {@code importFile}
* labeled alternative in {@link KickCParser#importDecl}.
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitImportDecl(KickCParser.ImportDeclContext ctx); void exitImportFile(KickCParser.ImportFileContext ctx);
/**
* Enter a parse tree produced by the {@code includeFile}
* labeled alternative in {@link KickCParser#importDecl}.
* @param ctx the parse tree
*/
void enterIncludeFile(KickCParser.IncludeFileContext ctx);
/**
* Exit a parse tree produced by the {@code includeFile}
* labeled alternative in {@link KickCParser#importDecl}.
* @param ctx the parse tree
*/
void exitIncludeFile(KickCParser.IncludeFileContext ctx);
/** /**
* Enter a parse tree produced by {@link KickCParser#decl}. * Enter a parse tree produced by {@link KickCParser#decl}.
* @param ctx the parse tree * @param ctx the parse tree

View File

@ -1,4 +1,4 @@
// Generated from C:/c64/kickc/src/main/java/dk/camelot64/kickc/parser\KickCParser.g4 by ANTLR 4.7.2 // Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCParser.g4 by ANTLR 4.7.2
package dk.camelot64.kickc.parser; package dk.camelot64.kickc.parser;
@ -37,11 +37,19 @@ public interface KickCParserVisitor<T> extends ParseTreeVisitor<T> {
*/ */
T visitDeclOrImport(KickCParser.DeclOrImportContext ctx); T visitDeclOrImport(KickCParser.DeclOrImportContext ctx);
/** /**
* Visit a parse tree produced by {@link KickCParser#importDecl}. * Visit a parse tree produced by the {@code importFile}
* labeled alternative in {@link KickCParser#importDecl}.
* @param ctx the parse tree * @param ctx the parse tree
* @return the visitor result * @return the visitor result
*/ */
T visitImportDecl(KickCParser.ImportDeclContext ctx); T visitImportFile(KickCParser.ImportFileContext ctx);
/**
* Visit a parse tree produced by the {@code includeFile}
* labeled alternative in {@link KickCParser#importDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIncludeFile(KickCParser.IncludeFileContext ctx);
/** /**
* Visit a parse tree produced by {@link KickCParser#decl}. * Visit a parse tree produced by {@link KickCParser#decl}.
* @param ctx the parse tree * @param ctx the parse tree

View File

@ -93,7 +93,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
} }
@Override @Override
public Object visitImportDecl(KickCParser.ImportDeclContext ctx) { public Object visitImportFile(KickCParser.ImportFileContext ctx) {
String importName = ctx.STRING().getText(); String importName = ctx.STRING().getText();
String importFileName = importName.substring(1, importName.length() - 1); String importFileName = importName.substring(1, importName.length() - 1);
if(program.getLog().isVerboseParse()) { if(program.getLog().isVerboseParse()) {
@ -102,6 +102,16 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
return null; return null;
} }
@Override
public Object visitIncludeFile(KickCParser.IncludeFileContext ctx) {
String includeName = ctx.STRING().getText();
String includeFileName = includeName.substring(1, includeName.length() - 1);
if(program.getLog().isVerboseParse()) {
program.getLog().append("Including " + includeFileName);
}
return null;
}
@Override @Override
public Object visitGlobalDirectiveVarModel(KickCParser.GlobalDirectiveVarModelContext ctx) { public Object visitGlobalDirectiveVarModel(KickCParser.GlobalDirectiveVarModelContext ctx) {
List<TerminalNode> settingNodes = new ArrayList<>(ctx.NAME()); List<TerminalNode> settingNodes = new ArrayList<>(ctx.NAME());

View File

@ -1,5 +1,5 @@
// Simple single-color (320x200) bitmap routines // Simple single-color (320x200) bitmap routines
import "string" #include "string"
// The adddress of the bitmap screen (used for colors) // The adddress of the bitmap screen (used for colors)
byte* bitmap_screen; byte* bitmap_screen;

View File

@ -4,7 +4,7 @@
// (J) https://www.c64-wiki.com/wiki/C64DTV_Programming_Guide // (J) https://www.c64-wiki.com/wiki/C64DTV_Programming_Guide
// (H) http://dtvhacking.cbm8bit.com/dtv_wiki/images/d/d9/Dtv_registers_full.txt // (H) http://dtvhacking.cbm8bit.com/dtv_wiki/images/d/d9/Dtv_registers_full.txt
import "c64.kc" #include "c64.kc"
// Feature enables or disables the extra C64 DTV features // Feature enables or disables the extra C64 DTV features
byte* const DTV_FEATURE = $d03f; byte* const DTV_FEATURE = $d03f;

View File

@ -16,7 +16,7 @@
// |7. | #%01111111 (127/$7f) | STOP ($ )| q ($11)|COMMODR($ )| SPACE ($20)| 2 ($32)|CONTROL($ )| <- ($1f)| 1 ($31)| // |7. | #%01111111 (127/$7f) | STOP ($ )| q ($11)|COMMODR($ )| SPACE ($20)| 2 ($32)|CONTROL($ )| <- ($1f)| 1 ($31)|
// +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+ // +----+----------------------+------------+------------+------------+------------+------------+------------+------------+------------+
import "c64.kc" #include "c64.kc"
// Keyboard Codes for all 63 keys. // Keyboard Codes for all 63 keys.
// Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7). // Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7).

View File

@ -12,7 +12,7 @@
// In practice a good method is to wait until the raster is beyond plexFreeNextYpos() and then call plexShowSprite(). Repeat until all 32 sprites have been shown. // In practice a good method is to wait until the raster is beyond plexFreeNextYpos() and then call plexShowSprite(). Repeat until all 32 sprites have been shown.
// TODO: Let the caller specify the number of sprites to use (or add PLEX_ENABLE[PLEX_COUNT]) // TODO: Let the caller specify the number of sprites to use (or add PLEX_ENABLE[PLEX_COUNT])
import "c64" #include "c64"
// The number of sprites in the multiplexer // The number of sprites in the multiplexer
const char PLEX_COUNT = 32; const char PLEX_COUNT = 32;

View File

@ -1,5 +1,5 @@
import "stdlib" #include "stdlib"
import "string" #include "string"
byte* print_screen = $0400; byte* print_screen = $0400;
byte* print_line_cursor = print_screen; byte* print_line_cursor = print_screen;

View File

@ -4,8 +4,8 @@
// Uses the approximation sin(x) = x - x^/6 + x^/128 // Uses the approximation sin(x) = x - x^/6 + x^/128
// Optimization possibility: Use symmetries when generating sinustables. wavelength%2==0 -> mirror symmetry over PI, wavelength%4==0 -> mirror symmetry over PI/2. // Optimization possibility: Use symmetries when generating sinustables. wavelength%2==0 -> mirror symmetry over PI, wavelength%4==0 -> mirror symmetry over PI/2.
import "division.kc" #include "division.kc"
import "multiply.kc" #include "multiply.kc"
// PI*2 in u[4.28] format // PI*2 in u[4.28] format
const dword PI2_u4f28 = $6487ed51; const dword PI2_u4f28 = $6487ed51;

View File

@ -1,6 +1,6 @@
// Table-based implementation of integer square sqr() and square root sqrt() // Table-based implementation of integer square sqr() and square root sqrt()
import "stdlib" #include "stdlib"
// The number of squares to pre-calculate. Limits what values sqr() can calculate and the result of sqrt() // The number of squares to pre-calculate. Limits what values sqr() can calculate and the result of sqrt()
byte NUM_SQUARES = 0xff; byte NUM_SQUARES = 0xff;

View File

@ -1,6 +1,6 @@
// C standard library stdlib.h // C standard library stdlib.h
// Implementation of functions found int C stdlib.h / stdlib.c // Implementation of functions found int C stdlib.h / stdlib.c
import "string" #include "string"
// Top of the heap used by malloc() // Top of the heap used by malloc()
unsigned char* HEAP_TOP = 0xa000; unsigned char* HEAP_TOP = 0xa000;

View File

@ -1,7 +1,7 @@
// C standard library time.h // C standard library time.h
// Functions to get and manipulate date and time information. // Functions to get and manipulate date and time information.
import "c64" #include "c64"
// Type suitable for storing the processor time. // Type suitable for storing the processor time.
typedef unsigned long clock_t; typedef unsigned long clock_t;

View File

@ -1,4 +1,4 @@
import "bgblacklib" #include "bgblacklib"
void main() { void main() {
*BGCOL = BLACK; *BGCOL = BLACK;
} }

View File

@ -1,4 +1,4 @@
import "c64" #include "c64"
byte* const SCREEN = $400; byte* const SCREEN = $400;
byte* const BITMAP = $2000; byte* const BITMAP = $2000;

View File

@ -2,7 +2,7 @@
// Coded by Richard-William Loerakker // Coded by Richard-William Loerakker
// Original Source https://bcaorganizer.blogspot.com/p/c-program-for_21.html?fbclid=IwAR0iL8pYcCqhCPa6LmtQ9qej-YonYVepY2cBegYRIWO0l8RPeOnTVniMAac // Original Source https://bcaorganizer.blogspot.com/p/c-program-for_21.html?fbclid=IwAR0iL8pYcCqhCPa6LmtQ9qej-YonYVepY2cBegYRIWO0l8RPeOnTVniMAac
import "c64" #include "c64"
byte* const SCREEN = $400; byte* const SCREEN = $400;
byte* const BITMAP = $2000; byte* const BITMAP = $2000;

View File

@ -1,8 +1,8 @@
// Illustrates problem with bitmap-draw.kc line() // Illustrates problem with bitmap-draw.kc line()
// Reported by Janne Johansson // Reported by Janne Johansson
import "c64.kc" #include "c64.kc"
import "bitmap-draw.kc" #include "bitmap-draw.kc"
byte* const SCREEN = $400; byte* const SCREEN = $400;
byte* const BITMAP = $2000; byte* const BITMAP = $2000;

View File

@ -1,8 +1,8 @@
// Shows that bitmap2.kc line() does not have the same problem as bitmap-draw.kc // Shows that bitmap2.kc line() does not have the same problem as bitmap-draw.kc
// See bitmap-line-anim-1.kc // See bitmap-line-anim-1.kc
import "c64.kc" #include "c64.kc"
import "bitmap2.kc" #include "bitmap2.kc"
byte* const SCREEN = $400; byte* const SCREEN = $400;
byte* const BITMAP = $2000; byte* const BITMAP = $2000;

View File

@ -1,7 +1,7 @@
// Tests the simple bitmap plotter - and counts plots per frame in an IRQ // Tests the simple bitmap plotter - and counts plots per frame in an IRQ
// Plots simple plots // Plots simple plots
import "c64" #include "c64"
import "bitmap2" #include "bitmap2"
byte* BITMAP = 0x2000; byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400; byte* SCREEN = 0x0400;

View File

@ -1,9 +1,9 @@
// Tests the simple bitmap plotter - and counts plots per frame in an IRQ // Tests the simple bitmap plotter - and counts plots per frame in an IRQ
// Plots a fullscreen elipsis // Plots a fullscreen elipsis
import "c64" #include "c64"
import "sinus" #include "sinus"
import "multiply" #include "multiply"
import "bitmap2" #include "bitmap2"
byte* BITMAP = 0x2000; byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400; byte* SCREEN = 0x0400;

View File

@ -1,9 +1,9 @@
// Tests the simple bitmap plotter - and counts plots per frame in an IRQ // Tests the simple bitmap plotter - and counts plots per frame in an IRQ
// Plots a spiral // Plots a spiral
import "c64" #include "c64"
import "sinus" #include "sinus"
import "multiply" #include "multiply"
import "bitmap2" #include "bitmap2"
byte* BITMAP = 0x2000; byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400; byte* SCREEN = 0x0400;

View File

@ -1,8 +1,8 @@
// Tests the simple bitmap plotter // Tests the simple bitmap plotter
// Plots a few lines using the bresenham line algorithm // Plots a few lines using the bresenham line algorithm
import "c64" #include "c64"
import "bitmap2" #include "bitmap2"
import "print" #include "print"
byte* BITMAP = 0x2000; byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400; byte* SCREEN = 0x0400;

View File

@ -1,6 +1,6 @@
// Tests the different standard C types // Tests the different standard C types
import "print" #include "print"
void main() { void main() {
print_cls(); print_cls();

View File

@ -1,5 +1,5 @@
// C64DTV 8bpp charmode stretcher // C64DTV 8bpp charmode stretcher
import "c64dtv.kc" #include "c64dtv.kc"
// Plane with the screen // Plane with the screen
byte* const SCREEN = $7c00; byte* const SCREEN = $7c00;

View File

@ -1,5 +1,5 @@
// C64DTV 8bpp charmode stretcher // C64DTV 8bpp charmode stretcher
import "c64dtv.kc" #include "c64dtv.kc"
// Plane with all pixels // Plane with all pixels
byte* const CHUNKY = $8000; byte* const CHUNKY = $8000;

View File

@ -1,6 +1,6 @@
// Fill a box on the screen using the blitter // Fill a box on the screen using the blitter
import "c64dtv.kc" #include "c64dtv.kc"
byte* const SCREEN = $400; byte* const SCREEN = $400;
const byte SRCA[] = "camelot rules!"; const byte SRCA[] = "camelot rules!";

View File

@ -1,4 +1,4 @@
import "c64dtv.kc" #include "c64dtv.kc"
byte* const SCREEN = $400; byte* const SCREEN = $400;
const byte SRCA[] = { 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '}; const byte SRCA[] = { 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '};

View File

@ -1,6 +1,6 @@
// Test C64DTV v2 256-colors and the 16-color redefinable palette // Test C64DTV v2 256-colors and the 16-color redefinable palette
import "c64dtv.kc" #include "c64dtv.kc"
void main() { void main() {
asm { sei } asm { sei }

View File

@ -1,8 +1,8 @@
// Interactive Explorer for C64DTV Screen Modes // Interactive Explorer for C64DTV Screen Modes
import "c64dtv.kc" #include "c64dtv.kc"
import "print.kc" #include "print.kc"
import "keyboard.kc" #include "keyboard.kc"
import "bitmap-draw.kc" #include "bitmap-draw.kc"
void main() { void main() {
asm { sei } // Disable normal interrupt (prevent keyboard reading glitches and allows to hide basic/kernal) asm { sei } // Disable normal interrupt (prevent keyboard reading glitches and allows to hide basic/kernal)

View File

@ -1,8 +1,8 @@
// Exploring C64DTV Screen Modes // Exploring C64DTV Screen Modes
import "c64dtv.kc" #include "c64dtv.kc"
import "print.kc" #include "print.kc"
import "keyboard.kc" #include "keyboard.kc"
import "bitmap-draw.kc" #include "bitmap-draw.kc"
void main() { void main() {
asm { sei } // Disable normal interrupt (prevent keyboard reading glitches and allows to hide basic/kernal) asm { sei } // Disable normal interrupt (prevent keyboard reading glitches and allows to hide basic/kernal)

View File

@ -1,8 +1,8 @@
// Counting cycles using a CIA timer // Counting cycles using a CIA timer
import "c64" #include "c64"
import "time" #include "time"
import "print" #include "print"
byte* const SCREEN = 0x0400; byte* const SCREEN = 0x0400;

View File

@ -1,8 +1,8 @@
// Setup and run a simple CIA-timer // Setup and run a simple CIA-timer
import "c64" #include "c64"
import "time" #include "time"
import "print" #include "print"
byte* const SCREEN = 0x0400; byte* const SCREEN = 0x0400;

View File

@ -1,9 +1,9 @@
// Clears start screen throwing around the letters (by turning them into sprites) // Clears start screen throwing around the letters (by turning them into sprites)
import "stdlib" #include "stdlib"
import "sqr" #include "sqr"
import "atan2" #include "atan2"
import "multiply" #include "multiply"
import "c64" #include "c64"
// Generate debug code (raster time usage etc.) // Generate debug code (raster time usage etc.)
const bool DEBUG = false; const bool DEBUG = false;

View File

@ -1,8 +1,8 @@
// Display MEDUSA PETSCII by Buzz_clik // Display MEDUSA PETSCII by Buzz_clik
// https://csdb.dk/release/?id=178673 // https://csdb.dk/release/?id=178673
import "c64" #include "c64"
import "string" #include "string"
char MEDUSA_SCREEN[1000] = kickasm(resource "medusas.prg" ) {{ char MEDUSA_SCREEN[1000] = kickasm(resource "medusas.prg" ) {{
.var fileScreen = LoadBinary("medusas.prg", BF_C64FILE) .var fileScreen = LoadBinary("medusas.prg", BF_C64FILE)

View File

@ -1,10 +1,10 @@
// Pre-calculated bobs inside a charset (pre-moved to all x/y-combinations) // Pre-calculated bobs inside a charset (pre-moved to all x/y-combinations)
import "c64" #include "c64"
import "string" #include "string"
import "keyboard" #include "keyboard"
import "time" #include "time"
import "print" #include "print"
import "fastmultiply" #include "fastmultiply"
// The prototype BOB (a 3x3 char image with a bob image in the upper 2x2 chars) // The prototype BOB (a 3x3 char image with a bob image in the upper 2x2 chars)
// The chars are layout as follows with data in chars 0, 1, 3, 4 initially // The chars are layout as follows with data in chars 0, 1, 3, 4 initially

View File

@ -1,10 +1,10 @@
// Pre-calculated bobs inside a charset (pre-moved to all x/y-combinations) // Pre-calculated bobs inside a charset (pre-moved to all x/y-combinations)
import "c64" #include "c64"
import "string" #include "string"
import "keyboard" #include "keyboard"
import "time" #include "time"
import "print" #include "print"
import "fastmultiply" #include "fastmultiply"
// The prototype BOB (a 3x3 char image with a bob image in the upper 2x2 chars) // The prototype BOB (a 3x3 char image with a bob image in the upper 2x2 chars)
// The chars are layout as follows with data in chars 0, 1, 3, 4 initially // The chars are layout as follows with data in chars 0, 1, 3, 4 initially

View File

@ -1,9 +1,9 @@
// Same animation using a multiplexer // Same animation using a multiplexer
import "c64" #include "c64"
import "multiplexer" #include "multiplexer"
import "fastmultiply" #include "fastmultiply"
import "string" #include "string"
import "keyboard" #include "keyboard"
// The BOB sprite // The BOB sprite
align(0x1000) char SPRITE[] = kickasm(resource "smiley.png") {{ align(0x1000) char SPRITE[] = kickasm(resource "smiley.png") {{

View File

@ -1,11 +1,11 @@
// Show a few simple splines using the splines library // Show a few simple splines using the splines library
import "splines" #include "splines"
import "bitmap2" #include "bitmap2"
import "time" #include "time"
import "print" #include "print"
import "fastmultiply" #include "fastmultiply"
import "c64" #include "c64"
char* const PRINT_SCREEN = 0x0400; char* const PRINT_SCREEN = 0x0400;
char* const BITMAP_SCREEN = 0x5c00; char* const BITMAP_SCREEN = 0x5c00;

View File

@ -1,6 +1,6 @@
// Put a 2x2 font into sprites and show it on screen // Put a 2x2 font into sprites and show it on screen
import "c64" #include "c64"
import "multiplexer" #include "multiplexer"
char * const CHARSET_DEFAULT = 0x1000; char * const CHARSET_DEFAULT = 0x1000;
char * const SPRITES = 0x3000; char * const SPRITES = 0x3000;

View File

@ -1,4 +1,4 @@
import "tetris-sprites" #include "tetris-sprites"
char SIN[256] = kickasm {{ char SIN[256] = kickasm {{
.var AMPL = 200-21 .var AMPL = 200-21

View File

@ -2,8 +2,8 @@
// Implementation of the tetris game play logic. Most of the logic is modelled after NES tetris // Implementation of the tetris game play logic. Most of the logic is modelled after NES tetris
// Source: https://meatfighter.com/nintendotetrisai/ // Source: https://meatfighter.com/nintendotetrisai/
import "tetris-data" #include "tetris-data"
import "tetris-pieces" #include "tetris-pieces"
// Pointers to the playfield address for each playfield line // Pointers to the playfield address for each playfield line
char* playfield_lines[PLAYFIELD_LINES]; char* playfield_lines[PLAYFIELD_LINES];

View File

@ -2,8 +2,8 @@
// All rendering logic for showing the playfield, the pieces and the scores // All rendering logic for showing the playfield, the pieces and the scores
// Also handles double buffering // Also handles double buffering
import "tetris-data" #include "tetris-data"
import "tetris-pieces" #include "tetris-pieces"
kickasm(pc PLAYFIELD_CHARSET, resource "playfield-screen.imap") {{ kickasm(pc PLAYFIELD_CHARSET, resource "playfield-screen.imap") {{
.fill 8,$00 // Place a filled char at the start of the charset .fill 8,$00 // Place a filled char at the start of the charset

View File

@ -1,7 +1,7 @@
// Tetris Game for the Commodore 64 // Tetris Game for the Commodore 64
// A sprite multiplexer covering the playfield with a black layer to allow for 3 single-pixel colors // A sprite multiplexer covering the playfield with a black layer to allow for 3 single-pixel colors
import "c64" #include "c64"
import "tetris-data" #include "tetris-data"
kickasm(pc PLAYFIELD_SPRITES, resource "playfield-sprites.png") {{ kickasm(pc PLAYFIELD_SPRITES, resource "playfield-sprites.png") {{
.var sprites = LoadPicture("playfield-sprites.png", List().add($010101, $000000)) .var sprites = LoadPicture("playfield-sprites.png", List().add($010101, $000000))

View File

@ -2,13 +2,13 @@
// The tetris game tries to match NES tetris gameplay pretty closely // The tetris game tries to match NES tetris gameplay pretty closely
// Source: https://meatfighter.com/nintendotetrisai/ // Source: https://meatfighter.com/nintendotetrisai/
import "c64" #include "c64"
import "keyboard" #include "keyboard"
import "sid" #include "sid"
import "tetris-data" #include "tetris-data"
import "tetris-render" #include "tetris-render"
import "tetris-sprites" #include "tetris-sprites"
import "tetris-play" #include "tetris-play"
void main() { void main() {
sid_rnd_init(); sid_rnd_init();

View File

@ -1,5 +1,5 @@
import "c64.kc" #include "c64.kc"
import "print" #include "print"
byte* SCREEN = $0400; byte* SCREEN = $0400;

View File

@ -2,7 +2,7 @@
// Each function of the kernal is a no-args function // Each function of the kernal is a no-args function
// The functions are placed in the SYSCALLS table surrounded by JMP and NOP // The functions are placed in the SYSCALLS table surrounded by JMP and NOP
import "string" #include "string"
#pragma link("xmega65.ld") #pragma link("xmega65.ld")

View File

@ -1,4 +1,4 @@
import "print.kc" #include "print.kc"
byte* const BGCOL = $d021; byte* const BGCOL = $d021;
const byte GREEN = 5; const byte GREEN = 5;
const byte RED = 2 ; const byte RED = 2 ;

View File

@ -1,10 +1,10 @@
// Find atan2(x, y) using the CORDIC method // Find atan2(x, y) using the CORDIC method
// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf // See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf
import "font-hex" #include "font-hex"
import "atan2" #include "atan2"
import "c64" #include "c64"
import "print" #include "print"
byte* const CHARSET = 0x2000; byte* const CHARSET = 0x2000;
byte* const SCREEN = 0x2800; byte* const SCREEN = 0x2800;

View File

@ -1,9 +1,9 @@
// Find atan2(x, y) using the CORDIC method // Find atan2(x, y) using the CORDIC method
// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf // See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf
import "font-hex" #include "font-hex"
import "atan2" #include "atan2"
import "c64" #include "c64"
byte* const CHARSET = 0x2000; byte* const CHARSET = 0x2000;
byte* const SCREEN = 0x2800; byte* const SCREEN = 0x2800;

View File

@ -1,8 +1,8 @@
// Find atan2(x, y) using the CORDIC method // Find atan2(x, y) using the CORDIC method
// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf // See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf
import "font-hex" #include "font-hex"
import "atan2" #include "atan2"
import "c64" #include "c64"
byte* const CHARSET = 0x2000; byte* const CHARSET = 0x2000;
byte* const SCREEN = 0x2800; byte* const SCREEN = 0x2800;

View File

@ -1,9 +1,9 @@
// Find atan2(x, y) using the CORDIC method // Find atan2(x, y) using the CORDIC method
// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf // See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf
import "font-hex" #include "font-hex"
import "c64" #include "c64"
import "atan2" #include "atan2"
byte* const CHARSET = 0x2000; byte* const CHARSET = 0x2000;

View File

@ -1,7 +1,7 @@
// Tests problem writing/reading joystick encountered by Danny Spijksma // Tests problem writing/reading joystick encountered by Danny Spijksma
// https://www.protovision.games/hardw/build4player.php?language=en&fbclid=IwAR1MJLgQjOU0zVa0ax2aNeGa-xVbE9IGY9zC6b6eInTV4HQzoUAoCPoXu14 // https://www.protovision.games/hardw/build4player.php?language=en&fbclid=IwAR1MJLgQjOU0zVa0ax2aNeGa-xVbE9IGY9zC6b6eInTV4HQzoUAoCPoXu14
import "c64" #include "c64"
char* const SCREEN = 0x0400; char* const SCREEN = 0x0400;
void main() { void main() {
(*CIA2_PORT_B) &= 0x7f; (*CIA2_PORT_B) &= 0x7f;

View File

@ -1,6 +1,6 @@
// Show default font on screen // Show default font on screen
import "string" #include "string"
byte* SCREEN = 0x0400; byte* SCREEN = 0x0400;

View File

@ -1,5 +1,5 @@
import "imported" #include "imported"
import "imported" #include "imported"
void main() { void main() {
*BGCOL = RED; *BGCOL = RED;

View File

@ -4,7 +4,7 @@
* Based on facebook post from * Based on facebook post from
*/ */
import "print" #include "print"
void main () { void main () {
print_cls(); print_cls();

View File

@ -2,8 +2,8 @@
// Based on: // Based on:
// - C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt // - C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
// - Codebase64 Article http://codebase64.org/doku.php?id=base:3d_rotation // - Codebase64 Article http://codebase64.org/doku.php?id=base:3d_rotation
import "c64" #include "c64"
import "print" #include "print"
// The rotated point - updated by calling rotate_matrix() // The rotated point - updated by calling rotate_matrix()
signed char* xr = $f0; signed char* xr = $f0;

View File

@ -2,8 +2,8 @@
// Based on: // Based on:
// - C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt // - C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
// - Codebase64 Article http://codebase64.org/doku.php?id=base:3d_rotation // - Codebase64 Article http://codebase64.org/doku.php?id=base:3d_rotation
import "c64" #include "c64"
import "print" #include "print"
// The rotated point - updated by calling rotate() // The rotated point - updated by calling rotate()
signed char* xr = $f0; signed char* xr = $f0;

View File

@ -1,5 +1,5 @@
import "c64.kc" #include "c64.kc"
import "bitmap-draw.kc" #include "bitmap-draw.kc"
char* const SCREEN = $400; char* const SCREEN = $400;
char* const BITMAP = $2000; char* const BITMAP = $2000;

View File

@ -1,6 +1,6 @@
// Allows analysis of the CHARGEN ROM font // Allows analysis of the CHARGEN ROM font
import "c64.kc" #include "c64.kc"
import "keyboard.kc" #include "keyboard.kc"
char* SCREEN = $400; char* SCREEN = $400;

View File

@ -6,7 +6,7 @@
// - http://codebase64.org/doku.php?id=base:seriously_fast_multiplication // - http://codebase64.org/doku.php?id=base:seriously_fast_multiplication
// - http://codebase64.org/doku.php?id=magazines:chacking16 // - http://codebase64.org/doku.php?id=magazines:chacking16
import "print.kc" #include "print.kc"
signed char vals[] = {-95, -64, -32, -16, 0, 16, 32, 64, 95}; signed char vals[] = {-95, -64, -32, -16, 0, 16, 32, 64, 95};

View File

@ -4,8 +4,8 @@
// Ported to KickC by Jesper Gravgaard. // Ported to KickC by Jesper Gravgaard.
// Original source https://github.com/cc65/cc65/blob/master/samples/fire.c // Original source https://github.com/cc65/cc65/blob/master/samples/fire.c
import "c64" #include "c64"
import "sid" #include "sid"
unsigned char* SCREEN1 = 0x3800; unsigned char* SCREEN1 = 0x3800;
unsigned char* SCREEN2 = 0x3c00; unsigned char* SCREEN2 = 0x3c00;

View File

@ -1,7 +1,7 @@
// Creates a 2x2 font from the system CHARGEN font and compress it by identifying identical chars // Creates a 2x2 font from the system CHARGEN font and compress it by identifying identical chars
import "c64" #include "c64"
import "string" #include "string"
char* const SCREEN = 0x0400; char* const SCREEN = 0x0400;
char* const FONT_ORIGINAL = 0x2000; char* const FONT_ORIGINAL = 0x2000;

View File

@ -1,4 +1,4 @@
import "print" #include "print"
void main() { void main() {
print_str("hello world!"); print_str("hello world!");
print_ln(); print_ln();

View File

@ -1,5 +1,5 @@
// A raster IRQ that opens the top/bottom border. // A raster IRQ that opens the top/bottom border.
import "c64.kc" #include "c64.kc"
char* const GHOST_BYTE = $3fff; char* const GHOST_BYTE = $3fff;

View File

@ -3,8 +3,8 @@
// To execute the program succesfully you must mount the D64 disk image and execute the kernalload.PRG program // To execute the program succesfully you must mount the D64 disk image and execute the kernalload.PRG program
#pragma link("kernalload.ld") #pragma link("kernalload.ld")
import "string" #include "string"
import "c64" #include "c64"
// Sprite file // Sprite file
#pragma data_seg(Sprite) #pragma data_seg(Sprite)

View File

@ -1,6 +1,6 @@
// A simple usage of the flexible sprite multiplexer routine // A simple usage of the flexible sprite multiplexer routine
import "c64" #include "c64"
import "multiplexer" #include "multiplexer"
// Location of screen & sprites // Location of screen & sprites
char* SCREEN = $400; char* SCREEN = $400;

View File

@ -1,5 +1,5 @@
// A simple SID music player playing music in the main loop. // A simple SID music player playing music in the main loop.
import "c64.kc" #include "c64.kc"
char* const MUSIC = $1000; char* const MUSIC = $1000;

View File

@ -1,5 +1,5 @@
// A simple SID music player using RASTER IRQ // A simple SID music player using RASTER IRQ
import "c64.kc" #include "c64.kc"
char* const MUSIC = $1000; char* const MUSIC = $1000;

View File

@ -2,7 +2,7 @@
// Code by Scan of Desire (Richard-William Loerakker) // Code by Scan of Desire (Richard-William Loerakker)
// Sample from ART OF NOISE: MOMENTS IN LOVE // Sample from ART OF NOISE: MOMENTS IN LOVE
import "c64" #include "c64"
const unsigned int SAMPLE_SIZE = 0x6100; const unsigned int SAMPLE_SIZE = 0x6100;
char SAMPLE[SAMPLE_SIZE] = kickasm(resource "moments_sample.bin") {{ .import binary "moments_sample.bin" }}; char SAMPLE[SAMPLE_SIZE] = kickasm(resource "moments_sample.bin") {{ .import binary "moments_sample.bin" }};

View File

@ -6,9 +6,9 @@
// Ported to KickC by Jesper Gravgaard. // Ported to KickC by Jesper Gravgaard.
// Original source https://github.com/cc65/cc65/blob/master/samples/plasma.c // Original source https://github.com/cc65/cc65/blob/master/samples/plasma.c
import "c64" #include "c64"
import "print" #include "print"
import "sid" #include "sid"
unsigned char* const SCREEN1 = $2800; unsigned char* const SCREEN1 = $2800;
unsigned char* const CHARSET = $2000; unsigned char* const CHARSET = $2000;

View File

@ -4,9 +4,9 @@
// Ported to KickC by Jesper Gravgaard. // Ported to KickC by Jesper Gravgaard.
// Original source https://github.com/cc65/cc65/blob/master/samples/plasma.c // Original source https://github.com/cc65/cc65/blob/master/samples/plasma.c
import "c64" #include "c64"
import "print" #include "print"
import "sid" #include "sid"
char* const SCREEN1 = 0x2800; char* const SCREEN1 = 0x2800;
char* const SCREEN2 = 0x2c00; char* const SCREEN2 = 0x2c00;

View File

@ -1,4 +1,4 @@
import "c64.kc" #include "c64.kc"
void main() { void main() {
asm { asm {

View File

@ -1,9 +1,9 @@
// 2D rotattion of 8 sprites // 2D rotattion of 8 sprites
import "c64" #include "c64"
import "fastmultiply" #include "fastmultiply"
import "time" #include "time"
import "print" #include "print"
char* SCREEN = $0400; char* SCREEN = $0400;

View File

@ -1,6 +1,6 @@
import "c64.kc" #include "c64.kc"
import "sinus.kc" #include "sinus.kc"
import "string.kc" #include "string.kc"
char* SCREEN = $400; char* SCREEN = $400;
char* LOGO = $2000; char* LOGO = $2000;

View File

@ -1,5 +1,5 @@
import "c64.kc" #include "c64.kc"
import "string" #include "string"
char* SCREEN = $400; char* SCREEN = $400;
char* LOGO = $2000; char* LOGO = $2000;

View File

@ -1,9 +1,9 @@
// Generate a big sinus and plot it on a bitmap // Generate a big sinus and plot it on a bitmap
import "c64.kc" #include "c64.kc"
import "sinus.kc" #include "sinus.kc"
import "string.kc" #include "string.kc"
import "bitmap2.kc" #include "bitmap2.kc"
char* SCREEN = $400; char* SCREEN = $400;
char* BITMAP = $2000; char* BITMAP = $2000;

View File

@ -1,6 +1,6 @@
import "c64" #include "c64"
import "basic-floats" #include "basic-floats"
import "print" #include "print"
const char sinlen_x = 221; const char sinlen_x = 221;
const char sintab_x[221]; const char sintab_x[221];

View File

@ -4,7 +4,7 @@
// Uses principles from C=Hacking #16 https://codebase64.org/doku.php?id=magazines:chacking16 // Uses principles from C=Hacking #16 https://codebase64.org/doku.php?id=magazines:chacking16
// Utilizes the fact that a*b = ((a+b)/2)^2 - ((a-b)/2)^2 // Utilizes the fact that a*b = ((a+b)/2)^2 - ((a-b)/2)^2
import "print" #include "print"
void main() { void main() {
print_cls(); print_cls();

View File

@ -1,7 +1,7 @@
// Shows a font where each char contains the number of the char (00-ff) // Shows a font where each char contains the number of the char (00-ff)
import "c64" #include "c64"
import "string" #include "string"
import "font-hex" #include "font-hex"
byte* SCREEN = 0x0400; byte* SCREEN = 0x0400;
byte* CHARSET = 0x2000; byte* CHARSET = 0x2000;

View File

@ -1,6 +1,6 @@
// Test minimization of constants // Test minimization of constants
import "c64" #include "c64"
void main() { void main() {
byte* const PLAYFIELD_CHARSET = $2800; byte* const PLAYFIELD_CHARSET = $2800;

View File

@ -1,4 +1,4 @@
import "imported.kc" #include "imported.kc"
void main() { void main() {
byte* screen = $0400; byte* screen = $0400;

View File

@ -1,4 +1,4 @@
import "print.kc" #include "print.kc"
byte txt[] = "camelot"; byte txt[] = "camelot";

View File

@ -1,5 +1,5 @@
// A minimal working raster hardware IRQ with clobber-based register savings // A minimal working raster hardware IRQ with clobber-based register savings
import "c64" #include "c64"
void main() { void main() {
asm { sei } asm { sei }

View File

@ -1,5 +1,5 @@
// Test interrupt routine using a variable between calls (irq_idx) // Test interrupt routine using a variable between calls (irq_idx)
import "c64" #include "c64"
byte* const SCREEN = $0400; byte* const SCREEN = $0400;

View File

@ -1,6 +1,6 @@
// A minimal working IRQ // A minimal working IRQ
import "c64" #include "c64"
// Setup the IRQ routine // Setup the IRQ routine
void main() { void main() {

View File

@ -5,8 +5,8 @@
// Press "C" to enter pressed state (increaded bgcol) - and "SPACE" to leave presssed state again. // Press "C" to enter pressed state (increaded bgcol) - and "SPACE" to leave presssed state again.
// Holding SPACE will sometimes trigger the pressed state when normal interrupts are enabled (green border) // Holding SPACE will sometimes trigger the pressed state when normal interrupts are enabled (green border)
// but never when they are disabled (red border) // but never when they are disabled (red border)
import "keyboard.kc" #include "keyboard.kc"
import "c64.kc" #include "c64.kc"
void main() { void main() {
*BORDERCOL = GREEN; *BORDERCOL = GREEN;

View File

@ -1,6 +1,6 @@
// Animated lines drawn on a single color bitmap // Animated lines drawn on a single color bitmap
import "c64.kc" #include "c64.kc"
import "division.kc" #include "division.kc"
byte* BITMAP = $a000; byte* BITMAP = $a000;
byte* SCREEN = $8800; byte* SCREEN = $8800;

View File

@ -1,7 +1,7 @@
// Linear table generator // Linear table generator
// Work in progress towards a sinus generator // Work in progress towards a sinus generator
import "division.kc" #include "division.kc"
import "print.kc" #include "print.kc"
void main() { void main() {
word lintab1[20]; word lintab1[20];

View File

@ -8,7 +8,7 @@
// 2.8212026 23111.2917 23111 // 2.8212026 23111.2917 23111
// -1.7417939 -14268.77563 -14269 // -1.7417939 -14268.77563 -14269
import "multiply" #include "multiply"
void main() { void main() {

View File

@ -1,8 +1,8 @@
// Program where loop-head optimization produces wrong return value // Program where loop-head optimization produces wrong return value
// Reported by Richard-William Loerakker // Reported by Richard-William Loerakker
import "c64" #include "c64"
import "multiply" #include "multiply"
void main() { void main() {
dword result = mul16u(4,123); dword result = mul16u(4,123);

View File

@ -1,6 +1,6 @@
// Experiments with malloc() - a byte array // Experiments with malloc() - a byte array
import "stdlib" #include "stdlib"
byte* BYTES = malloc(0x100); byte* BYTES = malloc(0x100);

Some files were not shown because too many files have changed in this diff Show More