Esempio n. 1
0
void machine_tape_init_c64(void)
{
    if (tapemode != 1) {
        if (tapemode == 0) {
            tape_init(&tapeinit_c64_mode);
        } else {
            tape_reinit(&tapeinit_c64_mode);
        }
        tapemode = 1;
    }
}
Esempio n. 2
0
void machine_tape_init_c128(void)
{
    if (tapemode != 2) {
        if (tapemode == 0) {
            tape_init(&tapeinit_c128_mode);
        } else {
            tape_reinit(&tapeinit_c128_mode);
        }
        tapemode = 2;
    }
}
Esempio n. 3
0
static void
test_tape_load_p_second_dict_on_tape()
{
  int i;
  unsigned char mem[65536];
  char *filename = "fixtures/test.tap";
  char *filename_on_tape = "test2     ";

  observer_status_init();
  tape_init(observer);
  tape_attach(filename);

  mem[9985] = 0;
  strncpy(mem+9986, filename_on_tape, 10);

  /* Skip first dictionary */
  tape_load_p(mem, 10);

  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 1);
  assert(observer_status.tape_pos == 62);
  assert(observer_status.message_type == TAPE_MESSAGE);
  assert(strcmp(observer_status.message, "Skipping file: test") == 0);

  /* Load the header block */
  tape_load_p(mem, 10);
  /* Check correct name is in memory */
  assert(memcmp(mem+10+1, mem+9986, 10) == 0);

  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 1);
  assert(observer_status.tape_pos == 90);
  assert(observer_status.message_type == TAPE_MESSAGE);
  assert(strcmp(observer_status.message, "Found file: test2") == 0);

  /* Load the data block */
  tape_load_p(mem, 10000);
  /* Check data block is loaded */
  assert(mem[10000] == 0x54);
  assert(mem[10001] == 0x45);
  assert(mem[10029] == 0x32);
  assert(mem[10030] == 0xB6);
  assert(mem[10031] == 0x04);

  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 1);
  assert(observer_status.tape_pos == 125);
  assert(observer_status.message_type == TAPE_MESSAGE);
  assert(strcmp(observer_status.message, "Load complete.") == 0);

  tape_detach();
}
Esempio n. 4
0
static void
test_tape_attach_file_doesnt_exist()
{
  char *filename = tmpnam(NULL);
  FILE *fp;

  tape_init(observer);
  fp = tape_attach(filename);
  assert(fp != NULL);
  assert(ftell(fp) == 0);
  assert(fputc(65, fp) == 65);
  tape_detach();
}
Esempio n. 5
0
/* Tests that tape_save_p() truncates the tape properly */
static void
test_tape_save_p_truncate()
{
  char *filename = tmpnam(NULL);  
  FILE *fp;
  unsigned char mem[65536];
  int i;

  observer_status_init();
  tape_init(observer);

  /* Save 3 lots of header and data blocks */
  tape_attach(filename);
  for (i = 0; i < 3; i++) {
    generate_block(mem+(100*i), 25+i, 'A'+i);
    generate_block(mem+(100*i)+50, 30+i, 6+i);
    tape_save_p(mem+(100*i), 25+i);
    tape_save_p(mem+(100*i)+50, 30+i);
  }
  tape_detach();

  tape_attach(filename);

  /* Load first header and data blocks */
  for(i = 0; i < 10; i++) {
    mem[9986+i] = mem[100+i];
  }
  tape_load_p(mem, 1000);
  tape_load_p(mem, 1150);

  /* Save 1 set of header and data blocks after the first 2 blocks */
  generate_block(mem+2000, 28, 'N');
  generate_block(mem+2050, 40, 20);
  tape_save_p(mem+2000, 28);
  tape_save_p(mem+2050, 20);
  tape_detach();

  /* Check that tape only contains first header and data blocks followed by
   * the last saved header and data blocks */
  fp = fopen(filename, "rb");
  assert(fp != NULL);

  assert(block_correct(fp, mem, 25));
  assert(block_correct(fp, mem+50, 30));
  
  assert(block_correct(fp, mem+2000, 28));
  assert(block_correct(fp, mem+2050, 20));

  assert(fgetc(fp) == EOF);
  fclose(fp);
}
Esempio n. 6
0
int main(int argc, char *argv[])
{
    signed int entrypoint;

    if (argc < 2) {
        printf("Usage: %s <script name>\n", argv[0]);
        exit(-1);
    }

    tape_init();
    entrypoint = load_script(argv[1]);
    interpret(entrypoint);

    return 0;
}
Esempio n. 7
0
static void
test_tape_init()
{
  char *filename = "fixtures/test.tap";

  observer_status_init();
  tape_init(observer);

  tape_attach(filename);
  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 1);
  assert(observer_status.tape_pos == 0);
  assert(observer_status.message_type == TAPE_MESSAGE);
  assert(strcmp(observer_status.message, "Tape image attached.") == 0);
  tape_detach();
}
Esempio n. 8
0
static void
test_tape_save_p()
{
  char *filename = tmpnam(NULL);
  FILE *fp;
  unsigned char mem[65536];

  /* Create header and data block */
  generate_block(mem, 25, 'A');
  generate_block(mem+50, 300, 6);

  observer_status_init();
  tape_init(observer);

  tape_attach(filename);

  /* Save the blocks */

  tape_save_p(mem, 25);
  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 1);
  assert(observer_status.tape_pos == 28);
  assert(observer_status.message_type == TAPE_MESSAGE);
  assert(strcmp(observer_status.message, "Saving to file: BCDEFGHIJK") == 0);

  tape_save_p(mem+50, 300);
  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 1);
  assert(observer_status.tape_pos == 331);
  assert(observer_status.message_type == TAPE_MESSAGE);
  assert(strcmp(observer_status.message, "Save complete.") == 0);

  tape_detach();

  /* Check the header and data blocks */
  fp = fopen(filename, "rb");
  assert(fp != NULL);
 
  assert(block_correct(fp, mem, 25));
  assert(block_correct(fp, mem+50, 300));
  assert(fgetc(fp) == EOF);
  fclose(fp);
}
Esempio n. 9
0
static void
test_tape_attach_file_can_not_create()
{
  char *filename = "";
  FILE *fp;

  observer_status_init();
  tape_init(observer);
  fp = tape_attach(filename);

  assert(fp == NULL);
  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 0);
  assert(observer_status.tape_pos == 0);
  assert(observer_status.message_type == TAPE_ERROR);
  assert(strcmp(observer_status.message, "Couldn't create file.") == 0);

  tape_detach();
}
Esempio n. 10
0
int cbm2rom_load_kernal(const char *rom_name)
{
    if (!rom_loaded)
        return 0;  /* init not far enough */

    /* De-initialize kbd-buf, autostart and tape stuff here before
       reloading the ROM the traps are installed in.  */
    kbdbuf_init(0, 0, 0, 0);
    autostart_init(0, 0, 0, 0, 0, 0);
    tape_init(&tapeinit);

    /* Load Kernal ROM.  */
    if (!util_check_null_string(rom_name)) {
        if (sysfile_load(rom_name, mem_rom + 0xe000, 0x2000, 0x2000) < 0) {
            log_error(cbm2rom_log, "Couldn't load ROM `%s'.", rom_name);
            return -1;
        }
    }

    return cbm2rom_checksum();
}
Esempio n. 11
0
static void
test_tape_attach_file_exists()
{
  FILE *fp;
  char *filename = "fixtures/test.tap";

  observer_status_init();
  tape_init(observer);

  fp = tape_attach(filename);

  assert(fp != NULL);
  assert(ftell(fp) == 0);
  assert(fgetc(fp) == 0x1A);

  assert(observer_status.observer_called == 1);
  assert(observer_status.tape_attached == 1);
  assert(observer_status.tape_pos == 0);
  assert(observer_status.message_type == TAPE_MESSAGE);
  assert(strcmp(observer_status.message, "Tape image attached.") == 0);

  tape_detach();
}
Esempio n. 12
0
/* VIC20-specific initialization.  */
int machine_specific_init(void)
{
    vic20_log = log_open("VIC20");

    if (mem_load() < 0)
        return -1;

    /* Setup trap handling.  */
    traps_init();

    /* Initialize serial traps.  If user does not want them, or if the
       ``drive'' emulation is used, do not install them.  */
    if (serial_init(vic20_serial_traps) < 0)
        return -1;

    serial_trap_init(0xa4);
    serial_iec_bus_init();

    /* Initialize RS232 handler.  */
    rs232drv_init();
    vic20_rsuser_init();

    /* initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation. */
    drive_init();

    /* Initialize autostart.  */
    autostart_init((CLOCK)
                   (3 * VIC20_PAL_RFSH_PER_SEC * VIC20_PAL_CYCLES_PER_RFSH),
                   1, 0xcc, 0xd1, 0xd3, 0xd5);

    /* Initialize the VIC-I emulation.  */
    if (vic_init() == NULL)
        return -1;

    via1_init(machine_context.via1);
    via2_init(machine_context.via2);

    ieeevia1_init(machine_context.ieeevia1);
    ieeevia2_init(machine_context.ieeevia2);

#ifndef COMMON_KBD
    /* Load the default keymap file.  */
    if (vic20_kbd_init() < 0)
        return -1;
#endif

    vic20_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.cycles_per_rfsh
                * machine_timing.rfsh_per_sec));

    /* Initialize the VIC20-specific part of the UI.  */
    vic20ui_init();

    vic20iec_init();

    machine_drive_stub();

    return 0;
}
Esempio n. 13
0
/* Plus4-specific initialization.  */
int machine_specific_init(void)
{
    int delay;

    plus4_log = log_open("Plus4");

    if (mem_load() < 0) {
        return -1;
    }

    event_init();

    /* Setup trap handling.  */
    traps_init();

    gfxoutput_init();

#ifdef HAVE_MOUSE
    /* Initialize mouse support (if present).  */
    mouse_init();
#endif

    /* Initialize serial traps.  */
    if (serial_init(plus4_serial_traps) < 0) {
        return -1;
    }

    serial_trap_init(0xa8);
    serial_iec_bus_init();

    rs232drv_init();

    /* Initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation.  */
    drive_init();

    disk_image_init();

    /* Initialize autostart.  */
    resources_get_int("AutostartDelay", &delay);
    if (delay == 0) {
        delay = 2; /* default */
    }
    autostart_init((CLOCK)(delay * PLUS4_PAL_RFSH_PER_SEC * PLUS4_PAL_CYCLES_PER_RFSH), 1, 0, 0xc8, 0xca, -40);

    /* Initialize the sidcart first */
    sidcart_sound_chip_init();

    /* Initialize native sound chip */
    ted_sound_chip_init();

    /* Initialize cartridge based sound chips */
    digiblaster_sound_chip_init();
    speech_sound_chip_init();

    /* Initialize userport based sound chips */
    userport_dac_sound_chip_init();

    drive_sound_init();
    video_sound_init();

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

#ifdef USE_BEOS_UI
    /* Pre-init Plus4-specific parts of the menus before ted_init()
       creates a canvas window with a menubar at the top. This could
       also be used by other ports, e.g. GTK+...  */
    plus4ui_init_early();
#endif

    if (ted_init() == NULL) {
        return -1;
    }

    acia_init();

#ifndef COMMON_KBD
    if (plus4_kbd_init() < 0) {
        return -1;
    }
#endif

    plus4_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(1319, 239, 8, (CLOCK)(machine_timing.rfsh_per_sec * machine_timing.cycles_per_rfsh));

    if (!console_mode) {
        plus4ui_init();
    }

    if (!video_disabled_mode) {
        joystick_init();
    }

    cs256k_init();

    h256k_init();

    plus4iec_init();

    machine_drive_stub();

    /* Initialize the machine specific I/O */
    plus4io_init();

#if defined (USE_XF86_EXTENSIONS) && (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
    {
        /* set fullscreen if user used `-fullscreen' on cmdline */
        int fs;
        resources_get_int("UseFullscreen", &fs);
        if (fs) {
            resources_set_int("TEDFullscreen", 1);
        }
    }
#endif
    return 0;
}
Esempio n. 14
0
int main (int argc, char **argv)

{
char		command [CMD_SIZE];

int		initialize_tape = 1;
int	 	tape_status = 5;

int		status;
unsigned char	*beam_ptr;
int		first_time = TRUE;

LL_beam_rec *enet_pak;

extern process_exit();
extern print_target_elev ();

	
	/* trap signals */
	(void) signal (SIGINT, ((void (*) ()) process_exit));
	(void) signal (SIGHUP, ((void (*) ()) process_exit));
	(void) signal (SIGTERM, ((void (*) ()) process_exit));

	enet_pak = (LL_beam_rec *) malloc ((unsigned) sizeof (LL_beam_rec));
	if (enet_pak == NULL)
	{
		(void) printf ("Malloc error \n");
		return (-1);
	}

	if ((!get_params (&Glob)))
		exit (2);

	/* initialize streams (fmq and/or shmem)  for sending beam data */
	if (init_streams ())
	{
		(void) fprintf (stderr, "streams initialization error");
		return (1);
	}

	if (system ("clear") != 0)
		perror ("clear");

/* 	Determine the source of the data to be reformatted */
	if (!Glob.real_time)
	{
		/* initialize the shared memory for receiving commands*/
    		if (recv_cmd (1, Glob.cmd_shmem_key, (unsigned char **) &command) == -1)
		{
			(void) printf ("recv_cmd fatal error\n");
			exit (-1);
		}

		for (;;)
		{
			if ((status = get_shm_cmd (command)) > 0)
				break;
			else
				if (first_time)
				{
					first_time = FALSE;
					(void) printf ("waiting for menu process to send start command\n");
				}
				sleep (2);
		}
		source = parse_settings (command, &Glob);
		if (source < 0)
			return (0);
	}
	else
		source = RADAR;

	switch (source)
	{
	case RADAR: 

		if (recv_shm (1, Glob.input_shmem_key, &beam_ptr))
		{
			(void) printf ("recv_shm fatal error\n");
			exit (-1);
		}

		for (;go ;)
		{
			if (get_shmem_data (enet_pak, Glob.input_shmem_key)
																		== 0)
			{
				if (first_time)
				{
					(void) printf ("waiting for data\n");
					first_time = FALSE;
				}
				usleep (no_packet);
			}

			/* Check for a stop command */
			if (!Glob.real_time)
			{
				if ((status = get_shm_cmd (command)) > 0)
				{
					source = parse_settings (command, &Glob);
					if (source < 0) go = 0;
					if (source == FLAG_CHANGE)
					{
						(void) printf ("\n  Flag status: Dealias failure = %s\n",
											Glob.caf ? "TRUE":"FALSE");
						(void) printf ("                 Point Target    = %s\n",
											Glob.ctf ? "TRUE":"FALSE");
						(void) printf ("                SNR thresholding = %s\n",
											Glob.cvf ? "TRUE":"FALSE");
						(void) printf ("                 Clutter = %s\n",
											Glob.ccv ? "TRUE":"FALSE");
						(void) printf ("              low PRF in valid gate = %s\n\n",
											Glob.cv ? "TRUE":"FALSE");
					}

				}
			}
		}
		break;

	case TAPE:

		if (Glob.remote_tape)
		{
			if (tape_init (&fd_tape, Glob.tape_device))
			{
				(void) printf("Error initializing the tape device %s", 
														Glob.tape_device);
				source = -1;
				return (0);
			}
		}

		for (;go ;)
		{
			if (initialize_tape)
			{
				initialize_tape = FALSE;
				tape_command ();
			}

			tape_status = get_tape_data (fd_tape, data_rate, enet_pak); 
			switch (tape_status)
			{
                case 0:
					/* automatically rewind the tape
					 * when end of tape is detected
					 */
					 /*
                        		tape_rewind = REWIND;
		                        initialize_tape = TRUE;
					  */
					  /* or stop the system at the end of the tape */
                    (void) printf ("Received STOP command \n");
		            go = 0;
					exit (0);
               		break;

                case INITIALIZE_RMT:
					(void) close (fd_tape);
					if (tape_init (&fd_tape, Glob.tape_device))
					{
						(void) printf("Error initializing the tape device %s", 
														Glob.tape_device);
						source = -1;
						return (0);
					}
               		break;
                case INITIALIZE:
                    initialize_tape = TRUE;
               		break;
		        case REWIND:
		            /*go = 0;
					exit (0);
               		break;*/
                    tape_rewind = REWIND;
		            initialize_tape = TRUE;
               		break;
               	case TAPE_ERR: 
                	(void) printf ("Tape read error / received STOP command \n");
		             go = 0;
               		break;
				case RATE_CHANGE:
					initialize_tape = FALSE;
					break;

				case PAUSE:
					for (;;)
					{
						if (Glob.remote_tape)
						{
							(void) rmt_close ();
						}
						if ((status = get_shm_cmd (command)) > 0)
						{
							if (Glob.remote_tape)
							{
								if (tape_init (&fd_tape, Glob.tape_device))
								{
									(void) printf("Error initializing the tape device %s", Glob.tape_device);
									go = 0;
								}
							}
							break;
						}
						else
							usleep (3000);
					}
					break;
				case FLAG_CHANGE:
					(void) printf ("\n  Flag status: Dealias failure = %s\n",
										Glob.caf ? "TRUE":"FALSE");
					(void) printf ("                 Point Target    = %s\n",
										Glob.ctf ? "TRUE":"FALSE");
					(void) printf ("                SNR thresholding = %s\n",
										Glob.cvf ? "TRUE":"FALSE");
					(void) printf ("                 Clutter = %s\n",
										Glob.ccv ? "TRUE":"FALSE");
					(void) printf ("              low PRF in valid gate = %s\n\n",
										Glob.cv ? "TRUE":"FALSE");
			}
		}
		break;

	default:
			(void) printf ("source unrecognized \n");
			break;
	}

	return (0);

}
Esempio n. 15
0
/* Plus4-specific initialization.  */
int machine_specific_init(void)
{
    plus4_log = log_open("Plus4");

    if (mem_load() < 0)
        return -1;

    /* Setup trap handling.  */
    traps_init();

    /* Initialize serial traps.  */
    if (serial_init(plus4_serial_traps) < 0)
        return -1;

    serial_trap_init(0xa8);
    serial_iec_bus_init();

    rs232drv_init();

    /* Initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation.  */
    drive_init();

    /* Initialize autostart.  */
    autostart_init((CLOCK)(2 * PLUS4_PAL_RFSH_PER_SEC
                   * PLUS4_PAL_CYCLES_PER_RFSH), 0, 0, 0xc8, 0xca, -40);

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    if (ted_init() == NULL)
        return -1;

    acia_init();

#ifndef COMMON_KBD
    if (plus4_kbd_init() < 0)
        return -1;
#endif

    plus4_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(1319, 239, 8, (CLOCK)(machine_timing.rfsh_per_sec
                * machine_timing.cycles_per_rfsh));

    plus4ui_init();

    cs256k_init();

    h256k_init();

    plus4iec_init();

    machine_drive_stub();

    return 0;
}
Esempio n. 16
0
/* C64-specific initialization.  */
int machine_specific_init(void)
{
    int delay;

    c64_log = log_open("C64");

    if (mem_load() < 0) {
        return -1;
    }

    /* Setup trap handling.  */
    traps_init();

    /* Initialize serial traps.  */
    if (serial_init(c64_serial_traps) < 0) {
        return -1;
    }

    serial_trap_init(0xa4);
    serial_iec_bus_init();

    /* Initialize RS232 handler.  */
    rs232drv_init();
    c64_rsuser_init();

    /* Initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation.  */
    drive_init();

    resources_get_int("AutostartDelay", &delay);
    if (delay == 0) {
        delay = 3; /* default */
    }

    /* Initialize autostart.  */
    autostart_init((CLOCK)(delay * C64_PAL_RFSH_PER_SEC * C64_PAL_CYCLES_PER_RFSH), 1, 0xcc, 0xd1, 0xd3, 0xd5);

    if (vicii_init(VICII_STANDARD) == NULL && !video_disabled_mode) {
        return -1;
    }

    c64_mem_init();

    cia1_init(machine_context.cia1);
    cia2_init(machine_context.cia2);

#ifndef COMMON_KBD
    /* Initialize the keyboard.  */
    if (c64_kbd_init() < 0) {
        return -1;
    }
#endif
    c64keyboard_init();

    c64_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec, machine_timing.cycles_per_sec);

    /* Initialize native sound chip */
    sid_sound_chip_init();

    /* Initialize cartridge based sound chips */
    cartridge_sound_chip_init();

    drive_sound_init();
    video_sound_init();

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.rfsh_per_sec * machine_timing.cycles_per_rfsh));

    /* Initialize the C64-specific I/O */
    c64io_init();

    /* Initialize the C64-specific part of the UI.  */
    if (!console_mode) {
        if (machine_class == VICE_MACHINE_C64SC) {
            c64scui_init();
        } else {
            c64ui_init();
        }
    }

    /* Initialize glue logic.  */
    c64_glue_init();

    /* Initialize the +60K.  */
    plus60k_init();

    /* Initialize the +256K.  */
    plus256k_init();

    /* Initialize the C64 256K.  */
    c64_256k_init();

#ifdef HAVE_MOUSE
    /* Initialize mouse support (if present).  */
    mouse_init();

    /* Initialize lightpen support and register VICII callbacks */
    lightpen_init();
    lightpen_register_timing_callback(vicii_lightpen_timing, 0);
    lightpen_register_trigger_callback(vicii_trigger_light_pen);
#endif
    c64iec_init();
    c64fastiec_init();

    cartridge_init();

    machine_drive_stub();
#if defined (USE_XF86_EXTENSIONS) && (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
    {
        /* set fullscreen if user used `-fullscreen' on cmdline */
        int fs;
        resources_get_int("UseFullscreen", &fs);
        if (fs) {
            resources_set_int("VICIIFullscreen", 1);
        }
    }
#endif

    return 0;
}
Esempio n. 17
0
/* C128-specific initialization.  */
int machine_specific_init(void)
{
    c128_log = log_open("C128");

    if (mem_load() < 0) {
        return -1;
    }

    if (z80mem_load() < 0) {
        return -1;
    }

    /* Setup trap handling.  */
    traps_init();

    /* Initialize serial traps.  */
    if (serial_init(c128_serial_traps) < 0) {
        return -1;
    }

    serial_trap_init(0xa4);
    serial_iec_bus_init();

    /* initialize RS232 handler */
    rs232drv_init();
    c64_rsuser_init();

    /* initialize print devices */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation.  */
    drive_init();

    /* Initialize autostart. FIXME: at least 0xa26 is only for 40 cols */
    autostart_init((CLOCK)(3 * C128_PAL_RFSH_PER_SEC * C128_PAL_CYCLES_PER_RFSH), 1, 0xa27, 0xe0, 0xec, 0xee);

    if (vdc_init() == NULL) {
        return -1;
    }

    if (vicii_init(VICII_EXTENDED) == NULL) {
        return -1;
    }

    cia1_init(machine_context.cia1);
    cia2_init(machine_context.cia2);

#ifndef COMMON_KBD
    /* Initialize the keyboard.  */
    if (c128_kbd_init() < 0) {
        return -1;
    }
#endif

    c64keyboard_init();

    c128_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec, machine_timing.cycles_per_sec);

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(842, 208, 10, (CLOCK)(machine_timing.rfsh_per_sec * machine_timing.cycles_per_rfsh));

    /* Initialize the C128-specific part of the UI.  */
    c128ui_init();

#ifdef HAVE_MOUSE
    /* Initialize mouse support (if present).  */
    mouse_init();

    /* Initialize lightpen support and register VICII/VDC callbacks */
    lightpen_init();
    lightpen_register_timing_callback(vicii_lightpen_timing, 1);
    lightpen_register_timing_callback(vdc_lightpen_timing, 0);
    lightpen_register_trigger_callback(c128_trigger_light_pen);
#endif

    c64iec_init();
    c128fastiec_init();

    cartridge_init();

    mmu_init();

    machine_drive_stub();

#if defined (USE_XF86_EXTENSIONS) && (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
    {
        /* set fullscreen if user used `-fullscreen' on cmdline 
           use VICII as default */
        int fs;

        resources_get_int("UseFullscreen", &fs);
        if (fs) {
            resources_get_int("40/80ColumnKey", &fs);
            if (fs == 1) {
                resources_set_int("VICIIFullscreen", 1);
            } else {
                resources_set_int("VDCFullscreen", 1);
            }
        }
    }
#endif

    return 0;
}
Esempio n. 18
0
/* Plus4-specific initialization.  */
int machine_specific_init(void)
{
    int delay;

    plus4_log = log_open("Plus4");

    if (mem_load() < 0)
        return -1;

    /* Setup trap handling.  */
    traps_init();

    /* Initialize serial traps.  */
    if (serial_init(plus4_serial_traps) < 0)
        return -1;

    serial_trap_init(0xa8);
    serial_iec_bus_init();

    rs232drv_init();

    /* Initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation.  */
    drive_init();

    /* Initialize autostart.  */
    resources_get_int("AutostartDelay", &delay);
    if (delay == 0) {
        delay = 2; /* default */
    }
    autostart_init((CLOCK)(delay * PLUS4_PAL_RFSH_PER_SEC
                   * PLUS4_PAL_CYCLES_PER_RFSH), 0, 0, 0xc8, 0xca, -40);

    /* Initialize the sidcart first */
    sidcart_sound_chip_init();

    /* Initialize native sound chip */
    ted_sound_chip_init();

    /* Initialize cartridge based sound chips */
    digiblaster_sound_chip_init();
    speech_sound_chip_init();

    drive_sound_init();
    video_sound_init();

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    if (ted_init() == NULL) {
        return -1;
    }

    acia_init();

#ifndef COMMON_KBD
    if (plus4_kbd_init() < 0) {
        return -1;
    }
#endif

    plus4_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(1319, 239, 8, (CLOCK)(machine_timing.rfsh_per_sec
                * machine_timing.cycles_per_rfsh));

    plus4ui_init();

    cs256k_init();

    h256k_init();

    plus4iec_init();

    machine_drive_stub();

#if defined (USE_XF86_EXTENSIONS) && \
    (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
    {
        /* set fullscreen if user used `-fullscreen' on cmdline */
        int fs;
        resources_get_int("UseFullscreen", &fs);
        if (fs) {
            resources_set_int("TEDFullscreen", 1);
        }
    }
#endif
    return 0;
}
Esempio n. 19
0
/* VIC20-specific initialization.  */
int machine_specific_init(void)
{
    int delay;

    vic20_log = log_open("VIC20");

    if (mem_load() < 0) {
        return -1;
    }

    event_init();

    /* Setup trap handling.  */
    traps_init();

    if (!video_disabled_mode) {
        joystick_init();
    }

    gfxoutput_init();

    /* Initialize serial traps.  If user does not want them, or if the
       ``drive'' emulation is used, do not install them.  */
    if (serial_init(vic20_serial_traps) < 0) {
        return -1;
    }

    serial_trap_init(0xa4);
    serial_iec_bus_init();

    /* Initialize RS232 handler.  */
    rs232drv_init();
    vic20_rsuser_init();

    /* initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation. */
    drive_init();

    disk_image_init();

    /* Initialize autostart.  */
    resources_get_int("AutostartDelay", &delay);
    if (delay == 0) {
        delay = 3; /* default */
    }
    autostart_init((CLOCK)
                   (delay * VIC20_PAL_RFSH_PER_SEC * VIC20_PAL_CYCLES_PER_RFSH),
                   1, 0xcc, 0xd1, 0xd3, 0xd5);

#ifdef USE_BEOS_UI
    /* Pre-init VIC20-specific parts of the menus before vic_init()
       creates a canvas window with a menubar at the top. This could
       also be used by other ports, e.g. GTK+...  */
    vic20ui_init_early();
#endif

    /* Initialize the VIC-I emulation.  */
    if (vic_init() == NULL) {
        return -1;
    }

    via1_init(machine_context.via1);
    via2_init(machine_context.via2);

    ieeevia1_init(machine_context.ieeevia1);
    ieeevia2_init(machine_context.ieeevia2);

#ifndef COMMON_KBD
    /* Load the default keymap file.  */
    if (vic20_kbd_init() < 0) {
        return -1;
    }
#endif

    vic20_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize native sound chip first */
    vic_sound_chip_init();

    /* Initialize the sidcart */
    sidcart_sound_chip_init();

    /* Initialize cartridge based sound chips */
    cartridge_sound_chip_init();

    /* Initialize userport based sound chips */
    userport_dac_sound_chip_init();

    drive_sound_init();
    video_sound_init();

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.cycles_per_rfsh * machine_timing.rfsh_per_sec));

    /* Initialize the VIC20-specific part of the UI.  */
    vic20ui_init();

    vic20iec_init();

    cartridge_init();

#ifdef HAVE_MOUSE
    mouse_init();

#ifdef HAVE_LIGHTPEN
    /* Initialize lightpen support and register VIC-I callbacks */
    lightpen_init();
    lightpen_register_timing_callback(vic_lightpen_timing, 0);
    lightpen_register_trigger_callback(vic_trigger_light_pen);
#endif
#endif

    /* Register joystick callback (for lightpen triggering via fire button) */
    joystick_register_machine(via2_check_lightpen);

#ifdef HAVE_MIDI
    midi_init();
#endif

    machine_drive_stub();

#if defined (USE_XF86_EXTENSIONS) && (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
    {
        /* set fullscreen if user used `-fullscreen' on cmdline */
        int fs;
        resources_get_int("UseFullscreen", &fs);
        if (fs) {
            resources_set_int("VICFullscreen", 1);
        }
    }
#endif
    return 0;
}
Esempio n. 20
0
/* C64-specific initialization.  */
int machine_specific_init(void)
{
    c64_log = log_open("C64");

    if (mem_load() < 0)
        return -1;

    if (vsid_mode) {
        psid_init_driver();
    }

    if (!vsid_mode) {
        /* Setup trap handling.  */
        traps_init();

        /* Initialize serial traps.  */
        if (serial_init(c64_serial_traps) < 0)
            return -1;

        serial_trap_init(0xa4);
        serial_iec_bus_init();

        /* Initialize RS232 handler.  */
        rs232drv_init();
        c64_rsuser_init();

        /* Initialize print devices.  */
        printer_init();

        /* Initialize the tape emulation.  */
        tape_init(&tapeinit);

        /* Initialize the datasette emulation.  */
        datasette_init();

        /* Fire up the hardware-level drive emulation.  */
        drive_init();

        /* Initialize autostart.  */
        autostart_init((CLOCK)(3 * C64_PAL_RFSH_PER_SEC
                       * C64_PAL_CYCLES_PER_RFSH),
                       1, 0xcc, 0xd1, 0xd3, 0xd5);
    }

    if (vicii_init(VICII_STANDARD) == NULL && !console_mode && !vsid_mode)
        return -1;

    c64_mem_init();

    cia1_init(machine_context.cia1);
    cia2_init(machine_context.cia2);

    if (!vsid_mode) {
        tpi_init(machine_context.tpi1);

        acia1_init();

#ifndef COMMON_KBD
        /* Initialize the keyboard.  */
        if (c64_kbd_init() < 0)
            return -1;
#endif

        c64keyboard_init();
    }

    c64_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.rfsh_per_sec
                * machine_timing.cycles_per_rfsh));

    /* Initialize the C64-specific part of the UI.  */
    if (!console_mode) {

        if (vsid_mode)
            vsid_ui_init();
        else
            c64ui_init();
    }

    if (!vsid_mode)
    {
        /* Initialize the REU.  */
        reu_init();

        /* Initialize the GEORAM.  */
        georam_init();

        /* Initialize the RAMCART.  */
        ramcart_init();

        /* Initialize the +60K.  */
        plus60k_init();

        /* Initialize the +256K.  */
        plus256k_init();

        /* Initialize the C64 256K.  */
        c64_256k_init();

        /* Initialize the MMC64.  */
        mmc64_init();

#ifdef HAVE_TFE
        /* Initialize the TFE.  */
        tfe_init();
#endif

#ifdef HAVE_MOUSE
        /* Initialize mouse support (if present).  */
        mouse_init();
#endif

        c64iec_init();
        c64fastiec_init();

        cartridge_init();
    }

    machine_drive_stub();

    return 0;
}