diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rwxr-xr-x | makefile | 33 | ||||
-rwxr-xr-x | src/fake86/console.c | 4 | ||||
-rwxr-xr-x | src/fake86/main.c | 8 | ||||
-rwxr-xr-x | src/fake86/timing.c | 3 | ||||
-rwxr-xr-x | src/fake86/video.c | 3 |
6 files changed, 39 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be95b60 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.o +*.swp +*~ +fake86 +imagegen @@ -1,20 +1,29 @@ -SRCFILES=src/fake86/*.c +SRC := src/fake86 +SRCFILES=$(wildcard $(SRC)/*.c) +OBJFILES=$(patsubst $(SRC)/%.c, %.o, $(SRCFILES)) + BINPATH=/usr/bin DATAPATH=/usr/share/fake86 -CFLAGS=-O2 -DPATH_DATAFILES=\"$(DATAPATH)/\" -INCLUDE=-Isrc/fake86 -LIBS=-lpthread +CFLAGS=-Wall -O2 -DPATH_DATAFILES=\"$(DATAPATH)/\" -std=gnu99 +INCLUDE=-I$(SRC) +LIBS=-lpthread -lX11 SDLFLAGS=`sdl-config --cflags --libs` -all: fake86-src imagegen-src +%.o: $(SRC)/%.c + $(CC) -c $< $(CFLAGS) $(INCLUDE) $(LIBS) $(SDLFLAGS) + +all: $(OBJFILES_F86) fake86 imagegen + +fake86: $(OBJFILES) + $(CC) $^ -o $@ $(CFLAGS) $(INCLUDE) $(LIBS) $(SDLFLAGS) + mv $@ bin -fake86-src: - $(CC) $(SRCFILES) -o bin/fake86 $(CFLAGS) $(INCLUDE) $(LIBS) $(SDLFLAGS) - chmod a+x bin/fake86 +imagegen.o: src/imagegen/imagegen.c + $(CC) -c $< $(CFLAGS) -imagegen-src: - $(CC) src/imagegen/imagegen.c -o bin/imagegen $(CFLAGS) - chmod a+x bin/imagegen +imagegen: imagegen.o + $(CC) $^ -o $@ + mv $@ bin install: mkdir -p $(BINPATH) @@ -27,7 +36,9 @@ install: cp -p data/videorom.bin $(DATAPATH) cp -p data/rombasic.bin $(DATAPATH) +.PHONY: clean: + rm -f *.o rm -f src/fake86/*.o rm -f src/fake86/*~ rm -f src/imagegen/*.o diff --git a/src/fake86/console.c b/src/fake86/console.c index 03edebb..ab935d2 100755 --- a/src/fake86/console.c +++ b/src/fake86/console.c @@ -75,7 +75,9 @@ void waitforcmd (uint8_t *dst, uint16_t maxlen) { SDL_Delay(10); //don't waste CPU time while in the polling loop } #else - gets (dst); + char buf[255]; + + fgets (buf, dst, stdin); #endif } diff --git a/src/fake86/main.c b/src/fake86/main.c index 78b3c43..0cd550f 100755 --- a/src/fake86/main.c +++ b/src/fake86/main.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> +#include <unistd.h> #include "mutex.h" #ifdef _WIN32 CRITICAL_SECTION screenmutex; @@ -47,18 +48,18 @@ extern void reset86(); extern void exec86 (uint32_t execloops); extern uint8_t initscreen (uint8_t *ver); extern void VideoThread(); -extern doscrmodechange(); +extern int doscrmodechange(); extern void handleinput(); #ifdef CPU_ADDR_MODE_CACHE extern uint64_t cached_access_count, uncached_access_count; #endif -extern uint8_t scrmodechange, doaudio; +extern uint8_t verbose, scrmodechange, doaudio; extern uint64_t totalexec, totalframes; uint64_t starttick, endtick, lasttick; -uint8_t *biosfile = NULL, verbose = 0, cgaonly = 0, useconsole = 0; +uint8_t *biosfile = NULL, cgaonly = 0, useconsole = 0; uint32_t speed = 0; @@ -102,6 +103,7 @@ uint32_t loadbios (uint8_t *filename) { binfile = fopen (filename, "rb"); if (binfile == NULL) { + fprintf(stderr, "Unable to load %s\n", filename); return (0); } diff --git a/src/fake86/timing.c b/src/fake86/timing.c index b3c4b23..010ebe0 100755 --- a/src/fake86/timing.c +++ b/src/fake86/timing.c @@ -41,8 +41,9 @@ extern void tickaudio(); extern void tickssource(); extern void tickadlib(); extern void tickBlaster(); +extern uint64_t lasttick; -uint64_t hostfreq = 1000000, lasttick = 0, curtick = 0, tickgap, i8253tickgap, lasti8253tick, scanlinetiming, lastscanlinetick, curscanline = 0; +uint64_t hostfreq = 1000000, curtick = 0, tickgap, i8253tickgap, lasti8253tick, scanlinetiming, lastscanlinetick, curscanline = 0; uint64_t sampleticks, lastsampletick, ssourceticks, lastssourcetick, adlibticks, lastadlibtick, lastblastertick, gensamplerate; uint16_t pit0counter = 65535; diff --git a/src/fake86/video.c b/src/fake86/video.c index 95c9c61..29cf0d1 100755 --- a/src/fake86/video.c +++ b/src/fake86/video.c @@ -43,7 +43,8 @@ extern uint8_t scrmodechange; uint8_t VRAM[262144], vidmode, cgabg, blankattr, vidgfxmode, vidcolor; uint16_t cursx, cursy, cols = 80, rows = 25, vgapage, cursorposition, cursorvisible; -uint8_t updatedscreen, clocksafe, port3da, port6, portout16; +extern uint8_t portout16; +uint8_t updatedscreen, clocksafe, port3da, port6; uint16_t VGA_SC[0x100], VGA_CRTC[0x100], VGA_ATTR[0x100], VGA_GC[0x100]; uint32_t videobase= 0xB8000, textbase = 0xB8000, x, y; uint8_t fontcga[32768]; |