Disable serial port if building for Windows

This commit is contained in:
Ry 2023-05-29 18:52:25 -07:00
parent 08e7168b1d
commit f98a9a255f
4 changed files with 9 additions and 2 deletions

View File

@ -7,7 +7,7 @@ LDFLAGS += `$(SDL2_CONFIG) --libs`
else else
ifeq ($(TARGET),mingw) ifeq ($(TARGET),mingw)
CC = x86_64-w64-mingw32-gcc CC = x86_64-w64-mingw32-gcc
CFLAGS += -g -Ofast -std=c99 -Wall -Wextra CFLAGS += -g -Ofast -std=c99 -Wall -Wextra -DWINDOWS
LDFLAGS += -lmingw32 -lSDL2main -lSDL2 LDFLAGS += -lmingw32 -lSDL2main -lSDL2
TARGET_FILE_EXTENSION = .exe TARGET_FILE_EXTENSION = .exe
else else

View File

@ -30,10 +30,12 @@ extern mouse_t mouse;
int bus_io_read(void *user, uint32_t *value, uint32_t port) { int bus_io_read(void *user, uint32_t *value, uint32_t port) {
(void) user; (void) user;
switch (port) { switch (port) {
#ifndef WINDOWS
case 0x00000000: { // serial port case 0x00000000: { // serial port
*value = serial_get(); *value = serial_get();
break; break;
}; };
#endif
case 0x80000000 ... 0x8000031F: { // overlay port case 0x80000000 ... 0x8000031F: { // overlay port
uint8_t overlay_number = port & 0x000000FF; uint8_t overlay_number = port & 0x000000FF;

View File

@ -119,7 +119,9 @@ int main(int argc, char *argv[]) {
ScreenDraw(); ScreenDraw();
} }
#ifndef WINDOWS
serial_init(); serial_init();
#endif
tick_start = SDL_GetTicks(); tick_start = SDL_GetTicks();
tick_end = SDL_GetTicks(); tick_end = SDL_GetTicks();

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#ifndef WINDOWS
#include <sys/select.h> #include <sys/select.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h>
#include <termios.h> #include <termios.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
@ -50,6 +51,8 @@ int serial_get(void) {
return 0; return 0;
} }
#endif
void serial_put(int value) { void serial_put(int value) {
putchar((int) value); putchar((int) value);
fflush(stdout); fflush(stdout);