trunk/3rdparty/mongoose/mongoose.c
| r243600 | r243601 | |
| 48 | 48 | #define _INTEGRAL_MAX_BITS 64 // Enable _stati64() on Windows |
| 49 | 49 | #define _CRT_SECURE_NO_WARNINGS // Disable deprecation warning in VS2005+ |
| 50 | 50 | #undef WIN32_LEAN_AND_MEAN // Let windows.h always include winsock2.h |
| 51 | #if defined(__Linux__) || defined(_WIN32) |
| 51 | 52 | #define _XOPEN_SOURCE 600 // For flockfile() on Linux |
| 53 | #endif |
| 52 | 54 | #define __STDC_FORMAT_MACROS // <inttypes.h> wants this for C++ |
| 53 | 55 | #define __STDC_LIMIT_MACROS // C++ wants that for INT64_MAX |
| 54 | 56 | #ifndef _LARGEFILE_SOURCE |
| r243600 | r243601 | |
| 345 | 347 | assert(io != NULL); |
| 346 | 348 | assert(io->len <= io->size); |
| 347 | 349 | |
| 350 | /* check overflow */ |
| 351 | if (len > ~(size_t)0 - (size_t)(io->buf + io->len)) { |
| 352 | return 0; |
| 353 | } |
| 354 | |
| 348 | 355 | if (len <= 0) { |
| 349 | 356 | } else if (io->len + len <= io->size) { |
| 350 | 357 | memcpy(io->buf + io->len, buf, len); |
| r243600 | r243601 | |
| 2891 | 2898 | static int deliver_websocket_frame(struct connection *conn) { |
| 2892 | 2899 | // Having buf unsigned char * is important, as it is used below in arithmetic |
| 2893 | 2900 | unsigned char *buf = (unsigned char *) conn->ns_conn->recv_iobuf.buf; |
| 2894 | | int i, len, buf_len = conn->ns_conn->recv_iobuf.len, frame_len = 0, |
| 2901 | size_t i, len, buf_len = conn->ns_conn->recv_iobuf.len, frame_len = 0, |
| 2895 | 2902 | mask_len = 0, header_len = 0, data_len = 0, buffered = 0; |
| 2896 | 2903 | |
| 2897 | 2904 | if (buf_len >= 2) { |
| r243600 | r243601 | |
| 2902 | 2909 | header_len = 2 + mask_len; |
| 2903 | 2910 | } else if (len == 126 && buf_len >= 4 + mask_len) { |
| 2904 | 2911 | header_len = 4 + mask_len; |
| 2905 | | data_len = ((((int) buf[2]) << 8) + buf[3]); |
| 2912 | data_len = ((((size_t) buf[2]) << 8) + buf[3]); |
| 2906 | 2913 | } else if (buf_len >= 10 + mask_len) { |
| 2907 | 2914 | header_len = 10 + mask_len; |
| 2908 | | data_len = (int) (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) + |
| 2915 | data_len = (size_t) (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) + |
| 2909 | 2916 | htonl(* (uint32_t *) &buf[6]); |
| 2910 | 2917 | } |
| 2911 | 2918 | } |
| r243600 | r243601 | |
| 2936 | 2943 | } |
| 2937 | 2944 | |
| 2938 | 2945 | size_t mg_websocket_write(struct mg_connection *conn, int opcode, |
| 2939 | | const char *data, size_t data_len) { |
| 2946 | const char *data, size_t data_len) { |
| 2940 | 2947 | unsigned char mem[4192], *copy = mem; |
| 2941 | 2948 | size_t copy_len = 0; |
| 2942 | 2949 | |
| 2950 | /* Check overflow */ |
| 2951 | if (data_len > ~(size_t)0 - (size_t)10) { |
| 2952 | return 0; |
| 2953 | } |
| 2954 | |
| 2943 | 2955 | if (data_len + 10 > sizeof(mem) && |
| 2944 | 2956 | (copy = (unsigned char *) NS_MALLOC(data_len + 10)) == NULL) { |
| 2945 | 2957 | return 0; |
trunk/src/emu/cpu/amis2000/amis2000.c
| r243600 | r243601 | |
| 6 | 6 | Overall functionality is similar to (and probably derived from) NEC uCOM-4. |
| 7 | 7 | |
| 8 | 8 | References: |
| 9 | | - AMI MOS Products Catalog Winter 1979 |
| 9 | - AMI MOS Products Catalog 1979/1980 |
| 10 | 10 | - AMI S2000 Programming Manual (rev. 2) |
| 11 | 11 | |
| 12 | 12 | TODO: |
| r243600 | r243601 | |
| 27 | 27 | // S2000 is the most basic one, 64 nibbles internal RAM and 1KB internal ROM |
| 28 | 28 | // S2150 increased RAM to 80 nibbles and ROM to 1.5KB |
| 29 | 29 | // high-voltage output versions of these chips (S2000A and S2150A) are identical overall |
| 30 | | const device_type AMI_S2000 = &device_creator<amis2000_device>; |
| 31 | | const device_type AMI_S2150 = &device_creator<amis2150_device>; |
| 30 | const device_type AMI_S2000 = &device_creator<amis2000_cpu_device>; |
| 31 | const device_type AMI_S2150 = &device_creator<amis2150_cpu_device>; |
| 32 | 32 | |
| 33 | // S2152 is an extension to S2150, removing the K pins and adding a better timer |
| 34 | const device_type AMI_S2152 = &device_creator<amis2152_cpu_device>; |
| 33 | 35 | |
| 36 | |
| 34 | 37 | // internal memory maps |
| 35 | | static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_device) |
| 38 | static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_base_device) |
| 36 | 39 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 37 | 40 | ADDRESS_MAP_END |
| 38 | 41 | |
| 39 | | static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_device) |
| 42 | static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_base_device) |
| 40 | 43 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 41 | 44 | AM_RANGE(0x0400, 0x05ff) AM_NOP // 0x00 |
| 42 | 45 | AM_RANGE(0x0600, 0x07ff) AM_ROM |
| 43 | 46 | ADDRESS_MAP_END |
| 44 | 47 | |
| 45 | 48 | |
| 46 | | static ADDRESS_MAP_START(data_64x4, AS_DATA, 8, amis2000_device) |
| 49 | static ADDRESS_MAP_START(data_64x4, AS_DATA, 8, amis2000_base_device) |
| 47 | 50 | AM_RANGE(0x00, 0x3f) AM_RAM |
| 48 | 51 | ADDRESS_MAP_END |
| 49 | 52 | |
| 50 | | static ADDRESS_MAP_START(data_80x4, AS_DATA, 8, amis2000_device) |
| 53 | static ADDRESS_MAP_START(data_80x4, AS_DATA, 8, amis2000_base_device) |
| 51 | 54 | AM_RANGE(0x00, 0x3f) AM_RAM |
| 52 | 55 | AM_RANGE(0x40, 0x4f) AM_RAM |
| 53 | 56 | ADDRESS_MAP_END |
| 54 | 57 | |
| 55 | 58 | |
| 56 | 59 | // device definitions |
| 57 | | amis2000_device::amis2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 58 | | : cpu_device(mconfig, AMI_S2000, "AMI S2000", tag, owner, clock, "amis2000", __FILE__), |
| 59 | | m_program_config("program", ENDIANNESS_BIG, 8, 13, 0, ADDRESS_MAP_NAME(program_1k)), |
| 60 | | m_data_config("data", ENDIANNESS_BIG, 8, 6, 0, ADDRESS_MAP_NAME(data_64x4)), |
| 61 | | m_bu_bits(2), |
| 62 | | m_callstack_bits(10), |
| 63 | | m_callstack_depth(3), |
| 64 | | m_read_k(*this), |
| 65 | | m_read_i(*this), |
| 66 | | m_read_d(*this), |
| 67 | | m_write_d(*this), |
| 68 | | m_write_a(*this) |
| 69 | | { |
| 70 | | } |
| 60 | amis2000_cpu_device::amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 61 | : amis2000_base_device(mconfig, AMI_S2000, "AMI S2000", tag, owner, clock, 2, 10, 3, 13, ADDRESS_MAP_NAME(program_1k), 6, ADDRESS_MAP_NAME(data_64x4), "amis2000", __FILE__) |
| 62 | { } |
| 71 | 63 | |
| 72 | | amis2000_device::amis2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) |
| 73 | | : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), |
| 74 | | m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program), |
| 75 | | m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data), |
| 76 | | m_bu_bits(bu_bits), |
| 77 | | m_callstack_bits(callstack_bits), |
| 78 | | m_callstack_depth(callstack_depth), |
| 79 | | m_read_k(*this), |
| 80 | | m_read_i(*this), |
| 81 | | m_read_d(*this), |
| 82 | | m_write_d(*this), |
| 83 | | m_write_a(*this) |
| 84 | | { |
| 85 | | } |
| 64 | amis2150_cpu_device::amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 65 | : amis2000_base_device(mconfig, AMI_S2150, "AMI S2150", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2150", __FILE__) |
| 66 | { } |
| 86 | 67 | |
| 87 | | amis2150_device::amis2150_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 88 | | : amis2000_device(mconfig, AMI_S2150, "AMI S2150", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2150", __FILE__) |
| 89 | | { |
| 90 | | } |
| 68 | amis2152_cpu_device::amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 69 | : amis2000_base_device(mconfig, AMI_S2152, "AMI S2152", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2152", __FILE__) |
| 70 | { } |
| 91 | 71 | |
| 92 | 72 | |
| 73 | |
| 93 | 74 | // disasm |
| 94 | | void amis2000_device::state_string_export(const device_state_entry &entry, astring &string) |
| 75 | void amis2000_base_device::state_string_export(const device_state_entry &entry, astring &string) |
| 95 | 76 | { |
| 96 | 77 | switch (entry.index()) |
| 97 | 78 | { |
| r243600 | r243601 | |
| 110 | 91 | } |
| 111 | 92 | } |
| 112 | 93 | |
| 113 | | offs_t amis2000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) |
| 94 | offs_t amis2000_base_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) |
| 114 | 95 | { |
| 115 | 96 | extern CPU_DISASSEMBLE(amis2000); |
| 116 | 97 | return CPU_DISASSEMBLE_NAME(amis2000)(this, buffer, pc, oprom, opram, options); |
| r243600 | r243601 | |
| 128 | 109 | S2000_ACC, S2000_E, S2000_CY |
| 129 | 110 | }; |
| 130 | 111 | |
| 131 | | void amis2000_device::device_start() |
| 112 | void amis2000_base_device::device_start() |
| 132 | 113 | { |
| 133 | 114 | m_program = &space(AS_PROGRAM); |
| 134 | 115 | m_data = &space(AS_DATA); |
| r243600 | r243601 | |
| 138 | 119 | m_read_d.resolve_safe(0); |
| 139 | 120 | m_write_d.resolve_safe(); |
| 140 | 121 | m_write_a.resolve_safe(); |
| 122 | m_write_f.resolve_safe(); |
| 141 | 123 | |
| 142 | 124 | m_bu_mask = (1 << m_bu_bits) - 1; |
| 143 | 125 | m_callstack_mask = (1 << m_callstack_bits) - 1; |
| r243600 | r243601 | |
| 197 | 179 | } |
| 198 | 180 | |
| 199 | 181 | |
| 182 | void amis2152_cpu_device::device_start() |
| 183 | { |
| 184 | amis2000_base_device::device_start(); |
| 200 | 185 | |
| 186 | m_d2f_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amis2152_cpu_device::d2f_timer_cb), this)); |
| 187 | |
| 188 | // zerofill |
| 189 | m_d2f_latch = 0; |
| 190 | m_fout_state = 0; |
| 191 | |
| 192 | // register for savestates |
| 193 | save_item(NAME(m_d2f_latch)); |
| 194 | save_item(NAME(m_fout_state)); |
| 195 | } |
| 196 | |
| 197 | |
| 198 | |
| 201 | 199 | //------------------------------------------------- |
| 202 | 200 | // device_reset - device-specific reset |
| 203 | 201 | //------------------------------------------------- |
| 204 | 202 | |
| 205 | | void amis2000_device::device_reset() |
| 203 | void amis2000_base_device::device_reset() |
| 206 | 204 | { |
| 207 | 205 | m_pc = 0; |
| 208 | 206 | m_op = 0; |
| 209 | 207 | m_skip = false; |
| 210 | 208 | |
| 211 | 209 | // clear i/o |
| 210 | m_a = 0x1fff; |
| 211 | m_write_a(0, m_a, 0xffff); |
| 212 | 212 | m_d_polarity = 0; |
| 213 | | m_d = 0; d_latch_out(false); |
| 214 | | m_a = 0; m_write_a(0, 0, 0xffff); |
| 213 | m_d = 0; |
| 214 | d_latch_out(false); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
| 218 | void amis2152_cpu_device::device_reset() |
| 219 | { |
| 220 | amis2000_base_device::device_reset(); |
| 218 | 221 | |
| 222 | // start d2f timer |
| 223 | m_write_f(0); |
| 224 | d2f_timer_clock(); |
| 225 | } |
| 226 | |
| 227 | |
| 228 | |
| 219 | 229 | //------------------------------------------------- |
| 220 | 230 | // execute |
| 221 | 231 | //------------------------------------------------- |
| 222 | 232 | |
| 223 | | void amis2000_device::execute_run() |
| 233 | void amis2000_base_device::execute_run() |
| 224 | 234 | { |
| 225 | 235 | while (m_icount > 0) |
| 226 | 236 | { |
trunk/src/emu/cpu/amis2000/amis2000.h
| r243600 | r243601 | |
| 14 | 14 | |
| 15 | 15 | // generic input pins (4 bits each) |
| 16 | 16 | #define MCFG_AMI_S2000_READ_K_CB(_devcb) \ |
| 17 | | amis2000_device::set_read_k_callback(*device, DEVCB_##_devcb); |
| 17 | amis2000_base_device::set_read_k_callback(*device, DEVCB_##_devcb); |
| 18 | 18 | |
| 19 | 19 | #define MCFG_AMI_S2000_READ_I_CB(_devcb) \ |
| 20 | | amis2000_device::set_read_i_callback(*device, DEVCB_##_devcb); |
| 20 | amis2000_base_device::set_read_i_callback(*device, DEVCB_##_devcb); |
| 21 | 21 | |
| 22 | 22 | // 8-bit external databus coupled as input/output pins |
| 23 | 23 | #define MCFG_AMI_S2000_READ_D_CB(_devcb) \ |
| 24 | | amis2000_device::set_read_d_callback(*device, DEVCB_##_devcb); |
| 24 | amis2000_base_device::set_read_d_callback(*device, DEVCB_##_devcb); |
| 25 | 25 | |
| 26 | 26 | #define MCFG_AMI_S2000_WRITE_D_CB(_devcb) \ |
| 27 | | amis2000_device::set_write_d_callback(*device, DEVCB_##_devcb); |
| 27 | amis2000_base_device::set_write_d_callback(*device, DEVCB_##_devcb); |
| 28 | 28 | |
| 29 | 29 | // 13-bit external addressbus coupled as output pins |
| 30 | 30 | #define MCFG_AMI_S2000_WRITE_A_CB(_devcb) \ |
| 31 | | amis2000_device::set_write_a_callback(*device, DEVCB_##_devcb); |
| 31 | amis2000_base_device::set_write_a_callback(*device, DEVCB_##_devcb); |
| 32 | 32 | |
| 33 | // F_out pin (only for S2152) |
| 34 | #define MCFG_AMI_S2152_FOUT_CB(_devcb) \ |
| 35 | amis2000_base_device::set_write_f_callback(*device, DEVCB_##_devcb); |
| 33 | 36 | |
| 34 | | class amis2000_device : public cpu_device |
| 37 | |
| 38 | class amis2000_base_device : public cpu_device |
| 35 | 39 | { |
| 36 | 40 | public: |
| 37 | 41 | // construction/destruction |
| 38 | | amis2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 39 | | amis2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); |
| 42 | amis2000_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) |
| 43 | : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 44 | , m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program) |
| 45 | , m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data) |
| 46 | , m_bu_bits(bu_bits) |
| 47 | , m_callstack_bits(callstack_bits) |
| 48 | , m_callstack_depth(callstack_depth) |
| 49 | , m_read_k(*this) |
| 50 | , m_read_i(*this) |
| 51 | , m_read_d(*this) |
| 52 | , m_write_d(*this) |
| 53 | , m_write_a(*this) |
| 54 | , m_write_f(*this) |
| 55 | { } |
| 40 | 56 | |
| 41 | 57 | // static configuration helpers |
| 42 | | template<class _Object> static devcb_base &set_read_k_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_k.set_callback(object); } |
| 43 | | template<class _Object> static devcb_base &set_read_i_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_i.set_callback(object); } |
| 44 | | template<class _Object> static devcb_base &set_read_d_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_d.set_callback(object); } |
| 45 | | template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_write_d.set_callback(object); } |
| 46 | | template<class _Object> static devcb_base &set_write_a_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_write_a.set_callback(object); } |
| 58 | template<class _Object> static devcb_base &set_read_k_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_k.set_callback(object); } |
| 59 | template<class _Object> static devcb_base &set_read_i_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_i.set_callback(object); } |
| 60 | template<class _Object> static devcb_base &set_read_d_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_d.set_callback(object); } |
| 61 | template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_d.set_callback(object); } |
| 62 | template<class _Object> static devcb_base &set_write_a_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_a.set_callback(object); } |
| 63 | template<class _Object> static devcb_base &set_write_f_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_f.set_callback(object); } |
| 47 | 64 | |
| 48 | 65 | protected: |
| 49 | 66 | // device-level overrides |
| r243600 | r243601 | |
| 103 | 120 | devcb_read8 m_read_d; |
| 104 | 121 | devcb_write8 m_write_d; |
| 105 | 122 | devcb_write16 m_write_a; |
| 123 | devcb_write_line m_write_f; |
| 106 | 124 | |
| 107 | 125 | // misc internal helpers |
| 108 | 126 | UINT8 ram_r(); |
| r243600 | r243601 | |
| 112 | 130 | void d_latch_out(bool active); |
| 113 | 131 | |
| 114 | 132 | // opcode handlers |
| 115 | | void op_lai(); |
| 116 | | void op_lab(); |
| 117 | | void op_lae(); |
| 118 | | void op_xab(); |
| 119 | | void op_xabu(); |
| 120 | | void op_xae(); |
| 121 | | void op_lbe(); |
| 122 | | void op_lbep(); |
| 123 | | void op_lbz(); |
| 124 | | void op_lbf(); |
| 133 | virtual void op_lai(); |
| 134 | virtual void op_lab(); |
| 135 | virtual void op_lae(); |
| 136 | virtual void op_xab(); |
| 137 | virtual void op_xabu(); |
| 138 | virtual void op_xae(); |
| 139 | virtual void op_lbe(); |
| 140 | virtual void op_lbep(); |
| 141 | virtual void op_lbz(); |
| 142 | virtual void op_lbf(); |
| 125 | 143 | |
| 126 | | void op_lam(); |
| 127 | | void op_xc(); |
| 128 | | void op_xci(); |
| 129 | | void op_xcd(); |
| 130 | | void op_stm(); |
| 131 | | void op_rsm(); |
| 144 | virtual void op_lam(); |
| 145 | virtual void op_xc(); |
| 146 | virtual void op_xci(); |
| 147 | virtual void op_xcd(); |
| 148 | virtual void op_stm(); |
| 149 | virtual void op_rsm(); |
| 132 | 150 | |
| 133 | | void op_inp(); |
| 134 | | void op_out(); |
| 135 | | void op_disb(); |
| 136 | | void op_disn(); |
| 137 | | void op_mvs(); |
| 138 | | void op_psh(); |
| 139 | | void op_psl(); |
| 140 | | void op_eur(); |
| 151 | virtual void op_inp(); |
| 152 | virtual void op_out(); |
| 153 | virtual void op_disb(); |
| 154 | virtual void op_disn(); |
| 155 | virtual void op_mvs(); |
| 156 | virtual void op_psh(); |
| 157 | virtual void op_psl(); |
| 158 | virtual void op_eur(); |
| 141 | 159 | |
| 142 | | void op_pp(); |
| 143 | | void op_jmp(); |
| 144 | | void op_jms(); |
| 145 | | void op_rt(); |
| 146 | | void op_rts(); |
| 147 | | void op_nop(); |
| 148 | | void op_halt(); |
| 160 | virtual void op_pp(); |
| 161 | virtual void op_jmp(); |
| 162 | virtual void op_jms(); |
| 163 | virtual void op_rt(); |
| 164 | virtual void op_rts(); |
| 165 | virtual void op_nop(); |
| 166 | virtual void op_halt(); |
| 149 | 167 | |
| 150 | | void op_szc(); |
| 151 | | void op_szm(); |
| 152 | | void op_szi(); |
| 153 | | void op_szk(); |
| 154 | | void op_sbe(); |
| 155 | | void op_sam(); |
| 156 | | void op_sos(); |
| 157 | | void op_tf1(); |
| 158 | | void op_tf2(); |
| 168 | virtual void op_szc(); |
| 169 | virtual void op_szm(); |
| 170 | virtual void op_szi(); |
| 171 | virtual void op_szk(); |
| 172 | virtual void op_sbe(); |
| 173 | virtual void op_sam(); |
| 174 | virtual void op_sos(); |
| 175 | virtual void op_tf1(); |
| 176 | virtual void op_tf2(); |
| 159 | 177 | |
| 160 | | void op_adcs(); |
| 161 | | void op_adis(); |
| 162 | | void op_add(); |
| 163 | | void op_and(); |
| 164 | | void op_xor(); |
| 165 | | void op_stc(); |
| 166 | | void op_rsc(); |
| 167 | | void op_cma(); |
| 168 | | void op_sf1(); |
| 169 | | void op_rf1(); |
| 170 | | void op_sf2(); |
| 171 | | void op_rf2(); |
| 178 | virtual void op_adcs(); |
| 179 | virtual void op_adis(); |
| 180 | virtual void op_add(); |
| 181 | virtual void op_and(); |
| 182 | virtual void op_xor(); |
| 183 | virtual void op_stc(); |
| 184 | virtual void op_rsc(); |
| 185 | virtual void op_cma(); |
| 186 | virtual void op_sf1(); |
| 187 | virtual void op_rf1(); |
| 188 | virtual void op_sf2(); |
| 189 | virtual void op_rf2(); |
| 172 | 190 | }; |
| 173 | 191 | |
| 174 | 192 | |
| 175 | | class amis2150_device : public amis2000_device |
| 193 | class amis2000_cpu_device : public amis2000_base_device |
| 176 | 194 | { |
| 177 | 195 | public: |
| 178 | | amis2150_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 196 | amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 179 | 197 | }; |
| 180 | 198 | |
| 181 | 199 | |
| 200 | class amis2150_cpu_device : public amis2000_base_device |
| 201 | { |
| 202 | public: |
| 203 | amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 204 | }; |
| 182 | 205 | |
| 206 | |
| 207 | class amis2152_cpu_device : public amis2000_base_device |
| 208 | { |
| 209 | public: |
| 210 | amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 211 | |
| 212 | protected: |
| 213 | // device-level overrides |
| 214 | virtual void device_start(); |
| 215 | virtual void device_reset(); |
| 216 | |
| 217 | // digital-to-frequency converter |
| 218 | UINT8 m_d2f_latch; |
| 219 | emu_timer *m_d2f_timer; |
| 220 | int m_fout_state; |
| 221 | |
| 222 | void d2f_timer_clock(); |
| 223 | TIMER_CALLBACK_MEMBER(d2f_timer_cb); |
| 224 | |
| 225 | // opcode handlers |
| 226 | virtual void op_szk(); |
| 227 | }; |
| 228 | |
| 229 | |
| 230 | |
| 183 | 231 | extern const device_type AMI_S2000; |
| 184 | 232 | extern const device_type AMI_S2150; |
| 233 | extern const device_type AMI_S2152; |
| 185 | 234 | |
| 186 | 235 | |
| 187 | 236 | #endif /* _AMIS2000_H_ */ |
trunk/src/emu/cpu/amis2000/amis2000op.inc
| r243600 | r243601 | |
| 2 | 2 | |
| 3 | 3 | // internal helpers |
| 4 | 4 | |
| 5 | | inline UINT8 amis2000_device::ram_r() |
| 5 | inline UINT8 amis2000_base_device::ram_r() |
| 6 | 6 | { |
| 7 | 7 | UINT16 address = m_bu << 4 | m_bl; |
| 8 | 8 | return m_data->read_byte(address) & 0xf; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | | inline void amis2000_device::ram_w(UINT8 data) |
| 11 | inline void amis2000_base_device::ram_w(UINT8 data) |
| 12 | 12 | { |
| 13 | 13 | UINT16 address = m_bu << 4 | m_bl; |
| 14 | 14 | m_data->write_byte(address, data & 0xf); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | | void amis2000_device::pop_callstack() |
| 17 | void amis2000_base_device::pop_callstack() |
| 18 | 18 | { |
| 19 | 19 | m_pc = (m_pc & ~m_callstack_mask) | (m_callstack[0] & m_callstack_mask); |
| 20 | 20 | for (int i = 0; i < m_callstack_depth-1; i++) |
| 21 | 21 | m_callstack[i] = m_callstack[i+1]; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | | void amis2000_device::push_callstack() |
| 24 | void amis2000_base_device::push_callstack() |
| 25 | 25 | { |
| 26 | 26 | for (int i = m_callstack_depth-1; i >= 1; i--) |
| 27 | 27 | m_callstack[i] = m_callstack[i-1]; |
| 28 | 28 | m_callstack[0] = m_pc & m_callstack_mask; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | | void amis2000_device::d_latch_out(bool active) |
| 31 | void amis2000_base_device::d_latch_out(bool active) |
| 32 | 32 | { |
| 33 | 33 | m_write_d(0, active ? (m_d ^ m_d_polarity) : 0, 0xff); |
| 34 | 34 | m_d_active = active; |
| r243600 | r243601 | |
| 37 | 37 | |
| 38 | 38 | // Register Instructions |
| 39 | 39 | |
| 40 | | void amis2000_device::op_lai() |
| 40 | void amis2000_base_device::op_lai() |
| 41 | 41 | { |
| 42 | 42 | // LAI X: load ACC with X, select I and K inputs |
| 43 | 43 | // note: only execute the first one in a sequence of LAI |
| r243600 | r243601 | |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | | void amis2000_device::op_lab() |
| 52 | void amis2000_base_device::op_lab() |
| 53 | 53 | { |
| 54 | 54 | // LAB: load ACC with BL |
| 55 | 55 | m_acc = m_bl; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | | void amis2000_device::op_lae() |
| 58 | void amis2000_base_device::op_lae() |
| 59 | 59 | { |
| 60 | 60 | // LAE: load ACC with E |
| 61 | 61 | m_acc = m_e; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | | void amis2000_device::op_xab() |
| 64 | void amis2000_base_device::op_xab() |
| 65 | 65 | { |
| 66 | 66 | // XAB: exchange ACC with BL |
| 67 | 67 | UINT8 old_acc = m_acc; |
| r243600 | r243601 | |
| 69 | 69 | m_bl = old_acc; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | | void amis2000_device::op_xabu() |
| 72 | void amis2000_base_device::op_xabu() |
| 73 | 73 | { |
| 74 | 74 | // XABU: exchange ACC with BU |
| 75 | 75 | UINT8 old_acc = m_acc; |
| r243600 | r243601 | |
| 77 | 77 | m_bu = old_acc & m_bu_mask; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | | void amis2000_device::op_xae() |
| 80 | void amis2000_base_device::op_xae() |
| 81 | 81 | { |
| 82 | 82 | // XAE: exchange ACC with E |
| 83 | 83 | UINT8 old_acc = m_acc; |
| r243600 | r243601 | |
| 85 | 85 | m_e = old_acc; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | | void amis2000_device::op_lbe() |
| 88 | void amis2000_base_device::op_lbe() |
| 89 | 89 | { |
| 90 | 90 | // LBE Y: load BU with Y, load BL with E |
| 91 | 91 | // note: only execute the first one in a sequence of LB* |
| r243600 | r243601 | |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | | void amis2000_device::op_lbep() |
| 100 | void amis2000_base_device::op_lbep() |
| 101 | 101 | { |
| 102 | 102 | // LBEP Y: load BU with Y, load BL with E+1 |
| 103 | 103 | // note: only execute the first one in a sequence of LB* |
| r243600 | r243601 | |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | | void amis2000_device::op_lbz() |
| 112 | void amis2000_base_device::op_lbz() |
| 113 | 113 | { |
| 114 | 114 | // LBZ Y: load BU with Y, load BL with 0 |
| 115 | 115 | // note: only execute the first one in a sequence of LB* |
| r243600 | r243601 | |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | | void amis2000_device::op_lbf() |
| 124 | void amis2000_base_device::op_lbf() |
| 125 | 125 | { |
| 126 | 126 | // LBF Y: load BU with Y, load BL with 15 |
| 127 | 127 | // note: only execute the first one in a sequence of LB* |
| r243600 | r243601 | |
| 136 | 136 | |
| 137 | 137 | // RAM Instructions |
| 138 | 138 | |
| 139 | | void amis2000_device::op_lam() |
| 139 | void amis2000_base_device::op_lam() |
| 140 | 140 | { |
| 141 | 141 | // LAM _Y: load ACC with RAM, xor BU with _Y |
| 142 | 142 | m_acc = ram_r(); |
| r243600 | r243601 | |
| 144 | 144 | m_bu ^= (param & m_bu_mask); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | | void amis2000_device::op_xc() |
| 147 | void amis2000_base_device::op_xc() |
| 148 | 148 | { |
| 149 | 149 | // XC _Y: exchange ACC with RAM, xor BU with _Y |
| 150 | 150 | UINT8 old_acc = m_acc; |
| r243600 | r243601 | |
| 154 | 154 | m_bu ^= (param & m_bu_mask); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | | void amis2000_device::op_xci() |
| 157 | void amis2000_base_device::op_xci() |
| 158 | 158 | { |
| 159 | 159 | // XCI _Y: exchange ACC with RAM, increment BL(skip next on carry), xor BU with _Y |
| 160 | 160 | op_xc(); |
| r243600 | r243601 | |
| 162 | 162 | m_skip = (m_bl == 0); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | | void amis2000_device::op_xcd() |
| 165 | void amis2000_base_device::op_xcd() |
| 166 | 166 | { |
| 167 | 167 | // XCD _Y: exchange ACC with RAM, decrement BL(skip next on carry), xor BU with _Y |
| 168 | 168 | op_xc(); |
| r243600 | r243601 | |
| 170 | 170 | m_skip = (m_bl == 0xf); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | | void amis2000_device::op_stm() |
| 173 | void amis2000_base_device::op_stm() |
| 174 | 174 | { |
| 175 | 175 | // STM Z: set RAM bit Z |
| 176 | 176 | UINT8 param = 1 << (m_op & 0x03); |
| 177 | 177 | ram_w(ram_r() | param); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | | void amis2000_device::op_rsm() |
| 180 | void amis2000_base_device::op_rsm() |
| 181 | 181 | { |
| 182 | 182 | // RSM Z: reset RAM bit Z |
| 183 | 183 | UINT8 param = 1 << (m_op & 0x03); |
| r243600 | r243601 | |
| 187 | 187 | |
| 188 | 188 | // Input/Output Instructions |
| 189 | 189 | |
| 190 | | void amis2000_device::op_inp() |
| 190 | void amis2000_base_device::op_inp() |
| 191 | 191 | { |
| 192 | 192 | // INP: input D-pins to ACC and RAM |
| 193 | 193 | UINT8 in = m_d_active ? m_d : m_read_d(0, 0xff); |
| r243600 | r243601 | |
| 195 | 195 | ram_w(in >> 4 & 0xf); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | | void amis2000_device::op_out() |
| 198 | void amis2000_base_device::op_out() |
| 199 | 199 | { |
| 200 | 200 | // OUT: pulse output ACC and RAM to D-pins |
| 201 | 201 | logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | | void amis2000_device::op_disb() |
| 204 | void amis2000_base_device::op_disb() |
| 205 | 205 | { |
| 206 | 206 | // DISB: set D-latch to ACC and RAM directly |
| 207 | 207 | m_d = m_acc | ram_r() << 4; |
| 208 | 208 | d_latch_out(true); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | | void amis2000_device::op_disn() |
| 211 | void amis2000_base_device::op_disn() |
| 212 | 212 | { |
| 213 | 213 | // DISN: set D-latch to ACC+carry via on-die segment decoder |
| 214 | 214 | static const UINT8 lut_segment_decoder[0x10] = |
| r243600 | r243601 | |
| 220 | 220 | d_latch_out(true); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | | void amis2000_device::op_mvs() |
| 223 | void amis2000_base_device::op_mvs() |
| 224 | 224 | { |
| 225 | 225 | // MVS: output master strobe latch to A-pins |
| 226 | 226 | d_latch_out(false); |
| 227 | 227 | m_write_a(0, m_a, 0xffff); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | | void amis2000_device::op_psh() |
| 230 | void amis2000_base_device::op_psh() |
| 231 | 231 | { |
| 232 | 232 | // PSH: preset high(BL) master strobe latch |
| 233 | 233 | switch (m_bl) |
| r243600 | r243601 | |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | | void amis2000_device::op_psl() |
| 257 | void amis2000_base_device::op_psl() |
| 258 | 258 | { |
| 259 | 259 | // PSL: preset low(BL) master strobe latch |
| 260 | 260 | switch (m_bl) |
| r243600 | r243601 | |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | | void amis2000_device::op_eur() |
| 284 | void amis2000_base_device::op_eur() |
| 285 | 285 | { |
| 286 | 286 | // EUR: set timer frequency(European) and D-latch polarity, via ACC |
| 287 | 287 | m_d_polarity = (m_acc & 1) ? 0x00 : 0xff; |
| r243600 | r243601 | |
| 291 | 291 | |
| 292 | 292 | // Program Control Instructions |
| 293 | 293 | |
| 294 | | void amis2000_device::op_pp() |
| 294 | void amis2000_base_device::op_pp() |
| 295 | 295 | { |
| 296 | 296 | // PP _X: prepare page/bank with _X |
| 297 | 297 | UINT8 param = ~m_op & 0x0f; |
| r243600 | r243601 | |
| 301 | 301 | m_pbr = param & 7; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | | void amis2000_device::op_jmp() |
| 304 | void amis2000_base_device::op_jmp() |
| 305 | 305 | { |
| 306 | 306 | // JMP X: jump to X(+PP) |
| 307 | 307 | UINT16 mask = 0x3f; |
| r243600 | r243601 | |
| 316 | 316 | m_pc = (m_pc & ~mask) | param; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | | void amis2000_device::op_jms() |
| 319 | void amis2000_base_device::op_jms() |
| 320 | 320 | { |
| 321 | 321 | // JMS X: call to X(+PP) |
| 322 | 322 | m_icount--; |
| r243600 | r243601 | |
| 328 | 328 | m_pc |= 0x3c0; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | | void amis2000_device::op_rt() |
| 331 | void amis2000_base_device::op_rt() |
| 332 | 332 | { |
| 333 | 333 | // RT: return from subroutine |
| 334 | 334 | pop_callstack(); |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | | void amis2000_device::op_rts() |
| 337 | void amis2000_base_device::op_rts() |
| 338 | 338 | { |
| 339 | 339 | // RTS: return from subroutine and skip next |
| 340 | 340 | op_rt(); |
| 341 | 341 | m_skip = true; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | | void amis2000_device::op_nop() |
| 344 | void amis2000_base_device::op_nop() |
| 345 | 345 | { |
| 346 | 346 | // NOP: no operation |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | | void amis2000_device::op_halt() |
| 349 | void amis2000_base_device::op_halt() |
| 350 | 350 | { |
| 351 | 351 | // HALT: debugger breakpoint for devkit-use |
| 352 | 352 | logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc); |
| r243600 | r243601 | |
| 355 | 355 | |
| 356 | 356 | // Skip Instructions |
| 357 | 357 | |
| 358 | | void amis2000_device::op_szc() |
| 358 | void amis2000_base_device::op_szc() |
| 359 | 359 | { |
| 360 | 360 | // SZC: skip next on zero(no) carry |
| 361 | 361 | m_skip = !m_carry; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | | void amis2000_device::op_szm() |
| 364 | void amis2000_base_device::op_szm() |
| 365 | 365 | { |
| 366 | 366 | // SZM Z: skip next on zero RAM bit Z |
| 367 | 367 | UINT8 param = 1 << (m_op & 0x03); |
| 368 | 368 | m_skip = !(ram_r() & param); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | | void amis2000_device::op_szi() |
| 371 | void amis2000_base_device::op_szi() |
| 372 | 372 | { |
| 373 | 373 | // SZI: skip next on I pin(s) |
| 374 | 374 | m_skip = ((~m_read_i(0, 0xff) & m_ki_mask) != 0); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | | void amis2000_device::op_szk() |
| 377 | void amis2000_base_device::op_szk() |
| 378 | 378 | { |
| 379 | 379 | // SZK: skip next on K pin(s) |
| 380 | 380 | m_skip = ((~m_read_k(0, 0xff) & m_ki_mask) != 0); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | | void amis2000_device::op_sbe() |
| 383 | void amis2000_base_device::op_sbe() |
| 384 | 384 | { |
| 385 | 385 | // SBE: skip next on BL equals E |
| 386 | 386 | m_skip = (m_bl == m_e); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | | void amis2000_device::op_sam() |
| 389 | void amis2000_base_device::op_sam() |
| 390 | 390 | { |
| 391 | 391 | // SAM: skip next on ACC equals RAM |
| 392 | 392 | m_skip = (m_acc == ram_r()); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | | void amis2000_device::op_sos() |
| 395 | void amis2000_base_device::op_sos() |
| 396 | 396 | { |
| 397 | 397 | // SOS: skip next on SF(timer output), clear SF |
| 398 | 398 | logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc); |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | | void amis2000_device::op_tf1() |
| 401 | void amis2000_base_device::op_tf1() |
| 402 | 402 | { |
| 403 | 403 | // TF1: skip next on flag 1 |
| 404 | 404 | m_skip = ((m_f & 0x01) != 0); |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | | void amis2000_device::op_tf2() |
| 407 | void amis2000_base_device::op_tf2() |
| 408 | 408 | { |
| 409 | 409 | // TF2: skip next on flag 2 |
| 410 | 410 | m_skip = ((m_f & 0x02) != 0); |
| r243600 | r243601 | |
| 413 | 413 | |
| 414 | 414 | // Arithmetic and Logical Instructions |
| 415 | 415 | |
| 416 | | void amis2000_device::op_adcs() |
| 416 | void amis2000_base_device::op_adcs() |
| 417 | 417 | { |
| 418 | 418 | // ADCS: add RAM to ACC+carry, skip next on not carry |
| 419 | 419 | m_acc += ram_r() + m_carry; |
| r243600 | r243601 | |
| 422 | 422 | m_acc &= 0xf; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | | void amis2000_device::op_adis() |
| 425 | void amis2000_base_device::op_adis() |
| 426 | 426 | { |
| 427 | 427 | // ADIS X: add X to ACC, skip next on not carry |
| 428 | 428 | UINT8 param = m_op & 0x0f; |
| r243600 | r243601 | |
| 431 | 431 | m_acc &= 0xf; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | | void amis2000_device::op_add() |
| 434 | void amis2000_base_device::op_add() |
| 435 | 435 | { |
| 436 | 436 | // ADD: add RAM to ACC |
| 437 | 437 | m_acc = (m_acc + ram_r()) & 0xf; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | | void amis2000_device::op_and() |
| 440 | void amis2000_base_device::op_and() |
| 441 | 441 | { |
| 442 | 442 | // AND: and ACC with RAM |
| 443 | 443 | m_acc &= ram_r(); |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | | void amis2000_device::op_xor() |
| 446 | void amis2000_base_device::op_xor() |
| 447 | 447 | { |
| 448 | 448 | // XOR: xor ACC with RAM |
| 449 | 449 | m_acc ^= ram_r(); |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | | void amis2000_device::op_stc() |
| 452 | void amis2000_base_device::op_stc() |
| 453 | 453 | { |
| 454 | 454 | // STC: set carry |
| 455 | 455 | m_carry = 1; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | | void amis2000_device::op_rsc() |
| 458 | void amis2000_base_device::op_rsc() |
| 459 | 459 | { |
| 460 | 460 | // RSC: reset carry |
| 461 | 461 | m_carry = 0; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | | void amis2000_device::op_cma() |
| 464 | void amis2000_base_device::op_cma() |
| 465 | 465 | { |
| 466 | 466 | // CMA: complement ACC |
| 467 | 467 | m_acc ^= 0xf; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | | void amis2000_device::op_sf1() |
| 470 | void amis2000_base_device::op_sf1() |
| 471 | 471 | { |
| 472 | 472 | // SF1: set flag 1 |
| 473 | 473 | m_f |= 0x01; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | | void amis2000_device::op_rf1() |
| 476 | void amis2000_base_device::op_rf1() |
| 477 | 477 | { |
| 478 | 478 | // RF1: reset flag 1 |
| 479 | 479 | m_f &= ~0x01; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | | void amis2000_device::op_sf2() |
| 482 | void amis2000_base_device::op_sf2() |
| 483 | 483 | { |
| 484 | 484 | // SF2: set flag 2 |
| 485 | 485 | m_f |= 0x02; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | | void amis2000_device::op_rf2() |
| 488 | void amis2000_base_device::op_rf2() |
| 489 | 489 | { |
| 490 | 490 | // RF2: reset flag 2 |
| 491 | 491 | m_f &= ~0x02; |
| 492 | 492 | } |
| 493 | |
| 494 | |
| 495 | |
| 496 | // AMI S2152 specific handlers |
| 497 | |
| 498 | void amis2152_cpu_device::d2f_timer_clock() |
| 499 | { |
| 500 | // schedule next timeout (frequency is guessed) |
| 501 | attotime base = attotime::from_hz(unscaled_clock() / 4 / 64); |
| 502 | m_d2f_timer->adjust(base * (0x10 - m_d2f_latch)); |
| 503 | } |
| 504 | |
| 505 | TIMER_CALLBACK_MEMBER(amis2152_cpu_device::d2f_timer_cb) |
| 506 | { |
| 507 | m_write_f(m_fout_state); |
| 508 | m_fout_state ^= 1; |
| 509 | |
| 510 | d2f_timer_clock(); |
| 511 | } |
| 512 | |
| 513 | void amis2152_cpu_device::op_szk() |
| 514 | { |
| 515 | // instead of SZK: ???: load d2f latch with ACC(?) |
| 516 | m_d2f_latch = m_acc; |
| 517 | } |
trunk/src/mame/drivers/n8080.c
| r243600 | r243601 | |
| 3 | 3 | Nintendo 8080 hardware |
| 4 | 4 | |
| 5 | 5 | - Space Fever |
| 6 | | - Space Fever High Splitter |
| 6 | - Space Fever High Splitter (aka SF-Hisplitter) |
| 7 | 7 | - Space Launcher |
| 8 | 8 | - Sheriff / Bandido / Western Gun 2 |
| 9 | 9 | - Helifire |
| r243600 | r243601 | |
| 933 | 933 | GAME( 1979, spacefev, 0, spacefev, spacefev, driver_device, 0, ROT270, "Nintendo", "Space Fever (New Ver.)", GAME_SUPPORTS_SAVE ) |
| 934 | 934 | GAME( 1979, spacefevo, spacefev, spacefev, spacefev, driver_device, 0, ROT270, "Nintendo", "Space Fever (Old Ver.)", GAME_SUPPORTS_SAVE ) |
| 935 | 935 | GAME( 1979, spacefevo2, spacefev, spacefev, spacefev, driver_device, 0, ROT270, "Nintendo", "Space Fever (Older Ver.)", GAME_SUPPORTS_SAVE ) |
| 936 | | GAME( 1979, highsplt, 0, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", GAME_SUPPORTS_SAVE ) |
| 937 | | GAME( 1979, highsplta, highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", GAME_SUPPORTS_SAVE ) |
| 938 | | GAME( 1979, highspltb, highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", GAME_SUPPORTS_SAVE ) |
| 936 | GAME( 1979, highsplt, 0, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", GAME_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer |
| 937 | GAME( 1979, highsplta, highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", GAME_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer |
| 938 | GAME( 1979, highspltb, highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", GAME_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer |
| 939 | 939 | GAME( 1979, spacelnc, 0, spacefev, spacelnc, driver_device, 0, ROT270, "Nintendo", "Space Launcher", GAME_SUPPORTS_SAVE ) |
| 940 | 940 | GAME( 1979, sheriff, 0, sheriff, sheriff, driver_device, 0, ROT270, "Nintendo", "Sheriff", GAME_SUPPORTS_SAVE ) |
| 941 | 941 | GAME( 1980, bandido, sheriff, sheriff, bandido, driver_device, 0, ROT270, "Nintendo (Exidy license)", "Bandido", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/drivers/wc90.c
| r243600 | r243601 | |
| 55 | 55 | * * |
| 56 | 56 | ***************************** |
| 57 | 57 | |
| 58 | | There is known to be a Pacman hack running on this hardware. It was done by Mike C. and isn't ment |
| 58 | There is known to be a Pacman hack running on this hardware. It was done by Mike C. and isn't meant |
| 59 | 59 | for inclusion in MAME. However the roms with checksums are listed below to prevent it being added |
| 60 | 60 | as a newly "found" game: |
| 61 | 61 | |
| r243600 | r243601 | |
| 79 | 79 | #include "includes/wc90.h" |
| 80 | 80 | |
| 81 | 81 | |
| 82 | | WRITE8_MEMBER(wc90_state::wc90_bankswitch_w) |
| 82 | WRITE8_MEMBER(wc90_state::bankswitch_w) |
| 83 | 83 | { |
| 84 | 84 | int bankaddress; |
| 85 | 85 | UINT8 *RAM = memregion("maincpu")->base(); |
| r243600 | r243601 | |
| 89 | 89 | membank("bank1")->set_base(&RAM[bankaddress] ); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | | WRITE8_MEMBER(wc90_state::wc90_bankswitch1_w) |
| 92 | WRITE8_MEMBER(wc90_state::bankswitch1_w) |
| 93 | 93 | { |
| 94 | 94 | int bankaddress; |
| 95 | 95 | UINT8 *RAM = memregion("sub")->base(); |
| r243600 | r243601 | |
| 99 | 99 | membank("bank2")->set_base(&RAM[bankaddress] ); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | | WRITE8_MEMBER(wc90_state::wc90_sound_command_w) |
| 102 | WRITE8_MEMBER(wc90_state::sound_command_w) |
| 103 | 103 | { |
| 104 | 104 | soundlatch_byte_w(space, offset, data); |
| 105 | 105 | m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| r243600 | r243601 | |
| 110 | 110 | static ADDRESS_MAP_START( wc90_map_1, AS_PROGRAM, 8, wc90_state ) |
| 111 | 111 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 112 | 112 | AM_RANGE(0x8000, 0x9fff) AM_RAM /* Main RAM */ |
| 113 | | AM_RANGE(0xa000, 0xafff) AM_RAM_WRITE(wc90_fgvideoram_w) AM_SHARE("fgvideoram") /* fg video ram */ |
| 113 | AM_RANGE(0xa000, 0xafff) AM_RAM_WRITE(fgvideoram_w) AM_SHARE("fgvideoram") /* fg video ram */ |
| 114 | 114 | AM_RANGE(0xb000, 0xbfff) AM_RAM |
| 115 | | AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(wc90_bgvideoram_w) AM_SHARE("bgvideoram") |
| 115 | AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(bgvideoram_w) AM_SHARE("bgvideoram") |
| 116 | 116 | AM_RANGE(0xd000, 0xdfff) AM_RAM |
| 117 | | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(wc90_txvideoram_w) AM_SHARE("txvideoram") /* tx video ram */ |
| 117 | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") /* tx video ram */ |
| 118 | 118 | AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank1") |
| 119 | 119 | AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("share1") |
| 120 | 120 | AM_RANGE(0xfc00, 0xfc00) AM_READ_PORT("P1") |
| r243600 | r243601 | |
| 134 | 134 | AM_RANGE(0xfc43, 0xfc43) AM_WRITEONLY AM_SHARE("scroll2yhi") |
| 135 | 135 | AM_RANGE(0xfc46, 0xfc46) AM_WRITEONLY AM_SHARE("scroll2xlo") |
| 136 | 136 | AM_RANGE(0xfc47, 0xfc47) AM_WRITEONLY AM_SHARE("scroll2xhi") |
| 137 | | AM_RANGE(0xfcc0, 0xfcc0) AM_WRITE(wc90_sound_command_w) |
| 137 | AM_RANGE(0xfcc0, 0xfcc0) AM_WRITE(sound_command_w) |
| 138 | 138 | AM_RANGE(0xfcd0, 0xfcd0) AM_WRITE(watchdog_reset_w) |
| 139 | | AM_RANGE(0xfce0, 0xfce0) AM_WRITE(wc90_bankswitch_w) |
| 139 | AM_RANGE(0xfce0, 0xfce0) AM_WRITE(bankswitch_w) |
| 140 | 140 | ADDRESS_MAP_END |
| 141 | 141 | |
| 142 | 142 | static ADDRESS_MAP_START( wc90_map_2, AS_PROGRAM, 8, wc90_state ) |
| r243600 | r243601 | |
| 147 | 147 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 148 | 148 | AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank2") |
| 149 | 149 | AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("share1") |
| 150 | | AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90_bankswitch1_w) |
| 150 | AM_RANGE(0xfc00, 0xfc00) AM_WRITE(bankswitch1_w) |
| 151 | 151 | AM_RANGE(0xfc01, 0xfc01) AM_WRITE(watchdog_reset_w) |
| 152 | 152 | ADDRESS_MAP_END |
| 153 | 153 | |
| r243600 | r243601 | |
| 316 | 316 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 317 | 317 | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 318 | 318 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 319 | | MCFG_SCREEN_UPDATE_DRIVER(wc90_state, screen_update_wc90) |
| 319 | MCFG_SCREEN_UPDATE_DRIVER(wc90_state, screen_update) |
| 320 | 320 | MCFG_SCREEN_PALETTE("palette") |
| 321 | 321 | |
| 322 | 322 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", wc90) |
| r243600 | r243601 | |
| 472 | 472 | ROM_LOAD( "ic82_06.bin", 0x00000, 0x20000, CRC(2fd692ed) SHA1(0273dc39181504320bec0187d074b2f86c821508) ) |
| 473 | 473 | ROM_END |
| 474 | 474 | |
| 475 | | GAME( 1989, wc90, 0, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (World)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) |
| 476 | | GAME( 1989, wc90a, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) |
| 477 | | GAME( 1989, wc90b, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 2)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) |
| 478 | | GAME( 1989, wc90t, wc90, wc90t,wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (trackball set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) |
| 475 | GAME( 1989, wc90, 0, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (World)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 476 | GAME( 1989, wc90a, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 477 | GAME( 1989, wc90b, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 2)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 478 | GAME( 1989, wc90t, wc90, wc90t,wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (trackball set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
trunk/src/mame/drivers/wwfsstar.c
| r243600 | r243601 | |
| 121 | 121 | 04 Mar 2002 | Fixed Dip Switches and Inputs (Steph) |
| 122 | 122 | | Fixed screen flipping by using similar routine to the one |
| 123 | 123 | | in src/video/wwfwfest.c (Steph) |
| 124 | | 18 Jun 2001 | Changed Interrupt Function .. its not fully understood whats |
| 124 | 18 Jun 2001 | Changed Interrupt Function .. it's not fully understood what |
| 125 | 125 | | is meant to be going on .. |
| 126 | 126 | 15 Jun 2001 | Cleaned up Sprite Drawing a bit, correcting some clipping probs, |
| 127 | 127 | | mapped DSW's |
| r243600 | r243601 | |
| 170 | 170 | |
| 171 | 171 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, wwfsstar_state ) |
| 172 | 172 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 173 | | AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(wwfsstar_fg0_videoram_w) AM_SHARE("fg0_videoram") /* FG0 Ram */ |
| 174 | | AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(wwfsstar_bg0_videoram_w) AM_SHARE("bg0_videoram") /* BG0 Ram */ |
| 173 | AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(fg0_videoram_w) AM_SHARE("fg0_videoram") /* FG0 Ram */ |
| 174 | AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(bg0_videoram_w) AM_SHARE("bg0_videoram") /* BG0 Ram */ |
| 175 | 175 | AM_RANGE(0x100000, 0x1003ff) AM_RAM AM_SHARE("spriteram") /* SPR Ram */ |
| 176 | 176 | AM_RANGE(0x140000, 0x140fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 177 | | AM_RANGE(0x180000, 0x180003) AM_WRITE(wwfsstar_irqack_w) |
| 177 | AM_RANGE(0x180000, 0x180003) AM_WRITE(irqack_w) |
| 178 | 178 | AM_RANGE(0x180000, 0x180001) AM_READ_PORT("DSW1") |
| 179 | 179 | AM_RANGE(0x180002, 0x180003) AM_READ_PORT("DSW2") |
| 180 | 180 | AM_RANGE(0x180004, 0x180005) AM_READ_PORT("P1") |
| 181 | | AM_RANGE(0x180004, 0x180007) AM_WRITE(wwfsstar_scrollwrite) |
| 181 | AM_RANGE(0x180004, 0x180007) AM_WRITE(scroll_w) |
| 182 | 182 | AM_RANGE(0x180006, 0x180007) AM_READ_PORT("P2") |
| 183 | 183 | AM_RANGE(0x180008, 0x180009) AM_READ_PORT("SYSTEM") |
| 184 | | AM_RANGE(0x180008, 0x180009) AM_WRITE(wwfsstar_soundwrite) |
| 185 | | AM_RANGE(0x18000a, 0x18000b) AM_WRITE(wwfsstar_flipscreen_w) |
| 184 | AM_RANGE(0x180008, 0x180009) AM_WRITE(sound_w) |
| 185 | AM_RANGE(0x18000a, 0x18000b) AM_WRITE(flipscreen_w) |
| 186 | 186 | AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM /* Work Ram */ |
| 187 | 187 | ADDRESS_MAP_END |
| 188 | 188 | |
| r243600 | r243601 | |
| 201 | 201 | as used by the above memory map |
| 202 | 202 | *******************************************************************************/ |
| 203 | 203 | |
| 204 | | WRITE16_MEMBER(wwfsstar_state::wwfsstar_scrollwrite) |
| 204 | WRITE16_MEMBER(wwfsstar_state::scroll_w) |
| 205 | 205 | { |
| 206 | 206 | switch (offset) |
| 207 | 207 | { |
| r243600 | r243601 | |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | | WRITE16_MEMBER(wwfsstar_state::wwfsstar_soundwrite) |
| 217 | WRITE16_MEMBER(wwfsstar_state::sound_w) |
| 218 | 218 | { |
| 219 | 219 | soundlatch_byte_w(space, 1, data & 0xff); |
| 220 | 220 | m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | | WRITE16_MEMBER(wwfsstar_state::wwfsstar_flipscreen_w) |
| 223 | WRITE16_MEMBER(wwfsstar_state::flipscreen_w) |
| 224 | 224 | { |
| 225 | 225 | flip_screen_set(data & 1); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | | WRITE16_MEMBER(wwfsstar_state::wwfsstar_irqack_w) |
| 228 | WRITE16_MEMBER(wwfsstar_state::irqack_w) |
| 229 | 229 | { |
| 230 | 230 | if (offset == 0) |
| 231 | 231 | m_maincpu->set_input_line(6, CLEAR_LINE); |
| r243600 | r243601 | |
| 247 | 247 | A hack is required: raise the vblank bit a scanline early. |
| 248 | 248 | */ |
| 249 | 249 | |
| 250 | | TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_state::wwfsstar_scanline) |
| 250 | TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_state::scanline) |
| 251 | 251 | { |
| 252 | 252 | int scanline = param; |
| 253 | 253 | |
| r243600 | r243601 | |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | | CUSTOM_INPUT_MEMBER(wwfsstar_state::wwfsstar_vblank_r) |
| 281 | CUSTOM_INPUT_MEMBER(wwfsstar_state::vblank_r) |
| 282 | 282 | { |
| 283 | 283 | return m_vblank; |
| 284 | 284 | } |
| r243600 | r243601 | |
| 313 | 313 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("Button B (1P VS 2P - Buy-in)") |
| 314 | 314 | |
| 315 | 315 | PORT_START("SYSTEM") |
| 316 | | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfsstar_state,wwfsstar_vblank_r, NULL) /* VBlank */ |
| 316 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfsstar_state, vblank_r, NULL) /* VBlank */ |
| 317 | 317 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 318 | 318 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 319 | 319 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r243600 | r243601 | |
| 416 | 416 | /* basic machine hardware */ |
| 417 | 417 | MCFG_CPU_ADD("maincpu", M68000, CPU_CLOCK) |
| 418 | 418 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 419 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", wwfsstar_state, wwfsstar_scanline, "screen", 0, 1) |
| 419 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", wwfsstar_state, scanline, "screen", 0, 1) |
| 420 | 420 | |
| 421 | 421 | MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) |
| 422 | 422 | MCFG_CPU_PROGRAM_MAP(sound_map) |
| r243600 | r243601 | |
| 424 | 424 | /* video hardware */ |
| 425 | 425 | MCFG_SCREEN_ADD("screen", RASTER) |
| 426 | 426 | MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 320, 0, 256, 272, 8, 248) /* HTOTAL and VTOTAL are guessed */ |
| 427 | | MCFG_SCREEN_UPDATE_DRIVER(wwfsstar_state, screen_update_wwfsstar) |
| 427 | MCFG_SCREEN_UPDATE_DRIVER(wwfsstar_state, screen_update) |
| 428 | 428 | MCFG_SCREEN_PALETTE("palette") |
| 429 | 429 | |
| 430 | 430 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", wwfsstar) |
| r243600 | r243601 | |
| 627 | 627 | |
| 628 | 628 | |
| 629 | 629 | |
| 630 | | GAME( 1989, wwfsstar, 0, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (Europe)", 0 ) |
| 631 | | GAME( 1989, wwfsstaru, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (US, Newer)", 0 ) |
| 632 | | GAME( 1989, wwfsstarua, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (US)", 0 ) |
| 633 | | GAME( 1989, wwfsstarj, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (Japan)", 0 ) |
| 634 | | GAME( 1989, wwfsstarb, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "bootleg", "WWF Superstars (bootleg)", 0 ) |
| 630 | GAME( 1989, wwfsstar, 0, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (Europe)", GAME_SUPPORTS_SAVE ) |
| 631 | GAME( 1989, wwfsstaru, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (US, Newer)", GAME_SUPPORTS_SAVE ) |
| 632 | GAME( 1989, wwfsstarua, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (US)", GAME_SUPPORTS_SAVE ) |
| 633 | GAME( 1989, wwfsstarj, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "Technos Japan", "WWF Superstars (Japan)", GAME_SUPPORTS_SAVE ) |
| 634 | GAME( 1989, wwfsstarb, wwfsstar, wwfsstar, wwfsstar, driver_device, 0, ROT0, "bootleg", "WWF Superstars (bootleg)", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/drivers/xxmissio.c
| r243600 | r243601 | |
| 14 | 14 | #include "includes/xxmissio.h" |
| 15 | 15 | |
| 16 | 16 | |
| 17 | | WRITE8_MEMBER(xxmissio_state::xxmissio_bank_sel_w) |
| 17 | WRITE8_MEMBER(xxmissio_state::bank_sel_w) |
| 18 | 18 | { |
| 19 | 19 | membank("bank1")->set_entry(data & 7); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | | CUSTOM_INPUT_MEMBER(xxmissio_state::xxmissio_status_r) |
| 22 | CUSTOM_INPUT_MEMBER(xxmissio_state::status_r) |
| 23 | 23 | { |
| 24 | 24 | int bit_mask = (FPTR)param; |
| 25 | 25 | return (m_status & bit_mask) ? 1 : 0; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | | WRITE8_MEMBER(xxmissio_state::xxmissio_status_m_w) |
| 28 | WRITE8_MEMBER(xxmissio_state::status_m_w) |
| 29 | 29 | { |
| 30 | 30 | switch (data) |
| 31 | 31 | { |
| r243600 | r243601 | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | | WRITE8_MEMBER(xxmissio_state::xxmissio_status_s_w) |
| 47 | WRITE8_MEMBER(xxmissio_state::status_s_w) |
| 48 | 48 | { |
| 49 | 49 | switch (data) |
| 50 | 50 | { |
| r243600 | r243601 | |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | | INTERRUPT_GEN_MEMBER(xxmissio_state::xxmissio_interrupt_m) |
| 66 | INTERRUPT_GEN_MEMBER(xxmissio_state::interrupt_m) |
| 67 | 67 | { |
| 68 | 68 | m_status &= ~0x20; |
| 69 | | device.execute().set_input_line(0, HOLD_LINE); |
| 69 | m_maincpu->set_input_line(0, HOLD_LINE); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | | INTERRUPT_GEN_MEMBER(xxmissio_state::xxmissio_interrupt_s) |
| 72 | INTERRUPT_GEN_MEMBER(xxmissio_state::interrupt_s) |
| 73 | 73 | { |
| 74 | 74 | m_status &= ~0x10; |
| 75 | | device.execute().set_input_line(0, HOLD_LINE); |
| 75 | m_subcpu->set_input_line(0, HOLD_LINE); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | void xxmissio_state::machine_start() |
| 79 | 79 | { |
| 80 | 80 | membank("bank1")->configure_entries(0, 8, memregion("user1")->base(), 0x4000); |
| 81 | 81 | membank("bank1")->set_entry(0); |
| 82 | |
| 83 | save_item(NAME(m_status)); |
| 82 | 84 | } |
| 83 | 85 | |
| 84 | 86 | /****************************************************************************/ |
| r243600 | r243601 | |
| 92 | 94 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1") |
| 93 | 95 | AM_RANGE(0xa001, 0xa001) AM_READ_PORT("P2") |
| 94 | 96 | AM_RANGE(0xa002, 0xa002) AM_READ_PORT("STATUS") |
| 95 | | AM_RANGE(0xa002, 0xa002) AM_WRITE(xxmissio_status_m_w) |
| 96 | | AM_RANGE(0xa003, 0xa003) AM_WRITE(xxmissio_flipscreen_w) |
| 97 | AM_RANGE(0xa002, 0xa002) AM_WRITE(status_m_w) |
| 98 | AM_RANGE(0xa003, 0xa003) AM_WRITE(flipscreen_w) |
| 97 | 99 | |
| 98 | 100 | AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_SHARE("fgram") |
| 99 | | AM_RANGE(0xc800, 0xcfff) AM_READWRITE(xxmissio_bgram_r, xxmissio_bgram_w) AM_SHARE("bgram") |
| 101 | AM_RANGE(0xc800, 0xcfff) AM_READWRITE(bgram_r, bgram_w) AM_SHARE("bgram") |
| 100 | 102 | AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram") |
| 101 | 103 | |
| 102 | 104 | AM_RANGE(0xd800, 0xdaff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| r243600 | r243601 | |
| 112 | 114 | |
| 113 | 115 | AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE("ym1", ym2203_device, read, write) |
| 114 | 116 | AM_RANGE(0x8002, 0x8003) AM_DEVREADWRITE("ym2", ym2203_device, read, write) |
| 115 | | AM_RANGE(0x8006, 0x8006) AM_WRITE(xxmissio_bank_sel_w) |
| 117 | AM_RANGE(0x8006, 0x8006) AM_WRITE(bank_sel_w) |
| 116 | 118 | |
| 117 | 119 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1") |
| 118 | 120 | AM_RANGE(0xa001, 0xa001) AM_READ_PORT("P2") |
| 119 | 121 | AM_RANGE(0xa002, 0xa002) AM_READ_PORT("STATUS") |
| 120 | | AM_RANGE(0xa002, 0xa002) AM_WRITE(xxmissio_status_s_w) |
| 121 | | AM_RANGE(0xa003, 0xa003) AM_WRITE(xxmissio_flipscreen_w) |
| 122 | AM_RANGE(0xa002, 0xa002) AM_WRITE(status_s_w) |
| 123 | AM_RANGE(0xa003, 0xa003) AM_WRITE(flipscreen_w) |
| 122 | 124 | |
| 123 | 125 | AM_RANGE(0xc000, 0xc7ff) AM_SHARE("fgram") AM_RAM |
| 124 | | AM_RANGE(0xc800, 0xcfff) AM_SHARE("bgram") AM_READWRITE(xxmissio_bgram_r, xxmissio_bgram_w) |
| 126 | AM_RANGE(0xc800, 0xcfff) AM_SHARE("bgram") AM_READWRITE(bgram_r, bgram_w) |
| 125 | 127 | AM_RANGE(0xd000, 0xd7ff) AM_SHARE("spriteram") AM_RAM |
| 126 | 128 | |
| 127 | 129 | AM_RANGE(0xd800, 0xdaff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| r243600 | r243601 | |
| 196 | 198 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) /* Shown as "Unused" in the manual */ |
| 197 | 199 | |
| 198 | 200 | PORT_START("STATUS") |
| 199 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x01) |
| 201 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x01) |
| 200 | 202 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") |
| 201 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x04) |
| 202 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x08) |
| 203 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x10) |
| 204 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x20) |
| 205 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x40) |
| 206 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x80) |
| 203 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x04) |
| 204 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x08) |
| 205 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x10) |
| 206 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x20) |
| 207 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x40) |
| 208 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x80) |
| 207 | 209 | INPUT_PORTS_END |
| 208 | 210 | |
| 209 | 211 | /****************************************************************************/ |
| r243600 | r243601 | |
| 258 | 260 | /* basic machine hardware */ |
| 259 | 261 | MCFG_CPU_ADD("maincpu", Z80,12000000/4) /* 3.0MHz */ |
| 260 | 262 | MCFG_CPU_PROGRAM_MAP(map1) |
| 261 | | MCFG_CPU_VBLANK_INT_DRIVER("screen", xxmissio_state, xxmissio_interrupt_m) |
| 263 | MCFG_CPU_VBLANK_INT_DRIVER("screen", xxmissio_state, interrupt_m) |
| 262 | 264 | |
| 263 | 265 | MCFG_CPU_ADD("sub", Z80,12000000/4) /* 3.0MHz */ |
| 264 | 266 | MCFG_CPU_PROGRAM_MAP(map2) |
| 265 | | MCFG_CPU_PERIODIC_INT_DRIVER(xxmissio_state, xxmissio_interrupt_s, 2*60) |
| 267 | MCFG_CPU_PERIODIC_INT_DRIVER(xxmissio_state, interrupt_s, 2*60) |
| 266 | 268 | |
| 267 | 269 | MCFG_QUANTUM_TIME(attotime::from_hz(6000)) |
| 268 | 270 | |
| r243600 | r243601 | |
| 273 | 275 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 274 | 276 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 275 | 277 | MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 4*8, 28*8-1) |
| 276 | | MCFG_SCREEN_UPDATE_DRIVER(xxmissio_state, screen_update_xxmissio) |
| 278 | MCFG_SCREEN_UPDATE_DRIVER(xxmissio_state, screen_update) |
| 277 | 279 | MCFG_SCREEN_PALETTE("palette") |
| 278 | 280 | |
| 279 | 281 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", xxmissio) |
| r243600 | r243601 | |
| 293 | 295 | MCFG_SOUND_ROUTE(3, "mono", 0.40) |
| 294 | 296 | |
| 295 | 297 | MCFG_SOUND_ADD("ym2", YM2203, 12000000/8) |
| 296 | | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(xxmissio_state, xxmissio_scroll_x_w)) |
| 297 | | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(xxmissio_state, xxmissio_scroll_y_w)) |
| 298 | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(xxmissio_state, scroll_x_w)) |
| 299 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(xxmissio_state, scroll_y_w)) |
| 298 | 300 | MCFG_SOUND_ROUTE(0, "mono", 0.15) |
| 299 | 301 | MCFG_SOUND_ROUTE(1, "mono", 0.15) |
| 300 | 302 | MCFG_SOUND_ROUTE(2, "mono", 0.15) |
| r243600 | r243601 | |
| 326 | 328 | ROM_LOAD16_BYTE( "xx11.4b", 0x0001, 0x8000, CRC(d9dd827c) SHA1(aea3a5abd871adf7f75ad4d6cc57eff0833135c7) ) |
| 327 | 329 | ROM_END |
| 328 | 330 | |
| 329 | | GAME( 1986, xxmissio, 0, xxmissio, xxmissio, driver_device, 0, ROT90, "UPL", "XX Mission", 0 ) |
| 331 | GAME( 1986, xxmissio, 0, xxmissio, xxmissio, driver_device, 0, ROT90, "UPL", "XX Mission", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/wc90.h
| r243600 | r243601 | |
| 5 | 5 | public: |
| 6 | 6 | wc90_state(const machine_config &mconfig, device_type type, const char *tag) |
| 7 | 7 | : driver_device(mconfig, type, tag), |
| 8 | m_maincpu(*this, "maincpu"), |
| 9 | m_audiocpu(*this, "audiocpu"), |
| 10 | m_gfxdecode(*this, "gfxdecode"), |
| 11 | m_palette(*this, "palette"), |
| 12 | m_sprgen(*this, "spritegen"), |
| 8 | 13 | m_fgvideoram(*this, "fgvideoram"), |
| 9 | 14 | m_bgvideoram(*this, "bgvideoram"), |
| 10 | 15 | m_txvideoram(*this, "txvideoram"), |
| r243600 | r243601 | |
| 20 | 25 | m_scroll1yhi(*this, "scroll1yhi"), |
| 21 | 26 | m_scroll2ylo(*this, "scroll2ylo"), |
| 22 | 27 | m_scroll2yhi(*this, "scroll2yhi"), |
| 23 | | m_spriteram(*this, "spriteram"), |
| 24 | | m_maincpu(*this, "maincpu"), |
| 25 | | m_audiocpu(*this, "audiocpu"), |
| 26 | | m_gfxdecode(*this, "gfxdecode"), |
| 27 | | m_palette(*this, "palette"), |
| 28 | | m_sprgen(*this, "spritegen") |
| 28 | m_spriteram(*this, "spriteram") |
| 29 | 29 | { } |
| 30 | 30 | |
| 31 | |
| 32 | required_device<cpu_device> m_maincpu; |
| 33 | required_device<cpu_device> m_audiocpu; |
| 34 | required_device<gfxdecode_device> m_gfxdecode; |
| 35 | required_device<palette_device> m_palette; |
| 36 | required_device<tecmo_spr_device> m_sprgen; |
| 31 | 37 | |
| 32 | | |
| 33 | 38 | required_shared_ptr<UINT8> m_fgvideoram; |
| 34 | 39 | required_shared_ptr<UINT8> m_bgvideoram; |
| 35 | 40 | required_shared_ptr<UINT8> m_txvideoram; |
| r243600 | r243601 | |
| 45 | 50 | required_shared_ptr<UINT8> m_scroll1yhi; |
| 46 | 51 | required_shared_ptr<UINT8> m_scroll2ylo; |
| 47 | 52 | required_shared_ptr<UINT8> m_scroll2yhi; |
| 53 | required_shared_ptr<UINT8> m_spriteram; |
| 54 | |
| 48 | 55 | tilemap_t *m_tx_tilemap; |
| 49 | 56 | tilemap_t *m_fg_tilemap; |
| 50 | 57 | tilemap_t *m_bg_tilemap; |
| 51 | | required_shared_ptr<UINT8> m_spriteram; |
| 52 | | DECLARE_WRITE8_MEMBER(wc90_bankswitch_w); |
| 53 | | DECLARE_WRITE8_MEMBER(wc90_bankswitch1_w); |
| 54 | | DECLARE_WRITE8_MEMBER(wc90_sound_command_w); |
| 55 | | DECLARE_WRITE8_MEMBER(wc90_bgvideoram_w); |
| 56 | | DECLARE_WRITE8_MEMBER(wc90_fgvideoram_w); |
| 57 | | DECLARE_WRITE8_MEMBER(wc90_txvideoram_w); |
| 58 | |
| 59 | DECLARE_WRITE8_MEMBER(bankswitch_w); |
| 60 | DECLARE_WRITE8_MEMBER(bankswitch1_w); |
| 61 | DECLARE_WRITE8_MEMBER(sound_command_w); |
| 62 | DECLARE_WRITE8_MEMBER(bgvideoram_w); |
| 63 | DECLARE_WRITE8_MEMBER(fgvideoram_w); |
| 64 | DECLARE_WRITE8_MEMBER(txvideoram_w); |
| 65 | DECLARE_WRITE_LINE_MEMBER(irqhandler); |
| 66 | |
| 58 | 67 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 59 | 68 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 60 | 69 | TILE_GET_INFO_MEMBER(get_tx_tile_info); |
| 61 | 70 | TILE_GET_INFO_MEMBER(track_get_bg_tile_info); |
| 62 | 71 | TILE_GET_INFO_MEMBER(track_get_fg_tile_info); |
| 72 | |
| 63 | 73 | virtual void video_start(); |
| 64 | 74 | DECLARE_VIDEO_START(wc90t); |
| 65 | | UINT32 screen_update_wc90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 66 | | |
| 67 | | DECLARE_WRITE_LINE_MEMBER(irqhandler); |
| 68 | | required_device<cpu_device> m_maincpu; |
| 69 | | required_device<cpu_device> m_audiocpu; |
| 70 | | required_device<gfxdecode_device> m_gfxdecode; |
| 71 | | required_device<palette_device> m_palette; |
| 72 | | required_device<tecmo_spr_device> m_sprgen; |
| 75 | |
| 76 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 73 | 77 | }; |
trunk/src/mame/includes/wwfsstar.h
| r243600 | r243601 | |
| 3 | 3 | public: |
| 4 | 4 | wwfsstar_state(const machine_config &mconfig, device_type type, const char *tag) |
| 5 | 5 | : driver_device(mconfig, type, tag), |
| 6 | | m_spriteram(*this, "spriteram"), |
| 7 | | m_fg0_videoram(*this, "fg0_videoram"), |
| 8 | | m_bg0_videoram(*this, "bg0_videoram"), |
| 9 | 6 | m_maincpu(*this, "maincpu"), |
| 10 | 7 | m_audiocpu(*this, "audiocpu"), |
| 11 | 8 | m_gfxdecode(*this, "gfxdecode"), |
| 12 | 9 | m_screen(*this, "screen"), |
| 13 | | m_palette(*this, "palette") { } |
| 10 | m_palette(*this, "palette"), |
| 11 | m_spriteram(*this, "spriteram"), |
| 12 | m_fg0_videoram(*this, "fg0_videoram"), |
| 13 | m_bg0_videoram(*this, "bg0_videoram") { } |
| 14 | 14 | |
| 15 | required_device<cpu_device> m_maincpu; |
| 16 | required_device<cpu_device> m_audiocpu; |
| 17 | required_device<gfxdecode_device> m_gfxdecode; |
| 18 | required_device<screen_device> m_screen; |
| 19 | required_device<palette_device> m_palette; |
| 20 | |
| 21 | required_shared_ptr<UINT16> m_spriteram; |
| 22 | required_shared_ptr<UINT16> m_fg0_videoram; |
| 23 | required_shared_ptr<UINT16> m_bg0_videoram; |
| 24 | |
| 15 | 25 | int m_vblank; |
| 16 | 26 | int m_scrollx; |
| 17 | 27 | int m_scrolly; |
| 18 | | required_shared_ptr<UINT16> m_spriteram; |
| 19 | | required_shared_ptr<UINT16> m_fg0_videoram; |
| 20 | | required_shared_ptr<UINT16> m_bg0_videoram; |
| 21 | 28 | tilemap_t *m_fg0_tilemap; |
| 22 | 29 | tilemap_t *m_bg0_tilemap; |
| 23 | | DECLARE_WRITE16_MEMBER(wwfsstar_scrollwrite); |
| 24 | | DECLARE_WRITE16_MEMBER(wwfsstar_soundwrite); |
| 25 | | DECLARE_WRITE16_MEMBER(wwfsstar_flipscreen_w); |
| 26 | | DECLARE_WRITE16_MEMBER(wwfsstar_irqack_w); |
| 27 | | DECLARE_WRITE16_MEMBER(wwfsstar_fg0_videoram_w); |
| 28 | | DECLARE_WRITE16_MEMBER(wwfsstar_bg0_videoram_w); |
| 29 | | DECLARE_CUSTOM_INPUT_MEMBER(wwfsstar_vblank_r); |
| 30 | |
| 31 | DECLARE_WRITE16_MEMBER(scroll_w); |
| 32 | DECLARE_WRITE16_MEMBER(sound_w); |
| 33 | DECLARE_WRITE16_MEMBER(flipscreen_w); |
| 34 | DECLARE_WRITE16_MEMBER(irqack_w); |
| 35 | DECLARE_WRITE16_MEMBER(fg0_videoram_w); |
| 36 | DECLARE_WRITE16_MEMBER(bg0_videoram_w); |
| 37 | |
| 38 | DECLARE_CUSTOM_INPUT_MEMBER(vblank_r); |
| 39 | |
| 40 | TIMER_DEVICE_CALLBACK_MEMBER(scanline); |
| 41 | |
| 30 | 42 | TILE_GET_INFO_MEMBER(get_fg0_tile_info); |
| 31 | 43 | TILEMAP_MAPPER_MEMBER(bg0_scan); |
| 32 | 44 | TILE_GET_INFO_MEMBER(get_bg0_tile_info); |
| 45 | |
| 33 | 46 | virtual void video_start(); |
| 34 | | UINT32 screen_update_wwfsstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 35 | | TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_scanline); |
| 47 | |
| 48 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 36 | 49 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 37 | | required_device<cpu_device> m_maincpu; |
| 38 | | required_device<cpu_device> m_audiocpu; |
| 39 | | required_device<gfxdecode_device> m_gfxdecode; |
| 40 | | required_device<screen_device> m_screen; |
| 41 | | required_device<palette_device> m_palette; |
| 42 | 50 | }; |
trunk/src/mame/includes/xxmissio.h
| r243600 | r243601 | |
| 3 | 3 | public: |
| 4 | 4 | xxmissio_state(const machine_config &mconfig, device_type type, const char *tag) |
| 5 | 5 | : driver_device(mconfig, type, tag), |
| 6 | | m_bgram(*this, "bgram"), |
| 7 | | m_fgram(*this, "fgram"), |
| 8 | | m_spriteram(*this, "spriteram"), |
| 9 | 6 | m_maincpu(*this, "maincpu"), |
| 10 | 7 | m_subcpu(*this, "sub"), |
| 11 | 8 | m_gfxdecode(*this, "gfxdecode"), |
| 12 | | m_palette(*this, "palette") { } |
| 9 | m_palette(*this, "palette"), |
| 10 | m_bgram(*this, "bgram"), |
| 11 | m_fgram(*this, "fgram"), |
| 12 | m_spriteram(*this, "spriteram") { } |
| 13 | 13 | |
| 14 | | UINT8 m_status; |
| 14 | required_device<cpu_device> m_maincpu; |
| 15 | required_device<cpu_device> m_subcpu; |
| 16 | required_device<gfxdecode_device> m_gfxdecode; |
| 17 | required_device<palette_device> m_palette; |
| 18 | |
| 15 | 19 | required_shared_ptr<UINT8> m_bgram; |
| 16 | 20 | required_shared_ptr<UINT8> m_fgram; |
| 17 | 21 | required_shared_ptr<UINT8> m_spriteram; |
| 22 | |
| 18 | 23 | tilemap_t *m_bg_tilemap; |
| 19 | 24 | tilemap_t *m_fg_tilemap; |
| 25 | UINT8 m_status; |
| 20 | 26 | UINT8 m_xscroll; |
| 21 | 27 | UINT8 m_yscroll; |
| 22 | 28 | UINT8 m_flipscreen; |
| 23 | | DECLARE_WRITE8_MEMBER(xxmissio_bank_sel_w); |
| 24 | | DECLARE_WRITE8_MEMBER(xxmissio_status_m_w); |
| 25 | | DECLARE_WRITE8_MEMBER(xxmissio_status_s_w); |
| 26 | | DECLARE_WRITE8_MEMBER(xxmissio_flipscreen_w); |
| 27 | | DECLARE_WRITE8_MEMBER(xxmissio_bgram_w); |
| 28 | | DECLARE_READ8_MEMBER(xxmissio_bgram_r); |
| 29 | | DECLARE_CUSTOM_INPUT_MEMBER(xxmissio_status_r); |
| 29 | |
| 30 | DECLARE_WRITE8_MEMBER(bank_sel_w); |
| 31 | DECLARE_WRITE8_MEMBER(status_m_w); |
| 32 | DECLARE_WRITE8_MEMBER(status_s_w); |
| 33 | DECLARE_WRITE8_MEMBER(flipscreen_w); |
| 34 | DECLARE_WRITE8_MEMBER(bgram_w); |
| 35 | DECLARE_READ8_MEMBER(bgram_r); |
| 36 | DECLARE_WRITE8_MEMBER(scroll_x_w); |
| 37 | DECLARE_WRITE8_MEMBER(scroll_y_w); |
| 38 | |
| 39 | DECLARE_CUSTOM_INPUT_MEMBER(status_r); |
| 40 | |
| 41 | INTERRUPT_GEN_MEMBER(interrupt_m); |
| 42 | INTERRUPT_GEN_MEMBER(interrupt_s); |
| 43 | |
| 30 | 44 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 31 | 45 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 46 | |
| 32 | 47 | virtual void machine_start(); |
| 33 | 48 | virtual void video_start(); |
| 34 | | UINT32 screen_update_xxmissio(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 35 | | INTERRUPT_GEN_MEMBER(xxmissio_interrupt_m); |
| 36 | | INTERRUPT_GEN_MEMBER(xxmissio_interrupt_s); |
| 37 | | DECLARE_WRITE8_MEMBER(xxmissio_scroll_x_w); |
| 38 | | DECLARE_WRITE8_MEMBER(xxmissio_scroll_y_w); |
| 49 | |
| 50 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 39 | 51 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx); |
| 40 | | required_device<cpu_device> m_maincpu; |
| 41 | | required_device<cpu_device> m_subcpu; |
| 42 | | required_device<gfxdecode_device> m_gfxdecode; |
| 43 | | required_device<palette_device> m_palette; |
| 44 | 52 | }; |
trunk/src/mess/drivers/wildfire.c
| r243600 | r243601 | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | TODO: |
| 16 | | - bad sound (probably MCU related) |
| 16 | - sound emulation could still be improved |
| 17 | 17 | - when the game strobes a led faster, it should appear brighter, for example when |
| 18 | 18 | the ball hits one of the bumpers |
| 19 | 19 | - some 7segs digits are wrong (mcu on-die decoder is customizable?) |
| r243600 | r243601 | |
| 28 | 28 | #include "wildfire.lh" // this is a test layout, external artwork is necessary |
| 29 | 29 | |
| 30 | 30 | // master clock is a single stage RC oscillator: R=?K, C=?pf, |
| 31 | | // S2150 default frequency is 850kHz |
| 31 | // S2000 default frequency is 850kHz |
| 32 | 32 | #define MASTER_CLOCK (850000) |
| 33 | 33 | |
| 34 | 34 | |
| r243600 | r243601 | |
| 38 | 38 | wildfire_state(const machine_config &mconfig, device_type type, const char *tag) |
| 39 | 39 | : driver_device(mconfig, type, tag), |
| 40 | 40 | m_maincpu(*this, "maincpu"), |
| 41 | | m_speaker(*this, "speaker") |
| 41 | m_speaker(*this, "speaker"), |
| 42 | m_a12_decay_timer(*this, "a12_decay") |
| 42 | 43 | { } |
| 43 | 44 | |
| 44 | 45 | required_device<cpu_device> m_maincpu; |
| 45 | 46 | required_device<speaker_sound_device> m_speaker; |
| 47 | required_device<timer_device> m_a12_decay_timer; |
| 46 | 48 | |
| 47 | 49 | UINT8 m_d; |
| 48 | 50 | UINT16 m_a; |
| 51 | UINT8 m_q2; |
| 52 | UINT8 m_q3; |
| 49 | 53 | |
| 50 | 54 | UINT16 m_display_state[0x10]; |
| 51 | 55 | UINT16 m_display_cache[0x10]; |
| r243600 | r243601 | |
| 53 | 57 | |
| 54 | 58 | DECLARE_WRITE8_MEMBER(write_d); |
| 55 | 59 | DECLARE_WRITE16_MEMBER(write_a); |
| 60 | DECLARE_WRITE_LINE_MEMBER(write_f); |
| 56 | 61 | |
| 57 | 62 | TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); |
| 63 | bool index_is_7segled(int index); |
| 58 | 64 | void display_update(); |
| 59 | | bool index_is_7segled(int index); |
| 65 | |
| 66 | TIMER_DEVICE_CALLBACK_MEMBER(reset_q2); |
| 67 | void write_a12(int state); |
| 68 | void sound_update(); |
| 60 | 69 | |
| 61 | 70 | virtual void machine_start(); |
| 62 | 71 | }; |
| r243600 | r243601 | |
| 104 | 113 | for (int i = 0; i < 0x10; i++) |
| 105 | 114 | { |
| 106 | 115 | // update current state |
| 107 | | m_display_state[i] = (~m_a >> i & 1) ? m_d : 0; |
| 116 | m_display_state[i] = (m_a >> i & 1) ? m_d : 0; |
| 108 | 117 | |
| 109 | 118 | active_state[i] = 0; |
| 110 | 119 | |
| r243600 | r243601 | |
| 150 | 159 | |
| 151 | 160 | /*************************************************************************** |
| 152 | 161 | |
| 162 | Sound |
| 163 | |
| 164 | ***************************************************************************/ |
| 165 | |
| 166 | // Sound output is via a speaker between transistors Q2(from A12) and Q3(from F_out) |
| 167 | // A12 to Q2 has a little electronic circuit going, causing a slight delay. |
| 168 | // (see patent US4334679 FIG.5, the 2 resistors are 10K and the cap is a 4.7uF electrolytic) |
| 169 | |
| 170 | // decay time, in steps of 1ms |
| 171 | #define A12_DECAY_TIME 5 /* a complete guess */ |
| 172 | |
| 173 | void wildfire_state::sound_update() |
| 174 | { |
| 175 | m_speaker->level_w(m_q2 & m_q3); |
| 176 | } |
| 177 | |
| 178 | WRITE_LINE_MEMBER(wildfire_state::write_f) |
| 179 | { |
| 180 | // F_out pin: speaker out |
| 181 | m_q3 = (state) ? 1 : 0; |
| 182 | sound_update(); |
| 183 | } |
| 184 | |
| 185 | TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::reset_q2) |
| 186 | { |
| 187 | m_q2 = 0; |
| 188 | sound_update(); |
| 189 | } |
| 190 | |
| 191 | void wildfire_state::write_a12(int state) |
| 192 | { |
| 193 | if (state) |
| 194 | { |
| 195 | m_a12_decay_timer->adjust(attotime::never); |
| 196 | m_q2 = state; |
| 197 | sound_update(); |
| 198 | } |
| 199 | else if (m_a >> 12 & 1) |
| 200 | { |
| 201 | // falling edge |
| 202 | m_a12_decay_timer->adjust(attotime::from_msec(A12_DECAY_TIME)); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | |
| 207 | |
| 208 | /*************************************************************************** |
| 209 | |
| 153 | 210 | I/O |
| 154 | 211 | |
| 155 | 212 | ***************************************************************************/ |
| r243600 | r243601 | |
| 163 | 220 | |
| 164 | 221 | WRITE16_MEMBER(wildfire_state::write_a) |
| 165 | 222 | { |
| 166 | | // A12: enable speaker out |
| 167 | | // this is in combination with the MCU K4-pin, how? |
| 168 | | m_speaker->level_w(data >> 12 & 1); |
| 223 | data ^= 0x1fff; // active-low |
| 224 | |
| 225 | // A12: enable speaker |
| 226 | write_a12(data >> 12 & 1); |
| 169 | 227 | |
| 170 | 228 | // A0-A2: select 7segleds |
| 171 | 229 | // A3-A11: select other leds |
| r243600 | r243601 | |
| 206 | 264 | |
| 207 | 265 | m_d = 0; |
| 208 | 266 | m_a = 0; |
| 267 | m_q2 = 0; |
| 268 | m_q3 = 0; |
| 209 | 269 | |
| 210 | 270 | // register for savestates |
| 211 | 271 | save_item(NAME(m_display_state)); |
| r243600 | r243601 | |
| 214 | 274 | |
| 215 | 275 | save_item(NAME(m_d)); |
| 216 | 276 | save_item(NAME(m_a)); |
| 277 | save_item(NAME(m_q2)); |
| 278 | save_item(NAME(m_q3)); |
| 217 | 279 | } |
| 218 | 280 | |
| 219 | 281 | |
| 220 | 282 | static MACHINE_CONFIG_START( wildfire, wildfire_state ) |
| 221 | 283 | |
| 222 | 284 | /* basic machine hardware */ |
| 223 | | MCFG_CPU_ADD("maincpu", AMI_S2150, MASTER_CLOCK) |
| 285 | MCFG_CPU_ADD("maincpu", AMI_S2152, MASTER_CLOCK) |
| 224 | 286 | MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1")) |
| 225 | 287 | MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d)) |
| 226 | 288 | MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a)) |
| 289 | MCFG_AMI_S2152_FOUT_CB(WRITELINE(wildfire_state, write_f)) |
| 227 | 290 | |
| 228 | 291 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", wildfire_state, display_decay_tick, attotime::from_msec(1)) |
| 292 | MCFG_TIMER_DRIVER_ADD("a12_decay", wildfire_state, reset_q2) |
| 229 | 293 | |
| 230 | 294 | MCFG_DEFAULT_LAYOUT(layout_wildfire) |
| 231 | 295 | |