--- hatari/src/uae-cpu/hatari-glue.c 2019/04/01 07:10:23 1.1.1.5 +++ hatari/src/uae-cpu/hatari-glue.c 2019/04/01 07:10:40 1.1.1.6 @@ -1,3 +1,14 @@ +/* + Hatari - hatari-glue.c + + This file is distributed under the GNU Public License, version 2 or at + your option any later version. Read the file gpl.txt for details. + + This file contains some code to glue the UAE CPU core to the rest of the + emulator and Hatari's "illegal" opcodes. +*/ +static char rcsid[] = "Hatari $Id: hatari-glue.c,v 1.1.1.6 2019/04/01 07:10:40 root Exp $"; + #include @@ -25,6 +36,8 @@ int address_space_24 = TRUE; int cpu_level = 0; /* 68000 (default) */ int cpu_compatible = FALSE; +int requestedInterrupt = -1; + long STmem_size = 0x400000; /* 4MB */ long TTmem_size = 0; @@ -32,21 +45,17 @@ long TTmem_size = 0; /* Reset custom chips */ void customreset(void) { -#if 0 /* Disabled since WinSTon ignores the RESET instruction, too */ - /* Taken from Reset_ST in reset.c: */ - Int_Reset(); /* Reset interrupts */ - MFP_Reset(); /* Setup MFP chip */ - Video_Reset(); /* Reset video */ - PSG_Reset(); /* Reset PSG */ - Sound_Reset(); /* Reset Sound */ - IKBD_Reset(FALSE); /* Keyboard */ - Screen_Reset(); /* Reset screen */ - - /* And VBL interrupt, MUST always be one interrupt ready to trigger */ - Int_AddAbsoluteInterrupt(CYCLES_ENDLINE,INTERRUPT_VIDEO_ENDLINE); - Int_AddAbsoluteInterrupt(CYCLES_HBL,INTERRUPT_VIDEO_HBL); - Int_AddAbsoluteInterrupt(CYCLES_PER_FRAME,INTERRUPT_VIDEO_VBL); -#endif + requestedInterrupt = -1; +} + + +/* Return interrupt number (1 - 7), -1 means no interrupt. */ +int intlev(void) +{ + int ret = requestedInterrupt; + requestedInterrupt = -1; + + return ret; } @@ -133,11 +142,21 @@ unsigned long OpCode_OldGemDos(uae_u32 o */ unsigned long OpCode_GemDos(uae_u32 opcode) { + if(!bInitGemDOS) + { + /* Init on boot - see cartimg.c */ + GemDOS_Boot(); - if(!bInitGemDOS) - GemDOS_Boot(); /* Init on boot - see cartimg.c */ - else + /* We use this to get pointer to Line-A structure details + * (to fix for extended VDI res) */ + LineABase = regs.regs[0]; /* D0 */ + FontBase = regs.regs[9]; /* A1 */ + VDI_LineA(); + } + else + { GemDOS_OpCode(); /* handler code in gemdos.c */ + } m68k_incpc(2); fill_prefetch_0();