System-friendly delay on AmigaOS

This commit is contained in:
Andreas Zdziarstek committed 2021-02-12 00:00:08 +01:00
1 parent 342910ab5d
commit 2f8771f399
4 files changed
+32 -3

No files matched your search

Binary file not shown.
+2 -2
View File
@@ -9,7 +9,7 @@ AS = $(PREFIX)/m68k-amigaos-as
VPATH = .:../common_src
INCLUDE = -I../common_src
DEFINE = -DPROGRAM_NAME='"$(PROGRAM_NAME)"' -DREPLACE_GETOPT
DEFINE = -DPROGRAM_NAME='"$(PROGRAM_NAME)"' -DREPLACE_GETOPT -DUSE_CUSTOM_DELAY
#CFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -mcrt=nix13 -msmall-code -fbaserel -mregparm -Wall -Werror -Wno-pointer-sign -std=gnu99
@@ -19,7 +19,7 @@ CXXFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -mcrt=nix13 -msmall-co
LIBS = -lamiga
OBJ = mt32-pi.o midi_dev.o getopt.o version.o
OBJ = mt32-pi.o midi_dev.o getopt.o delay.o version.o
%.o : %.c
$(CC) -c -o $@ $< $(CFLAGS)
+27
View File
@@ -0,0 +1,27 @@
/*
* mt32-pi-control
*
* An mt32-pi control program for DOS PCs, Atari ST,
* and Amiga computers
*
* Copyright (C) 2021 Andreas Zdziarstek
*
*/
#include <stdio.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include "delay.h"
void delay_ms(unsigned int delay) {
if(DOSBase) {
//System-friendly delay, uses 50Hz ticks normally
Delay(delay/(1000/TICKS_PER_SECOND) + 1);
} else {
// with mcrt=nix13 we should get a DOSBase through proto/dos.h so this should
// (hopefully) never happen
fprintf(stderr, "WARNING: Delay seems not to be working due to missing DOSBase.\n");
}
}
+3 -1
View File
@@ -48,7 +48,7 @@ static char *dev_optstr = "Sl:";
static bool use_direct_serial = false;
static char camd_out[32] = "out.0";
int mididev_init(void) {
int mididev_init(void) {
if(use_direct_serial) {
if (!(msg_port = CreatePort(NULL, 0L))) {
fprintf(stderr, "Failed to create port.\n");
@@ -127,6 +127,8 @@ int mididev_deinit(void) {
DeleteMidi(midi_node);
midi_node = NULL;
}
CloseLibrary(CamdBase);
return 0;
}