emu48-mirror/EMU48.H

134 lines
3.7 KiB
C
Raw Normal View History

/*
* Copyright (C) 1995 Sebastien Carlier
*/
#define VERSION "0.37"
#include "hardware.h"
#define XM 1
#define SB 2
#define SR 4
#define MP 8
#define CRC(nib) crc=(crc>>4)^(((crc^(nib))&0xf)*0x1081);
#define ISMODULE(n,d) ((!ucfg[n])&&(d>=base[n])&&(d<(base[n]+size[n])))
#define INTERRUPT(t) {INTP=1;rstkpush(pc);pc=0xf;}
#define PCHANGED {F_s[0]=P;F_l[1]=P+1;}
extern char A[16];
extern char B[16];
extern char C[16];
extern char D[16];
extern char R0[16];
extern char R1[16];
extern char R2[16];
extern char R3[16];
extern char R4[16];
extern char ST[4];
extern char HST, P;
extern int OUT, IN;
extern int SHUTDN, INTP, INTE, INTD, rstkp, MODE, CARRY;
extern long rstk[8];
extern long pc, d0, d1;
extern int F_s[16];
extern int F_l[16];
extern char CARDSTATUS;
extern char *rom, *ram, *port1, *port2, *data[6], ioram[64];
extern int ucfg[6], bank1, bank2;
extern long base[6], size[6];
extern unsigned short crc;
extern unsigned long t1, t2, saturn_speed;
extern int quit;
extern int load_state;
extern int load();
extern int save();
extern void bank_save(char *mem, char *bn, int bank);
extern void bank_load(char *mem, char *bn, int bank);
extern void bank_switch(int bank);
extern void emulate();
extern long rstkpop();
extern void rstkpush(long d);
extern char *nibble_ptr(long d);
extern char read_nibble(long d);
extern char read_nibble_crc(long d);
extern void write_nibble(long d, char c);
extern char read_io(long d);
extern void write_io(long d, char c);
extern void config();
extern void unconfig();
extern void reset();
extern void c_eq_id();
extern void calibrate_timer();
extern long Npack(char *a, int s);
extern void Nunpack(char *a, long b, int s);
extern void Nread(char *a, long b, int s);
extern void NCread(char *a, long b, int s);
extern void Nwrite(char *a, long b, int s);
extern void Ncopy(char *a, char *b, int s);
extern void Nxchg(char *a, char *b, int s);
extern void Ninc(char *a, int s);
extern void Ndec(char *a, int s);
extern void Nadd(char *a, char *b, int s);
extern void Nsub(char *a, char *b, int s);
extern void Nrsub(char *a, char *b, int s);
extern void Nand(char *a, char *b, int s);
extern void Nor(char *a, char *b, int s);
extern void Nzero(char *a, int s);
extern void Nnot(char *a, int s);
extern void Nneg(char *a, int s);
extern void Nsl(char *a, int s);
extern void Nsr(char *a, int s);
extern void Nbit0(char *a, char b);
extern void Nbit1(char *a, char b);
extern void Nslc(char *a, int s);
extern void Nsrc(char *a, int s);
extern void Nsrb(char *a, int s);
extern void Ndbl(char *a, int s);
extern void Tbit0(char *a, char b);
extern void Tbit1(char *a, char b);
extern void Te(char *a, char *b, int s);
extern void Tne(char *a, char *b, int s);
extern void Tz(char *a, int s);
extern void Tnz(char *a, int s);
extern void Ta(char *a, char *b, int s);
extern void Tae(char *a, char *b, int s);
extern void Tb(char *a, char *b, int s);
extern void Tbe(char *a, char *b, int s);
#define P_FIELDScl(t,fn) extern void t##F##fn(char *a, long b, int f);
#define P_FIELDScc(t,fn) extern void t##F##fn(char *a, char *b, int f);
#define P_FIELDSc(t,fn) extern void t##F##fn(char *a, int f);
P_FIELDScl(N,unpack)
P_FIELDScl(NC,read)
P_FIELDScl(N,write)
P_FIELDScc(N,copy)
P_FIELDScc(N,xchg)
P_FIELDSc(N,inc)
P_FIELDSc(N,dec)
P_FIELDScc(N,add)
P_FIELDScc(N,sub)
P_FIELDScc(N,rsub)
P_FIELDScc(N,and)
P_FIELDScc(N,or)
P_FIELDSc(N,zero)
P_FIELDSc(N,not)
P_FIELDSc(N,neg)
P_FIELDSc(N,sr)
P_FIELDSc(N,sl)
P_FIELDSc(N,srb)
P_FIELDSc(N,dbl)
P_FIELDScc(T,e)
P_FIELDScc(T,ne)
P_FIELDSc(T,z)
P_FIELDSc(T,nz)
P_FIELDScc(T,a)
P_FIELDScc(T,ae)
P_FIELDScc(T,b)
P_FIELDScc(T,be)