From 6f3affaaef16c460ffe1e465e6f7c19bca076b9e Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sun, 27 Feb 2022 09:31:09 -0600 Subject: [PATCH] ecs: nested labels --- src/common/ecs/ecs.ts | 18 +-- test/ecs/narrow1.txt | 6 +- test/ecs/score.txt | 118 +++++++++---------- test/ecs/sprites.txt | 204 ++++++++++++++++---------------- test/ecs/sprites1.txt | 178 ++++++++++++++-------------- test/ecs/superman.txt | 266 +++++++++++++++++++++--------------------- test/ecs/titles.txt | 248 +++++++++++++++++++-------------------- test/ecs/vcs1.txt | 86 +++++++------- test/ecs/vcslib.txt | 90 +++++++------- 9 files changed, 607 insertions(+), 607 deletions(-) diff --git a/src/common/ecs/ecs.ts b/src/common/ecs/ecs.ts index 6e8a7e18..e60e91bf 100644 --- a/src/common/ecs/ecs.ts +++ b/src/common/ecs/ecs.ts @@ -765,8 +765,10 @@ class ActionEval { }); return code; } - private replaceLabels(code: string, label: string) { + private replaceLabels(code: string) { const label_re = /@(\w+)\b/g; + let seq = this.em.seq++; + let label = `${this.instance.system.name}__${this.action.event}__${seq}`; code = code.replace(label_re, (s: string, a: string) => `${label}__${a}`); return code; } @@ -992,7 +994,7 @@ class ActionEval { evalInlineCode(code: string) { let props = this.scope.state.props || {}; // replace @labels - code = this.replaceLabels(code, this.label); + code = this.replaceLabels(code); // replace {{...}} tags // TODO: use nodes instead code = this.replaceTags(code, this.action, props); @@ -1046,7 +1048,6 @@ class ActionEval { } else if (instance.params.query) { qr = qr.intersection(new EntitySet(scope, instance.params.query)); } - let entities = qr.entities; // TODO: generalize to other cpus/langs switch (select) { case 'once': @@ -1074,13 +1075,13 @@ class ActionEval { state.xreg = state.xreg.narrow(qr, action); if (state.xreg == null || state.xreg.eset?.entities == null) { if (select == 'if') { - entities = []; - break; // "if" failed + qr.entities = []; // "if" failed } else { throw new ECSError(`no entities in statement`, action); } } else { - entities = state.xreg.eset.entities; // TODO? + // TODO: must be a better way... + qr.entities = state.xreg.eset.entities; } } else if (select == 'with') { if (instance.params.refEntity && instance.params.refField) { @@ -1096,6 +1097,7 @@ class ActionEval { break; } // + let entities = qr.entities; let code = '%%CODE%%'; let props: { [name: string]: string } = {}; // TODO: detect cycles @@ -1155,7 +1157,6 @@ class ActionEval { props['%xofs'] = (this.scope.state.xreg?.offset() || 0).toString(); props['%yofs'] = (this.scope.state.yreg?.offset() || 0).toString(); let working = jr ? jr.union(qr) : qr; - working.entities = entities; // TODO? not good... //console.log('working', action.event, working.entities.length, entities.length); return { working, oldState, props, code }; } @@ -1581,7 +1582,7 @@ export class EntityScope implements SourceLocated { } normalizeCode(code: string, action: Action) { // TODO: use dialect to help with this - code = code.replace(/(\w+__\w+__)(\d+)(\w+)/g, (z,a,b,c) => a+c); + code = code.replace(/\b(\w+__\w+__)(\d+)__(\w+)\b/g, (z,a,b,c) => a+c); return code; } getSystemStats(inst: SystemInstance) : SystemStats { @@ -1687,7 +1688,6 @@ export class EntityScope implements SourceLocated { } let subcall = this.dialect.call(stats.labels[0]); for (let label of stats.labels) { - // TODO: need to trim()? let startdelim = this.dialect.comment(`start action ${label}`).trim(); let enddelim = this.dialect.comment(`end action ${label}`).trim(); let istart = code.indexOf(startdelim); diff --git a/test/ecs/narrow1.txt b/test/ecs/narrow1.txt index b7f3c3c9..8a231b34 100644 --- a/test/ecs/narrow1.txt +++ b/test/ecs/narrow1.txt @@ -23,14 +23,14 @@ __Start: ;;; start action move__start__1 ldx #0 -move__start__1____each: +move__start__2____each: lda Xpos_x_b0+2,x inx cpx #2 - jne move__start__1____each -move__start__1____exit: + jne move__start__2____each +move__start__2____exit: ;;; end action move__start__1 diff --git a/test/ecs/score.txt b/test/ecs/score.txt index 3845e055..7ab5b81b 100644 --- a/test/ecs/score.txt +++ b/test/ecs/score.txt @@ -75,12 +75,12 @@ __BRK: dey bne :- -;;; start action FrameLoop__start__2 +;;; start action FrameLoop__start__3 -FrameLoop__start__2__NextFrame: +FrameLoop__start__4__NextFrame: FRAME_START -;;; start action Kernel6Digit__preframe__3 +;;; start action Kernel6Digit__preframe__5 Digit0 = Kernel6Digit__2__tmp+0 Digit1 = Kernel6Digit__2__tmp+2 @@ -88,20 +88,20 @@ Digit2 = Kernel6Digit__2__tmp+4 Digit3 = Kernel6Digit__2__tmp+6 Digit4 = Kernel6Digit__2__tmp+8 Digit5 = Kernel6Digit__2__tmp+10 -Kernel6Digit__preframe__3__BCD0 = Kernel6Digit__2__tmp+12 -Kernel6Digit__preframe__3__BCD1 = Kernel6Digit__2__tmp+13 -Kernel6Digit__preframe__3__BCD2 = Kernel6Digit__2__tmp+14 +Kernel6Digit__preframe__7__BCD0 = Kernel6Digit__2__tmp+12 +Kernel6Digit__preframe__7__BCD1 = Kernel6Digit__2__tmp+13 +Kernel6Digit__preframe__7__BCD2 = Kernel6Digit__2__tmp+14 lda BCDScore6_digits_b0 - sta Kernel6Digit__preframe__3__BCD0 + sta Kernel6Digit__preframe__7__BCD0 lda BCDScore6_digits_b8 - sta Kernel6Digit__preframe__3__BCD1 + sta Kernel6Digit__preframe__7__BCD1 lda BCDScore6_digits_b16 - sta Kernel6Digit__preframe__3__BCD2 + sta Kernel6Digit__preframe__7__BCD2 ldx #0 ; leftmost bitmap ldy #2 ; start from most-sigificant BCD value -Kernel6Digit__preframe__3__Loop: - lda Kernel6Digit__preframe__3__BCD0,y ; get BCD value +Kernel6Digit__preframe__7__Loop: + lda Kernel6Digit__preframe__7__BCD0,y ; get BCD value and #$f0 ; isolate high nibble (* 16) lsr ; shift right 1 bit (* 8) clc @@ -112,7 +112,7 @@ Kernel6Digit__preframe__3__Loop: sta Digit0+1,x ; store pointer hi byte inx inx ; next bitmap pointer - lda Kernel6Digit__preframe__3__BCD0,y ; get BCD value (again) + lda Kernel6Digit__preframe__7__BCD0,y ; get BCD value (again) and #$f ; isolate low nibble asl asl @@ -126,13 +126,13 @@ Kernel6Digit__preframe__3__Loop: inx inx ; next bitmap pointer dey ; next BCD value - bpl Kernel6Digit__preframe__3__Loop ; repeat until < 0 + bpl Kernel6Digit__preframe__7__Loop ; repeat until < 0 -;;; end action Kernel6Digit__preframe__3 +;;; end action Kernel6Digit__preframe__5 KERNEL_START -;;; start action Kernel6Digit__kernel__4 +;;; start action Kernel6Digit__kernel__8 lda PFColor_pfcolor_b0 sta COLUP0 @@ -156,23 +156,23 @@ Kernel6Digit__preframe__3__Loop: sta VDELP0 sta VDELP1 -;;; end action Kernel6Digit__kernel__4 +;;; end action Kernel6Digit__kernel__8 -;;; start action Kernel6Digit__kernel__5 +;;; start action Kernel6Digit__kernel__11 ; Display the resulting 48x8 bitmap ; using the Digit0-5 pointers. -Kernel6Digit__kernel__5__LoopCount = Kernel6Digit__2__tmp+12 -Kernel6Digit__kernel__5__Temp = Kernel6Digit__2__tmp+13 +Kernel6Digit__kernel__13__LoopCount = Kernel6Digit__2__tmp+12 +Kernel6Digit__kernel__13__Temp = Kernel6Digit__2__tmp+13 lda BGColor_bgcolor_b0 sta WSYNC sta COLUBK lda #7 - sta Kernel6Digit__kernel__5__LoopCount + sta Kernel6Digit__kernel__13__LoopCount SLEEPR 20 ; TODO? -Kernel6Digit__kernel__5__BigLoop: - ldy Kernel6Digit__kernel__5__LoopCount ; counts backwards +Kernel6Digit__kernel__13__BigLoop: + ldy Kernel6Digit__kernel__13__LoopCount ; counts backwards lda (Digit0),y ; load B0 (1st sprite byte) sta GRP0 ; B0 -> [GRP0] lda (Digit1),y ; load B1 -> A @@ -181,17 +181,17 @@ Kernel6Digit__kernel__5__BigLoop: lda (Digit2),y ; load B2 -> A sta GRP0 ; B2 -> [GRP0], B1 -> GRP1 lda (Digit5),y ; load B5 -> A - sta Kernel6Digit__kernel__5__Temp ; B5 -> temp + sta Kernel6Digit__kernel__13__Temp ; B5 -> temp lda (Digit4),y ; load B4 tax ; -> X lda (Digit3),y ; load B3 -> A - ldy Kernel6Digit__kernel__5__Temp ; load B5 -> Y + ldy Kernel6Digit__kernel__13__Temp ; load B5 -> Y sta GRP1 ; B3 -> [GRP1]; B2 -> GRP0 stx GRP0 ; B4 -> [GRP0]; B3 -> GRP1 sty GRP1 ; B5 -> [GRP1]; B4 -> GRP0 sta GRP0 ; ?? -> [GRP0]; B5 -> GRP1 - dec Kernel6Digit__kernel__5__LoopCount ; go to next line - bpl Kernel6Digit__kernel__5__BigLoop ; repeat until < 0 + dec Kernel6Digit__kernel__13__LoopCount ; go to next line + bpl Kernel6Digit__kernel__13__BigLoop ; repeat until < 0 lda #0 ; clear the sprite registers sta WSYNC @@ -201,9 +201,9 @@ Kernel6Digit__kernel__5__BigLoop: sta GRP1 sta COLUBK -;;; end action Kernel6Digit__kernel__5 +;;; end action Kernel6Digit__kernel__11 -;;; start action Kernel2Digit__kernel__6 +;;; start action Kernel2Digit__kernel__14 lda #$02 sta CTRLPF @@ -214,17 +214,17 @@ Kernel6Digit__kernel__5__BigLoop: lda PFColor_pfcolor_b0+1 sta COLUP1 -;;; end action Kernel2Digit__kernel__6 +;;; end action Kernel2Digit__kernel__14 -;;; start action Kernel2Digit__kernel__7 +;;; start action Kernel2Digit__kernel__17 lda #7 sta Kernel2Digit__4__tmp+0 -Kernel2Digit__kernel__7__Loop: +Kernel2Digit__kernel__19__Loop: ldx #0 sta WSYNC -;;; start action Kernel2Digit__compute2digit__8 +;;; start action Kernel2Digit__compute2digit__20 lda Kernel2Digit__4__tmp+1 ; load 1st pf sta PF1 ; store 1st pf @@ -236,14 +236,14 @@ Kernel2Digit__kernel__7__Loop: asl asl -;;; start action Kernel2Digit__fetchdigit__9 +;;; start action Kernel2Digit__fetchdigit__22 adc Kernel2Digit__4__tmp+0 tay ; TODO: select your own? lda FontTablePF,y -;;; end action Kernel2Digit__fetchdigit__9 +;;; end action Kernel2Digit__fetchdigit__22 and #$0f ldy Kernel2Digit__4__tmp+2 ; load 2nd pf @@ -254,24 +254,24 @@ Kernel2Digit__kernel__7__Loop: lsr sty PF1 ; store 2nd pf -;;; start action Kernel2Digit__fetchdigit__10 +;;; start action Kernel2Digit__fetchdigit__24 adc Kernel2Digit__4__tmp+0 tay ; TODO: select your own? lda FontTablePF,y -;;; end action Kernel2Digit__fetchdigit__10 +;;; end action Kernel2Digit__fetchdigit__24 and #$f0 ora Kernel2Digit__4__tmp+1 + 0 sta Kernel2Digit__4__tmp+1 + 0 -;;; end action Kernel2Digit__compute2digit__8 +;;; end action Kernel2Digit__compute2digit__20 inx -;;; start action Kernel2Digit__compute2digit__11 +;;; start action Kernel2Digit__compute2digit__26 lda Kernel2Digit__4__tmp+1 ; load 1st pf sta PF1 ; store 1st pf @@ -283,14 +283,14 @@ Kernel2Digit__kernel__7__Loop: asl asl -;;; start action Kernel2Digit__fetchdigit__12 +;;; start action Kernel2Digit__fetchdigit__28 adc Kernel2Digit__4__tmp+0 tay ; TODO: select your own? lda FontTablePF,y -;;; end action Kernel2Digit__fetchdigit__12 +;;; end action Kernel2Digit__fetchdigit__28 and #$0f ldy Kernel2Digit__4__tmp+2 ; load 2nd pf @@ -301,40 +301,40 @@ Kernel2Digit__kernel__7__Loop: lsr sty PF1 ; store 2nd pf -;;; start action Kernel2Digit__fetchdigit__13 +;;; start action Kernel2Digit__fetchdigit__30 adc Kernel2Digit__4__tmp+0 tay ; TODO: select your own? lda FontTablePF,y -;;; end action Kernel2Digit__fetchdigit__13 +;;; end action Kernel2Digit__fetchdigit__30 and #$f0 ora Kernel2Digit__4__tmp+1 + 1 sta Kernel2Digit__4__tmp+1 + 1 -;;; end action Kernel2Digit__compute2digit__11 +;;; end action Kernel2Digit__compute2digit__26 ; playfield dec Kernel2Digit__4__tmp+0 - bpl Kernel2Digit__kernel__7__Loop + bpl Kernel2Digit__kernel__19__Loop ; dex ; stx PF1 -;;; end action Kernel2Digit__kernel__7 +;;; end action Kernel2Digit__kernel__17 KERNEL_END -;;; start action JoyButton__postframe__14 +;;; start action JoyButton__postframe__32 lda INPT4 ;read button input - bmi JoyButton__postframe__14__NotPressed + bmi JoyButton__postframe__34__NotPressed -;;; start action IncScore__joybutton__15 +;;; start action IncScore__joybutton__35 -;;; start action BCDMath__AddBCD4__16 +;;; start action BCDMath__AddBCD4__38 .ifnblank $0210 lda #<$0210 @@ -355,20 +355,20 @@ Kernel2Digit__kernel__7__Loop: sta BCDScore6_digits_b16 cld ; exit BCD mode -;;; end action BCDMath__AddBCD4__16 +;;; end action BCDMath__AddBCD4__38 -;;; end action IncScore__joybutton__15 +;;; end action IncScore__joybutton__35 -JoyButton__postframe__14__NotPressed: +JoyButton__postframe__34__NotPressed: -;;; end action JoyButton__postframe__14 +;;; end action JoyButton__postframe__32 FRAME_END - jmp FrameLoop__start__2__NextFrame ; loop to next frame + jmp FrameLoop__start__4__NextFrame ; loop to next frame -;;; end action FrameLoop__start__2 +;;; end action FrameLoop__start__3 ; start main routine .segment "VECTORS" Return: .word $6060 @@ -380,7 +380,7 @@ VecBRK: .word Main::__BRK FontTable: -;;; start action FontTable__FontTable__17 +;;; start action FontTable__FontTable__41 ; Font table for digits 0-9 (8x8 pixels) ;;{w:8,h:8,count:10,brev:1,flip:1};; @@ -390,11 +390,11 @@ FontTable: .byte $00,$3c,$66,$66,$7c,$60,$66,$3c,$00,$18,$18,$18,$18,$0c,$66,$7e .byte $00,$3c,$66,$66,$3c,$66,$66,$3c,$00,$3c,$66,$06,$3e,$66,$66,$3c -;;; end action FontTable__FontTable__17 +;;; end action FontTable__FontTable__41 FontTablePF: -;;; start action FontTablePF__FontTablePF__18 +;;; start action FontTablePF__FontTablePF__43 ; Font table for digits 0-9 (4x8 pixels) ;;{w:8,h:8,count:10,brev:1,flip:1};; @@ -410,7 +410,7 @@ FontTablePF: .byte $00,$00,$EE,$22,$EE,$AA,$EE,$00 ;; -;;; end action FontTablePF__FontTablePF__18 +;;; end action FontTablePF__FontTablePF__43 .endscope Main__Start = Main::__Start \ No newline at end of file diff --git a/test/ecs/sprites.txt b/test/ecs/sprites.txt index a3c56bc9..b02aedb7 100644 --- a/test/ecs/sprites.txt +++ b/test/ecs/sprites.txt @@ -142,12 +142,12 @@ __BRK: dey bne :- -;;; start action FrameLoop__start__2 +;;; start action FrameLoop__start__3 -FrameLoop__start__2__NextFrame: +FrameLoop__start__4__NextFrame: FRAME_START -;;; start action Kernel2Sprite__preframe__3 +;;; start action Kernel2Sprite__preframe__5 .define KLINES #192 .define KPAD 32 @@ -162,17 +162,17 @@ FrameLoop__start__2__NextFrame: sta Kernel2Sprite__2__tmp+6 sta Kernel2Sprite__2__tmp+7 -;;; end action Kernel2Sprite__preframe__3 +;;; end action Kernel2Sprite__preframe__5 -;;; start action Kernel2Sprite__preframe__4 +;;; start action Kernel2Sprite__preframe__8 ldy #0 -Kernel2Sprite__preframe__4____each: +Kernel2Sprite__preframe__9____each: ldx SpriteSlot_sprite_b0,y ; flags set according to sprite slot value ; skip sprite if negative - jmi Kernel2Sprite__preframe__4__nosprite + jmi Kernel2Sprite__preframe__10__nosprite ; set player object flags lda Sprite_plyrflags_b0,x sta NUSIZ0,y @@ -211,16 +211,16 @@ Kernel2Sprite__preframe__4____each: ldx Kernel2Sprite__2__tmp+12 ; restore X lda HasYpos_ypos_b0,x sta Kernel2Sprite__2__tmp+10,y -Kernel2Sprite__preframe__4__nosprite: +Kernel2Sprite__preframe__10__nosprite: iny cpy #2 - jne Kernel2Sprite__preframe__4____each -Kernel2Sprite__preframe__4____exit: + jne Kernel2Sprite__preframe__9____each +Kernel2Sprite__preframe__9____exit: -;;; end action Kernel2Sprite__preframe__4 +;;; end action Kernel2Sprite__preframe__8 -;;; start action Kernel2Sprite__preframe__5 +;;; start action Kernel2Sprite__preframe__11 ; shuffle pointers into (MSB, LSB) byte order ; L0 L1 H0 H1 -> L0 H0 L1 H1 @@ -233,34 +233,34 @@ Kernel2Sprite__preframe__4____exit: sty Kernel2Sprite__2__tmp+5 sta Kernel2Sprite__2__tmp+6 -;;; end action Kernel2Sprite__preframe__5 +;;; end action Kernel2Sprite__preframe__11 -;;; start action Kernel2Sprite__preframe__6 +;;; start action Kernel2Sprite__preframe__13 lda #162 sta COLUBK -;;; end action Kernel2Sprite__preframe__6 +;;; end action Kernel2Sprite__preframe__13 -;;; start action Kernel2Sprite__preframe__7 +;;; start action Kernel2Sprite__preframe__16 -;;; end action Kernel2Sprite__preframe__7 +;;; end action Kernel2Sprite__preframe__16 -;;; start action SetXPos__preframe__8 +;;; start action SetXPos__preframe__17 sta HMCLR -;;; end action SetXPos__preframe__8 +;;; end action SetXPos__preframe__17 -;;; start action SetXPos__preframe__9 +;;; start action SetXPos__preframe__19 ldy #0 -SetXPos__preframe__9____each: +SetXPos__preframe__20____each: ldx SpriteSlot_sprite_b0,y lda HasXpos_xpos_b0,x -;;; start action SetHorizPos__SetHorizPos__10 +;;; start action SetHorizPos__SetHorizPos__22 ; SetHorizPos routine ; A = X coordinate @@ -268,9 +268,9 @@ SetXPos__preframe__9____each: sta WSYNC ; start a new line sec ; set carry flag nop -SetHorizPos__SetHorizPos__10__DivideLoop: +SetHorizPos__SetHorizPos__23__DivideLoop: sbc #15 ; subtract 15 - bcs SetHorizPos__SetHorizPos__10__DivideLoop ; branch until negative + bcs SetHorizPos__SetHorizPos__23__DivideLoop ; branch until negative eor #7 ; calculate fine offset asl asl @@ -279,52 +279,52 @@ SetHorizPos__SetHorizPos__10__DivideLoop: sta RESP0,y ; fix coarse position sta HMP0,y ; set fine offset -;;; end action SetHorizPos__SetHorizPos__10 +;;; end action SetHorizPos__SetHorizPos__22 iny cpy #2 - jne SetXPos__preframe__9____each -SetXPos__preframe__9____exit: + jne SetXPos__preframe__20____each +SetXPos__preframe__20____exit: -;;; end action SetXPos__preframe__9 +;;; end action SetXPos__preframe__19 -;;; start action SetXPos__preframe__11 +;;; start action SetXPos__preframe__24 -;;; end action SetXPos__preframe__11 +;;; end action SetXPos__preframe__24 -;;; start action SetXPos__preframe__12 +;;; start action SetXPos__preframe__25 sta WSYNC sta HMOVE -;;; end action SetXPos__preframe__12 +;;; end action SetXPos__preframe__25 KERNEL_START -;;; start action Kernel2Sprite__kernel__13 +;;; start action Kernel2Sprite__kernel__27 ldy #0 sty VDELP0 iny sta VDELP1 -;;; end action Kernel2Sprite__kernel__13 +;;; end action Kernel2Sprite__kernel__27 -;;; start action Kernel2Sprite__kernel__14 +;;; start action Kernel2Sprite__kernel__30 ldy #192 -Kernel2Sprite__kernel__14__LVScan: +Kernel2Sprite__kernel__32__LVScan: -;;; start action Kernel2Sprite__scanline__15 +;;; start action Kernel2Sprite__scanline__33 ; draw player 0 lda Kernel2Sprite__2__tmp+8 ; height dcp Kernel2Sprite__2__tmp+10 ; ypos - bcs Kernel2Sprite__scanline__15__DoDraw1 + bcs Kernel2Sprite__scanline__34__DoDraw1 lda #0 .byte $2C -Kernel2Sprite__scanline__15__DoDraw1: +Kernel2Sprite__scanline__34__DoDraw1: lda (Kernel2Sprite__2__tmp+0),y .if 0 = 0 sta WSYNC @@ -335,32 +335,32 @@ Kernel2Sprite__scanline__15__DoDraw1: ; draw player 1 lda Kernel2Sprite__2__tmp+9 ; height dcp Kernel2Sprite__2__tmp+11 ; ypos - bcs Kernel2Sprite__scanline__15__DoDraw2 + bcs Kernel2Sprite__scanline__34__DoDraw2 lda #0 .byte $2C -Kernel2Sprite__scanline__15__DoDraw2: +Kernel2Sprite__scanline__34__DoDraw2: lda (Kernel2Sprite__2__tmp+2),y sta GRP1 lda (Kernel2Sprite__2__tmp+6),y sta COLUP1 -;;; end action Kernel2Sprite__scanline__15 +;;; end action Kernel2Sprite__scanline__33 -;;; start action Kernel2Sprite__scanline__16 +;;; start action Kernel2Sprite__scanline__35 -;;; end action Kernel2Sprite__scanline__16 +;;; end action Kernel2Sprite__scanline__35 dey ; next scanline -;;; start action Kernel2Sprite__scanline__17 +;;; start action Kernel2Sprite__scanline__36 ; draw player 0 lda Kernel2Sprite__2__tmp+8 ; height dcp Kernel2Sprite__2__tmp+10 ; ypos - bcs Kernel2Sprite__scanline__17__DoDraw1 + bcs Kernel2Sprite__scanline__37__DoDraw1 lda #0 .byte $2C -Kernel2Sprite__scanline__17__DoDraw1: +Kernel2Sprite__scanline__37__DoDraw1: lda (Kernel2Sprite__2__tmp+0),y .if 1 = 0 sta WSYNC @@ -371,27 +371,27 @@ Kernel2Sprite__scanline__17__DoDraw1: ; draw player 1 lda Kernel2Sprite__2__tmp+9 ; height dcp Kernel2Sprite__2__tmp+11 ; ypos - bcs Kernel2Sprite__scanline__17__DoDraw2 + bcs Kernel2Sprite__scanline__37__DoDraw2 lda #0 .byte $2C -Kernel2Sprite__scanline__17__DoDraw2: +Kernel2Sprite__scanline__37__DoDraw2: lda (Kernel2Sprite__2__tmp+2),y sta GRP1 lda (Kernel2Sprite__2__tmp+6),y sta COLUP1 -;;; end action Kernel2Sprite__scanline__17 +;;; end action Kernel2Sprite__scanline__36 -;;; start action Kernel2Sprite__scanline__18 +;;; start action Kernel2Sprite__scanline__38 -;;; end action Kernel2Sprite__scanline__18 +;;; end action Kernel2Sprite__scanline__38 dey ; next scanline - bne Kernel2Sprite__kernel__14__LVScan ; repeat until out of lines + bne Kernel2Sprite__kernel__32__LVScan ; repeat until out of lines -;;; end action Kernel2Sprite__kernel__14 +;;; end action Kernel2Sprite__kernel__30 -;;; start action Kernel2Sprite__kernel__19 +;;; start action Kernel2Sprite__kernel__39 lda #0 sta GRP0 @@ -399,94 +399,94 @@ Kernel2Sprite__scanline__17__DoDraw2: sta GRP0 sta GRP1 -;;; end action Kernel2Sprite__kernel__19 +;;; end action Kernel2Sprite__kernel__39 KERNEL_END -;;; start action Joystick__postframe__20 +;;; start action Joystick__postframe__41 ; 2 control inputs share a single byte, 4 bits each lda SWCHA sta Joystick__3__tmp+0 -;;; end action Joystick__postframe__20 +;;; end action Joystick__postframe__41 -;;; start action Joystick__postframe__21 +;;; start action Joystick__postframe__43 ldx #0 -Joystick__postframe__21____each: +Joystick__postframe__44____each: asl Joystick__3__tmp+0 - bcs Joystick__postframe__21__SkipMoveRight + bcs Joystick__postframe__45__SkipMoveRight -;;; start action MoveJoyX__joyright__22 +;;; start action MoveJoyX__joyright__46 lda HasXpos_xpos_b0,x clc adc #1 cmp #152 - bcs MoveJoyX__joyright__22__nomove + bcs MoveJoyX__joyright__48__nomove sta HasXpos_xpos_b0,x -MoveJoyX__joyright__22__nomove: +MoveJoyX__joyright__48__nomove: -;;; end action MoveJoyX__joyright__22 +;;; end action MoveJoyX__joyright__46 -Joystick__postframe__21__SkipMoveRight: +Joystick__postframe__45__SkipMoveRight: asl Joystick__3__tmp+0 - bcs Joystick__postframe__21__SkipMoveLeft + bcs Joystick__postframe__45__SkipMoveLeft -;;; start action MoveJoyX__joyleft__23 +;;; start action MoveJoyX__joyleft__49 lda HasXpos_xpos_b0,x sec sbc #1 - bcc MoveJoyX__joyleft__23__nomove + bcc MoveJoyX__joyleft__51__nomove sta HasXpos_xpos_b0,x -MoveJoyX__joyleft__23__nomove: +MoveJoyX__joyleft__51__nomove: -;;; end action MoveJoyX__joyleft__23 +;;; end action MoveJoyX__joyleft__49 -Joystick__postframe__21__SkipMoveLeft: +Joystick__postframe__45__SkipMoveLeft: asl Joystick__3__tmp+0 - bcs Joystick__postframe__21__SkipMoveDown + bcs Joystick__postframe__45__SkipMoveDown -;;; start action MoveJoyY__joydown__24 +;;; start action MoveJoyY__joydown__52 lda HasYpos_ypos_b0,x clc adc #1 cmp #220 - bcs MoveJoyY__joydown__24__nomove + bcs MoveJoyY__joydown__54__nomove sta HasYpos_ypos_b0,x -MoveJoyY__joydown__24__nomove: +MoveJoyY__joydown__54__nomove: -;;; end action MoveJoyY__joydown__24 +;;; end action MoveJoyY__joydown__52 -Joystick__postframe__21__SkipMoveDown: +Joystick__postframe__45__SkipMoveDown: asl Joystick__3__tmp+0 - bcs Joystick__postframe__21__SkipMoveUp + bcs Joystick__postframe__45__SkipMoveUp -;;; start action MoveJoyY__joyup__25 +;;; start action MoveJoyY__joyup__55 lda HasYpos_ypos_b0,x sec sbc #1 - bcc MoveJoyY__joyup__25__nomove + bcc MoveJoyY__joyup__57__nomove sta HasYpos_ypos_b0,x -MoveJoyY__joyup__25__nomove: +MoveJoyY__joyup__57__nomove: -;;; end action MoveJoyY__joyup__25 +;;; end action MoveJoyY__joyup__55 -Joystick__postframe__21__SkipMoveUp: +Joystick__postframe__45__SkipMoveUp: inx cpx #4 - jne Joystick__postframe__21____each -Joystick__postframe__21____exit: + jne Joystick__postframe__44____each +Joystick__postframe__44____exit: -;;; end action Joystick__postframe__21 +;;; end action Joystick__postframe__43 -;;; start action SpriteShuffler__postframe__26 +;;; start action SpriteShuffler__postframe__58 ; load two sprite slots at left side of array lda SpriteSlot_sprite_b0 @@ -495,36 +495,36 @@ Joystick__postframe__21____exit: sta SpriteShuffler__8__tmp+1 ; move two slots to the left ldx #0 -SpriteShuffler__postframe__26__loop: +SpriteShuffler__postframe__60__loop: lda SpriteSlot_sprite_b0+2,x sta SpriteSlot_sprite_b0,x inx cpx #4-2 - bne SpriteShuffler__postframe__26__loop + bne SpriteShuffler__postframe__60__loop ; store two sprite slots at right side of array lda SpriteShuffler__8__tmp+0 sta SpriteSlot_sprite_b0+4-2 lda SpriteShuffler__8__tmp+1 sta SpriteSlot_sprite_b0+4-1 -;;; end action SpriteShuffler__postframe__26 +;;; end action SpriteShuffler__postframe__58 -;;; start action SpriteHider__postframe__27 +;;; start action SpriteHider__postframe__61 lda #4-1 sta SpriteHider__9__tmp+0 -;;; end action SpriteHider__postframe__27 +;;; end action SpriteHider__postframe__61 -;;; start action SpriteHider__postframe__28 +;;; start action SpriteHider__postframe__64 ldy #0 -SpriteHider__postframe__28____each: +SpriteHider__postframe__65____each: ldx SpriteSlot_sprite_b0,y lda HasYpos_ypos_b0,x cmp #192 - bcc SpriteHider__postframe__28__skip + bcc SpriteHider__postframe__66__skip ; swap this sprite slot with slot at end of array lda SpriteSlot_sprite_b0,y pha @@ -534,20 +534,20 @@ SpriteHider__postframe__28____each: pla sta SpriteSlot_sprite_b0,x dec SpriteHider__9__tmp+0 -SpriteHider__postframe__28__skip: +SpriteHider__postframe__66__skip: iny cpy #2 - jne SpriteHider__postframe__28____each -SpriteHider__postframe__28____exit: + jne SpriteHider__postframe__65____each +SpriteHider__postframe__65____exit: -;;; end action SpriteHider__postframe__28 +;;; end action SpriteHider__postframe__64 FRAME_END - jmp FrameLoop__start__2__NextFrame ; loop to next frame + jmp FrameLoop__start__4__NextFrame ; loop to next frame -;;; end action FrameLoop__start__2 +;;; end action FrameLoop__start__3 ; start main routine .segment "VECTORS" Return: .word $6060 diff --git a/test/ecs/sprites1.txt b/test/ecs/sprites1.txt index 80fdaf94..f32432b5 100644 --- a/test/ecs/sprites1.txt +++ b/test/ecs/sprites1.txt @@ -142,22 +142,22 @@ __BRK: dey bne :- -;;; start action FrameLoop__start__2 +;;; start action FrameLoop__start__3 -FrameLoop__start__2__NextFrame: +FrameLoop__start__4__NextFrame: FRAME_START -;;; start action Kernel2Sprite__preframe__3 +;;; start action Kernel2Sprite__preframe__5 .define KLINES #192 .define KPAD 32 -;;; end action Kernel2Sprite__preframe__3 +;;; end action Kernel2Sprite__preframe__5 -;;; start action Kernel2Sprite__preframe__4 +;;; start action Kernel2Sprite__preframe__8 ldy #0 -Kernel2Sprite__preframe__4____each: +Kernel2Sprite__preframe__9____each: ldx SpriteSlot_sprite_b0,y ; set player object flags @@ -201,12 +201,12 @@ Kernel2Sprite__preframe__4____each: iny cpy #2 - jne Kernel2Sprite__preframe__4____each -Kernel2Sprite__preframe__4____exit: + jne Kernel2Sprite__preframe__9____each +Kernel2Sprite__preframe__9____exit: -;;; end action Kernel2Sprite__preframe__4 +;;; end action Kernel2Sprite__preframe__8 -;;; start action Kernel2Sprite__preframe__5 +;;; start action Kernel2Sprite__preframe__11 ; L0 L1 H0 H1 -> L0 H0 L1 H1 lda Kernel2Sprite__2__tmp+1 @@ -218,34 +218,34 @@ Kernel2Sprite__preframe__4____exit: sty Kernel2Sprite__2__tmp+5 sta Kernel2Sprite__2__tmp+6 -;;; end action Kernel2Sprite__preframe__5 +;;; end action Kernel2Sprite__preframe__11 -;;; start action Kernel2Sprite__preframe__6 +;;; start action Kernel2Sprite__preframe__13 lda #162 sta COLUBK -;;; end action Kernel2Sprite__preframe__6 +;;; end action Kernel2Sprite__preframe__13 -;;; start action Kernel2Sprite__preframe__7 +;;; start action Kernel2Sprite__preframe__16 -;;; end action Kernel2Sprite__preframe__7 +;;; end action Kernel2Sprite__preframe__16 -;;; start action SetXPos__preframe__8 +;;; start action SetXPos__preframe__17 sta HMCLR -;;; end action SetXPos__preframe__8 +;;; end action SetXPos__preframe__17 -;;; start action SetXPos__preframe__9 +;;; start action SetXPos__preframe__19 ldy #0 -SetXPos__preframe__9____each: +SetXPos__preframe__20____each: ldx SpriteSlot_sprite_b0,y lda HasXpos_xpos_b0,x -;;; start action SetHorizPos__SetHorizPos__10 +;;; start action SetHorizPos__SetHorizPos__22 ; SetHorizPos routine ; A = X coordinate @@ -253,9 +253,9 @@ SetXPos__preframe__9____each: sta WSYNC ; start a new line sec ; set carry flag nop -SetHorizPos__SetHorizPos__10__DivideLoop: +SetHorizPos__SetHorizPos__23__DivideLoop: sbc #15 ; subtract 15 - bcs SetHorizPos__SetHorizPos__10__DivideLoop ; branch until negative + bcs SetHorizPos__SetHorizPos__23__DivideLoop ; branch until negative eor #7 ; calculate fine offset asl asl @@ -264,42 +264,42 @@ SetHorizPos__SetHorizPos__10__DivideLoop: sta RESP0,y ; fix coarse position sta HMP0,y ; set fine offset -;;; end action SetHorizPos__SetHorizPos__10 +;;; end action SetHorizPos__SetHorizPos__22 iny cpy #2 - jne SetXPos__preframe__9____each -SetXPos__preframe__9____exit: + jne SetXPos__preframe__20____each +SetXPos__preframe__20____exit: -;;; end action SetXPos__preframe__9 +;;; end action SetXPos__preframe__19 -;;; start action SetXPos__preframe__11 +;;; start action SetXPos__preframe__24 -;;; end action SetXPos__preframe__11 +;;; end action SetXPos__preframe__24 -;;; start action SetXPos__preframe__12 +;;; start action SetXPos__preframe__25 sta WSYNC sta HMOVE -;;; end action SetXPos__preframe__12 +;;; end action SetXPos__preframe__25 KERNEL_START -;;; start action Kernel2Sprite__kernel__13 +;;; start action Kernel2Sprite__kernel__27 ldy #0 sty VDELP0 iny sta VDELP1 -;;; end action Kernel2Sprite__kernel__13 +;;; end action Kernel2Sprite__kernel__27 -;;; start action Kernel2Sprite__kernel__14 +;;; start action Kernel2Sprite__kernel__30 ; define macro for each line - .macro Kernel2Sprite__kernel__14__DrawLine do_wsync + .macro Kernel2Sprite__kernel__32__DrawLine do_wsync .local DoDraw1 .local DoDraw2 ; draw player 0 @@ -330,22 +330,22 @@ DoDraw2: .endmacro ldy #192 -Kernel2Sprite__kernel__14__LVScan: +Kernel2Sprite__kernel__32__LVScan: -;;; start action Kernel2Sprite__scanline1__15 +;;; start action Kernel2Sprite__scanline1__33 -;;; end action Kernel2Sprite__scanline1__15 +;;; end action Kernel2Sprite__scanline1__33 - Kernel2Sprite__kernel__14__DrawLine 1 ; macro: draw scanline w/ WSYNC + Kernel2Sprite__kernel__32__DrawLine 1 ; macro: draw scanline w/ WSYNC dey ; next scanline - Kernel2Sprite__kernel__14__DrawLine 0 ; macro: draw scanline no WSYNC + Kernel2Sprite__kernel__32__DrawLine 0 ; macro: draw scanline no WSYNC dey ; next scanline - bne Kernel2Sprite__kernel__14__LVScan ; repeat until out of lines + bne Kernel2Sprite__kernel__32__LVScan ; repeat until out of lines -;;; end action Kernel2Sprite__kernel__14 +;;; end action Kernel2Sprite__kernel__30 -;;; start action Kernel2Sprite__kernel__16 +;;; start action Kernel2Sprite__kernel__34 lda #0 sta GRP0 @@ -353,94 +353,94 @@ Kernel2Sprite__kernel__14__LVScan: sta GRP0 sta GRP1 -;;; end action Kernel2Sprite__kernel__16 +;;; end action Kernel2Sprite__kernel__34 KERNEL_END -;;; start action Joystick__postframe__17 +;;; start action Joystick__postframe__37 ; 2 control inputs share a single byte, 4 bits each lda SWCHA sta Joystick__3__tmp+0 -;;; end action Joystick__postframe__17 +;;; end action Joystick__postframe__37 -;;; start action Joystick__postframe__18 +;;; start action Joystick__postframe__39 ldx #0 -Joystick__postframe__18____each: +Joystick__postframe__40____each: asl Joystick__3__tmp+0 - bcs Joystick__postframe__18__SkipMoveRight + bcs Joystick__postframe__41__SkipMoveRight -;;; start action MoveJoyX__joyright__19 +;;; start action MoveJoyX__joyright__42 lda HasXpos_xpos_b0,x clc adc #1 cmp #152 - bcs MoveJoyX__joyright__19__nomove + bcs MoveJoyX__joyright__44__nomove sta HasXpos_xpos_b0,x -MoveJoyX__joyright__19__nomove: +MoveJoyX__joyright__44__nomove: -;;; end action MoveJoyX__joyright__19 +;;; end action MoveJoyX__joyright__42 -Joystick__postframe__18__SkipMoveRight: +Joystick__postframe__41__SkipMoveRight: asl Joystick__3__tmp+0 - bcs Joystick__postframe__18__SkipMoveLeft + bcs Joystick__postframe__41__SkipMoveLeft -;;; start action MoveJoyX__joyleft__20 +;;; start action MoveJoyX__joyleft__45 lda HasXpos_xpos_b0,x sec sbc #1 - bcc MoveJoyX__joyleft__20__nomove + bcc MoveJoyX__joyleft__47__nomove sta HasXpos_xpos_b0,x -MoveJoyX__joyleft__20__nomove: +MoveJoyX__joyleft__47__nomove: -;;; end action MoveJoyX__joyleft__20 +;;; end action MoveJoyX__joyleft__45 -Joystick__postframe__18__SkipMoveLeft: +Joystick__postframe__41__SkipMoveLeft: asl Joystick__3__tmp+0 - bcs Joystick__postframe__18__SkipMoveDown + bcs Joystick__postframe__41__SkipMoveDown -;;; start action MoveJoyY__joydown__21 +;;; start action MoveJoyY__joydown__48 lda HasYpos_ypos_b0,x clc adc #1 cmp #220 - bcs MoveJoyY__joydown__21__nomove + bcs MoveJoyY__joydown__50__nomove sta HasYpos_ypos_b0,x -MoveJoyY__joydown__21__nomove: +MoveJoyY__joydown__50__nomove: -;;; end action MoveJoyY__joydown__21 +;;; end action MoveJoyY__joydown__48 -Joystick__postframe__18__SkipMoveDown: +Joystick__postframe__41__SkipMoveDown: asl Joystick__3__tmp+0 - bcs Joystick__postframe__18__SkipMoveUp + bcs Joystick__postframe__41__SkipMoveUp -;;; start action MoveJoyY__joyup__22 +;;; start action MoveJoyY__joyup__51 lda HasYpos_ypos_b0,x sec sbc #1 - bcc MoveJoyY__joyup__22__nomove + bcc MoveJoyY__joyup__53__nomove sta HasYpos_ypos_b0,x -MoveJoyY__joyup__22__nomove: +MoveJoyY__joyup__53__nomove: -;;; end action MoveJoyY__joyup__22 +;;; end action MoveJoyY__joyup__51 -Joystick__postframe__18__SkipMoveUp: +Joystick__postframe__41__SkipMoveUp: inx cpx #4 - jne Joystick__postframe__18____each -Joystick__postframe__18____exit: + jne Joystick__postframe__40____each +Joystick__postframe__40____exit: -;;; end action Joystick__postframe__18 +;;; end action Joystick__postframe__39 -;;; start action SpriteShuffler__postframe__23 +;;; start action SpriteShuffler__postframe__54 ; load two sprite slots at left side of array lda SpriteSlot_sprite_b0 @@ -449,36 +449,36 @@ Joystick__postframe__18____exit: sta SpriteShuffler__8__tmp+1 ; move two slots to the left ldx #0 -SpriteShuffler__postframe__23__loop: +SpriteShuffler__postframe__56__loop: lda SpriteSlot_sprite_b0+2,x sta SpriteSlot_sprite_b0,x inx cpx #4-2 - bne SpriteShuffler__postframe__23__loop + bne SpriteShuffler__postframe__56__loop ; store two sprite slots at right side of array lda SpriteShuffler__8__tmp+0 sta SpriteSlot_sprite_b0+4-2 lda SpriteShuffler__8__tmp+1 sta SpriteSlot_sprite_b0+4-1 -;;; end action SpriteShuffler__postframe__23 +;;; end action SpriteShuffler__postframe__54 -;;; start action SpriteHider__postframe__24 +;;; start action SpriteHider__postframe__57 lda #4-1 sta SpriteHider__9__tmp+0 -;;; end action SpriteHider__postframe__24 +;;; end action SpriteHider__postframe__57 -;;; start action SpriteHider__postframe__25 +;;; start action SpriteHider__postframe__60 ldy #0 -SpriteHider__postframe__25____each: +SpriteHider__postframe__61____each: ldx SpriteSlot_sprite_b0,y lda HasYpos_ypos_b0,x cmp #192 - bcc SpriteHider__postframe__25__skip + bcc SpriteHider__postframe__62__skip ; swap this sprite slot with slot at end of array lda SpriteSlot_sprite_b0,y pha @@ -488,20 +488,20 @@ SpriteHider__postframe__25____each: pla sta SpriteSlot_sprite_b0,x dec SpriteHider__9__tmp+0 -SpriteHider__postframe__25__skip: +SpriteHider__postframe__62__skip: iny cpy #2 - jne SpriteHider__postframe__25____each -SpriteHider__postframe__25____exit: + jne SpriteHider__postframe__61____each +SpriteHider__postframe__61____exit: -;;; end action SpriteHider__postframe__25 +;;; end action SpriteHider__postframe__60 FRAME_END - jmp FrameLoop__start__2__NextFrame ; loop to next frame + jmp FrameLoop__start__4__NextFrame ; loop to next frame -;;; end action FrameLoop__start__2 +;;; end action FrameLoop__start__3 ; start main routine .segment "VECTORS" Return: .word $6060 diff --git a/test/ecs/superman.txt b/test/ecs/superman.txt index 0370412e..9357b6f9 100644 --- a/test/ecs/superman.txt +++ b/test/ecs/superman.txt @@ -658,12 +658,12 @@ __BRK: dey bne :- -;;; start action FrameLoop__start__2 +;;; start action FrameLoop__start__3 -FrameLoop__start__2__NextFrame: +FrameLoop__start__4__NextFrame: FRAME_START -;;; start action Kernel2Sprite__preframe__3 +;;; start action Kernel2Sprite__preframe__5 .define KLINES #192 .define KPAD 32 @@ -678,17 +678,17 @@ FrameLoop__start__2__NextFrame: sta Kernel2Sprite__2__tmp+6 sta Kernel2Sprite__2__tmp+7 -;;; end action Kernel2Sprite__preframe__3 +;;; end action Kernel2Sprite__preframe__5 -;;; start action Kernel2Sprite__preframe__4 +;;; start action Kernel2Sprite__preframe__8 ldy #0 -Kernel2Sprite__preframe__4____each: +Kernel2Sprite__preframe__9____each: ldx SpriteSlot_sprite_b0,y ; flags set according to sprite slot value ; skip sprite if negative - jmi Kernel2Sprite__preframe__4__nosprite + jmi Kernel2Sprite__preframe__10__nosprite ; set player object flags lda Sprite_plyrflags_b0,x sta NUSIZ0,y @@ -727,16 +727,16 @@ Kernel2Sprite__preframe__4____each: ldx Kernel2Sprite__2__tmp+12 ; restore X lda HasYpos_ypos_b0,x sta Kernel2Sprite__2__tmp+10,y -Kernel2Sprite__preframe__4__nosprite: +Kernel2Sprite__preframe__10__nosprite: iny cpy #2 - jne Kernel2Sprite__preframe__4____each -Kernel2Sprite__preframe__4____exit: + jne Kernel2Sprite__preframe__9____each +Kernel2Sprite__preframe__9____exit: -;;; end action Kernel2Sprite__preframe__4 +;;; end action Kernel2Sprite__preframe__8 -;;; start action Kernel2Sprite__preframe__5 +;;; start action Kernel2Sprite__preframe__11 ; shuffle pointers into (MSB, LSB) byte order ; L0 L1 H0 H1 -> L0 H0 L1 H1 @@ -749,34 +749,34 @@ Kernel2Sprite__preframe__4____exit: sty Kernel2Sprite__2__tmp+5 sta Kernel2Sprite__2__tmp+6 -;;; end action Kernel2Sprite__preframe__5 +;;; end action Kernel2Sprite__preframe__11 -;;; start action Kernel2Sprite__preframe__6 +;;; start action Kernel2Sprite__preframe__13 lda #162 sta COLUBK -;;; end action Kernel2Sprite__preframe__6 +;;; end action Kernel2Sprite__preframe__13 -;;; start action Kernel2Sprite__preframe__7 +;;; start action Kernel2Sprite__preframe__16 -;;; end action Kernel2Sprite__preframe__7 +;;; end action Kernel2Sprite__preframe__16 -;;; start action SetXPos__preframe__8 +;;; start action SetXPos__preframe__17 sta HMCLR -;;; end action SetXPos__preframe__8 +;;; end action SetXPos__preframe__17 -;;; start action SetXPos__preframe__9 +;;; start action SetXPos__preframe__19 ldy #0 -SetXPos__preframe__9____each: +SetXPos__preframe__20____each: ldx SpriteSlot_sprite_b0,y lda HasXpos_xpos_b0,x -;;; start action SetHorizPos__SetHorizPos__10 +;;; start action SetHorizPos__SetHorizPos__22 ; SetHorizPos routine ; A = X coordinate @@ -784,9 +784,9 @@ SetXPos__preframe__9____each: sta WSYNC ; start a new line sec ; set carry flag nop -SetHorizPos__SetHorizPos__10__DivideLoop: +SetHorizPos__SetHorizPos__23__DivideLoop: sbc #15 ; subtract 15 - bcs SetHorizPos__SetHorizPos__10__DivideLoop ; branch until negative + bcs SetHorizPos__SetHorizPos__23__DivideLoop ; branch until negative eor #7 ; calculate fine offset asl asl @@ -795,28 +795,28 @@ SetHorizPos__SetHorizPos__10__DivideLoop: sta RESP0,y ; fix coarse position sta HMP0,y ; set fine offset -;;; end action SetHorizPos__SetHorizPos__10 +;;; end action SetHorizPos__SetHorizPos__22 iny cpy #2 - jne SetXPos__preframe__9____each -SetXPos__preframe__9____exit: + jne SetXPos__preframe__20____each +SetXPos__preframe__20____exit: -;;; end action SetXPos__preframe__9 +;;; end action SetXPos__preframe__19 -;;; start action SetXPos__preframe__11 +;;; start action SetXPos__preframe__24 -;;; end action SetXPos__preframe__11 +;;; end action SetXPos__preframe__24 -;;; start action SetXPos__preframe__12 +;;; start action SetXPos__preframe__25 sta WSYNC sta HMOVE -;;; end action SetXPos__preframe__12 +;;; end action SetXPos__preframe__25 -;;; start action VersatilePlayfield__preframe__13 +;;; start action VersatilePlayfield__preframe__27 ldx Location_room_b0+0 @@ -826,33 +826,33 @@ SetXPos__preframe__9____exit: sta VersatilePlayfield__10__tmp+1 -;;; end action VersatilePlayfield__preframe__13 +;;; end action VersatilePlayfield__preframe__27 KERNEL_START -;;; start action Kernel2Sprite__kernel__14 +;;; start action Kernel2Sprite__kernel__30 ldy #0 sty VDELP0 iny sta VDELP1 -;;; end action Kernel2Sprite__kernel__14 +;;; end action Kernel2Sprite__kernel__30 -;;; start action Kernel2Sprite__kernel__15 +;;; start action Kernel2Sprite__kernel__33 ldy #192 -Kernel2Sprite__kernel__15__LVScan: +Kernel2Sprite__kernel__35__LVScan: -;;; start action Kernel2Sprite__scanline__16 +;;; start action Kernel2Sprite__scanline__36 ; draw player 0 lda Kernel2Sprite__2__tmp+8 ; height dcp Kernel2Sprite__2__tmp+10 ; ypos - bcs Kernel2Sprite__scanline__16__DoDraw1 + bcs Kernel2Sprite__scanline__37__DoDraw1 lda #0 .byte $2C -Kernel2Sprite__scanline__16__DoDraw1: +Kernel2Sprite__scanline__37__DoDraw1: lda (Kernel2Sprite__2__tmp+0),y .if 0 = 0 sta WSYNC @@ -863,50 +863,50 @@ Kernel2Sprite__scanline__16__DoDraw1: ; draw player 1 lda Kernel2Sprite__2__tmp+9 ; height dcp Kernel2Sprite__2__tmp+11 ; ypos - bcs Kernel2Sprite__scanline__16__DoDraw2 + bcs Kernel2Sprite__scanline__37__DoDraw2 lda #0 .byte $2C -Kernel2Sprite__scanline__16__DoDraw2: +Kernel2Sprite__scanline__37__DoDraw2: lda (Kernel2Sprite__2__tmp+2),y sta GRP1 lda (Kernel2Sprite__2__tmp+6),y sta COLUP1 -;;; end action Kernel2Sprite__scanline__16 +;;; end action Kernel2Sprite__scanline__36 -;;; start action Kernel2Sprite__scanline__17 +;;; start action Kernel2Sprite__scanline__38 -;;; end action Kernel2Sprite__scanline__17 +;;; end action Kernel2Sprite__scanline__38 -;;; start action VersatilePlayfield__scanline__18 +;;; start action VersatilePlayfield__scanline__39 .if 0 = 0 lda (VersatilePlayfield__10__tmp+0),y tax .endif -;;; end action VersatilePlayfield__scanline__18 +;;; end action VersatilePlayfield__scanline__39 -;;; start action VersatilePlayfield__scanline__19 +;;; start action VersatilePlayfield__scanline__41 .if 0 = 1 lda (VersatilePlayfield__10__tmp+0),y sta $00,x .endif -;;; end action VersatilePlayfield__scanline__19 +;;; end action VersatilePlayfield__scanline__41 dey ; next scanline -;;; start action Kernel2Sprite__scanline__20 +;;; start action Kernel2Sprite__scanline__43 ; draw player 0 lda Kernel2Sprite__2__tmp+8 ; height dcp Kernel2Sprite__2__tmp+10 ; ypos - bcs Kernel2Sprite__scanline__20__DoDraw1 + bcs Kernel2Sprite__scanline__44__DoDraw1 lda #0 .byte $2C -Kernel2Sprite__scanline__20__DoDraw1: +Kernel2Sprite__scanline__44__DoDraw1: lda (Kernel2Sprite__2__tmp+0),y .if 1 = 0 sta WSYNC @@ -917,45 +917,45 @@ Kernel2Sprite__scanline__20__DoDraw1: ; draw player 1 lda Kernel2Sprite__2__tmp+9 ; height dcp Kernel2Sprite__2__tmp+11 ; ypos - bcs Kernel2Sprite__scanline__20__DoDraw2 + bcs Kernel2Sprite__scanline__44__DoDraw2 lda #0 .byte $2C -Kernel2Sprite__scanline__20__DoDraw2: +Kernel2Sprite__scanline__44__DoDraw2: lda (Kernel2Sprite__2__tmp+2),y sta GRP1 lda (Kernel2Sprite__2__tmp+6),y sta COLUP1 -;;; end action Kernel2Sprite__scanline__20 +;;; end action Kernel2Sprite__scanline__43 -;;; start action Kernel2Sprite__scanline__21 +;;; start action Kernel2Sprite__scanline__45 -;;; end action Kernel2Sprite__scanline__21 +;;; end action Kernel2Sprite__scanline__45 -;;; start action VersatilePlayfield__scanline__22 +;;; start action VersatilePlayfield__scanline__46 .if 1 = 0 lda (VersatilePlayfield__10__tmp+0),y tax .endif -;;; end action VersatilePlayfield__scanline__22 +;;; end action VersatilePlayfield__scanline__46 -;;; start action VersatilePlayfield__scanline__23 +;;; start action VersatilePlayfield__scanline__48 .if 1 = 1 lda (VersatilePlayfield__10__tmp+0),y sta $00,x .endif -;;; end action VersatilePlayfield__scanline__23 +;;; end action VersatilePlayfield__scanline__48 dey ; next scanline - bne Kernel2Sprite__kernel__15__LVScan ; repeat until out of lines + bne Kernel2Sprite__kernel__35__LVScan ; repeat until out of lines -;;; end action Kernel2Sprite__kernel__15 +;;; end action Kernel2Sprite__kernel__33 -;;; start action Kernel2Sprite__kernel__24 +;;; start action Kernel2Sprite__kernel__50 lda #0 sta GRP0 @@ -963,223 +963,223 @@ Kernel2Sprite__scanline__20__DoDraw2: sta GRP0 sta GRP1 -;;; end action Kernel2Sprite__kernel__24 +;;; end action Kernel2Sprite__kernel__50 KERNEL_END -;;; start action Joystick__postframe__25 +;;; start action Joystick__postframe__52 ; 2 control inputs share a single byte, 4 bits each lda SWCHA sta Joystick__3__tmp+0 -;;; end action Joystick__postframe__25 +;;; end action Joystick__postframe__52 -;;; start action Joystick__postframe__26 +;;; start action Joystick__postframe__54 asl Joystick__3__tmp+0 - bcs Joystick__postframe__26__SkipMoveRight + bcs Joystick__postframe__56__SkipMoveRight -;;; start action JoyFaceDirection__joyright__27 +;;; start action JoyFaceDirection__joyright__57 lda Sprite_plyrflags_b0 and #$f7 sta Sprite_plyrflags_b0 -;;; end action JoyFaceDirection__joyright__27 +;;; end action JoyFaceDirection__joyright__57 -;;; start action SuperFly__joyright__28 +;;; start action SuperFly__joyright__60 lda HasXpos_xpos_b0 clc adc #2 cmp #142 - jcc SuperFly__joyright__28__nomove + jcc SuperFly__joyright__62__nomove -;;; start action SuperFly__goeast__29 +;;; start action SuperFly__goeast__63 ldy Location_room_b0 lda Room_east_b0,y sta Location_room_b0 -;;; end action SuperFly__goeast__29 +;;; end action SuperFly__goeast__63 lda #2 -SuperFly__joyright__28__nomove: +SuperFly__joyright__62__nomove: sta HasXpos_xpos_b0 -;;; end action SuperFly__joyright__28 +;;; end action SuperFly__joyright__60 -Joystick__postframe__26__SkipMoveRight: +Joystick__postframe__56__SkipMoveRight: asl Joystick__3__tmp+0 - bcs Joystick__postframe__26__SkipMoveLeft + bcs Joystick__postframe__56__SkipMoveLeft -;;; start action JoyFaceDirection__joyleft__30 +;;; start action JoyFaceDirection__joyleft__66 lda Sprite_plyrflags_b0 ora #$08 sta Sprite_plyrflags_b0 -;;; end action JoyFaceDirection__joyleft__30 +;;; end action JoyFaceDirection__joyleft__66 -;;; start action SuperFly__joyleft__31 +;;; start action SuperFly__joyleft__69 lda HasXpos_xpos_b0 sec sbc #2 - jcs SuperFly__joyleft__31__nomove + jcs SuperFly__joyleft__71__nomove -;;; start action SuperFly__gowest__32 +;;; start action SuperFly__gowest__72 ldy Location_room_b0 lda Room_west_b0,y sta Location_room_b0 -;;; end action SuperFly__gowest__32 +;;; end action SuperFly__gowest__72 lda #142 -SuperFly__joyleft__31__nomove: +SuperFly__joyleft__71__nomove: sta HasXpos_xpos_b0 -;;; end action SuperFly__joyleft__31 +;;; end action SuperFly__joyleft__69 -Joystick__postframe__26__SkipMoveLeft: +Joystick__postframe__56__SkipMoveLeft: asl Joystick__3__tmp+0 - bcs Joystick__postframe__26__SkipMoveDown + bcs Joystick__postframe__56__SkipMoveDown -;;; start action SuperFly__joydown__33 +;;; start action SuperFly__joydown__75 lda HasYpos_ypos_b0 clc adc #2 cmp #220 - jcc SuperFly__joydown__33__nomove + jcc SuperFly__joydown__77__nomove -;;; start action SuperFly__gosouth__34 +;;; start action SuperFly__gosouth__78 ldy Location_room_b0 lda Room_south_b0,y sta Location_room_b0 -;;; end action SuperFly__gosouth__34 +;;; end action SuperFly__gosouth__78 lda #2 -SuperFly__joydown__33__nomove: +SuperFly__joydown__77__nomove: sta HasYpos_ypos_b0 -;;; end action SuperFly__joydown__33 +;;; end action SuperFly__joydown__75 -Joystick__postframe__26__SkipMoveDown: +Joystick__postframe__56__SkipMoveDown: asl Joystick__3__tmp+0 - bcs Joystick__postframe__26__SkipMoveUp + bcs Joystick__postframe__56__SkipMoveUp -;;; start action SuperFly__joyup__35 +;;; start action SuperFly__joyup__81 lda HasYpos_ypos_b0 sec sbc #2 - jcs SuperFly__joyup__35__nomove + jcs SuperFly__joyup__83__nomove -;;; start action SuperFly__gonorth__36 +;;; start action SuperFly__gonorth__84 ldy Location_room_b0 lda Room_north_b0,y sta Location_room_b0 -;;; end action SuperFly__gonorth__36 +;;; end action SuperFly__gonorth__84 lda #200 -SuperFly__joyup__35__nomove: +SuperFly__joyup__83__nomove: sta HasYpos_ypos_b0 -;;; end action SuperFly__joyup__35 +;;; end action SuperFly__joyup__81 -Joystick__postframe__26__SkipMoveUp: +Joystick__postframe__56__SkipMoveUp: -;;; end action Joystick__postframe__26 +;;; end action Joystick__postframe__54 -;;; start action BadMove__postframe__37 +;;; start action BadMove__postframe__87 ldx #0 -BadMove__postframe__37____each: +BadMove__postframe__88____each: -;;; start action JoyFaceDirection__joyright__38 +;;; start action JoyFaceDirection__joyright__90 lda Sprite_plyrflags_b0+1,x and #$f7 sta Sprite_plyrflags_b0+1,x -;;; end action JoyFaceDirection__joyright__38 +;;; end action JoyFaceDirection__joyright__90 -;;; start action SuperFly__joyright__39 +;;; start action SuperFly__joyright__93 lda HasXpos_xpos_b0+1,x clc adc #1 cmp #142 - jcc SuperFly__joyright__39__nomove + jcc SuperFly__joyright__95__nomove -;;; start action SuperFly__goeast__40 +;;; start action SuperFly__goeast__96 ldy Location_room_b0+1,x lda Room_east_b0,y sta Location_room_b0+1,x -;;; end action SuperFly__goeast__40 +;;; end action SuperFly__goeast__96 lda #2 -SuperFly__joyright__39__nomove: +SuperFly__joyright__95__nomove: sta HasXpos_xpos_b0+1,x -;;; end action SuperFly__joyright__39 +;;; end action SuperFly__joyright__93 inx cpx #3 - jne BadMove__postframe__37____each -BadMove__postframe__37____exit: + jne BadMove__postframe__88____each +BadMove__postframe__88____exit: -;;; end action BadMove__postframe__37 +;;; end action BadMove__postframe__87 -;;; start action RoomShuffle__postframe__41 +;;; start action RoomShuffle__postframe__99 ldy 4 ldx SpriteSlot_sprite_b0+1 - bmi RoomShuffle__postframe__41__empty ; empty slot, load 1st entry -RoomShuffle__postframe__41__loop: + bmi RoomShuffle__postframe__101__empty ; empty slot, load 1st entry +RoomShuffle__postframe__101__loop: inx cpx 4 - bcc RoomShuffle__postframe__41__norecycle + bcc RoomShuffle__postframe__101__norecycle ; TODO: need to get index of specific entity -RoomShuffle__postframe__41__empty: +RoomShuffle__postframe__101__empty: ldx #1 ; skip null sprite and super dude? -RoomShuffle__postframe__41__norecycle: +RoomShuffle__postframe__101__norecycle: lda Location_room_b0,x cmp Location_room_b0 - beq RoomShuffle__postframe__41__exit + beq RoomShuffle__postframe__101__exit dey - bne RoomShuffle__postframe__41__loop + bne RoomShuffle__postframe__101__loop ldx #$ff -RoomShuffle__postframe__41__exit: +RoomShuffle__postframe__101__exit: stx SpriteSlot_sprite_b0+1 -;;; end action RoomShuffle__postframe__41 +;;; end action RoomShuffle__postframe__99 -;;; start action VersatilePlayfield__postframe__42 +;;; start action VersatilePlayfield__postframe__102 lda #0 sta PF0 sta PF1 sta PF2 -;;; end action VersatilePlayfield__postframe__42 +;;; end action VersatilePlayfield__postframe__102 FRAME_END - jmp FrameLoop__start__2__NextFrame ; loop to next frame + jmp FrameLoop__start__4__NextFrame ; loop to next frame -;;; end action FrameLoop__start__2 +;;; end action FrameLoop__start__3 ; start main routine .segment "VECTORS" Return: .word $6060 diff --git a/test/ecs/titles.txt b/test/ecs/titles.txt index d4dc580d..53e68cec 100644 --- a/test/ecs/titles.txt +++ b/test/ecs/titles.txt @@ -20,11 +20,11 @@ __Reset: __BRK: CLEAN_START -;;; start action Demo__start__2 +;;; start action Demo__start__3 jmp Title__Start -;;; end action Demo__start__2 +;;; end action Demo__start__3 ; start main routine .segment "VECTORS" Return: .word $6060 @@ -311,56 +311,56 @@ Bitmap48_height_b0: .byte 36 __Start: -;;; start action FrameLoop__start__3 +;;; start action FrameLoop__start__5 -FrameLoop__start__3__NextFrame: +FrameLoop__start__6__NextFrame: FRAME_START -;;; start action StaticKernel__preframe__4 +;;; start action StaticKernel__preframe__7 -;;; start action Kernel48Pixel__kernelsetup__5 +;;; start action Kernel48Pixel__kernelsetup__10 -;;; end action Kernel48Pixel__kernelsetup__5 +;;; end action Kernel48Pixel__kernelsetup__10 -;;; start action Kernel48Pixel__kernelsetup__6 +;;; start action Kernel48Pixel__kernelsetup__11 -;;; end action Kernel48Pixel__kernelsetup__6 +;;; end action Kernel48Pixel__kernelsetup__11 -;;; start action StaticKernel__kernelsetup__7 +;;; start action StaticKernel__kernelsetup__12 lda #160 sta COLUBK -;;; end action StaticKernel__kernelsetup__7 +;;; end action StaticKernel__kernelsetup__12 -;;; start action StaticKernel__kernelsetup__8 +;;; start action StaticKernel__kernelsetup__15 -;;; end action StaticKernel__kernelsetup__8 +;;; end action StaticKernel__kernelsetup__15 -;;; start action StaticKernel__kernelsetup__9 +;;; start action StaticKernel__kernelsetup__16 -;;; end action StaticKernel__kernelsetup__9 +;;; end action StaticKernel__kernelsetup__16 -;;; end action StaticKernel__preframe__4 +;;; end action StaticKernel__preframe__7 KERNEL_START -;;; start action StaticKernel__kernel__10 +;;; start action StaticKernel__kernel__17 ldx #0 -StaticKernel__kernel__10____each: +StaticKernel__kernel__18____each: sta WSYNC -;;; start action Kernel48Pixel__kernelsetup__11 +;;; start action Kernel48Pixel__kernelsetup__20 cpx #2+1 - jcs Kernel48Pixel__kernelsetup__11____skipxhi + jcs Kernel48Pixel__kernelsetup__21____skipxhi cpx #2 - jcc Kernel48Pixel__kernelsetup__11____skipxlo + jcc Kernel48Pixel__kernelsetup__21____skipxlo lda #36 sta Kernel48Pixel__2__tmp+0 ; scanline counter @@ -385,117 +385,117 @@ StaticKernel__kernel__10____each: SLEEPH 24-8 ; sleep 24 cycles sta HMCLR ; clear HMOVE registers -Kernel48Pixel__kernelsetup__11____skipxlo: +Kernel48Pixel__kernelsetup__21____skipxlo: -Kernel48Pixel__kernelsetup__11____skipxhi: +Kernel48Pixel__kernelsetup__21____skipxhi: -;;; end action Kernel48Pixel__kernelsetup__11 +;;; end action Kernel48Pixel__kernelsetup__20 -;;; start action Kernel48Pixel__kernelsetup__12 +;;; start action Kernel48Pixel__kernelsetup__23 cpx #2+1 - jcs Kernel48Pixel__kernelsetup__12____skipxhi + jcs Kernel48Pixel__kernelsetup__24____skipxhi cpx #2 - jcc Kernel48Pixel__kernelsetup__12____skipxlo + jcc Kernel48Pixel__kernelsetup__24____skipxlo lda #252 sta COLUP0 sta COLUP1 -Kernel48Pixel__kernelsetup__12____skipxlo: +Kernel48Pixel__kernelsetup__24____skipxlo: -Kernel48Pixel__kernelsetup__12____skipxhi: +Kernel48Pixel__kernelsetup__24____skipxhi: -;;; end action Kernel48Pixel__kernelsetup__12 +;;; end action Kernel48Pixel__kernelsetup__23 -;;; start action StaticKernel__kernelsetup__13 +;;; start action StaticKernel__kernelsetup__26 lda BGColor_bgcolor_b0,x sta COLUBK -;;; end action StaticKernel__kernelsetup__13 +;;; end action StaticKernel__kernelsetup__26 -;;; start action StaticKernel__kernelsetup__14 +;;; start action StaticKernel__kernelsetup__29 cpx #2+1 - jcs StaticKernel__kernelsetup__14____skipxhi + jcs StaticKernel__kernelsetup__30____skipxhi cpx #2 - jcc StaticKernel__kernelsetup__14____skipxlo + jcc StaticKernel__kernelsetup__30____skipxlo lda #252 sta COLUPF -StaticKernel__kernelsetup__14____skipxlo: +StaticKernel__kernelsetup__30____skipxlo: -StaticKernel__kernelsetup__14____skipxhi: +StaticKernel__kernelsetup__30____skipxhi: -;;; end action StaticKernel__kernelsetup__14 +;;; end action StaticKernel__kernelsetup__29 -;;; start action StaticKernel__kernelsetup__15 +;;; start action StaticKernel__kernelsetup__32 -;;; end action StaticKernel__kernelsetup__15 +;;; end action StaticKernel__kernelsetup__32 - jsr Kernel48Pixel__kerneldraw__16 + jsr Kernel48Pixel__kerneldraw__33 -;;; start action StaticKernel__kerneldraw__17 +;;; start action StaticKernel__kerneldraw__36 ldy KernelSection_lines_b0,x -StaticKernel__kerneldraw__17__loop: +StaticKernel__kerneldraw__38__loop: sta WSYNC dey - bne StaticKernel__kerneldraw__17__loop + bne StaticKernel__kerneldraw__38__loop -;;; end action StaticKernel__kerneldraw__17 +;;; end action StaticKernel__kerneldraw__36 inx cpx #5 - jne StaticKernel__kernel__10____each -StaticKernel__kernel__10____exit: + jne StaticKernel__kernel__18____each +StaticKernel__kernel__18____exit: -;;; end action StaticKernel__kernel__10 +;;; end action StaticKernel__kernel__17 KERNEL_END -;;; start action JoyButton__postframe__18 +;;; start action JoyButton__postframe__39 lda INPT4 ;read button input - bmi JoyButton__postframe__18__NotPressed + bmi JoyButton__postframe__41__NotPressed -;;; start action Advance__joybutton__19 +;;; start action Advance__joybutton__42 jmp Title2__Start -;;; end action Advance__joybutton__19 +;;; end action Advance__joybutton__42 -JoyButton__postframe__18__NotPressed: +JoyButton__postframe__41__NotPressed: -;;; end action JoyButton__postframe__18 +;;; end action JoyButton__postframe__39 FRAME_END - jmp FrameLoop__start__3__NextFrame ; loop to next frame + jmp FrameLoop__start__6__NextFrame ; loop to next frame -;;; end action FrameLoop__start__3 +;;; end action FrameLoop__start__5 .rodata __ALIGNORIGIN: .rodata -Kernel48Pixel__kerneldraw__16: +Kernel48Pixel__kerneldraw__33: cpx #2+1 - jcs Kernel48Pixel__kerneldraw__16____skipxhi + jcs Kernel48Pixel__kerneldraw__34____skipxhi cpx #2 - jcc Kernel48Pixel__kerneldraw__16____skipxlo + jcc Kernel48Pixel__kerneldraw__34____skipxlo txa pha -Kernel48Pixel__kerneldraw__16__Loop: +Kernel48Pixel__kerneldraw__35__Loop: ldy Kernel48Pixel__2__tmp+0 ; counts backwards sta WSYNC ; sync to next scanline lda Bitmap48_bitmap0_e3_b0,y ; load B0 (1st sprite byte) @@ -514,19 +514,19 @@ Kernel48Pixel__kerneldraw__16__Loop: sty GRP1 ; B5 -> [GRP1]; B4 -> GRP0 sta GRP0 ; ?? -> [GRP0]; B5 -> GRP1 dec Kernel48Pixel__2__tmp+0 ; go to next line - bpl Kernel48Pixel__kerneldraw__16__Loop ; repeat until < 0 + bpl Kernel48Pixel__kerneldraw__35__Loop ; repeat until < 0 pla tax -Kernel48Pixel__kerneldraw__16____skipxlo: +Kernel48Pixel__kerneldraw__34____skipxlo: -Kernel48Pixel__kerneldraw__16____skipxhi: +Kernel48Pixel__kerneldraw__34____skipxhi: rts -.assert >(Kernel48Pixel__kerneldraw__16) = >(*), error, "Kernel48Pixel__kerneldraw__16 crosses a page boundary!" +.assert >(Kernel48Pixel__kerneldraw__33) = >(*), error, "Kernel48Pixel__kerneldraw__33 crosses a page boundary!" -.assert (* - Kernel48Pixel__kerneldraw__16) <= 63, error, .sprintf("Kernel48Pixel__kerneldraw__16 does not fit in 63 bytes, it took %d!", (* - Kernel48Pixel__kerneldraw__16)) +.assert (* - Kernel48Pixel__kerneldraw__33) <= 63, error, .sprintf("Kernel48Pixel__kerneldraw__33 does not fit in 63 bytes, it took %d!", (* - Kernel48Pixel__kerneldraw__33)) .endscope Title__Start = Title::__Start .scope Title2 @@ -861,56 +861,56 @@ __Start: dey bne :- -;;; start action FrameLoop__start__20 +;;; start action FrameLoop__start__44 -FrameLoop__start__20__NextFrame: +FrameLoop__start__45__NextFrame: FRAME_START -;;; start action StaticKernel__preframe__21 +;;; start action StaticKernel__preframe__46 -;;; start action Kernel48Pixel__kernelsetup__22 +;;; start action Kernel48Pixel__kernelsetup__49 -;;; end action Kernel48Pixel__kernelsetup__22 +;;; end action Kernel48Pixel__kernelsetup__49 -;;; start action Kernel48Pixel__kernelsetup__23 +;;; start action Kernel48Pixel__kernelsetup__50 -;;; end action Kernel48Pixel__kernelsetup__23 +;;; end action Kernel48Pixel__kernelsetup__50 -;;; start action StaticKernel__kernelsetup__24 +;;; start action StaticKernel__kernelsetup__51 lda BGColor_bgcolor_b0 sta COLUBK -;;; end action StaticKernel__kernelsetup__24 +;;; end action StaticKernel__kernelsetup__51 -;;; start action StaticKernel__kernelsetup__25 +;;; start action StaticKernel__kernelsetup__54 -;;; end action StaticKernel__kernelsetup__25 +;;; end action StaticKernel__kernelsetup__54 -;;; start action StaticKernel__kernelsetup__26 +;;; start action StaticKernel__kernelsetup__55 -;;; end action StaticKernel__kernelsetup__26 +;;; end action StaticKernel__kernelsetup__55 -;;; end action StaticKernel__preframe__21 +;;; end action StaticKernel__preframe__46 KERNEL_START -;;; start action StaticKernel__kernel__27 +;;; start action StaticKernel__kernel__56 ldx #0 -StaticKernel__kernel__27____each: +StaticKernel__kernel__57____each: sta WSYNC -;;; start action Kernel48Pixel__kernelsetup__28 +;;; start action Kernel48Pixel__kernelsetup__59 cpx #2+1 - jcs Kernel48Pixel__kernelsetup__28____skipxhi + jcs Kernel48Pixel__kernelsetup__60____skipxhi cpx #2 - jcc Kernel48Pixel__kernelsetup__28____skipxlo + jcc Kernel48Pixel__kernelsetup__60____skipxlo lda #43 sta Kernel48Pixel__2__tmp+0 ; scanline counter @@ -935,84 +935,84 @@ StaticKernel__kernel__27____each: SLEEPH 24-8 ; sleep 24 cycles sta HMCLR ; clear HMOVE registers -Kernel48Pixel__kernelsetup__28____skipxlo: +Kernel48Pixel__kernelsetup__60____skipxlo: -Kernel48Pixel__kernelsetup__28____skipxhi: +Kernel48Pixel__kernelsetup__60____skipxhi: -;;; end action Kernel48Pixel__kernelsetup__28 +;;; end action Kernel48Pixel__kernelsetup__59 -;;; start action Kernel48Pixel__kernelsetup__29 +;;; start action Kernel48Pixel__kernelsetup__62 cpx #2+1 - jcs Kernel48Pixel__kernelsetup__29____skipxhi + jcs Kernel48Pixel__kernelsetup__63____skipxhi cpx #2 - jcc Kernel48Pixel__kernelsetup__29____skipxlo + jcc Kernel48Pixel__kernelsetup__63____skipxlo lda PFColor_pfcolor_b0 sta COLUP0 sta COLUP1 -Kernel48Pixel__kernelsetup__29____skipxlo: +Kernel48Pixel__kernelsetup__63____skipxlo: -Kernel48Pixel__kernelsetup__29____skipxhi: +Kernel48Pixel__kernelsetup__63____skipxhi: -;;; end action Kernel48Pixel__kernelsetup__29 +;;; end action Kernel48Pixel__kernelsetup__62 -;;; start action StaticKernel__kernelsetup__30 +;;; start action StaticKernel__kernelsetup__65 lda BGColor_bgcolor_b0,x sta COLUBK -;;; end action StaticKernel__kernelsetup__30 +;;; end action StaticKernel__kernelsetup__65 -;;; start action StaticKernel__kernelsetup__31 +;;; start action StaticKernel__kernelsetup__68 cpx #2+1 - jcs StaticKernel__kernelsetup__31____skipxhi + jcs StaticKernel__kernelsetup__69____skipxhi cpx #2 - jcc StaticKernel__kernelsetup__31____skipxlo + jcc StaticKernel__kernelsetup__69____skipxlo lda PFColor_pfcolor_b0 sta COLUPF -StaticKernel__kernelsetup__31____skipxlo: +StaticKernel__kernelsetup__69____skipxlo: -StaticKernel__kernelsetup__31____skipxhi: +StaticKernel__kernelsetup__69____skipxhi: -;;; end action StaticKernel__kernelsetup__31 +;;; end action StaticKernel__kernelsetup__68 -;;; start action StaticKernel__kernelsetup__32 +;;; start action StaticKernel__kernelsetup__71 -;;; end action StaticKernel__kernelsetup__32 +;;; end action StaticKernel__kernelsetup__71 - jsr Kernel48Pixel__kerneldraw__33 + jsr Kernel48Pixel__kerneldraw__72 -;;; start action StaticKernel__kerneldraw__34 +;;; start action StaticKernel__kerneldraw__75 ldy KernelSection_lines_b0,x -StaticKernel__kerneldraw__34__loop: +StaticKernel__kerneldraw__77__loop: sta WSYNC dey - bne StaticKernel__kerneldraw__34__loop + bne StaticKernel__kerneldraw__77__loop -;;; end action StaticKernel__kerneldraw__34 +;;; end action StaticKernel__kerneldraw__75 inx cpx #5 - jne StaticKernel__kernel__27____each -StaticKernel__kernel__27____exit: + jne StaticKernel__kernel__57____each +StaticKernel__kernel__57____exit: -;;; end action StaticKernel__kernel__27 +;;; end action StaticKernel__kernel__56 KERNEL_END -;;; start action Colors__postframe__35 +;;; start action Colors__postframe__78 inc PFColor_pfcolor_b0 bne :+ @@ -1020,27 +1020,27 @@ StaticKernel__kernel__27____exit: inc BGColor_bgcolor_b0+2 : -;;; end action Colors__postframe__35 +;;; end action Colors__postframe__78 FRAME_END - jmp FrameLoop__start__20__NextFrame ; loop to next frame + jmp FrameLoop__start__45__NextFrame ; loop to next frame -;;; end action FrameLoop__start__20 +;;; end action FrameLoop__start__44 .rodata __ALIGNORIGIN: .rodata -Kernel48Pixel__kerneldraw__33: +Kernel48Pixel__kerneldraw__72: cpx #2+1 - jcs Kernel48Pixel__kerneldraw__33____skipxhi + jcs Kernel48Pixel__kerneldraw__73____skipxhi cpx #2 - jcc Kernel48Pixel__kerneldraw__33____skipxlo + jcc Kernel48Pixel__kerneldraw__73____skipxlo txa pha -Kernel48Pixel__kerneldraw__33__Loop: +Kernel48Pixel__kerneldraw__74__Loop: ldy Kernel48Pixel__2__tmp+0 ; counts backwards sta WSYNC ; sync to next scanline lda Bitmap48_bitmap0_e2_b0,y ; load B0 (1st sprite byte) @@ -1059,19 +1059,19 @@ Kernel48Pixel__kerneldraw__33__Loop: sty GRP1 ; B5 -> [GRP1]; B4 -> GRP0 sta GRP0 ; ?? -> [GRP0]; B5 -> GRP1 dec Kernel48Pixel__2__tmp+0 ; go to next line - bpl Kernel48Pixel__kerneldraw__33__Loop ; repeat until < 0 + bpl Kernel48Pixel__kerneldraw__74__Loop ; repeat until < 0 pla tax -Kernel48Pixel__kerneldraw__33____skipxlo: +Kernel48Pixel__kerneldraw__73____skipxlo: -Kernel48Pixel__kerneldraw__33____skipxhi: +Kernel48Pixel__kerneldraw__73____skipxhi: rts -.assert >(Kernel48Pixel__kerneldraw__33) = >(*), error, "Kernel48Pixel__kerneldraw__33 crosses a page boundary!" +.assert >(Kernel48Pixel__kerneldraw__72) = >(*), error, "Kernel48Pixel__kerneldraw__72 crosses a page boundary!" -.assert (* - Kernel48Pixel__kerneldraw__33) <= 63, error, .sprintf("Kernel48Pixel__kerneldraw__33 does not fit in 63 bytes, it took %d!", (* - Kernel48Pixel__kerneldraw__33)) +.assert (* - Kernel48Pixel__kerneldraw__72) <= 63, error, .sprintf("Kernel48Pixel__kerneldraw__72 does not fit in 63 bytes, it took %d!", (* - Kernel48Pixel__kerneldraw__72)) .endscope Title2__Start = Title2::__Start .endscope diff --git a/test/ecs/vcs1.txt b/test/ecs/vcs1.txt index 8efbded3..a5ff83a8 100644 --- a/test/ecs/vcs1.txt +++ b/test/ecs/vcs1.txt @@ -68,69 +68,69 @@ __BRK: dey bne :- -;;; start action FrameLoop__start__2 +;;; start action FrameLoop__start__3 -FrameLoop__start__2__NextFrame: +FrameLoop__start__4__NextFrame: FRAME_START -;;; start action StaticKernel__preframe__3 +;;; start action StaticKernel__preframe__5 -;;; start action StaticKernel__kernelsetup__4 +;;; start action StaticKernel__kernelsetup__8 lda #24 sta COLUBK -;;; end action StaticKernel__kernelsetup__4 +;;; end action StaticKernel__kernelsetup__8 -;;; start action StaticKernel__kernelsetup__5 +;;; start action StaticKernel__kernelsetup__11 -;;; end action StaticKernel__kernelsetup__5 +;;; end action StaticKernel__kernelsetup__11 -;;; start action StaticKernel__kernelsetup__6 +;;; start action StaticKernel__kernelsetup__12 -;;; end action StaticKernel__kernelsetup__6 +;;; end action StaticKernel__kernelsetup__12 -;;; end action StaticKernel__preframe__3 +;;; end action StaticKernel__preframe__5 KERNEL_START -;;; start action StaticKernel__kernel__7 +;;; start action StaticKernel__kernel__13 ldx #0 -StaticKernel__kernel__7____each: +StaticKernel__kernel__14____each: sta WSYNC -;;; start action StaticKernel__kernelsetup__8 +;;; start action StaticKernel__kernelsetup__16 lda BGColor_bgcolor_b0,x sta COLUBK -;;; end action StaticKernel__kernelsetup__8 +;;; end action StaticKernel__kernelsetup__16 -;;; start action StaticKernel__kernelsetup__9 +;;; start action StaticKernel__kernelsetup__19 cpx #5+2 - jcs StaticKernel__kernelsetup__9____skipxhi + jcs StaticKernel__kernelsetup__20____skipxhi cpx #5 - jcc StaticKernel__kernelsetup__9____skipxlo + jcc StaticKernel__kernelsetup__20____skipxlo lda PFColor_pfcolor_b0-5,x sta COLUPF -StaticKernel__kernelsetup__9____skipxlo: +StaticKernel__kernelsetup__20____skipxlo: -StaticKernel__kernelsetup__9____skipxhi: +StaticKernel__kernelsetup__20____skipxhi: -;;; end action StaticKernel__kernelsetup__9 +;;; end action StaticKernel__kernelsetup__19 -;;; start action StaticKernel__kernelsetup__10 +;;; start action StaticKernel__kernelsetup__22 cpx #4 - jcc StaticKernel__kernelsetup__10____skipxlo + jcc StaticKernel__kernelsetup__23____skipxlo lda Playfield_pf_b0-4,x sta PF0 @@ -139,63 +139,63 @@ StaticKernel__kernelsetup__9____skipxhi: lda Playfield_pf_b16-4,x sta PF2 -StaticKernel__kernelsetup__10____skipxlo: +StaticKernel__kernelsetup__23____skipxlo: -;;; end action StaticKernel__kernelsetup__10 +;;; end action StaticKernel__kernelsetup__22 ldy KernelSection_lines_b0,x -StaticKernel__kernel__7__loop: +StaticKernel__kernel__15__loop: sta WSYNC dey - bne StaticKernel__kernel__7__loop + bne StaticKernel__kernel__15__loop inx cpx #8 - jne StaticKernel__kernel__7____each -StaticKernel__kernel__7____exit: + jne StaticKernel__kernel__14____each +StaticKernel__kernel__14____exit: -;;; end action StaticKernel__kernel__7 +;;; end action StaticKernel__kernel__13 KERNEL_END -;;; start action JoyButton__postframe__11 +;;; start action JoyButton__postframe__25 lda INPT4 ;read button input - bmi JoyButton__postframe__11__NotPressed + bmi JoyButton__postframe__27__NotPressed -;;; start action Local__joybutton__12 +;;; start action Local__joybutton__28 inc Local__6__tmp+0 inc PFColor_pfcolor_b0 -;;; end action Local__joybutton__12 +;;; end action Local__joybutton__28 -JoyButton__postframe__11__NotPressed: +JoyButton__postframe__27__NotPressed: -;;; end action JoyButton__postframe__11 +;;; end action JoyButton__postframe__25 FRAME_END -;;; start action ResetSwitch__nextframe__13 +;;; start action ResetSwitch__nextframe__31 lsr SWCHB ; test Game Reset switch - bcs ResetSwitch__nextframe__13__NoStart + bcs ResetSwitch__nextframe__32__NoStart -;;; start action ResetConsole__resetswitch__14 +;;; start action ResetConsole__resetswitch__33 jmp Main::__Reset ; jump to Reset handler -;;; end action ResetConsole__resetswitch__14 +;;; end action ResetConsole__resetswitch__33 -ResetSwitch__nextframe__13__NoStart: +ResetSwitch__nextframe__32__NoStart: -;;; end action ResetSwitch__nextframe__13 +;;; end action ResetSwitch__nextframe__31 - jmp FrameLoop__start__2__NextFrame ; loop to next frame + jmp FrameLoop__start__4__NextFrame ; loop to next frame -;;; end action FrameLoop__start__2 +;;; end action FrameLoop__start__3 ; start main routine .segment "VECTORS" Return: .word $6060 diff --git a/test/ecs/vcslib.txt b/test/ecs/vcslib.txt index 321c1214..c53a33fd 100644 --- a/test/ecs/vcslib.txt +++ b/test/ecs/vcslib.txt @@ -70,69 +70,69 @@ __BRK: dey bne :- -;;; start action FrameLoop__start__2 +;;; start action FrameLoop__start__3 -FrameLoop__start__2__NextFrame: +FrameLoop__start__4__NextFrame: FRAME_START -;;; start action StaticKernel__preframe__3 +;;; start action StaticKernel__preframe__5 -;;; start action StaticKernel__kernelsetup__4 +;;; start action StaticKernel__kernelsetup__8 lda #24 sta COLUBK -;;; end action StaticKernel__kernelsetup__4 +;;; end action StaticKernel__kernelsetup__8 -;;; start action StaticKernel__kernelsetup__5 +;;; start action StaticKernel__kernelsetup__11 -;;; end action StaticKernel__kernelsetup__5 +;;; end action StaticKernel__kernelsetup__11 -;;; start action StaticKernel__kernelsetup__6 +;;; start action StaticKernel__kernelsetup__12 -;;; end action StaticKernel__kernelsetup__6 +;;; end action StaticKernel__kernelsetup__12 -;;; end action StaticKernel__preframe__3 +;;; end action StaticKernel__preframe__5 KERNEL_START -;;; start action StaticKernel__kernel__7 +;;; start action StaticKernel__kernel__13 ldx #0 -StaticKernel__kernel__7____each: +StaticKernel__kernel__14____each: sta WSYNC -;;; start action StaticKernel__kernelsetup__8 +;;; start action StaticKernel__kernelsetup__16 lda BGColor_bgcolor_b0,x sta COLUBK -;;; end action StaticKernel__kernelsetup__8 +;;; end action StaticKernel__kernelsetup__16 -;;; start action StaticKernel__kernelsetup__9 +;;; start action StaticKernel__kernelsetup__19 cpx #5+2 - jcs StaticKernel__kernelsetup__9____skipxhi + jcs StaticKernel__kernelsetup__20____skipxhi cpx #5 - jcc StaticKernel__kernelsetup__9____skipxlo + jcc StaticKernel__kernelsetup__20____skipxlo lda PFColor_pfcolor_b0-5,x sta COLUPF -StaticKernel__kernelsetup__9____skipxlo: +StaticKernel__kernelsetup__20____skipxlo: -StaticKernel__kernelsetup__9____skipxhi: +StaticKernel__kernelsetup__20____skipxhi: -;;; end action StaticKernel__kernelsetup__9 +;;; end action StaticKernel__kernelsetup__19 -;;; start action StaticKernel__kernelsetup__10 +;;; start action StaticKernel__kernelsetup__22 cpx #4 - jcc StaticKernel__kernelsetup__10____skipxlo + jcc StaticKernel__kernelsetup__23____skipxlo lda Playfield_pf_b0-4,x sta PF0 @@ -141,69 +141,69 @@ StaticKernel__kernelsetup__9____skipxhi: lda Playfield_pf_b16-4,x sta PF2 -StaticKernel__kernelsetup__10____skipxlo: +StaticKernel__kernelsetup__23____skipxlo: -;;; end action StaticKernel__kernelsetup__10 +;;; end action StaticKernel__kernelsetup__22 -;;; start action StaticKernel__kerneldraw__11 +;;; start action StaticKernel__kerneldraw__25 ldy KernelSection_lines_b0,x -StaticKernel__kerneldraw__11__loop: +StaticKernel__kerneldraw__27__loop: sta WSYNC dey - bne StaticKernel__kerneldraw__11__loop + bne StaticKernel__kerneldraw__27__loop -;;; end action StaticKernel__kerneldraw__11 +;;; end action StaticKernel__kerneldraw__25 inx cpx #8 - jne StaticKernel__kernel__7____each -StaticKernel__kernel__7____exit: + jne StaticKernel__kernel__14____each +StaticKernel__kernel__14____exit: -;;; end action StaticKernel__kernel__7 +;;; end action StaticKernel__kernel__13 KERNEL_END -;;; start action JoyButton__postframe__12 +;;; start action JoyButton__postframe__28 lda INPT4 ;read button input - bmi JoyButton__postframe__12__NotPressed + bmi JoyButton__postframe__30__NotPressed -;;; start action Local__joybutton__13 +;;; start action Local__joybutton__31 inc Local__6__tmp+0 inc PFColor_pfcolor_b0 -;;; end action Local__joybutton__13 +;;; end action Local__joybutton__31 -JoyButton__postframe__12__NotPressed: +JoyButton__postframe__30__NotPressed: -;;; end action JoyButton__postframe__12 +;;; end action JoyButton__postframe__28 FRAME_END -;;; start action ResetSwitch__nextframe__14 +;;; start action ResetSwitch__nextframe__34 lsr SWCHB ; test Game Reset switch - bcs ResetSwitch__nextframe__14__NoStart + bcs ResetSwitch__nextframe__35__NoStart -;;; start action ResetConsole__resetswitch__15 +;;; start action ResetConsole__resetswitch__36 jmp Main::__Reset ; jump to Reset handler -;;; end action ResetConsole__resetswitch__15 +;;; end action ResetConsole__resetswitch__36 -ResetSwitch__nextframe__14__NoStart: +ResetSwitch__nextframe__35__NoStart: -;;; end action ResetSwitch__nextframe__14 +;;; end action ResetSwitch__nextframe__34 - jmp FrameLoop__start__2__NextFrame ; loop to next frame + jmp FrameLoop__start__4__NextFrame ; loop to next frame -;;; end action FrameLoop__start__2 +;;; end action FrameLoop__start__3 ; start main routine .segment "VECTORS" Return: .word $6060