From e2d7eb740647a9aafc2fff97d2999651b0be0623 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 29 Nov 2020 17:39:52 +0000 Subject: [PATCH] Removed (the now) unused alarm.h --- AppleWinExpress2008.vcproj | 20 ++- AppleWinExpress2019.vcxproj | 1 - AppleWinExpress2019.vcxproj.filters | 3 - source/CommonVICE/alarm.h | 191 ---------------------------- 4 files changed, 8 insertions(+), 207 deletions(-) delete mode 100644 source/CommonVICE/alarm.h diff --git a/AppleWinExpress2008.vcproj b/AppleWinExpress2008.vcproj index 2ecd1aa0..7adf14cf 100644 --- a/AppleWinExpress2008.vcproj +++ b/AppleWinExpress2008.vcproj @@ -246,14 +246,6 @@ RelativePath=".\source\Interface.h" > - - - - @@ -278,6 +270,14 @@ RelativePath=".\source\StdAfx.h" > + + + + @@ -593,10 +593,6 @@ RelativePath=".\source\CommonVICE\6510core.h" > - - diff --git a/AppleWinExpress2019.vcxproj b/AppleWinExpress2019.vcxproj index ccc0525e..9d359ab2 100644 --- a/AppleWinExpress2019.vcxproj +++ b/AppleWinExpress2019.vcxproj @@ -28,7 +28,6 @@ - diff --git a/AppleWinExpress2019.vcxproj.filters b/AppleWinExpress2019.vcxproj.filters index 6af9c8c0..18756afd 100644 --- a/AppleWinExpress2019.vcxproj.filters +++ b/AppleWinExpress2019.vcxproj.filters @@ -225,9 +225,6 @@ Source Files\CommonVICE - - Source Files\CommonVICE - Source Files\Emulator diff --git a/source/CommonVICE/alarm.h b/source/CommonVICE/alarm.h deleted file mode 100644 index a2400afd..00000000 --- a/source/CommonVICE/alarm.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * alarm.h - Alarm handling. - * - * Written by - * Ettore Perazzoli - * Andreas Boose - * - * This file is part of VICE, the Versatile Commodore Emulator. - * See README for copyright notice. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA. - * - */ - -#ifndef _ALARM_H -#define _ALARM_H - -#include "../CommonVICE/types.h" - -#define ALARM_CONTEXT_MAX_PENDING_ALARMS 0x100 - -typedef void (*alarm_callback_t)(CLOCK offset, void *data); - -/* An alarm. */ -struct alarm_s { - /* Descriptive name of the alarm. */ - char *name; - - /* Alarm context this alarm is in. */ - struct alarm_context_s *context; - - /* Callback to be called when the alarm is dispatched. */ - alarm_callback_t callback; - - /* Index into the pending alarm list. If < 0, the alarm is not - pending. */ - int pending_idx; - - /* Call data */ - void *data; - - /* Link to the next and previous alarms in the list. */ - struct alarm_s *next, *prev; -}; -typedef struct alarm_s alarm_t; - -struct pending_alarms_s { - /* The alarm. */ - struct alarm_s *alarm; - - /* Clock tick at which this alarm should be activated. */ - CLOCK clk; -}; -typedef struct pending_alarms_s pending_alarms_t; - -/* An alarm context. */ -struct alarm_context_s { - /* Descriptive name of the alarm context. */ - char *name; - - /* Alarm list. */ - struct alarm_s *alarms; - - /* Pending alarm array. Statically allocated because it's slightly - faster this way. */ - pending_alarms_t pending_alarms[ALARM_CONTEXT_MAX_PENDING_ALARMS]; - unsigned int num_pending_alarms; - - /* Clock tick for the next pending alarm. */ - CLOCK next_pending_alarm_clk; - - /* Pending alarm number. */ - int next_pending_alarm_idx; -}; -typedef struct alarm_context_s alarm_context_t; - -/* ------------------------------------------------------------------------ */ - -extern alarm_context_t *alarm_context_new(const char *name); -extern void alarm_context_init(alarm_context_t *context, const char *name); -extern void alarm_context_destroy(alarm_context_t *context); -extern void alarm_context_time_warp(alarm_context_t *context, CLOCK warp_amount, - int warp_direction); -extern alarm_t *alarm_new(alarm_context_t *context, const char *name, - alarm_callback_t callback, void *data); -extern void alarm_destroy(alarm_t *alarm); -extern void alarm_unset(alarm_t *alarm); -extern void alarm_log_too_many_alarms(void); - -/* ------------------------------------------------------------------------- */ - -#if 1 //TC -/* Inline functions. */ - -/*inline*/ static CLOCK alarm_context_next_pending_clk(alarm_context_t *context) -{ - return context->next_pending_alarm_clk; -} - -/*inline*/ static void alarm_context_update_next_pending(alarm_context_t *context) -{ - CLOCK next_pending_alarm_clk = (CLOCK)~0L; - unsigned int next_pending_alarm_idx; - unsigned int i; - - next_pending_alarm_idx = context->next_pending_alarm_idx; - - for (i = 0; i < context->num_pending_alarms; i++) { - CLOCK pending_clk = context->pending_alarms[i].clk; - - if (pending_clk <= next_pending_alarm_clk) { - next_pending_alarm_clk = pending_clk; - next_pending_alarm_idx = i; - } - } - - context->next_pending_alarm_clk = next_pending_alarm_clk; - context->next_pending_alarm_idx = next_pending_alarm_idx; -} - -/*inline*/ static void alarm_context_dispatch(alarm_context_t *context, - CLOCK cpu_clk) -{ - CLOCK offset; - unsigned int idx; - alarm_t *alarm; - - offset = (CLOCK)(cpu_clk - context->next_pending_alarm_clk); - - idx = context->next_pending_alarm_idx; - alarm = context->pending_alarms[idx].alarm; - - (alarm->callback)(offset, alarm->data); -} - -/*inline*/ static void alarm_set(alarm_t *alarm, CLOCK cpu_clk) -{ - alarm_context_t *context; - int idx; - - context = alarm->context; - idx = alarm->pending_idx; - - if (idx < 0) { - unsigned int new_idx; - - /* Not pending yet: add. */ - - new_idx = context->num_pending_alarms; - if (new_idx >= ALARM_CONTEXT_MAX_PENDING_ALARMS) { - alarm_log_too_many_alarms(); - return; - } - - context->pending_alarms[new_idx].alarm = alarm; - context->pending_alarms[new_idx].clk = cpu_clk; - - context->num_pending_alarms++; - - if (cpu_clk < context->next_pending_alarm_clk) { - context->next_pending_alarm_clk = cpu_clk; - context->next_pending_alarm_idx = new_idx; - } - - alarm->pending_idx = new_idx; - } else { - /* Already pending: modify. */ - - context->pending_alarms[idx].clk = cpu_clk; - if (context->next_pending_alarm_clk > cpu_clk - || idx == context->next_pending_alarm_idx) - alarm_context_update_next_pending(context); - } -} -#endif // TC - -#endif -