Fixed file handling, first steps for win32 and linux version

This commit is contained in:
Andreas Zdziarstek committed 2021-02-01 22:20:35 +01:00
1 parent 888f1b243a
commit 8320a2e6b0
11 files changed
+209 -9

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
PROGRAM_NAME := mt32-pi-ctl
CXX = g++
CC = gcc
AR = ar
AS = as
VPATH = .:../common_src
INCLUDE = -I../common_src
DEFINE = -DPROGRAM_NAME='"$(PROGRAM_NAME)"' -DUSE_CUSTOM_DELAY
#CFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -mcrt=nix13 -msmall-code -fbaserel -mregparm -Wall -Werror -Wno-pointer-sign -std=gnu99
CFLAGS = $(INCLUDE) -O2 -ffunction-sections -fdata-sections -Wl,--gc-sections -Wall -Werror -Wno-pointer-sign -std=gnu99 $(DEFINE)
CXXFLAGS = $(INCLUDE) -O2 -ffunction-sections -fdata-sections -Wl,--gc-sections -Wall -Werror $(DEFINE)
LIBS = -lasound
OBJ = mt32-pi.o midi_dev.o delay.o
%.o : %.c
$(CC) -c -o $@ $< $(CFLAGS)
%.o : %.C
$(CC) -c -o $@ $< $(CFLAGS)
$(PROGRAM_NAME) : $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean
clean :
rm -f $(OBJ) $(PROGRAM_NAME)
.PHONY: dist
dist: $(PROGRAM_NAME)
cp -v $(PROGRAM_NAME) ../amiga_bin/
cp -v *.bmp ../amiga_bin/
+14
View File
@@ -0,0 +1,14 @@
#include <time.h>
#include <errno.h>
#include "delay.h"
void delay_ms(unsigned int delay) {
struct timespec ts, tr;
ts.tv_sec = (time_t)(delay/1000);
ts.tv_nsec = (long) ((delay%1000)*1000000);
while((clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &tr))==EINTR) {
ts = tr;
}
}
+51
View File
@@ -0,0 +1,51 @@
/*
* mt32-pi-control
*
* An mt32-pi control program for DOS PCs, Atari ST,
* and Amiga computers
*
* Copyright (C) 2021 Andreas Zdziarstek
*
*/
#include <stdio.h>
int mididev_init(void) {
return 0;
}
int mididev_deinit(void) {
return 0;
}
int mididev_send_bytes(const unsigned char *buf, int len) {
if(len==0) return 0;
if((buf[0] == 0xF0 && buf[len-1] == 0xF7) || len==3) {
for(int i=0; i<len; i++) {
fprintf(stderr, "%02X ", buf[i]);
}
fprintf(stderr, "\n");
} else {
fprintf(stderr, "Error: Non-SysEx message with more than 3 bytes.\n");
return -1;
}
//fprintf(stderr, "len:%d end:%02X\n", len, buf[len-1]);
// for(int i=0; i<len; i++) {
// fprintf(stderr, "%02X ", buf[i]);
// }
//fprintf(stderr, "\n");
return 0;
}
void mididev_print_usage(void) {}
void mididev_add_optstr(char *optstr) {}
int mididev_parse_arg(int c, const char *optarg) {
return 0;
}