[cputest]
; CPU model (68000, 68020, 68030, 68040 or 68060).
-cpu=68040
+cpu=68000
; CPU address space.
; If 24-bit, tester will assume upper 8-bits of addresses gets ignored.
feature_undefined_ccr=1
mode=all
+; interrupt timing test
+[test=IPL]
+cpu=68000-68010
+enabled=1
+verbose=0
+feature_undefined_ccr=1
+feature_interrupts=2
+feature_sr_mask=0x2000
+#feature_addressing_modes_dst=apdi
+feature_condition_codes=pl
+rnd_seed=11
+mode=all
+
; interrupt timing test with waitstates
[test=WIPL]
cpu=68000-68010
-enabled=1
+enabled=0
verbose=0
feature_undefined_ccr=1
feature_interrupts=2
rnd_seed=10
mode=btst.b
-; interrupt timing test
-[test=IPL]
-cpu=68000-68010
-enabled=1
-verbose=0
-feature_undefined_ccr=1
-feature_interrupts=2
-feature_sr_mask=0x2000
-#feature_addressing_modes_dst=apdi
-feature_condition_codes=pl
-rnd_seed=10
-mode=btst.b
-
; STOP/SR modification timing special test
+; (not -cycles compatible)
[test=SR]
cpu=68000-68010
enabled=0
mode=stop
; interrupt exception
+; (not -cycles compatible)
[test=IRQ]
enabled=0
verbose=0
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <memory.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <sys/stat.h>
+
+#ifdef _MSC_VER
+#include "msc_dirent.h"
+#else
+#include <dirent.h>
+#endif
+
+#ifdef AMIGA
+
+// Uses dos.library directly because -mcrt=nix13 directory routines
+// are not reliable at least when using FAT95
+
+#include <proto/exec.h>
+#include <proto/dos.h>
+#include <dos/dos.h>
+
+struct DosLibrary *DOSBase;
+
+struct DirInfo
+{
+ BPTR lock;
+ struct FileInfoBlock fib;
+};
+
+#else
+
+static char tmpbuffer[256];
+static int isdir(const char *dirpath, const char *name)
+{
+ struct stat buf;
+
+ snprintf(tmpbuffer, sizeof(tmpbuffer), "%s%s", dirpath, name);
+ return stat(tmpbuffer, &buf) == 0 && S_ISDIR(buf.st_mode);
+}
+
+#endif
+
+void *x_opendir(char *path)
+{
+#ifdef AMIGA
+ struct DirInfo *di = AllocMem(sizeof(struct DirInfo), MEMF_CLEAR | MEMF_PUBLIC);
+ if (!di) {
+ return NULL;
+ }
+ di->lock = Lock(path, SHARED_LOCK);
+ if (!di->lock) {
+ FreeMem(di, sizeof(struct DirInfo));
+ return NULL;
+ }
+ if (!Examine(di->lock, &di->fib)) {
+ FreeMem(di, sizeof(struct DirInfo));
+ return NULL;
+ }
+ return (void*)di;
+#else
+ return opendir(path);
+#endif
+}
+
+void x_closedir(void *v)
+{
+#ifdef AMIGA
+ struct DirInfo *di = (struct DirInfo*)v;
+ if (di) {
+ UnLock(di->lock);
+ FreeMem(di, sizeof(struct DirInfo));
+ }
+#else
+ closedir((DIR*)v);
+#endif
+}
+
+int x_readdir(char *path, void *v, char *s)
+{
+#ifdef AMIGA
+ struct DirInfo *di = (struct DirInfo*)v;
+ if (!ExNext(di->lock, &di->fib)) {
+ return 0;
+ }
+ strcpy(s, di->fib.fib_FileName);
+ return di->fib.fib_DirEntryType < 0 ? 1 : - 1;
+#else
+ struct dirent *d = readdir((DIR*)v);
+ if (!d)
+ return 0;
+ strcpy(s, d->d_name);
+ return isdir(path, s) ? -1 : 1;
+#endif
+}
static char opcode[32], group[32], cpustr[10];
+void *x_opendir(char *path);
+void x_closedir(void *v);
+int x_readdir(char *path, void *v, char *s);
+
#ifndef M68K
#define xmemcpy memcpy
}
}
-static int isdir(const char *dirpath, const char *name)
-{
- struct stat buf;
-
- snprintf(tmpbuffer, sizeof(tmpbuffer), "%s%s", dirpath, name);
- return stat(tmpbuffer, &buf) == 0 && S_ISDIR(buf.st_mode);
-}
-
int main(int argc, char *argv[])
{
int stop_on_error = 1;
}
}
- DIR *groupd = NULL;
+ void *groupd = NULL;
char *p = strchr(opcode, '/');
if (p) {
}
if (!strcmp(group, "all")) {
- groupd = opendir(path);
+ groupd = x_opendir(path);
}
int cpumodel = cpu_lvl == 5 ? 6 : cpu_lvl;
if (groupd) {
pathptr[0] = 0;
- struct dirent *groupdr = readdir(groupd);
+ char dname[256];
+ int groupdr = x_readdir(path, groupd, dname);
if (!groupdr)
break;
- if (!isdir(path, groupdr->d_name))
+ if (groupdr > 0)
continue;
- if (groupdr->d_name[0] == '.')
+ if (dname[0] == '.')
continue;
- if (strnicmp(cpustr, groupdr->d_name, strlen(cpustr)))
+ if (strnicmp(cpustr, dname, strlen(cpustr)))
continue;
- sprintf(pathptr, "%s/", groupdr->d_name);
- strcpy(group, groupdr->d_name + strlen(cpustr));
+ sprintf(pathptr, "%s/", dname);
+ strcpy(group, dname + strlen(cpustr));
} else {
sprintf(pathptr, "%u_%s/",cpumodel, group);
}
}
if (!_stricmp(opcode, "all") || (opcode[0] && opcode[strlen(opcode) - 1] == '*')) {
- DIR *d = opendir(path);
+ void *d = x_opendir(path);
if (!d) {
printf("Couldn't list directory '%s'\n", path);
return 0;
// get directory
for (;;) {
- struct dirent *dr = readdir(d);
+ int dr = x_readdir(path, d, dirs + diroff);
if (!dr)
break;
- int d = isdir(path, dr->d_name);
- if (d && dr->d_name[0] != '.') {
- strcpy(dirs + diroff, dr->d_name);
+ if (dr < 0 && dirs[diroff] != '.') {
dircnt++;
diroff += MAX_FILE_LEN;
if (dircnt >= MAX_FILES) {
}
}
}
- closedir(d);
+ x_closedir(d);
// sort directory
for (int i = 0; i < diroff; i += MAX_FILE_LEN) {
}
if (groupd)
- closedir(groupd);
+ x_closedir(groupd);
return 0;
}
CFLAGS = -mcrt=nix13 -O2 -m68000 -fomit-frame-pointer -msoft-float -DREVDATE=$(NOWDATE) -DREVTIME=$(NOWTIME) -DAMIGA -DM68K
LINK_CFLAGS = -mcrt=nix13 -lm -s
-OBJS = main.o asm040.o asm060.o amiga.o \
+OBJS = main.o dir.o asm040.o asm060.o amiga.o \
decode_ea.o globals.o opcode_handler_cpu.o opcode_handler_fpu.o \
opcode_handler_mmu.o opcodes_cpu.o opcodes_fpu.o opcodes_mmu.o util.o \
inflate.o
main.o: main.c
$(CC) $(CFLAGS) -I. -c -o $@ main.c
+dir.o: dir.c
+ $(CC) $(CFLAGS) -I. -c -o $@ dir.c
+
decode_ea.o: adis/decode_ea.c
$(CC) $(CFLAGS) -I. -c -o $@ adis/decode_ea.c
CFLAGS = -O2 -m68000 -fomit-frame-pointer -msoft-float -DREVDATE=$(NOWDATE) -DREVTIME=$(NOWTIME) -DM68K -DWAITEXIT
LINK_CFLAGS = -lm -s
-OBJS = main.o asm040.o asm060.o atari.o \
+OBJS = main.o dir.o asm040.o asm060.o atari.o \
decode_ea.o globals.o opcode_handler_cpu.o opcode_handler_fpu.o \
opcode_handler_mmu.o opcodes_cpu.o opcodes_fpu.o opcodes_mmu.o util.o \
inflate.o
main.o: main.c
$(CC) $(CFLAGS) -I. -c -o $@ main.c
+dir.o: dir.c
+ $(CC) $(CFLAGS) -I. -c -o $@ dir.c
+
decode_ea.o: adis/decode_ea.c
$(CC) $(CFLAGS) -I. -c -o $@ adis/decode_ea.c