Fix a whole bunch of warnings

This commit is contained in:
Vladimir Serbinenko 2019-11-01 15:33:24 +01:00
parent 2a01065ce2
commit b2ab4b7fd1
33 changed files with 343 additions and 351 deletions

View File

@ -54,7 +54,8 @@ unsigned long pdp_mem_map;
/*
* The QBUS memory map.
*/
int q_null(), q_err(c_addr, d_word), q_errb(c_addr, d_byte),
static void q_null();
int q_err(c_addr, d_word), q_errb(c_addr, d_byte),
port_read(c_addr, d_word*), port_write(c_addr, d_word), port_bwrite(c_addr, d_byte);
int secret_read(c_addr, d_word*), secret_write(c_addr, d_word), secret_bwrite(c_addr, d_byte);
int force_read( c_addr, d_word*), terak_read(c_addr, d_word*);
@ -62,7 +63,7 @@ int force_read( c_addr, d_word*), terak_read(c_addr, d_word*);
typedef struct {
c_addr start;
c_addr size;
int (*ifunc)();
void (*ifunc)();
int (*rfunc)(c_addr, d_word*);
int (*wfunc)(c_addr, d_word);
int (*bwfunc)(c_addr, d_byte);
@ -87,7 +88,7 @@ pdp_qmap qmap_bk[] = {
{ 0, 0, 0, 0, 0, 0 }
};
tcons_read(c_addr a, d_word *d) {
int tcons_read(c_addr a, d_word *d) {
switch (a & 077) {
case 064:
*d = 0200;
@ -100,7 +101,7 @@ tcons_read(c_addr a, d_word *d) {
return OK;
}
tcons_write(c_addr a, d_word d) {
int tcons_write(c_addr a, d_word d) {
switch (a & 077) {
case 064:
fprintf(stderr, "Writing %06o: %06o\n", a, d);
@ -116,11 +117,15 @@ tcons_write(c_addr a, d_word d) {
return OK;
}
int tcons_writeb(c_addr a, unsigned char d) {
return tcons_write(a, d);
}
pdp_qmap qmap_terak[] = {
{ TERAK_DISK_REG, TERAK_DISK_SIZE, tdisk_init, tdisk_read,
tdisk_write, tdisk_bwrite },
{ 0177564, 4, q_null, tcons_read, tcons_write, tcons_write },
{ 0177764, 4, q_null, tcons_read, tcons_write, tcons_write },
{ 0177564, 4, q_null, tcons_read, tcons_write, tcons_writeb },
{ 0177764, 4, q_null, tcons_read, tcons_write, tcons_writeb },
{ 0177744, 2, q_null, port_read, port_write, port_bwrite },
{ 0177560, 2, q_null, port_read, port_write, port_bwrite },
{ 0173000, 0200, q_null, terak_read, q_err, q_errb },
@ -171,7 +176,7 @@ int port_bwrite(c_addr a, d_byte d) {
return OK; /* goes nowhere */
}
secret_read(addr, word)
int secret_read(addr, word)
c_addr addr;
d_word *word;
{
@ -208,9 +213,7 @@ int secret_bwrite(c_addr a, d_byte d) {
*/
int
lc_word( addr, word )
c_addr addr;
d_word *word;
lc_word(c_addr addr, d_word *word)
{
int i;
@ -329,11 +332,7 @@ void pagereg_bwrite(d_byte byte) {
* sc_word() - Store a word at the given core address.
*/
int
sc_word( addr, word )
c_addr addr;
d_word word;
{
int sc_word(c_addr addr, d_word word) {
int i;
addr &= ~1;
@ -365,10 +364,7 @@ d_word word;
*/
int
ll_byte( p, baddr, byte )
register pdp_regs *p;
d_word baddr;
d_byte *byte;
ll_byte( register pdp_regs *p, d_word baddr, d_byte *byte )
{
d_word word;
d_word laddr;
@ -405,10 +401,7 @@ d_byte *byte;
*/
int
sl_byte( p, laddr, byte )
register pdp_regs *p;
d_word laddr;
d_byte byte;
sl_byte(register pdp_regs *p, d_word laddr, d_byte byte)
{
d_word t;
int i;
@ -443,7 +436,7 @@ d_byte byte;
* mem_init() - Initialize the memory.
*/
mem_init()
void mem_init()
{
int x;
if (terak) {
@ -500,9 +493,8 @@ mem_init()
* q_null() - Null QBUS device switch handler.
*/
int q_null()
static void q_null()
{
return OK;
}
/*
@ -525,7 +517,7 @@ int q_errb(c_addr x, d_byte y)
* q_reset() - Reset the UNIBUS devices.
*/
q_reset()
void q_reset()
{
int i;

View File

@ -33,9 +33,9 @@ static unsigned lasttime;
* to receive 16 bit; that is, from PC to BK a whole byte can
* be sent at once.
*/
bkplip_init() {
void bkplip_init() {
#ifdef linux
if (fd != -1) return OK;
if (fd != -1) return;
fd = open(DEVTAP, O_RDWR);
if(fd == -1) {
@ -55,7 +55,6 @@ bkplip_init() {
lasttime = 0;
#endif
return OK;
}
static int len_left = 0;
@ -67,7 +66,7 @@ static int txlen = 0, txbyte = 0;
* If a packet is present, returns its length (a word) with bit 15 set,
* then its contents (N bytes). Each read returns a new byte, no strobing yet.
*/
bkplip_read(addr, word)
int bkplip_read(addr, word)
c_addr addr;
d_word *word;
{
@ -111,7 +110,7 @@ d_word *word;
* Expects a packet length (a word) with bit 15 set,
* then N bytes. Each write transmits a byte, no strobing yet.
*/
bkplip_write(addr, word)
int bkplip_write(addr, word)
c_addr addr;
d_word word;
{
@ -142,7 +141,7 @@ d_word word;
return OK;
}
bkplip_bwrite(c_addr addr, d_byte byte) {
int bkplip_bwrite(c_addr addr, d_byte byte) {
d_word offset = addr & 1;
d_word word;
bkplip_read(addr & ~1, &word);

12
boot.c
View File

@ -36,7 +36,7 @@
* Used for BK-0010 style ROM - stores into the mapped memory.
*/
void load_rom(unsigned start, char * rompath, unsigned min_size, unsigned max_size) {
void load_rom(unsigned start, const char * rompath, unsigned min_size, unsigned max_size) {
char * path;
int i;
extern unsigned long pdp_ram_map;
@ -83,7 +83,7 @@ void load_rom(unsigned start, char * rompath, unsigned min_size, unsigned max_si
/*
* Loads BK-0011 ROM into the givem ROM block from a given offset.
*/
void load_rom11(d_word * rom, int byte_off, char * rompath, int byte_size) {
void load_rom11(d_word * rombuf, int byte_off, const char * rompath, int byte_size) {
char * path;
int i;
@ -105,14 +105,14 @@ void load_rom11(d_word * rom, int byte_off, char * rompath, int byte_size) {
fprintf(stderr, _("Couldn't open file.\n"));
exit(1);
}
rom += byte_off/2;
for (i = 0; i < byte_size/2; i++, rom++) {
rombuf += byte_off/2;
for (i = 0; i < byte_size/2; i++, rombuf++) {
int lobyte = getc(romf);
int hibyte = getc(romf);
d_word data;
if (hibyte < 0) break;
data = lobyte | hibyte<<8;
*rom = data;
*rombuf = data;
}
if (i < byte_size/2) {
fprintf(stderr, _("Incomplete or damaged file.\n"));
@ -123,7 +123,7 @@ void load_rom11(d_word * rom, int byte_off, char * rompath, int byte_size) {
fprintf(stderr, _("Done.\n"));
}
int
void
boot_init()
{
static unsigned char boot_done = 0;

View File

@ -29,17 +29,14 @@
#include "defines.h"
#include "ops.h"
/*
* brx() - Simple Branch Instructions.
*/
int
brx( p, clear, set )
register pdp_regs *p;
unsigned clear;
unsigned set;
brx(register pdp_regs *p, unsigned clear, unsigned set)
{
d_word offset;

View File

@ -8,27 +8,26 @@
unsigned char covox_val;
unsigned int covox_age;
covox_init() {
void covox_init() {
covox_val = 0;
covox_age = ~0;
}
covox_read(c_addr addr, d_word *word)
int covox_read(c_addr addr, d_word *word)
{
*word = 0; /* pulldown */
return OK;
}
covox_write(c_addr addr, d_word word)
int covox_write(c_addr addr, d_word word)
{
covox_val = word & 0xFF;
covox_age = 0;
return OK;
}
covox_bwrite(c_addr addr, d_byte byte) {
int covox_bwrite(c_addr addr, d_byte byte) {
d_word offset = addr & 1;
d_word word;
if (offset == 0) {
covox_val = byte;
} else {

111
defines.h
View File

@ -63,6 +63,26 @@ typedef unsigned short d_word; /* data word (16 bit) */
typedef unsigned char d_byte; /* data byte (8 bit) */
typedef unsigned char flag_t; /* for boolean or small value flags */
void plug_joystick(void);
void plug_printer(void);
void plug_mouse(void);
void plug_covox(void);
void plug_synth(void);
void plug_bkplip(void);
void fake_disk_io(void);
void fake_sector_io(void);
c_addr disas (c_addr a, char * dest);
void fake_tuneup_sequence(void);
void fake_array_with_tuneup(void);
void fake_read_strobe(void);
void fake_write_file(void);
void sound_discard(void);
void sound_semwait(void);
void platform_sound_init(void);
void sound_write_sample(short val);
void sound_flush(void);
void platform_sound_flush(void);
/*
* PDP processor defines.
*/
@ -133,24 +153,43 @@ extern unsigned int hasexit;
#define PDP_FULL_MEM_SIZE (64 * 512) /* 0 - 177777 */
extern d_word rom[4][8192], ram[8][8192], system_rom[8192];
extern int boot_init(), boot_read(), boot_write(c_addr, d_word), boot_bwrite(c_addr, d_byte);
extern int scr_init(), scr_write(int, c_addr, d_word), scr_switch(int, int);
extern int tty_init(), tty_read(), tty_write(c_addr, d_word), tty_bwrite(c_addr, d_byte);
extern int io_init(), io_read(), io_write(c_addr, d_word), io_bwrite(c_addr, d_byte);
extern int disk_init(), disk_read(), disk_write(c_addr, d_word), disk_bwrite(c_addr, d_byte);
extern int tdisk_init(), tdisk_read(), tdisk_write(c_addr, d_word), tdisk_bwrite(c_addr, d_byte);
extern void disk_finish();
extern void tdisk_finish();
extern void io_read_start();
extern int timer_init(), timer_read(), timer_write(c_addr, d_word), timer_bwrite(c_addr, d_byte);
extern int line_init(), line_read(), line_write(c_addr, d_word), line_bwrite(c_addr, d_byte);
extern int printer_init(), printer_read(), printer_write(c_addr, d_word), printer_bwrite(c_addr, d_byte);
extern int mouse_init(), mouse_read(), mouse_write(c_addr, d_word), mouse_bwrite(c_addr, d_byte);
extern int covox_init(), covox_read(), covox_write(c_addr, d_word), covox_bwrite(c_addr, d_byte);
extern int synth_init(), synth_read(), synth_write(c_addr, d_word), synth_bwrite(c_addr, d_byte), synth_next(void);
extern int bkplip_init(), bkplip_read(), bkplip_write(c_addr, d_word), bkplip_bwrite(c_addr, d_byte);
extern void line_init(void);
void scr_init(void);
void boot_init(void);
void timer_init(void);
void printer_init(void);
void covox_init(void);
void synth_init(void);
void mouse_init(void);
void tty_init(void);
void bkplip_init(void);
void io_init(void);
void disk_init(void);
void tdisk_init(void);
extern int boot_read(void), boot_write(c_addr, d_word), boot_bwrite(c_addr, d_byte);
extern int scr_write(int, c_addr, d_word), scr_switch(int, int);
extern int tty_read(c_addr addr, d_word *word);
extern int tty_write(c_addr, d_word), tty_bwrite(c_addr, d_byte);
extern int io_read(c_addr addr, d_word *word), io_write(c_addr, d_word), io_bwrite(c_addr, d_byte);
extern int disk_read(c_addr addr, d_word *word), disk_write(c_addr, d_word), disk_bwrite(c_addr, d_byte);
extern int tdisk_read(c_addr addr, d_word *word), tdisk_write(c_addr, d_word), tdisk_bwrite(c_addr, d_byte);
extern void disk_finish(void);
extern void tdisk_finish(void);
extern void io_read_start(void);
extern int timer_read(c_addr addr, d_word *word);
extern int timer_write(c_addr, d_word), timer_bwrite(c_addr, d_byte);
extern int line_read(c_addr addr, d_word *word), line_write(c_addr, d_word), line_bwrite(c_addr, d_byte);
extern int printer_read(c_addr addr, d_word *word), printer_write(c_addr, d_word), printer_bwrite(c_addr, d_byte);
extern int mouse_read(c_addr addr, d_word *word), mouse_write(c_addr, d_word), mouse_bwrite(c_addr, d_byte);
extern int covox_read(c_addr addr, d_word *word);
extern int covox_write(c_addr, d_word), covox_bwrite(c_addr, d_byte);
extern int synth_read(c_addr addr, d_word *word), synth_write(c_addr, d_word), synth_bwrite(c_addr, d_byte), synth_next(void);
extern int bkplip_read(c_addr addr, d_word *word), bkplip_write(c_addr, d_word), bkplip_bwrite(c_addr, d_byte);
extern int service(d_word);
unsigned short *get_vram_line (int bufno, int line);
void tape_read_start(void);
void tape_read_finish(void);
/*
* Defines for the event handling system.
*/
@ -162,7 +201,7 @@ extern int service(d_word);
#define TTY_PRI 1
typedef struct _event {
int (*handler)(); /* handler function */
int (*handler)(d_word); /* handler function */
d_word info; /* info or vector number */
double when; /* when to fire this event */
} event;
@ -172,9 +211,7 @@ typedef struct _event {
* Instruction Table for Fast Decode.
*/
struct _itab {
int (*func)();
};
typedef int (*_itab_t)();
/*
@ -193,7 +230,7 @@ extern char * bos11rom, * diskrom, * bos11extrom, * basic11arom, * basic11brom;
extern int TICK_RATE;
extern char * floppyA, *floppyB, *floppyC, *floppyD;
extern struct _itab itab[];
extern const _itab_t itab[];
extern unsigned short tty_scroll;
extern unsigned scr_dirty;
extern flag_t key_pressed;
@ -331,4 +368,34 @@ extern flag_t timer_intr_enabled;
else \
SET_CC_V()
typedef enum {
nopD, rtcD, stepinD, stepoutD, readtsD, readD, writeD, delD
} disk_cmd;
/* Why bother, let's memory-map the files! */
typedef struct {
unsigned int length;
unsigned short * image;
const unsigned short * ptr;
unsigned char track;
unsigned char side;
unsigned char ro;
unsigned char motor;
unsigned char inprogress;
unsigned char crc;
unsigned char need_sidetrk;
unsigned char need_sectsize;
unsigned char cursec;
disk_cmd cmd;
} disk_t;
extern unsigned long pending_interrupts;
void sim_init(void);
extern int breakpoint;
extern unsigned char change_req;
extern unsigned char param_change_line;
extern unsigned char req_page[512], req_palette[512];
extern int cybuf[1024];
extern int cybufidx;
#endif

20
disas.c
View File

@ -32,12 +32,12 @@
* otherwise it has no operands.
* Digits mean "look deeper".
*/
char* base[16] = {
static const char *const base[16] = {
"0", "Gmov", "Gcmp", "Gbit", "Gbic", "Gbis", "Gadd", "7",
"8", "Gmovb", "Gcmpb", "Gbitb", "Gbicb", "Gbisb", "Gsub", "N"
};
char* decode0[64] = {
static const char* const decode0[64] = {
/*000*/ "0", "Ojmp", "2", "Oswab", "Bbr", "Bbr", "Bbr", "Bbr",
/*001*/ "Bbne", "Bbne", "Bbne", "Bbne", "Bbeq", "Bbeq", "Bbeq", "Bbeq",
/*002*/ "Bbge", "Bbge", "Bbge", "Bbge", "Bblt", "Bblt", "Bblt", "Bblt",
@ -48,7 +48,7 @@ char* decode0[64] = {
/*007*/ "N", "N", "N", "N", "N", "N", "N", "N"
};
char* decode000[64] = {
static const char *const decode000[64] = {
"halt", "wait", "rti", "bpt", "iot", "reset", "rtt", "N",
"N", "N", "N", "N", "N", "N", "N", "N",
"N", "N", "N", "N", "N", "N", "N", "N",
@ -60,7 +60,7 @@ char* decode000[64] = {
};
/* Here the instruction is completely decoded, we can print it as is */
char * decode002[64] = {
static const char *const decode002[64] = {
"rts r0", "rts r1", "rts r2", "rts r3", "rts r4", "rts r5", "rts sp", "rts pc",
"N", "N", "N", "N", "N", "N", "N", "N",
"N", "N", "N", "N", "N", "N", "N", "N",
@ -71,7 +71,7 @@ char * decode002[64] = {
"sen", "senc", "senv", "senvc", "senz", "senzc", "senzv", "scc"
};
char * decode7[64] = {
static const char *const decode7[64] = {
/*070*/ "Rmul",
/*071*/ "Rdiv",
/*072*/ "Rash",
@ -82,16 +82,16 @@ char * decode7[64] = {
/*077*/ "Ssob",
};
char * decode750[4] = {
static const char *const decode750[4] = {
/*07500*/ "Ffadd",
/*07501*/ "Ffsub",
/*07502*/ "Ffmul",
/*07503*/ "Ffdiv",
};
char * regnam[8] = {"r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc" };
static const char *const regnam[8] = {"r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc" };
char * decode8[64] = {
static const char *const decode8[64] = {
/*100*/ "Bbpl", "Bbpl", "Bbpl", "Bbpl", "Bbmi", "Bbmi", "Bbmi", "Bbmi",
/*101*/ "Bbhi", "Bbhi", "Bbhi", "Bbhi", "Bblos", "Bblos", "Bblos", "Bblos",
/*102*/ "Bbvc", "Bbvc", "Bbvc", "Bbvc", "Bbvs", "Bbvs", "Bbvs", "Bbvs",
@ -113,7 +113,7 @@ void printop(unsigned rm, c_addr * a, char **destp) {
unsigned mode = rm >> 3;
switch (mode) {
case 0:
sprintf(*destp, regnam[r]);
sprintf(*destp, "%s", regnam[r]);
break;
case 1:
sprintf(*destp, "(%s)", regnam[r]);
@ -159,7 +159,7 @@ c_addr disas (c_addr a, char * dest) {
lc_word(a, &inst);
a += 2;
a &= 0177777;
char * code = base[inst >> 12];
const char * code = base[inst >> 12];
char soffset;
unsigned char uoffset;
switch (*code) {

30
disk.c
View File

@ -14,22 +14,6 @@
#define O_BINARY 0
#endif
/* Why bother, let's memory-map the files! */
typedef struct {
unsigned int length;
unsigned short * image;
unsigned short * ptr;
unsigned char track;
unsigned char side;
unsigned char ro;
unsigned char motor;
unsigned char inprogress;
unsigned char crc;
unsigned char need_sidetrk;
unsigned char need_sectsize;
unsigned char cursec;
} disk_t;
disk_t disks[4];
static int selected = -1;
@ -38,7 +22,7 @@ void do_disk_io(int drive, int blkno, int nwords, int ioaddr);
/* Pretty much had to rewrite it for portability rofl. - Gameblabla
* This does not seem to handle writes to the file.
* */
void disk_open(disk_t * pdt, char * name)
void disk_open(disk_t * pdt, const char * name)
{
FILE* fp;
int result;
@ -99,7 +83,7 @@ void disk_open(disk_t * pdt, char * name)
/* Are there any interrupts to open or close ? */
int disk_init() {
void disk_init() {
static char init_done = 0;
int i;
if (!init_done) {
@ -115,7 +99,6 @@ int disk_init() {
disks[i].motor = disks[i].inprogress = 0;
}
selected = -1;
return OK;
}
void disk_finish() {
@ -134,7 +117,6 @@ void disk_finish() {
/* The index hole appears for 1 ms every 100 ms,
*/
int index_flag() {
extern double ticks;
unsigned msec = ticks / (TICK_RATE/1000);
return (msec % 100 == 0);
}
@ -145,7 +127,7 @@ int index_flag() {
#define DATAFLAG 0120773
#define ENDFLAG 0120770
unsigned short index_marker[] = {
static const unsigned short index_marker[] = {
FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER,
FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER,
0, 0, 0, 0, 0, 0, LAST, IDXFLAG
@ -153,13 +135,13 @@ FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER,
#define IDXMRKLEN (sizeof(index_marker)/sizeof(*index_marker))
unsigned short data_marker[] = {
static const unsigned short data_marker[] = {
FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER,
FILLER, FILLER, FILLER, 0, 0, 0, 0, 0, 0, LAST, DATAFLAG
};
#define DATAMRKLEN (sizeof(data_marker)/sizeof(*data_marker))
unsigned short end_marker[] = {
static const unsigned short end_marker[] = {
FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER,
FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER, FILLER,
FILLER, FILLER, 0, 0, 0, 0, 0, 0, LAST, ENDFLAG
@ -232,7 +214,7 @@ disk_read(c_addr addr, d_word *word) {
pdp.regs[PC], *word);
#endif
} else {
static dummy = 0x5555;
static int dummy = 0x5555;
fprintf(stderr, "?");
// fprintf(stderr, _("Reading 177132 when no I/O is progress?\n"));
*word = dummy = ~dummy;

View File

@ -29,7 +29,7 @@
#include "defines.h"
#include "ops.h"
/*
* mov() - Move Instruction. Move operations with registers

44
ea.c
View File

@ -38,9 +38,7 @@
* load_ea()
*/
load_ea( p, addr )
register pdp_regs *p;
d_word *addr;
int load_ea( register pdp_regs *p, d_word *addr)
{
d_word indirect;
int result;
@ -104,9 +102,7 @@ d_word *addr;
* pop()
*/
pop( p, data )
register pdp_regs *p;
d_word *data;
int pop(register pdp_regs *p, d_word *data)
{
int result;
@ -121,9 +117,7 @@ d_word *data;
* push()
*/
push( p, data )
register pdp_regs *p;
d_word data;
int push(register pdp_regs *p, d_word data)
{
p->regs[SP] -= 2;
return sl_word( p, p->regs[SP], data );
@ -134,9 +128,7 @@ d_word data;
* loadb_dst()
*/
loadb_dst( p, data )
register pdp_regs *p;
d_byte *data;
int loadb_dst(register pdp_regs *p, d_byte *data)
{
d_word addr, indirect;
int result;
@ -224,9 +216,7 @@ d_byte *data;
* loadb_src()
*/
loadb_src( p, data )
register pdp_regs *p;
d_byte *data;
int loadb_src( register pdp_regs *p, d_byte *data)
{
d_word addr, indirect;
int result;
@ -307,9 +297,7 @@ d_byte *data;
* storeb_dst() -
*/
storeb_dst( p, data )
register pdp_regs *p;
d_byte data;
int storeb_dst(register pdp_regs *p, d_byte data)
{
d_word addr, indirect;
int result;
@ -391,9 +379,7 @@ d_byte data;
* storeb_dst_2() -
*/
storeb_dst_2( p, data )
register pdp_regs *p;
d_byte data;
int storeb_dst_2(register pdp_regs *p, d_byte data)
{
if (DST_MODE == 0) {
p->regs[DST_REG] &= 0177400;
@ -408,9 +394,7 @@ d_byte data;
* load_src()
*/
load_src( p, data )
register pdp_regs *p;
d_word *data;
int load_src(register pdp_regs *p, d_word *data)
{
d_word addr, indirect;
int result;
@ -485,9 +469,7 @@ d_word *data;
* store_dst() -
*/
store_dst( p, data )
register pdp_regs *p;
d_word data;
int store_dst(register pdp_regs *p, d_word data)
{
d_word addr, indirect;
int result;
@ -562,9 +544,7 @@ d_word data;
* load_dst()
*/
load_dst( p, data )
register pdp_regs *p;
d_word *data;
int load_dst(register pdp_regs *p, d_word *data)
{
d_word addr, indirect;
int result;
@ -646,9 +626,7 @@ d_word *data;
* store_dst_2() -
*/
store_dst_2( p, data )
register pdp_regs *p;
d_word data;
int store_dst_2( register pdp_regs *p, d_word data)
{
if (DST_MODE == 0) {
p->regs[DST_REG] = data;

View File

@ -31,7 +31,7 @@
#define EMU2149_VOL_YM2149 0
#define EMU2149_VOL_AY_3_8910 1
static e_uint32 voltbl[2][32]=
static const e_uint32 voltbl[2][32]=
{
{ 0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x05,0x06,0x07,0x09,0x0B,0x0D,0x0F,0x12,
0x16,0x1A,0x1F,0x25,0x2D,0x35,0x3F,0x4C,0x5A,0x6A,0x7F,0x97,0xB4,0xD6,0xFF,0xFF },

View File

@ -18,7 +18,7 @@ extern "C" {
typedef struct {
/* Volume Table */
e_uint32 *voltbl ;
const e_uint32 *voltbl ;
e_uint8 reg[0x20] ;
e_int32 out ;

17
io.c
View File

@ -13,13 +13,12 @@ unsigned io_sound_val = 0;
flag_t io_stop_happened = 0;
flag_t telegraph_enabled = 0; /* Default */
io_init() {
void io_init() {
sound_init();
tape_init();
return OK;
}
io_read(addr, word)
int io_read(addr, word)
c_addr addr;
d_word *word;
{
@ -39,7 +38,7 @@ d_word *word;
}
/* Include tape drive relay into sound as well */
io_write(addr, word)
int io_write(addr, word)
c_addr addr;
d_word word;
{
@ -62,7 +61,7 @@ d_word word;
return OK;
}
io_bwrite(c_addr addr, d_byte byte) {
int io_bwrite(c_addr addr, d_byte byte) {
d_word offset = addr - IO_REG;
unsigned oldval = io_sound_val;
if (offset == 0) {
@ -90,11 +89,11 @@ FILE * irpslog = 0;
enum { IdleL, NameL, HeaderL, BodyL, TailL } lstate = 0;
unsigned char rdbuf = 0;
line_init() {
void line_init() {
irpslog = fopen("irps.log", "w");
}
line_read(addr, word)
int line_read(addr, word)
c_addr addr;
d_word *word;
{
@ -114,7 +113,7 @@ d_word *word;
return OK;
}
line_write(addr, word)
int line_write(addr, word)
c_addr addr;
d_word word;
{
@ -134,7 +133,7 @@ d_word word;
int subcnt;
unsigned char fname[11];
unsigned short file_addr, file_len;
line_bwrite(addr, byte)
int line_bwrite(addr, byte)
c_addr addr;
d_byte byte;
{

94
itab.c
View File

@ -28,91 +28,9 @@
*/
#include "defines.h"
#include "ops.h"
extern int illegal();
extern int adc();
extern int adcb();
extern int add();
extern int ash();
extern int ashc();
extern int asl();
extern int aslb();
extern int asr();
extern int asrb();
extern int bcc();
extern int bcs();
extern int beq();
extern int bge();
extern int bgt();
extern int bhi();
extern int bic();
extern int bicb();
extern int bis();
extern int bisb();
extern int bit();
extern int bitb();
extern int ble();
extern int blos();
extern int blt();
extern int bmi();
extern int bne();
extern int bpl();
extern int bpt();
extern int br();
extern int bvc();
extern int bvs();
extern int clr();
extern int clrb();
extern int ccc();
extern int cmp();
extern int cmpb();
extern int com();
extern int comb();
extern int dec();
extern int decb();
extern int divide();
extern int emt();
extern int halt();
extern int inc();
extern int incb();
extern int iot();
extern int jmp();
extern int jsr();
extern int mark();
extern int mfpd();
extern int mfpi();
extern int mfps();
extern int mov();
extern int movb();
extern int mtpd();
extern int mtpi();
extern int mtps();
extern int mul();
extern int neg();
extern int negb();
extern int busreset();
extern int rol();
extern int rolb();
extern int ror();
extern int rorb();
extern int rti();
extern int rts();
extern int rtt();
extern int sbc();
extern int sbcb();
extern int scc();
extern int sob();
extern int sub();
extern int swabi();
extern int sxt();
extern int trap();
extern int tst();
extern int tstb();
extern int waiti();
extern int xor();
extern int fis();
struct _itab sitab0[64] = {
const _itab_t sitab0[64] = {
halt, waiti, rti, bpt, iot, busreset, rtt, illegal,
halt, halt, halt, halt, halt, halt, halt, halt,
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal,
@ -123,7 +41,7 @@ struct _itab sitab0[64] = {
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal
};
struct _itab sitab1[64] = {
const _itab_t sitab1[64] = {
rts, rts, rts, rts, rts, rts, rts, rts,
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal,
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal,
@ -137,16 +55,16 @@ struct _itab sitab1[64] = {
int dositab0( p )
register pdp_regs *p;
{
return (sitab0[p->ir&077].func)( p );
return sitab0[p->ir&077]( p );
}
int dositab1( p )
register pdp_regs *p;
{
return (sitab1[p->ir&077].func)( p );
return sitab1[p->ir&077]( p );
}
struct _itab itab[1024] = {
const _itab_t itab[1024] = {
/*000*/ dositab0, jmp, dositab1, swabi, br, br, br, br,
/*001*/ bne, bne, bne, bne, beq, beq, beq, beq,
/*002*/ bge, bge, bge, bge, blt, blt, blt, blt,

4
main.c
View File

@ -398,7 +398,7 @@ volatile int stop_it; /* set when a SIGINT happens during execution */
* sim_init() - Initialize the cpu registers.
*/
int
void
sim_init()
{
int x;
@ -514,7 +514,7 @@ int flag;
oldpc = p->regs[PC];
p->regs[PC] += 2;
if (result == OK) {
result = (itab[p->ir>>6].func)( p );
result = (itab[p->ir>>6])( p );
timing(p);
}

View File

@ -1,6 +1,8 @@
#include <stdio.h>
#define SYNCH 1000
#include <libintl.h>
#include <string.h>
#include <stdlib.h>
#include <locale.h>
#define _(String) gettext (String)

View File

@ -10,8 +10,7 @@ unsigned short mouse_up, mouse_right, mouse_down,
int relx, rely;
int
mouse_init() {
void mouse_init() {
switch (mouseflag) {
case 1: /* mouse in lower byte */
mouse_up = 1;
@ -85,7 +84,7 @@ int mouse_write(c_addr addr, d_word word) {
return OK;
}
mouse_bwrite(c_addr addr, d_byte byte) {
int mouse_bwrite(c_addr addr, d_byte byte) {
d_word offset = addr & 1;
d_word word;
mouse_read(addr & ~1, &word);

82
ops.h Normal file
View File

@ -0,0 +1,82 @@
extern int illegal(void);
extern int adc(register pdp_regs *p);
extern int adcb(register pdp_regs *p);
extern int add(register pdp_regs *p);
extern int ash(register pdp_regs *p);
extern int ashc(register pdp_regs *p);
extern int asl(register pdp_regs *p);
extern int aslb(register pdp_regs *p);
extern int asr(register pdp_regs *p);
extern int asrb(register pdp_regs *p);
extern int bcc(register pdp_regs *p);
extern int bcs(register pdp_regs *p);
extern int beq(register pdp_regs *p);
extern int bge(register pdp_regs *p);
extern int bgt(register pdp_regs *p);
extern int bhi(register pdp_regs *p);
extern int bic(register pdp_regs *p);
extern int bicb(register pdp_regs *p);
extern int bis(register pdp_regs *p);
extern int bisb(register pdp_regs *p);
extern int bit(register pdp_regs *p);
extern int bitb(register pdp_regs *p);
extern int ble(register pdp_regs *p);
extern int blos(register pdp_regs *p);
extern int blt(register pdp_regs *p);
extern int bmi(register pdp_regs *p);
extern int bne(register pdp_regs *p);
extern int bpl(register pdp_regs *p);
extern int bpt(void);
extern int br(register pdp_regs *p);
extern int bvc(register pdp_regs *p);
extern int bvs(register pdp_regs *p);
extern int clr(register pdp_regs *p);
extern int clrb(register pdp_regs *p);
extern int ccc(register pdp_regs *p);
extern int cmp(register pdp_regs *p);
extern int cmpb(register pdp_regs *p);
extern int com(register pdp_regs *p);
extern int comb(register pdp_regs *p);
extern int dec(register pdp_regs *p);
extern int decb(register pdp_regs *p);
extern int divide(register pdp_regs *p);
extern int emt(void);
extern int halt(register pdp_regs *p);
extern int inc(register pdp_regs *p);
extern int incb(register pdp_regs *p);
extern int iot(void);
extern int jmp(register pdp_regs *p);
extern int jsr(register pdp_regs *p);
extern int mark(register pdp_regs *p);
extern int mfpd(register pdp_regs *p);
extern int mfpi(register pdp_regs *p);
extern int mfps(register pdp_regs *p);
extern int mov(register pdp_regs *p);
extern int movb(register pdp_regs *p);
extern int mtpd(register pdp_regs *p);
extern int mtpi(register pdp_regs *p);
extern int mtps(register pdp_regs *p);
extern int mul(register pdp_regs *p);
extern int neg(register pdp_regs *p);
extern int negb(register pdp_regs *p);
extern int busreset(register pdp_regs *p);
extern int rol(register pdp_regs *p);
extern int rolb(register pdp_regs *p);
extern int ror(register pdp_regs *p);
extern int rorb(register pdp_regs *p);
extern int rti(register pdp_regs *p);
extern int rts(register pdp_regs *p);
extern int rtt(register pdp_regs *p);
extern int sbc(register pdp_regs *p);
extern int sbcb(register pdp_regs *p);
extern int scc(register pdp_regs *p);
extern int sob(register pdp_regs *p);
extern int sub(register pdp_regs *p);
extern int swabi(register pdp_regs *p);
extern int sxt(register pdp_regs *p);
extern int trap(void);
extern int tst(register pdp_regs *p);
extern int tstb(register pdp_regs *p);
extern int waiti(register pdp_regs *p);
extern int xor(register pdp_regs *p);
extern int fis(void);

View File

@ -1,3 +1,4 @@
#include <stdlib.h>
#include <stdio.h>
#include <sys/param.h>

View File

@ -8,18 +8,16 @@
FILE * io_printer_file = NULL;
#define STROBE 0400
printer_init() {
void printer_init() {
if (NULL == io_printer_file && printer_file) {
io_printer_file = fopen(printer_file, "w");
if (NULL == io_printer_file) {
perror(printer_file);
}
}
return OK;
}
printer_read(addr, word)
int printer_read(addr, word)
c_addr addr;
d_word *word;
{
@ -32,7 +30,7 @@ d_word *word;
return OK;
}
printer_write(addr, word)
int printer_write(addr, word)
c_addr addr;
d_word word;
{
@ -46,7 +44,7 @@ d_word word;
return OK;
}
printer_bwrite(c_addr addr, d_byte byte) {
int printer_bwrite(c_addr addr, d_byte byte) {
d_word offset = addr & 1;
d_word word;
printer_read(addr & ~1, &word);

View File

@ -1,3 +1,4 @@
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <libintl.h>

2
scr.c
View File

@ -179,7 +179,7 @@ setup_bases() {
}
}
scr_init() {
void scr_init() {
extern unsigned bk_icon[];
extern unsigned char * compute_icon_mask();

View File

@ -29,9 +29,8 @@ event events[NUM_PRI];
* ev_init() - Initialize the event system.
*/
ev_init()
void ev_init()
{
int x;
pending_interrupts = 0;
}
@ -39,12 +38,10 @@ ev_init()
* ev_register() - Register an event.
*/
int
ev_register( priority, handler, delay, info )
unsigned priority;
int (*handler)();
unsigned long delay; /* in clock ticks */
d_word info;
void ev_register(unsigned priority, int (*handler)(d_word),
unsigned long delay, /* in clock ticks */
d_word info)
{
if (pending_interrupts & (1 << priority)) {
@ -71,7 +68,7 @@ d_word info;
* priority list.
*/
ev_fire( int priority )
void ev_fire( int priority )
{
int x;
unsigned long mask;
@ -120,11 +117,9 @@ d_word vector;
int result;
d_word oldpsw;
d_word oldpc;
d_word oldmode;
d_word newmode;
c_addr vaddr;
d_word newpsw;
d_word newpc;
d_word oldmode;
last_branch = p->regs[PC];
oldmode = ( p->psw & 0140000 ) >> 14;
@ -163,13 +158,11 @@ d_word vector;
* rti() - Return from Interrupt Instruction.
*/
rti( p )
int rti( p )
register pdp_regs *p;
{
d_word newpsw;
d_word newpc;
d_word oldmode;
d_word newmode;
int result;
last_branch = p->regs[PC];
@ -189,13 +182,11 @@ register pdp_regs *p;
* rtt() - Return from Interrupt Instruction.
*/
rtt( p )
int rtt( p )
register pdp_regs *p;
{
d_word newpsw;
d_word newpc;
d_word oldmode;
d_word newmode;
int result;
last_branch = p->regs[PC];

View File

@ -29,13 +29,13 @@
#include "defines.h"
#include "ops.h"
/*
* adc() - Add Carry Instruction.
*/
adc( p )
int adc( p )
register pdp_regs *p;
{
d_word data;
@ -71,7 +71,7 @@ register pdp_regs *p;
* asl() - Arithmetic Shift Left Instruction.
*/
asl( p )
int asl( p )
register pdp_regs *p;
{
d_word data;
@ -100,7 +100,7 @@ register pdp_regs *p;
* asr() - Arithmetic Shift Right Instruction.
*/
asr( p )
int asr( p )
register pdp_regs *p;
{
d_word data;
@ -130,7 +130,7 @@ register pdp_regs *p;
* clr() - Clear Instruction.
*/
clr( p )
int clr( p )
register pdp_regs *p;
{
@ -145,7 +145,7 @@ register pdp_regs *p;
* com() - Complement Instrcution.
*/
com( p )
int com( p )
register pdp_regs *p;
{
d_word data;
@ -170,7 +170,7 @@ register pdp_regs *p;
* dec() - Decrement Instrcution.
*/
dec( p )
int dec( p )
register pdp_regs *p;
{
d_word data;
@ -198,7 +198,7 @@ register pdp_regs *p;
* inc() - Increment Instruction.
*/
inc( p )
int inc( p )
register pdp_regs *p;
{
d_word data;
@ -226,7 +226,7 @@ register pdp_regs *p;
* neg() - Negate Instruction.
*/
neg( p )
int neg( p )
register pdp_regs *p;
{
d_word data;
@ -259,7 +259,7 @@ register pdp_regs *p;
* rol() - Rotate Left Instruction.
*/
rol( p )
int rol( p )
register pdp_regs *p;
{
d_word data;
@ -293,7 +293,7 @@ register pdp_regs *p;
* ror() - Rotate Right Instruction.
*/
ror( p )
int ror( p )
register pdp_regs *p;
{
d_word data;
@ -327,7 +327,7 @@ register pdp_regs *p;
* sbc() - Subtract Carry Instruction.
*/
sbc( p )
int sbc( p )
register pdp_regs *p;
{
d_word data;
@ -363,7 +363,7 @@ register pdp_regs *p;
* swabi() - Swap Bytes Instruction.
*/
swabi( p )
int swabi( p )
register pdp_regs *p;
{
d_word data1;
@ -391,7 +391,7 @@ register pdp_regs *p;
* sxt() - Sign Extend Instruction.
*/
sxt( p )
int sxt( p )
register pdp_regs *p;
{
d_word data;
@ -413,7 +413,7 @@ register pdp_regs *p;
* tst() - Test Instruction.
*/
tst( p )
int tst( p )
register pdp_regs *p;
{
d_word data;
@ -435,7 +435,7 @@ register pdp_regs *p;
* tstb() - Test Byte Instruction.
*/
tstb( p )
int tstb( p )
register pdp_regs *p;
{
d_byte data;
@ -457,7 +457,7 @@ register pdp_regs *p;
* aslb() - Arithmetic Shift Left Byte Instruction.
*/
aslb( p )
int aslb( p )
register pdp_regs *p;
{
d_byte data;
@ -486,7 +486,7 @@ register pdp_regs *p;
* asrb() - Arithmetic Shift Right Byte Instruction.
*/
asrb( p )
int asrb( p )
pdp_regs *p;
{
d_byte data;
@ -515,7 +515,7 @@ pdp_regs *p;
* clrb() - Clear Byte Instruction.
*/
clrb( p )
int clrb( p )
register pdp_regs *p;
{
CLR_CC_ALL();
@ -529,7 +529,7 @@ register pdp_regs *p;
* comb() - Complement Byte Instrcution.
*/
comb( p )
int comb( p )
register pdp_regs *p;
{
d_byte data;
@ -554,7 +554,7 @@ register pdp_regs *p;
* decb() - Decrement Byte Instrcution.
*/
decb( p )
int decb( p )
register pdp_regs *p;
{
d_byte data;
@ -582,7 +582,7 @@ register pdp_regs *p;
* incb() - Increment Byte Instruction.
*/
incb( p )
int incb( p )
register pdp_regs *p;
{
d_byte data;
@ -610,7 +610,7 @@ register pdp_regs *p;
* negb() - Negate Byte Instruction.
*/
negb( p )
int negb( p )
register pdp_regs *p;
{
d_byte data;
@ -643,7 +643,7 @@ register pdp_regs *p;
* rolb() - Rotate Left Byte Instruction.
*/
rolb( p )
int rolb( p )
register pdp_regs *p;
{
d_byte data;
@ -677,7 +677,7 @@ register pdp_regs *p;
* rorb() - Rotate Right Byte Instruction.
*/
rorb( p )
int rorb( p )
register pdp_regs *p;
{
d_byte data;
@ -711,7 +711,7 @@ register pdp_regs *p;
* adcb() - Add Carry Byte Instruction.
*/
adcb( p )
int adcb( p )
register pdp_regs *p;
{
d_byte data;
@ -747,7 +747,7 @@ register pdp_regs *p;
* sbcb() - Subtract Carry Byte Instruction.
*/
sbcb( p )
int sbcb( p )
register pdp_regs *p;
{
d_byte data;

View File

@ -49,7 +49,7 @@ void callback(void * dummy, Uint8 * outbuf, int len)
}
/* Called after every instruction */
sound_flush() {
void sound_flush() {
int i;
if (fullspeed && io_sound_age >= io_max_sound_age && covox_age >= io_max_sound_age) {
if (sound_buf[cur_buf].ptr != 0)
@ -87,7 +87,7 @@ void sound_finish() {
SDL_AudioSpec desired;
sound_init() {
void sound_init() {
static init_done = 0;
int iarg, i;
if (!nflag)

View File

@ -11,7 +11,7 @@ unsigned char synth_reg;
PSG * psg;
synth_init() {
void synth_init() {
synth_reg = ~0;
if (!psg) {
PSG_init(3579545, SOUND_FREQ);
@ -21,21 +21,21 @@ synth_init() {
// PSG_setVolumeMode(psg,2);
}
synth_read(c_addr addr, d_word *word)
int synth_read(c_addr addr, d_word *word)
{
// *word = PSG_readReg(psg, synth_reg) ^ 0xFF;
*word = 0; // BK does not read from AY
return OK;
}
synth_write(c_addr addr, d_word word)
int synth_write(c_addr addr, d_word word)
{
// Writing register address
synth_reg = (word & 0xF) ^ 0xF;
return OK;
}
synth_bwrite(c_addr addr, d_byte byte) {
int synth_bwrite(c_addr addr, d_byte byte) {
// Writing data; what happens if the address is odd?
PSG_writeReg(psg, synth_reg, byte ^ 0xFF);
return OK;

2
tape.c
View File

@ -285,7 +285,7 @@ void fake_read_strobe() {
void
fake_write_file() {
c_addr base;
d_word base;
lc_word(0306, &base);
get_emt36_filename();
tape_write_file = fopen(unix_filename, "w");

View File

@ -10,9 +10,6 @@
#define SECSIZE 64 /* words */
#define SECPERTRACK 26
#define MAXTRACK 76
typedef enum {
nopD, rtcD, stepinD, stepoutD, readtsD, readD, writeD, delD
} disk_cmd;
typedef enum {
enF = 1, headF = 020, intrF = 0100, doneF = 0200,
@ -65,7 +62,7 @@ void tdisk_open(tdisk_t * pdt, char * name) {
/* Are there any interrupts to open or close ? */
int tdisk_init() {
void tdisk_init() {
static char init_done = 0;
int i;
if (!init_done) {
@ -82,7 +79,6 @@ int tdisk_init() {
tdisks[i].inprogress = 0;
}
selected = -1;
return OK;
}
void tdisk_finish() {
@ -106,7 +102,6 @@ int
tdisk_read(c_addr addr, d_word *word) {
d_word offset = addr - TERAK_DISK_REG;
tdisk_t * pdt = &tdisks[selected];
int index;
switch(offset) {
case 0: /* status */
if (selected == -1) {

16
timer.c
View File

@ -19,7 +19,10 @@ unsigned int timer_period;
*/
#define PERIOD 128
timer_read(addr, word)
static void timer_check();
static void timer_setmode(d_byte mode);
int timer_read(addr, word)
c_addr addr;
d_word *word;
{
@ -39,7 +42,7 @@ d_word *word;
return OK;
}
timer_write(addr, word)
int timer_write(addr, word)
c_addr addr;
d_word word;
{
@ -63,7 +66,7 @@ d_word word;
return OK;
}
timer_bwrite(addr, byte)
int timer_bwrite(addr, byte)
c_addr addr;
d_byte byte;
{
@ -90,7 +93,7 @@ d_byte byte;
return OK;
}
timer_check() {
static void timer_check() {
unsigned long delta;
if (!(timer_control & TIM_START))
return;
@ -119,8 +122,7 @@ timer_check() {
}
}
timer_setmode(mode)
d_byte mode;
static void timer_setmode(d_byte mode)
{
if (mode & TIM_UNKNOWN1) {
fprintf(stderr, _("Setting unknown timer mode bits\n"));
@ -139,7 +141,7 @@ d_byte mode;
timer_control = mode;
}
timer_init() {
void timer_init() {
timer_control = 0177400;
timer_count = 0177777;
timer_setup = 0011000;

View File

@ -6,11 +6,11 @@ double ticks = 0; /* in clock ticks, integral */
#define REGREG 12
static a_time[8] = {0, 12, 12, 20, 12, 20, 20, 28};
static b_time[8] = {0, 20, 20, 32, 20, 32, 32, 40};
static ab_time[8] = {0, 16, 16, 24, 16, 24, 24, 32};
static a2_time[8] = {0, 20, 20, 28, 20, 28, 28, 36};
static ds_time[8] = {0, 32, 32, 40, 32, 40, 40, 48};
static const int a_time[8] = {0, 12, 12, 20, 12, 20, 20, 28};
static const int b_time[8] = {0, 20, 20, 32, 20, 32, 32, 40};
static const int ab_time[8] = {0, 16, 16, 24, 16, 24, 24, 32};
static const int a2_time[8] = {0, 20, 20, 28, 20, 28, 28, 36};
static const int ds_time[8] = {0, 32, 32, 40, 32, 40, 40, 48};
#define a1_time a_time
#define dj_time a2_time
@ -28,7 +28,7 @@ enum inst {
sub, swabi, sxt, trap, tst, tstb, waiti, xor, fis, itimtab0, itimtab1
};
static enum inst sitimtab0[64] = {
static const enum inst sitimtab0[64] = {
halt, waiti, rti, bpt, iot, busreset, rtt, illegal,
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal,
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal,
@ -39,7 +39,7 @@ static enum inst sitimtab0[64] = {
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal
};
static enum inst sitimtab1[64] = {
static const enum inst sitimtab1[64] = {
rts, rts, rts, rts, rts, rts, rts, rts,
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal,
illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal,
@ -50,7 +50,7 @@ static enum inst sitimtab1[64] = {
scc, scc, scc, scc, scc, scc, scc, scc
};
static enum inst itimtab[1024] = {
static const enum inst itimtab[1024] = {
itimtab0, jmp, itimtab1, swabi, br, br, br, br,
bne, bne, bne, bne, beq, beq, beq, beq,
bge, bge, bge, bge, blt, blt, blt, blt,
@ -181,8 +181,7 @@ static enum inst itimtab[1024] = {
fis, fis, fis, fis, fis, fis, fis, fis
};
timing(p)
register pdp_regs *p;
void timing(register pdp_regs *p)
{
int byteop = (p->ir & SIGN) && ((p->ir >> 12) != 016);
enum {defop, binop, unop, cmpop, tstop } optype = defop;

14
tty.c
View File

@ -131,10 +131,8 @@ tty_open()
* tty_init() - Initialize the BK-0010 keyboard
*/
int
tty_init()
void tty_init()
{
int i;
unsigned short old_scroll = tty_scroll;
tty_reg = 0;
tty_data = 0;
@ -183,7 +181,6 @@ d_word word;
{
d_word offset = addr & 07;
d_word old_scroll;
char c;
switch( offset ) {
case 0:
@ -227,7 +224,6 @@ d_byte byte;
{
d_word offset = addr & 07;
d_word old_scroll;
char c;
switch( offset ) {
case 0:
@ -276,14 +272,14 @@ d_byte byte;
* tty_finish()
*/
tty_finish( c )
unsigned char c;
int tty_finish( d_word c )
{
service(( c & 0200 ) ? TTY_VECTOR2 : TTY_VECTOR);
tty_pending_int = 0;
return OK;
}
stop_key() {
void stop_key() {
io_stop_happened = 4;
service(04);
}
@ -299,7 +295,7 @@ stop_key() {
*/
static int ar2 = 0;
tty_keyevent(SDL_Event * pev) {
void tty_keyevent(SDL_Event * pev) {
int k, c;
k = pev->key.keysym.sym;

4
ui.c
View File

@ -343,7 +343,6 @@ ui_start( s, n )
char *s;
int n;
{
extern disas(c_addr pc, char * dest);
static char buf[80];
d_word word;
int good;
@ -467,7 +466,6 @@ void ui_load(const char *s)
ui_asm( s )
char *s;
{
extern disas(c_addr pc, char * dest);
static char buf[80];
c_addr addr;
c_addr new;
@ -513,8 +511,6 @@ ui_viewbuf ( char * s )
d_word word;
int good;
char buf[80];
extern int cybuf[1024];
extern int cybufidx;
s = rd_d_word( s, &word, &good );
if (good == FALSE ) {
fprintf(stderr, _("Bad address\n"));

25
weird.c
View File

@ -29,7 +29,7 @@
#include "defines.h"
#include "ops.h"
int busreset( p )
register pdp_regs *p;
@ -44,7 +44,6 @@ register pdp_regs *p;
int waiti( p )
register pdp_regs *p;
{
extern unsigned long pending_interrupts;
if (pending_interrupts)
return OK;
p->regs[PC] -= 2; /* repeat instruction */
@ -82,17 +81,17 @@ register pdp_regs *p;
}
int bne( p ) register pdp_regs *p; { return brx( p, CC_Z, 0 ); }
int beq( p ) register pdp_regs *p; { return brx( p, 0, CC_Z ); }
int bpl( p ) register pdp_regs *p; { return brx( p, CC_N, 0 ); }
int bmi( p ) register pdp_regs *p; { return brx( p, 0, CC_N ); }
int bhi( p ) register pdp_regs *p; { return brx( p, CC_C|CC_Z, 0 ); }
int bvc( p ) register pdp_regs *p; { return brx( p, CC_V, 0 ); }
int bvs( p ) register pdp_regs *p; { return brx( p, 0, CC_V ); }
int bcc( p ) register pdp_regs *p; { return brx( p, CC_C, 0 ); }
int bcs( p ) register pdp_regs *p; { return brx( p, 0, CC_C ); }
int scc( p ) register pdp_regs *p; { p->psw |= (p->ir & 017 ); return OK; }
int ccc( p ) register pdp_regs *p; { p->psw &= ~(p->ir & 017 ); return OK; }
int bne(register pdp_regs *p) { return brx( p, CC_Z, 0 ); }
int beq(register pdp_regs *p) { return brx( p, 0, CC_Z ); }
int bpl(register pdp_regs *p) { return brx( p, CC_N, 0 ); }
int bmi(register pdp_regs *p) { return brx( p, 0, CC_N ); }
int bhi(register pdp_regs *p) { return brx( p, CC_C|CC_Z, 0 ); }
int bvc(register pdp_regs *p) { return brx( p, CC_V, 0 ); }
int bvs(register pdp_regs *p) { return brx( p, 0, CC_V ); }
int bcc(register pdp_regs *p) { return brx( p, CC_C, 0 ); }
int bcs(register pdp_regs *p) { return brx( p, 0, CC_C ); }
int scc(register pdp_regs *p) { p->psw |= (p->ir & 017 ); return OK; }
int ccc(register pdp_regs *p) { p->psw &= ~(p->ir & 017 ); return OK; }
/*