Annotation of hatari/src/uae-cpu/hatari-glue.c, revision 1.1.1.2

1.1       root        1: 
                      2: #include <stdio.h>
                      3: 
                      4: #include "newcpu.h"
                      5: 
                      6: #include "../includes/main.h"
                      7: #include "../includes/int.h"
                      8: #include "../includes/tos.h"
                      9: 
                     10: 
                     11: 
                     12: #ifndef FALSE
                     13: #define FALSE 0
                     14: #define TRUE 1
                     15: #endif
                     16: 
                     17: 
                     18: int illegal_mem = FALSE;
                     19: int address_space_24 = 1;
                     20: int cpu_level = 0;              /* 68000 (default) */
                     21: int cpu_compatible = 0;
                     22: 
                     23: long STmem_size = 0x100000;  /* 1MB */
                     24: long TTmem_size = 0;
                     25: 
                     26: 
                     27: /* Reset custom chips */
                     28: void customreset(void)
                     29: {
                     30:  /* Taken from Reset_ST in reset.c: */
                     31:  Int_Reset();                                  // Reset interrupts
                     32:  MFP_Reset();                                  // Setup MFP chip
                     33:  Video_Reset();                                        // Reset video
                     34:  PSG_Reset();                                  // Reset PSG
                     35:  Sound_Reset();                                        // Reset Sound
                     36:  IKBD_Reset(FALSE);                            // Keyboard     
                     37:  Screen_Reset();                               // Reset screen
                     38: 
                     39:  // And VBL interrupt, MUST always be one interrupt ready to trigger
                     40:  Int_AddAbsoluteInterrupt(CYCLES_ENDLINE,INTERRUPT_VIDEO_ENDLINE);
                     41:  Int_AddAbsoluteInterrupt(CYCLES_HBL,INTERRUPT_VIDEO_HBL);
                     42:  Int_AddAbsoluteInterrupt(CYCLES_PER_FRAME,INTERRUPT_VIDEO_VBL);
                     43: }
                     44: 
                     45: int intlev (void) /* ??? */
                     46: {
                     47:   return -1;
                     48: }
                     49: 
                     50: 
                     51: /* Initialize 680x0 emulation, CheckROM() must have been called first */
                     52: int Init680x0(void)
                     53: {
                     54:  memory_init();
                     55: 
                     56:  init_m68k();
                     57: #ifdef USE_COMPILER
                     58:  compiler_init();
                     59: #endif
                     60:  return TRUE;
                     61: }
                     62: 
                     63: 
                     64: /* Deinitialize 680x0 emulation */
                     65: void Exit680x0(void)
                     66: {
                     67: }
                     68: 
                     69: 
                     70: /* Reset and start 680x0 emulation */
                     71: void Start680x0(void)
                     72: {
                     73:  m68k_reset();
                     74:  m68k_go(TRUE);
                     75: }
                     76: 
                     77: 
                     78: /* ----------------------------------------------------------------------- */
                     79: /*
                     80:   We use an illegal opcode to set ConnectedDrives, as TOS clears this
                     81:   value we cannot set it on init.
                     82: */
                     83: unsigned long OpCode_ConnectedDrive(uae_u32 opcode)
                     84: {
                     85:  /* Set connected drives */
                     86:  STMemory_WriteWord(0x4c2, ConnectedDriveMask);
                     87:  m68k_incpc(2);
                     88:  return 2;
                     89: }
                     90: 
                     91: /* ----------------------------------------------------------------------- */
                     92: /*
                     93:   Modify TimerD in GEMDos to gain more desktop performance
                     94: 
                     95:   Obviously, we need to emulate all timers correctly but GemDOS set's up Timer D at a very
                     96:   high rate(every couple of instructions). The interrupts isn't enabled but WinSTon still
                     97:   needs to process the interrupt table and this HALVES our frame rate!!! (It causes a cache
                     98:   reload each time). Some games actually reference this timer but don't set it up(eg Paradroid,
                     99:   Speedball I) so we simply intercept the Timer D setup code in GemDOS and fix the numbers
                    100:   with more 'laid-back' values. This still keeps 100% compatibility
                    101: */
                    102: unsigned long OpCode_TimerD(uae_u32 opcode)
                    103: {
                    104:  m68k_dreg(regs,0)=3;  /* 3 = Select Timer D */
                    105:  m68k_dreg(regs,1)=7;  /* 1 = /4 for 9600 baud(used /200) */
                    106:  m68k_dreg(regs,2)=100;        /* 2 = 9600 baud(100) */
                    107:  m68k_incpc(2);
                    108:  return 2;
                    109: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.