BASIC compiler/interpreter for PIC32MX/MZ-80K
Revisão | 2bd0bd042f5525f1d391fc6e5b9ce88cabf8630e (tree) |
---|---|
Hora | 2019-05-03 05:25:13 |
Autor | Katsumi <kmorimatsu@sour...> |
Commiter | Katsumi |
MachiKania web _ver0067
@@ -46,3 +46,9 @@ display.all=function(){ | ||
46 | 46 | } |
47 | 47 | } |
48 | 48 | }; |
49 | +display.show=function(msec){ | |
50 | + setTimeout(function(){ | |
51 | + display.all(); | |
52 | + setTimeout(arguments.callee,msec); | |
53 | + },msec); | |
54 | +}; |
@@ -410,8 +410,15 @@ filesystem.FSchdir=function(path){ | ||
410 | 410 | } |
411 | 411 | }; |
412 | 412 | filesystem.FSremove=function(fileName){ |
413 | -//int FSremove (const char * fileName); | |
414 | -alert('remove'); | |
413 | + //int FSremove (const char * fileName); | |
414 | + // Check file name | |
415 | + fileName=this.checkFileName(this.toString(fileName)); | |
416 | + if (typeof this.curdir[fileName]=='string') { | |
417 | + delete this.curdir[fileName]; | |
418 | + return 0; | |
419 | + } else { | |
420 | + return -1; | |
421 | + } | |
415 | 422 | }; |
416 | 423 | filesystem.FSrename=function(fileName,fo){ |
417 | 424 | //int FSrename (const char * fileName, FSFILE * fo); |
@@ -142,14 +142,14 @@ keyboard.vk2asc1_en=[ | ||
142 | 142 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
143 | 143 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
144 | 144 | ' ' ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
145 | - '0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,0x00,0x00,0x00,0x00,0x00,0x00, | |
145 | + '0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,0x00,';' ,0x00,'=' ,0x00,0x00, | |
146 | 146 | 0x00,'a' ,'b' ,'c' ,'d' ,'e' ,'f' ,'g' ,'h' ,'i' ,'j' ,'k' ,'l' ,'m' ,'n' ,'o' , |
147 | 147 | 'p' ,'q' ,'r' ,'s' ,'t' ,'u' ,'v' ,'w' ,'x' ,'y' ,'z' ,0x00,0x00,0x00,0x00,0x00, |
148 | 148 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'*' ,'+' ,0x00,'-' ,0x00,'/' , |
149 | 149 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
150 | 150 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
151 | 151 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
152 | - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
152 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'-' ,0x00,0x00, | |
153 | 153 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,';' ,'=' ,',' ,'-' ,'.' ,'/' , |
154 | 154 | '`' ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
155 | 155 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'[' ,'\\',']' ,0x27,0x00, |
@@ -161,14 +161,14 @@ keyboard.vk2asc2_en=[ | ||
161 | 161 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
162 | 162 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
163 | 163 | ' ' ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
164 | - ')' ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,0x00,0x00,0x00,0x00,0x00,0x00, | |
164 | + ')' ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,0x00,':' ,0x00,'+' ,0x00,0x00, | |
165 | 165 | 0x00,'A' ,'B' ,'C' ,'D' ,'E' ,'F' ,'G' ,'H' ,'I' ,'J' ,'K' ,'L' ,'M' ,'N' ,'O' , |
166 | 166 | 'P' ,'Q' ,'R' ,'S' ,'T' ,'U' ,'V' ,'W' ,'X' ,'Y' ,'Z' ,0x00,0x00,0x00,0x00,0x00, |
167 | 167 | '0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,'*' ,'+' ,0x00,'-' ,'.' ,'/' , |
168 | 168 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
169 | 169 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
170 | 170 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
171 | - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
171 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'_' ,0x00,0x00, | |
172 | 172 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,':' ,'+' ,'<' ,'_' ,'>' ,'?' , |
173 | 173 | '~' ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
174 | 174 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'{' ,'|' ,'}' ,0x22,0x00, |
@@ -12,6 +12,9 @@ display.all(); | ||
12 | 12 | system.reset('MACHIKAM.HEX'); |
13 | 13 | |
14 | 14 | main=function(maxspeed,breakpoint){ |
15 | + // Show display every 40 msec (25 frames/sec) | |
16 | + display.show(40); | |
17 | + // Preare for MIPS32 | |
15 | 18 | maxspeed=parseInt(maxspeed); |
16 | 19 | breakpoint=parseInt(breakpoint); |
17 | 20 | var speed=1; |
@@ -48,7 +51,6 @@ main=function(maxspeed,breakpoint){ | ||
48 | 51 | // Things to do every 16 msec |
49 | 52 | if (16<time-lastint) { |
50 | 53 | // Refresh somethings every 15 msec |
51 | - display.all(); | |
52 | 54 | // Interrupts |
53 | 55 | // Always for T2 (vector 9) and CS0 (vector 1) |
54 | 56 | SFR.IFS0SET((1<<9)+(1<<1)); |
@@ -228,12 +228,11 @@ mips32.exec=function(){ | ||
228 | 228 | this.rs=code&0x1f; |
229 | 229 | code=(code>>5)&0x3f; |
230 | 230 | this.mnh=code; |
231 | - var mnemonic=this.commands[code]; | |
232 | - if (mnemonic) { | |
233 | - return this[mnemonic](); | |
234 | - } else { | |
235 | - this.log("Invalid command:0x"+code.toString(16)); | |
236 | - } | |
231 | + // Execute the function | |
232 | + return this[this.commands[code]](); | |
233 | +}; | |
234 | +mips32.void=function(){ | |
235 | + this.log("Invalid command:0x"+this.code.toString(16)); | |
237 | 236 | }; |
238 | 237 | mips32.commands=[ |
239 | 238 | "execSpecial", //000000 |
@@ -253,20 +252,20 @@ mips32.commands=[ | ||
253 | 252 | "XORI", //001110 |
254 | 253 | "LUI", //001111 |
255 | 254 | "execCop0", //010000 |
256 | - "", //010001 | |
257 | - "", //010010 | |
258 | - "", //010011 | |
255 | + "void", //010001 | |
256 | + "void", //010010 | |
257 | + "void", //010011 | |
259 | 258 | "BEQL", //010100 |
260 | 259 | "BNEL", //010101 |
261 | 260 | "BLEZL", //010110 |
262 | 261 | "BGTZL", //010111 |
263 | - "", //011000 | |
264 | - "", //011001 | |
265 | - "", //011010 | |
266 | - "", //011011 | |
262 | + "void", //011000 | |
263 | + "void", //011001 | |
264 | + "void", //011010 | |
265 | + "void", //011011 | |
267 | 266 | "execSpecial2",//011100 |
268 | - "", //011101 | |
269 | - "", //011110 | |
267 | + "void", //011101 | |
268 | + "void", //011110 | |
270 | 269 | "execSpecial3",//011111 |
271 | 270 | "LB", //100000 |
272 | 271 | "LH", //100001 |
@@ -275,39 +274,39 @@ mips32.commands=[ | ||
275 | 274 | "LBU", //100100 |
276 | 275 | "LHU", //100101 |
277 | 276 | "LWR", //100110 |
278 | - "", //100111 | |
277 | + "void", //100111 | |
279 | 278 | "SB", //101000 |
280 | 279 | "SH", //101001 |
281 | 280 | "SWL", //101010 |
282 | 281 | "SW", //101011 |
283 | - "", //101100 | |
284 | - "", //101101 | |
282 | + "void", //101100 | |
283 | + "void", //101101 | |
285 | 284 | "SWR", //101110 |
286 | 285 | "CACHE", //101111 |
287 | 286 | "LL", //110000 |
288 | - "", //110001 | |
289 | - "", //110010 | |
287 | + "void", //110001 | |
288 | + "void", //110010 | |
290 | 289 | "PREF", //110011 |
291 | - "", //110100 | |
292 | - "", //110101 | |
293 | - "", //110110 | |
294 | - "", //110111 | |
290 | + "void", //110100 | |
291 | + "void", //110101 | |
292 | + "void", //110110 | |
293 | + "void", //110111 | |
295 | 294 | "SC", //111000 |
296 | - "", //111001 | |
297 | - "", //111010 | |
298 | - "", //111011 | |
299 | - "", //111100 | |
300 | - "", //111101 | |
301 | - "", //111110 | |
302 | - "", //111111 | |
295 | + "void", //111001 | |
296 | + "void", //111010 | |
297 | + "void", //111011 | |
298 | + "void", //111100 | |
299 | + "void", //111101 | |
300 | + "void", //111110 | |
301 | + "void", //111111 | |
303 | 302 | ]; |
304 | 303 | mips32.commandsSp=[ |
305 | 304 | "SLL", //000000 |
306 | - "", //000001 | |
305 | + "void", //000001 | |
307 | 306 | "SRL", //000010 |
308 | 307 | "SRA", //000011 |
309 | 308 | "SLLV", //000100 |
310 | - "", //000101 | |
309 | + "void", //000101 | |
311 | 310 | "SRLV", //000110 |
312 | 311 | "SRAV", //000111 |
313 | 312 | "JR", //001000 |
@@ -316,24 +315,24 @@ mips32.commandsSp=[ | ||
316 | 315 | "MOVN", //001011 |
317 | 316 | "SYSCALL", //001100 |
318 | 317 | "BREAK", //001101 |
319 | - "", //001110 | |
318 | + "void", //001110 | |
320 | 319 | "SYNC", //001111 |
321 | 320 | "MFHI", //010000 |
322 | 321 | "MTHI", //010001 |
323 | 322 | "MFLO", //010010 |
324 | 323 | "MTLO", //010011 |
325 | - "", //010100 | |
326 | - "", //010101 | |
327 | - "", //010110 | |
328 | - "", //010111 | |
324 | + "void", //010100 | |
325 | + "void", //010101 | |
326 | + "void", //010110 | |
327 | + "void", //010111 | |
329 | 328 | "MULT", //011000 |
330 | 329 | "MULTU", //011001 |
331 | 330 | "DIV", //011010 |
332 | 331 | "DIVU", //011011 |
333 | - "", //011100 | |
334 | - "", //011101 | |
335 | - "", //011110 | |
336 | - "", //011111 | |
332 | + "void", //011100 | |
333 | + "void", //011101 | |
334 | + "void", //011110 | |
335 | + "void", //011111 | |
337 | 336 | "ADD", //100000 |
338 | 337 | "ADDU", //100001 |
339 | 338 | "SUB", //100010 |
@@ -342,309 +341,293 @@ mips32.commandsSp=[ | ||
342 | 341 | "OR", //100101 |
343 | 342 | "XOR", //100110 |
344 | 343 | "NOR", //100111 |
345 | - "", //101000 | |
346 | - "", //101001 | |
344 | + "void", //101000 | |
345 | + "void", //101001 | |
347 | 346 | "SLT", //101010 |
348 | 347 | "SLTU", //101011 |
349 | - "", //101100 | |
350 | - "", //101101 | |
351 | - "", //101110 | |
352 | - "", //101111 | |
348 | + "void", //101100 | |
349 | + "void", //101101 | |
350 | + "void", //101110 | |
351 | + "void", //101111 | |
353 | 352 | "TGE", //110000 |
354 | 353 | "TGEU", //110001 |
355 | 354 | "TLT", //110010 |
356 | 355 | "TLTU", //110011 |
357 | 356 | "TEQ", //110100 |
358 | - "", //110101 | |
357 | + "void", //110101 | |
359 | 358 | "TNE", //110110 |
360 | - "", //110111 | |
361 | - "", //111000 | |
362 | - "", //111001 | |
363 | - "", //111010 | |
364 | - "", //111011 | |
365 | - "", //111100 | |
366 | - "", //111101 | |
367 | - "", //111110 | |
368 | - "", //111111 | |
359 | + "void", //110111 | |
360 | + "void", //111000 | |
361 | + "void", //111001 | |
362 | + "void", //111010 | |
363 | + "void", //111011 | |
364 | + "void", //111100 | |
365 | + "void", //111101 | |
366 | + "void", //111110 | |
367 | + "void", //111111 | |
369 | 368 | ]; |
370 | 369 | mips32.commandsBr=[ |
371 | 370 | "BLTZ", //00000 |
372 | 371 | "BGEZ", //00001 |
373 | 372 | "BLTZL", //00010 |
374 | 373 | "BGEZL", //00011 |
375 | - "", //00100 | |
376 | - "", //00101 | |
377 | - "", //00110 | |
378 | - "", //00111 | |
374 | + "void", //00100 | |
375 | + "void", //00101 | |
376 | + "void", //00110 | |
377 | + "void", //00111 | |
379 | 378 | "TGEI", //01000 |
380 | 379 | "TGEIU", //01001 |
381 | 380 | "TLTI", //01010 |
382 | 381 | "TLTIU", //01011 |
383 | 382 | "TEQI", //01100 |
384 | - "", //01101 | |
383 | + "void", //01101 | |
385 | 384 | "TNEI", //01110 |
386 | - "", //01111 | |
385 | + "void", //01111 | |
387 | 386 | "BLTZAL", //10000 |
388 | 387 | "BGEZAL", //10001 |
389 | 388 | "BLTZALL", //10010 |
390 | 389 | "BGEZALL", //10011 |
391 | - "", //10100 | |
392 | - "", //10101 | |
393 | - "", //10110 | |
394 | - "", //10111 | |
395 | - "", //11000 | |
396 | - "", //11001 | |
397 | - "", //11010 | |
398 | - "", //11011 | |
399 | - "", //11100 | |
400 | - "", //11101 | |
401 | - "", //11110 | |
402 | - "", //11111 | |
390 | + "void", //10100 | |
391 | + "void", //10101 | |
392 | + "void", //10110 | |
393 | + "void", //10111 | |
394 | + "void", //11000 | |
395 | + "void", //11001 | |
396 | + "void", //11010 | |
397 | + "void", //11011 | |
398 | + "void", //11100 | |
399 | + "void", //11101 | |
400 | + "void", //11110 | |
401 | + "void", //11111 | |
403 | 402 | ]; |
404 | 403 | mips32.commandsSp2=[ |
405 | 404 | "MADD", //000000 |
406 | 405 | "MADDU", //000001 |
407 | 406 | "MUL", //000010 |
408 | - "", //000011 | |
407 | + "void", //000011 | |
409 | 408 | "MSUB", //000100 |
410 | 409 | "MSUBU", //000101 |
411 | - "", //000110 | |
412 | - "", //000111 | |
413 | - "", //001000 | |
414 | - "", //001001 | |
415 | - "", //001010 | |
416 | - "", //001011 | |
417 | - "", //001100 | |
418 | - "", //001101 | |
419 | - "", //001110 | |
420 | - "", //001111 | |
421 | - "", //010000 | |
422 | - "", //010001 | |
423 | - "", //010010 | |
424 | - "", //010011 | |
425 | - "", //010100 | |
426 | - "", //010101 | |
427 | - "", //010110 | |
428 | - "", //010111 | |
429 | - "", //011000 | |
430 | - "", //011001 | |
431 | - "", //011010 | |
432 | - "", //011011 | |
433 | - "", //011100 | |
434 | - "", //011101 | |
435 | - "", //011110 | |
436 | - "", //011111 | |
410 | + "void", //000110 | |
411 | + "void", //000111 | |
412 | + "void", //001000 | |
413 | + "void", //001001 | |
414 | + "void", //001010 | |
415 | + "void", //001011 | |
416 | + "void", //001100 | |
417 | + "void", //001101 | |
418 | + "void", //001110 | |
419 | + "void", //001111 | |
420 | + "void", //010000 | |
421 | + "void", //010001 | |
422 | + "void", //010010 | |
423 | + "void", //010011 | |
424 | + "void", //010100 | |
425 | + "void", //010101 | |
426 | + "void", //010110 | |
427 | + "void", //010111 | |
428 | + "void", //011000 | |
429 | + "void", //011001 | |
430 | + "void", //011010 | |
431 | + "void", //011011 | |
432 | + "void", //011100 | |
433 | + "void", //011101 | |
434 | + "void", //011110 | |
435 | + "void", //011111 | |
437 | 436 | "CLZ", //100000 |
438 | 437 | "CLO", //100001 |
439 | - "", //100010 | |
440 | - "", //100011 | |
441 | - "", //100100 | |
442 | - "", //100101 | |
443 | - "", //100110 | |
444 | - "", //100111 | |
445 | - "", //101000 | |
446 | - "", //101001 | |
447 | - "", //101010 | |
448 | - "", //101011 | |
449 | - "", //101100 | |
450 | - "", //101101 | |
451 | - "", //101110 | |
452 | - "", //101111 | |
453 | - "", //110000 | |
454 | - "", //110001 | |
455 | - "", //110010 | |
456 | - "", //110011 | |
457 | - "", //110100 | |
458 | - "", //110101 | |
459 | - "", //110110 | |
460 | - "", //110111 | |
461 | - "", //111000 | |
462 | - "", //111001 | |
463 | - "", //111010 | |
464 | - "", //111011 | |
465 | - "", //111100 | |
466 | - "", //111101 | |
467 | - "", //111110 | |
438 | + "void", //100010 | |
439 | + "void", //100011 | |
440 | + "void", //100100 | |
441 | + "void", //100101 | |
442 | + "void", //100110 | |
443 | + "void", //100111 | |
444 | + "void", //101000 | |
445 | + "void", //101001 | |
446 | + "void", //101010 | |
447 | + "void", //101011 | |
448 | + "void", //101100 | |
449 | + "void", //101101 | |
450 | + "void", //101110 | |
451 | + "void", //101111 | |
452 | + "void", //110000 | |
453 | + "void", //110001 | |
454 | + "void", //110010 | |
455 | + "void", //110011 | |
456 | + "void", //110100 | |
457 | + "void", //110101 | |
458 | + "void", //110110 | |
459 | + "void", //110111 | |
460 | + "void", //111000 | |
461 | + "void", //111001 | |
462 | + "void", //111010 | |
463 | + "void", //111011 | |
464 | + "void", //111100 | |
465 | + "void", //111101 | |
466 | + "void", //111110 | |
468 | 467 | "SDBBP", //111111 |
469 | 468 | ]; |
470 | 469 | mips32.commandsSp3=[ |
471 | 470 | "EXT", //000000 |
472 | - "", //000001 | |
473 | - "", //000010 | |
474 | - "", //000011 | |
471 | + "void", //000001 | |
472 | + "void", //000010 | |
473 | + "void", //000011 | |
475 | 474 | "INS", //000100 |
476 | - "", //000101 | |
477 | - "", //000110 | |
478 | - "", //000111 | |
479 | - "", //001000 | |
480 | - "", //001001 | |
481 | - "", //001010 | |
482 | - "", //001011 | |
483 | - "", //001100 | |
484 | - "", //001101 | |
485 | - "", //001110 | |
486 | - "", //001111 | |
487 | - "", //010000 | |
488 | - "", //010001 | |
489 | - "", //010010 | |
490 | - "", //010011 | |
491 | - "", //010100 | |
492 | - "", //010101 | |
493 | - "", //010110 | |
494 | - "", //010111 | |
495 | - "", //011000 | |
496 | - "", //011001 | |
497 | - "", //011010 | |
498 | - "", //011011 | |
499 | - "", //011100 | |
500 | - "", //011101 | |
501 | - "", //011110 | |
502 | - "", //011111 | |
503 | - "", //100000 | |
504 | - "", //100001 | |
505 | - "", //100010 | |
506 | - "", //100011 | |
507 | - "", //100100 | |
508 | - "", //100101 | |
509 | - "", //100110 | |
510 | - "", //100111 | |
511 | - "", //101000 | |
512 | - "", //101001 | |
513 | - "", //101010 | |
514 | - "", //101011 | |
515 | - "", //101100 | |
516 | - "", //101101 | |
517 | - "", //101110 | |
518 | - "", //101111 | |
519 | - "", //110000 | |
520 | - "", //110001 | |
521 | - "", //110010 | |
522 | - "", //110011 | |
523 | - "", //110100 | |
524 | - "", //110101 | |
525 | - "", //110110 | |
526 | - "", //110111 | |
527 | - "", //111000 | |
528 | - "", //111001 | |
529 | - "", //111010 | |
530 | - "", //111011 | |
531 | - "", //111100 | |
532 | - "", //111101 | |
533 | - "", //111110 | |
534 | - "", //111111 | |
475 | + "void", //000101 | |
476 | + "void", //000110 | |
477 | + "void", //000111 | |
478 | + "void", //001000 | |
479 | + "void", //001001 | |
480 | + "void", //001010 | |
481 | + "void", //001011 | |
482 | + "void", //001100 | |
483 | + "void", //001101 | |
484 | + "void", //001110 | |
485 | + "void", //001111 | |
486 | + "void", //010000 | |
487 | + "void", //010001 | |
488 | + "void", //010010 | |
489 | + "void", //010011 | |
490 | + "void", //010100 | |
491 | + "void", //010101 | |
492 | + "void", //010110 | |
493 | + "void", //010111 | |
494 | + "void", //011000 | |
495 | + "void", //011001 | |
496 | + "void", //011010 | |
497 | + "void", //011011 | |
498 | + "void", //011100 | |
499 | + "void", //011101 | |
500 | + "void", //011110 | |
501 | + "void", //011111 | |
502 | + "void", //100000 | |
503 | + "void", //100001 | |
504 | + "void", //100010 | |
505 | + "void", //100011 | |
506 | + "void", //100100 | |
507 | + "void", //100101 | |
508 | + "void", //100110 | |
509 | + "void", //100111 | |
510 | + "void", //101000 | |
511 | + "void", //101001 | |
512 | + "void", //101010 | |
513 | + "void", //101011 | |
514 | + "void", //101100 | |
515 | + "void", //101101 | |
516 | + "void", //101110 | |
517 | + "void", //101111 | |
518 | + "void", //110000 | |
519 | + "void", //110001 | |
520 | + "void", //110010 | |
521 | + "void", //110011 | |
522 | + "void", //110100 | |
523 | + "void", //110101 | |
524 | + "void", //110110 | |
525 | + "void", //110111 | |
526 | + "void", //111000 | |
527 | + "void", //111001 | |
528 | + "void", //111010 | |
529 | + "void", //111011 | |
530 | + "void", //111100 | |
531 | + "void", //111101 | |
532 | + "void", //111110 | |
533 | + "void", //111111 | |
535 | 534 | ]; |
536 | 535 | mips32.commandsCp0=[ |
537 | - "", //000000 | |
536 | + "void", //000000 | |
538 | 537 | "TLBR", //000001 |
539 | 538 | "TLBWI", //000010 |
540 | - "", //000011 | |
541 | - "", //000100 | |
542 | - "", //000101 | |
539 | + "void", //000011 | |
540 | + "void", //000100 | |
541 | + "void", //000101 | |
543 | 542 | "TLBWR", //000110 |
544 | - "", //000111 | |
543 | + "void", //000111 | |
545 | 544 | "TLBP", //001000 |
546 | - "", //001001 | |
547 | - "", //001010 | |
548 | - "", //001011 | |
549 | - "", //001100 | |
550 | - "", //001101 | |
551 | - "", //001110 | |
552 | - "", //001111 | |
553 | - "", //010000 | |
554 | - "", //010001 | |
555 | - "", //010010 | |
556 | - "", //010011 | |
557 | - "", //010100 | |
558 | - "", //010101 | |
559 | - "", //010110 | |
560 | - "", //010111 | |
545 | + "void", //001001 | |
546 | + "void", //001010 | |
547 | + "void", //001011 | |
548 | + "void", //001100 | |
549 | + "void", //001101 | |
550 | + "void", //001110 | |
551 | + "void", //001111 | |
552 | + "void", //010000 | |
553 | + "void", //010001 | |
554 | + "void", //010010 | |
555 | + "void", //010011 | |
556 | + "void", //010100 | |
557 | + "void", //010101 | |
558 | + "void", //010110 | |
559 | + "void", //010111 | |
561 | 560 | "ERET", //011000 |
562 | - "", //011001 | |
563 | - "", //011010 | |
564 | - "", //011011 | |
565 | - "", //011100 | |
566 | - "", //011101 | |
567 | - "", //011110 | |
561 | + "void", //011001 | |
562 | + "void", //011010 | |
563 | + "void", //011011 | |
564 | + "void", //011100 | |
565 | + "void", //011101 | |
566 | + "void", //011110 | |
568 | 567 | "DERET", //011111 |
569 | 568 | "WAIT", //100000 |
570 | - "", //100001 | |
571 | - "", //100010 | |
572 | - "", //100011 | |
573 | - "", //100100 | |
574 | - "", //100101 | |
575 | - "", //100110 | |
576 | - "", //100111 | |
577 | - "", //101000 | |
578 | - "", //101001 | |
579 | - "", //101010 | |
580 | - "", //101011 | |
581 | - "", //101100 | |
582 | - "", //101101 | |
583 | - "", //101110 | |
584 | - "", //101111 | |
585 | - "", //110000 | |
586 | - "", //110001 | |
587 | - "", //110010 | |
588 | - "", //110011 | |
589 | - "", //110100 | |
590 | - "", //110101 | |
591 | - "", //110110 | |
592 | - "", //110111 | |
593 | - "", //111000 | |
594 | - "", //111001 | |
595 | - "", //111010 | |
596 | - "", //111011 | |
597 | - "", //111100 | |
598 | - "", //111101 | |
599 | - "", //111110 | |
600 | - "", //111111 | |
569 | + "void", //100001 | |
570 | + "void", //100010 | |
571 | + "void", //100011 | |
572 | + "void", //100100 | |
573 | + "void", //100101 | |
574 | + "void", //100110 | |
575 | + "void", //100111 | |
576 | + "void", //101000 | |
577 | + "void", //101001 | |
578 | + "void", //101010 | |
579 | + "void", //101011 | |
580 | + "void", //101100 | |
581 | + "void", //101101 | |
582 | + "void", //101110 | |
583 | + "void", //101111 | |
584 | + "void", //110000 | |
585 | + "void", //110001 | |
586 | + "void", //110010 | |
587 | + "void", //110011 | |
588 | + "void", //110100 | |
589 | + "void", //110101 | |
590 | + "void", //110110 | |
591 | + "void", //110111 | |
592 | + "void", //111000 | |
593 | + "void", //111001 | |
594 | + "void", //111010 | |
595 | + "void", //111011 | |
596 | + "void", //111100 | |
597 | + "void", //111101 | |
598 | + "void", //111110 | |
599 | + "void", //111111 | |
601 | 600 | ]; |
602 | 601 | mips32.commandsCp0Rs=[ |
603 | 602 | "MFC0", //00000 |
604 | - "", //00001 | |
605 | - "", //00010 | |
606 | - "", //00011 | |
603 | + "void", //00001 | |
604 | + "void", //00010 | |
605 | + "void", //00011 | |
607 | 606 | "MTC0", //00100 |
608 | - "", //00101 | |
609 | - "", //00110 | |
610 | - "", //00111 | |
611 | - "", //01000 | |
612 | - "", //01001 | |
607 | + "void", //00101 | |
608 | + "void", //00110 | |
609 | + "void", //00111 | |
610 | + "void", //01000 | |
611 | + "void", //01001 | |
613 | 612 | "RDPGPR", //01010 |
614 | - "", //01011 | |
615 | - "", //01100 | |
616 | - "", //01101 | |
613 | + "void", //01011 | |
614 | + "void", //01100 | |
615 | + "void", //01101 | |
617 | 616 | "WRPGPR", //01110 |
618 | - "", //01!11 | |
617 | + "void", //01!11 | |
619 | 618 | ]; |
620 | 619 | mips32.execSpecial=function(){ |
621 | - var mnemonic=this.commandsSp[this.mnl]; | |
622 | - if (mnemonic) { | |
623 | - return this[mnemonic](); | |
624 | - } else { | |
625 | - this.log("Invalid command:\n Special 0x"+this.mnl.toString(16)); | |
626 | - } | |
620 | + return this[this.commandsSp[this.mnl]](); | |
627 | 621 | }; |
628 | 622 | mips32.execBranch=function(){ |
629 | - var mnemonic=this.commandsSp[this.rt]; | |
630 | - if (mnemonic) { | |
631 | - return this[mnemonic](); | |
632 | - } else { | |
633 | - this.log("Invalid command:\n Branch 0x"+this.mnl.toString(16)); | |
634 | - } | |
623 | + return this[this.commandsBr[this.rt]](); | |
635 | 624 | }; |
636 | 625 | mips32.execCop0=function(){ |
637 | 626 | if (this.rs&0x10) { // CO (25th bit) is 1 |
638 | - var mnemonic=this.commandsCp0[this.mnl]; | |
639 | - if (mnemonic) { | |
640 | - return this[mnemonic](); | |
641 | - } else { | |
642 | - this.log("Invalid command:\n COP0 0x"+this.mnl.toString(16)); | |
643 | - return; | |
644 | - } | |
627 | + return this[this.commandsCp0[this.mnl]](); | |
645 | 628 | } else { // CO (25th bit) is 0 |
646 | 629 | var mnemonic=this.commandsCp0Rs[this.rs]; |
647 | - if (mnemonic) { | |
630 | + if (mnemonic!='void') { | |
648 | 631 | return this[mnemonic](); |
649 | 632 | } |
650 | 633 | if (this.rs==0x0b) { |
@@ -655,20 +638,10 @@ mips32.execCop0=function(){ | ||
655 | 638 | } |
656 | 639 | }; |
657 | 640 | mips32.execSpecial2=function(){ |
658 | - var mnemonic=this.commandsSp2[this.mnl]; | |
659 | - if (mnemonic) { | |
660 | - return this[mnemonic](); | |
661 | - } else { | |
662 | - this.log("Invalid command:\n Special2 0x"+this.mnl.toString(16)); | |
663 | - } | |
641 | + return this[this.commandsSp2[this.mnl]](); | |
664 | 642 | }; |
665 | 643 | mips32.execSpecial3=function(){ |
666 | - var mnemonic=this.commandsSp3[this.mnl]; | |
667 | - if (mnemonic) { | |
668 | - return this[mnemonic](); | |
669 | - } else { | |
670 | - this.log("Invalid command:\n Special3 0x"+this.mnl.toString(16)); | |
671 | - } | |
644 | + return this[this.commandsSp3[this.mnl]](); | |
672 | 645 | }; |
673 | 646 | mips32.ADD=function(){ |
674 | 647 | var rs=this.GPR.signed(this.rs); |