-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmame_i386.cpp
More file actions
1039 lines (919 loc) · 35.9 KB
/
Copy pathmame_i386.cpp
File metadata and controls
1039 lines (919 loc) · 35.9 KB
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
/* ----------------------------------------------------------------------------
MAME i386
---------------------------------------------------------------------------- */
// disable warnings for Microsoft Visual C++ 2005 or later
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
// for MAME i86/i386
#pragma warning( disable : 4065 )
#pragma warning( disable : 4146 )
#pragma warning( disable : 4267 )
#endif
#ifndef __BIG_ENDIAN__
#define LSB_FIRST
#endif
#ifndef INLINE
#define INLINE inline
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1400)
#define S64(v) v##I64
#define U64(v) v##UI64
#else
#define S64(v) v##LL
#define U64(v) v##ULL
#endif
#ifdef _MSC_VC6
void logerror(const char *format, ...)
{
// va_list ap;
// va_start(ap, format);
// vfprintf(stderr, format, ap);
// va_end(ap);
}
void popmessage(const char *format, ...)
{
// va_list ap;
// va_start(ap, format);
// vfprintf(stderr, format, ap);
// va_end(ap);
}
#else
//#define logerror(...) fprintf(stderr, __VA_ARGS__)
#define logerror(...)
//#define popmessage(...) fprintf(stderr, __VA_ARGS__)
#define popmessage(...)
#endif
/*****************************************************************************/
/* src/emu/devcpu.h */
// CPU interface functions
#define CPU_INIT_NAME(name) cpu_init_##name
#define CPU_INIT(name) void CPU_INIT_NAME(name)()
#define CPU_INIT_CALL(name) CPU_INIT_NAME(name)()
#define CPU_RESET_NAME(name) cpu_reset_##name
#define CPU_RESET(name) void CPU_RESET_NAME(name)()
#define CPU_RESET_CALL(name) CPU_RESET_NAME(name)()
#define CPU_EXECUTE_NAME(name) cpu_execute_##name
#define CPU_EXECUTE(name) void CPU_EXECUTE_NAME(name)()
#define CPU_EXECUTE_CALL(name) CPU_EXECUTE_NAME(name)()
#define CPU_TRANSLATE_NAME(name) cpu_translate_##name
#define CPU_TRANSLATE(name) int CPU_TRANSLATE_NAME(name)(address_spacenum space, int intention, offs_t *address)
#define CPU_TRANSLATE_CALL(name) CPU_TRANSLATE_NAME(name)(space, intention, address)
#define CPU_DISASSEMBLE_NAME(name) cpu_disassemble_##name
#define CPU_DISASSEMBLE(name) int CPU_DISASSEMBLE_NAME(name)(char *buffer, offs_t eip, const UINT8 *oprom)
#define CPU_DISASSEMBLE_CALL(name) CPU_DISASSEMBLE_NAME(name)(buffer, eip, oprom)
#define CPU_MODEL_STR(name) #name
#define CPU_MODEL_NAME(name) CPU_MODEL_STR(name)
/*****************************************************************************/
/* src/emu/didisasm.h */
// Disassembler constants
const UINT32 DASMFLAG_SUPPORTED = 0x80000000; // are disassembly flags supported?
const UINT32 DASMFLAG_STEP_OUT = 0x40000000; // this instruction should be the end of a step out sequence
const UINT32 DASMFLAG_STEP_OVER = 0x20000000; // this instruction should be stepped over by setting a breakpoint afterwards
const UINT32 DASMFLAG_STEP_COND = 0x10000000; // this instruction should be stepped over by setting a breakpoint afterwards
const UINT32 DASMFLAG_OVERINSTMASK = 0x0c000000; // number of extra instructions to skip when stepping over
const UINT32 DASMFLAG_OVERINSTSHIFT = 26; // bits to shift after masking to get the value
const UINT32 DASMFLAG_LENGTHMASK = 0x0000ffff; // the low 16-bits contain the actual length
/*****************************************************************************/
/* src/emu/diexec.h */
// I/O line states
enum line_state
{
CLEAR_LINE = 0, // clear (a fired or held) line
ASSERT_LINE, // assert an interrupt immediately
HOLD_LINE, // hold interrupt line until acknowledged
PULSE_LINE // pulse interrupt line instantaneously (only for NMI, RESET)
};
// I/O line definitions
enum
{
INPUT_LINE_IRQ = 0,
INPUT_LINE_NMI
};
/*****************************************************************************/
/* src/emu/dimemory.h */
/* src/emu/divtlb.h */
// Translation intentions
enum
{
TR_READ = 0, // translate for read
TR_WRITE = 1, // translate for write
TR_FETCH = 2 // translate for instruction fetch
};
enum
{
TR_UREAD = 4, // TR_USER | TR_READ
TR_UWRITE = 5, // TR_USER | TR_WRITE
TR_UFETCH = 6, // TR_USER | TR_FETCH
TR_TYPE = 3, // read write or fetch
TR_USER = 4 // user mode or fully privileged
};
/*****************************************************************************/
/* src/emu/emucore.h */
// constants for expression endianness
enum endianness_t
{
ENDIANNESS_LITTLE,
ENDIANNESS_BIG
};
// declare native endianness to be one or the other
#ifdef LSB_FIRST
const endianness_t ENDIANNESS_NATIVE = ENDIANNESS_LITTLE;
#else
const endianness_t ENDIANNESS_NATIVE = ENDIANNESS_BIG;
#endif
// endian-based value: first value is if 'endian' is little-endian, second is if 'endian' is big-endian
#define ENDIAN_VALUE_LE_BE(endian,leval,beval) (((endian) == ENDIANNESS_LITTLE) ? (leval) : (beval))
// endian-based value: first value is if native endianness is little-endian, second is if native is big-endian
#define NATIVE_ENDIAN_VALUE_LE_BE(leval,beval) ENDIAN_VALUE_LE_BE(ENDIANNESS_NATIVE, leval, beval)
// endian-based value: first value is if 'endian' matches native, second is if 'endian' doesn't match native
#define ENDIAN_VALUE_NE_NNE(endian,leval,beval) (((endian) == ENDIANNESS_NATIVE) ? (neval) : (nneval))
/*****************************************************************************/
/* src/emu/emumem.h */
// helpers for checking address alignment
#define WORD_ALIGNED(a) (((a) & 1) == 0)
#define DWORD_ALIGNED(a) (((a) & 3) == 0)
#define QWORD_ALIGNED(a) (((a) & 7) == 0)
/*****************************************************************************/
/* src/emu/memory.h */
// address spaces
enum address_spacenum
{
AS_0, // first address space
AS_1, // second address space
AS_2, // third address space
AS_3, // fourth address space
ADDRESS_SPACES, // maximum number of address spaces
// alternate address space names for common use
AS_PROGRAM = AS_0, // program address space
AS_DATA = AS_1, // data address space
AS_IO = AS_2 // I/O address space
};
// offsets and addresses are 32-bit (for now...)
typedef UINT32 offs_t;
#define read_decrypted_byte read_byte
#define read_decrypted_word read_word
#define read_decrypted_dword read_dword
#define read_raw_byte read_byte
#define write_raw_byte write_byte
#define read_word_unaligned read_word
#define write_word_unaligned write_word
#define read_io_word_unaligned read_io_word
#define write_io_word_unaligned write_io_word
/*****************************************************************************/
/* src/osd/osdcomm.h */
/* Highly useful macro for compile-time knowledge of an array size */
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))
static CPU_TRANSLATE(i386);
#define SUPPORT_FPU_SOFTFLOAT3
#ifdef SUPPORT_FPU_SOFTFLOAT3
// definitions in stdin.h for Microsoft Visual C++ 2008 or prior
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;
typedef unsigned __int64 uint_least64_t;
typedef unsigned int uint_fast8_t;
typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
typedef unsigned __int64 uint_fast64_t;
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed __int64 int64_t;
typedef signed char int_least8_t;
typedef signed short int_least16_t;
typedef signed int int_least32_t;
typedef signed __int64 int_least64_t;
typedef signed int int_fast8_t;
typedef signed int int_fast16_t;
typedef signed int int_fast32_t;
typedef signed __int64 int_fast64_t;
#define INT64_C(val) val##I64
#define UINT64_C(val) val##UI64
#else
#include <stdint.h>
#endif
// disable warnings for Microsoft Visual C++ 2008 or prior
#if defined(_MSC_VER) && (_MSC_VER < 1600)
#pragma warning( disable : 4800 )
#endif
// disable global optimazation for Microsoft Visual C++ 6
#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma optimize("g", off)
#endif
#define SOFTFLOAT_ROUND_ODD
#define INLINE_LEVEL 5
#define SOFTFLOAT_FAST_DIV32TO16
#define SOFTFLOAT_FAST_DIV64TO32
#define SOFTFLOAT_FAST_INT64
//#include "mame/lib/softfloat3/source/s_eq128.c"
//#include "mame/lib/softfloat3/source/s_le128.c"
//#include "mame/lib/softfloat3/source/s_lt128.c"
//#include "mame/lib/softfloat3/source/s_shortShiftLeft128.c"
//#include "mame/lib/softfloat3/source/s_shortShiftRight128.c"
//#include "mame/lib/softfloat3/source/s_shortShiftRightJam64.c"
//#include "mame/lib/softfloat3/source/s_shortShiftRightJam64Extra.c"
//#include "mame/lib/softfloat3/source/s_shortShiftRightJam128.c"
//#include "mame/lib/softfloat3/source/s_shortShiftRightJam128Extra.c"
//#include "mame/lib/softfloat3/source/s_shiftRightJam32.c"
//#include "mame/lib/softfloat3/source/s_shiftRightJam64.c"
//#include "mame/lib/softfloat3/source/s_shiftRightJam64Extra.c"
#include "mame/lib/softfloat3/source/s_shiftRightJam128.c"
#include "mame/lib/softfloat3/source/s_shiftRightJam128Extra.c"
#include "mame/lib/softfloat3/source/s_shiftRightJam256M.c"
#include "mame/lib/softfloat3/source/s_countLeadingZeros8.c"
//#include "mame/lib/softfloat3/source/s_countLeadingZeros16.c"
//#include "mame/lib/softfloat3/source/s_countLeadingZeros32.c"
#include "mame/lib/softfloat3/source/s_countLeadingZeros64.c"
//#include "mame/lib/softfloat3/source/s_add128.c"
#include "mame/lib/softfloat3/source/s_add256M.c"
//#include "mame/lib/softfloat3/source/s_sub128.c"
#include "mame/lib/softfloat3/source/s_sub256M.c"
//#include "mame/lib/softfloat3/source/s_mul64ByShifted32To128.c"
#include "mame/lib/softfloat3/source/s_mul64To128.c"
//#include "mame/lib/softfloat3/source/s_mul128By32.c"
#include "mame/lib/softfloat3/source/s_mul128To256M.c"
#include "mame/lib/softfloat3/source/s_approxRecip_1Ks.c"
#include "mame/lib/softfloat3/source/s_approxRecip32_1.c"
#include "mame/lib/softfloat3/source/s_approxRecipSqrt_1Ks.c"
#include "mame/lib/softfloat3/source/s_approxRecipSqrt32_1.c"
#include "mame/lib/softfloat3/source/8086/softfloat_raiseFlags.c"
#include "mame/lib/softfloat3/source/8086/s_commonNaNToF16UI.c"
#include "mame/lib/softfloat3/source/8086/s_propagateNaNF16UI.c"
#include "mame/lib/softfloat3/source/8086/s_f32UIToCommonNaN.c"
#include "mame/lib/softfloat3/source/8086/s_commonNaNToF32UI.c"
#include "mame/lib/softfloat3/source/8086/s_propagateNaNF32UI.c"
#include "mame/lib/softfloat3/source/8086/s_f64UIToCommonNaN.c"
#include "mame/lib/softfloat3/source/8086/s_f16UIToCommonNaN.c"
#include "mame/lib/softfloat3/source/8086/s_commonNaNToF64UI.c"
#include "mame/lib/softfloat3/source/8086/s_propagateNaNF64UI.c"
#include "mame/lib/softfloat3/source/8086/extF80M_isSignalingNaN.c"
#include "mame/lib/softfloat3/source/8086/s_extF80UIToCommonNaN.c"
#include "mame/lib/softfloat3/source/8086/s_commonNaNToExtF80UI.c"
#include "mame/lib/softfloat3/source/8086/s_propagateNaNExtF80UI.c"
#include "mame/lib/softfloat3/source/8086/f128M_isSignalingNaN.c"
#include "mame/lib/softfloat3/source/8086/s_f128UIToCommonNaN.c"
#include "mame/lib/softfloat3/source/8086/s_commonNaNToF128UI.c"
#include "mame/lib/softfloat3/source/8086/s_propagateNaNF128UI.c"
#include "mame/lib/softfloat3/source/s_roundToUI32.c"
#include "mame/lib/softfloat3/source/s_roundToUI64.c"
#include "mame/lib/softfloat3/source/s_roundToI32.c"
#include "mame/lib/softfloat3/source/s_roundToI64.c"
#include "mame/lib/softfloat3/source/s_normSubnormalF16Sig.c"
#include "mame/lib/softfloat3/source/s_roundPackToF16.c"
#include "mame/lib/softfloat3/source/s_normRoundPackToF16.c"
#include "mame/lib/softfloat3/source/s_addMagsF16.c"
#include "mame/lib/softfloat3/source/s_subMagsF16.c"
#include "mame/lib/softfloat3/source/s_mulAddF16.c"
#include "mame/lib/softfloat3/source/s_normSubnormalF32Sig.c"
#include "mame/lib/softfloat3/source/s_roundPackToF32.c"
#include "mame/lib/softfloat3/source/s_normRoundPackToF32.c"
#include "mame/lib/softfloat3/source/s_addMagsF32.c"
#include "mame/lib/softfloat3/source/s_subMagsF32.c"
#include "mame/lib/softfloat3/source/s_mulAddF32.c"
#include "mame/lib/softfloat3/source/s_normSubnormalF64Sig.c"
#include "mame/lib/softfloat3/source/s_roundPackToF64.c"
#include "mame/lib/softfloat3/source/s_normRoundPackToF64.c"
#include "mame/lib/softfloat3/source/s_addMagsF64.c"
#include "mame/lib/softfloat3/source/s_subMagsF64.c"
#include "mame/lib/softfloat3/source/s_mulAddF64.c"
#include "mame/lib/softfloat3/source/s_normSubnormalExtF80Sig.c"
#include "mame/lib/softfloat3/source/s_roundPackToExtF80.c"
#include "mame/lib/softfloat3/source/s_normRoundPackToExtF80.c"
#include "mame/lib/softfloat3/source/s_addMagsExtF80.c"
#include "mame/lib/softfloat3/source/s_subMagsExtF80.c"
#include "mame/lib/softfloat3/source/s_normSubnormalF128Sig.c"
#include "mame/lib/softfloat3/source/s_roundPackToF128.c"
#include "mame/lib/softfloat3/source/s_normRoundPackToF128.c"
#include "mame/lib/softfloat3/source/s_addMagsF128.c"
#include "mame/lib/softfloat3/source/s_subMagsF128.c"
#include "mame/lib/softfloat3/source/s_mulAddF128.c"
#include "mame/lib/softfloat3/source/softfloat_state.c"
#include "mame/lib/softfloat3/source/ui32_to_f16.c"
#include "mame/lib/softfloat3/source/ui32_to_f32.c"
#include "mame/lib/softfloat3/source/ui32_to_f64.c"
#include "mame/lib/softfloat3/source/ui32_to_extF80.c"
#include "mame/lib/softfloat3/source/ui32_to_extF80M.c"
#include "mame/lib/softfloat3/source/ui32_to_f128.c"
#include "mame/lib/softfloat3/source/ui32_to_f128M.c"
#include "mame/lib/softfloat3/source/ui64_to_f16.c"
#include "mame/lib/softfloat3/source/ui64_to_f32.c"
#include "mame/lib/softfloat3/source/ui64_to_f64.c"
#include "mame/lib/softfloat3/source/ui64_to_extF80.c"
#include "mame/lib/softfloat3/source/ui64_to_extF80M.c"
#include "mame/lib/softfloat3/source/ui64_to_f128.c"
#include "mame/lib/softfloat3/source/ui64_to_f128M.c"
#include "mame/lib/softfloat3/source/i32_to_f16.c"
#include "mame/lib/softfloat3/source/i32_to_f32.c"
#include "mame/lib/softfloat3/source/i32_to_f64.c"
#include "mame/lib/softfloat3/source/i32_to_extF80.c"
#include "mame/lib/softfloat3/source/i32_to_extF80M.c"
#include "mame/lib/softfloat3/source/i32_to_f128.c"
#include "mame/lib/softfloat3/source/i32_to_f128M.c"
#include "mame/lib/softfloat3/source/i64_to_f16.c"
#include "mame/lib/softfloat3/source/i64_to_f32.c"
#include "mame/lib/softfloat3/source/i64_to_f64.c"
#include "mame/lib/softfloat3/source/i64_to_extF80.c"
#include "mame/lib/softfloat3/source/i64_to_extF80M.c"
#include "mame/lib/softfloat3/source/i64_to_f128.c"
#include "mame/lib/softfloat3/source/i64_to_f128M.c"
#include "mame/lib/softfloat3/source/f16_to_ui32.c"
#include "mame/lib/softfloat3/source/f16_to_ui64.c"
#include "mame/lib/softfloat3/source/f16_to_i32.c"
#include "mame/lib/softfloat3/source/f16_to_i64.c"
#include "mame/lib/softfloat3/source/f16_to_ui32_r_minMag.c"
#include "mame/lib/softfloat3/source/f16_to_ui64_r_minMag.c"
#include "mame/lib/softfloat3/source/f16_to_i32_r_minMag.c"
#include "mame/lib/softfloat3/source/f16_to_i64_r_minMag.c"
#include "mame/lib/softfloat3/source/f16_to_f32.c"
#include "mame/lib/softfloat3/source/f16_to_f64.c"
#include "mame/lib/softfloat3/source/f16_to_extF80.c"
#include "mame/lib/softfloat3/source/f16_to_extF80M.c"
#include "mame/lib/softfloat3/source/f16_to_f128.c"
#include "mame/lib/softfloat3/source/f16_to_f128M.c"
#include "mame/lib/softfloat3/source/f16_roundToInt.c"
#include "mame/lib/softfloat3/source/f16_add.c"
#include "mame/lib/softfloat3/source/f16_sub.c"
#include "mame/lib/softfloat3/source/f16_mul.c"
#include "mame/lib/softfloat3/source/f16_mulAdd.c"
#include "mame/lib/softfloat3/source/f16_div.c"
#include "mame/lib/softfloat3/source/f16_rem.c"
#include "mame/lib/softfloat3/source/f16_sqrt.c"
#include "mame/lib/softfloat3/source/f16_eq.c"
#include "mame/lib/softfloat3/source/f16_le.c"
#include "mame/lib/softfloat3/source/f16_lt.c"
#include "mame/lib/softfloat3/source/f16_eq_signaling.c"
#include "mame/lib/softfloat3/source/f16_le_quiet.c"
#include "mame/lib/softfloat3/source/f16_lt_quiet.c"
#include "mame/lib/softfloat3/source/f16_isSignalingNaN.c"
#include "mame/lib/softfloat3/source/f32_to_ui32.c"
#include "mame/lib/softfloat3/source/f32_to_ui64.c"
#include "mame/lib/softfloat3/source/f32_to_i32.c"
#include "mame/lib/softfloat3/source/f32_to_i64.c"
#include "mame/lib/softfloat3/source/f32_to_ui32_r_minMag.c"
#include "mame/lib/softfloat3/source/f32_to_ui64_r_minMag.c"
#include "mame/lib/softfloat3/source/f32_to_i32_r_minMag.c"
#include "mame/lib/softfloat3/source/f32_to_i64_r_minMag.c"
#include "mame/lib/softfloat3/source/f32_to_f16.c"
#include "mame/lib/softfloat3/source/f32_to_f64.c"
#include "mame/lib/softfloat3/source/f32_to_extF80.c"
#include "mame/lib/softfloat3/source/f32_to_extF80M.c"
#include "mame/lib/softfloat3/source/f32_to_f128.c"
#include "mame/lib/softfloat3/source/f32_to_f128M.c"
#include "mame/lib/softfloat3/source/f32_roundToInt.c"
#include "mame/lib/softfloat3/source/f32_add.c"
#include "mame/lib/softfloat3/source/f32_sub.c"
#include "mame/lib/softfloat3/source/f32_mul.c"
#include "mame/lib/softfloat3/source/f32_mulAdd.c"
#include "mame/lib/softfloat3/source/f32_div.c"
#include "mame/lib/softfloat3/source/f32_rem.c"
#include "mame/lib/softfloat3/source/f32_sqrt.c"
#include "mame/lib/softfloat3/source/f32_eq.c"
#include "mame/lib/softfloat3/source/f32_le.c"
#include "mame/lib/softfloat3/source/f32_lt.c"
#include "mame/lib/softfloat3/source/f32_eq_signaling.c"
#include "mame/lib/softfloat3/source/f32_le_quiet.c"
#include "mame/lib/softfloat3/source/f32_lt_quiet.c"
#include "mame/lib/softfloat3/source/f32_isSignalingNaN.c"
#include "mame/lib/softfloat3/source/f64_to_ui32.c"
#include "mame/lib/softfloat3/source/f64_to_ui64.c"
#include "mame/lib/softfloat3/source/f64_to_i32.c"
#include "mame/lib/softfloat3/source/f64_to_i64.c"
#include "mame/lib/softfloat3/source/f64_to_ui32_r_minMag.c"
#include "mame/lib/softfloat3/source/f64_to_ui64_r_minMag.c"
#include "mame/lib/softfloat3/source/f64_to_i32_r_minMag.c"
#include "mame/lib/softfloat3/source/f64_to_i64_r_minMag.c"
#include "mame/lib/softfloat3/source/f64_to_f16.c"
#include "mame/lib/softfloat3/source/f64_to_f32.c"
#include "mame/lib/softfloat3/source/f64_to_extF80.c"
#include "mame/lib/softfloat3/source/f64_to_extF80M.c"
#include "mame/lib/softfloat3/source/f64_to_f128.c"
#include "mame/lib/softfloat3/source/f64_to_f128M.c"
#include "mame/lib/softfloat3/source/f64_roundToInt.c"
#include "mame/lib/softfloat3/source/f64_add.c"
#include "mame/lib/softfloat3/source/f64_sub.c"
#include "mame/lib/softfloat3/source/f64_mul.c"
#include "mame/lib/softfloat3/source/f64_mulAdd.c"
#include "mame/lib/softfloat3/source/f64_div.c"
#include "mame/lib/softfloat3/source/f64_rem.c"
#include "mame/lib/softfloat3/source/f64_sqrt.c"
#include "mame/lib/softfloat3/source/f64_eq.c"
#include "mame/lib/softfloat3/source/f64_le.c"
#include "mame/lib/softfloat3/source/f64_lt.c"
#include "mame/lib/softfloat3/source/f64_eq_signaling.c"
#include "mame/lib/softfloat3/source/f64_le_quiet.c"
#include "mame/lib/softfloat3/source/f64_lt_quiet.c"
#include "mame/lib/softfloat3/source/f64_isSignalingNaN.c"
#include "mame/lib/softfloat3/source/extF80_to_ui32.c"
#include "mame/lib/softfloat3/source/extF80_to_ui64.c"
#include "mame/lib/softfloat3/source/extF80_to_i32.c"
#include "mame/lib/softfloat3/source/extF80_to_i64.c"
#include "mame/lib/softfloat3/source/extF80_to_ui32_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80_to_ui64_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80_to_i32_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80_to_i64_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80_to_f16.c"
#include "mame/lib/softfloat3/source/extF80_to_f32.c"
#include "mame/lib/softfloat3/source/extF80_to_f64.c"
#include "mame/lib/softfloat3/source/extF80_to_f128.c"
#include "mame/lib/softfloat3/source/extF80_roundToInt.c"
#include "mame/lib/softfloat3/source/extF80_add.c"
#include "mame/lib/softfloat3/source/extF80_sub.c"
#include "mame/lib/softfloat3/source/extF80_mul.c"
#include "mame/lib/softfloat3/source/extF80_div.c"
#include "mame/lib/softfloat3/source/extF80_rem.c"
#include "mame/lib/softfloat3/source/extF80_sqrt.c"
#include "mame/lib/softfloat3/source/extF80_eq.c"
#include "mame/lib/softfloat3/source/extF80_le.c"
#include "mame/lib/softfloat3/source/extF80_lt.c"
#include "mame/lib/softfloat3/source/extF80_eq_signaling.c"
#include "mame/lib/softfloat3/source/extF80_le_quiet.c"
#include "mame/lib/softfloat3/source/extF80_lt_quiet.c"
#include "mame/lib/softfloat3/source/extF80_isSignalingNaN.c"
#include "mame/lib/softfloat3/source/extF80M_to_ui32.c"
#include "mame/lib/softfloat3/source/extF80M_to_ui64.c"
#include "mame/lib/softfloat3/source/extF80M_to_i32.c"
#include "mame/lib/softfloat3/source/extF80M_to_i64.c"
#include "mame/lib/softfloat3/source/extF80M_to_ui32_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80M_to_ui64_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80M_to_i32_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80M_to_i64_r_minMag.c"
#include "mame/lib/softfloat3/source/extF80M_to_f16.c"
#include "mame/lib/softfloat3/source/extF80M_to_f32.c"
#include "mame/lib/softfloat3/source/extF80M_to_f64.c"
#include "mame/lib/softfloat3/source/extF80M_to_f128M.c"
#include "mame/lib/softfloat3/source/extF80M_roundToInt.c"
#include "mame/lib/softfloat3/source/extF80M_add.c"
#include "mame/lib/softfloat3/source/extF80M_sub.c"
#include "mame/lib/softfloat3/source/extF80M_mul.c"
#include "mame/lib/softfloat3/source/extF80M_div.c"
#include "mame/lib/softfloat3/source/extF80M_rem.c"
#include "mame/lib/softfloat3/source/extF80M_sqrt.c"
#include "mame/lib/softfloat3/source/extF80M_eq.c"
#include "mame/lib/softfloat3/source/extF80M_le.c"
#include "mame/lib/softfloat3/source/extF80M_lt.c"
#include "mame/lib/softfloat3/source/extF80M_eq_signaling.c"
#include "mame/lib/softfloat3/source/extF80M_le_quiet.c"
#include "mame/lib/softfloat3/source/extF80M_lt_quiet.c"
#include "mame/lib/softfloat3/source/f128_to_ui32.c"
#include "mame/lib/softfloat3/source/f128_to_ui64.c"
#include "mame/lib/softfloat3/source/f128_to_i32.c"
#include "mame/lib/softfloat3/source/f128_to_i64.c"
#include "mame/lib/softfloat3/source/f128_to_ui32_r_minMag.c"
#include "mame/lib/softfloat3/source/f128_to_ui64_r_minMag.c"
#include "mame/lib/softfloat3/source/f128_to_i32_r_minMag.c"
#include "mame/lib/softfloat3/source/f128_to_i64_r_minMag.c"
#include "mame/lib/softfloat3/source/f128_to_f16.c"
#include "mame/lib/softfloat3/source/f128_to_f32.c"
#include "mame/lib/softfloat3/source/f128_to_extF80.c"
#include "mame/lib/softfloat3/source/f128_to_f64.c"
#include "mame/lib/softfloat3/source/f128_roundToInt.c"
#include "mame/lib/softfloat3/source/f128_add.c"
#include "mame/lib/softfloat3/source/f128_sub.c"
#include "mame/lib/softfloat3/source/f128_mul.c"
#include "mame/lib/softfloat3/source/f128_mulAdd.c"
#include "mame/lib/softfloat3/source/f128_div.c"
#include "mame/lib/softfloat3/source/f128_rem.c"
#include "mame/lib/softfloat3/source/f128_sqrt.c"
#include "mame/lib/softfloat3/source/f128_eq.c"
#include "mame/lib/softfloat3/source/f128_le.c"
#include "mame/lib/softfloat3/source/f128_lt.c"
#include "mame/lib/softfloat3/source/f128_eq_signaling.c"
#include "mame/lib/softfloat3/source/f128_le_quiet.c"
#include "mame/lib/softfloat3/source/f128_lt_quiet.c"
#include "mame/lib/softfloat3/source/f128_isSignalingNaN.c"
#include "mame/lib/softfloat3/source/f128M_to_ui32.c"
#include "mame/lib/softfloat3/source/f128M_to_ui64.c"
#include "mame/lib/softfloat3/source/f128M_to_i32.c"
#include "mame/lib/softfloat3/source/f128M_to_i64.c"
#include "mame/lib/softfloat3/source/f128M_to_ui32_r_minMag.c"
#include "mame/lib/softfloat3/source/f128M_to_ui64_r_minMag.c"
#include "mame/lib/softfloat3/source/f128M_to_i32_r_minMag.c"
#include "mame/lib/softfloat3/source/f128M_to_i64_r_minMag.c"
#include "mame/lib/softfloat3/source/f128M_to_f16.c"
#include "mame/lib/softfloat3/source/f128M_to_f32.c"
#include "mame/lib/softfloat3/source/f128M_to_extF80M.c"
#include "mame/lib/softfloat3/source/f128M_to_f64.c"
#include "mame/lib/softfloat3/source/f128M_roundToInt.c"
#include "mame/lib/softfloat3/source/f128M_add.c"
#include "mame/lib/softfloat3/source/f128M_sub.c"
#include "mame/lib/softfloat3/source/f128M_mul.c"
#include "mame/lib/softfloat3/source/f128M_mulAdd.c"
#include "mame/lib/softfloat3/source/f128M_div.c"
#include "mame/lib/softfloat3/source/f128M_rem.c"
#include "mame/lib/softfloat3/source/f128M_sqrt.c"
#include "mame/lib/softfloat3/source/f128M_eq.c"
#include "mame/lib/softfloat3/source/f128M_le.c"
#include "mame/lib/softfloat3/source/f128M_lt.c"
#include "mame/lib/softfloat3/source/f128M_eq_signaling.c"
#include "mame/lib/softfloat3/source/f128M_le_quiet.c"
#include "mame/lib/softfloat3/source/f128M_lt_quiet.c"
#include "mame/lib/softfloat3/bochs_ext/f2xm1.c"
#include "mame/lib/softfloat3/bochs_ext/fpatan.c"
#include "mame/lib/softfloat3/bochs_ext/fprem.c"
#include "mame/lib/softfloat3/bochs_ext/fsincos.c"
#include "mame/lib/softfloat3/bochs_ext/fyl2x.c"
#include "mame/lib/softfloat3/bochs_ext/poly.c"
#include "mame/lib/softfloat3/bochs_ext/extF80_scale.c"
#include "mame/lib/softfloat3/bochs_ext/isNaN.c"
#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma optimize("g", on)
#endif
#else
#include "mame/lib/softfloat/softfloat.c"
#include "mame/lib/softfloat/fsincos.c"
#include "mame/lib/softfloat/fpatan.c"
#include "mame/lib/softfloat/f2xm1.c"
#include "mame/lib/softfloat/fyl2x.c"
#endif
#include "mame/emu/cpu/i386/i386.c"
#include "mame/emu/cpu/vtlb.c"
#undef CPU_INIT
#undef CPU_RESET
#undef CPU_EXECUTE
#ifdef USE_DEBUGGER
#include "mame/emu/cpu/i386/i386dasm.c"
#undef CPU_DISASSEMBLE
int CPU_DISASSEMBLE(UINT8 *oprom, offs_t eip, bool is_ia32, char *buffer, size_t buffer_len)
{
if(is_ia32) {
return CPU_DISASSEMBLE_CALL(x86_32) & DASMFLAG_LENGTHMASK;
} else {
return CPU_DISASSEMBLE_CALL(x86_16) & DASMFLAG_LENGTHMASK;
}
}
#endif
#define CPU_EAX REG32(EAX)
#define CPU_ECX REG32(ECX)
#define CPU_EDX REG32(EDX)
#define CPU_EBX REG32(EBX)
#define CPU_ESP REG32(ESP)
#define CPU_EBP REG32(EBP)
#define CPU_ESI REG32(ESI)
#define CPU_EDI REG32(EDI)
#define CPU_AX REG16(AX)
#define CPU_CX REG16(CX)
#define CPU_DX REG16(DX)
#define CPU_BX REG16(BX)
#define CPU_SP REG16(SP)
#define CPU_BP REG16(BP)
#define CPU_SI REG16(SI)
#define CPU_DI REG16(DI)
#define CPU_AL REG8(AL)
#define CPU_CL REG8(CL)
#define CPU_DL REG8(DL)
#define CPU_BL REG8(BL)
#define CPU_AH REG8(AH)
#define CPU_CH REG8(CH)
#define CPU_DH REG8(DH)
#define CPU_BH REG8(BH)
#define CPU_ES m_sreg[ES].selector
#define CPU_CS m_sreg[CS].selector
#define CPU_SS m_sreg[SS].selector
#define CPU_DS m_sreg[DS].selector
#define CPU_FS m_sreg[FS].selector
#define CPU_GS m_sreg[GS].selector
#ifdef USE_DEBUGGER
#define CPU_PREV_CS m_prev_cs
#endif
#define CPU_ES_BASE m_sreg[ES].base
#define CPU_CS_BASE m_sreg[CS].base
#define CPU_SS_BASE m_sreg[SS].base
#define CPU_DS_BASE m_sreg[DS].base
#define CPU_FS_BASE m_sreg[FS].base
#define CPU_GS_BASE m_sreg[GS].base
#define CPU_ES_INDEX ES
#define CPU_CS_INDEX CS
#define CPU_SS_INDEX SS
#define CPU_DS_INDEX DS
#define CPU_FS_INDEX FS
#define CPU_GS_INDEX GS
inline void CPU_LOAD_SREG(UINT8 reg, UINT16 selector)
{
i386_sreg_load(selector, reg, NULL);
}
#define CPU_EIP_CHANGED (m_eip != m_prev_eip)
#define CPU_EIP m_eip
#define CPU_PREV_EIP m_prev_eip
inline void CPU_SET_EIP(UINT32 value)
{
m_eip = value;
CHANGE_PC(m_eip);
}
#define CPU_GDTR_LIMIT m_gdtr.limit
#define CPU_GDTR_BASE m_gdtr.base
#define CPU_IDTR_LIMIT m_idtr.limit
#define CPU_IDTR_BASE m_idtr.base
#define CPU_MSW m_cr[0]
#define CPU_CR0 m_cr[0]
#define CPU_CR1 m_cr[1]
#define CPU_CR2 m_cr[2]
#define CPU_CR3 m_cr[3]
#define CPU_CR4 m_cr[4]
#define CPU_CR0_PE (1 << 0)
#define CPU_CR0_PG (1 << 31)
#define CPU_DR(x) m_dr[x]
#define CPU_C_FLAG (m_CF != 0)
#define CPU_P_FLAG (m_PF != 0)
#define CPU_A_FLAG (m_AF != 0)
#define CPU_Z_FLAG (m_ZF != 0)
#define CPU_S_FLAG (m_SF != 0)
#define CPU_I_FLAG (m_IF != 0)
#define CPU_D_FLAG (m_DF != 0)
#define CPU_O_FLAG (m_OF != 0)
#if defined(SUPPORT_FPU)
#define FPU_CTRLWORD m_x87_cw
#define FPU_STATUSWORD m_x87_sw
#define FPU_TAGWORD m_x87_tw
#define FPU_INSTPTR_OFFSET m_x87_inst_ptr
#define FPU_INSTPTR_SEG m_x87_cs
#define FPU_DATAPTR_OFFSET m_x87_data_ptr
#define FPU_DATAPTR_SEG m_x87_ds
UINT8 FPU_REG(int n, int i)
{
#ifdef SUPPORT_FPU_SOFTFLOAT3
switch(i) {
case 0: return (m_x87_reg[n].signif >> 0) & 0xff;
case 1: return (m_x87_reg[n].signif >> 8) & 0xff;
case 2: return (m_x87_reg[n].signif >> 16) & 0xff;
case 3: return (m_x87_reg[n].signif >> 24) & 0xff;
case 4: return (m_x87_reg[n].signif >> 32) & 0xff;
case 5: return (m_x87_reg[n].signif >> 40) & 0xff;
case 6: return (m_x87_reg[n].signif >> 48) & 0xff;
case 7: return (m_x87_reg[n].signif >> 56) & 0xff;
case 8: return (m_x87_reg[n].signExp >> 0) & 0xff;
case 9: return (m_x87_reg[n].signExp >> 8) & 0xff;
}
#else
switch(i) {
case 0: return (m_x87_reg[n].low >> 0) & 0xff;
case 1: return (m_x87_reg[n].low >> 8) & 0xff;
case 2: return (m_x87_reg[n].low >> 16) & 0xff;
case 3: return (m_x87_reg[n].low >> 24) & 0xff;
case 4: return (m_x87_reg[n].low >> 32) & 0xff;
case 5: return (m_x87_reg[n].low >> 40) & 0xff;
case 6: return (m_x87_reg[n].low >> 48) & 0xff;
case 7: return (m_x87_reg[n].low >> 56) & 0xff;
case 8: return (m_x87_reg[n].high >> 0) & 0xff;
case 9: return (m_x87_reg[n].high >> 8) & 0xff;
}
#endif
return 0;
}
void SET_FPU_REG(int n, int i, UINT8 val)
{
#ifdef SUPPORT_FPU_SOFTFLOAT3
switch(i) {
case 0: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 0)) | ((UINT64)val << 0); break;
case 1: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 8)) | ((UINT64)val << 8); break;
case 2: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 16)) | ((UINT64)val << 16); break;
case 3: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 24)) | ((UINT64)val << 24); break;
case 4: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 32)) | ((UINT64)val << 32); break;
case 5: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 40)) | ((UINT64)val << 40); break;
case 6: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 48)) | ((UINT64)val << 48); break;
case 7: m_x87_reg[n].signif = (m_x87_reg[n].signif & ~((UINT64)0xff << 56)) | ((UINT64)val << 56); break;
case 8: m_x87_reg[n].signExp = (m_x87_reg[n].signExp & ~((UINT16)0xff << 0)) | ((UINT16)val << 0); break;
case 9: m_x87_reg[n].signExp = (m_x87_reg[n].signExp & ~((UINT16)0xff << 8)) | ((UINT16)val << 8); break;
}
#else
switch(i) {
case 0: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 0)) | ((UINT64)val << 0); break;
case 1: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 8)) | ((UINT64)val << 8); break;
case 2: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 16)) | ((UINT64)val << 16); break;
case 3: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 24)) | ((UINT64)val << 24); break;
case 4: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 32)) | ((UINT64)val << 32); break;
case 5: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 40)) | ((UINT64)val << 40); break;
case 6: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 48)) | ((UINT64)val << 48); break;
case 7: m_x87_reg[n].low = (m_x87_reg[n].low & ~((UINT64)0xff << 56)) | ((UINT64)val << 56); break;
case 8: m_x87_reg[n].high = (m_x87_reg[n].high & ~((UINT16)0xff << 0)) | ((UINT16)val << 0); break;
case 9: m_x87_reg[n].high = (m_x87_reg[n].high & ~((UINT16)0xff << 8)) | ((UINT16)val << 8); break;
}
#endif
}
#endif
inline void CPU_SET_C_FLAG(UINT8 value)
{
m_CF = value;
}
inline void CPU_SET_P_FLAG(UINT8 value)
{
m_PF = value;
}
inline void CPU_SET_A_FLAG(UINT8 value)
{
m_AF = value;
}
inline void CPU_SET_Z_FLAG(UINT8 value)
{
m_ZF = value;
}
inline void CPU_SET_S_FLAG(UINT8 value)
{
m_SF = value;
}
inline void CPU_SET_T_FLAG(UINT8 value)
{
m_TF = value;
}
inline void CPU_SET_I_FLAG(UINT8 value)
{
m_IF = value;
}
inline void CPU_SET_D_FLAG(UINT8 value)
{
m_DF = value;
}
inline void CPU_SET_O_FLAG(UINT8 value)
{
m_OF = value;
}
inline void CPU_SET_IOP_FLAG(UINT8 value)
{
m_IOP1 = (value ) & 1;
m_IOP2 = (value >> 1) & 1;
}
inline void CPU_SET_NT_FLAG(UINT8 value)
{
m_NT = value;
}
inline void CPU_SET_VM_FLAG(UINT8 value)
{
m_VM = value;
}
inline void CPU_SET_CR0(UINT32 value)
{
m_cr[0] = value;
}
inline void CPU_SET_CR3(UINT32 value)
{
m_cr[3] = value;
vtlb_flush_dynamic(m_vtlb);
}
inline void CPU_SET_CPL(int value)
{
m_CPL = value;
}
#define CPU_STAT_PM PROTECTED_MODE
#define CPU_STAT_VM86 V8086_MODE
#define CPU_EFLAG get_flags()
#define CPU_SET_EFLAG(x) set_flags(x)
#define CPU_ADRSMASK m_a20_mask
#define CPU_A20_LINE(x) i386_set_a20_line(x)
inline void CPU_IRQ_LINE(int state)
{
if(state) {
i386_set_irq_line(INPUT_LINE_IRQ, HOLD_LINE);
} else {
i386_set_irq_line(INPUT_LINE_IRQ, CLEAR_LINE);
}
}
#define CPU_INST_OP32 m_operand_size
void CPU_INIT()
{
CPU_INIT_CALL(CPU_MODEL);
}
void CPU_RELEASE()
{
vtlb_free(m_vtlb);
}
void CPU_FINISH()
{
CPU_RELEASE();
}
void CPU_RESET()
{
CPU_RESET_CALL(CPU_MODEL);
}
void CPU_EXECUTE()
{
CPU_EXECUTE_CALL(i386);
}
void CPU_SOFT_INTERRUPT(int irq)
{
m_ext = 0; // not an external interrupt
i386_trap(irq, 1);
m_ext = 1;
}
void CPU_JMP_FAR(UINT16 selector, UINT32 address)
{
if(PROTECTED_MODE && !V8086_MODE) {
i386_protected_mode_jump(selector, address, 1, m_operand_size);
} else {
m_sreg[CS].selector = selector;
m_performed_intersegment_jump = 1;
i386_load_segment_descriptor(CS);
m_eip = address;
CHANGE_PC(m_eip);
}
}
void CPU_CALL_FAR(UINT16 selector, UINT32 address)
{
if(PROTECTED_MODE && !V8086_MODE) {
i386_protected_mode_call(selector, address, 1, m_operand_size);
} else {
PUSH16(m_sreg[CS].selector);
PUSH16(m_eip);
m_sreg[CS].selector = selector;
m_performed_intersegment_jump = 1;
i386_load_segment_descriptor(CS);
m_eip = address;
CHANGE_PC(m_eip);
}
}
void CPU_IRET()
{
// Don't call msdos_syscall() in iret routine
m_pc = 1;
I386OP(iret16)();
}
void CPU_PUSH(UINT16 value)
{
PUSH16(value);
}
UINT16 CPU_POP()
{
return POP16();
}
void CPU_PUSHF()
{
I386OP(pushf)();
}
UINT16 CPU_READ_STACK()
{
UINT32 ea, new_esp;
if( STACK_32BIT ) {
new_esp = REG32(ESP) + 2;
ea = i386_translate(SS, new_esp - 2, 0, 2);
} else {
new_esp = REG16(SP) + 2;
ea = i386_translate(SS, (new_esp - 2) & 0xffff, 0, 2);
}
return READ16(ea);
}
void CPU_WRITE_STACK(UINT16 value)
{
UINT32 ea, new_esp;
if( STACK_32BIT ) {
new_esp = REG32(ESP) + 2;
ea = i386_translate(SS, new_esp - 2, 0, 2);
} else {
new_esp = REG16(SP) + 2;
ea = i386_translate(SS, (new_esp - 2) & 0xffff, 0, 2);
}
WRITE16(ea, value);
}
void CPU_LOAD_LDTR(UINT16 selector)
{
I386_SREG seg;
m_ldtr.segment = selector;
seg.selector = selector;
i386_load_protected_mode_segment(&seg, NULL);
m_ldtr.limit = seg.limit;
m_ldtr.base = seg.base;
m_ldtr.flags = seg.flags;
}
void CPU_LOAD_TR(UINT16 selector)
{
I386_SREG seg;
m_task.segment = selector;
seg.selector = selector;
i386_load_protected_mode_segment(&seg, NULL);
m_task.limit = seg.limit;