1 
2 // NOTE for bit string/field addressing
3 // ************************************
4 // modDim must be passed as 10 for bit string instructions,
5 // and as 11 for bit field instructions
6 
7 
8 
9 // Output variables for ReadAMAddress()
10 UINT8 amFlag;
11 UINT32 amOut;
12 UINT32 bamOffset;
13 
14 // Appo temp var
15 UINT32 amLength1,amLength2,amLength3,amLength4;
16 
17 
18 // Global vars used by AM functions
19 UINT32 modAdd;
20 UINT8 modM;
21 UINT8 modVal;
22 UINT8 modVal2;
23 UINT8 modWriteValB;
24 UINT16 modWriteValH;
25 UINT32 modWriteValW;
26 UINT8 modDim;
27 
28 // Addressing mode functions and tables
29 #include "am1.c" // ReadAM
30 #include "am2.c" // ReadAMAddress
31 #include "am3.c" // WriteAM
32 
33 /*
34   Input:
35   modAdd
36 	modDim
37 
38   Output:
39 	amOut
40 	amLength
41 */
42 
ReadAM(void)43 UINT32 ReadAM(void)
44 {
45 	modM=modM?1:0;
46 	modVal=OpRead8(modAdd);
47 	return AMTable1[modM][modVal>>5]();
48 }
49 
BitReadAM(void)50 UINT32 BitReadAM(void)
51 {
52 	modM=modM?1:0;
53 	modVal=OpRead8(modAdd);
54 	return BAMTable1[modM][modVal>>5]();
55 }
56 
57 
58 
59 /*
60   Input:
61   modAdd
62 	modDim
63 
64   Output:
65 	amOut
66 	amFlag
67 	amLength
68 */
69 
ReadAMAddress(void)70 UINT32 ReadAMAddress(void)
71 {
72 	modM=modM?1:0;
73 	modVal=OpRead8(modAdd);
74 	return AMTable2[modM][modVal>>5]();
75 }
76 
BitReadAMAddress(void)77 UINT32 BitReadAMAddress(void)
78 {
79 	modM=modM?1:0;
80 	modVal=OpRead8(modAdd);
81 	return BAMTable2[modM][modVal>>5]();
82 }
83 
84 /*
85   Input:
86   modAdd
87 	modDim
88 	modWriteValB/H/W
89 
90   Output:
91 	amOut
92 	amLength
93 */
94 
WriteAM(void)95 UINT32 WriteAM(void)
96 {
97 	modM=modM?1:0;
98 	modVal=OpRead8(modAdd);
99 	return AMTable3[modM][modVal>>5]();
100 }
101 
102 
103