~ubuntu-branches/ubuntu/utopic/vice/utopic

« back to all changes in this revision

Viewing changes to src/cbm2/cbm5x0.c

  • Committer: Package Import Robot
  • Author(s): Logan Rosen
  • Date: 2014-05-10 21:08:23 UTC
  • mfrom: (17.2.1 utopic-proposed)
  • Revision ID: package-import@ubuntu.com-20140510210823-r7x98jmpl1x7rgop
Tags: 2.4.dfsg+2.4.6-1ubuntu1
Use autotools-dev to update config.{sub,guess} for new arches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
#ifndef COMMON_KBD
132
132
        || pet_kbd_resources_init() < 0
133
133
#endif
134
 
        )
 
134
        ) {
135
135
        return -1;
 
136
    }
136
137
    return 0;
137
138
}
138
139
 
165
166
#ifndef COMMON_KBD
166
167
        || pet_kbd_cmdline_options_init() < 0
167
168
#endif
168
 
        )
 
169
        ) {
169
170
        return -1;
 
171
    }
170
172
 
171
173
    return 0;
172
174
}
184
186
static alarm_t *c500_powerline_clk_alarm = NULL;
185
187
static CLOCK c500_powerline_clk = 0;
186
188
 
187
 
static void c500_powerline_clk_alarm_handler(CLOCK offset, void *data) {
188
 
 
 
189
static void c500_powerline_clk_alarm_handler(CLOCK offset, void *data)
 
190
{
189
191
    c500_powerline_clk += C500_POWERLINE_CYCLES_PER_IRQ;
190
192
 
191
193
    SIGNAL_VERT_BLANK_OFF
193
195
    alarm_set(c500_powerline_clk_alarm, c500_powerline_clk);
194
196
 
195
197
    SIGNAL_VERT_BLANK_ON
196
 
 
197
198
}
198
199
 
199
200
static void c500_powerline_clk_overflow_callback(CLOCK sub, void *data)
221
222
 
222
223
    m = snapshot_module_create(p, module_name, C500DATA_DUMP_VER_MAJOR,
223
224
                               C500DATA_DUMP_VER_MINOR);
224
 
    if (m == NULL)
 
225
    if (m == NULL) {
225
226
        return -1;
 
227
    }
226
228
 
227
229
    SMW_DW(m, c500_powerline_clk - maincpu_clk);
228
230
 
238
240
    DWORD dword;
239
241
 
240
242
    m = snapshot_module_open(p, module_name, &vmajor, &vminor);
241
 
    if (m == NULL)
 
243
    if (m == NULL) {
242
244
        return -1;
 
245
    }
243
246
 
244
247
    if (vmajor != C500DATA_DUMP_VER_MAJOR) {
245
248
        snapshot_module_close(m);
264
267
    monitor_interface_t *drive_interface_init[DRIVE_NUM];
265
268
    monitor_cpu_type_t *asmarray[2];
266
269
 
267
 
    asmarray[0]=&asm6502;
268
 
    asmarray[1]=NULL;
 
270
    asmarray[0] = &asm6502;
 
271
    asmarray[1] = NULL;
269
272
 
270
273
    asm6502_init(&asm6502);
271
274
 
272
 
    for (dnr = 0; dnr < DRIVE_NUM; dnr++)
 
275
    for (dnr = 0; dnr < DRIVE_NUM; dnr++) {
273
276
        drive_interface_init[dnr] = drivecpu_monitor_interface_get(dnr);
 
277
    }
274
278
 
275
279
    /* Initialize the monitor.  */
276
280
    monitor_init(maincpu_monitor_interface_get(), drive_interface_init,
295
299
    /* Setup trap handling - must be before mem_load() */
296
300
    traps_init();
297
301
 
298
 
    if (mem_load() < 0)
 
302
    if (mem_load() < 0) {
299
303
        return -1;
 
304
    }
300
305
 
301
306
    rs232drv_init();
302
307
 
303
308
    /* initialize print devices */
304
309
    printer_init();
305
310
 
306
 
    if (vicii_init(VICII_STANDARD) == NULL)
 
311
    if (vicii_init(VICII_STANDARD) == NULL) {
307
312
        return -1;
 
313
    }
308
314
    /*
309
315
    c500_set_phi1_bank(15);
310
316
    c500_set_phi2_bank(15);
311
317
    */
312
318
 
313
319
    c500_powerline_clk_alarm = alarm_new(maincpu_alarm_context,
314
 
                                            "C500PowerlineClk",
315
 
                                            c500_powerline_clk_alarm_handler,
316
 
                                            NULL);
 
320
                                         "C500PowerlineClk",
 
321
                                         c500_powerline_clk_alarm_handler,
 
322
                                         NULL);
317
323
    clk_guard_add_callback(maincpu_clk_guard,
318
 
                            c500_powerline_clk_overflow_callback, NULL);
 
324
                           c500_powerline_clk_overflow_callback, NULL);
319
325
    machine_timing.cycles_per_sec = C500_PAL_CYCLES_PER_SEC;
320
326
    machine_timing.rfsh_per_sec = C500_PAL_RFSH_PER_SEC;
321
327
    machine_timing.cycles_per_rfsh = C500_PAL_CYCLES_PER_RFSH;
327
333
 
328
334
#ifndef COMMON_KBD
329
335
    /* Initialize the keyboard.  */
330
 
    if (cbm2_kbd_init() < 0)
 
336
    if (cbm2_kbd_init() < 0) {
331
337
        return -1;
 
338
    }
332
339
#endif
333
340
 
334
341
    /* Initialize the datasette emulation.  */
470
477
void machine_get_line_cycle(unsigned int *line, unsigned int *cycle, int *half_cycle)
471
478
{
472
479
    *line = (unsigned int)((maincpu_clk) / machine_timing.cycles_per_line
473
 
            % machine_timing.screen_lines);
 
480
                           % machine_timing.screen_lines);
474
481
 
475
482
    *cycle = (unsigned int)((maincpu_clk) % machine_timing.cycles_per_line);
476
483
 
479
486
 
480
487
void machine_change_timing(int timeval)
481
488
{
482
 
   int border_mode;
 
489
    int border_mode;
483
490
 
484
491
    /* log_message(LOG_DEFAULT, "machine_change_timing_c500 %d", timeval); */
485
492
 
572
579
    return -1;
573
580
}
574
581
 
575
 
void machine_play_psid(int tune)
576
 
{
577
 
}
578
 
 
579
582
int machine_screenshot(screenshot_t *screenshot, struct video_canvas_s *canvas)
580
583
{
581
584
    if (canvas == vicii_get_canvas()) {
622
625
{
623
626
    return "CBM-II-5x0";
624
627
}
625
 
 
626
 
#ifdef USE_SDLUI
627
 
/* Kludges for vsid & linking issues */
628
 
const char **csidmodel = NULL;
629
 
void psid_init_driver(void) {}
630
 
#endif