@@ -32,12 +32,12 @@ function pull(reg) {
32
32
if ( reg === "p" ) {
33
33
return [ "cpu.p.setFromByte(cpu.pull());" ] ;
34
34
}
35
- return [ " cpu." + reg + " = cpu.p.setzn(cpu.pull());" ] ;
35
+ return [ ` cpu.${ reg } = cpu.p.setzn(cpu.pull());` ] ;
36
36
}
37
37
38
38
function push ( reg ) {
39
39
if ( reg === "p" ) return "cpu.push(cpu.p.asByte());" ;
40
- return " cpu.push(cpu." + reg + ");" ;
40
+ return ` cpu.push(cpu.${ reg } );` ;
41
41
}
42
42
43
43
class InstructionGen {
@@ -76,27 +76,27 @@ class InstructionGen {
76
76
readOp ( addr , reg , spurious ) {
77
77
this . cycle ++ ;
78
78
let op ;
79
- if ( reg ) op = reg + " = cpu.readmem(" + addr + ");" ;
80
- else op = " cpu.readmem(" + addr + ");" ;
79
+ if ( reg ) op = ` ${ reg } = cpu.readmem(${ addr } );` ;
80
+ else op = ` cpu.readmem(${ addr } );` ;
81
81
if ( spurious ) op += " // spurious" ;
82
82
this . append ( this . cycle , op , true , addr ) ;
83
83
}
84
84
85
85
writeOp ( addr , reg , spurious ) {
86
86
this . cycle ++ ;
87
- let op = " cpu.writemem(" + addr + ", " + reg + ");" ;
87
+ let op = ` cpu.writemem(${ addr } , ${ reg } );` ;
88
88
if ( spurious ) op += " // spurious" ;
89
89
this . append ( this . cycle , op , true , addr ) ;
90
90
}
91
91
92
92
zpReadOp ( addr , reg ) {
93
93
this . cycle ++ ;
94
- this . append ( this . cycle , reg + " = cpu.readmemZpStack(" + addr + ");" , false ) ;
94
+ this . append ( this . cycle , ` ${ reg } = cpu.readmemZpStack(${ addr } );` , false ) ;
95
95
}
96
96
97
97
zpWriteOp ( addr , reg ) {
98
98
this . cycle ++ ;
99
- this . append ( this . cycle , " cpu.writememZpStack(" + addr + ", " + reg + ");" , true ) ;
99
+ this . append ( this . cycle , ` cpu.writememZpStack(${ addr } , ${ reg } );` , true ) ;
100
100
}
101
101
102
102
render ( startCycle ) {
@@ -124,9 +124,9 @@ class InstructionGen {
124
124
}
125
125
if ( toSkip && this . ops [ i ] . exact ) {
126
126
if ( this . ops [ i ] . addr ) {
127
- out . push ( " cpu.polltimeAddr(" + toSkip + ", " + this . ops [ i ] . addr + ");" ) ;
127
+ out . push ( ` cpu.polltimeAddr(${ toSkip } , ${ this . ops [ i ] . addr } );` ) ;
128
128
} else {
129
- out . push ( " cpu.polltime(" + toSkip + ");" ) ;
129
+ out . push ( ` cpu.polltime(${ toSkip } );` ) ;
130
130
}
131
131
toSkip = 0 ;
132
132
}
@@ -135,9 +135,9 @@ class InstructionGen {
135
135
}
136
136
if ( toSkip ) {
137
137
if ( this . ops [ this . cycle ] && this . ops [ this . cycle ] . addr ) {
138
- out . push ( " cpu.polltimeAddr(" + toSkip + ", " + this . ops [ this . cycle ] . addr + ");" ) ;
138
+ out . push ( ` cpu.polltimeAddr(${ toSkip } , ${ this . ops [ this . cycle ] . addr } );` ) ;
139
139
} else {
140
- out . push ( " cpu.polltime(" + toSkip + ");" ) ;
140
+ out . push ( ` cpu.polltime(${ toSkip } );` ) ;
141
141
}
142
142
}
143
143
if ( this . ops [ this . cycle ] ) out = out . concat ( this . ops [ this . cycle ] . op ) ;
@@ -173,7 +173,7 @@ class SplitInstruction {
173
173
render ( ) {
174
174
return this . preamble
175
175
. renderInternal ( )
176
- . concat ( " if (" + this . condition + " ) {" )
176
+ . concat ( ` if (${ this . condition } ) {` )
177
177
. concat ( this . indent ( this . ifTrue . render ( this . preamble . cycle ) ) )
178
178
. concat ( "} else {" )
179
179
. concat ( this . indent ( this . ifFalse . render ( this . preamble . cycle ) ) )
@@ -1009,8 +1009,8 @@ class Disassemble6502 {
1009
1009
const index = param . match ( / ( .* ) , ( [ x y ] ) $ / ) ;
1010
1010
if ( index ) {
1011
1011
param = index [ 1 ] ;
1012
- suffix = "," + index [ 2 ] . toUpperCase ( ) ;
1013
- suffix2 = " + " + index [ 2 ] . toUpperCase ( ) ;
1012
+ suffix = `, ${ index [ 2 ] . toUpperCase ( ) } ` ;
1013
+ suffix2 = ` + ${ index [ 2 ] . toUpperCase ( ) } ` ;
1014
1014
}
1015
1015
switch ( param ) {
1016
1016
case "imm" :
@@ -1097,7 +1097,7 @@ function makeCpuFunctions(cpu, opcodes, is65c12) {
1097
1097
ig . append ( "const addr = cpu.getb() | 0;" ) ;
1098
1098
} else {
1099
1099
ig . tick ( 3 ) ;
1100
- ig . append ( " const addr = (cpu.getb() + cpu." + arg [ 3 ] + " ) & 0xff;" ) ;
1100
+ ig . append ( ` const addr = (cpu.getb() + cpu.${ arg [ 3 ] } ) & 0xff;` ) ;
1101
1101
}
1102
1102
if ( op . read ) {
1103
1103
ig . zpReadOp ( "addr" , "REG" ) ;
@@ -1124,7 +1124,7 @@ function makeCpuFunctions(cpu, opcodes, is65c12) {
1124
1124
case "abs,x" :
1125
1125
case "abs,y" :
1126
1126
ig . append ( "const addr = cpu.getw() | 0;" ) ;
1127
- ig . append ( " let addrWithCarry = (addr + cpu." + arg [ 4 ] + " ) & 0xffff;" ) ;
1127
+ ig . append ( ` let addrWithCarry = (addr + cpu.${ arg [ 4 ] } ) & 0xffff;` ) ;
1128
1128
ig . append ( "const addrNonCarry = (addr & 0xff00) | (addrWithCarry & 0xff);" ) ;
1129
1129
ig . tick ( 3 ) ;
1130
1130
ig = ig . split ( "addrWithCarry !== addrNonCarry" ) ;
@@ -1289,13 +1289,16 @@ function makeCpuFunctions(cpu, opcodes, is65c12) {
1289
1289
const opcode = opcodes [ opcodeNum ] ;
1290
1290
return (
1291
1291
indent +
1292
- [ '"use strict";' , "// " + utils . hexbyte ( opcodeNum ) + " - " + opcode + "\n" ]
1293
- . concat (
1294
- opcode
1295
- ? getInstruction ( opcode , ! ! needsReg )
1296
- : [ "this.invalidOpcode(cpu, 0x" + utils . hexbyte ( opcodeNum ) + ");" ] ,
1297
- )
1298
- . join ( "\n" + indent )
1292
+ [
1293
+ '"use strict";' ,
1294
+ `// ${ utils . hexbyte ( opcodeNum ) } - ${ opcode }
1295
+ ` ,
1296
+ ] . concat (
1297
+ opcode
1298
+ ? getInstruction ( opcode , ! ! needsReg )
1299
+ : [ `this.invalidOpcode(cpu, 0x${ utils . hexbyte ( opcodeNum ) } );` ] ,
1300
+ ) . join ( `
1301
+ ${ indent } `)
1299
1302
) ;
1300
1303
}
1301
1304
0 commit comments