1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-24 12:31:25 +00:00

ecs: fold common subroutines, align/page crossing

This commit is contained in:
Steven Hugg 2022-02-19 04:06:25 -06:00
parent a87dbf03cf
commit 349c45d7c0
10 changed files with 170 additions and 285 deletions

View File

@ -237,7 +237,6 @@ export class ECSCompiler extends Tokenizer {
// TODO: include modifiers in error msg
const select = this.expectTokens(SELECT_TYPE).str as SelectType; // TODO: type check?
const all_modifiers = ['critical','asc','desc']; // TODO
const modifiers = this.parseModifiers(all_modifiers);
let query = undefined;
let join = undefined;
if (select == 'once') {
@ -253,12 +252,18 @@ export class ECSCompiler extends Tokenizer {
if (!query) { this.compileError(`A "${select}" query can't include a limit.`); }
else query.limit = this.expectInteger();
}
const modifiers = this.parseModifiers(all_modifiers);
let fitbytes = undefined;
if (this.ifToken('fit')) {
fitbytes = this.expectInteger();
}
let context : ActionContext = { scope: null, system };
// parse --- code ---
let text = this.parseCode(context);
let direction = undefined;
if (modifiers['asc']) direction = 'asc';
else if (modifiers['desc']) direction = 'desc';
let action = { text, event, query, join, select, direction };
let action = { text, event, query, join, select, direction, fitbytes };
if (modifiers['critical']) (action as ActionWithJoin).critical = true;
return action as ActionWithJoin;
}

View File

@ -125,6 +125,7 @@ export interface ActionBase extends SourceLocated {
event: string;
text: string;
critical?: boolean;
fitbytes?: number;
}
export interface ActionOnce extends ActionBase {
@ -297,12 +298,6 @@ export class Dialect_CA65 {
datasymbol(component: ComponentType, field: DataField, eid: number, bitofs: number) {
return `${component.name}_${field.name}_e${eid}_b${bitofs}`;
}
code() {
return `.code\n`;
}
bss() {
return `.bss\n`;
}
debug_file(path: string) {
return `.dbg file, "${path}", 0, 0`
}
@ -316,6 +311,22 @@ export class Dialect_CA65 {
return `.endscope\n${name}__Start = ${name}::__Start`
// TODO: scope__start = scope::start
}
align(value: number) {
return `.align ${value}`;
}
alignSegmentStart() {
return this.label('__ALIGNORIGIN');
}
warningIfMoreThan(bytes: number, startlabel: string) {
return `
.assert (* - ${startlabel}) <= ${bytes}, error, "${startlabel} does not fit in ${bytes} bytes!"`
}
alignIfLessThan(bytes: number) {
return `
.if <(* - __ALIGNORIGIN) > 256-${bytes}
.align $100
.endif`
}
segment(segtype: 'rodata' | 'bss' | 'code') {
if (segtype == 'bss') {
return `.zeropage`;
@ -590,6 +601,7 @@ class ActionEval {
entities : Entity[];
tmplabel = '';
label : string;
//used = new Set<string>(); // TODO
constructor(
readonly scope: EntityScope,
@ -842,6 +854,7 @@ class ActionEval {
__arg(args: string[]) {
let argindex = parseInt(args[0] || '0');
let argvalue = this.eventargs[argindex] || '';
//this.used.add(`arg_${argindex}_${argvalue}`);
return argvalue;
}
__bss_init(args: string[]) {
@ -996,6 +1009,22 @@ class ActionEval {
}
*/
}
isSubroutineSized(code: string) {
// TODO?
if (code.length > 20000) return false;
if (code.split('.dbg line').length >= 4) return true;
return false;
}
}
class EventCodeStats {
constructor(
public readonly inst: SystemInstance,
public readonly action: Action,
public readonly code: string,
public readonly symbol: string,
) { }
count = 0;
}
export class EntityScope implements SourceLocated {
@ -1009,12 +1038,15 @@ export class EntityScope implements SourceLocated {
rodata = new ConstDataSegment();
code = new CodeSegment();
componentsInScope = new Set();
eventSeq = 0;
resources = new Set<string>();
state = new ActionCPUState();
isDemo = false;
filePath = '';
eventSeq : number;
eventStats : { [key:string] : EventCodeStats };
inCritical = 0;
constructor(
public readonly em: EntityManager,
public readonly dialect: Dialect_CA65,
@ -1276,7 +1308,7 @@ export class EntityScope implements SourceLocated {
}
this.eventSeq++;
// generate code
let code = this.dialect.code() + '\n';
let code = '';
if (codelabel) { code += this.dialect.label(codelabel) + '\n'; }
let eventCount = 0;
let instances = this.instances.filter(inst => systems.includes(inst.system));
@ -1289,23 +1321,22 @@ export class EntityScope implements SourceLocated {
// TODO: keep event tree
let codeeval = new ActionEval(this, inst, action, args || []);
codeeval.begin();
if (action.critical) this.inCritical++;
let eventcode = codeeval.codeToString();
if (action.critical) this.inCritical--;
if (!this.inCritical && codeeval.isSubroutineSized(eventcode)) {
// TODO: label rewriting messes this up
let estats = this.eventStats[eventcode];
if (!estats) {
estats = this.eventStats[eventcode] = new EventCodeStats(
inst, action, eventcode, codeeval.label);
}
estats.count++;
if (action.critical) estats.count++; // always make critical event subroutines
}
let s = '';
s += this.dialect.comment(`start action ${sys.name} ${inst.id} ${event}`); // TODO
if (action.critical) {
// TODO: bin-packing, share identical code
let sublabel = `${codeeval.label}__sub`;
let lines = [
this.dialect.segment('rodata'),
this.dialect.label(sublabel),
codeeval.codeToString(),
this.dialect.return(),
this.dialect.code(),
this.dialect.call(sublabel)
];
s += lines.join('\n');
} else {
s += codeeval.codeToString();
}
s += eventcode;
s += this.dialect.comment(`end action ${sys.name} ${inst.id} ${event}`);
code += s;
// TODO: check that this happens once?
@ -1378,6 +1409,8 @@ export class EntityScope implements SourceLocated {
this.allocateROData(this.rodata);
}
private generateCode() {
this.eventSeq = 0;
this.eventStats = {};
let isMainScope = this.parent == null;
let start;
let initsys = this.em.getSystemByName('Init');
@ -1387,6 +1420,7 @@ export class EntityScope implements SourceLocated {
} else {
start = this.generateCodeForEvent('start');
}
start = this.replaceSubroutines(start);
this.code.addCodeFragment(start);
for (let sub of Array.from(this.resources.values())) {
if (!this.getSystemInstanceNamed(sub)) {
@ -1395,10 +1429,40 @@ export class EntityScope implements SourceLocated {
this.newSystemInstanceWithDefaults(sys);
}
let code = this.generateCodeForEvent(sub, [], sub);
this.code.addCodeFragment(code);
this.code.addCodeFragment(code); // TODO: should be rodata?
}
//this.showStats();
}
replaceSubroutines(code: string) {
// TODO: bin-packing for critical code
let allsubs : string[] = [];
for (let stats of Object.values(this.eventStats)) {
if (stats.count > 1) {
if (allsubs.length == 0) {
allsubs = [
this.dialect.segment('rodata'),
this.dialect.alignSegmentStart()
]
} else if (stats.action.fitbytes) {
allsubs.push(this.dialect.alignIfLessThan(stats.action.fitbytes));
}
code = (code as any).replaceAll(stats.code, this.dialect.call(stats.symbol));
let substart = stats.symbol;
let sublines = [
this.dialect.segment('rodata'),
this.dialect.label(substart),
stats.code,
this.dialect.return(),
];
if (stats.action.fitbytes) {
sublines.push(this.dialect.warningIfMoreThan(stats.action.fitbytes, substart));
}
allsubs = allsubs.concat(sublines);
}
}
code += allsubs.join('\n');
return code;
}
showStats() {
for (let inst of this.instances) {
// TODO?

View File

@ -7,8 +7,6 @@ Xpos_x_b0:
.res 1
.code
__Start:
.code
;;; start action move 1 start

View File

@ -48,8 +48,6 @@ Main__INITDATA:
.byte 36
.byte 86
__Start:
.code
;;; start action Init 9 main_init
@ -67,16 +65,12 @@ __BRK:
dey
bne :-
; initialize data segment
.code
;;; start action FrameLoop 1 start
FrameLoop__start__2__NextFrame:
FRAME_START
.code
;;; start action Kernel6Digit 2 preframe
Digit0 = Kernel6Digit__2__tmp+0
@ -128,9 +122,7 @@ Kernel6Digit__preframe__3__Loop:
;;; end action Kernel6Digit 2 preframe
KERNEL_START
.code
;;; start action Kernel6Digit 2 kernel
lda PFColor_pfcolor_b0
@ -222,9 +214,7 @@ Kernel6Digit__kernel__5__BigLoop:
Kernel2Digit__kernel__7__Loop:
ldx #0
sta WSYNC
.code
;;; start action Kernel2Digit 4 compute2digit
lda Kernel2Digit__4__tmp+1 ; load 1st pf
@ -236,9 +226,7 @@ Kernel2Digit__kernel__7__Loop:
asl
asl
asl
.code
;;; start action Kernel2Digit 4 fetchdigit
adc Kernel2Digit__4__tmp+0
@ -256,9 +244,7 @@ Kernel2Digit__kernel__7__Loop:
and #$f0
lsr
sty PF1 ; store 2nd pf
.code
;;; start action Kernel2Digit 4 fetchdigit
adc Kernel2Digit__4__tmp+0
@ -275,9 +261,7 @@ Kernel2Digit__kernel__7__Loop:
;;; end action Kernel2Digit 4 compute2digit
inx
.code
;;; start action Kernel2Digit 4 compute2digit
lda Kernel2Digit__4__tmp+1 ; load 1st pf
@ -289,9 +273,7 @@ Kernel2Digit__kernel__7__Loop:
asl
asl
asl
.code
;;; start action Kernel2Digit 4 fetchdigit
adc Kernel2Digit__4__tmp+0
@ -309,9 +291,7 @@ Kernel2Digit__kernel__7__Loop:
and #$f0
lsr
sty PF1 ; store 2nd pf
.code
;;; start action Kernel2Digit 4 fetchdigit
adc Kernel2Digit__4__tmp+0
@ -336,21 +316,15 @@ Kernel2Digit__kernel__7__Loop:
;;; end action Kernel2Digit 4 kernel
KERNEL_END
.code
;;; start action JoyButton 6 postframe
lda INPT4 ;read button input
bmi JoyButton__postframe__14__NotPressed
.code
;;; start action IncScore 8 joybutton
.code
;;; start action BCDMath 7 AddBCD4
.ifnblank $0210
@ -382,9 +356,7 @@ JoyButton__postframe__14__NotPressed:
;;; end action JoyButton 6 postframe
FRAME_END
.code
jmp FrameLoop__start__2__NextFrame ; loop to next frame
;;; end action FrameLoop 1 start
@ -397,8 +369,6 @@ VecBRK: .word Main::__BRK
;;; end action Init 9 main_init
.code
FontTable:
;;; start action FontTable 3 FontTable
@ -413,8 +383,6 @@ FontTable:
;;; end action FontTable 3 FontTable
.code
FontTablePF:
;;; start action FontTablePF 5 FontTablePF

View File

@ -115,8 +115,6 @@ Main__INITDATA:
.byte 2
.byte 3
__Start:
.code
;;; start action Init 10 main_init
@ -134,16 +132,12 @@ __BRK:
dey
bne :-
; initialize data segment
.code
;;; start action FrameLoop 1 start
FrameLoop__start__2__NextFrame:
FRAME_START
.code
;;; start action Kernel2Sprite 2 preframe
.define KLINES #192
@ -256,9 +250,7 @@ SetXPos__preframe__9____each:
ldx SpriteSlot_sprite_b0,y
lda HasXpos_xpos_b0,x
.code
;;; start action SetHorizPos 7 SetHorizPos
; SetHorizPos routine
@ -300,9 +292,7 @@ SetXPos__preframe__9____exit:
;;; end action SetXPos 6 preframe
KERNEL_START
.code
;;; start action Kernel2Sprite 2 kernel
ldy #0
@ -316,9 +306,7 @@ SetXPos__preframe__9____exit:
ldy #192
Kernel2Sprite__kernel__14__LVScan:
.code
;;; start action Kernel2Sprite 2 scanline
; draw player 0
@ -354,9 +342,7 @@ Kernel2Sprite__scanline__15__DoDraw2:
;;; end action Kernel2Sprite 2 scanline
dey ; next scanline
.code
;;; start action Kernel2Sprite 2 scanline
; draw player 0
@ -407,9 +393,7 @@ Kernel2Sprite__scanline__17__DoDraw2:
;;; end action Kernel2Sprite 2 kernel
KERNEL_END
.code
;;; start action Joystick 3 postframe
; 2 control inputs share a single byte, 4 bits each
@ -425,9 +409,7 @@ Joystick__postframe__21____each:
asl Joystick__3__tmp+0
bcs Joystick__postframe__21__SkipMoveRight
.code
;;; start action MoveJoyX 4 joyright
lda HasXpos_xpos_b0,x
@ -443,9 +425,7 @@ MoveJoyX__joyright__22__nomove:
Joystick__postframe__21__SkipMoveRight:
asl Joystick__3__tmp+0
bcs Joystick__postframe__21__SkipMoveLeft
.code
;;; start action MoveJoyX 4 joyleft
lda HasXpos_xpos_b0,x
@ -460,9 +440,7 @@ MoveJoyX__joyleft__23__nomove:
Joystick__postframe__21__SkipMoveLeft:
asl Joystick__3__tmp+0
bcs Joystick__postframe__21__SkipMoveDown
.code
;;; start action MoveJoyY 5 joydown
lda HasYpos_ypos_b0,x
@ -478,9 +456,7 @@ MoveJoyY__joydown__24__nomove:
Joystick__postframe__21__SkipMoveDown:
asl Joystick__3__tmp+0
bcs Joystick__postframe__21__SkipMoveUp
.code
;;; start action MoveJoyY 5 joyup
lda HasYpos_ypos_b0,x
@ -559,9 +535,7 @@ SpriteHider__postframe__28____exit:
;;; end action SpriteHider 9 postframe
FRAME_END
.code
jmp FrameLoop__start__2__NextFrame ; loop to next frame
;;; end action FrameLoop 1 start

View File

@ -115,8 +115,6 @@ Main__INITDATA:
.byte 0
.byte 0
__Start:
.code
;;; start action Init 10 main_init
@ -134,16 +132,12 @@ __BRK:
dey
bne :-
; initialize data segment
.code
;;; start action FrameLoop 1 start
FrameLoop__start__2__NextFrame:
FRAME_START
.code
;;; start action Kernel2Sprite 2 preframe
.define KLINES #192
@ -241,9 +235,7 @@ SetXPos__preframe__9____each:
ldx SpriteSlot_sprite_b0,y
lda HasXpos_xpos_b0,x
.code
;;; start action SetHorizPos 7 SetHorizPos
; SetHorizPos routine
@ -285,9 +277,7 @@ SetXPos__preframe__9____exit:
;;; end action SetXPos 6 preframe
KERNEL_START
.code
;;; start action Kernel2Sprite 2 kernel
ldy #0
@ -332,18 +322,14 @@ DoDraw2:
ldy #192
Kernel2Sprite__kernel__14__LVScan:
.code
;;; start action Kernel2Sprite 2 scanline1
;;; end action Kernel2Sprite 2 scanline1
Kernel2Sprite__kernel__14__DrawLine 1 ; macro: draw scanline w/ WSYNC
dey ; next scanline
.code
Kernel2Sprite__kernel__14__DrawLine 0 ; macro: draw scanline no WSYNC
dey ; next scanline
bne Kernel2Sprite__kernel__14__LVScan ; repeat until out of lines
@ -361,9 +347,7 @@ Kernel2Sprite__kernel__14__LVScan:
;;; end action Kernel2Sprite 2 kernel
KERNEL_END
.code
;;; start action Joystick 3 postframe
; 2 control inputs share a single byte, 4 bits each
@ -379,9 +363,7 @@ Joystick__postframe__18____each:
asl Joystick__3__tmp+0
bcs Joystick__postframe__18__SkipMoveRight
.code
;;; start action MoveJoyX 4 joyright
lda HasXpos_xpos_b0,x
@ -397,9 +379,7 @@ MoveJoyX__joyright__19__nomove:
Joystick__postframe__18__SkipMoveRight:
asl Joystick__3__tmp+0
bcs Joystick__postframe__18__SkipMoveLeft
.code
;;; start action MoveJoyX 4 joyleft
lda HasXpos_xpos_b0,x
@ -414,9 +394,7 @@ MoveJoyX__joyleft__20__nomove:
Joystick__postframe__18__SkipMoveLeft:
asl Joystick__3__tmp+0
bcs Joystick__postframe__18__SkipMoveDown
.code
;;; start action MoveJoyY 5 joydown
lda HasYpos_ypos_b0,x
@ -432,9 +410,7 @@ MoveJoyY__joydown__21__nomove:
Joystick__postframe__18__SkipMoveDown:
asl Joystick__3__tmp+0
bcs Joystick__postframe__18__SkipMoveUp
.code
;;; start action MoveJoyY 5 joyup
lda HasYpos_ypos_b0,x
@ -513,9 +489,7 @@ SpriteHider__postframe__25____exit:
;;; end action SpriteHider 9 postframe
FRAME_END
.code
jmp FrameLoop__start__2__NextFrame ; loop to next frame
;;; end action FrameLoop 1 start

View File

@ -627,8 +627,6 @@ Main__INITDATA:
.byte 0
.byte 0
__Start:
.code
;;; start action Init 11 main_init
@ -646,16 +644,12 @@ __BRK:
dey
bne :-
; initialize data segment
.code
;;; start action FrameLoop 1 start
FrameLoop__start__2__NextFrame:
FRAME_START
.code
;;; start action Kernel2Sprite 2 preframe
.define KLINES #192
@ -768,9 +762,7 @@ SetXPos__preframe__9____each:
ldx SpriteSlot_sprite_b0,y
lda HasXpos_xpos_b0,x
.code
;;; start action SetHorizPos 9 SetHorizPos
; SetHorizPos routine
@ -824,9 +816,7 @@ SetXPos__preframe__9____exit:
;;; end action VersatilePlayfield 10 preframe
KERNEL_START
.code
;;; start action Kernel2Sprite 2 kernel
ldy #0
@ -840,9 +830,7 @@ SetXPos__preframe__9____exit:
ldy #192
Kernel2Sprite__kernel__15__LVScan:
.code
;;; start action Kernel2Sprite 2 scanline
; draw player 0
@ -896,9 +884,7 @@ Kernel2Sprite__scanline__16__DoDraw2:
;;; end action VersatilePlayfield 10 scanline
dey ; next scanline
.code
;;; start action Kernel2Sprite 2 scanline
; draw player 0
@ -967,9 +953,7 @@ Kernel2Sprite__scanline__20__DoDraw2:
;;; end action Kernel2Sprite 2 kernel
KERNEL_END
.code
;;; start action Joystick 3 postframe
; 2 control inputs share a single byte, 4 bits each
@ -982,9 +966,7 @@ Kernel2Sprite__scanline__20__DoDraw2:
asl Joystick__3__tmp+0
bcs Joystick__postframe__26__SkipMoveRight
.code
;;; start action JoyFaceDirection 4 joyright
lda Sprite_plyrflags_b0
@ -1000,9 +982,7 @@ Kernel2Sprite__scanline__20__DoDraw2:
adc #2
cmp #142
jcc SuperFly__joyright__28__nomove
.code
;;; start action SuperFly 5 goeast
ldy Location_room_b0
@ -1020,9 +1000,7 @@ SuperFly__joyright__28__nomove:
Joystick__postframe__26__SkipMoveRight:
asl Joystick__3__tmp+0
bcs Joystick__postframe__26__SkipMoveLeft
.code
;;; start action JoyFaceDirection 4 joyleft
lda Sprite_plyrflags_b0
@ -1037,9 +1015,7 @@ Joystick__postframe__26__SkipMoveRight:
sec
sbc #2
jcs SuperFly__joyleft__31__nomove
.code
;;; start action SuperFly 5 gowest
ldy Location_room_b0
@ -1057,9 +1033,7 @@ SuperFly__joyleft__31__nomove:
Joystick__postframe__26__SkipMoveLeft:
asl Joystick__3__tmp+0
bcs Joystick__postframe__26__SkipMoveDown
.code
;;; start action SuperFly 5 joydown
lda HasYpos_ypos_b0
@ -1067,9 +1041,7 @@ Joystick__postframe__26__SkipMoveLeft:
adc #2
cmp #220
jcc SuperFly__joydown__33__nomove
.code
;;; start action SuperFly 5 gosouth
ldy Location_room_b0
@ -1087,18 +1059,14 @@ SuperFly__joydown__33__nomove:
Joystick__postframe__26__SkipMoveDown:
asl Joystick__3__tmp+0
bcs Joystick__postframe__26__SkipMoveUp
.code
;;; start action SuperFly 5 joyup
lda HasYpos_ypos_b0
sec
sbc #2
jcs SuperFly__joyup__35__nomove
.code
;;; start action SuperFly 5 gonorth
ldy Location_room_b0
@ -1122,9 +1090,7 @@ Joystick__postframe__26__SkipMoveUp:
ldx #0
BadMove__postframe__37____each:
.code
;;; start action JoyFaceDirection 4 joyright
lda Sprite_plyrflags_b0+1,x
@ -1140,9 +1106,7 @@ BadMove__postframe__37____each:
adc #1
cmp #142
jcc SuperFly__joyright__39__nomove
.code
;;; start action SuperFly 5 goeast
ldy Location_room_b0+1,x
@ -1199,9 +1163,7 @@ RoomShuffle__postframe__41__exit:
;;; end action VersatilePlayfield 10 postframe
FRAME_END
.code
jmp FrameLoop__start__2__NextFrame ; loop to next frame
;;; end action FrameLoop 1 start

View File

@ -142,8 +142,6 @@ Bitmap48_bitmap5_e2_b0:
Bitmap48_height_b0:
.byte 14
__Start:
.code
;;; start action Init 4 main_init
@ -155,21 +153,15 @@ __Reset:
__BRK:
CLEAN_START
; initialize data segment
.code
;;; start action FrameLoop 1 start
FrameLoop__start__2__NextFrame:
FRAME_START
.code
;;; start action StaticKernel 3 preframe
.code
;;; start action Kernel48Pixel 2 kernelsetup
;;; end action Kernel48Pixel 2 kernelsetup
@ -197,18 +189,14 @@ FrameLoop__start__2__NextFrame:
;;; end action StaticKernel 3 preframe
KERNEL_START
.code
;;; start action StaticKernel 3 kernel
ldx #0
StaticKernel__kernel__9____each:
sta WSYNC
.code
;;; start action Kernel48Pixel 2 kernelsetup
cpx #2+1
@ -292,9 +280,7 @@ StaticKernel__kernelsetup__13____skipxhi:
;;; end action StaticKernel 3 kernelsetup
.code
;;; start action Kernel48Pixel 2 kerneldraw
cpx #2+1
@ -355,13 +341,9 @@ StaticKernel__kernel__9____exit:
;;; end action StaticKernel 3 kernel
KERNEL_END
.code
FRAME_END
.code
jmp FrameLoop__start__2__NextFrame ; loop to next frame
;;; end action FrameLoop 1 start

View File

@ -44,8 +44,6 @@ Main__INITDATA:
.byte 0
.byte 0
__Start:
.code
;;; start action Init 7 main_init
@ -62,21 +60,15 @@ __BRK:
dey
bne :-
; initialize data segment
.code
;;; start action FrameLoop 1 start
FrameLoop__start__2__NextFrame:
FRAME_START
.code
;;; start action StaticKernel 4 preframe
.code
;;; start action StaticKernel 4 kernelsetup
lda #24
@ -96,18 +88,14 @@ FrameLoop__start__2__NextFrame:
;;; end action StaticKernel 4 preframe
KERNEL_START
.code
;;; start action StaticKernel 4 kernel
ldx #0
StaticKernel__kernel__7____each:
sta WSYNC
.code
;;; start action StaticKernel 4 kernelsetup
lda BGColor_bgcolor_b0,x
@ -164,16 +152,12 @@ StaticKernel__kernel__7____exit:
;;; end action StaticKernel 4 kernel
KERNEL_END
.code
;;; start action JoyButton 5 postframe
lda INPT4 ;read button input
bmi JoyButton__postframe__11__NotPressed
.code
;;; start action Local 6 joybutton
inc Local__6__tmp+0
@ -186,16 +170,12 @@ JoyButton__postframe__11__NotPressed:
;;; end action JoyButton 5 postframe
FRAME_END
.code
;;; start action ResetSwitch 2 nextframe
lsr SWCHB ; test Game Reset switch
bcs ResetSwitch__nextframe__13__NoStart
.code
;;; start action ResetConsole 3 resetswitch
jmp Main::__Reset ; jump to Reset handler

View File

@ -44,8 +44,6 @@ Main__INITDATA:
.byte 0
.byte 0
__Start:
.code
;;; start action Init 7 main_init
@ -63,21 +61,15 @@ __BRK:
dey
bne :-
; initialize data segment
.code
;;; start action FrameLoop 1 start
FrameLoop__start__2__NextFrame:
FRAME_START
.code
;;; start action StaticKernel 4 preframe
.code
;;; start action StaticKernel 4 kernelsetup
lda #24
@ -97,18 +89,14 @@ FrameLoop__start__2__NextFrame:
;;; end action StaticKernel 4 preframe
KERNEL_START
.code
;;; start action StaticKernel 4 kernel
ldx #0
StaticKernel__kernel__7____each:
sta WSYNC
.code
;;; start action StaticKernel 4 kernelsetup
lda BGColor_bgcolor_b0,x
@ -149,9 +137,7 @@ StaticKernel__kernelsetup__10____skipxlo:
;;; end action StaticKernel 4 kernelsetup
.code
;;; start action StaticKernel 4 kerneldraw
ldy KernelSection_lines_b0,x
@ -173,16 +159,12 @@ StaticKernel__kernel__7____exit:
;;; end action StaticKernel 4 kernel
KERNEL_END
.code
;;; start action JoyButton 5 postframe
lda INPT4 ;read button input
bmi JoyButton__postframe__12__NotPressed
.code
;;; start action Local 6 joybutton
inc Local__6__tmp+0
@ -195,16 +177,12 @@ JoyButton__postframe__12__NotPressed:
;;; end action JoyButton 5 postframe
FRAME_END
.code
;;; start action ResetSwitch 2 nextframe
lsr SWCHB ; test Game Reset switch
bcs ResetSwitch__nextframe__14__NoStart
.code
;;; start action ResetConsole 3 resetswitch
jmp Main::__Reset ; jump to Reset handler