@@ -13,12 +13,13 @@ const mappers = [1, 3, 4, 5];
13
13
const args = process . argv . slice ( 2 ) ;
14
14
15
15
if ( args . includes ( '-h' ) ) {
16
- console . log ( `usage: node [-h] [-v] [-m<${ mappers . join ( '|' ) } >] [-a] [-s] [-k]
16
+ console . log ( `usage: node [-h] [-v] [-m<${ mappers . join ( '|' ) } >] [-a] [-s] [-k] [-w]
17
17
18
18
-m mapper
19
19
-a faster aeppoz + press select to end game
20
20
-s disable highscores/SRAM
21
21
-k Famicom Keyboard support
22
+ -w force WASM compiler
22
23
-h you are here
23
24
` ) ;
24
25
process . exit ( 0 ) ;
@@ -28,9 +29,13 @@ const compileFlags = [];
28
29
29
30
// compiler options
30
31
31
- const nativeCC65 = process . env . PATH . split ( path . delimiter ) . some ( ( dir ) =>
32
- fs . statSync ( path . join ( dir , 'cc65' ) , { throwIfNoEntry : false } ) ?. isFile ( ) ,
33
- ) ;
32
+ const nativeCC65 = args . includes ( '-w' )
33
+ ? false
34
+ : process . env . PATH . split ( path . delimiter ) . some ( ( dir ) =>
35
+ fs
36
+ . statSync ( path . join ( dir , 'cc65' ) , { throwIfNoEntry : false } )
37
+ ?. isFile ( ) ,
38
+ ) ;
34
39
35
40
console . log ( `using ${ nativeCC65 ? 'system' : 'wasm' } ca65/ld65` ) ;
36
41
@@ -106,7 +111,7 @@ function handleSpawn(exe, ...args) {
106
111
}
107
112
}
108
113
109
- const ca65bin = nativeCC65 ? [ 'ca65' ] : [ 'node' , './tools/assemble/ca65.js ' ] ;
114
+ const ca65bin = nativeCC65 ? [ 'ca65' ] : [ 'node' , './tools/assemble/ca65' ] ;
110
115
111
116
console . time ( 'assemble' ) ;
112
117
@@ -126,7 +131,7 @@ console.timeEnd('assemble');
126
131
127
132
// link object files
128
133
129
- const ld65bin = nativeCC65 ? [ 'ld65' ] : [ 'node' , './tools/assemble/ld65.js ' ] ;
134
+ const ld65bin = nativeCC65 ? [ 'ld65' ] : [ 'node' , './tools/assemble/ld65' ] ;
130
135
131
136
console . time ( 'link' ) ;
132
137
@@ -157,7 +162,7 @@ console.log();
157
162
if ( fs . existsSync ( 'tetris.map' ) ) {
158
163
const memMap = fs . readFileSync ( 'tetris.map' , 'utf8' ) ;
159
164
160
- console . log ( ( memMap . match ( / P R G _ c h u n k \d + \s + 0 .+ $ / gm) ?? [ ] ) . join ( '\n' ) ) ;
165
+ console . log ( ( memMap . match ( / P R G _ c h u n k \d + \s + 0 .+ $ / gm) || [ ] ) . join ( '\n' ) ) ;
161
166
}
162
167
163
168
function hashFile ( filename ) {
0 commit comments