Previous 199869 Revisions Next

r34086 Saturday 27th December, 2014 at 13:39:22 UTC by David Haywood
arcompact - it's actually executing code in cartridge space now (nw)
[src/emu/cpu/arcompact]arcompact.c arcompact.h arcompact_execute.c arcompact_make.py
[src/mess/drivers]leapster.c

trunk/src/emu/cpu/arcompact/arcompact.c
r242597r242598
2424
2525const device_type ARCA5 = &device_creator<arcompact_device>;
2626
27static ADDRESS_MAP_START( arcompact_auxreg_map, AS_IO, 32, arcompact_device )
28ADDRESS_MAP_END
29
30
2731arcompact_device::arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2832   : cpu_device(mconfig, ARCA5, "ARCtangent-A5", tag, owner, clock, "arca5", __FILE__)
2933   , m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0) // some docs describe these as 'middle endian'?!
34   , m_io_config( "io", ENDIANNESS_LITTLE, 32, 34, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) ) // IO space is 32 bits of dwords, so 34-bits
3035{
3136}
3237
r242597r242598
5964   m_debugger_temp = 0;
6065
6166   m_program = &space(AS_PROGRAM);
67   m_io = &space(AS_IO);
6268
6369   state_add( 0,  "PC", m_debugger_temp).callimport().callexport().formatstr("%08X");
6470
r242597r242598
156162
157163}
158164
165
159166/*****************************************************************************/
167   
160168
161169void arcompact_device::execute_set_input(int irqline, int state)
162170{
trunk/src/emu/cpu/arcompact/arcompact.h
r242597r242598
7777   virtual void execute_set_input(int inputnum, int state);
7878
7979   // device_memory_interface overrides
80   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; }
80   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); }
8181
8282   // device_state_interface overrides
8383   virtual void state_import(const device_state_entry &entry);
r242597r242598
160160   ARCOMPACT_RETTYPE arcompact_handle04_0b(OPS_32);
161161   ARCOMPACT_RETTYPE arcompact_handle04_0c(OPS_32);
162162   ARCOMPACT_RETTYPE arcompact_handle04_0d(OPS_32);
163   ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32);
163//   ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32);
164164//   ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32);
165165   ARCOMPACT_RETTYPE arcompact_handle04_10(OPS_32);
166166   ARCOMPACT_RETTYPE arcompact_handle04_11(OPS_32);
167167   ARCOMPACT_RETTYPE arcompact_handle04_12(OPS_32);
168168//   ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32);
169   ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32);
169//   ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32);
170170//   ARCOMPACT_RETTYPE arcompact_handle04_15(OPS_32);
171171//   ARCOMPACT_RETTYPE arcompact_handle04_16(OPS_32);
172   ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32);
173   ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32);
174   ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32);
172//   ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32);
173//   ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32);
174//   ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32);
175175   ARCOMPACT_RETTYPE arcompact_handle04_1a(OPS_32);
176176   ARCOMPACT_RETTYPE arcompact_handle04_1b(OPS_32);
177177   ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32);
r242597r242598
183183   ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32);
184184   ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32);
185185   ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
186   ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32);
186//   ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32);
187187   ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32);
188188   ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32);
189189//   ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32);
r242597r242598
773773   ARCOMPACT_HANDLER04_TYPE_PM(04_06);
774774   ARCOMPACT_HANDLER04_TYPE_PM(04_07);
775775   ARCOMPACT_HANDLER04_TYPE_PM(04_0a);
776   ARCOMPACT_HANDLER04_TYPE_PM(04_0e);
776777   ARCOMPACT_HANDLER04_TYPE_PM(04_0f);
777778   ARCOMPACT_HANDLER04_TYPE_PM(04_13);
779   ARCOMPACT_HANDLER04_TYPE_PM(04_14);
778780   ARCOMPACT_HANDLER04_TYPE_PM(04_15);
779781   ARCOMPACT_HANDLER04_TYPE_PM(04_16);
782   ARCOMPACT_HANDLER04_TYPE_PM(04_17);   
783   ARCOMPACT_HANDLER04_TYPE_PM(04_18);
784   ARCOMPACT_HANDLER04_TYPE_PM(04_19);   
780785   ARCOMPACT_HANDLER04_TYPE_PM(04_20);
786   ARCOMPACT_HANDLER04_TYPE_PM(04_2b);
781787
782788   ARCOMPACT_HANDLER04_TYPE_PM(04_2f_02);
783789   ARCOMPACT_HANDLER04_TYPE_PM(04_2f_07);
r242597r242598
788794
789795
790796private:
791   address_space_config m_program_config;
797   const address_space_config m_program_config;
798   const address_space_config m_io_config;
792799
793800   UINT32 m_pc;
794801
795802   address_space *m_program;
803   address_space  *m_io;
804
796805   int m_icount;
797806
798807   UINT32 m_debugger_temp;
r242597r242598
806815   inline UINT8 READ8(UINT32 address) { return m_program->read_byte(address << 0); }
807816   inline void WRITE8(UINT32 address, UINT8 data){    m_program->write_byte(address << 0, data); }
808817   
818   inline  UINT64 READAUX(UINT64 address) { return m_io->read_dword(address *4); }
819   inline void WRITEAUX(UINT64 address, UINT32 data) { m_io->write_dword(address *4, data); }
820
821
809822   int check_condition(UINT8 condition);
810823
811824   UINT32 m_regs[0x40];
r242597r242598
853866#define CONDITION_EQ (STATUS32_CHECK_Z)
854867#define CONDITION_CS (STATUS32_CHECK_C)
855868#define CONDITION_LT ((STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V))
869#define CONDITION_MI (STATUS32_CHECK_N)
856870
857
858871extern const device_type ARCA5;
859872
860873
trunk/src/emu/cpu/arcompact/arcompact_execute.c
r242597r242598
148148      case 0x01: return CONDITION_EQ;
149149      case 0x02: return !CONDITION_EQ; // NE
150150      case 0x03: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
151      case 0x04: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
151      case 0x04: return CONDITION_MI; // MI (N)
152152      case 0x05: return CONDITION_CS; // CS (Carry Set / Lower than)
153153      case 0x06: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
154154      case 0x07: fatalerror("unhandled condition check %s", conditions[condition]); return -1;
r242597r242598
15011501   return m_pc + (size>>0);
15021502}
15031503
1504ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_04(OPS_32)  { return arcompact_01_01_01_helper(PARAMS, "BRLO"); }
1504ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_04(OPS_32) //  register - immediate BRLO
1505{
1506   BR_REGIMM_SETUP
15051507
1508   // BRLO (unsigned operation)
1509   if (b < c)
1510   {
1511      BR_TAKEJUMP
1512   }
1513   
1514   return m_pc + (size>>0);
1515
1516}
1517
15061518ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_05(OPS_32) // register - immediate BRHS
15071519{
15081520   BR_REGIMM_SETUP
r242597r242598
18401852   return arcompact_handle04_helper(PARAMS, opcodes_04[0x0d], /*"RCMP"*/ 1,0);
18411853}
18421854
1843ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0e(OPS_32)
1844{
1845   return arcompact_handle04_helper(PARAMS, opcodes_04[0x0e], /*"RSUB"*/ 0,0);
1846}
18471855
18481856
18491857ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32) 
r242597r242598
18631871
18641872
18651873
1866ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_14(OPS_32) 
1867{
1868   return arcompact_handle04_helper(PARAMS, opcodes_04[0x14], /*"ADD1"*/ 0,0);
1869}
18701874
18711875
18721876
1873
1874ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_17(OPS_32) 
1875{
1876   return arcompact_handle04_helper(PARAMS, opcodes_04[0x17], /*"SUB1"*/ 0,0);
1877}
1878
1879ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_18(OPS_32) 
1880{
1881   return arcompact_handle04_helper(PARAMS, opcodes_04[0x18], /*"SUB2"*/ 0,0);
1882}
1883
1884ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_19(OPS_32) 
1885{
1886   return arcompact_handle04_helper(PARAMS, opcodes_04[0x19], /*"SUB3"*/ 0,0);
1887}
1888
18891877ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1a(OPS_32) 
18901878{
18911879   return arcompact_handle04_helper(PARAMS, opcodes_04[0x1a], /*"MPY"*/ 0,0);
r242597r242598
19131901   int got_limm = 0;
19141902
19151903   COMMON32_GET_creg
1904   COMMON32_GET_F
19161905
19171906   if (creg == LIMM_REG)
19181907   {
r242597r242598
19341923      // J.F [ilink1]    0010 0RRR 0010 0000 1RRR 0111 01RR RRRR  (creg = ILINK1, FLAG must be set)
19351924      // J.F [ilink2]    0010 0RRR 0010 0000 1RRR 0111 10RR RRRR  (creg = ILINE2, FLAG must be set)
19361925
1937      arcompact_log("unimplemented J %08x", op);
1926      if (F)
1927      {
1928         if ((creg == REG_ILINK1) || (creg == REG_ILINK2))
1929         {
1930            arcompact_log("1 unimplemented J.F %08x", op);
1931         }
1932         else
1933         {
1934            // should not use .F unless jumping to ILINK1/2
1935            arcompact_fatal ("illegal 1 unimplemented J.F (F should not be set) %08x", op);
1936         }
1937
1938      }
1939      else
1940      {
1941         if ((creg == REG_ILINK1) || (creg == REG_ILINK2))
1942         {
1943            // should only jumping to ILINK1/2 if .F is set
1944            arcompact_fatal("illegal 1 unimplemented J (F not set) %08x", op);
1945         }
1946         else
1947         {
1948           
1949            return m_regs[creg];
1950         }
1951      }
19381952   }
19391953
19401954   return m_pc + (size>>0);
r242597r242598
19451959   // opcode          iiii i--- ppII IIII F--- uuuu uu-- ----
19461960   // J u6            0010 0RRR 0110 0000 0RRR uuuu uuRR RRRR
19471961   int size = 4;
1948   arcompact_log("unimplemented J %08x", op);
1962   arcompact_log("2 unimplemented J %08x", op);
19491963   return m_pc + (size>>0);
19501964}
19511965
r242597r242598
19541968   // opcode          iiii i--- ppII IIII F--- ssss ssSS SSSS
19551969   // J s12           0010 0RRR 1010 0000 0RRR ssss ssSS SSSS
19561970   int size = 4;
1957   arcompact_log("unimplemented J %08x", op);
1971   arcompact_log("3 unimplemented J %08x", op);
19581972   return m_pc + (size>>0);
19591973}
19601974
r242597r242598
21482162   return m_pc + (size>>0);
21492163}
21502164
2151ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2b(OPS_32)  // Store TO Auxiliary register FROM register
2152{   
2153   int size = 4;
2154//   UINT32 limm = 0;
2155   int got_limm = 0;
21562165
2157   COMMON32_GET_p;
2158   COMMON32_GET_breg;
2159
2160   if (breg == LIMM_REG)
2161   {
2162      //GET_LIMM_32;
2163      size = 8;
2164      got_limm = 1;
2165
2166   }
2167   else
2168   {
2169   }
2170
2171   if (p == 0)
2172   {
2173
2174      COMMON32_GET_creg
2175
2176      if (creg == LIMM_REG)
2177      {
2178         if (!got_limm)
2179         {
2180            //GET_LIMM_32;
2181            size = 8;
2182         }
2183      }
2184      else
2185      {
2186      }
2187   }
2188   else if (p == 1)
2189   {
2190   }
2191   else if (p == 2)
2192   {
2193   }
2194   else if (p == 3)
2195   {
2196   }
2197
2198   arcompact_log("unimplemented SR %08x", op);
2199   return m_pc + (size>>0);
2200}
2201
22022166ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_29(OPS_32)
22032167{
22042168   // leapster bios uses formats for FLAG that are not defined, bug I guess work anyway (P modes 0 / 1)
r242597r242598
26722636
26732637
26742638// Zero parameters (ZOP)
2675ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_00(OPS_16)  { arcompact_log("NOP_S"); return m_pc + (2 >> 0);}
2639ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_00(OPS_16)  { /*arcompact_log("NOP_S");*/ return m_pc + (2 >> 0);}
26762640ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_01(OPS_16)  { arcompact_log("UNIMP_S"); return m_pc + (2 >> 0);} // Unimplemented Instruction, same as illegal, but recommended to fill blank space
26772641ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_04(OPS_16)  { arcompact_log("JEQ_S [blink]"); return m_pc + (2 >> 0);}
26782642ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_05(OPS_16)  { arcompact_log("JNE_S [blink]"); return m_pc + (2 >> 0);}
r242597r242598
27192683
27202684ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_11(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ABS_S",0);  }
27212685ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_12(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "NOT_S",0);  }
2722ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_13(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "NEG_S",0);  }
2723ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_14(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ADD1_S",0); }
2724ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_15(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ADD2_S",0); }
2725ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_16(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ADD3_S",0); }
2686
2687
27262688ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_18(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ASL_S",0);  }
2727ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_19(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "LSR_S",0);  }
2689
27282690ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1a(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ASR_S",0);  }
27292691
27302692
trunk/src/emu/cpu/arcompact/arcompact_make.py
r242597r242598
1717        print >>f, "      if (c == 0x00000001) { STATUS32_SET_C; }"
1818        print >>f, "      else { STATUS32_CLEAR_C; }"
1919
20def EmitGroup04_Handle_NZCV_ADD_Flags(f, funcname, opname):
21        print >>f, "      if (result & 0x80000000) { STATUS32_SET_N; }"
22        print >>f, "      else { STATUS32_CLEAR_N; }"
23        print >>f, "      if (result == 0x00000000) { STATUS32_SET_Z; }"
24        print >>f, "      else { STATUS32_CLEAR_Z; }"
25        print >>f, "      if ((b & 0x80000000) == (c & 0x80000000))"
26        print >>f, "      {"
27        print >>f, "         if ((result & 0x80000000) != (b & 0x80000000))"
28        print >>f, "         {"
29        print >>f, "            STATUS32_SET_V;"
30        print >>f, "         }"
31        print >>f, "         else"
32        print >>f, "         {"
33        print >>f, "            STATUS32_CLEAR_V;"
34        print >>f, "         }"
35        print >>f, "      }"
36        print >>f, "      if (b < c)"
37        print >>f, "      {"
38        print >>f, "         STATUS32_SET_C;"
39        print >>f, "      }"
40        print >>f, "      else"
41        print >>f, "      {"
42        print >>f, "         STATUS32_CLEAR_C;"
43        print >>f, "      }"
2044
2145
2246def EmitGroup04_no_Flags(f, funcname, opname):
r242597r242598
4266        flaghandler(f, funcname, opname)
4367        print >>f, "   }"
4468
69def EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler):
70    print >>f, "   int size = 4;"
71   
72    if breg_is_dst_only == 0:   
73        print >>f, "   UINT32 limm = 0;"
74   
75    print >>f, "/*   int got_limm = 0; */"
76    print >>f, "   "
77    print >>f, "   COMMON32_GET_breg;"
78   
79    if flagcondition == -1:
80        print >>f, "   COMMON32_GET_F;"
81   
82    print >>f, "   COMMON32_GET_u6;"
83   
84    if ignore_a == 0:
85        print >>f, "   COMMON32_GET_areg;"
86    elif ignore_a == 1:
87        print >>f, "     //COMMON32_GET_areg; // areg is reserved / not used"
88    elif ignore_a == 2:
89        print >>f, "     //COMMON32_GET_areg; // areg bits already used as opcode select"
90    elif ignore_a == 3:
91        print >>f, "     //COMMON32_GET_areg; // areg bits already used as condition code select"
92    print >>f, "   "
93   
94    print >>f, "   UINT32 c;"
95    if breg_is_dst_only == 0:
96        print >>f, "   UINT32 b;"
97        print >>f, "   "
98        print >>f, "   /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */"
99        print >>f, "   if (breg == LIMM_REG)"
100        print >>f, "   {"
101        print >>f, "      GET_LIMM_32;"
102        print >>f, "      size = 8;"
103        print >>f, "/*      got_limm = 1; */"
104        print >>f, "      b = limm;"
105        print >>f, "   }"
106        print >>f, "   else"
107        print >>f, "   {"
108        print >>f, "      b = m_regs[breg];"
109        print >>f, "   }"
110   
111    print >>f, "    "
112    print >>f, "    c = u;"
113    print >>f, "   "
114    print >>f, "   /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */"
115
45116def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler):
46117    # the mode 0x00 handler 
47118    print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p00(OPS_32)" % (funcname)
r242597r242598
56127
57128    if flagcondition == -1:
58129        print >>f, "   COMMON32_GET_F;"
59   
130       
60131    print >>f, "   COMMON32_GET_creg;"
61132
62133    if ignore_a == 0:
63134        print >>f, "   COMMON32_GET_areg;"
64135    elif ignore_a == 1:
65       print >>f, "     //COMMON32_GET_areg; // areg is reserved / not used"
136        print >>f, "     //COMMON32_GET_areg; // areg is reserved / not used"
66137    elif ignore_a == 2:
67       print >>f, "     //COMMON32_GET_areg; // areg bits already used as opcode select"
138        print >>f, "     //COMMON32_GET_areg; // areg bits already used as opcode select"
68139 
69140    print >>f, "   "
70141   
r242597r242598
111182    # the mode 0x01 handler   
112183    print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p01(OPS_32)" % (funcname)
113184    print >>f, "{"
114    print >>f, "   int size = 4;"
115   
116    if breg_is_dst_only == 0:   
117        print >>f, "   UINT32 limm = 0;"
118   
119    print >>f, "/*   int got_limm = 0; */"
120    print >>f, "   "
121    print >>f, "   COMMON32_GET_breg;"
122   
123    if flagcondition == -1:
124        print >>f, "   COMMON32_GET_F;"
125   
126    print >>f, "   COMMON32_GET_u6;"
127   
128    if ignore_a == 0:
129        print >>f, "   COMMON32_GET_areg;"
130    elif ignore_a == 1:
131       print >>f, "     //COMMON32_GET_areg; // areg is reserved / not used"
132    elif ignore_a == 2:
133       print >>f, "     //COMMON32_GET_areg; // areg bits already used as opcode select"
134   
135    print >>f, "   "
136   
137    print >>f, "   UINT32 c;"
138    if breg_is_dst_only == 0:
139        print >>f, "   UINT32 b;"
140        print >>f, "   "
141        print >>f, "   /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */"
142        print >>f, "   if (breg == LIMM_REG)"
143        print >>f, "   {"
144        print >>f, "      GET_LIMM_32;"
145        print >>f, "      size = 8;"
146        print >>f, "/*      got_limm = 1; */"
147        print >>f, "      b = limm;"
148        print >>f, "   }"
149        print >>f, "   else"
150        print >>f, "   {"
151        print >>f, "      b = m_regs[breg];"
152        print >>f, "   }"
153   
154    print >>f, "    "
155    print >>f, "    c = u;"
156    print >>f, "   "
157    print >>f, "   /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */"
185    EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler)
158186    print >>f, "   %s" % (opexecute)
159187    print >>f, "   %s" % (opwrite)   
160188    print >>f, "   "
r242597r242598
244272        print >>f, "}"
245273    else:
246274        print >>f, "{"
247        print >>f, "   int size = 4;"
248        print >>f, "   arcompact_fatal(\"arcompact_handle%s_p11_m1 (%s)\\n\");"  % (funcname, opname)
275        EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, 3, breg_is_dst_only, flagcondition, flaghandler)
276        print >>f, "   COMMON32_GET_CONDITION;"
277        print >>f, "   if (!check_condition(condition))"
278        print >>f, "      return m_pc + (size>>0);"
279        print >>f, ""     
280        print >>f, "   %s" % (opexecute)
281        print >>f, "   %s" % (opwrite_alt)   
282        print >>f, "   "
283        EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler)
249284        print >>f, "   return m_pc + (size >> 0);"
250285        print >>f, "}"
251286        print >>f, ""
r242597r242598
297332    sys.exit(1)
298333
299334
300EmitGroup04(f, "04_00", "ADD", "UINT32 result = b + c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags )
335EmitGroup04(f, "04_00", "ADD", "UINT32 result = b + c;",                 "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_Handle_NZCV_ADD_Flags )
301336
302EmitGroup04(f, "04_02", "SUB", "UINT32 result = b - c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
337EmitGroup04(f, "04_02", "SUB", "UINT32 result = b - c;",                "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
303338
304EmitGroup04(f, "04_04", "AND", "UINT32 result = b & c;", "if (areg != LIMM_REG) { m_regs[areg] = result; }", "if (breg != LIMM_REG) { m_regs[breg] = result; }", 0,0, -1, EmitGroup04_Handle_NZ_Flags  )
305EmitGroup04(f, "04_05", "OR",  "UINT32 result = b | c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
306EmitGroup04(f, "04_06", "BIC", "UINT32 result = b & (~c);", "m_regs[areg] = result;", "m_regs[breg] = result;",  0,0, -1, EmitGroup04_unsupported_Flags  )
307EmitGroup04(f, "04_07", "XOR", "UINT32 result = b ^ c;", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
339EmitGroup04(f, "04_04", "AND",  "UINT32 result = b & c;",                 "if (areg != LIMM_REG) { m_regs[areg] = result; }", "if (breg != LIMM_REG) { m_regs[breg] = result; }", 0,0, -1, EmitGroup04_Handle_NZ_Flags  )
340EmitGroup04(f, "04_05", "OR",   "UINT32 result = b | c;",                 "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
341EmitGroup04(f, "04_06", "BIC",  "UINT32 result = b & (~c);",              "m_regs[areg] = result;", "m_regs[breg] = result;",  0,0, -1, EmitGroup04_unsupported_Flags  )
342EmitGroup04(f, "04_07", "XOR",  "UINT32 result = b ^ c;",                 "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
308343
309EmitGroup04(f, "04_0a", "MOV", "UINT32 result = c;", "m_regs[breg] = result;", "m_regs[breg] = result;", 1,1, -1, EmitGroup04_Handle_NZ_Flags  ) # special case, result always goes to breg
344EmitGroup04(f, "04_0a", "MOV", "UINT32 result = c;",                    "m_regs[breg] = result;", "m_regs[breg] = result;", 1,1, -1, EmitGroup04_Handle_NZ_Flags  ) # special case, result always goes to breg
310345
346EmitGroup04(f, "04_0e", "RSUB", "UINT32 result = c - b;",                 "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
311347EmitGroup04(f, "04_0f", "BSET", "UINT32 result = b | (1 << (c & 0x1f));", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
312348
313EmitGroup04(f, "04_13", "BMSK", "UINT32 result = b & ((1<<(c+1))-1);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
349EmitGroup04(f, "04_13", "BMSK", "UINT32 result = b & ((1<<(c+1))-1);",    "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
314350
315351
352EmitGroup04(f, "04_14", "ADD1", "UINT32 result = b + (c << 1);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
353EmitGroup04(f, "04_15", "ADD2", "UINT32 result = b + (c << 2);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
354EmitGroup04(f, "04_16", "ADD3", "UINT32 result = b + (c << 3);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
355EmitGroup04(f, "04_17", "SUB1", "UINT32 result = b - (c << 1);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
356EmitGroup04(f, "04_18", "SUB2", "UINT32 result = b - (c << 2);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
357EmitGroup04(f, "04_19", "SUB3", "UINT32 result = b - (c << 3);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
316358
317EmitGroup04(f, "04_15", "ADD2", "UINT32 result = b + (c << 2);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
318EmitGroup04(f, "04_16", "ADD3", "UINT32 result = b + (c << 3);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
359EmitGroup04(f, "04_2b", "SR", "WRITEAUX(c,b);", "", "", 1,0, -1, EmitGroup04_unsupported_Flags  ) # this can't be conditional (todo)
319360
320361
362
321363EmitGroup04(f, "05_00", "ASL", "UINT32 result = b << (c&0x1f);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
322364EmitGroup04(f, "05_01", "LSR", "UINT32 result = b >> (c&0x1f);", "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
323365
r242597r242598
327369EmitGroup04(f, "04_2f_08", "EXTW", "UINT32 result = c & 0x0000ffff;",  "m_regs[breg] = result;","", 2,1, -1, EmitGroup04_unsupported_Flags  ) # ^
328370
329371# xxx_S b <- b,c format opcodes  (or in some cases xxx_S b,c)
330EmitGroup0f(f, "0f_02", "SUB_S", "UINT32 result = m_regs[breg] - m_regs[creg];",  "m_regs[breg] = result;" )
331EmitGroup0f(f, "0f_04", "AND_S", "UINT32 result = m_regs[breg] & m_regs[creg];",  "m_regs[breg] = result;" )
332EmitGroup0f(f, "0f_05", "OR_S",  "UINT32 result = m_regs[breg] | m_regs[creg];",  "m_regs[breg] = result;" )
333EmitGroup0f(f, "0f_07", "XOR_S", "UINT32 result = m_regs[breg] ^ m_regs[creg];",  "m_regs[breg] = result;" )
334EmitGroup0f(f, "0f_0f", "EXTB_S","UINT32 result = m_regs[creg] & 0x000000ff;",    "m_regs[breg] = result;" )
335EmitGroup0f(f, "0f_10", "EXTW_S","UINT32 result = m_regs[creg] & 0x0000ffff;",    "m_regs[breg] = result;" )
336EmitGroup0f(f, "0f_1b", "ASL1_S","UINT32 result = m_regs[creg] << 1;",            "m_regs[breg] = result;" )
372EmitGroup0f(f, "0f_02", "SUB_S", "UINT32 result = m_regs[breg] - m_regs[creg];",        "m_regs[breg] = result;" )
373EmitGroup0f(f, "0f_04", "AND_S", "UINT32 result = m_regs[breg] & m_regs[creg];",        "m_regs[breg] = result;" )
374EmitGroup0f(f, "0f_05", "OR_S",  "UINT32 result = m_regs[breg] | m_regs[creg];",        "m_regs[breg] = result;" )
375EmitGroup0f(f, "0f_07", "XOR_S", "UINT32 result = m_regs[breg] ^ m_regs[creg];",        "m_regs[breg] = result;" )
376EmitGroup0f(f, "0f_0f", "EXTB_S","UINT32 result = m_regs[creg] & 0x000000ff;",          "m_regs[breg] = result;" )
377EmitGroup0f(f, "0f_10", "EXTW_S","UINT32 result = m_regs[creg] & 0x0000ffff;",          "m_regs[breg] = result;" )
378EmitGroup0f(f, "0f_13", "NEG_S"," UINT32 result = 0 - m_regs[creg];",                   "m_regs[breg] = result;" )
337379
380EmitGroup0f(f, "0f_14", "ADD1_S"," UINT32 result = m_regs[breg] + (m_regs[creg] <<1);", "m_regs[breg] = result;" )
381EmitGroup0f(f, "0f_15", "ADD2_S"," UINT32 result = m_regs[breg] + (m_regs[creg] <<2);", "m_regs[breg] = result;" )
382EmitGroup0f(f, "0f_16", "ADD3_S"," UINT32 result = m_regs[breg] + (m_regs[creg] <<3);", "m_regs[breg] = result;" )
338383
384EmitGroup0f(f, "0f_19", "LSR_S", "UINT32 result = m_regs[breg] >> (m_regs[creg]&0x1f);","m_regs[breg] = result;" )
385EmitGroup0f(f, "0f_1b", "ASL1_S","UINT32 result = m_regs[creg] << 1;",                  "m_regs[breg] = result;" )
386
387
339388#  xxx_S b, b, u5 format opcodes
340389EmitGroup17(f, "17_00", "ASL_S",  "m_regs[breg] = m_regs[breg] << (u&0x1f);" )
341390EmitGroup17(f, "17_01", "LSR_S",  "m_regs[breg] = m_regs[breg] >> (u&0x1f);" )
trunk/src/mess/drivers/leapster.c
r242597r242598
284284   AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_MIRROR(0x40000000) // pointers in the bios region seem to be to the 40xxxxxx region, either we mirror there or something (real bios?) is acutally missing
285285   AM_RANGE(0x0180D800, 0x0180D803) AM_READ(leapster_random_r)
286286   AM_RANGE(0x03000000, 0x030007ff) AM_RAM // puts stack here, writes a pointer @ 0x03000000 on startup
287   AM_RANGE(0x3c000000, 0x3c1fffff) AM_RAM // really ram, or has our code execution gone wrong?
287288//   AM_RANGE(0x80000000, 0x807fffff) AM_ROMBANK("cartrom") // game ROM pointers are all to the 80xxxxxx region, so I assume it maps here - installed if a cart is present
288289ADDRESS_MAP_END
289290


Previous 199869 Revisions Next


© 1997-2024 The MAME Team