this repo has no description
at main 278 lines 6.2 kB view raw
1/* 2 GLOBGLUE.h 3 4 Copyright (C) 2003 Bernd Schmidt, Philip Cummins, Paul C. Pratt 5 6 You can redistribute this file and/or modify it under the terms 7 of version 2 of the GNU General Public License as published by 8 the Free Software Foundation. You should have received a copy 9 of the license along with this file; see the file COPYING. 10 11 This file is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 license for more details. 15*/ 16 17#ifdef GLOBGLUE_H 18#error "header already included" 19#else 20#define GLOBGLUE_H 21#endif 22 23 24#define kEmMd_Twig43 0 25#define kEmMd_Twiggy 1 26#define kEmMd_128K 2 27#define kEmMd_512Ke 3 28#define kEmMd_Plus 4 29#define kEmMd_SE 5 30#define kEmMd_SEFDHD 6 31#define kEmMd_Classic 7 32#define kEmMd_PB100 8 33#define kEmMd_II 9 34#define kEmMd_IIx 10 35 36#define RAMSafetyMarginFudge 4 37 38#define kRAM_Size (kRAMa_Size + kRAMb_Size) 39EXPORTVAR(ui3p, RAM) 40 /* 41 allocated by OSGLUxxx to be at least 42 kRAM_Size + RAMSafetyMarginFudge 43 bytes. Because of shortcuts taken in GLOBGLUE.c, it is in theory 44 possible for the emulator to write up to 3 bytes past kRAM_Size. 45 */ 46 47#if EmVidCard 48EXPORTVAR(ui3p, VidROM) 49#endif 50 51#if IncludeVidMem 52EXPORTVAR(ui3p, VidMem) 53#endif 54 55EXPORTPROC MemOverlay_ChangeNtfy(void); 56 57#if (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx) 58EXPORTPROC Addr32_ChangeNtfy(void); 59#endif 60 61/* 62 representation of pointer into memory of emulated computer. 63*/ 64typedef ui5b CPTR; 65 66/* 67 mapping of address space to real memory 68*/ 69 70EXPORTFUNC ui3p get_real_address0(ui5b L, blnr WritableMem, CPTR addr, 71 ui5b *actL); 72 73/* 74 memory access routines that can use when have address 75 that is known to be in RAM (and that is in the first 76 copy of the ram, not the duplicates, i.e. < kRAM_Size). 77*/ 78 79#ifndef ln2mtb 80 81#define get_ram_byte(addr) do_get_mem_byte((addr) + RAM) 82#define get_ram_word(addr) do_get_mem_word((addr) + RAM) 83#define get_ram_long(addr) do_get_mem_long((addr) + RAM) 84 85#define put_ram_byte(addr, b) do_put_mem_byte((addr) + RAM, (b)) 86#define put_ram_word(addr, w) do_put_mem_word((addr) + RAM, (w)) 87#define put_ram_long(addr, l) do_put_mem_long((addr) + RAM, (l)) 88 89#else 90 91#define get_ram_byte get_vm_byte 92#define get_ram_word get_vm_word 93#define get_ram_long get_vm_long 94 95#define put_ram_byte put_vm_byte 96#define put_ram_word put_vm_word 97#define put_ram_long put_vm_long 98 99#endif 100 101#define get_ram_address(addr) ((addr) + RAM) 102 103/* 104 accessing addresses that don't map to 105 real memory, i.e. memory mapped devices 106*/ 107 108EXPORTFUNC blnr AddrSpac_Init(void); 109 110 111#define ui5r_FromSByte(x) ((ui5r)(si5r)(si3b)(ui3b)(x)) 112#define ui5r_FromSWord(x) ((ui5r)(si5r)(si4b)(ui4b)(x)) 113#define ui5r_FromSLong(x) ((ui5r)(si5r)(si5b)(ui5b)(x)) 114 115#define ui5r_FromUByte(x) ((ui5r)(ui3b)(x)) 116#define ui5r_FromUWord(x) ((ui5r)(ui4b)(x)) 117#define ui5r_FromULong(x) ((ui5r)(ui5b)(x)) 118 119 120#if WantDisasm 121EXPORTPROC dbglog_StartLine(void); 122#else 123#define dbglog_StartLine() 124#endif 125 126#if dbglog_HAVE 127EXPORTPROC dbglog_WriteMemArrow(blnr WriteMem); 128 129EXPORTPROC dbglog_WriteNote(char *s); 130EXPORTPROC dbglog_WriteSetBool(char *s, blnr v); 131EXPORTPROC dbglog_AddrAccess(char *s, 132 ui5r Data, blnr WriteMem, ui5r addr); 133EXPORTPROC dbglog_Access(char *s, ui5r Data, blnr WriteMem); 134#endif 135 136#if ! WantAbnormalReports 137#define ReportAbnormalID(id, s) 138#else 139#if dbglog_HAVE 140#define ReportAbnormalID DoReportAbnormalID 141#else 142#define ReportAbnormalID(id, s) DoReportAbnormalID(id) 143#endif 144EXPORTPROC DoReportAbnormalID(ui4r id 145#if dbglog_HAVE 146 , char *s 147#endif 148 ); 149#endif /* WantAbnormalReports */ 150 151EXPORTPROC VIAorSCCinterruptChngNtfy(void); 152 153EXPORTVAR(blnr, InterruptButton) 154EXPORTPROC SetInterruptButton(blnr v); 155 156enum { 157 kICT_SubTick, 158#if EmClassicKbrd 159 kICT_Kybd_ReceiveCommand, 160 kICT_Kybd_ReceiveEndCommand, 161#endif 162#if EmADB 163 kICT_ADB_NewState, 164#endif 165#if EmPMU 166 kICT_PMU_Task, 167#endif 168#if EmVIA1 169 kICT_VIA1_Timer1Check, 170 kICT_VIA1_Timer2Check, 171#endif 172#if EmVIA2 173 kICT_VIA2_Timer1Check, 174 kICT_VIA2_Timer2Check, 175#endif 176 177 kNumICTs 178}; 179 180EXPORTPROC ICT_add(int taskid, ui5b n); 181 182#define iCountt ui5b 183EXPORTFUNC iCountt GetCuriCount(void); 184EXPORTPROC ICT_Zap(void); 185 186EXPORTVAR(uimr, ICTactive) 187EXPORTVAR(iCountt, ICTwhen[kNumICTs]) 188EXPORTVAR(iCountt, NextiCount) 189 190EXPORTVAR(ui3b, Wires[kNumWires]) 191 192#define kLn2CycleScale 6 193#define kCycleScale (1 << kLn2CycleScale) 194 195#if WantCycByPriOp 196#define RdAvgXtraCyc /* 0 */ (kCycleScale + kCycleScale / 4) 197#define WrAvgXtraCyc /* 0 */ (kCycleScale + kCycleScale / 4) 198#endif 199 200#define kNumSubTicks 16 201 202 203#define HaveMasterMyEvtQLock EmClassicKbrd 204#if HaveMasterMyEvtQLock 205EXPORTVAR(ui4r, MasterMyEvtQLock) 206#endif 207EXPORTFUNC blnr FindKeyEvent(int *VirtualKey, blnr *KeyDown); 208 209 210/* minivmac extensions */ 211 212#define ExtnDat_checkval 0 213#define ExtnDat_extension 2 214#define ExtnDat_commnd 4 215#define ExtnDat_result 6 216#define ExtnDat_params 8 217 218#define kCmndVersion 0 219#define ExtnDat_version 8 220 221enum { 222 kExtnFindExtn, /* must be first */ 223 224 kExtnDisk, 225 kExtnSony, 226#if EmVidCard 227 kExtnVideo, 228#endif 229#if IncludeExtnPbufs 230 kExtnParamBuffers, 231#endif 232#if IncludeExtnHostTextClipExchange 233 kExtnHostTextClipExchange, 234#endif 235 236 kNumExtns 237}; 238 239#define kcom_callcheck 0x5B17 240 241EXPORTVAR(ui5r, my_disk_icon_addr) 242 243EXPORTPROC Memory_Reset(void); 244 245EXPORTPROC Extn_Reset(void); 246 247EXPORTPROC customreset(void); 248 249struct ATTer { 250 struct ATTer *Next; 251 ui5r cmpmask; 252 ui5r cmpvalu; 253 ui5r Access; 254 ui5r usemask; /* Should be one less than a power of two. */ 255 ui3p usebase; 256 ui3r MMDV; 257 ui3r Ntfy; 258 ui4r Pad0; 259 ui5r Pad1; /* make 32 byte structure, on 32 bit systems */ 260}; 261typedef struct ATTer ATTer; 262typedef ATTer *ATTep; 263 264#define kATTA_readreadybit 0 265#define kATTA_writereadybit 1 266#define kATTA_mmdvbit 2 267#define kATTA_ntfybit 3 268 269#define kATTA_readwritereadymask \ 270 ((1 << kATTA_readreadybit) | (1 << kATTA_writereadybit)) 271#define kATTA_readreadymask (1 << kATTA_readreadybit) 272#define kATTA_writereadymask (1 << kATTA_writereadybit) 273#define kATTA_mmdvmask (1 << kATTA_mmdvbit) 274#define kATTA_ntfymask (1 << kATTA_ntfybit) 275 276EXPORTFUNC ui5b MMDV_Access(ATTep p, ui5b Data, 277 blnr WriteMem, blnr ByteSize, CPTR addr); 278EXPORTFUNC blnr MemAccessNtfy(ATTep pT);