-
Notifications
You must be signed in to change notification settings - Fork 1
/
gbemu-part2.js
9780 lines (9756 loc) · 454 KB
/
gbemu-part2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Portions copyright 2013 Google, Inc
// Copyright (C) 2010 - 2012 Grant Galitz
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
// The full license is available at http://www.gnu.org/licenses/gpl.html
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
// The code has been adapted for use as a benchmark by Google.
// Previous files are in gbemu-part1.js, since they need to run in sloppy mode.
// Start of js/GameBoyCore.js file.
"use strict";
/*
* JavaScript GameBoy Color Emulator
* Copyright (C) 2010 - 2012 Grant Galitz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
* The full license is available at http://www.gnu.org/licenses/gpl.html
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
function GameBoyCore(canvas, ROMImage) {
//Params, etc...
this.canvas = canvas; //Canvas DOM object for drawing out the graphics to.
this.drawContext = null; // LCD Context
this.ROMImage = ROMImage; //The game's ROM.
//CPU Registers and Flags:
this.registerA = 0x01; //Register A (Accumulator)
this.FZero = true; //Register F - Result was zero
this.FSubtract = false; //Register F - Subtraction was executed
this.FHalfCarry = true; //Register F - Half carry or half borrow
this.FCarry = true; //Register F - Carry or borrow
this.registerB = 0x00; //Register B
this.registerC = 0x13; //Register C
this.registerD = 0x00; //Register D
this.registerE = 0xD8; //Register E
this.registersHL = 0x014D; //Registers H and L combined
this.stackPointer = 0xFFFE; //Stack Pointer
this.programCounter = 0x0100; //Program Counter
//Some CPU Emulation State Variables:
this.CPUCyclesTotal = 0; //Relative CPU clocking to speed set, rounded appropriately.
this.CPUCyclesTotalBase = 0; //Relative CPU clocking to speed set base.
this.CPUCyclesTotalCurrent = 0; //Relative CPU clocking to speed set, the directly used value.
this.CPUCyclesTotalRoundoff = 0; //Clocking per iteration rounding catch.
this.baseCPUCyclesPerIteration = 0; //CPU clocks per iteration at 1x speed.
this.remainingClocks = 0; //HALT clocking overrun carry over.
this.inBootstrap = true; //Whether we're in the GBC boot ROM.
this.usedBootROM = false; //Updated upon ROM loading...
this.usedGBCBootROM = false; //Did we boot to the GBC boot ROM?
this.halt = false; //Has the CPU been suspended until the next interrupt?
this.skipPCIncrement = false; //Did we trip the DMG Halt bug?
this.stopEmulator = 3; //Has the emulation been paused or a frame has ended?
this.IME = true; //Are interrupts enabled?
this.IRQLineMatched = 0; //CPU IRQ assertion.
this.interruptsRequested = 0; //IF Register
this.interruptsEnabled = 0; //IE Register
this.hdmaRunning = false; //HDMA Transfer Flag - GBC only
this.CPUTicks = 0; //The number of clock cycles emulated.
this.doubleSpeedShifter = 0; //GBC double speed clocking shifter.
this.JoyPad = 0xFF; //Joypad State (two four-bit states actually)
this.CPUStopped = false; //CPU STOP status.
//Main RAM, MBC RAM, GBC Main RAM, VRAM, etc.
this.memoryReader = []; //Array of functions mapped to read back memory
this.memoryWriter = []; //Array of functions mapped to write to memory
this.memoryHighReader = []; //Array of functions mapped to read back 0xFFXX memory
this.memoryHighWriter = []; //Array of functions mapped to write to 0xFFXX memory
this.ROM = []; //The full ROM file dumped to an array.
this.memory = []; //Main Core Memory
this.MBCRam = []; //Switchable RAM (Used by games for more RAM) for the main memory range 0xA000 - 0xC000.
this.VRAM = []; //Extra VRAM bank for GBC.
this.GBCMemory = []; //GBC main RAM Banks
this.MBC1Mode = false; //MBC1 Type (4/32, 16/8)
this.MBCRAMBanksEnabled = false; //MBC RAM Access Control.
this.currMBCRAMBank = 0; //MBC Currently Indexed RAM Bank
this.currMBCRAMBankPosition = -0xA000; //MBC Position Adder;
this.cGBC = false; //GameBoy Color detection.
this.gbcRamBank = 1; //Currently Switched GameBoy Color ram bank
this.gbcRamBankPosition = -0xD000; //GBC RAM offset from address start.
this.gbcRamBankPositionECHO = -0xF000; //GBC RAM (ECHO mirroring) offset from address start.
this.RAMBanks = [0, 1, 2, 4, 16]; //Used to map the RAM banks to maximum size the MBC used can do.
this.ROMBank1offs = 0; //Offset of the ROM bank switching.
this.currentROMBank = 0; //The parsed current ROM bank selection.
this.cartridgeType = 0; //Cartridge Type
this.name = ""; //Name of the game
this.gameCode = ""; //Game code (Suffix for older games)
this.fromSaveState = false; //A boolean to see if this was loaded in as a save state.
this.savedStateFileName = ""; //When loaded in as a save state, this will not be empty.
this.STATTracker = 0; //Tracker for STAT triggering.
this.modeSTAT = 0; //The scan line mode (for lines 1-144 it's 2-3-0, for 145-154 it's 1)
this.spriteCount = 252; //Mode 3 extra clocking counter (Depends on how many sprites are on the current line.).
this.LYCMatchTriggerSTAT = false; //Should we trigger an interrupt if LY==LYC?
this.mode2TriggerSTAT = false; //Should we trigger an interrupt if in mode 2?
this.mode1TriggerSTAT = false; //Should we trigger an interrupt if in mode 1?
this.mode0TriggerSTAT = false; //Should we trigger an interrupt if in mode 0?
this.LCDisOn = false; //Is the emulated LCD controller on?
this.LINECONTROL = []; //Array of functions to handle each scan line we do (onscreen + offscreen)
this.DISPLAYOFFCONTROL = [function (parentObj) {
//Array of line 0 function to handle the LCD controller when it's off (Do nothing!).
}];
this.LCDCONTROL = null; //Pointer to either LINECONTROL or DISPLAYOFFCONTROL.
this.initializeLCDController(); //Compile the LCD controller functions.
//RTC (Real Time Clock for MBC3):
this.RTCisLatched = false;
this.latchedSeconds = 0; //RTC latched seconds.
this.latchedMinutes = 0; //RTC latched minutes.
this.latchedHours = 0; //RTC latched hours.
this.latchedLDays = 0; //RTC latched lower 8-bits of the day counter.
this.latchedHDays = 0; //RTC latched high-bit of the day counter.
this.RTCSeconds = 0; //RTC seconds counter.
this.RTCMinutes = 0; //RTC minutes counter.
this.RTCHours = 0; //RTC hours counter.
this.RTCDays = 0; //RTC days counter.
this.RTCDayOverFlow = false; //Did the RTC overflow and wrap the day counter?
this.RTCHALT = false; //Is the RTC allowed to clock up?
//Gyro:
this.highX = 127;
this.lowX = 127;
this.highY = 127;
this.lowY = 127;
//Sound variables:
this.audioHandle = null; //XAudioJS handle
this.numSamplesTotal = 0; //Length of the sound buffers.
this.sampleSize = 0; //Length of the sound buffer for one channel.
this.dutyLookup = [ //Map the duty values given to ones we can work with.
[false, false, false, false, false, false, false, true],
[true, false, false, false, false, false, false, true],
[true, false, false, false, false, true, true, true],
[false, true, true, true, true, true, true, false]
];
this.currentBuffer = []; //The audio buffer we're working on.
this.bufferContainAmount = 0; //Buffer maintenance metric.
this.LSFR15Table = null;
this.LSFR7Table = null;
this.noiseSampleTable = null;
this.initializeAudioStartState();
this.soundMasterEnabled = false; //As its name implies
this.channel3PCM = null; //Channel 3 adjusted sample buffer.
//Vin Shit:
this.VinLeftChannelMasterVolume = 8; //Computed post-mixing volume.
this.VinRightChannelMasterVolume = 8; //Computed post-mixing volume.
//Channel paths enabled:
this.leftChannel1 = false;
this.leftChannel2 = false;
this.leftChannel3 = false;
this.leftChannel4 = false;
this.rightChannel1 = false;
this.rightChannel2 = false;
this.rightChannel3 = false;
this.rightChannel4 = false;
//Channel output level caches:
this.channel1currentSampleLeft = 0;
this.channel1currentSampleRight = 0;
this.channel2currentSampleLeft = 0;
this.channel2currentSampleRight = 0;
this.channel3currentSampleLeft = 0;
this.channel3currentSampleRight = 0;
this.channel4currentSampleLeft = 0;
this.channel4currentSampleRight = 0;
this.channel1currentSampleLeftSecondary = 0;
this.channel1currentSampleRightSecondary = 0;
this.channel2currentSampleLeftSecondary = 0;
this.channel2currentSampleRightSecondary = 0;
this.channel3currentSampleLeftSecondary = 0;
this.channel3currentSampleRightSecondary = 0;
this.channel4currentSampleLeftSecondary = 0;
this.channel4currentSampleRightSecondary = 0;
this.channel1currentSampleLeftTrimary = 0;
this.channel1currentSampleRightTrimary = 0;
this.channel2currentSampleLeftTrimary = 0;
this.channel2currentSampleRightTrimary = 0;
this.mixerOutputCache = 0;
//Pre-multipliers to cache some calculations:
this.initializeTiming();
this.machineOut = 0; //Premultiplier for audio samples per instruction.
//Audio generation counters:
this.audioTicks = 0; //Used to sample the audio system every x CPU instructions.
this.audioIndex = 0; //Used to keep alignment on audio generation.
this.rollover = 0; //Used to keep alignment on the number of samples to output (Realign from counter alias).
//Timing Variables
this.emulatorTicks = 0; //Times for how many instructions to execute before ending the loop.
this.DIVTicks = 56; //DIV Ticks Counter (Invisible lower 8-bit)
this.LCDTicks = 60; //Counter for how many instructions have been executed on a scanline so far.
this.timerTicks = 0; //Counter for the TIMA timer.
this.TIMAEnabled = false; //Is TIMA enabled?
this.TACClocker = 1024; //Timer Max Ticks
this.serialTimer = 0; //Serial IRQ Timer
this.serialShiftTimer = 0; //Serial Transfer Shift Timer
this.serialShiftTimerAllocated = 0; //Serial Transfer Shift Timer Refill
this.IRQEnableDelay = 0; //Are the interrupts on queue to be enabled?
var dateVar = new_Date(); // The line is changed for benchmarking.
this.lastIteration = dateVar.getTime();//The last time we iterated the main loop.
dateVar = new_Date(); // The line is changed for benchmarking.
this.firstIteration = dateVar.getTime();
this.iterations = 0;
this.actualScanLine = 0; //Actual scan line...
this.lastUnrenderedLine = 0; //Last rendered scan line...
this.queuedScanLines = 0;
this.totalLinesPassed = 0;
this.haltPostClocks = 0; //Post-Halt clocking.
//ROM Cartridge Components:
this.cMBC1 = false; //Does the cartridge use MBC1?
this.cMBC2 = false; //Does the cartridge use MBC2?
this.cMBC3 = false; //Does the cartridge use MBC3?
this.cMBC5 = false; //Does the cartridge use MBC5?
this.cMBC7 = false; //Does the cartridge use MBC7?
this.cSRAM = false; //Does the cartridge use save RAM?
this.cMMMO1 = false; //...
this.cRUMBLE = false; //Does the cartridge use the RUMBLE addressing (modified MBC5)?
this.cCamera = false; //Is the cartridge actually a GameBoy Camera?
this.cTAMA5 = false; //Does the cartridge use TAMA5? (Tamagotchi Cartridge)
this.cHuC3 = false; //Does the cartridge use HuC3 (Hudson Soft / modified MBC3)?
this.cHuC1 = false; //Does the cartridge use HuC1 (Hudson Soft / modified MBC1)?
this.cTIMER = false; //Does the cartridge have an RTC?
this.ROMBanks = [ // 1 Bank = 16 KBytes = 256 Kbits
2, 4, 8, 16, 32, 64, 128, 256, 512
];
this.ROMBanks[0x52] = 72;
this.ROMBanks[0x53] = 80;
this.ROMBanks[0x54] = 96;
this.numRAMBanks = 0; //How many RAM banks were actually allocated?
////Graphics Variables
this.currVRAMBank = 0; //Current VRAM bank for GBC.
this.backgroundX = 0; //Register SCX (X-Scroll)
this.backgroundY = 0; //Register SCY (Y-Scroll)
this.gfxWindowDisplay = false; //Is the windows enabled?
this.gfxSpriteShow = false; //Are sprites enabled?
this.gfxSpriteNormalHeight = true; //Are we doing 8x8 or 8x16 sprites?
this.bgEnabled = true; //Is the BG enabled?
this.BGPriorityEnabled = true; //Can we flag the BG for priority over sprites?
this.gfxWindowCHRBankPosition = 0; //The current bank of the character map the window uses.
this.gfxBackgroundCHRBankPosition = 0; //The current bank of the character map the BG uses.
this.gfxBackgroundBankOffset = 0x80; //Fast mapping of the tile numbering/
this.windowY = 0; //Current Y offset of the window.
this.windowX = 0; //Current X offset of the window.
this.drewBlank = 0; //To prevent the repeating of drawing a blank screen.
this.drewFrame = false; //Throttle how many draws we can do to once per iteration.
this.midScanlineOffset = -1; //mid-scanline rendering offset.
this.pixelEnd = 0; //track the x-coord limit for line rendering (mid-scanline usage).
this.currentX = 0; //The x-coord we left off at for mid-scanline rendering.
//BG Tile Pointer Caches:
this.BGCHRBank1 = null;
this.BGCHRBank2 = null;
this.BGCHRCurrentBank = null;
//Tile Data Cache:
this.tileCache = null;
//Palettes:
this.colors = [0xEFFFDE, 0xADD794, 0x529273, 0x183442]; //"Classic" GameBoy palette colors.
this.OBJPalette = null;
this.BGPalette = null;
this.gbcOBJRawPalette = null;
this.gbcBGRawPalette = null;
this.gbOBJPalette = null;
this.gbBGPalette = null;
this.gbcOBJPalette = null;
this.gbcBGPalette = null;
this.gbBGColorizedPalette = null;
this.gbOBJColorizedPalette = null;
this.cachedBGPaletteConversion = null;
this.cachedOBJPaletteConversion = null;
this.updateGBBGPalette = this.updateGBRegularBGPalette;
this.updateGBOBJPalette = this.updateGBRegularOBJPalette;
this.colorizedGBPalettes = false;
this.BGLayerRender = null; //Reference to the BG rendering function.
this.WindowLayerRender = null; //Reference to the window rendering function.
this.SpriteLayerRender = null; //Reference to the OAM rendering function.
this.frameBuffer = []; //The internal frame-buffer.
this.swizzledFrame = null; //The secondary gfx buffer that holds the converted RGBA values.
this.canvasBuffer = null; //imageData handle
this.pixelStart = 0; //Temp variable for holding the current working framebuffer offset.
//Variables used for scaling in JS:
this.onscreenWidth = this.offscreenWidth = 160;
this.onscreenHeight = this.offScreenheight = 144;
this.offscreenRGBCount = this.onscreenWidth * this.onscreenHeight * 4;
//Initialize the white noise cache tables ahead of time:
this.intializeWhiteNoise();
}
// Start of code changed for benchmarking (removed ROM):
GameBoyCore.prototype.GBBOOTROM = [];
GameBoyCore.prototype.GBCBOOTROM = [];
// End of code changed for benchmarking.
GameBoyCore.prototype.ffxxDump = [ //Dump of the post-BOOT I/O register state (From gambatte):
0x0F, 0x00, 0x7C, 0xFF, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01,
0x80, 0xBF, 0xF3, 0xFF, 0xBF, 0xFF, 0x3F, 0x00, 0xFF, 0xBF, 0x7F, 0xFF, 0x9F, 0xFF, 0xBF, 0xFF,
0xFF, 0x00, 0x00, 0xBF, 0x77, 0xF3, 0xF1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x91, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0xFF, 0xFE,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0xFF, 0xC1, 0x00, 0xFE, 0xFF, 0xFF, 0xFF,
0xF8, 0xFF, 0x00, 0x00, 0x00, 0x8F, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B, 0x03, 0x73, 0x00, 0x83, 0x00, 0x0C, 0x00, 0x0D,
0x00, 0x08, 0x11, 0x1F, 0x88, 0x89, 0x00, 0x0E, 0xDC, 0xCC, 0x6E, 0xE6, 0xDD, 0xDD, 0xD9, 0x99,
0xBB, 0xBB, 0x67, 0x63, 0x6E, 0x0E, 0xEC, 0xCC, 0xDD, 0xDC, 0x99, 0x9F, 0xBB, 0xB9, 0x33, 0x3E,
0x45, 0xEC, 0x52, 0xFA, 0x08, 0xB7, 0x07, 0x5D, 0x01, 0xFD, 0xC0, 0xFF, 0x08, 0xFC, 0x00, 0xE5,
0x0B, 0xF8, 0xC2, 0xCE, 0xF4, 0xF9, 0x0F, 0x7F, 0x45, 0x6D, 0x3D, 0xFE, 0x46, 0x97, 0x33, 0x5E,
0x08, 0xEF, 0xF1, 0xFF, 0x86, 0x83, 0x24, 0x74, 0x12, 0xFC, 0x00, 0x9F, 0xB4, 0xB7, 0x06, 0xD5,
0xD0, 0x7A, 0x00, 0x9E, 0x04, 0x5F, 0x41, 0x2F, 0x1D, 0x77, 0x36, 0x75, 0x81, 0xAA, 0x70, 0x3A,
0x98, 0xD1, 0x71, 0x02, 0x4D, 0x01, 0xC1, 0xFF, 0x0D, 0x00, 0xD3, 0x05, 0xF9, 0x00, 0x0B, 0x00
];
GameBoyCore.prototype.OPCODE = [
//NOP
//#0x00:
function (parentObj) {
//Do Nothing...
},
//LD BC, nn
//#0x01:
function (parentObj) {
parentObj.registerC = parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.registerB = parentObj.memoryRead((parentObj.programCounter + 1) & 0xFFFF);
parentObj.programCounter = (parentObj.programCounter + 2) & 0xFFFF;
},
//LD (BC), A
//#0x02:
function (parentObj) {
parentObj.memoryWrite((parentObj.registerB << 8) | parentObj.registerC, parentObj.registerA);
},
//INC BC
//#0x03:
function (parentObj) {
var temp_var = ((parentObj.registerB << 8) | parentObj.registerC) + 1;
parentObj.registerB = (temp_var >> 8) & 0xFF;
parentObj.registerC = temp_var & 0xFF;
},
//INC B
//#0x04:
function (parentObj) {
parentObj.registerB = (parentObj.registerB + 1) & 0xFF;
parentObj.FZero = (parentObj.registerB == 0);
parentObj.FHalfCarry = ((parentObj.registerB & 0xF) == 0);
parentObj.FSubtract = false;
},
//DEC B
//#0x05:
function (parentObj) {
parentObj.registerB = (parentObj.registerB - 1) & 0xFF;
parentObj.FZero = (parentObj.registerB == 0);
parentObj.FHalfCarry = ((parentObj.registerB & 0xF) == 0xF);
parentObj.FSubtract = true;
},
//LD B, n
//#0x06:
function (parentObj) {
parentObj.registerB = parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//RLCA
//#0x07:
function (parentObj) {
parentObj.FCarry = (parentObj.registerA > 0x7F);
parentObj.registerA = ((parentObj.registerA << 1) & 0xFF) | (parentObj.registerA >> 7);
parentObj.FZero = parentObj.FSubtract = parentObj.FHalfCarry = false;
},
//LD (nn), SP
//#0x08:
function (parentObj) {
var temp_var = (parentObj.memoryRead((parentObj.programCounter + 1) & 0xFFFF) << 8) | parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 2) & 0xFFFF;
parentObj.memoryWrite(temp_var, parentObj.stackPointer & 0xFF);
parentObj.memoryWrite((temp_var + 1) & 0xFFFF, parentObj.stackPointer >> 8);
},
//ADD HL, BC
//#0x09:
function (parentObj) {
var dirtySum = parentObj.registersHL + ((parentObj.registerB << 8) | parentObj.registerC);
parentObj.FHalfCarry = ((parentObj.registersHL & 0xFFF) > (dirtySum & 0xFFF));
parentObj.FCarry = (dirtySum > 0xFFFF);
parentObj.registersHL = dirtySum & 0xFFFF;
parentObj.FSubtract = false;
},
//LD A, (BC)
//#0x0A:
function (parentObj) {
parentObj.registerA = parentObj.memoryRead((parentObj.registerB << 8) | parentObj.registerC);
},
//DEC BC
//#0x0B:
function (parentObj) {
var temp_var = (((parentObj.registerB << 8) | parentObj.registerC) - 1) & 0xFFFF;
parentObj.registerB = temp_var >> 8;
parentObj.registerC = temp_var & 0xFF;
},
//INC C
//#0x0C:
function (parentObj) {
parentObj.registerC = (parentObj.registerC + 1) & 0xFF;
parentObj.FZero = (parentObj.registerC == 0);
parentObj.FHalfCarry = ((parentObj.registerC & 0xF) == 0);
parentObj.FSubtract = false;
},
//DEC C
//#0x0D:
function (parentObj) {
parentObj.registerC = (parentObj.registerC - 1) & 0xFF;
parentObj.FZero = (parentObj.registerC == 0);
parentObj.FHalfCarry = ((parentObj.registerC & 0xF) == 0xF);
parentObj.FSubtract = true;
},
//LD C, n
//#0x0E:
function (parentObj) {
parentObj.registerC = parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//RRCA
//#0x0F:
function (parentObj) {
parentObj.registerA = (parentObj.registerA >> 1) | ((parentObj.registerA & 1) << 7);
parentObj.FCarry = (parentObj.registerA > 0x7F);
parentObj.FZero = parentObj.FSubtract = parentObj.FHalfCarry = false;
},
//STOP
//#0x10:
function (parentObj) {
if (parentObj.cGBC) {
if ((parentObj.memory[0xFF4D] & 0x01) == 0x01) { //Speed change requested.
if (parentObj.memory[0xFF4D] > 0x7F) { //Go back to single speed mode.
cout("Going into single clock speed mode.", 0);
parentObj.doubleSpeedShifter = 0;
parentObj.memory[0xFF4D] &= 0x7F; //Clear the double speed mode flag.
}
else { //Go to double speed mode.
cout("Going into double clock speed mode.", 0);
parentObj.doubleSpeedShifter = 1;
parentObj.memory[0xFF4D] |= 0x80; //Set the double speed mode flag.
}
parentObj.memory[0xFF4D] &= 0xFE; //Reset the request bit.
}
else {
parentObj.handleSTOP();
}
}
else {
parentObj.handleSTOP();
}
},
//LD DE, nn
//#0x11:
function (parentObj) {
parentObj.registerE = parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.registerD = parentObj.memoryRead((parentObj.programCounter + 1) & 0xFFFF);
parentObj.programCounter = (parentObj.programCounter + 2) & 0xFFFF;
},
//LD (DE), A
//#0x12:
function (parentObj) {
parentObj.memoryWrite((parentObj.registerD << 8) | parentObj.registerE, parentObj.registerA);
},
//INC DE
//#0x13:
function (parentObj) {
var temp_var = ((parentObj.registerD << 8) | parentObj.registerE) + 1;
parentObj.registerD = (temp_var >> 8) & 0xFF;
parentObj.registerE = temp_var & 0xFF;
},
//INC D
//#0x14:
function (parentObj) {
parentObj.registerD = (parentObj.registerD + 1) & 0xFF;
parentObj.FZero = (parentObj.registerD == 0);
parentObj.FHalfCarry = ((parentObj.registerD & 0xF) == 0);
parentObj.FSubtract = false;
},
//DEC D
//#0x15:
function (parentObj) {
parentObj.registerD = (parentObj.registerD - 1) & 0xFF;
parentObj.FZero = (parentObj.registerD == 0);
parentObj.FHalfCarry = ((parentObj.registerD & 0xF) == 0xF);
parentObj.FSubtract = true;
},
//LD D, n
//#0x16:
function (parentObj) {
parentObj.registerD = parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//RLA
//#0x17:
function (parentObj) {
var carry_flag = (parentObj.FCarry) ? 1 : 0;
parentObj.FCarry = (parentObj.registerA > 0x7F);
parentObj.registerA = ((parentObj.registerA << 1) & 0xFF) | carry_flag;
parentObj.FZero = parentObj.FSubtract = parentObj.FHalfCarry = false;
},
//JR n
//#0x18:
function (parentObj) {
parentObj.programCounter = (parentObj.programCounter + ((parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter) << 24) >> 24) + 1) & 0xFFFF;
},
//ADD HL, DE
//#0x19:
function (parentObj) {
var dirtySum = parentObj.registersHL + ((parentObj.registerD << 8) | parentObj.registerE);
parentObj.FHalfCarry = ((parentObj.registersHL & 0xFFF) > (dirtySum & 0xFFF));
parentObj.FCarry = (dirtySum > 0xFFFF);
parentObj.registersHL = dirtySum & 0xFFFF;
parentObj.FSubtract = false;
},
//LD A, (DE)
//#0x1A:
function (parentObj) {
parentObj.registerA = parentObj.memoryRead((parentObj.registerD << 8) | parentObj.registerE);
},
//DEC DE
//#0x1B:
function (parentObj) {
var temp_var = (((parentObj.registerD << 8) | parentObj.registerE) - 1) & 0xFFFF;
parentObj.registerD = temp_var >> 8;
parentObj.registerE = temp_var & 0xFF;
},
//INC E
//#0x1C:
function (parentObj) {
parentObj.registerE = (parentObj.registerE + 1) & 0xFF;
parentObj.FZero = (parentObj.registerE == 0);
parentObj.FHalfCarry = ((parentObj.registerE & 0xF) == 0);
parentObj.FSubtract = false;
},
//DEC E
//#0x1D:
function (parentObj) {
parentObj.registerE = (parentObj.registerE - 1) & 0xFF;
parentObj.FZero = (parentObj.registerE == 0);
parentObj.FHalfCarry = ((parentObj.registerE & 0xF) == 0xF);
parentObj.FSubtract = true;
},
//LD E, n
//#0x1E:
function (parentObj) {
parentObj.registerE = parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//RRA
//#0x1F:
function (parentObj) {
var carry_flag = (parentObj.FCarry) ? 0x80 : 0;
parentObj.FCarry = ((parentObj.registerA & 1) == 1);
parentObj.registerA = (parentObj.registerA >> 1) | carry_flag;
parentObj.FZero = parentObj.FSubtract = parentObj.FHalfCarry = false;
},
//JR NZ, n
//#0x20:
function (parentObj) {
if (!parentObj.FZero) {
parentObj.programCounter = (parentObj.programCounter + ((parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter) << 24) >> 24) + 1) & 0xFFFF;
parentObj.CPUTicks += 4;
}
else {
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
}
},
//LD HL, nn
//#0x21:
function (parentObj) {
parentObj.registersHL = (parentObj.memoryRead((parentObj.programCounter + 1) & 0xFFFF) << 8) | parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 2) & 0xFFFF;
},
//LDI (HL), A
//#0x22:
function (parentObj) {
parentObj.memoryWriter[parentObj.registersHL](parentObj, parentObj.registersHL, parentObj.registerA);
parentObj.registersHL = (parentObj.registersHL + 1) & 0xFFFF;
},
//INC HL
//#0x23:
function (parentObj) {
parentObj.registersHL = (parentObj.registersHL + 1) & 0xFFFF;
},
//INC H
//#0x24:
function (parentObj) {
var H = ((parentObj.registersHL >> 8) + 1) & 0xFF;
parentObj.FZero = (H == 0);
parentObj.FHalfCarry = ((H & 0xF) == 0);
parentObj.FSubtract = false;
parentObj.registersHL = (H << 8) | (parentObj.registersHL & 0xFF);
},
//DEC H
//#0x25:
function (parentObj) {
var H = ((parentObj.registersHL >> 8) - 1) & 0xFF;
parentObj.FZero = (H == 0);
parentObj.FHalfCarry = ((H & 0xF) == 0xF);
parentObj.FSubtract = true;
parentObj.registersHL = (H << 8) | (parentObj.registersHL & 0xFF);
},
//LD H, n
//#0x26:
function (parentObj) {
parentObj.registersHL = (parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter) << 8) | (parentObj.registersHL & 0xFF);
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//DAA
//#0x27:
function (parentObj) {
if (!parentObj.FSubtract) {
if (parentObj.FCarry || parentObj.registerA > 0x99) {
parentObj.registerA = (parentObj.registerA + 0x60) & 0xFF;
parentObj.FCarry = true;
}
if (parentObj.FHalfCarry || (parentObj.registerA & 0xF) > 0x9) {
parentObj.registerA = (parentObj.registerA + 0x06) & 0xFF;
parentObj.FHalfCarry = false;
}
}
else if (parentObj.FCarry && parentObj.FHalfCarry) {
parentObj.registerA = (parentObj.registerA + 0x9A) & 0xFF;
parentObj.FHalfCarry = false;
}
else if (parentObj.FCarry) {
parentObj.registerA = (parentObj.registerA + 0xA0) & 0xFF;
}
else if (parentObj.FHalfCarry) {
parentObj.registerA = (parentObj.registerA + 0xFA) & 0xFF;
parentObj.FHalfCarry = false;
}
parentObj.FZero = (parentObj.registerA == 0);
},
//JR Z, n
//#0x28:
function (parentObj) {
if (parentObj.FZero) {
parentObj.programCounter = (parentObj.programCounter + ((parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter) << 24) >> 24) + 1) & 0xFFFF;
parentObj.CPUTicks += 4;
}
else {
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
}
},
//ADD HL, HL
//#0x29:
function (parentObj) {
parentObj.FHalfCarry = ((parentObj.registersHL & 0xFFF) > 0x7FF);
parentObj.FCarry = (parentObj.registersHL > 0x7FFF);
parentObj.registersHL = (parentObj.registersHL << 1) & 0xFFFF;
parentObj.FSubtract = false;
},
//LDI A, (HL)
//#0x2A:
function (parentObj) {
parentObj.registerA = parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL);
parentObj.registersHL = (parentObj.registersHL + 1) & 0xFFFF;
},
//DEC HL
//#0x2B:
function (parentObj) {
parentObj.registersHL = (parentObj.registersHL - 1) & 0xFFFF;
},
//INC L
//#0x2C:
function (parentObj) {
var L = (parentObj.registersHL + 1) & 0xFF;
parentObj.FZero = (L == 0);
parentObj.FHalfCarry = ((L & 0xF) == 0);
parentObj.FSubtract = false;
parentObj.registersHL = (parentObj.registersHL & 0xFF00) | L;
},
//DEC L
//#0x2D:
function (parentObj) {
var L = (parentObj.registersHL - 1) & 0xFF;
parentObj.FZero = (L == 0);
parentObj.FHalfCarry = ((L & 0xF) == 0xF);
parentObj.FSubtract = true;
parentObj.registersHL = (parentObj.registersHL & 0xFF00) | L;
},
//LD L, n
//#0x2E:
function (parentObj) {
parentObj.registersHL = (parentObj.registersHL & 0xFF00) | parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//CPL
//#0x2F:
function (parentObj) {
parentObj.registerA ^= 0xFF;
parentObj.FSubtract = parentObj.FHalfCarry = true;
},
//JR NC, n
//#0x30:
function (parentObj) {
if (!parentObj.FCarry) {
parentObj.programCounter = (parentObj.programCounter + ((parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter) << 24) >> 24) + 1) & 0xFFFF;
parentObj.CPUTicks += 4;
}
else {
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
}
},
//LD SP, nn
//#0x31:
function (parentObj) {
parentObj.stackPointer = (parentObj.memoryRead((parentObj.programCounter + 1) & 0xFFFF) << 8) | parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 2) & 0xFFFF;
},
//LDD (HL), A
//#0x32:
function (parentObj) {
parentObj.memoryWriter[parentObj.registersHL](parentObj, parentObj.registersHL, parentObj.registerA);
parentObj.registersHL = (parentObj.registersHL - 1) & 0xFFFF;
},
//INC SP
//#0x33:
function (parentObj) {
parentObj.stackPointer = (parentObj.stackPointer + 1) & 0xFFFF;
},
//INC (HL)
//#0x34:
function (parentObj) {
var temp_var = (parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL) + 1) & 0xFF;
parentObj.FZero = (temp_var == 0);
parentObj.FHalfCarry = ((temp_var & 0xF) == 0);
parentObj.FSubtract = false;
parentObj.memoryWriter[parentObj.registersHL](parentObj, parentObj.registersHL, temp_var);
},
//DEC (HL)
//#0x35:
function (parentObj) {
var temp_var = (parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL) - 1) & 0xFF;
parentObj.FZero = (temp_var == 0);
parentObj.FHalfCarry = ((temp_var & 0xF) == 0xF);
parentObj.FSubtract = true;
parentObj.memoryWriter[parentObj.registersHL](parentObj, parentObj.registersHL, temp_var);
},
//LD (HL), n
//#0x36:
function (parentObj) {
parentObj.memoryWriter[parentObj.registersHL](parentObj, parentObj.registersHL, parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter));
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//SCF
//#0x37:
function (parentObj) {
parentObj.FCarry = true;
parentObj.FSubtract = parentObj.FHalfCarry = false;
},
//JR C, n
//#0x38:
function (parentObj) {
if (parentObj.FCarry) {
parentObj.programCounter = (parentObj.programCounter + ((parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter) << 24) >> 24) + 1) & 0xFFFF;
parentObj.CPUTicks += 4;
}
else {
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
}
},
//ADD HL, SP
//#0x39:
function (parentObj) {
var dirtySum = parentObj.registersHL + parentObj.stackPointer;
parentObj.FHalfCarry = ((parentObj.registersHL & 0xFFF) > (dirtySum & 0xFFF));
parentObj.FCarry = (dirtySum > 0xFFFF);
parentObj.registersHL = dirtySum & 0xFFFF;
parentObj.FSubtract = false;
},
//LDD A, (HL)
//#0x3A:
function (parentObj) {
parentObj.registerA = parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL);
parentObj.registersHL = (parentObj.registersHL - 1) & 0xFFFF;
},
//DEC SP
//#0x3B:
function (parentObj) {
parentObj.stackPointer = (parentObj.stackPointer - 1) & 0xFFFF;
},
//INC A
//#0x3C:
function (parentObj) {
parentObj.registerA = (parentObj.registerA + 1) & 0xFF;
parentObj.FZero = (parentObj.registerA == 0);
parentObj.FHalfCarry = ((parentObj.registerA & 0xF) == 0);
parentObj.FSubtract = false;
},
//DEC A
//#0x3D:
function (parentObj) {
parentObj.registerA = (parentObj.registerA - 1) & 0xFF;
parentObj.FZero = (parentObj.registerA == 0);
parentObj.FHalfCarry = ((parentObj.registerA & 0xF) == 0xF);
parentObj.FSubtract = true;
},
//LD A, n
//#0x3E:
function (parentObj) {
parentObj.registerA = parentObj.memoryReader[parentObj.programCounter](parentObj, parentObj.programCounter);
parentObj.programCounter = (parentObj.programCounter + 1) & 0xFFFF;
},
//CCF
//#0x3F:
function (parentObj) {
parentObj.FCarry = !parentObj.FCarry;
parentObj.FSubtract = parentObj.FHalfCarry = false;
},
//LD B, B
//#0x40:
function (parentObj) {
//Do nothing...
},
//LD B, C
//#0x41:
function (parentObj) {
parentObj.registerB = parentObj.registerC;
},
//LD B, D
//#0x42:
function (parentObj) {
parentObj.registerB = parentObj.registerD;
},
//LD B, E
//#0x43:
function (parentObj) {
parentObj.registerB = parentObj.registerE;
},
//LD B, H
//#0x44:
function (parentObj) {
parentObj.registerB = parentObj.registersHL >> 8;
},
//LD B, L
//#0x45:
function (parentObj) {
parentObj.registerB = parentObj.registersHL & 0xFF;
},
//LD B, (HL)
//#0x46:
function (parentObj) {
parentObj.registerB = parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL);
},
//LD B, A
//#0x47:
function (parentObj) {
parentObj.registerB = parentObj.registerA;
},
//LD C, B
//#0x48:
function (parentObj) {
parentObj.registerC = parentObj.registerB;
},
//LD C, C
//#0x49:
function (parentObj) {
//Do nothing...
},
//LD C, D
//#0x4A:
function (parentObj) {
parentObj.registerC = parentObj.registerD;
},
//LD C, E
//#0x4B:
function (parentObj) {
parentObj.registerC = parentObj.registerE;
},
//LD C, H
//#0x4C:
function (parentObj) {
parentObj.registerC = parentObj.registersHL >> 8;
},
//LD C, L
//#0x4D:
function (parentObj) {
parentObj.registerC = parentObj.registersHL & 0xFF;
},
//LD C, (HL)
//#0x4E:
function (parentObj) {
parentObj.registerC = parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL);
},
//LD C, A
//#0x4F:
function (parentObj) {
parentObj.registerC = parentObj.registerA;
},
//LD D, B
//#0x50:
function (parentObj) {
parentObj.registerD = parentObj.registerB;
},
//LD D, C
//#0x51:
function (parentObj) {
parentObj.registerD = parentObj.registerC;
},
//LD D, D
//#0x52:
function (parentObj) {
//Do nothing...
},
//LD D, E
//#0x53:
function (parentObj) {
parentObj.registerD = parentObj.registerE;
},
//LD D, H
//#0x54:
function (parentObj) {
parentObj.registerD = parentObj.registersHL >> 8;
},
//LD D, L
//#0x55:
function (parentObj) {
parentObj.registerD = parentObj.registersHL & 0xFF;
},
//LD D, (HL)
//#0x56:
function (parentObj) {
parentObj.registerD = parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL);
},
//LD D, A
//#0x57:
function (parentObj) {
parentObj.registerD = parentObj.registerA;
},
//LD E, B
//#0x58:
function (parentObj) {
parentObj.registerE = parentObj.registerB;
},
//LD E, C
//#0x59:
function (parentObj) {
parentObj.registerE = parentObj.registerC;
},
//LD E, D
//#0x5A:
function (parentObj) {
parentObj.registerE = parentObj.registerD;
},
//LD E, E
//#0x5B:
function (parentObj) {
//Do nothing...
},
//LD E, H
//#0x5C:
function (parentObj) {
parentObj.registerE = parentObj.registersHL >> 8;
},
//LD E, L
//#0x5D:
function (parentObj) {
parentObj.registerE = parentObj.registersHL & 0xFF;
},
//LD E, (HL)
//#0x5E:
function (parentObj) {
parentObj.registerE = parentObj.memoryReader[parentObj.registersHL](parentObj, parentObj.registersHL);
},
//LD E, A
//#0x5F:
function (parentObj) {
parentObj.registerE = parentObj.registerA;
},
//LD H, B
//#0x60:
function (parentObj) {
parentObj.registersHL = (parentObj.registerB << 8) | (parentObj.registersHL & 0xFF);
},
//LD H, C
//#0x61:
function (parentObj) {
parentObj.registersHL = (parentObj.registerC << 8) | (parentObj.registersHL & 0xFF);
},
//LD H, D
//#0x62:
function (parentObj) {
parentObj.registersHL = (parentObj.registerD << 8) | (parentObj.registersHL & 0xFF);
},
//LD H, E
//#0x63:
function (parentObj) {
parentObj.registersHL = (parentObj.registerE << 8) | (parentObj.registersHL & 0xFF);
},
//LD H, H
//#0x64:
function (parentObj) {
//Do nothing...
},
//LD H, L
//#0x65:
function (parentObj) {
parentObj.registersHL = (parentObj.registersHL & 0xFF) * 0x101;
},