shelves/new_menus/src/mame/machine/tait8741.c
| r29302 | r29303 | |
| 31 | 31 | #define CMD_08 1 |
| 32 | 32 | #define CMD_4a 2 |
| 33 | 33 | |
| 34 | | struct I8741 { |
| 35 | | UINT8 toData; /* to host data */ |
| 36 | | UINT8 fromData; /* from host data */ |
| 37 | | UINT8 fromCmd; /* from host command */ |
| 38 | | UINT8 status; /* b0 = rd ready,b1 = wd full,b2 = cmd ?? */ |
| 39 | | UINT8 mode; |
| 40 | | UINT8 phase; |
| 41 | | UINT8 txd[8]; |
| 42 | | UINT8 rxd[8]; |
| 43 | | UINT8 parallelselect; |
| 44 | | UINT8 txpoint; |
| 45 | | int connect; |
| 46 | | UINT8 pending4a; |
| 47 | | int serial_out; |
| 48 | | int coins; |
| 49 | | read8_space_func portHandler; |
| 50 | | const char *portName; |
| 51 | | }; |
| 34 | const device_type TAITO8741_4PACK = &device_creator<taito8741_4pack_device>; |
| 52 | 35 | |
| 53 | | static const struct TAITO8741interface *intf; |
| 54 | | //static I8741 *taito8741; |
| 55 | | static I8741 taito8741[MAX_TAITO8741]; |
| 36 | taito8741_4pack_device::taito8741_4pack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 37 | : device_t(mconfig, TAITO8741_4PACK, "Taito 8741 MCU 4 pack", tag, owner, clock, "taito8741_4pack", __FILE__), |
| 38 | m_port_handler_0_r(*this), |
| 39 | m_port_handler_1_r(*this), |
| 40 | m_port_handler_2_r(*this), |
| 41 | m_port_handler_3_r(*this) |
| 42 | { |
| 43 | } |
| 56 | 44 | |
| 57 | 45 | /* for host data , write */ |
| 58 | | static void taito8741_hostdata_w(I8741 *st,int data) |
| 46 | void taito8741_4pack_device::hostdata_w(I8741 *st,int data) |
| 59 | 47 | { |
| 60 | 48 | st->toData = data; |
| 61 | 49 | st->status |= 0x01; |
| 62 | 50 | } |
| 63 | 51 | |
| 64 | 52 | /* from host data , read */ |
| 65 | | static int taito8741_hostdata_r(I8741 *st) |
| 53 | int taito8741_4pack_device::hostdata_r(I8741 *st) |
| 66 | 54 | { |
| 67 | 55 | if( !(st->status & 0x02) ) return -1; |
| 68 | 56 | st->status &= 0xfd; |
| r29302 | r29303 | |
| 70 | 58 | } |
| 71 | 59 | |
| 72 | 60 | /* from host command , read */ |
| 73 | | static int taito8741_hostcmd_r(I8741 *st) |
| 61 | int taito8741_4pack_device::hostcmd_r(I8741 *st) |
| 74 | 62 | { |
| 75 | 63 | if(!(st->status & 0x04)) return -1; |
| 76 | 64 | st->status &= 0xfb; |
| r29302 | r29303 | |
| 80 | 68 | |
| 81 | 69 | /* TAITO8741 I8741 emulation */ |
| 82 | 70 | |
| 83 | | static void taito8741_serial_rx(I8741 *st,UINT8 *data) |
| 71 | void taito8741_4pack_device::serial_rx(I8741 *st,UINT8 *data) |
| 84 | 72 | { |
| 85 | 73 | memcpy(st->rxd,data,8); |
| 86 | 74 | } |
| 87 | 75 | |
| 88 | 76 | /* timer callback of serial tx finish */ |
| 89 | | static TIMER_CALLBACK( taito8741_serial_tx ) |
| 77 | TIMER_CALLBACK_MEMBER( taito8741_4pack_device::serial_tx ) |
| 90 | 78 | { |
| 91 | 79 | int num = param; |
| 92 | | I8741 *st = &taito8741[num]; |
| 80 | I8741 *st = &m_taito8741[num]; |
| 93 | 81 | I8741 *sst; |
| 94 | 82 | |
| 95 | 83 | if( st->mode==TAITO8741_MASTER) |
| r29302 | r29303 | |
| 98 | 86 | st->txpoint = 1; |
| 99 | 87 | if(st->connect >= 0 ) |
| 100 | 88 | { |
| 101 | | sst = &taito8741[st->connect]; |
| 89 | sst = &m_taito8741[st->connect]; |
| 102 | 90 | /* transfer data */ |
| 103 | | taito8741_serial_rx(sst,st->txd); |
| 91 | serial_rx(sst,st->txd); |
| 104 | 92 | LOG(("8741-%d Serial data TX to %d\n",num,st->connect)); |
| 105 | 93 | if( sst->mode==TAITO8741_SLAVE) |
| 106 | 94 | sst->serial_out = 1; |
| 107 | 95 | } |
| 108 | 96 | } |
| 109 | 97 | |
| 110 | | void TAITO8741_reset(int num) |
| 98 | void taito8741_4pack_device::device_reset() |
| 111 | 99 | { |
| 112 | | I8741 *st = &taito8741[num]; |
| 113 | | st->status = 0x00; |
| 114 | | st->phase = 0; |
| 115 | | st->parallelselect = 0; |
| 116 | | st->txpoint = 1; |
| 117 | | st->pending4a = 0; |
| 118 | | st->serial_out = 0; |
| 119 | | st->coins = 0; |
| 120 | | memset(st->rxd,0,8); |
| 121 | | memset(st->txd,0,8); |
| 100 | for (int i=0;i<4;i++) |
| 101 | { |
| 102 | I8741 *st = &m_taito8741[i]; |
| 103 | st->number = i; |
| 104 | st->status = 0x00; |
| 105 | st->phase = 0; |
| 106 | st->parallelselect = 0; |
| 107 | st->txpoint = 1; |
| 108 | st->pending4a = 0; |
| 109 | st->serial_out = 0; |
| 110 | st->coins = 0; |
| 111 | memset(st->rxd,0,8); |
| 112 | memset(st->txd,0,8); |
| 113 | } |
| 122 | 114 | } |
| 123 | 115 | |
| 124 | 116 | /* 8741 update */ |
| 125 | | static void taito8741_update(address_space &space, int num) |
| 117 | void taito8741_4pack_device::update(int num) |
| 126 | 118 | { |
| 127 | 119 | I8741 *st,*sst; |
| 128 | 120 | int next = num; |
| r29302 | r29303 | |
| 130 | 122 | |
| 131 | 123 | do{ |
| 132 | 124 | num = next; |
| 133 | | st = &taito8741[num]; |
| 125 | st = &m_taito8741[num]; |
| 134 | 126 | if( st->connect != -1 ) |
| 135 | | sst = &taito8741[st->connect]; |
| 127 | sst = &m_taito8741[st->connect]; |
| 136 | 128 | else sst = 0; |
| 137 | 129 | next = -1; |
| 138 | 130 | /* check pending command */ |
| r29302 | r29303 | |
| 149 | 141 | case CMD_4a: /* wait for syncronus ? */ |
| 150 | 142 | if(!st->pending4a) |
| 151 | 143 | { |
| 152 | | taito8741_hostdata_w(st,0); |
| 144 | hostdata_w(st,0); |
| 153 | 145 | st->phase = CMD_IDLE; |
| 154 | 146 | next = num; /* continue this chip */ |
| 155 | 147 | } |
| 156 | 148 | break; |
| 157 | 149 | case CMD_IDLE: |
| 158 | 150 | /* ----- data in port check ----- */ |
| 159 | | data = taito8741_hostdata_r(st); |
| 151 | data = hostdata_r(st); |
| 160 | 152 | if( data != -1 ) |
| 161 | 153 | { |
| 162 | 154 | switch(st->mode) |
| r29302 | r29303 | |
| 177 | 169 | else |
| 178 | 170 | { /* port select */ |
| 179 | 171 | st->parallelselect = data & 0x07; |
| 180 | | taito8741_hostdata_w(st,st->portHandler ? st->portHandler(space,st->parallelselect,0xff) : st->portName ? space.machine().root_device().ioport(st->portName)->read() : 0); |
| 172 | hostdata_w(st,port_read(st->number,st->parallelselect)); |
| 181 | 173 | } |
| 182 | 174 | } |
| 183 | 175 | } |
| 184 | 176 | /* ----- new command fetch ----- */ |
| 185 | | data = taito8741_hostcmd_r(st); |
| 177 | data = hostcmd_r(st); |
| 186 | 178 | switch( data ) |
| 187 | 179 | { |
| 188 | 180 | case -1: /* no command data */ |
| 189 | 181 | break; |
| 190 | 182 | case 0x00: /* read from parallel port */ |
| 191 | | taito8741_hostdata_w(st,st->portHandler ? st->portHandler(space,0,0xff) : st->portName ? space.machine().root_device().ioport(st->portName)->read() : 0 ); |
| 183 | hostdata_w(st,port_read(st->number,0)); |
| 192 | 184 | break; |
| 193 | 185 | case 0x01: /* read receive buffer 0 */ |
| 194 | 186 | case 0x02: /* read receive buffer 1 */ |
| r29302 | r29303 | |
| 198 | 190 | case 0x06: /* read receive buffer 5 */ |
| 199 | 191 | case 0x07: /* read receive buffer 6 */ |
| 200 | 192 | //if (data == 2 && num==0 && st->rxd[data-1]&0x80) logerror("Coin Get\n"); |
| 201 | | taito8741_hostdata_w(st,st->rxd[data-1]); |
| 193 | hostdata_w(st,st->rxd[data-1]); |
| 202 | 194 | break; |
| 203 | 195 | case 0x08: /* latch received serial data */ |
| 204 | | st->txd[0] = st->portHandler ? st->portHandler(space,0,0xff) : st->portName ? space.machine().root_device().ioport(st->portName)->read() : 0; |
| 196 | st->txd[0] = port_read(st->number,0); |
| 205 | 197 | if( sst ) |
| 206 | 198 | { |
| 207 | | space.machine().scheduler().synchronize(FUNC(taito8741_serial_tx), num); |
| 199 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(taito8741_4pack_device::serial_tx),this), num); |
| 208 | 200 | st->serial_out = 0; |
| 209 | 201 | st->status |= 0x04; |
| 210 | 202 | st->phase = CMD_08; |
| r29302 | r29303 | |
| 230 | 222 | if(sst->pending4a) |
| 231 | 223 | { |
| 232 | 224 | sst->pending4a = 0; /* syncronus */ |
| 233 | | taito8741_hostdata_w(st,0); /* return for host */ |
| 225 | hostdata_w(st,0); /* return for host */ |
| 234 | 226 | next = st->connect; |
| 235 | 227 | } |
| 236 | 228 | else st->phase = CMD_4a; |
| 237 | 229 | } |
| 238 | 230 | break; |
| 239 | 231 | case 0x80: /* 8741-3 : return check code */ |
| 240 | | taito8741_hostdata_w(st,0x66); |
| 232 | hostdata_w(st,0x66); |
| 241 | 233 | break; |
| 242 | 234 | case 0x81: /* 8741-2 : return check code */ |
| 243 | | taito8741_hostdata_w(st,0x48); |
| 235 | hostdata_w(st,0x48); |
| 244 | 236 | break; |
| 245 | 237 | case 0xf0: /* GSWORD 8741-1 : initialize ?? */ |
| 246 | 238 | break; |
| r29302 | r29303 | |
| 252 | 244 | }while(next>=0); |
| 253 | 245 | } |
| 254 | 246 | |
| 255 | | int TAITO8741_start(const struct TAITO8741interface *taito8741intf) |
| 247 | void taito8741_4pack_device::device_start() |
| 256 | 248 | { |
| 257 | | int i; |
| 258 | | |
| 259 | | intf = taito8741intf; |
| 260 | | |
| 261 | | //taito8741 = (I8741 *)malloc(intf->num*sizeof(I8741)); |
| 262 | | //if( taito8741 == 0 ) return 1; |
| 263 | | |
| 264 | | for(i=0;i<intf->num;i++) |
| 265 | | { |
| 266 | | taito8741[i].connect = intf->serial_connect[i]; |
| 267 | | taito8741[i].portHandler = intf->portHandler_r[i]; |
| 268 | | taito8741[i].portName = intf->portName_r[i]; |
| 269 | | taito8741[i].mode = intf->mode[i]; |
| 270 | | TAITO8741_reset(i); |
| 271 | | } |
| 272 | | return 0; |
| 249 | m_port_handler_0_r.resolve_safe(0); |
| 250 | m_port_handler_1_r.resolve_safe(0); |
| 251 | m_port_handler_2_r.resolve_safe(0); |
| 252 | m_port_handler_3_r.resolve_safe(0); |
| 273 | 253 | } |
| 274 | 254 | |
| 275 | 255 | /* read status port */ |
| 276 | | static int I8741_status_r(address_space &space, int num) |
| 256 | int taito8741_4pack_device::status_r(int num) |
| 277 | 257 | { |
| 278 | | I8741 *st = &taito8741[num]; |
| 279 | | taito8741_update(space, num); |
| 280 | | LOG(("%s:8741-%d ST Read %02x\n",space.machine().describe_context(),num,st->status)); |
| 258 | I8741 *st = &m_taito8741[num]; |
| 259 | update(num); |
| 260 | LOG(("%s:8741-%d ST Read %02x\n",machine().describe_context(),num,st->status)); |
| 281 | 261 | return st->status; |
| 282 | 262 | } |
| 283 | 263 | |
| 284 | 264 | /* read data port */ |
| 285 | | static int I8741_data_r(address_space &space, int num) |
| 265 | int taito8741_4pack_device::data_r(int num) |
| 286 | 266 | { |
| 287 | | I8741 *st = &taito8741[num]; |
| 267 | I8741 *st = &m_taito8741[num]; |
| 288 | 268 | int ret = st->toData; |
| 289 | 269 | st->status &= 0xfe; |
| 290 | | LOG(("%s:8741-%d DATA Read %02x\n",space.machine().describe_context(),num,ret)); |
| 270 | LOG(("%s:8741-%d DATA Read %02x\n",machine().describe_context(),num,ret)); |
| 291 | 271 | |
| 292 | 272 | /* update chip */ |
| 293 | | taito8741_update(space, num); |
| 273 | update(num); |
| 294 | 274 | |
| 295 | 275 | switch( st->mode ) |
| 296 | 276 | { |
| 297 | 277 | case TAITO8741_PORT: /* parallel data */ |
| 298 | | taito8741_hostdata_w(st,st->portHandler ? st->portHandler(space, st->parallelselect, 0xff) : st->portName ? space.machine().root_device().ioport(st->portName)->read() : 0); |
| 278 | hostdata_w(st,port_read(st->number,st->parallelselect)); |
| 299 | 279 | break; |
| 300 | 280 | } |
| 301 | 281 | return ret; |
| 302 | 282 | } |
| 303 | 283 | |
| 304 | 284 | /* Write data port */ |
| 305 | | static void I8741_data_w(address_space &space, int num, int data) |
| 285 | void taito8741_4pack_device::data_w(int num, int data) |
| 306 | 286 | { |
| 307 | | I8741 *st = &taito8741[num]; |
| 308 | | LOG(("%s:8741-%d DATA Write %02x\n",space.machine().describe_context(),num,data)); |
| 287 | I8741 *st = &m_taito8741[num]; |
| 288 | LOG(("%s:8741-%d DATA Write %02x\n",machine().describe_context(),num,data)); |
| 309 | 289 | st->fromData = data; |
| 310 | 290 | st->status |= 0x02; |
| 311 | 291 | /* update chip */ |
| 312 | | taito8741_update(space, num); |
| 292 | update(num); |
| 313 | 293 | } |
| 314 | 294 | |
| 315 | 295 | /* Write command port */ |
| 316 | | static void I8741_command_w(address_space &space, int num, int data) |
| 296 | void taito8741_4pack_device::command_w(int num, int data) |
| 317 | 297 | { |
| 318 | | I8741 *st = &taito8741[num]; |
| 319 | | LOG(("%s:8741-%d CMD Write %02x\n",space.machine().describe_context(),num,data)); |
| 298 | I8741 *st = &m_taito8741[num]; |
| 299 | LOG(("%s:8741-%d CMD Write %02x\n",machine().describe_context(),num,data)); |
| 320 | 300 | st->fromCmd = data; |
| 321 | 301 | st->status |= 0x04; |
| 322 | 302 | /* update chip */ |
| 323 | | taito8741_update(space,num); |
| 303 | update(num); |
| 324 | 304 | } |
| 325 | 305 | |
| 326 | | /* Write port handler */ |
| 327 | | WRITE8_HANDLER( TAITO8741_0_w ) |
| 306 | UINT8 taito8741_4pack_device::port_read(int num, int offset) |
| 328 | 307 | { |
| 329 | | if(offset&1) I8741_command_w(space,0,data); |
| 330 | | else I8741_data_w(space,0,data); |
| 308 | switch(num) |
| 309 | { |
| 310 | case 0 : return m_port_handler_0_r(offset); |
| 311 | case 1 : return m_port_handler_1_r(offset); |
| 312 | case 2 : return m_port_handler_2_r(offset); |
| 313 | case 3 : return m_port_handler_3_r(offset); |
| 314 | default : return 0; |
| 315 | } |
| 331 | 316 | } |
| 332 | | WRITE8_HANDLER( TAITO8741_1_w ) |
| 333 | | { |
| 334 | | if(offset&1) I8741_command_w(space,1,data); |
| 335 | | else I8741_data_w(space,1,data); |
| 336 | | } |
| 337 | | WRITE8_HANDLER( TAITO8741_2_w ) |
| 338 | | { |
| 339 | | if(offset&1) I8741_command_w(space,2,data); |
| 340 | | else I8741_data_w(space,2,data); |
| 341 | | } |
| 342 | | WRITE8_HANDLER( TAITO8741_3_w ) |
| 343 | | { |
| 344 | | if(offset&1) I8741_command_w(space,3,data); |
| 345 | | else I8741_data_w(space,3,data); |
| 346 | | } |
| 347 | 317 | |
| 348 | | /* Read port handler */ |
| 349 | | READ8_HANDLER( TAITO8741_0_r ) |
| 350 | | { |
| 351 | | if(offset&1) return I8741_status_r(space,0); |
| 352 | | return I8741_data_r(space,0); |
| 353 | | } |
| 354 | | READ8_HANDLER( TAITO8741_1_r ) |
| 355 | | { |
| 356 | | if(offset&1) return I8741_status_r(space,1); |
| 357 | | return I8741_data_r(space,1); |
| 358 | | } |
| 359 | | READ8_HANDLER( TAITO8741_2_r ) |
| 360 | | { |
| 361 | | if(offset&1) return I8741_status_r(space,2); |
| 362 | | return I8741_data_r(space,2); |
| 363 | | } |
| 364 | | READ8_HANDLER( TAITO8741_3_r ) |
| 365 | | { |
| 366 | | if(offset&1) return I8741_status_r(space,3); |
| 367 | | return I8741_data_r(space,3); |
| 368 | | } |
| 369 | 318 | /**************************************************************************** |
| 370 | 319 | |
| 371 | 320 | joshi Vollyball set. |
| r29302 | r29303 | |
| 378 | 327 | |
| 379 | 328 | ****************************************************************************/ |
| 380 | 329 | |
| 381 | | static int josvolly_nmi_enable; |
| 330 | const device_type JOSVOLLY8741_4PACK = &device_creator<josvolly8741_4pack_device>; |
| 382 | 331 | |
| 383 | | struct JV8741 { |
| 384 | | UINT8 cmd; |
| 385 | | UINT8 sts; |
| 386 | | UINT8 txd; |
| 387 | | UINT8 outport; |
| 388 | | UINT8 rxd; |
| 389 | | UINT8 connect; |
| 332 | josvolly8741_4pack_device::josvolly8741_4pack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 333 | : device_t(mconfig, JOSVOLLY8741_4PACK, "joshi Vollyball 8741 MCU 4 pack", tag, owner, clock, "josvolly8741_4pack", __FILE__), |
| 334 | m_port_handler_0_r(*this), |
| 335 | m_port_handler_1_r(*this), |
| 336 | m_port_handler_2_r(*this), |
| 337 | m_port_handler_3_r(*this) |
| 338 | { |
| 339 | } |
| 390 | 340 | |
| 391 | | UINT8 rst; |
| 341 | void josvolly8741_4pack_device::device_start() |
| 342 | { |
| 343 | m_port_handler_0_r.resolve_safe(0); |
| 344 | m_port_handler_1_r.resolve_safe(0); |
| 345 | m_port_handler_2_r.resolve_safe(0); |
| 346 | m_port_handler_3_r.resolve_safe(0); |
| 347 | } |
| 392 | 348 | |
| 393 | | const char *initReadPort; |
| 394 | | }; |
| 395 | 349 | |
| 396 | | static JV8741 i8741[4]; |
| 397 | | |
| 398 | | void josvolly_8741_reset(void) |
| 350 | void josvolly8741_4pack_device::device_reset() |
| 399 | 351 | { |
| 400 | | int i; |
| 352 | m_nmi_enable = 0; |
| 401 | 353 | |
| 402 | | josvolly_nmi_enable = 0; |
| 403 | | |
| 404 | | for(i=0;i<4;i++) |
| 354 | for(int i=0;i<4;i++) |
| 405 | 355 | { |
| 406 | | i8741[i].cmd = 0; |
| 407 | | i8741[i].sts = 0; // 0xf0; /* init flag */ |
| 408 | | i8741[i].txd = 0; |
| 409 | | i8741[i].outport = 0xff; |
| 410 | | i8741[i].rxd = 0; |
| 356 | m_i8741[i].cmd = 0; |
| 357 | m_i8741[i].sts = 0; // 0xf0; /* init flag */ |
| 358 | m_i8741[i].txd = 0; |
| 359 | m_i8741[i].outport = 0xff; |
| 360 | m_i8741[i].rxd = 0; |
| 411 | 361 | |
| 412 | | i8741[i].rst = 1; |
| 413 | | |
| 362 | m_i8741[i].rst = 1; |
| 414 | 363 | } |
| 415 | | i8741[0].connect = 1; |
| 416 | | i8741[1].connect = 0; |
| 417 | | |
| 418 | | i8741[0].initReadPort = "DSW1"; /* DSW1 */ |
| 419 | | i8741[1].initReadPort = "DSW2"; /* DSW2 */ |
| 420 | | i8741[2].initReadPort = "DSW1"; /* DUMMY */ |
| 421 | | i8741[3].initReadPort = "DSW2"; /* DUMMY */ |
| 422 | | |
| 423 | 364 | } |
| 424 | 365 | |
| 425 | 366 | /* transmit data finish callback */ |
| 426 | | static TIMER_CALLBACK( josvolly_8741_tx ) |
| 367 | TIMER_CALLBACK_MEMBER( josvolly8741_4pack_device::tx ) |
| 427 | 368 | { |
| 428 | 369 | int num = param; |
| 429 | | JV8741 *src = &i8741[num]; |
| 430 | | JV8741 *dst = &i8741[src->connect]; |
| 370 | JV8741 *src = &m_i8741[num]; |
| 371 | JV8741 *dst = &m_i8741[src->connect]; |
| 431 | 372 | |
| 432 | 373 | dst->rxd = src->txd; |
| 433 | 374 | |
| r29302 | r29303 | |
| 435 | 376 | dst->sts |= 0x01; /* RX ready ? */ |
| 436 | 377 | } |
| 437 | 378 | |
| 438 | | static void josvolly_8741_do(running_machine &machine, int num) |
| 379 | void josvolly8741_4pack_device::update(int num) |
| 439 | 380 | { |
| 440 | | if( (i8741[num].sts & 0x02) ) |
| 381 | if( (m_i8741[num].sts & 0x02) ) |
| 441 | 382 | { |
| 442 | 383 | /* transmit data */ |
| 443 | | machine.scheduler().timer_set (attotime::from_usec(1), FUNC(josvolly_8741_tx), num); |
| 384 | machine().scheduler().timer_set (attotime::from_usec(1), timer_expired_delegate(FUNC(josvolly8741_4pack_device::tx),this), num); |
| 444 | 385 | } |
| 445 | 386 | } |
| 446 | 387 | |
| 447 | | static void josvolly_8741_w(address_space &space, int num, int offset, int data) |
| 388 | void josvolly8741_4pack_device::write(int num, int offset, int data) |
| 448 | 389 | { |
| 449 | | JV8741 *mcu = &i8741[num]; |
| 390 | JV8741 *mcu = &m_i8741[num]; |
| 450 | 391 | |
| 451 | 392 | if(offset==1) |
| 452 | 393 | { |
| 453 | | LOG(("%s:8741[%d] CW %02X\n", space.machine().describe_context(), num, data)); |
| 394 | LOG(("%s:8741[%d] CW %02X\n", machine().describe_context(), num, data)); |
| 454 | 395 | |
| 455 | 396 | /* read pointer */ |
| 456 | 397 | mcu->cmd = data; |
| r29302 | r29303 | |
| 472 | 413 | break; |
| 473 | 414 | case 2: |
| 474 | 415 | #if 1 |
| 475 | | mcu->rxd = space.machine().root_device().ioport("DSW2")->read(); |
| 416 | mcu->rxd = port_read(1); |
| 476 | 417 | mcu->sts |= 0x01; /* RD ready */ |
| 477 | 418 | #endif |
| 478 | 419 | break; |
| r29302 | r29303 | |
| 488 | 429 | else |
| 489 | 430 | { |
| 490 | 431 | /* data */ |
| 491 | | LOG(("%s:8741[%d] DW %02X\n", space.machine().describe_context(), num, data)); |
| 432 | LOG(("%s:8741[%d] DW %02X\n", machine().describe_context(), num, data)); |
| 492 | 433 | |
| 493 | 434 | mcu->txd = data ^ 0x40; /* parity reverce ? */ |
| 494 | 435 | mcu->sts |= 0x02; /* TXD busy */ |
| r29302 | r29303 | |
| 496 | 437 | /* interrupt ? */ |
| 497 | 438 | if(num == 0) |
| 498 | 439 | { |
| 499 | | if(josvolly_nmi_enable) |
| 440 | if(m_nmi_enable) |
| 500 | 441 | { |
| 501 | | space.machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 502 | | josvolly_nmi_enable = 0; |
| 442 | machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 443 | m_nmi_enable = 0; |
| 503 | 444 | } |
| 504 | 445 | } |
| 505 | 446 | #endif |
| 506 | 447 | } |
| 507 | | josvolly_8741_do(space.machine(), num); |
| 448 | update(num); |
| 508 | 449 | } |
| 509 | 450 | |
| 510 | | static INT8 josvolly_8741_r(address_space &space,int num,int offset) |
| 451 | UINT8 josvolly8741_4pack_device::read(int num,int offset) |
| 511 | 452 | { |
| 512 | | JV8741 *mcu = &i8741[num]; |
| 453 | JV8741 *mcu = &m_i8741[num]; |
| 513 | 454 | int ret; |
| 514 | 455 | |
| 515 | 456 | if(offset==1) |
| 516 | 457 | { |
| 517 | 458 | if(mcu->rst) |
| 518 | | mcu->rxd = space.machine().root_device().ioport(mcu->initReadPort)->read(); /* port in */ |
| 459 | mcu->rxd = port_read(num); /* port in */ |
| 519 | 460 | ret = mcu->sts; |
| 520 | | LOG(("%s:8741[%d] SR %02X\n",space.machine().describe_context(),num,ret)); |
| 461 | LOG(("%s:8741[%d] SR %02X\n",machine().describe_context(),num,ret)); |
| 521 | 462 | } |
| 522 | 463 | else |
| 523 | 464 | { |
| 524 | 465 | /* clear status port */ |
| 525 | 466 | mcu->sts &= ~0x01; /* RD ready */ |
| 526 | 467 | ret = mcu->rxd; |
| 527 | | LOG(("%s:8741[%d] DR %02X\n",space.machine().describe_context(),num,ret)); |
| 468 | LOG(("%s:8741[%d] DR %02X\n",machine().describe_context(),num,ret)); |
| 528 | 469 | mcu->rst = 0; |
| 529 | 470 | } |
| 530 | 471 | return ret; |
| 531 | 472 | } |
| 532 | 473 | |
| 533 | | WRITE8_HANDLER( josvolly_8741_0_w ){ josvolly_8741_w(space,0,offset,data); } |
| 534 | | READ8_HANDLER( josvolly_8741_0_r ) { return josvolly_8741_r(space,0,offset); } |
| 535 | | WRITE8_HANDLER( josvolly_8741_1_w ) { josvolly_8741_w(space,1,offset,data); } |
| 536 | | READ8_HANDLER( josvolly_8741_1_r ) { return josvolly_8741_r(space,1,offset); } |
| 537 | | |
| 538 | | WRITE8_HANDLER( josvolly_nmi_enable_w ) |
| 474 | UINT8 josvolly8741_4pack_device::port_read(int num) |
| 539 | 475 | { |
| 540 | | josvolly_nmi_enable = 1; |
| 476 | switch(num) |
| 477 | { |
| 478 | case 0 : return m_port_handler_0_r(0); |
| 479 | case 1 : return m_port_handler_1_r(0); |
| 480 | case 2 : return m_port_handler_2_r(0); |
| 481 | case 3 : return m_port_handler_3_r(0); |
| 482 | default : return 0; |
| 483 | } |
| 541 | 484 | } |
| 485 | |
shelves/new_menus/src/mame/machine/tait8741.h
| r29302 | r29303 | |
| 6 | 6 | gladiatr and Great Swordsman set. |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | | #define MAX_TAITO8741 4 |
| 10 | | |
| 11 | 9 | /* NEC 8741 program mode */ |
| 12 | 10 | #define TAITO8741_MASTER 0 |
| 13 | 11 | #define TAITO8741_SLAVE 1 |
| 14 | 12 | #define TAITO8741_PORT 2 |
| 15 | 13 | |
| 16 | | struct TAITO8741interface |
| 14 | #define MCFG_TAITO8741_ADD(_tag) \ |
| 15 | MCFG_DEVICE_ADD(_tag, TAITO8741_4PACK, 0) |
| 16 | |
| 17 | #define MCFG_TAITO8741_PORT_HANDLERS(_devcb0, _devcb1, _devcb2, _devcb3) \ |
| 18 | devcb = &taito8741_4pack_device::set_port_handler_0_callback(*device, DEVCB2_##_devcb0); \ |
| 19 | devcb = &taito8741_4pack_device::set_port_handler_1_callback(*device, DEVCB2_##_devcb1); \ |
| 20 | devcb = &taito8741_4pack_device::set_port_handler_2_callback(*device, DEVCB2_##_devcb2); \ |
| 21 | devcb = &taito8741_4pack_device::set_port_handler_3_callback(*device, DEVCB2_##_devcb3); |
| 22 | |
| 23 | #define MCFG_TAITO8741_MODES(_mode0, _mode1, _mode2, _mode3) \ |
| 24 | taito8741_4pack_device::static_set_mode(*device, 0, _mode0); \ |
| 25 | taito8741_4pack_device::static_set_mode(*device, 1, _mode1); \ |
| 26 | taito8741_4pack_device::static_set_mode(*device, 2, _mode2); \ |
| 27 | taito8741_4pack_device::static_set_mode(*device, 3, _mode3); |
| 28 | |
| 29 | |
| 30 | #define MCFG_TAITO8741_CONNECT(_con0, _con1, _con2, _con3) \ |
| 31 | taito8741_4pack_device::static_set_connect(*device, 0, _con0); \ |
| 32 | taito8741_4pack_device::static_set_connect(*device, 1, _con1); \ |
| 33 | taito8741_4pack_device::static_set_connect(*device, 2, _con2); \ |
| 34 | taito8741_4pack_device::static_set_connect(*device, 3, _con3); |
| 35 | |
| 36 | |
| 37 | class taito8741_4pack_device : public device_t |
| 17 | 38 | { |
| 18 | | int num; |
| 19 | | int mode[MAX_TAITO8741]; /* program select */ |
| 20 | | int serial_connect[MAX_TAITO8741]; /* serial port connection */ |
| 21 | | read8_space_func portHandler_r[MAX_TAITO8741]; /* parallel port handler */ |
| 22 | | const char *portName_r[MAX_TAITO8741]; |
| 39 | struct I8741 { |
| 40 | int number; |
| 41 | UINT8 toData; /* to host data */ |
| 42 | UINT8 fromData; /* from host data */ |
| 43 | UINT8 fromCmd; /* from host command */ |
| 44 | UINT8 status; /* b0 = rd ready,b1 = wd full,b2 = cmd ?? */ |
| 45 | UINT8 mode; |
| 46 | UINT8 phase; |
| 47 | UINT8 txd[8]; |
| 48 | UINT8 rxd[8]; |
| 49 | UINT8 parallelselect; |
| 50 | UINT8 txpoint; |
| 51 | int connect; |
| 52 | UINT8 pending4a; |
| 53 | int serial_out; |
| 54 | int coins; |
| 55 | }; |
| 56 | |
| 57 | public: |
| 58 | taito8741_4pack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 59 | ~taito8741_4pack_device() {} |
| 60 | |
| 61 | template<class _Object> static devcb2_base &set_port_handler_0_callback(device_t &device, _Object object) { return downcast<taito8741_4pack_device &>(device).m_port_handler_0_r.set_callback(object); } |
| 62 | template<class _Object> static devcb2_base &set_port_handler_1_callback(device_t &device, _Object object) { return downcast<taito8741_4pack_device &>(device).m_port_handler_1_r.set_callback(object); } |
| 63 | template<class _Object> static devcb2_base &set_port_handler_2_callback(device_t &device, _Object object) { return downcast<taito8741_4pack_device &>(device).m_port_handler_2_r.set_callback(object); } |
| 64 | template<class _Object> static devcb2_base &set_port_handler_3_callback(device_t &device, _Object object) { return downcast<taito8741_4pack_device &>(device).m_port_handler_3_r.set_callback(object); } |
| 65 | |
| 66 | static void static_set_mode(device_t &device, int num, UINT8 mode) { downcast<taito8741_4pack_device &>(device).m_taito8741[num].mode = mode; } |
| 67 | static void static_set_connect(device_t &device, int num, int conn) { downcast<taito8741_4pack_device &>(device).m_taito8741[num].connect = conn; } |
| 68 | |
| 69 | DECLARE_READ8_MEMBER( read_0 ) { if(offset&1) return status_r(0); else return data_r(0); } |
| 70 | DECLARE_WRITE8_MEMBER( write_0 ) { if(offset&1) command_w(0,data); else data_w(0,data); } |
| 71 | DECLARE_READ8_MEMBER( read_1 ) { if(offset&1) return status_r(1); else return data_r(1); } |
| 72 | DECLARE_WRITE8_MEMBER( write_1 ) { if(offset&1) command_w(1,data); else data_w(1,data); } |
| 73 | DECLARE_READ8_MEMBER( read_2 ) { if(offset&1) return status_r(2); else return data_r(2); } |
| 74 | DECLARE_WRITE8_MEMBER( write_2 ) { if(offset&1) command_w(2,data); else data_w(2,data); } |
| 75 | DECLARE_READ8_MEMBER( read_3 ) { if(offset&1) return status_r(3); else return data_r(3); } |
| 76 | DECLARE_WRITE8_MEMBER( write_3 ) { if(offset&1) command_w(3,data); else data_w(3,data); } |
| 77 | |
| 78 | TIMER_CALLBACK_MEMBER( serial_tx ); |
| 79 | void update(int num); |
| 80 | int status_r(int num); |
| 81 | int data_r(int num); |
| 82 | void data_w(int num, int data); |
| 83 | void command_w(int num, int data); |
| 84 | |
| 85 | UINT8 port_read(int num, int offset); |
| 86 | |
| 87 | protected: |
| 88 | // device-level overrides |
| 89 | virtual void device_start(); |
| 90 | virtual void device_reset(); |
| 91 | |
| 92 | private: |
| 93 | void hostdata_w(I8741 *st,int data); |
| 94 | int hostdata_r(I8741 *st); |
| 95 | int hostcmd_r(I8741 *st); |
| 96 | void serial_rx(I8741 *st,UINT8 *data); |
| 97 | |
| 98 | // internal state |
| 99 | I8741 m_taito8741[4]; |
| 100 | |
| 101 | devcb2_read8 m_port_handler_0_r; |
| 102 | devcb2_read8 m_port_handler_1_r; |
| 103 | devcb2_read8 m_port_handler_2_r; |
| 104 | devcb2_read8 m_port_handler_3_r; |
| 23 | 105 | }; |
| 24 | 106 | |
| 25 | | int TAITO8741_start(const struct TAITO8741interface *taito8741intf); |
| 26 | 107 | |
| 27 | | void TAITO8741_reset(int num); |
| 108 | extern const device_type TAITO8741_4PACK; |
| 28 | 109 | |
| 29 | | /* write handler */ |
| 30 | | DECLARE_WRITE8_HANDLER( TAITO8741_0_w ); |
| 31 | | DECLARE_WRITE8_HANDLER( TAITO8741_1_w ); |
| 32 | | DECLARE_WRITE8_HANDLER( TAITO8741_2_w ); |
| 33 | | DECLARE_WRITE8_HANDLER( TAITO8741_3_w ); |
| 34 | | /* read handler */ |
| 35 | | DECLARE_READ8_HANDLER( TAITO8741_0_r ); |
| 36 | | DECLARE_READ8_HANDLER( TAITO8741_1_r ); |
| 37 | | DECLARE_READ8_HANDLER( TAITO8741_2_r ); |
| 38 | | DECLARE_READ8_HANDLER( TAITO8741_3_r ); |
| 39 | 110 | |
| 40 | 111 | /**************************************************************************** |
| 41 | 112 | joshi Volleyball set. |
| 42 | 113 | ****************************************************************************/ |
| 43 | 114 | |
| 44 | | void josvolly_8741_reset(void); |
| 45 | | DECLARE_WRITE8_HANDLER( josvolly_8741_0_w ); |
| 46 | | DECLARE_WRITE8_HANDLER( josvolly_8741_1_w ); |
| 47 | | DECLARE_READ8_HANDLER( josvolly_8741_0_r ); |
| 48 | | DECLARE_READ8_HANDLER( josvolly_8741_1_r ); |
| 49 | | DECLARE_WRITE8_HANDLER( josvolly_nmi_enable_w ); |
| 115 | #define MCFG_JOSVOLLY8741_ADD(_tag) \ |
| 116 | MCFG_DEVICE_ADD(_tag, JOSVOLLY8741_4PACK, 0) |
| 50 | 117 | |
| 118 | #define MCFG_JOSVOLLY8741_PORT_HANDLERS(_devcb0, _devcb1, _devcb2, _devcb3) \ |
| 119 | devcb = &josvolly8741_4pack_device::set_port_handler_0_callback(*device, DEVCB2_##_devcb0); \ |
| 120 | devcb = &josvolly8741_4pack_device::set_port_handler_1_callback(*device, DEVCB2_##_devcb1); \ |
| 121 | devcb = &josvolly8741_4pack_device::set_port_handler_2_callback(*device, DEVCB2_##_devcb2); \ |
| 122 | devcb = &josvolly8741_4pack_device::set_port_handler_3_callback(*device, DEVCB2_##_devcb3); |
| 123 | |
| 124 | #define MCFG_JOSVOLLY8741_CONNECT(_con0, _con1, _con2, _con3) \ |
| 125 | josvolly8741_4pack_device::static_set_connect(*device, 0, _con0); \ |
| 126 | josvolly8741_4pack_device::static_set_connect(*device, 1, _con1); \ |
| 127 | josvolly8741_4pack_device::static_set_connect(*device, 2, _con2); \ |
| 128 | josvolly8741_4pack_device::static_set_connect(*device, 3, _con3); |
| 129 | |
| 130 | |
| 131 | class josvolly8741_4pack_device : public device_t |
| 132 | { |
| 133 | struct JV8741 { |
| 134 | UINT8 cmd; |
| 135 | UINT8 sts; |
| 136 | UINT8 txd; |
| 137 | UINT8 outport; |
| 138 | UINT8 rxd; |
| 139 | UINT8 connect; |
| 140 | UINT8 rst; |
| 141 | }; |
| 142 | |
| 143 | public: |
| 144 | josvolly8741_4pack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 145 | ~josvolly8741_4pack_device() {} |
| 146 | |
| 147 | template<class _Object> static devcb2_base &set_port_handler_0_callback(device_t &device, _Object object) { return downcast<josvolly8741_4pack_device &>(device).m_port_handler_0_r.set_callback(object); } |
| 148 | template<class _Object> static devcb2_base &set_port_handler_1_callback(device_t &device, _Object object) { return downcast<josvolly8741_4pack_device &>(device).m_port_handler_1_r.set_callback(object); } |
| 149 | template<class _Object> static devcb2_base &set_port_handler_2_callback(device_t &device, _Object object) { return downcast<josvolly8741_4pack_device &>(device).m_port_handler_2_r.set_callback(object); } |
| 150 | template<class _Object> static devcb2_base &set_port_handler_3_callback(device_t &device, _Object object) { return downcast<josvolly8741_4pack_device &>(device).m_port_handler_3_r.set_callback(object); } |
| 151 | |
| 152 | static void static_set_connect(device_t &device, int num, int conn) { downcast<josvolly8741_4pack_device &>(device).m_i8741[num].connect = conn; } |
| 153 | |
| 154 | DECLARE_READ8_MEMBER( read_0 ) { return read(0,offset); } |
| 155 | DECLARE_WRITE8_MEMBER( write_0 ) { write(0,offset,data); } |
| 156 | DECLARE_READ8_MEMBER( read_1 ) { return read(1,offset); } |
| 157 | DECLARE_WRITE8_MEMBER( write_1 ) { write(1,offset,data); } |
| 158 | |
| 159 | DECLARE_WRITE8_HANDLER( nmi_enable_w ) { m_nmi_enable = 1; } |
| 160 | |
| 161 | TIMER_CALLBACK_MEMBER( tx ); |
| 162 | protected: |
| 163 | // device-level overrides |
| 164 | virtual void device_start(); |
| 165 | virtual void device_reset(); |
| 166 | |
| 167 | private: |
| 168 | void update(int num); |
| 169 | void write(int num, int offset, int data); |
| 170 | UINT8 read(int num,int offset); |
| 171 | UINT8 port_read(int num); |
| 172 | |
| 173 | // internal state |
| 174 | JV8741 m_i8741[4]; |
| 175 | int m_nmi_enable; |
| 176 | |
| 177 | devcb2_read8 m_port_handler_0_r; |
| 178 | devcb2_read8 m_port_handler_1_r; |
| 179 | devcb2_read8 m_port_handler_2_r; |
| 180 | devcb2_read8 m_port_handler_3_r; |
| 181 | }; |
| 182 | |
| 183 | |
| 184 | extern const device_type JOSVOLLY8741_4PACK; |
| 185 | |
| 186 | |
| 51 | 187 | #endif |
shelves/new_menus/src/mame/video/kopunch.c
| r29302 | r29303 | |
| 1 | /************************************************************************* |
| 2 | |
| 3 | Sega KO Punch |
| 4 | |
| 5 | Functions to emulate the video hardware of the machine. |
| 6 | |
| 7 | *************************************************************************/ |
| 8 | |
| 1 | 9 | #include "emu.h" |
| 2 | 10 | #include "includes/kopunch.h" |
| 3 | 11 | |
| r29302 | r29303 | |
| 5 | 13 | PALETTE_INIT_MEMBER(kopunch_state, kopunch) |
| 6 | 14 | { |
| 7 | 15 | const UINT8 *color_prom = memregion("proms")->base(); |
| 8 | | int i; |
| 9 | 16 | |
| 10 | | color_prom += 24; /* first 24 colors are black */ |
| 11 | | for (i = 0; i < palette.entries(); i++) |
| 17 | color_prom += 24; // first 24 colors are black |
| 18 | |
| 19 | for (int i = 0; i < palette.entries(); i++) |
| 12 | 20 | { |
| 13 | 21 | int bit0, bit1, bit2, r, g, b; |
| 14 | 22 | |
| r29302 | r29303 | |
| 33 | 41 | } |
| 34 | 42 | } |
| 35 | 43 | |
| 36 | | WRITE8_MEMBER(kopunch_state::kopunch_videoram_w) |
| 44 | WRITE8_MEMBER(kopunch_state::kopunch_fg_w) |
| 37 | 45 | { |
| 38 | | m_videoram[offset] = data; |
| 46 | m_vram_fg[offset] = data; |
| 39 | 47 | m_fg_tilemap->mark_tile_dirty(offset); |
| 40 | 48 | } |
| 41 | 49 | |
| 42 | | WRITE8_MEMBER(kopunch_state::kopunch_videoram2_w) |
| 50 | WRITE8_MEMBER(kopunch_state::kopunch_bg_w) |
| 43 | 51 | { |
| 44 | | m_videoram2[offset] = data; |
| 52 | m_vram_bg[offset] = data; |
| 45 | 53 | m_bg_tilemap->mark_tile_dirty(offset); |
| 46 | 54 | } |
| 47 | 55 | |
| 48 | 56 | WRITE8_MEMBER(kopunch_state::kopunch_scroll_x_w) |
| 49 | 57 | { |
| 58 | m_scrollx = data; |
| 50 | 59 | m_bg_tilemap->set_scrollx(0, data); |
| 51 | 60 | } |
| 52 | 61 | |
| r29302 | r29303 | |
| 57 | 66 | |
| 58 | 67 | WRITE8_MEMBER(kopunch_state::kopunch_gfxbank_w) |
| 59 | 68 | { |
| 69 | // d0-d2: bg gfx bank |
| 60 | 70 | if (m_gfxbank != (data & 0x07)) |
| 61 | 71 | { |
| 62 | 72 | m_gfxbank = data & 0x07; |
| 63 | 73 | m_bg_tilemap->mark_all_dirty(); |
| 64 | 74 | } |
| 65 | 75 | |
| 76 | // d3: flip y, other bits: unused |
| 66 | 77 | m_bg_tilemap->set_flip((data & 0x08) ? TILEMAP_FLIPY : 0); |
| 67 | 78 | } |
| 68 | 79 | |
| 69 | 80 | TILE_GET_INFO_MEMBER(kopunch_state::get_fg_tile_info) |
| 70 | 81 | { |
| 71 | | int code = m_videoram[tile_index]; |
| 82 | int code = m_vram_fg[tile_index]; |
| 72 | 83 | |
| 73 | 84 | SET_TILE_INFO_MEMBER(0, code, 0, 0); |
| 74 | 85 | } |
| 75 | 86 | |
| 76 | 87 | TILE_GET_INFO_MEMBER(kopunch_state::get_bg_tile_info) |
| 77 | 88 | { |
| 78 | | int code = (m_videoram2[tile_index] & 0x7f) + 128 * m_gfxbank; |
| 89 | // note: highest bit is unused |
| 90 | int code = (m_vram_bg[tile_index] & 0x7f) | m_gfxbank << 7; |
| 79 | 91 | |
| 80 | 92 | SET_TILE_INFO_MEMBER(1, code, 0, 0); |
| 81 | 93 | } |
| r29302 | r29303 | |
| 86 | 98 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(kopunch_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); |
| 87 | 99 | |
| 88 | 100 | m_fg_tilemap->set_transparent_pen(0); |
| 89 | | |
| 90 | | m_bg_tilemap->set_scrolldx(16, 16); |
| 91 | 101 | } |
| 92 | 102 | |
| 93 | 103 | UINT32 kopunch_state::screen_update_kopunch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 94 | 104 | { |
| 95 | | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 105 | bitmap.fill(0, cliprect); |
| 106 | |
| 107 | // background does not wrap around horizontally |
| 108 | rectangle bg_clip = cliprect; |
| 109 | bg_clip.max_x = m_scrollx ^ 0xff; |
| 110 | |
| 111 | m_bg_tilemap->draw(screen, bitmap, bg_clip, 0, 0); |
| 96 | 112 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 97 | 113 | |
| 98 | 114 | return 0; |
shelves/new_menus/src/mame/drivers/gladiatr.c
| r29302 | r29303 | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | |
| 203 | | static READ8_HANDLER( gladiator_dsw1_r ) |
| 203 | READ8_MEMBER(gladiatr_state::gladiator_dsw1_r ) |
| 204 | 204 | { |
| 205 | | int orig = space.machine().root_device().ioport("DSW1")->read()^0xff; |
| 205 | int orig = ioport("DSW1")->read()^0xff; |
| 206 | 206 | |
| 207 | 207 | return BITSWAP8(orig, 0,1,2,3,4,5,6,7); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | | static READ8_HANDLER( gladiator_dsw2_r ) |
| 210 | READ8_MEMBER(gladiatr_state::gladiator_dsw2_r ) |
| 211 | 211 | { |
| 212 | | int orig = space.machine().root_device().ioport("DSW2")->read()^0xff; |
| 212 | int orig = ioport("DSW2")->read()^0xff; |
| 213 | 213 | |
| 214 | 214 | return BITSWAP8(orig, 2,3,4,5,6,7,1,0); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | | static READ8_HANDLER( gladiator_controls_r ) |
| 217 | READ8_MEMBER(gladiatr_state::gladiator_controls_r ) |
| 218 | 218 | { |
| 219 | 219 | int coins = 0; |
| 220 | 220 | |
| 221 | | if( space.machine().root_device().ioport("COINS")->read() & 0xc0 ) coins = 0x80; |
| 221 | if(ioport("COINS")->read() & 0xc0 ) coins = 0x80; |
| 222 | 222 | switch(offset) |
| 223 | 223 | { |
| 224 | 224 | case 0x01: /* start button , coins */ |
| 225 | | return space.machine().root_device().ioport("IN0")->read() | coins; |
| 225 | return ioport("IN0")->read() | coins; |
| 226 | 226 | case 0x02: /* Player 1 Controller , coins */ |
| 227 | | return space.machine().root_device().ioport("IN1")->read() | coins; |
| 227 | return ioport("IN1")->read() | coins; |
| 228 | 228 | case 0x04: /* Player 2 Controller , coins */ |
| 229 | | return space.machine().root_device().ioport("IN2")->read() | coins; |
| 229 | return ioport("IN2")->read() | coins; |
| 230 | 230 | } |
| 231 | 231 | /* unknown */ |
| 232 | 232 | return 0; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | | static READ8_HANDLER( gladiator_button3_r ) |
| 235 | READ8_MEMBER(gladiatr_state::gladiator_button3_r ) |
| 236 | 236 | { |
| 237 | 237 | switch(offset) |
| 238 | 238 | { |
| 239 | 239 | case 0x01: /* button 3 */ |
| 240 | | return space.machine().root_device().ioport("IN3")->read(); |
| 240 | return ioport("IN3")->read(); |
| 241 | 241 | } |
| 242 | 242 | /* unknown */ |
| 243 | 243 | return 0; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | | static const struct TAITO8741interface gladiator_8741interface= |
| 247 | | { |
| 248 | | 4, /* 4 chips */ |
| 249 | | {TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT},/* program mode */ |
| 250 | | {1,0,0,0}, /* serial port connection */ |
| 251 | | {gladiator_dsw1_r,gladiator_dsw2_r,gladiator_button3_r,gladiator_controls_r} /* port handler */ |
| 252 | | }; |
| 253 | | |
| 254 | 246 | MACHINE_RESET_MEMBER(gladiatr_state,gladiator) |
| 255 | 247 | { |
| 256 | | TAITO8741_start(&gladiator_8741interface); |
| 257 | 248 | /* 6809 bank memory set */ |
| 258 | 249 | { |
| 259 | 250 | UINT8 *rom = memregion("audiocpu")->base() + 0x10000; |
| r29302 | r29303 | |
| 437 | 428 | AM_RANGE(0xc002, 0xc002) AM_WRITE(gladiatr_bankswitch_w) |
| 438 | 429 | AM_RANGE(0xc004, 0xc004) AM_WRITE(gladiatr_irq_patch_w) /* !!! patch to 2nd CPU IRQ !!! */ |
| 439 | 430 | AM_RANGE(0xc007, 0xc007) AM_WRITE(gladiatr_flipscreen_w) |
| 440 | | AM_RANGE(0xc09e, 0xc09f) AM_READWRITE_LEGACY(TAITO8741_0_r, TAITO8741_0_w) |
| 431 | AM_RANGE(0xc09e, 0xc09f) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_0, write_0) |
| 441 | 432 | AM_RANGE(0xc0bf, 0xc0bf) AM_NOP // watchdog_reset_w doesn't work |
| 442 | 433 | ADDRESS_MAP_END |
| 443 | 434 | |
| 444 | 435 | static ADDRESS_MAP_START( gladiatr_cpu2_io, AS_IO, 8, gladiatr_state ) |
| 445 | 436 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 446 | 437 | AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) |
| 447 | | AM_RANGE(0x20, 0x21) AM_READWRITE_LEGACY(TAITO8741_1_r, TAITO8741_1_w) |
| 438 | AM_RANGE(0x20, 0x21) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_1, write_1) |
| 448 | 439 | AM_RANGE(0x40, 0x40) AM_NOP // WRITE(sub_irq_ack_w) |
| 449 | | AM_RANGE(0x60, 0x61) AM_READWRITE_LEGACY(TAITO8741_2_r, TAITO8741_2_w) |
| 450 | | AM_RANGE(0x80, 0x81) AM_READWRITE_LEGACY(TAITO8741_3_r, TAITO8741_3_w) |
| 440 | AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_2, write_2) |
| 441 | AM_RANGE(0x80, 0x81) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_3, write_3) |
| 451 | 442 | AM_RANGE(0xa0, 0xa7) AM_NOP // filters on sound output |
| 452 | 443 | AM_RANGE(0xe0, 0xe0) AM_WRITE(glad_cpu_sound_command_w) |
| 453 | 444 | ADDRESS_MAP_END |
| r29302 | r29303 | |
| 716 | 707 | MCFG_MACHINE_RESET_OVERRIDE(gladiatr_state,gladiator) |
| 717 | 708 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 718 | 709 | |
| 710 | MCFG_TAITO8741_ADD("taito8741") |
| 711 | MCFG_TAITO8741_MODES(TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT) |
| 712 | MCFG_TAITO8741_CONNECT(1,0,0,0) |
| 713 | MCFG_TAITO8741_PORT_HANDLERS(READ8(gladiatr_state,gladiator_dsw1_r),READ8(gladiatr_state,gladiator_dsw2_r),READ8(gladiatr_state,gladiator_button3_r),READ8(gladiatr_state,gladiator_controls_r)) |
| 714 | |
| 719 | 715 | /* video hardware */ |
| 720 | 716 | MCFG_SCREEN_ADD("screen", RASTER) |
| 721 | 717 | MCFG_SCREEN_REFRESH_RATE(60) |
shelves/new_menus/src/mame/drivers/gsword.c
| r29302 | r29303 | |
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | #if 0 |
| 153 | | int ::gsword_coins_in(void) |
| 153 | int gsword_state::gsword_coins_in(void) |
| 154 | 154 | { |
| 155 | 155 | /* emulate 8741 coin slot */ |
| 156 | 156 | if (ioport("IN4")->read() & 0xc0) |
| r29302 | r29303 | |
| 186 | 186 | return data; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | | static READ8_HANDLER( gsword_8741_2_r ) |
| 189 | READ8_MEMBER(gsword_state::gsword_8741_2_r ) |
| 190 | 190 | { |
| 191 | 191 | switch (offset) |
| 192 | 192 | { |
| 193 | 193 | case 0x01: /* start button , coins */ |
| 194 | | return space.machine().root_device().ioport("IN0")->read(); |
| 194 | return ioport("IN0")->read(); |
| 195 | 195 | case 0x02: /* Player 1 Controller */ |
| 196 | | return space.machine().root_device().ioport("IN1")->read(); |
| 196 | return ioport("IN1")->read(); |
| 197 | 197 | case 0x04: /* Player 2 Controller */ |
| 198 | | return space.machine().root_device().ioport("IN3")->read(); |
| 198 | return ioport("IN3")->read(); |
| 199 | 199 | // default: |
| 200 | 200 | // logerror("8741-2 unknown read %d PC=%04x\n",offset,space.device().safe_pc()); |
| 201 | 201 | } |
| r29302 | r29303 | |
| 203 | 203 | return 0; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | | static READ8_HANDLER( gsword_8741_3_r ) |
| 206 | READ8_MEMBER(gsword_state::gsword_8741_3_r ) |
| 207 | 207 | { |
| 208 | 208 | switch (offset) |
| 209 | 209 | { |
| 210 | 210 | case 0x01: /* start button */ |
| 211 | | return space.machine().root_device().ioport("IN2")->read(); |
| 211 | return ioport("IN2")->read(); |
| 212 | 212 | case 0x02: /* Player 1 Controller? */ |
| 213 | | return space.machine().root_device().ioport("IN1")->read(); |
| 213 | return ioport("IN1")->read(); |
| 214 | 214 | case 0x04: /* Player 2 Controller? */ |
| 215 | | return space.machine().root_device().ioport("IN3")->read(); |
| 215 | return ioport("IN3")->read(); |
| 216 | 216 | } |
| 217 | 217 | /* unknown */ |
| 218 | 218 | // logerror("8741-3 unknown read %d PC=%04x\n",offset,space.device().safe_pc()); |
| 219 | 219 | return 0; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | | static const struct TAITO8741interface gsword_8741interface= |
| 223 | | { |
| 224 | | 4, /* 4 chips */ |
| 225 | | { TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT }, /* program mode */ |
| 226 | | { 1,0,0,0 }, /* serial port connection */ |
| 227 | | { NULL,NULL,gsword_8741_2_r,gsword_8741_3_r }, /* port handler */ |
| 228 | | { "DSW2","DSW1",NULL,NULL } |
| 229 | | }; |
| 230 | | |
| 231 | 222 | MACHINE_RESET_MEMBER(gsword_state,gsword) |
| 232 | 223 | { |
| 233 | | int i; |
| 234 | | |
| 235 | | for(i=0;i<4;i++) TAITO8741_reset(i); |
| 236 | 224 | m_coins = 0; |
| 237 | 225 | |
| 238 | 226 | /* snd CPU mask NMI during reset phase */ |
| 239 | 227 | m_nmi_enable = 0; |
| 240 | 228 | m_protect_hack = 0; |
| 241 | | |
| 242 | | TAITO8741_start(&gsword_8741interface); |
| 243 | 229 | } |
| 244 | 230 | |
| 245 | 231 | MACHINE_RESET_MEMBER(gsword_state,josvolly) |
| 246 | 232 | { |
| 247 | | josvolly_8741_reset(); |
| 248 | 233 | } |
| 249 | 234 | |
| 250 | 235 | INTERRUPT_GEN_MEMBER(gsword_state::gsword_snd_interrupt) |
| r29302 | r29303 | |
| 339 | 324 | |
| 340 | 325 | static ADDRESS_MAP_START( cpu1_io_map, AS_IO, 8, gsword_state ) |
| 341 | 326 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 342 | | AM_RANGE(0x7e, 0x7f) AM_WRITE_LEGACY(TAITO8741_0_w) AM_READ_LEGACY(TAITO8741_0_r) |
| 327 | AM_RANGE(0x7e, 0x7f) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_0, write_0) |
| 343 | 328 | ADDRESS_MAP_END |
| 344 | 329 | |
| 345 | 330 | static ADDRESS_MAP_START( josvolly_cpu1_io_map, AS_IO, 8, gsword_state ) |
| 346 | 331 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 347 | | AM_RANGE(0x7e, 0x7f) AM_WRITE_LEGACY(josvolly_8741_0_w) AM_READ_LEGACY(josvolly_8741_0_r) |
| 332 | AM_RANGE(0x7e, 0x7f) AM_DEVREADWRITE("josvolly_8741", josvolly8741_4pack_device, read_0, write_0) |
| 348 | 333 | ADDRESS_MAP_END |
| 349 | 334 | |
| 350 | 335 | // |
| r29302 | r29303 | |
| 356 | 341 | |
| 357 | 342 | static ADDRESS_MAP_START( cpu2_io_map, AS_IO, 8, gsword_state ) |
| 358 | 343 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 359 | | AM_RANGE(0x00, 0x01) AM_READWRITE_LEGACY(TAITO8741_2_r,TAITO8741_2_w) |
| 360 | | AM_RANGE(0x20, 0x21) AM_READWRITE_LEGACY(TAITO8741_3_r,TAITO8741_3_w) |
| 361 | | AM_RANGE(0x40, 0x41) AM_READWRITE_LEGACY(TAITO8741_1_r,TAITO8741_1_w) |
| 344 | AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_2, write_2) |
| 345 | AM_RANGE(0x20, 0x21) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_3, write_3) |
| 346 | AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_1, write_1) |
| 362 | 347 | AM_RANGE(0x60, 0x60) AM_READWRITE(gsword_fake_0_r, gsword_AY8910_control_port_0_w) |
| 363 | 348 | AM_RANGE(0x61, 0x61) AM_DEVREADWRITE("ay1", ay8910_device, data_r, data_w) |
| 364 | 349 | AM_RANGE(0x80, 0x80) AM_READWRITE(gsword_fake_1_r, gsword_AY8910_control_port_1_w) |
| r29302 | r29303 | |
| 388 | 373 | AM_RANGE(0x8002, 0x8002) AM_READ_PORT("IN0") // START |
| 389 | 374 | |
| 390 | 375 | // AM_RANGE(0x6000, 0x6000) AM_WRITE(adpcm_soundcommand_w) |
| 391 | | AM_RANGE(0xA000, 0xA001) AM_WRITE_LEGACY(josvolly_8741_1_w) AM_READ_LEGACY(josvolly_8741_1_r) |
| 376 | AM_RANGE(0xA000, 0xA001) AM_DEVREADWRITE("josvolly_8741", josvolly8741_4pack_device, read_1, write_1) |
| 392 | 377 | ADDRESS_MAP_END |
| 393 | 378 | |
| 394 | 379 | static ADDRESS_MAP_START( josvolly_cpu2_io_map, AS_IO, 8, gsword_state ) |
| r29302 | r29303 | |
| 398 | 383 | AM_RANGE(0x40, 0x40) AM_READWRITE(gsword_fake_1_r, gsword_AY8910_control_port_1_w) |
| 399 | 384 | AM_RANGE(0x41, 0x41) AM_DEVREADWRITE("ay2", ay8910_device, data_r, data_w) |
| 400 | 385 | |
| 401 | | AM_RANGE(0x81, 0x81) AM_WRITE_LEGACY(josvolly_nmi_enable_w) |
| 386 | AM_RANGE(0x81, 0x81) AM_DEVWRITE("josvolly_8741", josvolly8741_4pack_device, nmi_enable_w) |
| 402 | 387 | AM_RANGE(0xC1, 0xC1) AM_NOP // irq clear |
| 403 | 388 | |
| 404 | 389 | ADDRESS_MAP_END |
| r29302 | r29303 | |
| 666 | 651 | |
| 667 | 652 | MCFG_MACHINE_RESET_OVERRIDE(gsword_state,gsword) |
| 668 | 653 | |
| 654 | MCFG_TAITO8741_ADD("taito8741") |
| 655 | MCFG_TAITO8741_MODES(TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT) |
| 656 | MCFG_TAITO8741_CONNECT(1,0,0,0) |
| 657 | MCFG_TAITO8741_PORT_HANDLERS(IOPORT("DSW2"),IOPORT("DSW1"),READ8(gsword_state,gsword_8741_2_r),READ8(gsword_state,gsword_8741_3_r)) |
| 669 | 658 | #if 1 |
| 670 | 659 | /* to MCU timeout champbbj */ |
| 671 | 660 | MCFG_QUANTUM_TIME(attotime::from_hz(6000)) |
| r29302 | r29303 | |
| 714 | 703 | MCFG_CPU_VBLANK_INT_DRIVER("screen", gsword_state, irq0_line_hold) |
| 715 | 704 | |
| 716 | 705 | MCFG_MACHINE_RESET_OVERRIDE(gsword_state,josvolly) |
| 706 | |
| 707 | MCFG_JOSVOLLY8741_ADD("josvolly_8741") |
| 708 | MCFG_JOSVOLLY8741_CONNECT(1,0,0,0) |
| 709 | MCFG_JOSVOLLY8741_PORT_HANDLERS(IOPORT("DSW1"),IOPORT("DSW2"),IOPORT("DSW1"),IOPORT("DSW2")) |
| 717 | 710 | |
| 711 | |
| 718 | 712 | /* video hardware */ |
| 719 | 713 | MCFG_SCREEN_ADD("screen", RASTER) |
| 720 | 714 | MCFG_SCREEN_REFRESH_RATE(60) |
shelves/new_menus/src/mame/drivers/kopunch.c
| r29302 | r29303 | |
| 1 | 1 | /******************************************************** |
| 2 | 2 | |
| 3 | | KO Punch (c) 1981 Sega |
| 3 | KO Punch (c) 1981 Sega |
| 4 | |
| 5 | XTAL: ? |
| 6 | CPU: 8085 (proof: it uses SIM opcode) |
| 4 | 7 | |
| 8 | TODO: |
| 9 | - discrete sound? |
| 10 | - figure out sensors |
| 11 | - coins sometimes don't register |
| 12 | |
| 13 | |
| 14 | ********************************************************* |
| 15 | |
| 16 | This is a simple boxing bag game, but for visual feedback |
| 17 | it has a small CRT instead of LEDs or a dial. |
| 18 | |
| 19 | Insert coin, select your weightclass (7 buttons on cab), and punch. |
| 20 | |
| 21 | Heavyweight - 300K |
| 22 | Middleweight - 260K |
| 23 | Welterweight - 230K |
| 24 | Lightweight - 200K |
| 25 | Featherweight - 170K |
| 26 | Bantamweight - 140K |
| 27 | Flyweight - 100K |
| 28 | |
| 5 | 29 | ********************************************************/ |
| 6 | 30 | |
| 7 | 31 | #include "emu.h" |
| 8 | 32 | #include "cpu/i8085/i8085.h" |
| 9 | 33 | #include "includes/kopunch.h" |
| 10 | 34 | |
| 35 | |
| 11 | 36 | INTERRUPT_GEN_MEMBER(kopunch_state::kopunch_interrupt) |
| 12 | 37 | { |
| 13 | 38 | device.execute().set_input_line(I8085_RST75_LINE, ASSERT_LINE); |
| r29302 | r29303 | |
| 26 | 51 | WRITE8_MEMBER(kopunch_state::kopunch_lamp_w) |
| 27 | 52 | { |
| 28 | 53 | set_led_status(machine(), 0, ~data & 0x80); |
| 29 | | |
| 30 | | // if ((data & 0x7f) != 0x7f) |
| 31 | | // popmessage("port 38 = %02x",data); |
| 32 | 54 | } |
| 33 | 55 | |
| 34 | 56 | WRITE8_MEMBER(kopunch_state::kopunch_coin_w) |
| r29302 | r29303 | |
| 36 | 58 | coin_counter_w(machine(), 0, ~data & 0x80); |
| 37 | 59 | coin_counter_w(machine(), 1, ~data & 0x40); |
| 38 | 60 | |
| 39 | | // if ((data & 0x3f) != 0x3f) |
| 40 | | // popmessage("port 34 = %02x",data); |
| 61 | // if ((data & 0x3f) != 0x3e) |
| 62 | // printf("port 34 = %02x ",data); |
| 41 | 63 | } |
| 42 | 64 | |
| 43 | 65 | |
| r29302 | r29303 | |
| 45 | 67 | static ADDRESS_MAP_START( kopunch_map, AS_PROGRAM, 8, kopunch_state ) |
| 46 | 68 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 47 | 69 | AM_RANGE(0x2000, 0x23ff) AM_RAM |
| 48 | | AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(kopunch_videoram_w) AM_SHARE("videoram") |
| 49 | | AM_RANGE(0x7000, 0x70ff) AM_RAM_WRITE(kopunch_videoram2_w) AM_SHARE("videoram2") |
| 50 | | AM_RANGE(0x7100, 0x7aff) AM_RAM // ??? |
| 70 | AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(kopunch_fg_w) AM_SHARE("vram_fg") |
| 71 | AM_RANGE(0x7000, 0x70ff) AM_RAM_WRITE(kopunch_bg_w) AM_SHARE("vram_bg") |
| 72 | AM_RANGE(0x7100, 0x73ff) AM_RAM // unused vram |
| 51 | 73 | ADDRESS_MAP_END |
| 52 | 74 | |
| 53 | 75 | static ADDRESS_MAP_START( kopunch_io_map, AS_IO, 8, kopunch_state ) |
| r29302 | r29303 | |
| 70 | 92 | |
| 71 | 93 | INPUT_CHANGED_MEMBER(kopunch_state::left_coin_inserted) |
| 72 | 94 | { |
| 73 | | /* left coin insertion causes a rst6.5 (vector 0x34) */ |
| 95 | // left coin insertion causes a rst6.5 (vector 0x34) |
| 74 | 96 | if (newval) |
| 75 | 97 | m_maincpu->set_input_line(I8085_RST65_LINE, HOLD_LINE); |
| 76 | 98 | } |
| 77 | 99 | |
| 78 | 100 | INPUT_CHANGED_MEMBER(kopunch_state::right_coin_inserted) |
| 79 | 101 | { |
| 80 | | /* right coin insertion causes a rst5.5 (vector 0x2c) */ |
| 102 | // right coin insertion causes a rst5.5 (vector 0x2c) |
| 81 | 103 | if (newval) |
| 82 | 104 | m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE); |
| 83 | 105 | } |
| 84 | 106 | |
| 85 | 107 | static INPUT_PORTS_START( kopunch ) |
| 86 | 108 | PORT_START("P1") |
| 87 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY |
| 88 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY |
| 89 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY |
| 90 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY |
| 91 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 92 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 93 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 94 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) |
| 95 | | |
| 96 | | PORT_START("SYSTEM") |
| 97 | | PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* punch strength (high 3 bits) */ |
| 98 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, kopunch_state,right_coin_inserted, 0) |
| 109 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 110 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 111 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 112 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) |
| 99 | 113 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) |
| 100 | 114 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) |
| 101 | 115 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON7 ) |
| 102 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, kopunch_state,left_coin_inserted, 0) |
| 116 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // related to above startbuttons |
| 103 | 117 | |
| 118 | PORT_START("SYSTEM") |
| 119 | PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) // punch strength (high 3 bits) |
| 120 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, kopunch_state, right_coin_inserted, 0) |
| 121 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) // sensor |
| 122 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) // sensor |
| 123 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // sensor |
| 124 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, kopunch_state, left_coin_inserted, 0) |
| 125 | |
| 104 | 126 | PORT_START("DSW") |
| 105 | 127 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 106 | 128 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| r29302 | r29303 | |
| 128 | 150 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 129 | 151 | |
| 130 | 152 | PORT_START("P2") |
| 131 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL |
| 132 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL |
| 133 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL |
| 134 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL |
| 135 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 136 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 137 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL |
| 153 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 154 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ? these 3 are read at the same time: p2>>4, and 7, <<1, read from a table |
| 155 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // " |
| 156 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // " |
| 138 | 157 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 139 | 158 | INPUT_PORTS_END |
| 140 | 159 | |
| r29302 | r29303 | |
| 162 | 181 | }; |
| 163 | 182 | |
| 164 | 183 | static GFXDECODE_START( kopunch ) |
| 165 | | GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) |
| 184 | GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) |
| 166 | 185 | GFXDECODE_ENTRY( "gfx2", 0, charlayoutbig, 0, 1 ) |
| 167 | 186 | GFXDECODE_END |
| 168 | 187 | |
| 169 | 188 | |
| 170 | 189 | void kopunch_state::machine_start() |
| 171 | 190 | { |
| 191 | // zerofill |
| 192 | m_gfxbank = 0; |
| 193 | m_scrollx = 0; |
| 194 | |
| 195 | // savestates |
| 172 | 196 | save_item(NAME(m_gfxbank)); |
| 197 | save_item(NAME(m_scrollx)); |
| 173 | 198 | } |
| 174 | 199 | |
| 175 | | void kopunch_state::machine_reset() |
| 176 | | { |
| 177 | | m_gfxbank = 0; |
| 178 | | } |
| 179 | | |
| 180 | 200 | static MACHINE_CONFIG_START( kopunch, kopunch_state ) |
| 181 | 201 | |
| 182 | 202 | /* basic machine hardware */ |
| 183 | | MCFG_CPU_ADD("maincpu", I8085A, 4000000) /* 4 MHz ???? Uses SIM, must be 8085 */ |
| 203 | MCFG_CPU_ADD("maincpu", I8085A, 4000000) // 4 MHz? |
| 184 | 204 | MCFG_CPU_PROGRAM_MAP(kopunch_map) |
| 185 | 205 | MCFG_CPU_IO_MAP(kopunch_io_map) |
| 186 | 206 | MCFG_CPU_VBLANK_INT_DRIVER("screen", kopunch_state, kopunch_interrupt) |
| 187 | 207 | |
| 188 | | |
| 189 | 208 | /* video hardware */ |
| 190 | 209 | MCFG_SCREEN_ADD("screen", RASTER) |
| 191 | 210 | MCFG_SCREEN_REFRESH_RATE(60) |
| r29302 | r29303 | |
| 215 | 234 | ROM_LOAD( "epr1106.x", 0x1000, 0x1000, CRC(25a5c68b) SHA1(9761418c6f3903f8aaceece658739fe5bf5c0803) ) |
| 216 | 235 | |
| 217 | 236 | ROM_REGION( 0x1800, "gfx1", 0 ) |
| 218 | | ROM_LOAD( "epr1102", 0x0000, 0x0800, CRC(8a52de96) SHA1(5abdaa83c6bfea81395cb190f5364b72811927ba) ) |
| 219 | | ROM_LOAD( "epr1103", 0x0800, 0x0800, CRC(bae5e054) SHA1(95373123ab64543cdffb7ee9e02d0613c5c494bf) ) |
| 220 | | ROM_LOAD( "epr1104", 0x1000, 0x0800, CRC(7b119a0e) SHA1(454f01355fa9512a7442990cc92da7bc7a8d6b68) ) |
| 237 | ROM_LOAD( "epr1103", 0x0000, 0x0800, CRC(bae5e054) SHA1(95373123ab64543cdffb7ee9e02d0613c5c494bf) ) |
| 238 | ROM_LOAD( "epr1104", 0x0800, 0x0800, CRC(7b119a0e) SHA1(454f01355fa9512a7442990cc92da7bc7a8d6b68) ) |
| 239 | ROM_LOAD( "epr1102", 0x1000, 0x0800, CRC(8a52de96) SHA1(5abdaa83c6bfea81395cb190f5364b72811927ba) ) |
| 221 | 240 | |
| 222 | 241 | ROM_REGION( 0x6000, "gfx2", 0 ) |
| 223 | 242 | ROM_LOAD( "epr1107", 0x0000, 0x1000, CRC(ca00244d) SHA1(690931ea1bef9d80dcd7bd2ea2462b083c884a89) ) |
| r29302 | r29303 | |
| 228 | 247 | ROM_LOAD( "epr1111", 0x5000, 0x1000, CRC(28530ec9) SHA1(1a8782d37128cdb43133fc891cde93d2bdd5476b) ) |
| 229 | 248 | |
| 230 | 249 | ROM_REGION( 0x0060, "proms", 0 ) |
| 231 | | ROM_LOAD( "epr1101", 0x0000, 0x0020, CRC(15600f5d) SHA1(130179f79761cb16316c544e3c689bc10431db30) ) /* palette */ |
| 232 | | ROM_LOAD( "epr1099", 0x0020, 0x0020, CRC(fc58c456) SHA1(f27c3ad669dfdc33bcd7e0481fa01bf34973e816) ) /* unknown */ |
| 233 | | ROM_LOAD( "epr1100", 0x0040, 0x0020, CRC(bedb66b1) SHA1(8e78bb205d900075b761e1baa5f5813174ff28ba) ) /* unknown */ |
| 250 | ROM_LOAD( "epr1101", 0x0000, 0x0020, CRC(15600f5d) SHA1(130179f79761cb16316c544e3c689bc10431db30) ) /* palette */ |
| 251 | ROM_LOAD( "epr1099", 0x0020, 0x0020, CRC(fc58c456) SHA1(f27c3ad669dfdc33bcd7e0481fa01bf34973e816) ) /* unknown */ |
| 252 | ROM_LOAD( "epr1100", 0x0040, 0x0020, CRC(bedb66b1) SHA1(8e78bb205d900075b761e1baa5f5813174ff28ba) ) /* unknown */ |
| 234 | 253 | ROM_END |
| 235 | 254 | |
| 236 | | GAME( 1981, kopunch, 0, kopunch, kopunch, driver_device, 0, ROT270, "Sega", "KO Punch", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) |
| 255 | GAME( 1981, kopunch, 0, kopunch, kopunch, driver_device, 0, ROT270, "Sega", "KO Punch", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_MECHANICAL | GAME_SUPPORTS_SAVE ) |
shelves/new_menus/src/emu/video/saa5050.c
| r29302 | r29303 | |
| 29 | 29 | //************************************************************************** |
| 30 | 30 | |
| 31 | 31 | const device_type SAA5050 = &device_creator<saa5050_device>; |
| 32 | const device_type SAA5051 = &device_creator<saa5051_device>; |
| 32 | 33 | const device_type SAA5052 = &device_creator<saa5052_device>; |
| 34 | const device_type SAA5053 = &device_creator<saa5053_device>; |
| 35 | const device_type SAA5054 = &device_creator<saa5054_device>; |
| 36 | const device_type SAA5055 = &device_creator<saa5055_device>; |
| 37 | const device_type SAA5056 = &device_creator<saa5056_device>; |
| 38 | const device_type SAA5057 = &device_creator<saa5057_device>; |
| 33 | 39 | |
| 34 | 40 | |
| 35 | 41 | //------------------------------------------------- |
| r29302 | r29303 | |
| 37 | 43 | //------------------------------------------------- |
| 38 | 44 | |
| 39 | 45 | ROM_START( saa5050 ) |
| 40 | | ROM_REGION( 0x10000, "chargen", 0 ) |
| 46 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 41 | 47 | ROM_LOAD( "saa5050", 0x0140, 0x08c0, BAD_DUMP CRC(78c17e3e) SHA1(4e1c59dc484505de1dc0b1ba7e5f70a54b0d4ccc) ) |
| 42 | 48 | ROM_END |
| 43 | 49 | |
| 44 | 50 | |
| 45 | 51 | //------------------------------------------------- |
| 52 | // ROM( saa5051 ) |
| 53 | //------------------------------------------------- |
| 54 | |
| 55 | ROM_START( saa5051 ) |
| 56 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 57 | ROM_LOAD( "saa5051", 0x0140, 0x08c0, NO_DUMP ) |
| 58 | ROM_END |
| 59 | |
| 60 | |
| 61 | //------------------------------------------------- |
| 46 | 62 | // ROM( saa5052 ) |
| 47 | 63 | //------------------------------------------------- |
| 48 | 64 | |
| 49 | 65 | ROM_START( saa5052 ) |
| 50 | | ROM_REGION( 0x10000, "chargen", 0 ) |
| 66 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 51 | 67 | ROM_LOAD( "saa5052", 0x0140, 0x08c0, BAD_DUMP CRC(cda3bf79) SHA1(cf5ea94459c09001d422dadc212bc970b4b4aa20) ) |
| 52 | 68 | ROM_END |
| 53 | 69 | |
| 54 | 70 | |
| 55 | 71 | //------------------------------------------------- |
| 72 | // ROM( saa5053 ) |
| 73 | //------------------------------------------------- |
| 74 | |
| 75 | ROM_START( saa5053 ) |
| 76 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 77 | ROM_LOAD( "saa5053", 0x0140, 0x08c0, NO_DUMP ) |
| 78 | ROM_END |
| 79 | |
| 80 | |
| 81 | //------------------------------------------------- |
| 82 | // ROM( saa5054 ) |
| 83 | //------------------------------------------------- |
| 84 | |
| 85 | ROM_START( saa5054 ) |
| 86 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 87 | ROM_LOAD( "saa5054", 0x0140, 0x08c0, NO_DUMP ) |
| 88 | ROM_END |
| 89 | |
| 90 | |
| 91 | //------------------------------------------------- |
| 92 | // ROM( saa5055 ) |
| 93 | //------------------------------------------------- |
| 94 | |
| 95 | ROM_START( saa5055 ) |
| 96 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 97 | ROM_LOAD( "saa5055", 0x0140, 0x08c0, NO_DUMP ) |
| 98 | ROM_END |
| 99 | |
| 100 | |
| 101 | //------------------------------------------------- |
| 102 | // ROM( saa5056 ) |
| 103 | //------------------------------------------------- |
| 104 | |
| 105 | ROM_START( saa5056 ) |
| 106 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 107 | ROM_LOAD( "saa5056", 0x0140, 0x08c0, NO_DUMP ) |
| 108 | ROM_END |
| 109 | |
| 110 | |
| 111 | //------------------------------------------------- |
| 112 | // ROM( saa5057 ) |
| 113 | //------------------------------------------------- |
| 114 | |
| 115 | ROM_START( saa5057 ) |
| 116 | ROM_REGION( 0xa00, "chargen", 0 ) |
| 117 | ROM_LOAD( "saa5057", 0x0140, 0x08c0, NO_DUMP ) |
| 118 | ROM_END |
| 119 | |
| 120 | |
| 121 | //------------------------------------------------- |
| 56 | 122 | // rom_region - device-specific ROM region |
| 57 | 123 | //------------------------------------------------- |
| 58 | 124 | |
| 59 | 125 | const rom_entry *saa5050_device::device_rom_region() const |
| 60 | 126 | { |
| 61 | | switch (m_variant) |
| 62 | | { |
| 63 | | default: return ROM_NAME( saa5050 ); |
| 64 | | case TYPE_5052: return ROM_NAME( saa5052 ); |
| 65 | | } |
| 127 | return ROM_NAME( saa5050 ); |
| 66 | 128 | } |
| 67 | 129 | |
| 130 | const rom_entry *saa5051_device::device_rom_region() const |
| 131 | { |
| 132 | return ROM_NAME( saa5051 ); |
| 133 | } |
| 68 | 134 | |
| 135 | const rom_entry *saa5052_device::device_rom_region() const |
| 136 | { |
| 137 | return ROM_NAME( saa5052 ); |
| 138 | } |
| 69 | 139 | |
| 70 | | //************************************************************************** |
| 71 | | // MACROS / CONSTANTS |
| 72 | | //************************************************************************** |
| 140 | const rom_entry *saa5053_device::device_rom_region() const |
| 141 | { |
| 142 | return ROM_NAME( saa5053 ); |
| 143 | } |
| 73 | 144 | |
| 74 | | enum |
| 145 | const rom_entry *saa5054_device::device_rom_region() const |
| 75 | 146 | { |
| 76 | | NUL = 0, |
| 77 | | ALPHA_RED, |
| 78 | | ALPHA_GREEN, |
| 79 | | ALPHA_YELLOW, |
| 80 | | ALPHA_BLUE, |
| 81 | | ALPHA_MAGENTA, |
| 82 | | ALPHA_CYAN, |
| 83 | | ALPHA_WHITE, |
| 84 | | FLASH, |
| 85 | | STEADY, |
| 86 | | END_BOX, |
| 87 | | START_BOX, |
| 88 | | NORMAL_HEIGHT, |
| 89 | | DOUBLE_HEIGHT, |
| 90 | | S0, |
| 91 | | S1, |
| 92 | | DLE, |
| 93 | | GRAPHICS_RED, |
| 94 | | GRAPHICS_GREEN, |
| 95 | | GRAPHICS_YELLOW, |
| 96 | | GRAPHICS_BLUE, |
| 97 | | GRAPHICS_MAGENTA, |
| 98 | | GRAPHICS_CYAN, |
| 99 | | GRAPHICS_WHITE, |
| 100 | | CONCEAL_DISPLAY, |
| 101 | | CONTIGUOUS_GFX, |
| 102 | | SEPARATED_GFX, |
| 103 | | ESC, |
| 104 | | BLACK_BACKGROUND, |
| 105 | | NEW_BACKGROUND, |
| 106 | | HOLD_GRAPHICS, |
| 107 | | RELEASE_GRAPHICS |
| 108 | | }; |
| 147 | return ROM_NAME( saa5054 ); |
| 148 | } |
| 109 | 149 | |
| 150 | const rom_entry *saa5055_device::device_rom_region() const |
| 151 | { |
| 152 | return ROM_NAME( saa5055 ); |
| 153 | } |
| 110 | 154 | |
| 111 | | static const rgb_t PALETTE_SAA5050[] = |
| 155 | const rom_entry *saa5056_device::device_rom_region() const |
| 112 | 156 | { |
| 113 | | rgb_t::black, |
| 114 | | rgb_t(0xff, 0x00, 0x00), |
| 115 | | rgb_t(0x00, 0xff, 0x00), |
| 116 | | rgb_t(0xff, 0xff, 0x00), |
| 117 | | rgb_t(0x00, 0x00, 0xff), |
| 118 | | rgb_t(0xff, 0x00, 0xff), |
| 119 | | rgb_t(0x00, 0xff, 0xff), |
| 120 | | rgb_t::white |
| 121 | | }; |
| 157 | return ROM_NAME( saa5056 ); |
| 158 | } |
| 122 | 159 | |
| 160 | const rom_entry *saa5057_device::device_rom_region() const |
| 161 | { |
| 162 | return ROM_NAME( saa5057 ); |
| 163 | } |
| 123 | 164 | |
| 124 | 165 | |
| 166 | |
| 125 | 167 | //************************************************************************** |
| 126 | 168 | // LIVE DEVICE |
| 127 | 169 | //************************************************************************** |
| r29302 | r29303 | |
| 130 | 172 | // saa5050_device - constructor |
| 131 | 173 | //------------------------------------------------- |
| 132 | 174 | |
| 133 | | saa5050_device::saa5050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source) |
| 134 | | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 135 | | m_frame_count(0), |
| 136 | | m_variant(variant) |
| 175 | saa5050_device::saa5050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| 176 | device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 177 | m_char_rom(*this, "chargen"), |
| 178 | m_read_d(*this), |
| 179 | m_frame_count(0), |
| 180 | m_cols(0), |
| 181 | m_rows(0), |
| 182 | m_size(0) |
| 137 | 183 | { |
| 138 | 184 | } |
| 139 | 185 | |
| 140 | | saa5050_device::saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 141 | | : device_t(mconfig, SAA5050, "SAA5050", tag, owner, clock, "saa5050", __FILE__), |
| 142 | | m_frame_count(0), |
| 143 | | m_variant(TYPE_5050) |
| 186 | saa5050_device::saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 187 | device_t(mconfig, SAA5050, "SAA5050", tag, owner, clock, "saa5050", __FILE__), |
| 188 | m_char_rom(*this, "chargen"), |
| 189 | m_read_d(*this), |
| 190 | m_frame_count(0), |
| 191 | m_cols(0), |
| 192 | m_rows(0), |
| 193 | m_size(0) |
| 144 | 194 | { |
| 145 | 195 | } |
| 146 | 196 | |
| 197 | saa5051_device::saa5051_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 198 | : saa5050_device(mconfig, SAA5051, "SAA5051", tag, owner, clock, "saa5051", __FILE__) { } |
| 199 | |
| 147 | 200 | saa5052_device::saa5052_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 148 | | : saa5050_device(mconfig, SAA5052, "SAA5052", tag, owner, clock, TYPE_5052, "saa5052", __FILE__) |
| 149 | | { |
| 150 | | } |
| 201 | : saa5050_device(mconfig, SAA5052, "SAA5052", tag, owner, clock, "saa5052", __FILE__) { } |
| 151 | 202 | |
| 203 | saa5053_device::saa5053_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 204 | : saa5050_device(mconfig, SAA5053, "SAA5053", tag, owner, clock, "saa5053", __FILE__) { } |
| 152 | 205 | |
| 153 | | //------------------------------------------------- |
| 154 | | // device_config_complete - perform any |
| 155 | | // operations now that the configuration is |
| 156 | | // complete |
| 157 | | //------------------------------------------------- |
| 206 | saa5054_device::saa5054_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 207 | : saa5050_device(mconfig, SAA5054, "SAA5054", tag, owner, clock, "saa5054", __FILE__) { } |
| 158 | 208 | |
| 159 | | void saa5050_device::device_config_complete() |
| 160 | | { |
| 161 | | // inherit a copy of the static code |
| 162 | | const saa5050_interface *intf = reinterpret_cast<const saa5050_interface *>(static_config()); |
| 163 | | if (intf != NULL) |
| 164 | | *static_cast<saa5050_interface *>(this) = *intf; |
| 209 | saa5055_device::saa5055_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 210 | : saa5050_device(mconfig, SAA5055, "SAA5055", tag, owner, clock, "saa5055", __FILE__) { } |
| 165 | 211 | |
| 166 | | // or initialize to defaults if none provided |
| 167 | | else |
| 168 | | { |
| 169 | | memset(&m_in_d_cb, 0, sizeof(m_in_d_cb)); |
| 170 | | } |
| 171 | | } |
| 212 | saa5056_device::saa5056_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 213 | : saa5050_device(mconfig, SAA5056, "SAA5056", tag, owner, clock, "saa5056", __FILE__) { } |
| 172 | 214 | |
| 215 | saa5057_device::saa5057_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 216 | : saa5050_device(mconfig, SAA5057, "SAA5057", tag, owner, clock, "saa5057", __FILE__) { } |
| 173 | 217 | |
| 218 | |
| 219 | |
| 174 | 220 | //------------------------------------------------- |
| 175 | 221 | // device_start - device-specific startup |
| 176 | 222 | //------------------------------------------------- |
| r29302 | r29303 | |
| 178 | 224 | void saa5050_device::device_start() |
| 179 | 225 | { |
| 180 | 226 | // resolve callbacks |
| 181 | | m_in_d_func.resolve(m_in_d_cb, *this); |
| 227 | m_read_d.resolve_safe(0); |
| 182 | 228 | |
| 183 | | // find memory regions |
| 184 | | m_char_rom = memregion("chargen")->base(); |
| 185 | | |
| 186 | 229 | // register for state saving |
| 187 | 230 | save_item(NAME(m_code)); |
| 188 | 231 | save_item(NAME(m_last_code)); |
| r29302 | r29303 | |
| 202 | 245 | save_item(NAME(m_double_height_bottom_row)); |
| 203 | 246 | save_item(NAME(m_hold)); |
| 204 | 247 | save_item(NAME(m_frame_count)); |
| 205 | | save_item(NAME(m_variant)); |
| 206 | 248 | } |
| 207 | 249 | |
| 208 | 250 | |
| r29302 | r29303 | |
| 330 | 372 | if (m_double_height && m_double_height_bottom_row) ra += 5; |
| 331 | 373 | |
| 332 | 374 | offs_t char_rom_addr = (data * 10) + ra; |
| 333 | | m_char_data = m_char_rom[char_rom_addr]; |
| 375 | m_char_data = m_char_rom->base()[char_rom_addr]; |
| 334 | 376 | } |
| 335 | 377 | |
| 336 | 378 | |
| r29302 | r29303 | |
| 455 | 497 | |
| 456 | 498 | for (int sx = 0; sx < m_cols; sx++) |
| 457 | 499 | { |
| 458 | | UINT8 code = m_in_d_func(video_ram_addr++); |
| 500 | UINT8 code = m_read_d(video_ram_addr++); |
| 459 | 501 | |
| 460 | 502 | write(code & 0x7f); |
| 461 | 503 | |
shelves/new_menus/src/emu/video/saa5050.h
| r29302 | r29303 | |
| 39 | 39 | // INTERFACE CONFIGURATION MACROS |
| 40 | 40 | //************************************************************************** |
| 41 | 41 | |
| 42 | | #define MCFG_SAA5050_ADD(_tag, _clock, _config) \ |
| 43 | | MCFG_DEVICE_ADD(_tag, SAA5050, _clock) \ |
| 44 | | MCFG_DEVICE_CONFIG(_config) |
| 42 | #define MCFG_SAA5050_D_CALLBACK(_read) \ |
| 43 | devcb = &saa5050_device::set_d_rd_callback(*device, DEVCB2_##_read); |
| 45 | 44 | |
| 46 | | #define MCFG_SAA5052_ADD(_tag, _clock, _config) \ |
| 47 | | MCFG_DEVICE_ADD(_tag, SAA5052, _clock) \ |
| 48 | | MCFG_DEVICE_CONFIG(_config) |
| 49 | 45 | |
| 46 | #define MCFG_SAA5050_SCREEN_SIZE(_cols, _rows, _size) \ |
| 47 | saa5050_device::static_set_screen_size(*device, _cols, _rows, _size); |
| 50 | 48 | |
| 51 | | #define SAA5050_INTERFACE(name) \ |
| 52 | | const saa5050_interface (name) = |
| 53 | 49 | |
| 54 | 50 | |
| 55 | | |
| 56 | 51 | //************************************************************************** |
| 57 | 52 | // TYPE DEFINITIONS |
| 58 | 53 | //************************************************************************** |
| 59 | 54 | |
| 60 | | // ======================> saa5050_interface |
| 61 | | |
| 62 | | struct saa5050_interface |
| 63 | | { |
| 64 | | devcb_read8 m_in_d_cb; |
| 65 | | |
| 66 | | int m_cols; |
| 67 | | int m_rows; |
| 68 | | int m_size; |
| 69 | | }; |
| 70 | | |
| 71 | | |
| 72 | 55 | // ======================> saa5050_device |
| 73 | 56 | |
| 74 | | class saa5050_device : public device_t, |
| 75 | | public saa5050_interface |
| 57 | class saa5050_device : public device_t |
| 76 | 58 | { |
| 77 | 59 | public: |
| 78 | 60 | // construction/destruction |
| 79 | | saa5050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source); |
| 61 | saa5050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 80 | 62 | saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 81 | 63 | |
| 64 | static void static_set_screen_size(device_t &device, int cols, int rows, int size) { downcast<saa5050_device &>(device).m_cols = cols; downcast<saa5050_device &>(device).m_rows = rows; downcast<saa5050_device &>(device).m_size = size; } |
| 65 | |
| 66 | template<class _Object> static devcb2_base &set_d_rd_callback(device_t &device, _Object object) { return downcast<saa5050_device &>(device).m_read_d.set_callback(object); } |
| 67 | |
| 82 | 68 | // optional information overrides |
| 83 | 69 | virtual const rom_entry *device_rom_region() const; |
| 84 | 70 | |
| r29302 | r29303 | |
| 95 | 81 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 96 | 82 | |
| 97 | 83 | protected: |
| 98 | | enum |
| 99 | | { |
| 100 | | TYPE_5050, |
| 101 | | TYPE_5052 |
| 102 | | }; |
| 103 | | |
| 104 | 84 | // device-level overrides |
| 105 | | virtual void device_config_complete(); |
| 106 | 85 | virtual void device_start(); |
| 107 | 86 | virtual void device_reset(); |
| 108 | 87 | |
| 109 | 88 | private: |
| 89 | enum |
| 90 | { |
| 91 | NUL = 0, |
| 92 | ALPHA_RED, |
| 93 | ALPHA_GREEN, |
| 94 | ALPHA_YELLOW, |
| 95 | ALPHA_BLUE, |
| 96 | ALPHA_MAGENTA, |
| 97 | ALPHA_CYAN, |
| 98 | ALPHA_WHITE, |
| 99 | FLASH, |
| 100 | STEADY, |
| 101 | END_BOX, |
| 102 | START_BOX, |
| 103 | NORMAL_HEIGHT, |
| 104 | DOUBLE_HEIGHT, |
| 105 | S0, |
| 106 | S1, |
| 107 | DLE, |
| 108 | GRAPHICS_RED, |
| 109 | GRAPHICS_GREEN, |
| 110 | GRAPHICS_YELLOW, |
| 111 | GRAPHICS_BLUE, |
| 112 | GRAPHICS_MAGENTA, |
| 113 | GRAPHICS_CYAN, |
| 114 | GRAPHICS_WHITE, |
| 115 | CONCEAL_DISPLAY, |
| 116 | CONTIGUOUS_GFX, |
| 117 | SEPARATED_GFX, |
| 118 | ESC, |
| 119 | BLACK_BACKGROUND, |
| 120 | NEW_BACKGROUND, |
| 121 | HOLD_GRAPHICS, |
| 122 | RELEASE_GRAPHICS |
| 123 | }; |
| 124 | |
| 110 | 125 | void process_control_character(UINT8 data); |
| 111 | 126 | void get_character_data(UINT8 data); |
| 112 | 127 | |
| 113 | | devcb_resolved_read8 m_in_d_func; |
| 128 | required_memory_region m_char_rom; |
| 114 | 129 | |
| 115 | | const UINT8 *m_char_rom; |
| 130 | devcb2_read8 m_read_d; |
| 131 | |
| 116 | 132 | UINT8 m_code; |
| 117 | 133 | UINT8 m_last_code; |
| 118 | 134 | UINT8 m_char_data; |
| r29302 | r29303 | |
| 132 | 148 | bool m_hold; |
| 133 | 149 | int m_frame_count; |
| 134 | 150 | |
| 135 | | int m_variant; |
| 151 | int m_cols; |
| 152 | int m_rows; |
| 153 | int m_size; |
| 136 | 154 | }; |
| 137 | 155 | |
| 138 | 156 | |
| 157 | // ======================> saa5051_device |
| 158 | |
| 159 | class saa5051_device : public saa5050_device |
| 160 | { |
| 161 | public: |
| 162 | // construction/destruction |
| 163 | saa5051_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 164 | |
| 165 | // optional information overrides |
| 166 | virtual const rom_entry *device_rom_region() const; |
| 167 | }; |
| 168 | |
| 169 | |
| 139 | 170 | // ======================> saa5052_device |
| 140 | 171 | |
| 141 | 172 | class saa5052_device : public saa5050_device |
| r29302 | r29303 | |
| 143 | 174 | public: |
| 144 | 175 | // construction/destruction |
| 145 | 176 | saa5052_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 177 | |
| 178 | // optional information overrides |
| 179 | virtual const rom_entry *device_rom_region() const; |
| 146 | 180 | }; |
| 147 | 181 | |
| 148 | 182 | |
| 183 | // ======================> saa5053_device |
| 184 | |
| 185 | class saa5053_device : public saa5050_device |
| 186 | { |
| 187 | public: |
| 188 | // construction/destruction |
| 189 | saa5053_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 190 | |
| 191 | // optional information overrides |
| 192 | virtual const rom_entry *device_rom_region() const; |
| 193 | }; |
| 194 | |
| 195 | |
| 196 | // ======================> saa5054_device |
| 197 | |
| 198 | class saa5054_device : public saa5050_device |
| 199 | { |
| 200 | public: |
| 201 | // construction/destruction |
| 202 | saa5054_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 203 | |
| 204 | // optional information overrides |
| 205 | virtual const rom_entry *device_rom_region() const; |
| 206 | }; |
| 207 | |
| 208 | |
| 209 | // ======================> saa5055_device |
| 210 | |
| 211 | class saa5055_device : public saa5050_device |
| 212 | { |
| 213 | public: |
| 214 | // construction/destruction |
| 215 | saa5055_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 216 | |
| 217 | // optional information overrides |
| 218 | virtual const rom_entry *device_rom_region() const; |
| 219 | }; |
| 220 | |
| 221 | |
| 222 | // ======================> saa5056_device |
| 223 | |
| 224 | class saa5056_device : public saa5050_device |
| 225 | { |
| 226 | public: |
| 227 | // construction/destruction |
| 228 | saa5056_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 229 | |
| 230 | // optional information overrides |
| 231 | virtual const rom_entry *device_rom_region() const; |
| 232 | }; |
| 233 | |
| 234 | |
| 235 | // ======================> saa5057_device |
| 236 | |
| 237 | class saa5057_device : public saa5050_device |
| 238 | { |
| 239 | public: |
| 240 | // construction/destruction |
| 241 | saa5057_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 242 | |
| 243 | // optional information overrides |
| 244 | virtual const rom_entry *device_rom_region() const; |
| 245 | }; |
| 246 | |
| 247 | |
| 149 | 248 | // device type definition |
| 150 | | extern const device_type SAA5050; |
| 151 | | extern const device_type SAA5052; |
| 249 | extern const device_type SAA5050; // English |
| 250 | extern const device_type SAA5051; // German |
| 251 | extern const device_type SAA5052; // Swedish/Finnish |
| 252 | extern const device_type SAA5053; // Italian |
| 253 | extern const device_type SAA5054; // Belgian |
| 254 | extern const device_type SAA5055; // U.S. ASCII |
| 255 | extern const device_type SAA5056; // Hebrew |
| 256 | extern const device_type SAA5057; // Cyrillic |
| 152 | 257 | |
| 153 | 258 | |
| 154 | 259 | |
shelves/new_menus/src/emu/video/mc6845.c
| r29302 | r29303 | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | mc6845_device::mc6845_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 127 | | : device_t(mconfig, MC6845, "mc6845", tag, owner, clock, "mc6845", __FILE__), |
| 127 | : device_t(mconfig, MC6845, "MC6845 CRTC", tag, owner, clock, "mc6845", __FILE__), |
| 128 | 128 | device_video_interface(mconfig, *this, false) |
| 129 | 129 | { |
| 130 | 130 | } |
| r29302 | r29303 | |
| 1386 | 1386 | |
| 1387 | 1387 | |
| 1388 | 1388 | r6545_1_device::r6545_1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1389 | | : mc6845_device(mconfig, R6545_1, "R6545-1", tag, owner, clock, "r6545_1", __FILE__) |
| 1389 | : mc6845_device(mconfig, R6545_1, "R6545-1 CRTC", tag, owner, clock, "r6545_1", __FILE__) |
| 1390 | 1390 | { |
| 1391 | 1391 | } |
| 1392 | 1392 | |
| 1393 | 1393 | |
| 1394 | 1394 | h46505_device::h46505_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1395 | | : mc6845_device(mconfig, H46505, "H46505", tag, owner, clock, "h46505", __FILE__) |
| 1395 | : mc6845_device(mconfig, H46505, "H46505 CRTC", tag, owner, clock, "h46505", __FILE__) |
| 1396 | 1396 | { |
| 1397 | 1397 | } |
| 1398 | 1398 | |
| 1399 | 1399 | |
| 1400 | 1400 | mc6845_1_device::mc6845_1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1401 | | : mc6845_device(mconfig, MC6845_1, "MC6845-1", tag, owner, clock, "mc6845_1", __FILE__) |
| 1401 | : mc6845_device(mconfig, MC6845_1, "MC6845-1 CRTC", tag, owner, clock, "mc6845_1", __FILE__) |
| 1402 | 1402 | { |
| 1403 | 1403 | } |
| 1404 | 1404 | |
| 1405 | 1405 | |
| 1406 | 1406 | hd6845_device::hd6845_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1407 | | : mc6845_device(mconfig, HD6845, "HD6845", tag, owner, clock, "hd6845", __FILE__) |
| 1407 | : mc6845_device(mconfig, HD6845, "HD6845 CRTC", tag, owner, clock, "hd6845", __FILE__) |
| 1408 | 1408 | { |
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | 1411 | |
| 1412 | 1412 | c6545_1_device::c6545_1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1413 | | : mc6845_device(mconfig, C6545_1, "C6545-1", tag, owner, clock, "c6545_1", __FILE__) |
| 1413 | : mc6845_device(mconfig, C6545_1, "C6545-1 CRTC", tag, owner, clock, "c6545_1", __FILE__) |
| 1414 | 1414 | { |
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | 1417 | |
| 1418 | 1418 | sy6545_1_device::sy6545_1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1419 | | : mc6845_device(mconfig, SY6545_1, "SY6545-1", tag, owner, clock, "sy6545_1", __FILE__) |
| 1419 | : mc6845_device(mconfig, SY6545_1, "SY6545-1 CRTC", tag, owner, clock, "sy6545_1", __FILE__) |
| 1420 | 1420 | { |
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | 1423 | |
| 1424 | 1424 | sy6845e_device::sy6845e_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1425 | | : mc6845_device(mconfig, SY6845E, "SY6845E", tag, owner, clock, "sy6845e", __FILE__) |
| 1425 | : mc6845_device(mconfig, SY6845E, "SY6845E CRTC", tag, owner, clock, "sy6845e", __FILE__) |
| 1426 | 1426 | { |
| 1427 | 1427 | } |
| 1428 | 1428 | |
| 1429 | 1429 | |
| 1430 | 1430 | hd6345_device::hd6345_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1431 | | : mc6845_device(mconfig, HD6345, "HD6345", tag, owner, clock, "hd6345", __FILE__) |
| 1431 | : mc6845_device(mconfig, HD6345, "HD6345 CRTC", tag, owner, clock, "hd6345", __FILE__) |
| 1432 | 1432 | { |
| 1433 | 1433 | } |
| 1434 | 1434 | |
| 1435 | 1435 | |
| 1436 | 1436 | ams40041_device::ams40041_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1437 | | : mc6845_device(mconfig, AMS40041, "40041", tag, owner, clock, "ams40041", __FILE__) |
| 1437 | : mc6845_device(mconfig, AMS40041, "AMS40041 CRTC", tag, owner, clock, "ams40041", __FILE__) |
| 1438 | 1438 | { |
| 1439 | 1439 | } |
| 1440 | 1440 | |
shelves/new_menus/src/emu/video/h63484.c
| r29302 | r29303 | |
| 826 | 826 | } |
| 827 | 827 | } |
| 828 | 828 | |
| 829 | | void h63484_device::draw_circle(INT16 cx, INT16 cy, double r, double s_angol, double e_angol, bool c) |
| 829 | void h63484_device::draw_ellipse(INT16 cx, INT16 cy, double dx, double dy, double s_angol, double e_angol, bool c) |
| 830 | 830 | { |
| 831 | | double inc = 1.0 / (r * 100); |
| 831 | double inc = 1.0 / (MAX(dx, dy) * 100); |
| 832 | 832 | for (double angol = s_angol; fabs(angol - e_angol) >= inc*2; angol += inc * (c ? -1 : +1)) |
| 833 | 833 | { |
| 834 | 834 | if (angol > DEGREE_TO_RADIAN(360)) angol -= DEGREE_TO_RADIAN(360); |
| 835 | 835 | if (angol < DEGREE_TO_RADIAN(0)) angol += DEGREE_TO_RADIAN(360); |
| 836 | 836 | |
| 837 | | double px = cos(angol) * r; |
| 838 | | double py = sin(angol) * r; |
| 837 | double px = cos(angol) * dx; |
| 838 | double py = sin(angol) * dy; |
| 839 | 839 | set_dot(cx + round(px), cy + round(py), 0, 0); |
| 840 | 840 | } |
| 841 | 841 | } |
| r29302 | r29303 | |
| 1373 | 1373 | if (s_angol < 0) s_angol += DEGREE_TO_RADIAN(360); |
| 1374 | 1374 | if (e_angol < 0) e_angol += DEGREE_TO_RADIAN(360); |
| 1375 | 1375 | |
| 1376 | | draw_circle(xc, yc, r, s_angol, e_angol, BIT(m_cr, 8)); |
| 1376 | draw_ellipse(xc, yc, r, r, s_angol, e_angol, BIT(m_cr, 8)); |
| 1377 | 1377 | |
| 1378 | 1378 | m_cpx = xe; |
| 1379 | 1379 | m_cpy = ye; |
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | void h63484_device::command_earc_exec() |
| 1383 | { |
| 1384 | UINT16 a = m_pr[0]; |
| 1385 | UINT16 b = m_pr[1]; |
| 1386 | INT16 xc = (INT16)m_pr[2]; |
| 1387 | INT16 yc = (INT16)m_pr[3]; |
| 1388 | INT16 xe = (INT16)m_pr[4]; |
| 1389 | INT16 ye = (INT16)m_pr[5]; |
| 1390 | |
| 1391 | if (BIT(m_cr, 10)) |
| 1392 | { |
| 1393 | xc += m_cpx; |
| 1394 | yc += m_cpy; |
| 1395 | xe += m_cpx; |
| 1396 | ye += m_cpy; |
| 1397 | } |
| 1398 | |
| 1399 | double r = sqrt(pow((double)(xc - m_cpx), 2) / a + pow((double)(yc - m_cpy), 2) / b); |
| 1400 | double dx = sqrt((double)a); |
| 1401 | double dy = sqrt((double)b); |
| 1402 | double s_angol = atan2((double)(m_cpy - yc) / dy, (double)(m_cpx - xc) / dx); |
| 1403 | double e_angol = atan2((double)(ye - yc) / dy, (double)(xe - xc) / dx); |
| 1404 | if (s_angol < 0) s_angol += DEGREE_TO_RADIAN(360); |
| 1405 | if (e_angol < 0) e_angol += DEGREE_TO_RADIAN(360); |
| 1406 | |
| 1407 | draw_ellipse(xc, yc, r * dx, r * dy, s_angol, e_angol, BIT(m_cr, 8)); |
| 1408 | |
| 1409 | m_cpx = xe; |
| 1410 | m_cpy = ye; |
| 1411 | } |
| 1412 | |
| 1382 | 1413 | void h63484_device::process_fifo() |
| 1383 | 1414 | { |
| 1384 | 1415 | UINT8 data; |
| r29302 | r29303 | |
| 1654 | 1685 | if(m_param_ptr == 1) |
| 1655 | 1686 | { |
| 1656 | 1687 | if (CMD_LOG) logerror("HD63484 '%s': CRCL (%d, %d, %d, %d) %d\n", tag(), BIT(m_cr, 8), (m_cr >> 5) & 0x07, (m_cr >> 3) & 0x03, (m_cr >> 0) & 0x07, m_pr[0]); |
| 1657 | | draw_circle(m_cpx, m_cpy, m_pr[0] & 0x1fff, DEGREE_TO_RADIAN(0), DEGREE_TO_RADIAN(360), BIT(m_cr, 8)); |
| 1688 | UINT16 r = m_pr[0] & 0x1fff; |
| 1689 | draw_ellipse(m_cpx, m_cpy, r, r, DEGREE_TO_RADIAN(0), DEGREE_TO_RADIAN(360), BIT(m_cr, 8)); |
| 1658 | 1690 | command_end_seq(); |
| 1659 | 1691 | } |
| 1660 | 1692 | break; |
| r29302 | r29303 | |
| 1663 | 1695 | if(m_param_ptr == 3) |
| 1664 | 1696 | { |
| 1665 | 1697 | if (CMD_LOG) logerror("HD63484 '%s': ELPS (%d, %d, %d, %d) %d, %d, %d\n", tag(), BIT(m_cr, 8), (m_cr >> 5) & 0x07, (m_cr >> 3) & 0x03, (m_cr >> 0) & 0x07, m_pr[0], m_pr[1], m_pr[2]); |
| 1698 | double dx = (double)m_pr[3]; |
| 1699 | double dy = sqrt(pow(dx, 2) / ((double)m_pr[0] / m_pr[1])); |
| 1700 | draw_ellipse(m_cpx, m_cpy, dx, dy, DEGREE_TO_RADIAN(0), DEGREE_TO_RADIAN(360), BIT(m_cr, 8)); |
| 1666 | 1701 | command_end_seq(); |
| 1667 | | fatalerror("HD63484 COMMAND_ELPS!\n"); |
| 1668 | 1702 | } |
| 1669 | 1703 | break; |
| 1670 | 1704 | |
| r29302 | r29303 | |
| 1683 | 1717 | if(m_param_ptr == 6) |
| 1684 | 1718 | { |
| 1685 | 1719 | if (CMD_LOG) logerror("HD63484 '%s': %cEARC (%d, %d, %d, %d) %d, %d, %d, %d, %d, %d\n", tag(), BIT(m_cr, 10) ? 'R' : 'A', BIT(m_cr, 8), (m_cr >> 5) & 0x07, (m_cr >> 3) & 0x03, (m_cr >> 0) & 0x07, m_pr[0], m_pr[1], m_pr[2], m_pr[3], m_pr[4], m_pr[5]); |
| 1720 | command_earc_exec(); |
| 1686 | 1721 | command_end_seq(); |
| 1687 | | fatalerror("HD63484 COMMAND_AEARC!\n"); |
| 1688 | 1722 | } |
| 1689 | 1723 | break; |
| 1690 | 1724 | |
shelves/new_menus/src/mess/includes/abc80x.h
| r29302 | r29303 | |
| 133 | 133 | DECLARE_WRITE_LINE_MEMBER( sio_dtrb_w ); |
| 134 | 134 | DECLARE_WRITE_LINE_MEMBER( sio_rtsb_w ); |
| 135 | 135 | |
| 136 | | // cpu state |
| 137 | | int m_fetch_charram; // opcode fetched from character RAM region (0x7800-0x7fff) |
| 136 | // memory state |
| 137 | int m_fetch_charram; // opcode fetched from character RAM region (0x7800-0x7fff) |
| 138 | 138 | |
| 139 | | // video state |
| 140 | | UINT8 m_hrs; // HR picture start scanline |
| 141 | | UINT8 m_fgctl; // HR foreground control |
| 142 | | |
| 143 | 139 | // sound state |
| 144 | | int m_pling; // pling |
| 140 | int m_pling; |
| 145 | 141 | |
| 146 | 142 | // serial state |
| 147 | 143 | UINT8 m_sb; |
| r29302 | r29303 | |
| 153 | 149 | int m_dfd_in; |
| 154 | 150 | int m_tape_ctr; |
| 155 | 151 | |
| 152 | // video state |
| 153 | UINT8 m_hrs; // HR picture start scanline |
| 154 | UINT8 m_fgctl; // HR foreground control |
| 155 | |
| 156 | 156 | // timers |
| 157 | 157 | emu_timer *m_ctc_timer; |
| 158 | 158 | emu_timer *m_cassette_timer; |
| 159 | 159 | }; |
| 160 | 160 | |
| 161 | |
| 162 | // ======================> abc800m_state |
| 163 | |
| 161 | 164 | class abc800m_state : public abc800_state |
| 162 | 165 | { |
| 163 | 166 | public: |
| 164 | | abc800m_state(const machine_config &mconfig, device_type type, const char *tag) |
| 165 | | : abc800_state(mconfig, type, tag), |
| 166 | | m_crtc(*this, MC6845_TAG), |
| 167 | | m_palette(*this, "palette"), |
| 168 | | m_fgctl_prom(*this, "hru2"), |
| 169 | | m_char_rom(*this, MC6845_TAG) |
| 167 | abc800m_state(const machine_config &mconfig, device_type type, const char *tag) : |
| 168 | abc800_state(mconfig, type, tag), |
| 169 | m_crtc(*this, MC6845_TAG), |
| 170 | m_palette(*this, "palette"), |
| 171 | m_fgctl_prom(*this, "hru2"), |
| 172 | m_char_rom(*this, MC6845_TAG) |
| 170 | 173 | { } |
| 171 | 174 | |
| 172 | 175 | required_device<mc6845_device> m_crtc; |
| r29302 | r29303 | |
| 183 | 186 | DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); |
| 184 | 187 | }; |
| 185 | 188 | |
| 189 | |
| 190 | // ======================> abc800c_state |
| 191 | |
| 186 | 192 | class abc800c_state : public abc800_state |
| 187 | 193 | { |
| 188 | 194 | public: |
| 189 | | abc800c_state(const machine_config &mconfig, device_type type, const char *tag) |
| 190 | | : abc800_state(mconfig, type, tag), |
| 191 | | m_trom(*this, SAA5052_TAG), |
| 192 | | m_fgctl_prom(*this, "hru2") |
| 195 | abc800c_state(const machine_config &mconfig, device_type type, const char *tag) : |
| 196 | abc800_state(mconfig, type, tag), |
| 197 | m_trom(*this, SAA5052_TAG), |
| 198 | m_palette(*this, "palette"), |
| 199 | m_fgctl_prom(*this, "hru2") |
| 193 | 200 | { } |
| 194 | 201 | |
| 195 | 202 | required_device<saa5052_device> m_trom; |
| 203 | required_device<palette_device> m_palette; |
| 196 | 204 | required_memory_region m_fgctl_prom; |
| 197 | 205 | |
| 198 | 206 | DECLARE_DRIVER_INIT(driver_init); |
| r29302 | r29303 | |
| 204 | 212 | |
| 205 | 213 | DECLARE_READ8_MEMBER( char_ram_r ); |
| 206 | 214 | DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); |
| 215 | DECLARE_PALETTE_INIT( abc800c ); |
| 207 | 216 | }; |
| 208 | 217 | |
| 218 | |
| 209 | 219 | // ======================> abc802_state |
| 210 | 220 | |
| 211 | 221 | class abc802_state : public abc800_state |
| r29302 | r29303 | |
| 257 | 267 | abc806_state(const machine_config &mconfig, device_type type, const char *tag) |
| 258 | 268 | : abc800_state(mconfig, type, tag), |
| 259 | 269 | m_crtc(*this, MC6845_TAG), |
| 270 | m_palette(*this, "palette"), |
| 260 | 271 | m_rtc(*this, E0516_TAG), |
| 261 | 272 | m_rad_prom(*this, "rad"), |
| 262 | 273 | m_hru2_prom(*this, "hru"), |
| 263 | | m_char_rom(*this, MC6845_TAG) |
| 274 | m_char_rom(*this, MC6845_TAG), |
| 275 | m_attr_ram(*this, "attr_ram") |
| 264 | 276 | { } |
| 265 | 277 | |
| 266 | 278 | required_device<mc6845_device> m_crtc; |
| 279 | required_device<palette_device> m_palette; |
| 267 | 280 | required_device<e0516_device> m_rtc; |
| 268 | 281 | required_memory_region m_rad_prom; |
| 269 | 282 | required_memory_region m_hru2_prom; |
| 270 | 283 | required_memory_region m_char_rom; |
| 284 | optional_shared_ptr<UINT8> m_attr_ram; |
| 271 | 285 | |
| 272 | 286 | DECLARE_DRIVER_INIT(driver_init); |
| 273 | 287 | virtual void machine_start(); |
| r29302 | r29303 | |
| 295 | 309 | DECLARE_WRITE_LINE_MEMBER( hs_w ); |
| 296 | 310 | DECLARE_WRITE_LINE_MEMBER( vs_w ); |
| 297 | 311 | DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); |
| 312 | DECLARE_PALETTE_INIT( abc806 ); |
| 298 | 313 | |
| 299 | 314 | // memory state |
| 300 | 315 | int m_keydtr; // keyboard DTR |
| 301 | 316 | int m_eme; // extended memory enable |
| 302 | | int m_fetch_charram; // opcode fetched from character RAM region (0x7800-0x7fff) |
| 303 | 317 | UINT8 m_map[16]; // memory page register |
| 304 | 318 | |
| 305 | 319 | // video state |
| 306 | | UINT8 *m_color_ram; // attribute RAM |
| 307 | | |
| 308 | 320 | int m_txoff; // text display enable |
| 309 | 321 | int m_40; // 40/80 column mode |
| 310 | 322 | int m_flshclk_ctr; // flash clock counter |
| 311 | 323 | int m_flshclk; // flash clock |
| 312 | 324 | UINT8 m_attr_data; // attribute data latch |
| 313 | | UINT8 m_hrs; // HR memory mapping |
| 314 | 325 | UINT8 m_hrc[16]; // HR palette |
| 315 | 326 | UINT8 m_sync; // line synchronization delay |
| 316 | 327 | UINT8 m_v50_addr; // vertical sync PROM address |
shelves/new_menus/src/mess/video/abc800.c
| r29302 | r29303 | |
| 16 | 16 | #define VERTICAL_PORCH_HACK 29 |
| 17 | 17 | |
| 18 | 18 | |
| 19 | | static const rgb_t PALETTE_ABC[] = |
| 20 | | { |
| 21 | | rgb_t::black, |
| 22 | | rgb_t(0xff, 0x00, 0x00), // red |
| 23 | | rgb_t(0x00, 0xff, 0x00), // green |
| 24 | | rgb_t(0xff, 0xff, 0x00), // yellow |
| 25 | | rgb_t(0x00, 0x00, 0xff), // blue |
| 26 | | rgb_t(0xff, 0x00, 0xff), // magenta |
| 27 | | rgb_t(0x00, 0xff, 0xff), // cyan |
| 28 | | rgb_t::white |
| 29 | | }; |
| 30 | 19 | |
| 31 | | |
| 32 | | |
| 33 | 20 | //************************************************************************** |
| 34 | 21 | // HIGH RESOLUTION GRAPHICS |
| 35 | 22 | //************************************************************************** |
| r29302 | r29303 | |
| 83 | 70 | |
| 84 | 71 | void abc800c_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 85 | 72 | { |
| 73 | const pen_t *pen = m_palette->pens(); |
| 74 | |
| 86 | 75 | UINT16 addr = 0; |
| 87 | 76 | |
| 88 | 77 | for (int y = m_hrs; y < MIN(cliprect.max_y + 1, m_hrs + 480); y += 2) |
| r29302 | r29303 | |
| 106 | 95 | |
| 107 | 96 | if (black || opaque) |
| 108 | 97 | { |
| 109 | | bitmap.pix32(y, x) = PALETTE_ABC[color]; |
| 110 | | bitmap.pix32(y, x + 1) = PALETTE_ABC[color]; |
| 98 | bitmap.pix32(y, x) = pen[color]; |
| 99 | bitmap.pix32(y, x + 1) = pen[color]; |
| 111 | 100 | |
| 112 | | bitmap.pix32(y + 1, x) = PALETTE_ABC[color]; |
| 113 | | bitmap.pix32(y + 1, x + 1) = PALETTE_ABC[color]; |
| 101 | bitmap.pix32(y + 1, x) = pen[color]; |
| 102 | bitmap.pix32(y + 1, x + 1) = pen[color]; |
| 114 | 103 | } |
| 115 | 104 | } |
| 116 | 105 | |
| r29302 | r29303 | |
| 161 | 150 | return m_char_ram[translate_trom_offset(offset)]; |
| 162 | 151 | } |
| 163 | 152 | |
| 164 | | static SAA5050_INTERFACE( trom_intf ) |
| 153 | |
| 154 | //------------------------------------------------- |
| 155 | // PALETTE_INIT( abc800c ) |
| 156 | //------------------------------------------------- |
| 157 | |
| 158 | PALETTE_INIT_MEMBER( abc800c_state, abc800c ) |
| 165 | 159 | { |
| 166 | | DEVCB_DRIVER_MEMBER(abc800c_state, char_ram_r), |
| 167 | | 40, 24, 40 // x, y, size |
| 168 | | }; |
| 160 | palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black |
| 161 | palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red |
| 162 | palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green |
| 163 | palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow |
| 164 | palette.set_pen_color(4, rgb_t(0x00, 0x00, 0xff)); // blue |
| 165 | palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); // magenta |
| 166 | palette.set_pen_color(6, rgb_t(0x00, 0xff, 0xff)); // cyan |
| 167 | palette.set_pen_color(7, rgb_t(0xff, 0xff, 0xff)); // white |
| 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | //------------------------------------------------- |
| r29302 | r29303 | |
| 175 | 175 | MACHINE_CONFIG_FRAGMENT( abc800c_video ) |
| 176 | 176 | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 177 | 177 | MCFG_SCREEN_UPDATE_DRIVER(abc800c_state, screen_update) |
| 178 | | |
| 179 | 178 | MCFG_SCREEN_REFRESH_RATE(50) |
| 180 | 179 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 181 | 180 | MCFG_SCREEN_SIZE(480, 480) |
| 182 | 181 | MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 480-1) |
| 183 | 182 | |
| 184 | | MCFG_SAA5052_ADD(SAA5052_TAG, XTAL_12MHz/2, trom_intf) |
| 183 | MCFG_PALETTE_ADD("palette", 8) |
| 184 | MCFG_PALETTE_INIT_OWNER(abc800c_state, abc800c) |
| 185 | |
| 186 | MCFG_DEVICE_ADD(SAA5052_TAG, SAA5052, XTAL_12MHz/2) |
| 187 | MCFG_SAA5050_D_CALLBACK(READ8(abc800c_state, char_ram_r)) |
| 188 | MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) |
| 185 | 189 | MACHINE_CONFIG_END |
| 186 | 190 | |
| 187 | 191 | |
| r29302 | r29303 | |
| 271 | 275 | |
| 272 | 276 | static MC6845_INTERFACE( crtc_intf ) |
| 273 | 277 | { |
| 274 | | false, |
| 278 | true, |
| 275 | 279 | 0,0,0,0, |
| 276 | 280 | ABC800_CHAR_WIDTH, |
| 277 | 281 | NULL, |
| r29302 | r29303 | |
| 291 | 295 | |
| 292 | 296 | UINT32 abc800m_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 293 | 297 | { |
| 294 | | // HACK expand visible area to workaround MC6845 |
| 295 | | screen.set_visible_area(0, 767, 0, 311); |
| 296 | | |
| 297 | 298 | // clear screen |
| 298 | 299 | bitmap.fill(rgb_t::black, cliprect); |
| 299 | 300 | |
shelves/new_menus/src/mess/video/abc806.c
| r29302 | r29303 | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | | // these are needed because the MC6845 emulation does |
| 24 | | // not position the active display area correctly |
| 25 | 23 | #define HORIZONTAL_PORCH_HACK 109 |
| 26 | 24 | #define VERTICAL_PORCH_HACK 27 |
| 27 | 25 | |
| 28 | 26 | |
| 29 | | static const rgb_t PALETTE_ABC[] = |
| 30 | | { |
| 31 | | rgb_t::black, // black |
| 32 | | rgb_t(0xff, 0x00, 0x00), // red |
| 33 | | rgb_t(0x00, 0xff, 0x00), // green |
| 34 | | rgb_t(0xff, 0xff, 0x00), // yellow |
| 35 | | rgb_t(0x00, 0x00, 0xff), // blue |
| 36 | | rgb_t(0xff, 0x00, 0xff), // magenta |
| 37 | | rgb_t(0x00, 0xff, 0xff), // cyan |
| 38 | | rgb_t::white // white |
| 39 | | }; |
| 40 | 27 | |
| 41 | | |
| 42 | 28 | //------------------------------------------------- |
| 43 | 29 | // hrs_w - high resolution memory banking |
| 44 | 30 | //------------------------------------------------- |
| r29302 | r29303 | |
| 82 | 68 | |
| 83 | 69 | READ8_MEMBER( abc806_state::charram_r ) |
| 84 | 70 | { |
| 85 | | m_attr_data = m_color_ram[offset]; |
| 71 | m_attr_data = m_attr_ram[offset]; |
| 86 | 72 | |
| 87 | 73 | return m_char_ram[offset]; |
| 88 | 74 | } |
| r29302 | r29303 | |
| 94 | 80 | |
| 95 | 81 | WRITE8_MEMBER( abc806_state::charram_w ) |
| 96 | 82 | { |
| 97 | | m_color_ram[offset] = m_attr_data; |
| 83 | m_attr_ram[offset] = m_attr_data; |
| 98 | 84 | |
| 99 | 85 | m_char_ram[offset] = data; |
| 100 | 86 | } |
| r29302 | r29303 | |
| 239 | 225 | static MC6845_UPDATE_ROW( abc806_update_row ) |
| 240 | 226 | { |
| 241 | 227 | abc806_state *state = device->machine().driver_data<abc806_state>(); |
| 228 | const pen_t *pen = state->m_palette->pens(); |
| 242 | 229 | |
| 243 | 230 | // UINT8 old_data = 0xff; |
| 244 | 231 | int fg_color = 7; |
| r29302 | r29303 | |
| 254 | 241 | for (int column = 0; column < x_count; column++) |
| 255 | 242 | { |
| 256 | 243 | UINT8 data = state->m_char_ram[(ma + column) & 0x7ff]; |
| 257 | | UINT8 attr = state->m_color_ram[(ma + column) & 0x7ff]; |
| 244 | UINT8 attr = state->m_attr_ram[(ma + column) & 0x7ff]; |
| 258 | 245 | UINT16 rad_addr; |
| 259 | 246 | UINT8 rad_data; |
| 260 | 247 | |
| r29302 | r29303 | |
| 283 | 270 | e6 = BIT(attr, 1); |
| 284 | 271 | |
| 285 | 272 | // read attributes from next byte |
| 286 | | attr = state->m_color_ram[(ma + column + 1) & 0x7ff]; |
| 273 | attr = state->m_attr_ram[(ma + column + 1) & 0x7ff]; |
| 287 | 274 | |
| 288 | 275 | if (attr != 0x00) |
| 289 | 276 | { |
| r29302 | r29303 | |
| 327 | 314 | int color = BIT(chargen_data, 7) ? fg_color : bg_color; |
| 328 | 315 | if (!de) color = 0; |
| 329 | 316 | |
| 330 | | bitmap.pix32(y, x++) = PALETTE_ABC[color]; |
| 317 | bitmap.pix32(y, x++) = pen[color]; |
| 331 | 318 | |
| 332 | 319 | if (e5 || e6) |
| 333 | 320 | { |
| 334 | | bitmap.pix32(y, x++) = PALETTE_ABC[color]; |
| 321 | bitmap.pix32(y, x++) = pen[color]; |
| 335 | 322 | } |
| 336 | 323 | |
| 337 | 324 | chargen_data <<= 1; |
| r29302 | r29303 | |
| 431 | 418 | |
| 432 | 419 | void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 433 | 420 | { |
| 421 | const pen_t *pen = m_palette->pens(); |
| 422 | |
| 434 | 423 | UINT32 addr = (m_hrs & 0x0f) << 15; |
| 435 | 424 | |
| 436 | 425 | for (int y = m_sync + VERTICAL_PORCH_HACK; y < MIN(cliprect.max_y + 1, m_sync + VERTICAL_PORCH_HACK + 240); y++) |
| r29302 | r29303 | |
| 446 | 435 | |
| 447 | 436 | if (BIT(dot, 15) || (bitmap.pix32(y, x) == rgb_t::black)) |
| 448 | 437 | { |
| 449 | | bitmap.pix32(y, x) = PALETTE_ABC[(dot >> 12) & 0x07]; |
| 438 | bitmap.pix32(y, x) = pen[(dot >> 12) & 0x07]; |
| 450 | 439 | } |
| 451 | 440 | |
| 452 | 441 | dot <<= 4; |
| r29302 | r29303 | |
| 471 | 460 | |
| 472 | 461 | // allocate memory |
| 473 | 462 | m_char_ram.allocate(ABC806_CHAR_RAM_SIZE); |
| 474 | | m_color_ram = auto_alloc_array(machine(), UINT8, ABC806_ATTR_RAM_SIZE); |
| 463 | m_attr_ram.allocate(ABC806_ATTR_RAM_SIZE); |
| 475 | 464 | |
| 476 | 465 | // register for state saving |
| 477 | | save_pointer(NAME(m_char_ram.target()), ABC806_CHAR_RAM_SIZE); |
| 478 | | save_pointer(NAME(m_color_ram), ABC806_ATTR_RAM_SIZE); |
| 479 | | save_pointer(NAME(m_video_ram.target()), ABC806_VIDEO_RAM_SIZE); |
| 480 | 466 | save_item(NAME(m_txoff)); |
| 481 | 467 | save_item(NAME(m_40)); |
| 482 | 468 | save_item(NAME(m_flshclk_ctr)); |
| r29302 | r29303 | |
| 499 | 485 | |
| 500 | 486 | UINT32 abc806_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 501 | 487 | { |
| 502 | | // HACK expand visible area to workaround MC6845 |
| 503 | | screen.set_visible_area(0, 767, 0, 311); |
| 504 | | |
| 505 | 488 | // clear screen |
| 506 | 489 | bitmap.fill(rgb_t::black, cliprect); |
| 507 | 490 | |
| r29302 | r29303 | |
| 519 | 502 | |
| 520 | 503 | |
| 521 | 504 | //------------------------------------------------- |
| 505 | // PALETTE_INIT( abc806 ) |
| 506 | //------------------------------------------------- |
| 507 | |
| 508 | PALETTE_INIT_MEMBER( abc806_state, abc806 ) |
| 509 | { |
| 510 | palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black |
| 511 | palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red |
| 512 | palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green |
| 513 | palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow |
| 514 | palette.set_pen_color(4, rgb_t(0x00, 0x00, 0xff)); // blue |
| 515 | palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); // magenta |
| 516 | palette.set_pen_color(6, rgb_t(0x00, 0xff, 0xff)); // cyan |
| 517 | palette.set_pen_color(7, rgb_t(0xff, 0xff, 0xff)); // white |
| 518 | } |
| 519 | |
| 520 | |
| 521 | //------------------------------------------------- |
| 522 | 522 | // MACHINE_CONFIG_FRAGMENT( abc806_video ) |
| 523 | 523 | //------------------------------------------------- |
| 524 | 524 | |
| r29302 | r29303 | |
| 527 | 527 | |
| 528 | 528 | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 529 | 529 | MCFG_SCREEN_UPDATE_DRIVER(abc806_state, screen_update) |
| 530 | | |
| 531 | 530 | MCFG_SCREEN_REFRESH_RATE(60) |
| 532 | 531 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 533 | 532 | MCFG_SCREEN_SIZE(768, 312) |
| 534 | 533 | MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 312-1) |
| 534 | |
| 535 | MCFG_PALETTE_ADD("palette", 8) |
| 536 | MCFG_PALETTE_INIT_OWNER(abc806_state, abc806) |
| 535 | 537 | MACHINE_CONFIG_END |