forked from crypto2011/KBBUILDER
-
Notifications
You must be signed in to change notification settings - Fork 1
/
op.pas
2285 lines (2177 loc) · 53.1 KB
/
op.pas
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
unit op;
{ Generated automatically from c:\prg\codes\src\opdata4.cmd, 31.05.2012 18:10:47 }
interface
uses DAsmDefs, DAsmUtil;
const
hn_ = $0 or nf;
hnRET = $1 or nf;
hnJMP = $2 or nf;
hnJ_ = $3 or nf;
hnLOOP = $4 or nf;
hnLOOPE = $5 or nf;
hnLOOPNE = $6 or nf;
hnJCXZ = $7 or nf;
hnCALL = $8 or nf;
hnAL = $9 or nf;
hnCL = $A or nf;
hnDL = $B or nf;
hnBL = $C or nf;
hnAH = $D or nf;
hnCH = $E or nf;
hnDH = $F or nf;
hnBH = $10 or nf;
hnSPL = $11 or nf;
hnBPL = $12 or nf;
hnSIL = $13 or nf;
hnDIL = $14 or nf;
hnR8B = $15 or nf;
hnR9B = $16 or nf;
hnR10B = $17 or nf;
hnR11B = $18 or nf;
hnR12B = $19 or nf;
hnR13B = $1A or nf;
hnR14B = $1B or nf;
hnR15B = $1C or nf;
hnAX = $1D or nf;
hnCX = $1E or nf;
hnDX = $1F or nf;
hnBX = $20 or nf;
hnSP = $21 or nf;
hnBP = $22 or nf;
hnSI = $23 or nf;
hnDI = $24 or nf;
hnR8W = $25 or nf;
hnR9W = $26 or nf;
hnR10W = $27 or nf;
hnR11W = $28 or nf;
hnR12W = $29 or nf;
hnR13W = $2A or nf;
hnR14W = $2B or nf;
hnR15W = $2C or nf;
hnEAX = $2D or nf;
hnECX = $2E or nf;
hnEDX = $2F or nf;
hnEBX = $30 or nf;
hnESP = $31 or nf;
hnEBP = $32 or nf;
hnESI = $33 or nf;
hnEDI = $34 or nf;
hnR8D = $35 or nf;
hnR9D = $36 or nf;
hnR10D = $37 or nf;
hnR11D = $38 or nf;
hnR12D = $39 or nf;
hnR13D = $3A or nf;
hnR14D = $3B or nf;
hnR15D = $3C or nf;
hnRAX = $3D or nf;
hnRCX = $3E or nf;
hnRDX = $3F or nf;
hnRBX = $40 or nf;
hnRSP = $41 or nf;
hnRBP = $42 or nf;
hnRSI = $43 or nf;
hnRDI = $44 or nf;
hnR8 = $45 or nf;
hnR9 = $46 or nf;
hnR10 = $47 or nf;
hnR11 = $48 or nf;
hnR12 = $49 or nf;
hnR13 = $4A or nf;
hnR14 = $4B or nf;
hnR15 = $4C or nf;
hnO = $4D or nf;
hnNO = $4E or nf;
hnB = $4F or nf;
hnNB = $50 or nf;
hnE = $51 or nf;
hnNE = $52 or nf;
hnBE = $53 or nf;
hnA = $54 or nf;
hnS = $55 or nf;
hnNS = $56 or nf;
hnP = $57 or nf;
hnNP = $58 or nf;
hnL = $59 or nf;
hnGE = $5A or nf;
hnLE = $5B or nf;
hnG = $5C or nf;
hnADD = $5D or nf;
hnOR = $5E or nf;
hnADC = $5F or nf;
hnSBB = $60 or nf;
hnAND = $61 or nf;
hnSUB = $62 or nf;
hnXOR = $63 or nf;
hnCMP = $64 or nf;
hnDAA = $65 or nf;
hnDAS = $66 or nf;
hnAAA = $67 or nf;
hnAAS = $68 or nf;
hnINC = $69 or nf;
hnDEC = $6A or nf;
hnPUSH = $6B or nf;
hnPOP = $6C or nf;
hnMOVS_ = $6D or nf;
hnCMPS_ = $6E or nf;
hnSTOS_ = $6F or nf;
hnLODS_ = $70 or nf;
hnSCAS_ = $71 or nf;
hnW = $72 or nf;
hnD = $73 or nf;
hnQ = $74 or nf;
hnROL = $75 or nf;
hnROR = $76 or nf;
hnRCL = $77 or nf;
hnRCR = $78 or nf;
hnSHL = $79 or nf;
hnSHR = $7A or nf;
hnSAR = $7B or nf;
hnBT = $7C or nf;
hnBTS = $7D or nf;
hnBTR = $7E or nf;
hnBTC = $7F or nf;
hnES = $80 or nf;
hnCS = $81 or nf;
hnSS = $82 or nf;
hnDS = $83 or nf;
hnFS = $84 or nf;
hnGS = $85 or nf;
hnNEAR = $86 or nf;
hnFAR = $87 or nf;
hnTEST = $88 or nf;
hnNOT = $89 or nf;
hnNEG = $8A or nf;
hnMUL = $8B or nf;
hnIMUL = $8C or nf;
hnDIV = $8D or nf;
hnIDIV = $8E or nf;
hnSLDT = $8F or nf;
hnSTR = $90 or nf;
hnLLDT = $91 or nf;
hnLTR = $92 or nf;
hnVERR = $93 or nf;
hnVERW = $94 or nf;
hnSGDT = $95 or nf;
hnSIDT = $96 or nf;
hnLGDT = $97 or nf;
hnLIDT = $98 or nf;
hnSMSW = $99 or nf;
hnLMSW = $9A or nf;
hnINVLPG = $9B or nf;
hnCBW = $9C or nf;
hnCWDE = $9D or nf;
hnCDQE = $9E or nf;
hnCWD = $9F or nf;
hnCDQ = $A0 or nf;
hnCQO = $A1 or nf;
hnINSW = $A2 or nf;
hnINSD = $A3 or nf;
hnOUTSW = $A4 or nf;
hnOUTSD = $A5 or nf;
hnPUSHA = $A6 or nf;
hnPUSHAD = $A7 or nf;
hnPOPA = $A8 or nf;
hnPOPAD = $A9 or nf;
hnPUSHF = $AA or nf;
hnPUSHFD = $AB or nf;
hnPUSHFQ = $AC or nf;
hnPOPF = $AD or nf;
hnPOPFD = $AE or nf;
hnPOPFQ = $AF or nf;
hnCR0 = $B0 or nf;
hnCR2 = $B1 or nf;
hnCR3 = $B2 or nf;
hnCR8 = $B3 or nf;
hnDR0 = $B4 or nf;
hnDR1 = $B5 or nf;
hnDR2 = $B6 or nf;
hnDR3 = $B7 or nf;
hnDR6 = $B8 or nf;
hnDR7 = $B9 or nf;
hnTR3 = $BA or nf;
hnTR4 = $BB or nf;
hnTR5 = $BC or nf;
hnTR6 = $BD or nf;
hnTR7 = $BE or nf;
hnMM0 = $BF or nf;
hnMM1 = $C0 or nf;
hnMM2 = $C1 or nf;
hnMM3 = $C2 or nf;
hnMM4 = $C3 or nf;
hnMM5 = $C4 or nf;
hnMM6 = $C5 or nf;
hnMM7 = $C6 or nf;
hnBW = $C7 or nf;
hnWD = $C8 or nf;
hnDQ = $C9 or nf;
hnPSRL_ = $CA or nf;
hnPSRA_ = $CB or nf;
hnPSLL_ = $CC or nf;
hnFXSAVE = $CD or nf;
hnFXRSTOR = $CE or nf;
hnXMM0 = $CF or nf;
hnXMM1 = $D0 or nf;
hnXMM2 = $D1 or nf;
hnXMM3 = $D2 or nf;
hnXMM4 = $D3 or nf;
hnXMM5 = $D4 or nf;
hnXMM6 = $D5 or nf;
hnXMM7 = $D6 or nf;
hnXMM8 = $D7 or nf;
hnXMM9 = $D8 or nf;
hnXMM10 = $D9 or nf;
hnXMM11 = $DA or nf;
hnXMM12 = $DB or nf;
hnXMM13 = $DC or nf;
hnXMM14 = $DD or nf;
hnXMM15 = $DE or nf;
hnLAR = $DF or nf;
hnLSL = $E0 or nf;
hnLOADALL = $E1 or nf;
hnCLTS = $E2 or nf;
hnINVD = $E3 or nf;
hnWBINVD = $E4 or nf;
hnUD2 = $E5 or nf;
hnMOV = $E6 or nf;
hnWRMSR = $E7 or nf;
hnRDTSC = $E8 or nf;
hnRDMSR = $E9 or nf;
hnRDPMC = $EA or nf;
hnSYSENTER = $EB or nf;
hnSYSEXIT = $EC or nf;
hnCMOV_ = $ED or nf;
hnPUNPCKL_ = $EE or nf;
hnPACKSSWB = $EF or nf;
hnPACKUSWB = $F0 or nf;
hnPCMPGT_ = $F1 or nf;
hnPACKSSDW = $F2 or nf;
hnPUNPCKH_ = $F3 or nf;
hnMOVD = $F4 or nf;
hnMOVQ = $F5 or nf;
hnEMMS = $F6 or nf;
hnPCMPEQ_ = $F7 or nf;
hnPMULLW = $F8 or nf;
hnPSUBUS_ = $F9 or nf;
hnPAND = $FA or nf;
hnPADDUS_ = $FB or nf;
hnPANDN = $FC or nf;
hnPMULHUW = $FD or nf;
hnPMULHW = $FE or nf;
hnPSUBS_ = $FF or nf;
hnPOR = $100 or nf;
hnPADDS_ = $101 or nf;
hnPXOR = $102 or nf;
hnPMADDWD = $103 or nf;
hnPSUB_ = $104 or nf;
hnPADD_ = $105 or nf;
hnSET_ = $106 or nf;
hnCPUID = $107 or nf;
hnSHLD = $108 or nf;
hnCMPXCHG = $109 or nf;
hnRSM = $10A or nf;
hnSHRD = $10B or nf;
hnLSS = $10C or nf;
hnLFS = $10D or nf;
hnLGS = $10E or nf;
hnMOVZX = $10F or nf;
hnILLEG1 = $110 or nf;
hnBSF = $111 or nf;
hnBSR = $112 or nf;
hnMOVSX = $113 or nf;
hnXADD = $114 or nf;
hnBSWAP = $115 or nf;
hnST = $116 or nf;
hnST1 = $117 or nf;
hnST2 = $118 or nf;
hnST3 = $119 or nf;
hnST4 = $11A or nf;
hnST5 = $11B or nf;
hnST6 = $11C or nf;
hnST7 = $11D or nf;
hnCOM = $11E or nf;
hnCOMP = $11F or nf;
hnSUBR = $120 or nf;
hnDIVR = $121 or nf;
hnLD = $122 or nf;
hnSTP = $123 or nf;
hnFLDENV = $124 or nf;
hnFLDCW = $125 or nf;
hnFSTENV = $126 or nf;
hnFSTCW = $127 or nf;
hnFLD = $128 or nf;
hnFXCH = $129 or nf;
hnFNOP = $12A or nf;
hnFSTP = $12B or nf;
hnFCHS = $12C or nf;
hnFABS = $12D or nf;
hnFTST = $12E or nf;
hnFXAM = $12F or nf;
hnFLD1 = $130 or nf;
hnFLDL2T = $131 or nf;
hnFLDL2E = $132 or nf;
hnFLDPI = $133 or nf;
hnFLDLG2 = $134 or nf;
hnFLDLN2 = $135 or nf;
hnFLDZ = $136 or nf;
hnF2XM1 = $137 or nf;
hnFYL2X = $138 or nf;
hnFPTAN = $139 or nf;
hnFPATAN = $13A or nf;
hnFXTRACT = $13B or nf;
hnFPREM1 = $13C or nf;
hnFDECSTP = $13D or nf;
hnFINCSTP = $13E or nf;
hnFPREM = $13F or nf;
hnFYL2XP1 = $140 or nf;
hnFSQRT = $141 or nf;
hnFSINCOS = $142 or nf;
hnFRNDINT = $143 or nf;
hnFSCALE = $144 or nf;
hnFSIN = $145 or nf;
hnFCOS = $146 or nf;
hnFST = $147 or nf;
hnFENI = $148 or nf;
hnFDISI = $149 or nf;
hnFCLEX = $14A or nf;
hnFINIT = $14B or nf;
hnFSETPM = $14C or nf;
hnFSTOR = $14D or nf;
hnFSAVE = $14E or nf;
hnFSTSW = $14F or nf;
hnFFREE = $150 or nf;
hnFUCOM = $151 or nf;
hnFUCOMP = $152 or nf;
hnFBLD = $153 or nf;
hnFILD = $154 or nf;
hnFBSTP = $155 or nf;
hnFISTP = $156 or nf;
hnU = $157 or nf;
hnF = $158 or nf;
hnFI = $159 or nf;
hnFCMOV_ = $15A or nf;
hnFUCOMPP = $15B or nf;
hnFCMOVN_ = $15C or nf;
hnFUCOMI = $15D or nf;
hnFCOMI = $15E or nf;
hnFUCOMIP = $15F or nf;
hnFCOMIP = $160 or nf;
hnFWAIT = $161 or nf;
hnBOUND = $162 or nf;
hnARPL = $163 or nf;
hnMOVSXD = $164 or nf;
hnINSB = $165 or nf;
hnOUTSB = $166 or nf;
hnXCHG = $167 or nf;
hnLEA = $168 or nf;
hnNOP = $169 or nf;
hnWAIT = $16A or nf;
hnSAHF = $16B or nf;
hnLAHF = $16C or nf;
hnLES = $16D or nf;
hnLDS = $16E or nf;
hnENTER = $16F or nf;
hnLEAVE = $170 or nf;
hnINT = $171 or nf;
hnINTO = $172 or nf;
hnIRET = $173 or nf;
hnAAM = $174 or nf;
hnAAD = $175 or nf;
hnXLAT = $176 or nf;
hnESC = $177 or nf;
hnIN = $178 or nf;
hnOUT = $179 or nf;
hnLOCK = $17A or nf;
hnREPNE = $17B or nf;
hnREPE = $17C or nf;
hnHALT = $17D or nf;
hnCMC = $17E or nf;
hnCLC = $17F or nf;
hnSTC = $180 or nf;
hnCLI = $181 or nf;
hnSTI = $182 or nf;
hnCLD = $183 or nf;
hnSTD = $184 or nf;
function GetOpName(hName: THBMName):TBMOpRec;
const
ntregB: array[0..8-1]of THBMName = (
hnAL, hnCL, hnDL, hnBL, hnAH, hnCH, hnDH, hnBH
);
const
ntreg16: array[0..16-1]of THBMName = (
hnAX, hnCX, hnDX, hnBX, hnSP, hnBP, hnSI, hnDI, hnR8W, hnR9W, hnR10W, hnR11W, hnR12W, hnR13W, hnR14W, hnR15W
);
const
ntreg32: array[0..16-1]of THBMName = (
hnEAX, hnECX, hnEDX, hnEBX, hnESP, hnEBP, hnESI, hnEDI, hnR8D, hnR9D, hnR10D, hnR11D, hnR12D, hnR13D, hnR14D, hnR15D
);
function readOP: boolean;
implementation
const
BMNames: array[0..389-1] of TBMOpRec = (
{0x0}'?','RET','JMP','J_','LOOP','LOOPE','LOOPNE','JCXZ',
{0x8}'CALL','AL','CL','DL','BL','AH','CH','DH',
{0x10}'BH','SPL','BPL','SIL','DIL','R8B','R9B','R10B',
{0x18}'R11B','R12B','R13B','R14B','R15B','AX','CX','DX',
{0x20}'BX','SP','BP','SI','DI','R8W','R9W','R10W',
{0x28}'R11W','R12W','R13W','R14W','R15W','EAX','ECX','EDX',
{0x30}'EBX','ESP','EBP','ESI','EDI','R8D','R9D','R10D',
{0x38}'R11D','R12D','R13D','R14D','R15D','RAX','RCX','RDX',
{0x40}'RBX','RSP','RBP','RSI','RDI','R8','R9','R10',
{0x48}'R11','R12','R13','R14','R15','O','NO','B',
{0x50}'NB','E','NE','BE','A','S','NS','P',
{0x58}'NP','L','GE','LE','G','ADD','OR','ADC',
{0x60}'SBB','AND','SUB','XOR','CMP','DAA','DAS','AAA',
{0x68}'AAS','INC','DEC','PUSH','POP','MOVS_','CMPS_','STOS_',
{0x70}'LODS_','SCAS_','W','D','Q','ROL','ROR','RCL',
{0x78}'RCR','SHL','SHR','SAR','BT','BTS','BTR','BTC',
{0x80}'ES','CS','SS','DS','FS','GS','NEAR','FAR',
{0x88}'TEST','NOT','NEG','MUL','IMUL','DIV','IDIV','SLDT',
{0x90}'STR','LLDT','LTR','VERR','VERW','SGDT','SIDT','LGDT',
{0x98}'LIDT','SMSW','LMSW','INVLPG','CBW','CWDE','CDQE','CWD',
{0xA0}'CDQ','CQO','INSW','INSD','OUTSW','OUTSD','PUSHA','PUSHAD',
{0xA8}'POPA','POPAD','PUSHF','PUSHFD','PUSHFQ','POPF','POPFD','POPFQ',
{0xB0}'CR0','CR2','CR3','CR8','DR0','DR1','DR2','DR3',
{0xB8}'DR6','DR7','TR3','TR4','TR5','TR6','TR7','MM0',
{0xC0}'MM1','MM2','MM3','MM4','MM5','MM6','MM7','BW',
{0xC8}'WD','DQ','PSRL_','PSRA_','PSLL_','FXSAVE','FXRSTOR','XMM0',
{0xD0}'XMM1','XMM2','XMM3','XMM4','XMM5','XMM6','XMM7','XMM8',
{0xD8}'XMM9','XMM10','XMM11','XMM12','XMM13','XMM14','XMM15','LAR',
{0xE0}'LSL','LOADALL','CLTS','INVD','WBINVD','UD2','MOV','WRMSR',
{0xE8}'RDTSC','RDMSR','RDPMC','SYSENTER','SYSEXIT','CMOV_','PUNPCKL_','PACKSSWB',
{0xF0}'PACKUSWB','PCMPGT_','PACKSSDW','PUNPCKH_','MOVD','MOVQ','EMMS','PCMPEQ_',
{0xF8}'PMULLW','PSUBUS_','PAND','PADDUS_','PANDN','PMULHUW','PMULHW','PSUBS_',
{0x100}'POR','PADDS_','PXOR','PMADDWD','PSUB_','PADD_','SET_','CPUID',
{0x108}'SHLD','CMPXCHG','RSM','SHRD','LSS','LFS','LGS','MOVZX',
{0x110}'ILLEG1','BSF','BSR','MOVSX','XADD','BSWAP','ST','ST1',
{0x118}'ST2','ST3','ST4','ST5','ST6','ST7','COM','COMP',
{0x120}'SUBR','DIVR','LD','STP','FLDENV','FLDCW','FSTENV','FSTCW',
{0x128}'FLD','FXCH','FNOP','FSTP','FCHS','FABS','FTST','FXAM',
{0x130}'FLD1','FLDL2T','FLDL2E','FLDPI','FLDLG2','FLDLN2','FLDZ','F2XM1',
{0x138}'FYL2X','FPTAN','FPATAN','FXTRACT','FPREM1','FDECSTP','FINCSTP','FPREM',
{0x140}'FYL2XP1','FSQRT','FSINCOS','FRNDINT','FSCALE','FSIN','FCOS','FST',
{0x148}'FENI','FDISI','FCLEX','FINIT','FSETPM','FSTOR','FSAVE','FSTSW',
{0x150}'FFREE','FUCOM','FUCOMP','FBLD','FILD','FBSTP','FISTP','U',
{0x158}'F','FI','FCMOV_','FUCOMPP','FCMOVN_','FUCOMI','FCOMI','FUCOMIP',
{0x160}'FCOMIP','FWAIT','BOUND','ARPL','MOVSXD','INSB','OUTSB','XCHG',
{0x168}'LEA','NOP','WAIT','SAHF','LAHF','LES','LDS','ENTER',
{0x170}'LEAVE','INT','INTO','IRET','AAM','AAD','XLAT','ESC',
{0x178}'IN','OUT','LOCK','REPNE','REPE','HALT','CMC','CLC',
{0x180}'STC','CLI','STI','CLD','STD'
);
function GetOpName(hName: THBMName):TBMOpRec;
begin
hName := hName and nm;
if (hName<0)or(hName>High(BMNames)) then
Result := ''
else
Result := BMNames[hName];
end ;
const
ntregB64: array[0..16-1]of THBMName = (
hnAL, hnCL, hnDL, hnBL, hnSPL, hnBPL, hnSIL, hnDIL, hnR8B, hnR9B, hnR10B, hnR11B, hnR12B, hnR13B, hnR14B, hnR15B
);
const
ntreg64: array[0..16-1]of THBMName = (
hnRAX, hnRCX, hnRDX, hnRBX, hnRSP, hnRBP, hnRSI, hnRDI, hnR8, hnR9, hnR10, hnR11, hnR12, hnR13, hnR14, hnR15
);
function RegW(R: integer; var RN: integer): boolean;
var
OS: integer;
begin
Result := false;
OS := getOS;
case OS of
$0: RN := ntreg16[R];
$1: RN := ntreg32[R];
else Exit;
end;
Result := true;
end ;
function Reg(W,R: integer; var RN: integer): boolean;
begin
Result := false;
case W of
$0: RN := ntregB[R];
$1: if not RegW(R,RN) then Exit;
else Exit;
end;
Result := true;
end ;
function regBX(R: integer; var RN: integer): boolean;
var
WR: integer;
begin
Result := false;
WR := wasREX;
case WR of
$0: RN := ntregB[R];
$1: RN := ntregB64[R];
else Exit;
end;
Result := true;
end ;
function regWX(R,P: integer; var RN: integer): boolean;
var
OS,RX: integer;
begin
Result := false;
OS := getOS64;
RX := addREXBit(R,P);
case OS of
$0: RN := ntreg16[RX];
$1: RN := ntreg32[RX];
$2: RN := ntreg64[RX];
else Exit;
end;
Result := true;
end ;
function RegWM(R: integer; var RN: integer): boolean;
var
OS,M: integer;
begin
Result := false;
OS := getOS;
case OS of
$0: RN := ntreg16[R];
$1: begin
M := mode64;
case M of
$0: RN := ntreg32[R];
$1: RN := ntreg64[R];
else Exit;
end;
end;
else Exit;
end;
Result := true;
end ;
function regX(W,R,P: integer; var RN: integer): boolean;
begin
Result := false;
case W of
$0: if not regBX(R,RN) then Exit;
$1: if not regWX(R,P,RN) then Exit;
else Exit;
end;
Result := true;
end ;
function JmpOfsW: boolean;
var
M,S: integer;
begin
Result := false;
M := mode64;
case M of
$0: S := getOS;
$1: S := Identic(1);
else Exit;
end;
if not jmpOfs(1+S) then Exit;
Result := true;
end ;
const
ntJmpCond: array[0..16-1]of THBMName = (
hnO, hnNO, hnB, hnNB, hnE, hnNE, hnBE, hnA, hnS, hnNS, hnP, hnNP, hnL, hnGE, hnLE, hnG
);
const
ntArOp: array[0..8-1]of THBMName = (
hnADD, hnOR, hnADC, hnSBB, hnAND, hnSUB, hnXOR, hnCMP
);
const
ntDecArOp: array[0..4-1]of THBMName = (
hnDAA, hnDAS, hnAAA, hnAAS
);
const
ntincDec: array[0..2-1]of THBMName = (
hnINC, hnDEC
);
const
ntpushPop: array[0..2-1]of THBMName = (
hnPUSH, hnPOP
);
const
ntStrOp1: array[0..2-1]of THBMName = (
hnMOVS_, hnCMPS_
);
const
ntStrOp2: array[0..4-1]of THBMName = (
hn_, hnSTOS_, hnLODS_, hnSCAS_
);
const
ntsWD: array[0..3-1]of THBMName = (
hnW, hnD, hnQ
);
const
ntShftOp: array[0..8-1]of THBMName = (
hnROL, hnROR, hnRCL, hnRCR, hnSHL, hnSHR, hn_, hnSAR
);
const
ntBtOp: array[0..8-1]of THBMName = (
hn_, hn_, hn_, hn_, hnBT, hnBTS, hnBTR, hnBTC
);
const
ntSReg: array[0..8-1]of THBMName = (
hnES, hnCS, hnSS, hnDS, hnFS, hnGS, hn_, hn_
);
const
ntcallDist: array[0..2-1]of THBMName = (
hnNEAR, hnFAR
);
const
ntLoopS: array[0..4-1]of THBMName = (
hnLOOPNE, hnLOOPE, hnLOOP, hnJCXZ
);
const
ntGr1Op: array[0..8-1]of THBMName = (
hnTEST, hn_, hnNOT, hnNEG, hnMUL, hnIMUL, hnDIV, hnIDIV
);
const
ntGr2Op: array[0..4-1]of THBMName = (
hn_, hnCALL, hnJMP, hn_
);
const
ntGr3Op: array[0..2-1]of THBMName = (
hnINC, hnDEC
);
const
ntGr6Op: array[0..8-1]of THBMName = (
hnSLDT, hnSTR, hnLLDT, hnLTR, hnVERR, hnVERW, hn_, hn_
);
const
ntGr7Op: array[0..8-1]of THBMName = (
hnSGDT, hnSIDT, hnLGDT, hnLIDT, hnSMSW, hn_, hnLMSW, hnINVLPG
);
const
ntcbwOp: array[0..3-1]of THBMName = (
hnCBW, hnCWDE, hnCDQE
);
const
ntcwdOp: array[0..3-1]of THBMName = (
hnCWD, hnCDQ, hnCQO
);
const
ntinswOp: array[0..2-1]of THBMName = (
hnINSW, hnINSD
);
const
ntoutswOp: array[0..2-1]of THBMName = (
hnOUTSW, hnOUTSD
);
const
ntpushaOp: array[0..2-1]of THBMName = (
hnPUSHA, hnPUSHAD
);
const
ntpopaOp: array[0..2-1]of THBMName = (
hnPOPA, hnPOPAD
);
const
ntpushfOp: array[0..3-1]of THBMName = (
hnPUSHF, hnPUSHFD, hnPUSHFQ
);
const
ntpopfOp: array[0..3-1]of THBMName = (
hnPOPF, hnPOPFD, hnPOPFQ
);
const
ntCReg: array[0..16-1]of THBMName = (
hnCR0, hn_, hnCR2, hnCR3, hn_, hn_, hn_, hn_, hnCR8, hn_, hn_, hn_, hn_, hn_, hn_, hn_
);
const
ntDReg: array[0..16-1]of THBMName = (
hnDR0, hnDR1, hnDR2, hnDR3, hn_, hn_, hnDR6, hnDR7, hn_, hn_, hn_, hn_, hn_, hn_, hn_, hn_
);
const
ntTReg: array[0..8-1]of THBMName = (
hn_, hn_, hn_, hnTR3, hnTR4, hnTR5, hnTR6, hnTR7
);
function getEAV(W: integer; var M,A: integer): boolean;
begin
Result := false;
if (W and $1)<>$0 then W := 1+getOS;
if not getEA(W,M,A) then Exit;
Result := true;
end ;
function getEAV64(W: integer; var M,A: integer): boolean;
begin
Result := false;
if (W and $1)<>$0 then W := 1+getOS64;
if not getEA(W,M,A) then Exit;
Result := true;
end ;
function getEAVM(W: integer; var M,A: integer): boolean;
begin
Result := false;
if (W and $1)<>$0 then W := 1+mode64;
if not getEA(W,M,A) then Exit;
Result := true;
end ;
function readEA(W: integer; var M: integer): boolean;
var
A: integer;
begin
Result := false;
if not getEAV(W,M,A) then Exit;
SetCmdArg(A);
Result := true;
end ;
function readEAM(W: integer; var M: integer): boolean;
var
A: integer;
begin
Result := false;
if not getEAVM(W,M,A) then Exit;
SetCmdArg(A);
Result := true;
end ;
function readEA64(W: integer; var M: integer): boolean;
var
A: integer;
begin
Result := false;
if not getEAV64(W,M,A) then Exit;
SetCmdArg(A);
Result := true;
end ;
function imW(W: integer): boolean;
begin
Result := false;
if (W and $1)=$0 then begin
if not ImmedBW(0) then Exit;
end
else if not ImmedBW(1+getOS) then Exit;
Result := true;
end ;
function imW64(W: integer): boolean;
begin
Result := false;
if (W and $1)=$0 then begin
if not ImmedBW(0) then Exit;
end
else if not ImmedBW(1+getOS64) then Exit;
Result := true;
end ;
function imSignExt(S,W: integer): boolean;
begin
Result := false;
case S of
$0: if not imW(W) then Exit;
$1: if not imInt(0) then Exit;
else Exit;
end;
Result := true;
end ;
function xchgArg(D,A1,A2: integer): boolean;
begin
Result := false;
case D of
$0: begin
SetCmdArg(A1);
SetCmdArg(A2);
end;
$1: begin
SetCmdArg(A2);
SetCmdArg(A1);
end;
else Exit;
end;
Result := true;
end ;
function readRMD(W: integer): boolean;
var
R,A: integer;
var
_1: integer;
begin
Result := false;
if not getEAV(W,R,A) then Exit;
if not Reg(W,R,_1) then Exit;
SetCmdArg(_1);
SetCmdArg(A);
Result := true;
end ;
function readRMR(W: integer): boolean;
var
R,A: integer;
var
_1: integer;
begin
Result := false;
if not getEAV(W,R,A) then Exit;
SetCmdArg(A);
if not Reg(W,R,_1) then Exit;
SetCmdArg(_1);
Result := true;
end ;
function readRM(R,W: integer): boolean;
begin
Result := false;
case R of
$0: if not readRMR(W) then Exit;
$1: if not readRMD(W) then Exit;
else Exit;
end;
Result := true;
end ;
function readRMD64(W: integer): boolean;
var
R,A: integer;
var
_1: integer;
begin
Result := false;
if not getEAV64(W,R,A) then Exit;
if not regX(W,R,3,_1) then Exit;
SetCmdArg(_1);
SetCmdArg(A);
Result := true;
end ;
function readRMR64(W: integer): boolean;
var
R,A: integer;
var
_1: integer;
begin
Result := false;
if not getEAV64(W,R,A) then Exit;
SetCmdArg(A);
if not regX(W,R,3,_1) then Exit;
SetCmdArg(_1);
Result := true;
end ;
function readRM64(R,W: integer): boolean;
begin
Result := false;
case R of
$0: if not readRMR64(W) then Exit;
$1: if not readRMD64(W) then Exit;
else Exit;
end;
Result := true;
end ;
function readSRM(Rev: integer): boolean;
var
R,A: integer;
begin
Result := false;
if not getEA(1,R,A) then Exit;
case Rev of
$0: begin
SetCmdArg(A);
SetCmdArg(ntSReg[R]);
end;
$1: begin
SetCmdArg(ntSReg[R]);
SetCmdArg(A);
end;
else Exit;
end;
Result := true;
end ;
function ReadRMWD(W: integer): boolean;
var
R,A: integer;
var
_1: integer;
begin
Result := false;
if not getEA(W,R,A) then Exit;
if not regWX(R,3,_1) then Exit;
SetCmdArg(_1);
SetCmdArg(A);
Result := true;
end ;
function ReadFarPtr: boolean;
var
W,R,A: integer;
var
_1: integer;
begin
Result := false;
W := 1+getOS64;
if not getEA(W,R,A) then Exit;
if not regWX(R,3,_1) then Exit;
SetCmdArg(_1);
SetCmdArg(A);
Result := true;
end ;
function ReadMIm(W: integer): boolean;
var
R,A: integer;
begin
Result := false;
if not getEAV(W,R,A) then Exit;
SetCmdArg(A);
if not imW(W) then Exit;
Result := true;
end ;
function ReadM64Im(W: integer): boolean;
var
R,A: integer;
begin
Result := false;
if not getEAV64(W,R,A) then Exit;
SetCmdArg(A);
if not imW(W) then Exit;
Result := true;
end ;
function CurSeg: boolean;
var
S: integer;
begin
Result := false;
S := getSeg;
if (S and $F)<>$8 then SetCmdArg(ntSReg[S]);
Result := true;
end ;
function StrBW(W: integer): boolean;