OpenCores
URL https://opencores.org/ocsvn/t48/t48/trunk

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_3/] [sw/] [i8039emu/] [main.c] - Diff between revs 58 and 123

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 58 Rev 123
Line 1... Line 1...
/*
/*
 * $Id: main.c,v 1.2 2004-04-15 22:03:53 arniml Exp $
 * $Id: main.c,v 1.3 2004-07-03 14:37:12 arniml Exp $
 *
 *
 * Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
 * Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
 *
 *
 * All rights reserved
 * All rights reserved
 *
 *
Line 22... Line 22...
 *
 *
 */
 */
 
 
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
 
#include <string.h>
 
 
#include "types.h"
#include "types.h"
#include "memory.h"
#include "memory.h"
#include "i8039.h"
#include "i8039.h"
 
 
Line 35... Line 36...
}
}
 
 
 
 
void print_usage(void) {
void print_usage(void) {
  printf("Usage:\n");
  printf("Usage:\n");
  printf(" i8039 -f <hex file> [-d] [-h]\n");
  printf(" i8039 -f <hex file> [-x <hex file>] [-d] [-h]\n");
  printf("  -f : Name of hex file\n");
  printf("  -f : Name of hex file for internal ROM\n");
 
  printf("  -x : Name of hex file for external ROM (optional)\n");
  printf("  -d : Dump machine state\n");
  printf("  -d : Dump machine state\n");
  printf("  -h : Print this help\n");
  printf("  -h : Print this help\n");
}
}
 
 
 
 
int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
{
  int  do_cycles, real_cycles, total_cycles;
  int  do_cycles, real_cycles, total_cycles;
  char *hex_file = "";
  char *hex_file = "";
 
  char *ext_hex_file = "";
  int  c;
  int  c;
  int  dump = 0;
  int  dump = 0;
 
 
  /* process options */
  /* process options */
  while ((c = getopt(argc, argv, "df:h")) != -1) {
  while ((c = getopt(argc, argv, "df:hx:")) != -1) {
    switch (c) {
    switch (c) {
      case 'd':
      case 'd':
        dump = 1;
        dump = 1;
        break;
        break;
 
 
      case 'f':
      case 'f':
        hex_file = optarg;
        hex_file = optarg;
        break;
        break;
 
 
 
      case 'x':
 
        ext_hex_file = optarg;
 
        break;
 
 
      case 'h':
      case 'h':
        /* fallthrough */
        /* fallthrough */
 
 
      default:
      default:
        print_usage();
        print_usage();
Line 76... Line 83...
  if (strlen(hex_file) == 0) {
  if (strlen(hex_file) == 0) {
    print_usage();
    print_usage();
    return(1);
    return(1);
  }
  }
 
 
 
  /* read hex file for internal ROM */
  printf("Reading %s\n", hex_file);
  printf("Reading %s\n", hex_file);
  if (!read_hex_file(hex_file)) {
  if (!read_hex_file(hex_file, 0)) {
    printf("Error reading file!\n");
    printf("Error reading file!\n");
    return(1);
    return(1);
  }
  }
 
 
 
  /* read hex fiel for external ROM */
 
  if (strlen(ext_hex_file) > 0) {
 
    printf("Reading %s\n", ext_hex_file);
 
    if (!read_hex_file(ext_hex_file, 0x800)) {
 
      printf("Error reading file!\n");
 
      return(1);
 
    }
 
  }
 
 
  printf("Resetting 8039\n");
  printf("Resetting 8039\n");
  i8039_reset(NULL);
  i8039_reset(NULL);
 
 
  do_cycles = 52;
  do_cycles = 52;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.