1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-05-28 08:41:30 +00:00

ecs: EVENT__xxx defines

This commit is contained in:
Steven Hugg 2022-02-23 11:16:47 -06:00
parent 5afd3cf498
commit c9e75ae77d
9 changed files with 111 additions and 0 deletions

View File

@ -353,6 +353,10 @@ export class Dialect_CA65 {
equate(symbol: string, value: string): string { equate(symbol: string, value: string): string {
return `${symbol} = ${value}`; return `${symbol} = ${value}`;
} }
define(symbol: string, value?: string): string {
if (value) return `.define ${symbol} ${value}`;
else return `.define ${symbol}`;
}
call(symbol: string) { call(symbol: string) {
return ` jsr ${symbol}`; return ` jsr ${symbol}`;
} }
@ -1008,6 +1012,7 @@ class ActionEval {
//eidofs -= xreg.offset(); //eidofs -= xreg.offset();
//eidofs -= int.entities[0].id - xreg.elo; //eidofs -= int.entities[0].id - xreg.elo;
eidofs = xreg.elo - range.elo; eidofs = xreg.elo - range.elo;
// TODO? if (xreg.ehi > range.ehi) throw new ECSError(`field "${field.name}" could overflow`, action);
} else if (yreg && (int = yreg.eset?.intersection(qr))) { } else if (yreg && (int = yreg.eset?.intersection(qr))) {
ir = yreg.eset; ir = yreg.eset;
//eidofs -= yreg.offset(); //eidofs -= yreg.offset();
@ -1716,6 +1721,9 @@ export class EntityManager {
}) })
} }
exportToFile(file: SourceFileExport) { exportToFile(file: SourceFileExport) {
for (let event of Object.keys(this.event2systems)) {
file.line(this.dialect.equate(`EVENT__${event}`, '1'))
}
for (let scope of Object.values(this.topScopes)) { for (let scope of Object.values(this.topScopes)) {
if (!scope.isDemo || scope.filePath == this.mainPath) { if (!scope.isDemo || scope.filePath == this.mainPath) {
scope.dump(file); scope.dump(file);

View File

@ -1,3 +1,4 @@
EVENT__start = 1
.scope Main .scope Main
.zeropage .zeropage
Xpos_x_b0: Xpos_x_b0:

View File

@ -1,3 +1,20 @@
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kerneldraw = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
EVENT__FontTable = 1
EVENT__compute2digit = 1
EVENT__fetchdigit = 1
EVENT__FontTablePF = 1
EVENT__FontTablePFFancy = 1
EVENT__AddBCD4 = 1
.scope Main .scope Main
.zeropage .zeropage
BCDScore6_digits_b0: BCDScore6_digits_b0:

View File

@ -1,3 +1,19 @@
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kerneldraw = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
EVENT__scanline = 1
EVENT__joyleft = 1
EVENT__joyright = 1
EVENT__joyup = 1
EVENT__joydown = 1
.scope Main .scope Main
.zeropage .zeropage
HasBitmap_bitmap_b0: HasBitmap_bitmap_b0:

View File

@ -1,3 +1,20 @@
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kerneldraw = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
EVENT__scanline1 = 1
EVENT__scanline2 = 1
EVENT__joyleft = 1
EVENT__joyright = 1
EVENT__joyup = 1
EVENT__joydown = 1
.scope Main .scope Main
.zeropage .zeropage
HasBitmap_bitmap_b0: HasBitmap_bitmap_b0:

View File

@ -1,3 +1,23 @@
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kerneldraw = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
EVENT__scanline = 1
EVENT__joyleft = 1
EVENT__joyright = 1
EVENT__joyup = 1
EVENT__joydown = 1
EVENT__gowest = 1
EVENT__goeast = 1
EVENT__gonorth = 1
EVENT__gosouth = 1
.scope Main .scope Main
.zeropage .zeropage
Location_room_b0: Location_room_b0:

View File

@ -1,3 +1,14 @@
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kerneldraw = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
.scope TitleDemo .scope TitleDemo
.zeropage .zeropage
.code .code

View File

@ -1,3 +1,13 @@
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
.scope Main .scope Main
.zeropage .zeropage
PFColor_pfcolor_b0: PFColor_pfcolor_b0:

View File

@ -1,3 +1,14 @@
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kerneldraw = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
.scope Main .scope Main
.zeropage .zeropage
PFColor_pfcolor_b0: PFColor_pfcolor_b0: