c3ab4004ad
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
86 lines
No EOL
1.9 KiB
C
86 lines
No EOL
1.9 KiB
C
/*
|
||
* Copyright (C) 1995 Sebastien Carlier
|
||
*/
|
||
|
||
#include <stdlib.h>
|
||
#include <stdio.h>
|
||
#include <time.h>
|
||
#include "emu48.h"
|
||
|
||
char A[16]={0,};
|
||
char B[16]={0,};
|
||
char C[16]={0,};
|
||
char D[16]={0,};
|
||
char R0[16]={0,};
|
||
char R1[16]={0,};
|
||
char R2[16]={0,};
|
||
char R3[16]={0,};
|
||
char R4[16]={0,};
|
||
char ST[4]={0,};
|
||
char HST=0, P=0;
|
||
int OUT = 0, IN = 0;
|
||
int SHUTDN=0, INTP=0, INTE=0, INTD=0, rstkp = 0, MODE = 16, CARRY=0;
|
||
long rstk[8] = {0,};
|
||
long pc=0, d0=0, d1=0;
|
||
char CARDSTATUS = 0;
|
||
|
||
char *eprom;
|
||
char *rom = NULL, *ram, *port1, *port2;
|
||
char *data[6]={NULL,NULL,NULL,NULL,NULL,NULL};
|
||
int ucfg[6]={1,1,1,1,1,0}, bank1, bank2;
|
||
long base[6]={0x00100,0x80000,0x7F000,0x7E000,0x7E000,0x00000};
|
||
long size[6]={0x00040,0x40000,0x01000,0x01000,0x01000,0x100000};
|
||
unsigned short crc;
|
||
unsigned long t1=0xf, t2=0xffffffff;
|
||
unsigned long saturn_speed = 0;
|
||
int quit = 0;
|
||
int load_state = 1;
|
||
|
||
void calibrate_timer() {
|
||
|
||
saturn_speed = 4000;
|
||
return;
|
||
}
|
||
|
||
int main(int argc, char *argv[]) {
|
||
int i;
|
||
char c;
|
||
|
||
printf("Emu48 version "VERSION", Copyright (C) 1995 Sebastien Carlier\n");
|
||
printf("This is free software, and you are welcome to redistribute it\n");
|
||
printf("under certain conditions; see COPYING for details.\n");
|
||
for (i=1; i<argc; i++) {
|
||
if (argv[i][0] == '-') {
|
||
switch (argv[i][1]) {
|
||
case 'W':
|
||
c = argv[i][2];
|
||
P = (char)((c==0)?3:((c<=9)?(c-'0'):(c-'A'+10)));
|
||
pc = 0x01FC6;
|
||
load_state = 0;
|
||
break;
|
||
case 's':
|
||
sscanf(argv[i]+2,"%ld",&saturn_speed);
|
||
break;
|
||
default:
|
||
printf("Ignoring option %s\n", argv[i]);
|
||
}
|
||
} else printf("Ignoring '%s'\n", argv[i]);
|
||
}
|
||
|
||
load();
|
||
if (!saturn_speed) calibrate_timer();
|
||
init_lcd();
|
||
init_keyboard();
|
||
display_redraw();
|
||
|
||
emulate();
|
||
|
||
exit_keyboard();
|
||
exit_lcd();
|
||
if (quit==1) save();
|
||
free(ram);
|
||
free(rom);
|
||
printf("Interrupts frequency was set to %ld\n", saturn_speed);
|
||
return 0;
|
||
}
|
||
|