home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / EXTRA-ST / CPM-80-E / CPM-0.2 / CPM-0 / cpm-0.2 / cpmemu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-15  |  2.5 KB  |  108 lines

  1. /*****************************************************************************/
  2. /*                                         */
  3. /*                                         */
  4. /*    CP/M emulator version 0.1                         */
  5. /*                                         */
  6. /*    written by Michael Bischoff (mbi@mo.math.nat.tu-bs.de)             */
  7. /*    June-1994                                 */
  8. /*                                         */
  9. /*    This file is distributed under the GNU COPYRIGHT             */
  10. /*    see COPYRIGHT.GNU for Copyright details                     */
  11. /*                                         */
  12. /*                                         */
  13. /*****************************************************************************/
  14. #define _POSIX_SOURCE
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include <setjmp.h>
  19.  
  20. #define BIOS 0xfe00U
  21. #define BDOS (BIOS-0xdfaU)
  22.  
  23. /* io.c functions */
  24. int setup_io(const char *);
  25. void putch(int);
  26. int getch(void);
  27. int kbhit(void);
  28. void putmes(const char *);
  29. void vt52(int c);
  30.  
  31. /* assembler modules */
  32. void emulate(void);
  33. void singlestep(void);
  34.  
  35. /* z80out.c */
  36. /* char *disassemble(unsigned pc); */
  37. const unsigned char *disz80(const unsigned char *PC, char *s, unsigned);
  38. void disassem(unsigned *loc, int num);
  39. void dispregs(unsigned pc);
  40. void dispregs2(void);
  41. void memdump(unsigned addr, int lines);
  42.  
  43.  
  44. /* emulate() sees only this: */
  45. struct z80regs {
  46.     unsigned pc, sp, bc, de, hl, af, ir, clks;
  47.     unsigned ix, iy, bc2, de2, hl2, af2, iff, dummy;
  48. };
  49. extern struct z80regs z80regs;
  50. extern unsigned char z80mem[65536L+6];
  51. typedef unsigned char uchar;
  52. typedef unsigned short ushrt;
  53.  
  54. /* bios.c */
  55.  
  56. struct dpb {
  57.     ushrt spt;
  58.     uchar bsh;
  59.     uchar blm;
  60.     uchar exm;
  61.     ushrt dsm;
  62.     ushrt drm;
  63.     uchar alloc0;
  64.     uchar alloc1;
  65.     ushrt cks;    /* (drm+1)/4 if media is removable */
  66.     ushrt off;
  67. };
  68.  
  69. void loadfile(const char *);
  70. void cpm_init(const char *, const char *, struct dpb *);
  71. int check_BIOS_hook(void);
  72. void cpminit2(int argc, char *argv[]);
  73.  
  74. /* bdos.c */
  75. void check_BDOS_hook(void);
  76.  
  77. /* running.c */
  78. void z80step(int);
  79. void z80run(void);
  80. #define NBREAKS 9
  81. extern struct breakpoint {
  82.     unsigned where;
  83.     unsigned byte;
  84.     unsigned maxcnt;
  85.     unsigned curcnt;
  86.     int action;    /* inactive; break; print; ... */
  87. } breakpoint[NBREAKS+1];
  88. #define AC_NONE  0
  89. #define AC_BREAK 1
  90. #define AC_LIST  2
  91. extern int debug;    /* enter debug mode? */
  92. extern int prompt;    /* display debugging prompt? */
  93. extern jmp_buf mainloop;
  94. extern int break_at_BIOS;
  95. extern int silent_exit;
  96. extern int bdos_emulate;
  97. extern int restricted_mode;
  98. /* commands.c */
  99. void commandloop(void);
  100.  
  101. int conin(void);
  102. int getdig(int mindig);
  103. char *rdcmdline(int, int);
  104. unsigned gethex(void);
  105.  
  106. void lowlevel_init(void);
  107. void run_at_2MHz(void);
  108.