home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / emulator / unix / z80pack / z80sim / simint.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-11  |  1.4 KB  |  73 lines

  1. /*
  2.  * Z80SIM  -  a    Z80-CPU    simulator
  3.  *
  4.  * Copyright (C) 1987-92 by Udo Munk
  5.  *
  6.  * This module of the Z80-CPU simulator must not be modified by a user,
  7.  * see license agreement!
  8.  *
  9.  * History:
  10.  * 28-SEP-87 Development on TARGON/35 with AT&T Unix System V.3
  11.  * 11-JAN-89 Release 1.1
  12.  * 08-FEB-89 Release 1.2
  13.  * 13-MAR-89 Release 1.3
  14.  * 09-FEB-90 Release 1.4 Ported to TARGON/31 M10/30
  15.  * 20-DEC-90 Release 1.5 Ported to COHERENT 3.0
  16.  * 10-JUN-92 Release 1.6 long casting problem solved with COHERENT 3.2
  17.  *             and some optimization
  18.  * 25-JUN-92 Release 1.7 comments in english
  19.  */
  20.  
  21. /*
  22.  *    This module contain the interrupt handlers for the OS:
  23.  *
  24.  *    int_on()    : initialize interrupt handlers
  25.  *    int_off()    : reset interrupts to default
  26.  *    user_int()    : handler for user interrupt (CNTL-C)
  27.  *    quit_int()    : handler for signal "quit"
  28.  *    nmi_int()    : handler for non maskable interrupt (Z80)
  29.  *    int_int()    : handler for maskable interrupt (Z80)
  30.  */
  31.  
  32. #include <stdio.h>
  33. #include <signal.h>
  34. #include "sim.h"
  35. #include "simglb.h"
  36.  
  37. int_on()
  38. {
  39.     void user_int();
  40.     void quit_int();
  41.  
  42.     signal(SIGINT, user_int);
  43.     signal(SIGQUIT,    quit_int);
  44. }
  45.  
  46. int_off()
  47. {
  48.     signal(SIGINT, SIG_DFL);
  49.     signal(SIGQUIT,    SIG_DFL);
  50. }
  51.  
  52. static void user_int()
  53. {
  54.     signal(SIGINT, user_int);
  55. #ifdef CNTL_C
  56.     cpu_error = USERINT;
  57.     cpu_state = STOPPED;
  58. #else
  59.     cntl_c++;
  60. #endif
  61. }
  62.  
  63. static void quit_int()
  64. {
  65.     signal(SIGQUIT,    quit_int);
  66. #ifdef CNTL_BS
  67.     cpu_error = USERINT;
  68.     cpu_state = STOPPED;
  69. #else
  70.     cntl_bs++;
  71. #endif
  72. }
  73.