mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-05-28 23:41:32 +00:00
ecs: system instance, with #entity.field
This commit is contained in:
parent
acb50ac4b9
commit
4584cc778f
|
@ -2,7 +2,7 @@
|
||||||
import { mergeLocs, Token, Tokenizer, TokenType } from "../tokenizer";
|
import { mergeLocs, Token, Tokenizer, TokenType } from "../tokenizer";
|
||||||
import { SourceLocated, SourceLocation } from "../workertypes";
|
import { SourceLocated, SourceLocation } from "../workertypes";
|
||||||
import { newDecoder } from "./decoder";
|
import { newDecoder } from "./decoder";
|
||||||
import { Action, ActionOwner, ActionNode, ActionWithJoin, ArrayType, CodeLiteralNode, CodePlaceholderNode, ComponentType, DataField, DataType, DataValue, ECSError, Entity, EntityArchetype, EntityManager, EntityScope, IntType, Query, RefType, SelectType, SELECT_TYPE, SourceFileExport, System } from "./ecs";
|
import { Action, ActionOwner, ActionNode, ActionWithJoin, ArrayType, CodeLiteralNode, CodePlaceholderNode, ComponentType, DataField, DataType, DataValue, ECSError, Entity, EntityArchetype, EntityManager, EntityScope, IntType, Query, RefType, SelectType, SELECT_TYPE, SourceFileExport, System, SystemInstance, SystemInstanceParameters, ComponentFieldPair } from "./ecs";
|
||||||
|
|
||||||
export enum ECSTokenType {
|
export enum ECSTokenType {
|
||||||
Ellipsis = 'ellipsis',
|
Ellipsis = 'ellipsis',
|
||||||
|
@ -37,7 +37,7 @@ export class ECSCompiler extends Tokenizer {
|
||||||
{ type: ECSTokenType.Integer, regex: /[-]?\$[A-Fa-f0-9]+/ },
|
{ type: ECSTokenType.Integer, regex: /[-]?\$[A-Fa-f0-9]+/ },
|
||||||
{ type: ECSTokenType.Integer, regex: /[-]?\d+/ },
|
{ type: ECSTokenType.Integer, regex: /[-]?\d+/ },
|
||||||
{ type: ECSTokenType.Integer, regex: /[%][01]+/ },
|
{ type: ECSTokenType.Integer, regex: /[%][01]+/ },
|
||||||
{ type: ECSTokenType.Operator, regex: /[#=,:(){}\[\]\-]/ },
|
{ type: ECSTokenType.Operator, regex: /[.#=,:(){}\[\]\-]/ },
|
||||||
{ type: TokenType.Ident, regex: /[A-Za-z_][A-Za-z0-9_]*/ },
|
{ type: TokenType.Ident, regex: /[A-Za-z_][A-Za-z0-9_]*/ },
|
||||||
{ type: TokenType.Ignore, regex: /\/\/.*?[\n\r]/ },
|
{ type: TokenType.Ignore, regex: /\/\/.*?[\n\r]/ },
|
||||||
{ type: TokenType.Ignore, regex: /\/\*.*?\*\// },
|
{ type: TokenType.Ignore, regex: /\/\*.*?\*\// },
|
||||||
|
@ -300,12 +300,11 @@ export class ECSCompiler extends Tokenizer {
|
||||||
// TODO: add $loc
|
// TODO: add $loc
|
||||||
let tok = this.expectTokenTypes([ECSTokenType.CodeFragment]);
|
let tok = this.expectTokenTypes([ECSTokenType.CodeFragment]);
|
||||||
let code = tok.str.substring(3, tok.str.length-3);
|
let code = tok.str.substring(3, tok.str.length-3);
|
||||||
/*
|
|
||||||
let lines = code.split('\n');
|
|
||||||
// TODO: add after parsing maybe?
|
// TODO: add after parsing maybe?
|
||||||
|
let lines = code.split('\n');
|
||||||
if (this.debuginfo) this.addDebugInfo(lines, tok.$loc.line);
|
if (this.debuginfo) this.addDebugInfo(lines, tok.$loc.line);
|
||||||
code = lines.join('\n');
|
code = lines.join('\n');
|
||||||
*/
|
|
||||||
let acomp = new ECSActionCompiler(context);
|
let acomp = new ECSActionCompiler(context);
|
||||||
let nodes = acomp.parseFile(code, this.path);
|
let nodes = acomp.parseFile(code, this.path);
|
||||||
// TODO: return nodes
|
// TODO: return nodes
|
||||||
|
@ -342,7 +341,7 @@ export class ECSCompiler extends Tokenizer {
|
||||||
if (cmd == 'system') {
|
if (cmd == 'system') {
|
||||||
let sys = this.annotate(() => this.parseSystem());
|
let sys = this.annotate(() => this.parseSystem());
|
||||||
this.em.defineSystem(sys);
|
this.em.defineSystem(sys);
|
||||||
this.currentScope.addUsingSystem(sys);
|
this.currentScope.newSystemInstanceWithDefaults(sys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.currentScope = scope.parent || null;
|
this.currentScope = scope.parent || null;
|
||||||
|
@ -350,9 +349,9 @@ export class ECSCompiler extends Tokenizer {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseScopeUsing() {
|
parseScopeUsing() {
|
||||||
let syslist = this.parseList(this.parseSystemRef, ',');
|
let instlist = this.parseList(this.parseSystemInstanceRef, ',');
|
||||||
for (let sys of syslist) {
|
for (let inst of instlist) {
|
||||||
this.currentScope?.addUsingSystem(sys);
|
this.currentScope?.newSystemInstance(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,21 +373,21 @@ export class ECSCompiler extends Tokenizer {
|
||||||
if (cmd == 'init' || cmd == 'const') {
|
if (cmd == 'init' || cmd == 'const') {
|
||||||
// TODO: check data types
|
// TODO: check data types
|
||||||
let name = this.expectIdent().str;
|
let name = this.expectIdent().str;
|
||||||
let { component, field } = this.getEntityField(entity, name);
|
let { c, f } = this.getEntityField(entity, name);
|
||||||
let symtype = this.currentScope.isConstOrInit(component, name);
|
let symtype = this.currentScope.isConstOrInit(c, name);
|
||||||
if (symtype && symtype != cmd)
|
if (symtype && symtype != cmd)
|
||||||
this.compileError(`I can't mix const and init values for a given field in a scope.`);
|
this.compileError(`I can't mix const and init values for a given field in a scope.`);
|
||||||
this.expectToken('=');
|
this.expectToken('=');
|
||||||
let valueOrRef = this.parseDataValue(field);
|
let valueOrRef = this.parseDataValue(f);
|
||||||
if ((valueOrRef as ForwardRef).token != null) {
|
if ((valueOrRef as ForwardRef).token != null) {
|
||||||
this.deferred.push(() => {
|
this.deferred.push(() => {
|
||||||
let refvalue = this.resolveEntityRef(scope, valueOrRef as ForwardRef);
|
let refvalue = this.resolveEntityRef(scope, valueOrRef as ForwardRef);
|
||||||
if (cmd == 'const') scope.setConstValue(entity, component, name, refvalue);
|
if (cmd == 'const') scope.setConstValue(entity, c, name, refvalue);
|
||||||
if (cmd == 'init') scope.setInitValue(entity, component, name, refvalue);
|
if (cmd == 'init') scope.setInitValue(entity, c, name, refvalue);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (cmd == 'const') scope.setConstValue(entity, component, name, valueOrRef as DataValue);
|
if (cmd == 'const') scope.setConstValue(entity, c, name, valueOrRef as DataValue);
|
||||||
if (cmd == 'init') scope.setInitValue(entity, component, name, valueOrRef as DataValue);
|
if (cmd == 'init') scope.setInitValue(entity, c, name, valueOrRef as DataValue);
|
||||||
}
|
}
|
||||||
} else if (cmd == 'decode') {
|
} else if (cmd == 'decode') {
|
||||||
let decoderid = this.expectIdent().str;
|
let decoderid = this.expectIdent().str;
|
||||||
|
@ -398,15 +397,15 @@ export class ECSCompiler extends Tokenizer {
|
||||||
if (!decoder) { this.compileError(`I can't find a "${decoderid}" decoder.`); throw new Error() }
|
if (!decoder) { this.compileError(`I can't find a "${decoderid}" decoder.`); throw new Error() }
|
||||||
let result = decoder.parse();
|
let result = decoder.parse();
|
||||||
for (let entry of Object.entries(result.properties)) {
|
for (let entry of Object.entries(result.properties)) {
|
||||||
let { component, field } = this.getEntityField(entity, entry[0]);
|
let { c, f } = this.getEntityField(entity, entry[0]);
|
||||||
scope.setConstValue(entity, component, field.name, entry[1]);
|
scope.setConstValue(entity, c, f.name, entry[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEntityField(e: Entity, name: string) {
|
getEntityField(e: Entity, name: string) : ComponentFieldPair {
|
||||||
if (!this.currentScope) { this.internalError(); throw new Error(); }
|
if (!this.currentScope) { this.internalError(); throw new Error(); }
|
||||||
let comps = this.em.componentsWithFieldName([e.etype], name);
|
let comps = this.em.componentsWithFieldName([e.etype], name);
|
||||||
if (comps.length == 0) this.compileError(`I couldn't find a field named "${name}" for this entity.`)
|
if (comps.length == 0) this.compileError(`I couldn't find a field named "${name}" for this entity.`)
|
||||||
|
@ -414,7 +413,7 @@ export class ECSCompiler extends Tokenizer {
|
||||||
let component = comps[0];
|
let component = comps[0];
|
||||||
let field = component.fields.find(f => f.name == name);
|
let field = component.fields.find(f => f.name == name);
|
||||||
if (!field) { this.internalError(); throw new Error(); }
|
if (!field) { this.internalError(); throw new Error(); }
|
||||||
return { component, field };
|
return { c: component, f: field };
|
||||||
}
|
}
|
||||||
|
|
||||||
parseEntityArchetype() : EntityArchetype {
|
parseEntityArchetype() : EntityArchetype {
|
||||||
|
@ -431,14 +430,18 @@ export class ECSCompiler extends Tokenizer {
|
||||||
return cref;
|
return cref;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveEntityRef(scope: EntityScope, ref: ForwardRef) : number {
|
findEntityByName(scope: EntityScope, token: Token) {
|
||||||
let name = ref.token.str;
|
let name = token.str;
|
||||||
let eref = scope.entities.find(e => e.name == name);
|
let eref = scope.entities.find(e => e.name == name);
|
||||||
if (!eref) {
|
if (!eref) {
|
||||||
this.compileError(`I couldn't find an entity named "${name}" in this scope.`, ref.token.$loc)
|
this.compileError(`I couldn't find an entity named "${name}" in this scope.`, token.$loc)
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
let id = eref.id;
|
return eref;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolveEntityRef(scope: EntityScope, ref: ForwardRef) : number {
|
||||||
|
let id = this.findEntityByName(scope, ref.token).id;
|
||||||
if (ref.reftype) {
|
if (ref.reftype) {
|
||||||
// TODO: make this a function? elo ehi etc?
|
// TODO: make this a function? elo ehi etc?
|
||||||
let atypes = this.em.archetypesMatching(ref.reftype.query);
|
let atypes = this.em.archetypesMatching(ref.reftype.query);
|
||||||
|
@ -450,11 +453,29 @@ export class ECSCompiler extends Tokenizer {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseSystemRef() : System {
|
parseSystemInstanceRef() : SystemInstance {
|
||||||
let name = this.expectIdent().str;
|
let name = this.expectIdent().str;
|
||||||
let sys = this.em.getSystemByName(name);
|
let system = this.em.getSystemByName(name);
|
||||||
if (!sys) this.compileError(`I couldn't find a system named "${name}".`, this.lasttoken.$loc);
|
if (!system) this.compileError(`I couldn't find a system named "${name}".`, this.lasttoken.$loc);
|
||||||
return sys;
|
let params = {};
|
||||||
|
if (this.peekToken().str == 'with') {
|
||||||
|
this.consumeToken();
|
||||||
|
params = this.parseSystemInstanceParameters();
|
||||||
|
}
|
||||||
|
let inst = { system, params, id: 0 };
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
parseSystemInstanceParameters() : SystemInstanceParameters {
|
||||||
|
let scope = this.currentScope;
|
||||||
|
if (scope == null) throw new Error();
|
||||||
|
this.expectToken('#');
|
||||||
|
let entname = this.expectIdent();
|
||||||
|
this.expectToken('.');
|
||||||
|
let fieldname = this.expectIdent();
|
||||||
|
let entity = this.findEntityByName(scope, entname);
|
||||||
|
let cf = this.getEntityField(entity, fieldname.str);
|
||||||
|
return { refEntity: entity, refField: cf };
|
||||||
}
|
}
|
||||||
|
|
||||||
exportToFile(src: SourceFileExport) {
|
exportToFile(src: SourceFileExport) {
|
||||||
|
|
|
@ -59,6 +59,17 @@ export interface System extends SourceLocated {
|
||||||
tempbytes?: number;
|
tempbytes?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SystemInstanceParameters {
|
||||||
|
refEntity?: Entity;
|
||||||
|
refField?: ComponentFieldPair;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SystemInstance extends SourceLocated {
|
||||||
|
system: System;
|
||||||
|
params: SystemInstanceParameters;
|
||||||
|
id: number;
|
||||||
|
}
|
||||||
|
|
||||||
export const SELECT_TYPE = ['once', 'foreach', 'join', 'with', 'if', 'select'] as const;
|
export const SELECT_TYPE = ['once', 'foreach', 'join', 'with', 'if', 'select'] as const;
|
||||||
|
|
||||||
export type SelectType = typeof SELECT_TYPE[number];
|
export type SelectType = typeof SELECT_TYPE[number];
|
||||||
|
@ -166,7 +177,7 @@ interface ConstByte {
|
||||||
bitofs: number;
|
bitofs: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ComponentFieldPair {
|
export interface ComponentFieldPair {
|
||||||
c: ComponentType;
|
c: ComponentType;
|
||||||
f: DataField;
|
f: DataField;
|
||||||
}
|
}
|
||||||
|
@ -227,6 +238,11 @@ export class Dialect_CA65 {
|
||||||
@__skipxhi:
|
@__skipxhi:
|
||||||
`
|
`
|
||||||
|
|
||||||
|
ASM_LOOKUP_REF_X = `
|
||||||
|
ldx {{%reffield}}
|
||||||
|
{{%code}}
|
||||||
|
`
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
ASM_MAP_RANGES = `
|
ASM_MAP_RANGES = `
|
||||||
txa
|
txa
|
||||||
|
@ -312,8 +328,8 @@ export class Dialect_CA65 {
|
||||||
else return `.byte (${b.symbol} >> ${b.bitofs})` // TODO?
|
else return `.byte (${b.symbol} >> ${b.bitofs})` // TODO?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tempLabel(sys: System) {
|
tempLabel(inst: SystemInstance) {
|
||||||
return `${sys.name}__tmp`;
|
return `${inst.system.name}__${inst.id}__tmp`; // TODO: multiple instances?
|
||||||
}
|
}
|
||||||
equate(symbol: string, value: string): string {
|
equate(symbol: string, value: string): string {
|
||||||
return `${symbol} = ${value}`;
|
return `${symbol} = ${value}`;
|
||||||
|
@ -517,15 +533,25 @@ class ActionEval {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly scope: EntityScope,
|
readonly scope: EntityScope,
|
||||||
readonly sys: System,
|
readonly instance: SystemInstance,
|
||||||
readonly action: Action)
|
readonly action: Action)
|
||||||
{
|
{
|
||||||
this.em = scope.em;
|
this.em = scope.em;
|
||||||
this.dialect = scope.em.dialect;
|
this.dialect = scope.em.dialect;
|
||||||
this.oldState = scope.state;
|
this.oldState = scope.state;
|
||||||
|
this.tmplabel = this.dialect.tempLabel(this.instance);
|
||||||
let q = (action as ActionWithQuery).query;
|
let q = (action as ActionWithQuery).query;
|
||||||
if (q) this.qr = new EntitySet(scope, q);
|
if (q) this.qr = new EntitySet(scope, q);
|
||||||
else this.qr = new EntitySet(scope, undefined, [], []);
|
else this.qr = new EntitySet(scope, undefined, [], []);
|
||||||
|
// TODO? error if none?
|
||||||
|
if (instance.params.refEntity && instance.params.refField) {
|
||||||
|
let rf = instance.params.refField;
|
||||||
|
if (rf.f.dtype == 'ref') {
|
||||||
|
let rq = rf.f.query;
|
||||||
|
this.qr = this.qr.intersection(new EntitySet(scope, rq));
|
||||||
|
//console.log('with', instance.params, rq, this.qr);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.entities = this.qr.entities;
|
this.entities = this.qr.entities;
|
||||||
//let query = (this.action as ActionWithQuery).query;
|
//let query = (this.action as ActionWithQuery).query;
|
||||||
//TODO? if (query && this.entities.length == 0)
|
//TODO? if (query && this.entities.length == 0)
|
||||||
|
@ -565,8 +591,11 @@ class ActionEval {
|
||||||
this.entities = int.entities; // TODO?
|
this.entities = int.entities; // TODO?
|
||||||
}
|
}
|
||||||
} else if (this.action.select == 'with') {
|
} else if (this.action.select == 'with') {
|
||||||
if (this.qr.entities.length != 1)
|
if (this.instance.params.refEntity && this.instance.params.refField) {
|
||||||
throw new ECSError(`${this.sys.name} query outside of loop must match exactly one entity`, this.action); //TODO
|
state.x = this.qr;
|
||||||
|
// ???
|
||||||
|
} else if (this.qr.entities.length != 1)
|
||||||
|
throw new ECSError(`${this.instance.system.name} query outside of loop must match exactly one entity`, this.action); //TODO
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -583,7 +612,7 @@ class ActionEval {
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
let action = this.action;
|
let action = this.action;
|
||||||
let sys = this.sys;
|
let sys = this.instance.system;
|
||||||
let code = action.text;
|
let code = action.text;
|
||||||
let label = `${sys.name}__${action.event}__${this.em.seq++}`; // TODO: better label that won't conflict (seq?)
|
let label = `${sys.name}__${action.event}__${this.em.seq++}`; // TODO: better label that won't conflict (seq?)
|
||||||
let props: { [name: string]: string } = {};
|
let props: { [name: string]: string } = {};
|
||||||
|
@ -612,7 +641,18 @@ class ActionEval {
|
||||||
// filter entities from loop?
|
// filter entities from loop?
|
||||||
// TODO: when to ignore if entities.length == 1 and not in for loop?
|
// TODO: when to ignore if entities.length == 1 and not in for loop?
|
||||||
if (action.select == 'with') {
|
if (action.select == 'with') {
|
||||||
code = this.wrapCodeInFilter(code);
|
// TODO? when to load x?
|
||||||
|
if (this.instance.params.refEntity && this.instance.params.refField) {
|
||||||
|
let re = this.instance.params.refEntity;
|
||||||
|
let rf = this.instance.params.refField;
|
||||||
|
code = this.wrapCodeInRefLookup(code);
|
||||||
|
// TODO: only fetches 1st entity in list, need offset
|
||||||
|
let range = this.scope.bss.getFieldRange(rf.c, rf.f.name) || this.scope.rodata.getFieldRange(rf.c, rf.f.name);
|
||||||
|
let eidofs = re.id - range.elo;
|
||||||
|
props['%reffield'] = `${this.dialect.fieldsymbol(rf.c, rf.f, 0)}+${eidofs}`;
|
||||||
|
} else {
|
||||||
|
code = this.wrapCodeInFilter(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (action.select == 'if') {
|
if (action.select == 'if') {
|
||||||
code = this.wrapCodeInFilter(code);
|
code = this.wrapCodeInFilter(code);
|
||||||
|
@ -699,10 +739,11 @@ class ActionEval {
|
||||||
}
|
}
|
||||||
__local(args: string[]) {
|
__local(args: string[]) {
|
||||||
let tempinc = parseInt(args[0]);
|
let tempinc = parseInt(args[0]);
|
||||||
|
let tempbytes = this.instance.system.tempbytes;
|
||||||
if (isNaN(tempinc)) throw new ECSError(`bad temporary offset`, this.action);
|
if (isNaN(tempinc)) throw new ECSError(`bad temporary offset`, this.action);
|
||||||
if (!this.sys.tempbytes) throw new ECSError(`this system has no locals`, this.action);
|
if (!tempbytes) throw new ECSError(`this system has no locals`, this.action);
|
||||||
if (tempinc < 0 || tempinc >= this.sys.tempbytes) throw new ECSError(`this system only has ${this.sys.tempbytes} locals`, this.action);
|
if (tempinc < 0 || tempinc >= tempbytes) throw new ECSError(`this system only has ${tempbytes} locals`, this.action);
|
||||||
this.scope.updateTempLiveness(this.sys);
|
this.scope.updateTempLiveness(this.instance);
|
||||||
return `${this.tmplabel}+${tempinc}`;
|
return `${this.tmplabel}+${tempinc}`;
|
||||||
}
|
}
|
||||||
__bss_init(args: string[]) {
|
__bss_init(args: string[]) {
|
||||||
|
@ -735,6 +776,10 @@ class ActionEval {
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
wrapCodeInRefLookup(code: string) {
|
||||||
|
code = this.dialect.ASM_LOOKUP_REF_X.replace('{{%code}}', code);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
generateCodeForField(fieldName: string, bitofs: number, canWrite: boolean): string {
|
generateCodeForField(fieldName: string, bitofs: number, canWrite: boolean): string {
|
||||||
const action = this.action;
|
const action = this.action;
|
||||||
const qr = this.jr || this.qr; // TODO: why not both!
|
const qr = this.jr || this.qr; // TODO: why not both!
|
||||||
|
@ -841,10 +886,10 @@ class ActionEval {
|
||||||
export class EntityScope implements SourceLocated {
|
export class EntityScope implements SourceLocated {
|
||||||
$loc: SourceLocation;
|
$loc: SourceLocation;
|
||||||
childScopes: EntityScope[] = [];
|
childScopes: EntityScope[] = [];
|
||||||
systems: System[] = [];
|
instances: SystemInstance[] = [];
|
||||||
entities: Entity[] = [];
|
entities: Entity[] = [];
|
||||||
fieldtypes: { [name: string]: 'init' | 'const' } = {};
|
fieldtypes: { [name: string]: 'init' | 'const' } = {};
|
||||||
sysstats = new Map<System, SystemStats>();
|
sysstats = new Map<SystemInstance, SystemStats>();
|
||||||
actionstats = new Map<Action, ActionStats>();
|
actionstats = new Map<Action, ActionStats>();
|
||||||
bss = new UninitDataSegment();
|
bss = new UninitDataSegment();
|
||||||
rodata = new ConstDataSegment();
|
rodata = new ConstDataSegment();
|
||||||
|
@ -876,9 +921,14 @@ export class EntityScope implements SourceLocated {
|
||||||
this.entities.push(entity);
|
this.entities.push(entity);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
addUsingSystem(system: System) {
|
newSystemInstance(inst: SystemInstance) {
|
||||||
if (!system) throw new Error();
|
if (!inst) throw new Error();
|
||||||
this.systems.push(system);
|
inst.id = this.instances.length+1;
|
||||||
|
this.instances.push(inst);
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
newSystemInstanceWithDefaults(system: System) {
|
||||||
|
return this.newSystemInstance({ system, params: {}, id:0 });
|
||||||
}
|
}
|
||||||
getEntityByName(name: string) {
|
getEntityByName(name: string) {
|
||||||
return this.entities.find(e => e.name == name);
|
return this.entities.find(e => e.name == name);
|
||||||
|
@ -1093,18 +1143,18 @@ export class EntityScope implements SourceLocated {
|
||||||
// generate code
|
// generate code
|
||||||
let s = this.dialect.code();
|
let s = this.dialect.code();
|
||||||
//s += `\n; event ${event}\n`;
|
//s += `\n; event ${event}\n`;
|
||||||
systems = systems.filter(s => this.systems.includes(s));
|
let instances = this.instances.filter(inst => systems.includes(inst.system));
|
||||||
for (let sys of systems) {
|
for (let inst of instances) {
|
||||||
|
let sys = inst.system;
|
||||||
for (let action of sys.actions) {
|
for (let action of sys.actions) {
|
||||||
if (action.event == event) {
|
if (action.event == event) {
|
||||||
// TODO: use Tokenizer so error msgs are better
|
// TODO: use Tokenizer so error msgs are better
|
||||||
// TODO: keep event tree
|
// TODO: keep event tree
|
||||||
let codeeval = new ActionEval(this, sys, action);
|
let codeeval = new ActionEval(this, inst, action);
|
||||||
codeeval.tmplabel = this.dialect.tempLabel(sys);
|
|
||||||
codeeval.begin();
|
codeeval.begin();
|
||||||
s += this.dialect.comment(`start action ${sys.name} ${event}`); // TODO
|
s += this.dialect.comment(`start action ${sys.name} ${inst.id} ${event}`); // TODO
|
||||||
s += codeeval.codeToString();
|
s += codeeval.codeToString();
|
||||||
s += this.dialect.comment(`end action ${sys.name} ${event}`);
|
s += this.dialect.comment(`end action ${sys.name} ${inst.id} ${event}`);
|
||||||
// TODO: check that this happens once?
|
// TODO: check that this happens once?
|
||||||
codeeval.end();
|
codeeval.end();
|
||||||
this.getActionStats(action).callcount++;
|
this.getActionStats(action).callcount++;
|
||||||
|
@ -1113,11 +1163,11 @@ export class EntityScope implements SourceLocated {
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
getSystemStats(sys: System) : SystemStats {
|
getSystemStats(inst: SystemInstance) : SystemStats {
|
||||||
let stats = this.sysstats.get(sys);
|
let stats = this.sysstats.get(inst);
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
stats = new SystemStats();
|
stats = new SystemStats();
|
||||||
this.sysstats.set(sys, stats);
|
this.sysstats.set(inst, stats);
|
||||||
}
|
}
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
@ -1129,8 +1179,8 @@ export class EntityScope implements SourceLocated {
|
||||||
}
|
}
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
updateTempLiveness(sys: System) {
|
updateTempLiveness(inst: SystemInstance) {
|
||||||
let stats = this.getSystemStats(sys);
|
let stats = this.getSystemStats(inst);
|
||||||
let n = this.eventSeq;
|
let n = this.eventSeq;
|
||||||
if (stats.tempstartseq && stats.tempendseq) {
|
if (stats.tempstartseq && stats.tempendseq) {
|
||||||
stats.tempstartseq = Math.min(stats.tempstartseq, n);
|
stats.tempstartseq = Math.min(stats.tempstartseq, n);
|
||||||
|
@ -1148,14 +1198,14 @@ export class EntityScope implements SourceLocated {
|
||||||
let maxTempBytes = 128 - this.bss.size; // TODO: multiple data segs
|
let maxTempBytes = 128 - this.bss.size; // TODO: multiple data segs
|
||||||
let bssbin = new Bin({ left:0, top:0, bottom: this.eventSeq+1, right: maxTempBytes });
|
let bssbin = new Bin({ left:0, top:0, bottom: this.eventSeq+1, right: maxTempBytes });
|
||||||
pack.bins.push(bssbin);
|
pack.bins.push(bssbin);
|
||||||
for (let sys of this.systems) {
|
for (let instance of this.instances) {
|
||||||
let stats = this.getSystemStats(sys);
|
let stats = this.getSystemStats(instance);
|
||||||
if (sys.tempbytes && stats.tempstartseq && stats.tempendseq) {
|
if (instance.system.tempbytes && stats.tempstartseq && stats.tempendseq) {
|
||||||
let v = {
|
let v = {
|
||||||
sys,
|
inst: instance,
|
||||||
top: stats.tempstartseq,
|
top: stats.tempstartseq,
|
||||||
bottom: stats.tempendseq+1,
|
bottom: stats.tempendseq+1,
|
||||||
width: sys.tempbytes,
|
width: instance.system.tempbytes,
|
||||||
height: stats.tempendseq - stats.tempstartseq + 1,
|
height: stats.tempendseq - stats.tempstartseq + 1,
|
||||||
};
|
};
|
||||||
pack.boxes.push(v);
|
pack.boxes.push(v);
|
||||||
|
@ -1166,9 +1216,9 @@ export class EntityScope implements SourceLocated {
|
||||||
if (bssbin.extents.right > 0) {
|
if (bssbin.extents.right > 0) {
|
||||||
this.bss.allocateBytes('TEMP', bssbin.extents.right);
|
this.bss.allocateBytes('TEMP', bssbin.extents.right);
|
||||||
for (let b of pack.boxes) {
|
for (let b of pack.boxes) {
|
||||||
let sys : System = (b as any).sys;
|
let inst : SystemInstance = (b as any).inst;
|
||||||
console.log(sys.name, b.box?.left);
|
console.log(inst.system.name, b.box?.left);
|
||||||
this.bss.equates[this.dialect.tempLabel(sys)] = `TEMP+${b.box?.left}`;
|
this.bss.equates[this.dialect.tempLabel(inst)] = `TEMP+${b.box?.left}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1184,7 +1234,7 @@ export class EntityScope implements SourceLocated {
|
||||||
let start;
|
let start;
|
||||||
let initsys = this.em.getSystemByName('Init');
|
let initsys = this.em.getSystemByName('Init');
|
||||||
if (isMainScope && initsys) {
|
if (isMainScope && initsys) {
|
||||||
this.addUsingSystem(initsys); //TODO: what if none?
|
this.newSystemInstanceWithDefaults(initsys); //TODO: what if none?
|
||||||
start = this.generateCodeForEvent('main_init');
|
start = this.generateCodeForEvent('main_init');
|
||||||
} else {
|
} else {
|
||||||
start = this.generateCodeForEvent('start');
|
start = this.generateCodeForEvent('start');
|
||||||
|
@ -1197,8 +1247,9 @@ export class EntityScope implements SourceLocated {
|
||||||
//this.showStats();
|
//this.showStats();
|
||||||
}
|
}
|
||||||
showStats() {
|
showStats() {
|
||||||
for (let sys of this.systems) {
|
for (let inst of this.instances) {
|
||||||
console.log(sys.name, this.getSystemStats(sys));
|
// TODO?
|
||||||
|
console.log(inst.system.name, this.getSystemStats(inst));
|
||||||
}
|
}
|
||||||
for (let action of Array.from(this.actionstats.keys())) {
|
for (let action of Array.from(this.actionstats.keys())) {
|
||||||
console.log(action.event, this.getActionStats(action));
|
console.log(action.event, this.getActionStats(action));
|
||||||
|
|
|
@ -118,7 +118,7 @@ export class Tokenizer {
|
||||||
switch (rule.type) {
|
switch (rule.type) {
|
||||||
case TokenType.CatchAll:
|
case TokenType.CatchAll:
|
||||||
if (this.errorOnCatchAll) {
|
if (this.errorOnCatchAll) {
|
||||||
this.compileError(`I didn't expect the character "${m[0]}" here.`);
|
this.compileError(`I didn't expect the character "${m[0]}" here.`, loc);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
this.pushToken({ str: s, type: rule.type, $loc: loc });
|
this.pushToken({ str: s, type: rule.type, $loc: loc });
|
||||||
|
|
|
@ -39,10 +39,10 @@ TEMP:
|
||||||
.res 1
|
.res 1
|
||||||
.res 1
|
.res 1
|
||||||
.res 1
|
.res 1
|
||||||
Kernel2Sprite__tmp = TEMP+0
|
Kernel2Sprite__2__tmp = TEMP+0
|
||||||
Joystick__tmp = TEMP+0
|
Joystick__3__tmp = TEMP+0
|
||||||
SpriteShuffler__tmp = TEMP+1
|
SpriteShuffler__8__tmp = TEMP+1
|
||||||
SpriteHider__tmp = TEMP+3
|
SpriteHider__9__tmp = TEMP+3
|
||||||
.code
|
.code
|
||||||
KernelSection_lines_b0:
|
KernelSection_lines_b0:
|
||||||
.byte 192
|
.byte 192
|
||||||
|
@ -117,7 +117,7 @@ Main__INITDATA:
|
||||||
__Start:
|
__Start:
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Init main_init
|
;;; start action Init 10 main_init
|
||||||
|
|
||||||
.include "vcs-ca65.h"
|
.include "vcs-ca65.h"
|
||||||
.macpack longbranch
|
.macpack longbranch
|
||||||
|
@ -135,20 +135,20 @@ __BRK:
|
||||||
; initialize data segment
|
; initialize data segment
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action FrameLoop start
|
;;; start action FrameLoop 1 start
|
||||||
|
|
||||||
FrameLoop__start__2__NextFrame:
|
FrameLoop__start__2__NextFrame:
|
||||||
FRAME_START
|
FRAME_START
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Kernel2Sprite preframe
|
;;; start action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
.define KLINES #192
|
.define KLINES #192
|
||||||
.define KPAD 32
|
.define KPAD 32
|
||||||
|
|
||||||
;;; end action Kernel2Sprite preframe
|
;;; end action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
;;; start action Kernel2Sprite preframe
|
;;; start action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
Kernel2Sprite__preframe__4____each:
|
Kernel2Sprite__preframe__4____each:
|
||||||
|
@ -162,76 +162,76 @@ Kernel2Sprite__preframe__4____each:
|
||||||
lda KLINES+KPAD
|
lda KLINES+KPAD
|
||||||
sec
|
sec
|
||||||
sbc HasYpos_ypos_b0,x
|
sbc HasYpos_ypos_b0,x
|
||||||
sta Kernel2Sprite__tmp+11
|
sta Kernel2Sprite__2__tmp+11
|
||||||
; calculate bitmap pointer
|
; calculate bitmap pointer
|
||||||
stx Kernel2Sprite__tmp+12 ; save X (Sprite index)
|
stx Kernel2Sprite__2__tmp+12 ; save X (Sprite index)
|
||||||
lda HasBitmap_bitmap_b0,x ; deref bitmap
|
lda HasBitmap_bitmap_b0,x ; deref bitmap
|
||||||
tax
|
tax
|
||||||
lda Bitmap_bitmapdata_b0,x
|
lda Bitmap_bitmapdata_b0,x
|
||||||
sec
|
sec
|
||||||
sbc Kernel2Sprite__tmp+11
|
sbc Kernel2Sprite__2__tmp+11
|
||||||
sta Kernel2Sprite__tmp+0,y ; Y = sprite slot index
|
sta Kernel2Sprite__2__tmp+0,y ; Y = sprite slot index
|
||||||
lda Bitmap_bitmapdata_b8,x
|
lda Bitmap_bitmapdata_b8,x
|
||||||
sbc #0
|
sbc #0
|
||||||
sta Kernel2Sprite__tmp+2,y
|
sta Kernel2Sprite__2__tmp+2,y
|
||||||
; get bitmap height
|
; get bitmap height
|
||||||
lda Bitmap_height_b0,x
|
lda Bitmap_height_b0,x
|
||||||
sta Kernel2Sprite__tmp+8,y
|
sta Kernel2Sprite__2__tmp+8,y
|
||||||
; calculate colormap pointer
|
; calculate colormap pointer
|
||||||
ldx Kernel2Sprite__tmp+12 ; restore X
|
ldx Kernel2Sprite__2__tmp+12 ; restore X
|
||||||
lda HasColormap_colormap_b0,x ; deref colormap
|
lda HasColormap_colormap_b0,x ; deref colormap
|
||||||
tax
|
tax
|
||||||
lda Colormap_colormapdata_b0,x
|
lda Colormap_colormapdata_b0,x
|
||||||
sec
|
sec
|
||||||
sbc Kernel2Sprite__tmp+11
|
sbc Kernel2Sprite__2__tmp+11
|
||||||
sta Kernel2Sprite__tmp+4,y
|
sta Kernel2Sprite__2__tmp+4,y
|
||||||
lda Colormap_colormapdata_b8,x
|
lda Colormap_colormapdata_b8,x
|
||||||
sbc #0
|
sbc #0
|
||||||
sta Kernel2Sprite__tmp+6,y
|
sta Kernel2Sprite__2__tmp+6,y
|
||||||
; save ypos
|
; save ypos
|
||||||
ldx Kernel2Sprite__tmp+12 ; restore X
|
ldx Kernel2Sprite__2__tmp+12 ; restore X
|
||||||
lda HasYpos_ypos_b0,x
|
lda HasYpos_ypos_b0,x
|
||||||
sta Kernel2Sprite__tmp+10,y
|
sta Kernel2Sprite__2__tmp+10,y
|
||||||
|
|
||||||
iny
|
iny
|
||||||
cpy #2
|
cpy #2
|
||||||
jne Kernel2Sprite__preframe__4____each
|
jne Kernel2Sprite__preframe__4____each
|
||||||
Kernel2Sprite__preframe__4____exit:
|
Kernel2Sprite__preframe__4____exit:
|
||||||
|
|
||||||
;;; end action Kernel2Sprite preframe
|
;;; end action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
;;; start action Kernel2Sprite preframe
|
;;; start action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
; L0 L1 H0 H1 -> L0 H0 L1 H1
|
; L0 L1 H0 H1 -> L0 H0 L1 H1
|
||||||
lda Kernel2Sprite__tmp+1
|
lda Kernel2Sprite__2__tmp+1
|
||||||
ldy Kernel2Sprite__tmp+2
|
ldy Kernel2Sprite__2__tmp+2
|
||||||
sty Kernel2Sprite__tmp+1
|
sty Kernel2Sprite__2__tmp+1
|
||||||
sta Kernel2Sprite__tmp+2
|
sta Kernel2Sprite__2__tmp+2
|
||||||
lda Kernel2Sprite__tmp+5
|
lda Kernel2Sprite__2__tmp+5
|
||||||
ldy Kernel2Sprite__tmp+6
|
ldy Kernel2Sprite__2__tmp+6
|
||||||
sty Kernel2Sprite__tmp+5
|
sty Kernel2Sprite__2__tmp+5
|
||||||
sta Kernel2Sprite__tmp+6
|
sta Kernel2Sprite__2__tmp+6
|
||||||
|
|
||||||
;;; end action Kernel2Sprite preframe
|
;;; end action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
;;; start action Kernel2Sprite preframe
|
;;; start action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
lda #162
|
lda #162
|
||||||
sta COLUBK
|
sta COLUBK
|
||||||
|
|
||||||
;;; end action Kernel2Sprite preframe
|
;;; end action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
;;; start action Kernel2Sprite preframe
|
;;; start action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
;;; end action Kernel2Sprite preframe
|
;;; end action Kernel2Sprite 2 preframe
|
||||||
|
|
||||||
;;; start action SetXPos preframe
|
;;; start action SetXPos 6 preframe
|
||||||
|
|
||||||
sta HMCLR
|
sta HMCLR
|
||||||
|
|
||||||
;;; end action SetXPos preframe
|
;;; end action SetXPos 6 preframe
|
||||||
|
|
||||||
;;; start action SetXPos preframe
|
;;; start action SetXPos 6 preframe
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
SetXPos__preframe__8____each:
|
SetXPos__preframe__8____each:
|
||||||
|
@ -240,7 +240,7 @@ SetXPos__preframe__8____each:
|
||||||
lda HasXpos_xpos_b0,x
|
lda HasXpos_xpos_b0,x
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action SetHorizPos SetHorizPos
|
;;; start action SetHorizPos 7 SetHorizPos
|
||||||
|
|
||||||
; SetHorizPos routine
|
; SetHorizPos routine
|
||||||
; A = X coordinate
|
; A = X coordinate
|
||||||
|
@ -259,7 +259,7 @@ SetHorizPos__SetHorizPos__9__DivideLoop:
|
||||||
sta RESP0,y ; fix coarse position
|
sta RESP0,y ; fix coarse position
|
||||||
sta HMP0,y ; set fine offset
|
sta HMP0,y ; set fine offset
|
||||||
|
|
||||||
;;; end action SetHorizPos SetHorizPos
|
;;; end action SetHorizPos 7 SetHorizPos
|
||||||
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
@ -267,61 +267,61 @@ SetHorizPos__SetHorizPos__9__DivideLoop:
|
||||||
jne SetXPos__preframe__8____each
|
jne SetXPos__preframe__8____each
|
||||||
SetXPos__preframe__8____exit:
|
SetXPos__preframe__8____exit:
|
||||||
|
|
||||||
;;; end action SetXPos preframe
|
;;; end action SetXPos 6 preframe
|
||||||
|
|
||||||
;;; start action SetXPos preframe
|
;;; start action SetXPos 6 preframe
|
||||||
|
|
||||||
;;; end action SetXPos preframe
|
;;; end action SetXPos 6 preframe
|
||||||
|
|
||||||
;;; start action SetXPos preframe
|
;;; start action SetXPos 6 preframe
|
||||||
|
|
||||||
sta WSYNC
|
sta WSYNC
|
||||||
sta HMOVE
|
sta HMOVE
|
||||||
|
|
||||||
;;; end action SetXPos preframe
|
;;; end action SetXPos 6 preframe
|
||||||
|
|
||||||
KERNEL_START
|
KERNEL_START
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Kernel2Sprite kernel
|
;;; start action Kernel2Sprite 2 kernel
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
sty VDELP0
|
sty VDELP0
|
||||||
iny
|
iny
|
||||||
sta VDELP1
|
sta VDELP1
|
||||||
|
|
||||||
;;; end action Kernel2Sprite kernel
|
;;; end action Kernel2Sprite 2 kernel
|
||||||
|
|
||||||
;;; start action Kernel2Sprite kernel
|
;;; start action Kernel2Sprite 2 kernel
|
||||||
|
|
||||||
; define macro for each line
|
; define macro for each line
|
||||||
.macro Kernel2Sprite__kernel__12__DrawLine do_wsync
|
.macro Kernel2Sprite__kernel__12__DrawLine do_wsync
|
||||||
.local DoDraw1
|
.local DoDraw1
|
||||||
.local DoDraw2
|
.local DoDraw2
|
||||||
; draw player 0
|
; draw player 0
|
||||||
lda Kernel2Sprite__tmp+8 ; height
|
lda Kernel2Sprite__2__tmp+8 ; height
|
||||||
dcp Kernel2Sprite__tmp+10 ; ypos
|
dcp Kernel2Sprite__2__tmp+10 ; ypos
|
||||||
bcs DoDraw1
|
bcs DoDraw1
|
||||||
lda #0
|
lda #0
|
||||||
.byte $2C
|
.byte $2C
|
||||||
DoDraw1:
|
DoDraw1:
|
||||||
lda (Kernel2Sprite__tmp+0),y
|
lda (Kernel2Sprite__2__tmp+0),y
|
||||||
.if do_wsync
|
.if do_wsync
|
||||||
sta WSYNC
|
sta WSYNC
|
||||||
.endif
|
.endif
|
||||||
sta GRP0
|
sta GRP0
|
||||||
lda (Kernel2Sprite__tmp+4),y
|
lda (Kernel2Sprite__2__tmp+4),y
|
||||||
sta COLUP0
|
sta COLUP0
|
||||||
; draw player 1
|
; draw player 1
|
||||||
lda Kernel2Sprite__tmp+9 ; height
|
lda Kernel2Sprite__2__tmp+9 ; height
|
||||||
dcp Kernel2Sprite__tmp+11 ; ypos
|
dcp Kernel2Sprite__2__tmp+11 ; ypos
|
||||||
bcs DoDraw2
|
bcs DoDraw2
|
||||||
lda #0
|
lda #0
|
||||||
.byte $2C
|
.byte $2C
|
||||||
DoDraw2:
|
DoDraw2:
|
||||||
lda (Kernel2Sprite__tmp+2),y
|
lda (Kernel2Sprite__2__tmp+2),y
|
||||||
sta GRP1
|
sta GRP1
|
||||||
lda (Kernel2Sprite__tmp+6),y
|
lda (Kernel2Sprite__2__tmp+6),y
|
||||||
sta COLUP1
|
sta COLUP1
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
@ -329,9 +329,9 @@ DoDraw2:
|
||||||
Kernel2Sprite__kernel__12__LVScan:
|
Kernel2Sprite__kernel__12__LVScan:
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Kernel2Sprite scanline1
|
;;; start action Kernel2Sprite 2 scanline1
|
||||||
|
|
||||||
;;; end action Kernel2Sprite scanline1
|
;;; end action Kernel2Sprite 2 scanline1
|
||||||
|
|
||||||
Kernel2Sprite__kernel__12__DrawLine 1 ; macro: draw scanline w/ WSYNC
|
Kernel2Sprite__kernel__12__DrawLine 1 ; macro: draw scanline w/ WSYNC
|
||||||
dey ; next scanline
|
dey ; next scanline
|
||||||
|
@ -341,9 +341,9 @@ Kernel2Sprite__kernel__12__LVScan:
|
||||||
dey ; next scanline
|
dey ; next scanline
|
||||||
bne Kernel2Sprite__kernel__12__LVScan ; repeat until out of lines
|
bne Kernel2Sprite__kernel__12__LVScan ; repeat until out of lines
|
||||||
|
|
||||||
;;; end action Kernel2Sprite kernel
|
;;; end action Kernel2Sprite 2 kernel
|
||||||
|
|
||||||
;;; start action Kernel2Sprite kernel
|
;;; start action Kernel2Sprite 2 kernel
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta GRP0
|
sta GRP0
|
||||||
|
@ -351,29 +351,29 @@ Kernel2Sprite__kernel__12__LVScan:
|
||||||
sta GRP0
|
sta GRP0
|
||||||
sta GRP1
|
sta GRP1
|
||||||
|
|
||||||
;;; end action Kernel2Sprite kernel
|
;;; end action Kernel2Sprite 2 kernel
|
||||||
|
|
||||||
KERNEL_END
|
KERNEL_END
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Joystick postframe
|
;;; start action Joystick 3 postframe
|
||||||
|
|
||||||
; 2 control inputs share a single byte, 4 bits each
|
; 2 control inputs share a single byte, 4 bits each
|
||||||
lda SWCHA
|
lda SWCHA
|
||||||
sta Joystick__tmp+0
|
sta Joystick__3__tmp+0
|
||||||
|
|
||||||
;;; end action Joystick postframe
|
;;; end action Joystick 3 postframe
|
||||||
|
|
||||||
;;; start action Joystick postframe
|
;;; start action Joystick 3 postframe
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
Joystick__postframe__15____each:
|
Joystick__postframe__15____each:
|
||||||
|
|
||||||
asl Joystick__tmp+0
|
asl Joystick__3__tmp+0
|
||||||
bcs Joystick__postframe__15__SkipMoveRight
|
bcs Joystick__postframe__15__SkipMoveRight
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action MoveJoyX joyright
|
;;; start action MoveJoyX 4 joyright
|
||||||
|
|
||||||
lda HasXpos_xpos_b0,x
|
lda HasXpos_xpos_b0,x
|
||||||
clc
|
clc
|
||||||
|
@ -383,14 +383,14 @@ Joystick__postframe__15____each:
|
||||||
sta HasXpos_xpos_b0,x
|
sta HasXpos_xpos_b0,x
|
||||||
MoveJoyX__joyright__16__nomove:
|
MoveJoyX__joyright__16__nomove:
|
||||||
|
|
||||||
;;; end action MoveJoyX joyright
|
;;; end action MoveJoyX 4 joyright
|
||||||
|
|
||||||
Joystick__postframe__15__SkipMoveRight:
|
Joystick__postframe__15__SkipMoveRight:
|
||||||
asl Joystick__tmp+0
|
asl Joystick__3__tmp+0
|
||||||
bcs Joystick__postframe__15__SkipMoveLeft
|
bcs Joystick__postframe__15__SkipMoveLeft
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action MoveJoyX joyleft
|
;;; start action MoveJoyX 4 joyleft
|
||||||
|
|
||||||
lda HasXpos_xpos_b0,x
|
lda HasXpos_xpos_b0,x
|
||||||
sec
|
sec
|
||||||
|
@ -399,14 +399,14 @@ Joystick__postframe__15__SkipMoveRight:
|
||||||
sta HasXpos_xpos_b0,x
|
sta HasXpos_xpos_b0,x
|
||||||
MoveJoyX__joyleft__17__nomove:
|
MoveJoyX__joyleft__17__nomove:
|
||||||
|
|
||||||
;;; end action MoveJoyX joyleft
|
;;; end action MoveJoyX 4 joyleft
|
||||||
|
|
||||||
Joystick__postframe__15__SkipMoveLeft:
|
Joystick__postframe__15__SkipMoveLeft:
|
||||||
asl Joystick__tmp+0
|
asl Joystick__3__tmp+0
|
||||||
bcs Joystick__postframe__15__SkipMoveDown
|
bcs Joystick__postframe__15__SkipMoveDown
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action MoveJoyY joydown
|
;;; start action MoveJoyY 5 joydown
|
||||||
|
|
||||||
lda HasYpos_ypos_b0,x
|
lda HasYpos_ypos_b0,x
|
||||||
clc
|
clc
|
||||||
|
@ -416,14 +416,14 @@ Joystick__postframe__15__SkipMoveLeft:
|
||||||
sta HasYpos_ypos_b0,x
|
sta HasYpos_ypos_b0,x
|
||||||
MoveJoyY__joydown__18__nomove:
|
MoveJoyY__joydown__18__nomove:
|
||||||
|
|
||||||
;;; end action MoveJoyY joydown
|
;;; end action MoveJoyY 5 joydown
|
||||||
|
|
||||||
Joystick__postframe__15__SkipMoveDown:
|
Joystick__postframe__15__SkipMoveDown:
|
||||||
asl Joystick__tmp+0
|
asl Joystick__3__tmp+0
|
||||||
bcs Joystick__postframe__15__SkipMoveUp
|
bcs Joystick__postframe__15__SkipMoveUp
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action MoveJoyY joyup
|
;;; start action MoveJoyY 5 joyup
|
||||||
|
|
||||||
lda HasYpos_ypos_b0,x
|
lda HasYpos_ypos_b0,x
|
||||||
sec
|
sec
|
||||||
|
@ -432,7 +432,7 @@ Joystick__postframe__15__SkipMoveDown:
|
||||||
sta HasYpos_ypos_b0,x
|
sta HasYpos_ypos_b0,x
|
||||||
MoveJoyY__joyup__19__nomove:
|
MoveJoyY__joyup__19__nomove:
|
||||||
|
|
||||||
;;; end action MoveJoyY joyup
|
;;; end action MoveJoyY 5 joyup
|
||||||
|
|
||||||
Joystick__postframe__15__SkipMoveUp:
|
Joystick__postframe__15__SkipMoveUp:
|
||||||
|
|
||||||
|
@ -441,15 +441,15 @@ Joystick__postframe__15__SkipMoveUp:
|
||||||
jne Joystick__postframe__15____each
|
jne Joystick__postframe__15____each
|
||||||
Joystick__postframe__15____exit:
|
Joystick__postframe__15____exit:
|
||||||
|
|
||||||
;;; end action Joystick postframe
|
;;; end action Joystick 3 postframe
|
||||||
|
|
||||||
;;; start action SpriteShuffler postframe
|
;;; start action SpriteShuffler 8 postframe
|
||||||
|
|
||||||
; load two sprite slots at left side of array
|
; load two sprite slots at left side of array
|
||||||
lda SpriteSlot_sprite_b0
|
lda SpriteSlot_sprite_b0
|
||||||
sta SpriteShuffler__tmp+0
|
sta SpriteShuffler__8__tmp+0
|
||||||
lda SpriteSlot_sprite_b0+1
|
lda SpriteSlot_sprite_b0+1
|
||||||
sta SpriteShuffler__tmp+1
|
sta SpriteShuffler__8__tmp+1
|
||||||
; move two slots to the left
|
; move two slots to the left
|
||||||
ldx #0
|
ldx #0
|
||||||
SpriteShuffler__postframe__20__loop:
|
SpriteShuffler__postframe__20__loop:
|
||||||
|
@ -459,21 +459,21 @@ SpriteShuffler__postframe__20__loop:
|
||||||
cpx #4-2
|
cpx #4-2
|
||||||
bne SpriteShuffler__postframe__20__loop
|
bne SpriteShuffler__postframe__20__loop
|
||||||
; store two sprite slots at right side of array
|
; store two sprite slots at right side of array
|
||||||
lda SpriteShuffler__tmp+0
|
lda SpriteShuffler__8__tmp+0
|
||||||
sta SpriteSlot_sprite_b0+4-2
|
sta SpriteSlot_sprite_b0+4-2
|
||||||
lda SpriteShuffler__tmp+1
|
lda SpriteShuffler__8__tmp+1
|
||||||
sta SpriteSlot_sprite_b0+4-1
|
sta SpriteSlot_sprite_b0+4-1
|
||||||
|
|
||||||
;;; end action SpriteShuffler postframe
|
;;; end action SpriteShuffler 8 postframe
|
||||||
|
|
||||||
;;; start action SpriteHider postframe
|
;;; start action SpriteHider 9 postframe
|
||||||
|
|
||||||
lda #4-1
|
lda #4-1
|
||||||
sta SpriteHider__tmp+0
|
sta SpriteHider__9__tmp+0
|
||||||
|
|
||||||
;;; end action SpriteHider postframe
|
;;; end action SpriteHider 9 postframe
|
||||||
|
|
||||||
;;; start action SpriteHider postframe
|
;;; start action SpriteHider 9 postframe
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
SpriteHider__postframe__22____each:
|
SpriteHider__postframe__22____each:
|
||||||
|
@ -485,12 +485,12 @@ SpriteHider__postframe__22____each:
|
||||||
; swap this sprite slot with slot at end of array
|
; swap this sprite slot with slot at end of array
|
||||||
lda SpriteSlot_sprite_b0,y
|
lda SpriteSlot_sprite_b0,y
|
||||||
pha
|
pha
|
||||||
ldx SpriteHider__tmp+0 ; clobbers X, but no longer used
|
ldx SpriteHider__9__tmp+0 ; clobbers X, but no longer used
|
||||||
lda SpriteSlot_sprite_b0,x
|
lda SpriteSlot_sprite_b0,x
|
||||||
sta SpriteSlot_sprite_b0,y
|
sta SpriteSlot_sprite_b0,y
|
||||||
pla
|
pla
|
||||||
sta SpriteSlot_sprite_b0,x
|
sta SpriteSlot_sprite_b0,x
|
||||||
dec SpriteHider__tmp+0
|
dec SpriteHider__9__tmp+0
|
||||||
SpriteHider__postframe__22__skip:
|
SpriteHider__postframe__22__skip:
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
@ -498,14 +498,14 @@ SpriteHider__postframe__22__skip:
|
||||||
jne SpriteHider__postframe__22____each
|
jne SpriteHider__postframe__22____each
|
||||||
SpriteHider__postframe__22____exit:
|
SpriteHider__postframe__22____exit:
|
||||||
|
|
||||||
;;; end action SpriteHider postframe
|
;;; end action SpriteHider 9 postframe
|
||||||
|
|
||||||
FRAME_END
|
FRAME_END
|
||||||
.code
|
.code
|
||||||
|
|
||||||
jmp FrameLoop__start__2__NextFrame ; loop to next frame
|
jmp FrameLoop__start__2__NextFrame ; loop to next frame
|
||||||
|
|
||||||
;;; end action FrameLoop start
|
;;; end action FrameLoop 1 start
|
||||||
; start main routine
|
; start main routine
|
||||||
.segment "VECTORS"
|
.segment "VECTORS"
|
||||||
Return: .word $6060
|
Return: .word $6060
|
||||||
|
@ -513,7 +513,7 @@ VecNMI:
|
||||||
VecReset: .word Main::__Reset
|
VecReset: .word Main::__Reset
|
||||||
VecBRK: .word Main::__BRK
|
VecBRK: .word Main::__BRK
|
||||||
|
|
||||||
;;; end action Init main_init
|
;;; end action Init 10 main_init
|
||||||
|
|
||||||
.endscope
|
.endscope
|
||||||
Main__Start = Main::__Start
|
Main__Start = Main::__Start
|
|
@ -5,7 +5,7 @@ PFColor_pfcolor_b0:
|
||||||
.res 1
|
.res 1
|
||||||
TEMP:
|
TEMP:
|
||||||
.res 1
|
.res 1
|
||||||
Local__tmp = TEMP+0
|
Local__6__tmp = TEMP+0
|
||||||
.code
|
.code
|
||||||
KernelSection_lines_b0:
|
KernelSection_lines_b0:
|
||||||
.byte 2
|
.byte 2
|
||||||
|
@ -46,7 +46,7 @@ Main__INITDATA:
|
||||||
__Start:
|
__Start:
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Init main_init
|
;;; start action Init 7 main_init
|
||||||
|
|
||||||
.include "vcs-ca65.h"
|
.include "vcs-ca65.h"
|
||||||
.define PAL 0
|
.define PAL 0
|
||||||
|
@ -63,24 +63,24 @@ __BRK:
|
||||||
; initialize data segment
|
; initialize data segment
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action FrameLoop start
|
;;; start action FrameLoop 1 start
|
||||||
|
|
||||||
FrameLoop__start__2__NextFrame:
|
FrameLoop__start__2__NextFrame:
|
||||||
FRAME_START
|
FRAME_START
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel preframe
|
;;; start action StaticKernel 4 preframe
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
lda #24
|
lda #24
|
||||||
sta COLUBK
|
sta COLUBK
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #0+2
|
cpx #0+2
|
||||||
jcs StaticKernel__kernelsetup__5____skipxhi
|
jcs StaticKernel__kernelsetup__5____skipxhi
|
||||||
|
@ -95,9 +95,9 @@ StaticKernel__kernelsetup__5____skipxlo:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__5____skipxhi:
|
StaticKernel__kernelsetup__5____skipxhi:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #0+4
|
cpx #0+4
|
||||||
jcs StaticKernel__kernelsetup__6____skipxhi
|
jcs StaticKernel__kernelsetup__6____skipxhi
|
||||||
|
@ -116,15 +116,15 @@ StaticKernel__kernelsetup__6____skipxlo:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__6____skipxhi:
|
StaticKernel__kernelsetup__6____skipxhi:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
|
|
||||||
;;; end action StaticKernel preframe
|
;;; end action StaticKernel 4 preframe
|
||||||
|
|
||||||
KERNEL_START
|
KERNEL_START
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel kernel
|
;;; start action StaticKernel 4 kernel
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
StaticKernel__kernel__7____each:
|
StaticKernel__kernel__7____each:
|
||||||
|
@ -132,14 +132,14 @@ StaticKernel__kernel__7____each:
|
||||||
sta WSYNC
|
sta WSYNC
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
lda BGColor_bgcolor_b0,x
|
lda BGColor_bgcolor_b0,x
|
||||||
sta COLUBK
|
sta COLUBK
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #5+2
|
cpx #5+2
|
||||||
jcs StaticKernel__kernelsetup__9____skipxhi
|
jcs StaticKernel__kernelsetup__9____skipxhi
|
||||||
|
@ -154,9 +154,9 @@ StaticKernel__kernelsetup__9____skipxlo:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__9____skipxhi:
|
StaticKernel__kernelsetup__9____skipxhi:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #4
|
cpx #4
|
||||||
jcc StaticKernel__kernelsetup__10____skipxlo
|
jcc StaticKernel__kernelsetup__10____skipxlo
|
||||||
|
@ -170,7 +170,7 @@ StaticKernel__kernelsetup__9____skipxhi:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__10____skipxlo:
|
StaticKernel__kernelsetup__10____skipxlo:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
ldy KernelSection_lines_b0,x
|
ldy KernelSection_lines_b0,x
|
||||||
StaticKernel__kernel__7__loop:
|
StaticKernel__kernel__7__loop:
|
||||||
|
@ -185,50 +185,50 @@ StaticKernel__kernel__7__loop:
|
||||||
jne StaticKernel__kernel__7____each
|
jne StaticKernel__kernel__7____each
|
||||||
StaticKernel__kernel__7____exit:
|
StaticKernel__kernel__7____exit:
|
||||||
|
|
||||||
;;; end action StaticKernel kernel
|
;;; end action StaticKernel 4 kernel
|
||||||
|
|
||||||
KERNEL_END
|
KERNEL_END
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action JoyButton postframe
|
;;; start action JoyButton 5 postframe
|
||||||
|
|
||||||
lda INPT4 ;read button input
|
lda INPT4 ;read button input
|
||||||
bmi JoyButton__postframe__11__NotPressed
|
bmi JoyButton__postframe__11__NotPressed
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Local joybutton
|
;;; start action Local 6 joybutton
|
||||||
|
|
||||||
inc Local__tmp+0
|
inc Local__6__tmp+0
|
||||||
inc PFColor_pfcolor_b0
|
inc PFColor_pfcolor_b0
|
||||||
|
|
||||||
;;; end action Local joybutton
|
;;; end action Local 6 joybutton
|
||||||
|
|
||||||
JoyButton__postframe__11__NotPressed:
|
JoyButton__postframe__11__NotPressed:
|
||||||
|
|
||||||
;;; end action JoyButton postframe
|
;;; end action JoyButton 5 postframe
|
||||||
|
|
||||||
FRAME_END
|
FRAME_END
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action ResetSwitch nextframe
|
;;; start action ResetSwitch 2 nextframe
|
||||||
|
|
||||||
lsr SWCHB ; test Game Reset switch
|
lsr SWCHB ; test Game Reset switch
|
||||||
bcs ResetSwitch__nextframe__13__NoStart
|
bcs ResetSwitch__nextframe__13__NoStart
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action ResetConsole resetswitch
|
;;; start action ResetConsole 3 resetswitch
|
||||||
|
|
||||||
jmp Main::__Reset ; jump to Reset handler
|
jmp Main::__Reset ; jump to Reset handler
|
||||||
|
|
||||||
;;; end action ResetConsole resetswitch
|
;;; end action ResetConsole 3 resetswitch
|
||||||
|
|
||||||
ResetSwitch__nextframe__13__NoStart:
|
ResetSwitch__nextframe__13__NoStart:
|
||||||
|
|
||||||
;;; end action ResetSwitch nextframe
|
;;; end action ResetSwitch 2 nextframe
|
||||||
|
|
||||||
jmp FrameLoop__start__2__NextFrame ; loop to next frame
|
jmp FrameLoop__start__2__NextFrame ; loop to next frame
|
||||||
|
|
||||||
;;; end action FrameLoop start
|
;;; end action FrameLoop 1 start
|
||||||
; start main routine
|
; start main routine
|
||||||
.segment "VECTORS"
|
.segment "VECTORS"
|
||||||
Return: .word $6060
|
Return: .word $6060
|
||||||
|
@ -236,7 +236,7 @@ VecNMI:
|
||||||
VecReset: .word Main::__Reset
|
VecReset: .word Main::__Reset
|
||||||
VecBRK: .word Main::__BRK
|
VecBRK: .word Main::__BRK
|
||||||
|
|
||||||
;;; end action Init main_init
|
;;; end action Init 7 main_init
|
||||||
|
|
||||||
.endscope
|
.endscope
|
||||||
Main__Start = Main::__Start
|
Main__Start = Main::__Start
|
|
@ -5,7 +5,7 @@ PFColor_pfcolor_b0:
|
||||||
.res 1
|
.res 1
|
||||||
TEMP:
|
TEMP:
|
||||||
.res 1
|
.res 1
|
||||||
Local__tmp = TEMP+0
|
Local__6__tmp = TEMP+0
|
||||||
.code
|
.code
|
||||||
KernelSection_lines_b0:
|
KernelSection_lines_b0:
|
||||||
.byte 2
|
.byte 2
|
||||||
|
@ -46,7 +46,7 @@ Main__INITDATA:
|
||||||
__Start:
|
__Start:
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Init main_init
|
;;; start action Init 7 main_init
|
||||||
|
|
||||||
.include "vcs-ca65.h"
|
.include "vcs-ca65.h"
|
||||||
.macpack longbranch
|
.macpack longbranch
|
||||||
|
@ -64,24 +64,24 @@ __BRK:
|
||||||
; initialize data segment
|
; initialize data segment
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action FrameLoop start
|
;;; start action FrameLoop 1 start
|
||||||
|
|
||||||
FrameLoop__start__2__NextFrame:
|
FrameLoop__start__2__NextFrame:
|
||||||
FRAME_START
|
FRAME_START
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel preframe
|
;;; start action StaticKernel 4 preframe
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
lda #24
|
lda #24
|
||||||
sta COLUBK
|
sta COLUBK
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #0+2
|
cpx #0+2
|
||||||
jcs StaticKernel__kernelsetup__5____skipxhi
|
jcs StaticKernel__kernelsetup__5____skipxhi
|
||||||
|
@ -96,9 +96,9 @@ StaticKernel__kernelsetup__5____skipxlo:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__5____skipxhi:
|
StaticKernel__kernelsetup__5____skipxhi:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #0+4
|
cpx #0+4
|
||||||
jcs StaticKernel__kernelsetup__6____skipxhi
|
jcs StaticKernel__kernelsetup__6____skipxhi
|
||||||
|
@ -117,15 +117,15 @@ StaticKernel__kernelsetup__6____skipxlo:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__6____skipxhi:
|
StaticKernel__kernelsetup__6____skipxhi:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
|
|
||||||
;;; end action StaticKernel preframe
|
;;; end action StaticKernel 4 preframe
|
||||||
|
|
||||||
KERNEL_START
|
KERNEL_START
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel kernel
|
;;; start action StaticKernel 4 kernel
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
StaticKernel__kernel__7____each:
|
StaticKernel__kernel__7____each:
|
||||||
|
@ -133,14 +133,14 @@ StaticKernel__kernel__7____each:
|
||||||
sta WSYNC
|
sta WSYNC
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
lda BGColor_bgcolor_b0,x
|
lda BGColor_bgcolor_b0,x
|
||||||
sta COLUBK
|
sta COLUBK
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #5+2
|
cpx #5+2
|
||||||
jcs StaticKernel__kernelsetup__9____skipxhi
|
jcs StaticKernel__kernelsetup__9____skipxhi
|
||||||
|
@ -155,9 +155,9 @@ StaticKernel__kernelsetup__9____skipxlo:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__9____skipxhi:
|
StaticKernel__kernelsetup__9____skipxhi:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
;;; start action StaticKernel kernelsetup
|
;;; start action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
cpx #4
|
cpx #4
|
||||||
jcc StaticKernel__kernelsetup__10____skipxlo
|
jcc StaticKernel__kernelsetup__10____skipxlo
|
||||||
|
@ -171,11 +171,11 @@ StaticKernel__kernelsetup__9____skipxhi:
|
||||||
|
|
||||||
StaticKernel__kernelsetup__10____skipxlo:
|
StaticKernel__kernelsetup__10____skipxlo:
|
||||||
|
|
||||||
;;; end action StaticKernel kernelsetup
|
;;; end action StaticKernel 4 kernelsetup
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action StaticKernel kerneldraw
|
;;; start action StaticKernel 4 kerneldraw
|
||||||
|
|
||||||
ldy KernelSection_lines_b0,x
|
ldy KernelSection_lines_b0,x
|
||||||
StaticKernel__kerneldraw__11__loop:
|
StaticKernel__kerneldraw__11__loop:
|
||||||
|
@ -184,7 +184,7 @@ StaticKernel__kerneldraw__11__loop:
|
||||||
dey
|
dey
|
||||||
bne StaticKernel__kerneldraw__11__loop
|
bne StaticKernel__kerneldraw__11__loop
|
||||||
|
|
||||||
;;; end action StaticKernel kerneldraw
|
;;; end action StaticKernel 4 kerneldraw
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,50 +193,50 @@ StaticKernel__kerneldraw__11__loop:
|
||||||
jne StaticKernel__kernel__7____each
|
jne StaticKernel__kernel__7____each
|
||||||
StaticKernel__kernel__7____exit:
|
StaticKernel__kernel__7____exit:
|
||||||
|
|
||||||
;;; end action StaticKernel kernel
|
;;; end action StaticKernel 4 kernel
|
||||||
|
|
||||||
KERNEL_END
|
KERNEL_END
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action JoyButton postframe
|
;;; start action JoyButton 5 postframe
|
||||||
|
|
||||||
lda INPT4 ;read button input
|
lda INPT4 ;read button input
|
||||||
bmi JoyButton__postframe__12__NotPressed
|
bmi JoyButton__postframe__12__NotPressed
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action Local joybutton
|
;;; start action Local 6 joybutton
|
||||||
|
|
||||||
inc Local__tmp+0
|
inc Local__6__tmp+0
|
||||||
inc PFColor_pfcolor_b0
|
inc PFColor_pfcolor_b0
|
||||||
|
|
||||||
;;; end action Local joybutton
|
;;; end action Local 6 joybutton
|
||||||
|
|
||||||
JoyButton__postframe__12__NotPressed:
|
JoyButton__postframe__12__NotPressed:
|
||||||
|
|
||||||
;;; end action JoyButton postframe
|
;;; end action JoyButton 5 postframe
|
||||||
|
|
||||||
FRAME_END
|
FRAME_END
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action ResetSwitch nextframe
|
;;; start action ResetSwitch 2 nextframe
|
||||||
|
|
||||||
lsr SWCHB ; test Game Reset switch
|
lsr SWCHB ; test Game Reset switch
|
||||||
bcs ResetSwitch__nextframe__14__NoStart
|
bcs ResetSwitch__nextframe__14__NoStart
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;;; start action ResetConsole resetswitch
|
;;; start action ResetConsole 3 resetswitch
|
||||||
|
|
||||||
jmp Main::__Reset ; jump to Reset handler
|
jmp Main::__Reset ; jump to Reset handler
|
||||||
|
|
||||||
;;; end action ResetConsole resetswitch
|
;;; end action ResetConsole 3 resetswitch
|
||||||
|
|
||||||
ResetSwitch__nextframe__14__NoStart:
|
ResetSwitch__nextframe__14__NoStart:
|
||||||
|
|
||||||
;;; end action ResetSwitch nextframe
|
;;; end action ResetSwitch 2 nextframe
|
||||||
|
|
||||||
jmp FrameLoop__start__2__NextFrame ; loop to next frame
|
jmp FrameLoop__start__2__NextFrame ; loop to next frame
|
||||||
|
|
||||||
;;; end action FrameLoop start
|
;;; end action FrameLoop 1 start
|
||||||
; start main routine
|
; start main routine
|
||||||
.segment "VECTORS"
|
.segment "VECTORS"
|
||||||
Return: .word $6060
|
Return: .word $6060
|
||||||
|
@ -244,7 +244,7 @@ VecNMI:
|
||||||
VecReset: .word Main::__Reset
|
VecReset: .word Main::__Reset
|
||||||
VecBRK: .word Main::__BRK
|
VecBRK: .word Main::__BRK
|
||||||
|
|
||||||
;;; end action Init main_init
|
;;; end action Init 7 main_init
|
||||||
|
|
||||||
.endscope
|
.endscope
|
||||||
Main__Start = Main::__Start
|
Main__Start = Main::__Start
|
Loading…
Reference in New Issue
Block a user