src/mess/machine/aim65.c
| r14150 | r14151 | |
| 140 | 140 | |
| 141 | 141 | MACHINE_START( aim65 ) |
| 142 | 142 | { |
| 143 | aim65_state *state = machine.driver_data<aim65_state>(); |
| 143 | 144 | ram_device *ram = machine.device<ram_device>(RAM_TAG); |
| 144 | 145 | address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 145 | 146 | |
| 146 | 147 | /* Init RAM */ |
| 147 | 148 | space->install_ram(0x0000, ram->size() - 1, ram->pointer()); |
| 149 | |
| 150 | state->m_pb_save = 0; |
| 148 | 151 | } |
| 149 | 152 | |
| 150 | 153 | |
| r14150 | r14151 | |
| 158 | 161 | * connector for off-board RESET functions. The Monitor performs a software |
| 159 | 162 | * reset when the RES line goes high. |
| 160 | 163 | */ |
| 164 | |
| 165 | |
| 166 | /****************************************************************************** |
| 167 | Cassette |
| 168 | ******************************************************************************/ |
| 169 | |
| 170 | WRITE8_MEMBER( aim65_state::aim65_pb_w ) |
| 171 | { |
| 172 | /* |
| 173 | d7 = cass out (both decks) |
| 174 | d5 = cass2 motor |
| 175 | d4 = cass1 motor |
| 176 | d2 = tty out (not emulated) |
| 177 | d0/1 = printer data (not emulated) |
| 178 | */ |
| 179 | |
| 180 | UINT8 bits = data ^ m_pb_save; |
| 181 | m_pb_save = data; |
| 182 | |
| 183 | if (BIT(bits, 7)) |
| 184 | { |
| 185 | m_cass1->output(BIT(data, 7) ? -1.0 : +1.0); |
| 186 | m_cass2->output(BIT(data, 7) ? -1.0 : +1.0); |
| 187 | } |
| 188 | |
| 189 | if (BIT(bits, 5)) |
| 190 | { |
| 191 | if (BIT(data, 5)) |
| 192 | m_cass2->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| 193 | else |
| 194 | m_cass2->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); |
| 195 | } |
| 196 | |
| 197 | if (BIT(bits, 4)) |
| 198 | { |
| 199 | if (BIT(data, 4)) |
| 200 | m_cass1->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| 201 | else |
| 202 | m_cass1->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | |
| 207 | READ8_MEMBER( aim65_state::aim65_pb_r ) |
| 208 | { |
| 209 | /* |
| 210 | d7 = cassette in (deck 1) |
| 211 | d6 = tty in (not emulated) |
| 212 | d3 = kb/tty switch |
| 213 | */ |
| 214 | |
| 215 | UINT8 data = input_port_read(machine(), "switches"); |
| 216 | data |= (m_cass1->input() > +0.03) ? 0x80 : 0; |
| 217 | data |= 0x40; // TTY must be H if not used. |
| 218 | data |= m_pb_save & 0x37; |
| 219 | return data; |
| 220 | } |
| 221 | |
| 222 | |
| 223 | /****************************************************************************** |
| 224 | Printer |
| 225 | ******************************************************************************/ |
| 226 | |
| 227 | #ifdef UNUSED_FUNCTION |
| 228 | /* |
| 229 | |
| 230 | 2012-01-24 Printer code removed [Robbbert] |
| 231 | |
| 232 | From here to the end is not compiled. It is the remnants of the old printer |
| 233 | code. Have a look at version 0.114 or 0.115 for the original working code. |
| 234 | |
| 235 | I've left it here for the idly curious. |
| 236 | |
| 237 | The system sends out the pattern of dots to the 'dot-matrix' print-head. |
| 238 | |
| 239 | This is why we can't simply replace it with a Centronics-like 'Printer' |
| 240 | device - the output will be gibberish. |
| 241 | */ |
| 242 | |
| 243 | |
| 244 | |
| 245 | /* |
| 246 | aim65 thermal printer (20 characters) |
| 247 | 10 heat elements (place on 1 line, space between 2 characters(about 14dots)) |
| 248 | (pa0..pa7,pb0,pb1 1 heat element on) |
| 249 | |
| 250 | cb2 0 motor, heat elements on |
| 251 | cb1 output start!? |
| 252 | ca1 input |
| 253 | |
| 254 | normally printer 5x7 characters |
| 255 | (horizontal movement limits not known, normally 2 dots between characters) |
| 256 | |
| 257 | 3 dots space between lines? |
| 258 | */ |
| 259 | |
| 260 | |
| 261 | /* Part of aim65_pb_w |
| 262 | |
| 263 | data &= 0x03; |
| 264 | |
| 265 | if (m_flag_b == 0) |
| 266 | { |
| 267 | printerRAM[(m_printer_y * 20) + m_printer_x ] |= (data << 8); |
| 268 | m_flag_b = 1; |
| 269 | } |
| 270 | */ |
| 271 | |
| 272 | |
| 273 | /* Items for driver state |
| 274 | |
| 275 | emu_timer *m_print_timer; |
| 276 | int m_printer_x; |
| 277 | int m_printer_y; |
| 278 | bool m_printer_dir; |
| 279 | bool m_flag_a; |
| 280 | bool m_flag_b; |
| 281 | bool m_printer_level; |
| 282 | UINT16 *m_printerRAM; |
| 283 | */ |
| 284 | |
| 285 | |
| 286 | /* Other items from H file |
| 287 | VIDEO_START( aim65 ); |
| 288 | VIDEO_UPDATE( aim65 ); |
| 289 | */ |
| 290 | |
| 291 | |
| 292 | /* From 6522 config |
| 293 | DRIVER_MEMBER(aim65_state, aim65_pa_w), // out port A |
| 294 | DRIVER_MEMBER(aim65_state, aim65_printer_on), // out CB2 |
| 295 | */ |
| 296 | |
| 297 | |
| 298 | /* From Machine Config |
| 299 | MCFG_VIDEO_START(aim65) |
| 300 | MCFG_VIDEO_UPDATE(aim65) |
| 301 | */ |
| 302 | |
| 303 | |
| 304 | static TIMER_CALLBACK(aim65_printer_timer) |
| 305 | { |
| 306 | aim65_state *state = machine.driver_data<aim65_state>(); |
| 307 | via6522_device *via_0 = machine.device<via6522_device>("via6522_0"); |
| 308 | |
| 309 | via_0->write_cb1(state->m_printer_level); |
| 310 | via_0->write_cb1(!state->m_printer_level); |
| 311 | state->m_printer_level ^= 1; |
| 312 | |
| 313 | if (state->m_printer_dir) |
| 314 | { |
| 315 | if (state->m_printer_x > 0) |
| 316 | state->m_printer_x--; |
| 317 | else |
| 318 | { |
| 319 | state->m_printer_dir = 0; |
| 320 | state->m_printer_x++; |
| 321 | state->m_printer_y++; |
| 322 | } |
| 323 | } |
| 324 | else |
| 325 | { |
| 326 | if (state->m_printer_x < 9) |
| 327 | state->m_printer_x++; |
| 328 | else |
| 329 | { |
| 330 | state->m_printer_dir = 1; |
| 331 | state->m_printer_x--; |
| 332 | state->m_printer_y++; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | if (state->m_printer_y > 500) state->m_printer_y = 0; |
| 337 | |
| 338 | state->m_flag_a=0; |
| 339 | state->m_flag_b=0; |
| 340 | } |
| 341 | |
| 342 | |
| 343 | WRITE8_MEMBER( aim65_state::aim65_printer_on ) |
| 344 | { |
| 345 | via6522_device *via_0 = machine().device<via6522_device>("via6522_0"); |
| 346 | if (!data) |
| 347 | { |
| 348 | m_printer_x=0; |
| 349 | m_printer_y++; |
| 350 | if (m_printer_y > 500) m_printer_y = 0; |
| 351 | m_flag_a = m_flag_b=0; |
| 352 | via_0->write_cb1(0); |
| 353 | m_print_timer->adjust(attotime::zero, 0, attotime::from_usec(10)); |
| 354 | m_printer_level = 1; |
| 355 | } |
| 356 | else |
| 357 | m_print_timer->reset(); |
| 358 | } |
| 359 | |
| 360 | |
| 361 | WRITE8_MEMBER( aim65_state::aim65_pa_w ) |
| 362 | { |
| 363 | // All bits are for printer data (not emulated) |
| 364 | if (m_flag_a == 0) |
| 365 | { |
| 366 | m_printerRAM[(m_printer_y * 20) + m_printer_x] |= data; |
| 367 | m_flag_a = 1; |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | VIDEO_START( aim65 ) |
| 372 | { |
| 373 | aim65_state *state = machine.driver_data<aim65_state>(); |
| 374 | state->m_print_timer = machine.scheduler().timer_alloc(FUNC(aim65_printer_timer)); |
| 375 | state->m_printerRAM = auto_alloc_array(machine, UINT16, (600 * 10 * 2) / 2); |
| 376 | memset(state->m_printerRAM, 0, videoram_size); |
| 377 | VIDEO_START_CALL(generic); |
| 378 | state->m_printer_x = 0; |
| 379 | state->m_printer_y = 0; |
| 380 | state->m_printer_dir = 0; |
| 381 | state->m_flag_a = 0; |
| 382 | state->m_flag_b = 0; |
| 383 | state->m_printer_level = 0; |
| 384 | } |
| 385 | |
| 386 | SCREEN_UPDATE( aim65 ) |
| 387 | { |
| 388 | aim65_state *state = screen.machine().driver_data<aim65_state>(); |
| 389 | /* Display printer output */ |
| 390 | bool dir = 1; |
| 391 | UINT8 b,x,pen; |
| 392 | UINT16 y; |
| 393 | |
| 394 | for (y = 0; y<500; y++) |
| 395 | { |
| 396 | for(x = 0; x< 10; x++) |
| 397 | { |
| 398 | if (dir == 1) |
| 399 | data = state->m_printerRAM[y * 10 + x]; |
| 400 | else |
| 401 | data = state->m_printerRAM[(y * 10) + (9 - x)]; |
| 402 | |
| 403 | |
| 404 | for (b = 0; b<10; b++) |
| 405 | { |
| 406 | pen = screen.machine().pens[BIT(data, 0) ? 2 : 0]; |
| 407 | plot_pixel(bitmap,700 - ((b * 10) + x), y, pen); |
| 408 | data >>= 1; |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | dir ^= 1; |
| 413 | } |
| 414 | return 0; |
| 415 | } |
| 416 | |
| 417 | |
| 418 | #endif |
| 419 | |
src/mess/video/aim65.c
| r14150 | r14151 | |
| 1 | | /****************************************************************************** |
| 2 | | |
| 3 | | PeT mess@utanet.at Nov 2000 |
| 4 | | Updated by Dan Boris, 3/4/2007 |
| 5 | | |
| 6 | | ******************************************************************************/ |
| 7 | | |
| 8 | | #include "includes/aim65.h" |
| 9 | | |
| 10 | | //UINT16 *printerRAM; |
| 11 | | |
| 12 | | |
| 13 | | |
| 14 | | |
| 15 | | /****************************************************************************** |
| 16 | | Printer |
| 17 | | ******************************************************************************/ |
| 18 | | |
| 19 | | /* |
| 20 | | aim65 thermal printer (20 characters) |
| 21 | | 10 heat elements (place on 1 line, space between 2 characters(about 14dots)) |
| 22 | | (pa0..pa7,pb0,pb1 1 heat element on) |
| 23 | | |
| 24 | | cb2 0 motor, heat elements on |
| 25 | | cb1 output start!? |
| 26 | | ca1 input |
| 27 | | |
| 28 | | normally printer 5x7 characters |
| 29 | | (horizontal movement limits not known, normally 2 dots between characters) |
| 30 | | |
| 31 | | 3 dots space between lines? |
| 32 | | */ |
| 33 | | |
| 34 | | |
| 35 | | static TIMER_CALLBACK(aim65_printer_timer) |
| 36 | | { |
| 37 | | aim65_state *state = machine.driver_data<aim65_state>(); |
| 38 | | via6522_device *via_0 = machine.device<via6522_device>("via6522_0"); |
| 39 | | |
| 40 | | via_0->write_cb1(state->m_printer_level); |
| 41 | | via_0->write_cb1(!state->m_printer_level); |
| 42 | | state->m_printer_level ^= 1; |
| 43 | | |
| 44 | | if (state->m_printer_dir) |
| 45 | | { |
| 46 | | if (state->m_printer_x > 0) |
| 47 | | state->m_printer_x--; |
| 48 | | else |
| 49 | | { |
| 50 | | state->m_printer_dir = 0; |
| 51 | | state->m_printer_x++; |
| 52 | | state->m_printer_y++; |
| 53 | | } |
| 54 | | } |
| 55 | | else |
| 56 | | { |
| 57 | | if (state->m_printer_x < 9) |
| 58 | | state->m_printer_x++; |
| 59 | | else |
| 60 | | { |
| 61 | | state->m_printer_dir = 1; |
| 62 | | state->m_printer_x--; |
| 63 | | state->m_printer_y++; |
| 64 | | } |
| 65 | | } |
| 66 | | |
| 67 | | if (state->m_printer_y > 500) state->m_printer_y = 0; |
| 68 | | |
| 69 | | state->m_flag_a=0; |
| 70 | | state->m_flag_b=0; |
| 71 | | } |
| 72 | | |
| 73 | | |
| 74 | | WRITE8_MEMBER( aim65_state::aim65_printer_on ) |
| 75 | | { |
| 76 | | via6522_device *via_0 = machine().device<via6522_device>("via6522_0"); |
| 77 | | if (!data) |
| 78 | | { |
| 79 | | m_printer_x=0; |
| 80 | | m_printer_y++; |
| 81 | | if (m_printer_y > 500) m_printer_y = 0; |
| 82 | | m_flag_a = m_flag_b=0; |
| 83 | | via_0->write_cb1(0); |
| 84 | | //m_print_timer->adjust(attotime::zero, 0, attotime::from_usec(10)); |
| 85 | | m_printer_level = 1; |
| 86 | | } |
| 87 | | else |
| 88 | | { |
| 89 | | m_print_timer->reset(); |
| 90 | | } |
| 91 | | } |
| 92 | | |
| 93 | | |
| 94 | | WRITE8_MEMBER( aim65_state::aim65_pa_w ) |
| 95 | | { |
| 96 | | // All bits are for printer data (not emulated) |
| 97 | | #if 0 |
| 98 | | if (m_flag_a == 0) |
| 99 | | { |
| 100 | | printerRAM[(m_printer_y * 20) + m_printer_x] |= data; |
| 101 | | m_flag_a = 1; |
| 102 | | } |
| 103 | | #endif |
| 104 | | } |
| 105 | | |
| 106 | | WRITE8_MEMBER( aim65_state::aim65_pb_w ) |
| 107 | | { |
| 108 | | /* |
| 109 | | d7 = cass out (both decks) |
| 110 | | d5 = cass2 motor |
| 111 | | d4 = cass1 motor |
| 112 | | d2 = tty out (not emulated) |
| 113 | | d0/1 = printer data (not emulated) |
| 114 | | */ |
| 115 | | |
| 116 | | UINT8 bits = data ^ m_pb_save; |
| 117 | | m_pb_save = data; |
| 118 | | |
| 119 | | if (BIT(bits, 7)) |
| 120 | | { |
| 121 | | m_cass1->output(BIT(data, 7) ? -1.0 : +1.0); |
| 122 | | m_cass2->output(BIT(data, 7) ? -1.0 : +1.0); |
| 123 | | } |
| 124 | | |
| 125 | | if (BIT(bits, 5)) |
| 126 | | { |
| 127 | | if (BIT(data, 5)) |
| 128 | | m_cass2->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| 129 | | else |
| 130 | | m_cass2->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); |
| 131 | | } |
| 132 | | |
| 133 | | if (BIT(bits, 4)) |
| 134 | | { |
| 135 | | if (BIT(data, 4)) |
| 136 | | m_cass1->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| 137 | | else |
| 138 | | m_cass1->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); |
| 139 | | } |
| 140 | | |
| 141 | | |
| 142 | | #if 0 |
| 143 | | data &= 0x03; |
| 144 | | |
| 145 | | if (m_flag_b == 0) |
| 146 | | { |
| 147 | | printerRAM[(m_printer_y * 20) + m_printer_x ] |= (data << 8); |
| 148 | | m_flag_b = 1; |
| 149 | | } |
| 150 | | #endif |
| 151 | | } |
| 152 | | |
| 153 | | VIDEO_START( aim65 ) |
| 154 | | { |
| 155 | | aim65_state *state = machine.driver_data<aim65_state>(); |
| 156 | | state->m_print_timer = machine.scheduler().timer_alloc(FUNC(aim65_printer_timer)); |
| 157 | | |
| 158 | | #if 0 |
| 159 | | videoram_size = 600 * 10 * 2; |
| 160 | | printerRAM = auto_alloc_array(machine, UINT16, videoram_size / 2); |
| 161 | | memset(printerRAM, 0, videoram_size); |
| 162 | | VIDEO_START_CALL(generic); |
| 163 | | #endif |
| 164 | | state->m_printer_x = 0; |
| 165 | | state->m_printer_y = 0; |
| 166 | | state->m_printer_dir = 0; |
| 167 | | state->m_flag_a = 0; |
| 168 | | state->m_flag_b = 0; |
| 169 | | state->m_printer_level = 0; |
| 170 | | state->m_pb_save = 0; |
| 171 | | } |
| 172 | | |
| 173 | | |
| 174 | | #ifdef UNUSED_FUNCTION |
| 175 | | SCREEN_UPDATE( aim65 ) |
| 176 | | { |
| 177 | | /* Display printer output */ |
| 178 | | dir = 1; |
| 179 | | for(y = 0; y<500;y++) |
| 180 | | { |
| 181 | | for(x = 0; x< 10; x++) |
| 182 | | { |
| 183 | | if (dir == 1) { |
| 184 | | data = printerRAM[y * 10 + x]; |
| 185 | | } |
| 186 | | else { |
| 187 | | data = printerRAM[(y * 10) + (9 - x)]; |
| 188 | | } |
| 189 | | |
| 190 | | |
| 191 | | for (b = 0; b<10; b++) |
| 192 | | { |
| 193 | | color=machine.pens[(data & 0x1)?2:0]; |
| 194 | | plot_pixel(bitmap,700 - ((b * 10) + x), y,color); |
| 195 | | data = data >> 1; |
| 196 | | } |
| 197 | | } |
| 198 | | |
| 199 | | if (dir == 0) |
| 200 | | dir = 1; |
| 201 | | else |
| 202 | | dir = 0; |
| 203 | | } |
| 204 | | return 0; |
| 205 | | } |
| 206 | | #endif |
| 207 | | |
| 208 | | |
| 209 | | READ8_MEMBER( aim65_state::aim65_pb_r ) |
| 210 | | { |
| 211 | | /* |
| 212 | | d7 = cassette in (deck 1) |
| 213 | | d6 = tty in (not emulated) |
| 214 | | d3 = kb/tty switch |
| 215 | | */ |
| 216 | | |
| 217 | | UINT8 data = input_port_read(machine(), "switches"); |
| 218 | | data |= (m_cass1->input() > +0.03) ? 0x80 : 0; |
| 219 | | data |= 0x40; // TTY must be H if not used. |
| 220 | | data |= m_pb_save & 0x37; |
| 221 | | return data; |
| 222 | | } |
| 223 | | |
src/mess/drivers/aim65.c
| r14150 | r14151 | |
| 163 | 163 | DEVCB_NULL, // in CB1 |
| 164 | 164 | DEVCB_NULL, // in CA2 |
| 165 | 165 | DEVCB_NULL, // in CB2 |
| 166 | | DEVCB_DRIVER_MEMBER(aim65_state, aim65_pa_w), // out port A |
| 166 | DEVCB_NULL, // out Port A |
| 167 | 167 | DEVCB_DRIVER_MEMBER(aim65_state, aim65_pb_w), // out port B |
| 168 | 168 | DEVCB_NULL, // out CA1 |
| 169 | 169 | DEVCB_NULL, // out CB1 printer start |
| 170 | 170 | DEVCB_NULL, // out CA2 cass control (H=in) |
| 171 | | DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_on), // out CB2 |
| 171 | DEVCB_NULL, // out CB2 turn printer on |
| 172 | 172 | DEVCB_CPU_INPUT_LINE("maincpu", M6502_IRQ_LINE) //IRQ |
| 173 | 173 | }; |
| 174 | 174 | |
| r14150 | r14151 | |
| 248 | 248 | MCFG_DL1416T_ADD("ds4", aim65_update_ds4) |
| 249 | 249 | MCFG_DL1416T_ADD("ds5", aim65_update_ds5) |
| 250 | 250 | |
| 251 | | MCFG_VIDEO_START(aim65) |
| 252 | | |
| 253 | 251 | /* Sound - wave sound only */ |
| 254 | 252 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 255 | 253 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG) |