|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * custom chip support
5: *
6: * (c) 1995 Bernd Schmidt
7: */
8:
9: #ifndef WINUAE_CUSTOM_H
10: #define WINUAE_CUSTOM_H
11:
12: #include "rpt.h"
13:
14: /* These are the masks that are ORed together in the chipset_mask option.
15: * If CSMASK_AGA is set, the ECS bits are guaranteed to be set as well. */
16: #define CSMASK_ECS_AGNUS 1
17: #define CSMASK_ECS_DENISE 2
18: #define CSMASK_AGA 4
19: #define CSMASK_MASK (CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA)
20:
21: uae_u32 get_copper_address (int copno);
22:
23: extern int custom_init (void);
24: extern void customreset (void);
25: extern int intlev (void);
26: extern void dumpcustom (void);
27: extern void uae_reset (int hardreset);
28:
29: extern void do_disk (void);
30: extern void do_copper (void);
31:
32: extern void notice_new_xcolors (void);
33: extern void notice_screen_contents_lost (void);
34: extern void init_row_map (void);
35: extern void init_hz (void);
36: extern void init_custom (void);
37:
38: extern bool picasso_requested_on;
39: extern bool picasso_on;
40: extern void set_picasso_hack_rate (int hz);
41:
42: /* Set to 1 to leave out the current frame in average frame time calculation.
43: * Useful if the debugger was active. */
44: extern int bogusframe;
45: extern unsigned long int hsync_counter;
46:
47: extern uae_u16 dmacon;
48: extern uae_u16 intena, intreq, intreqr;
49:
50: extern int current_hpos (void);
51: extern int vpos;
52:
53: extern int find_copper_record (uaecptr, int *, int *);
54:
55: extern int n_frames;
56:
57: STATIC_INLINE int dmaen (unsigned int dmamask)
58: {
59: return (dmamask & dmacon) && (dmacon & 0x200);
60: }
61:
62:
63: #define SPCFLAG_STOP 2
64: #define SPCFLAG_COPPER 4
65: #define SPCFLAG_INT 8
66: //#define SPCFLAG_BRK 16
67: //#define SPCFLAG_EXTRA_CYCLES 32
68: //#define SPCFLAG_TRACE 64
69: //#define SPCFLAG_DOTRACE 128
70: //#define SPCFLAG_DOINT 256 /* arg, JIT fails without this.. */
71: #define SPCFLAG_BLTNASTY 512
72: //#define SPCFLAG_EXEC 1024
73: #define SPCFLAG_ACTION_REPLAY 2048
74: #define SPCFLAG_TRAP 4096 /* enforcer-hack */
75: //#define SPCFLAG_MODE_CHANGE 8192
76: #ifdef JIT
77: #define SPCFLAG_END_COMPILE 16384
78: #endif
79:
80: extern uae_u16 adkcon;
81:
82: extern unsigned int joy0dir, joy1dir;
83: extern int joy0button, joy1button;
84:
85: extern void INTREQ (uae_u16);
86: extern void INTREQ_0 (uae_u16);
87: extern void INTREQ_f (uae_u16);
88: extern void send_interrupt (int num, int delay);
89: extern uae_u16 INTREQR (void);
90:
91: /* maximums for statically allocated tables */
92: #ifdef UAE_MINI
93: /* absolute minimums for basic A500/A1200-emulation */
94: #define MAXHPOS 227
95: #define MAXVPOS 312
96: #else
97: #define MAXHPOS 256
98: #define MAXVPOS 592
99: #endif
100:
101: /* PAL/NTSC values */
102:
103: #define MAXHPOS_PAL 227
104: #define MAXHPOS_NTSC 227
105: #define MAXVPOS_PAL 312
106: #define MAXVPOS_NTSC 262
107: #define VBLANK_ENDLINE_PAL 26
108: #define VBLANK_ENDLINE_NTSC 21
109: #define VBLANK_SPRITE_PAL 25
110: #define VBLANK_SPRITE_NTSC 20
111: #define VBLANK_HZ_PAL 50
112: #define VBLANK_HZ_NTSC 60
113: #define EQU_ENDLINE_PAL 9
114: #define EQU_ENDLINE_NTSC 10
115:
116: extern int maxhpos, maxhpos_short;
117: extern int maxvpos, maxvpos_nom;
118: extern int hsyncstartpos;
119: extern int minfirstline, vblank_endline, numscrlines;
120: extern int vblank_hz, fake_vblank_hz, vblank_skip, doublescan;
121: extern frame_time_t syncbase;
122: #define NUMSCRLINES (maxvpos + 1 - minfirstline + 1)
123:
124: #define DMA_AUD0 0x0001
125: #define DMA_AUD1 0x0002
126: #define DMA_AUD2 0x0004
127: #define DMA_AUD3 0x0008
128: #define DMA_DISK 0x0010
129: #define DMA_SPRITE 0x0020
130: #define DMA_BLITTER 0x0040
131: #define DMA_COPPER 0x0080
132: #define DMA_BITPLANE 0x0100
133: #define DMA_MASTER 0x0200
134: #define DMA_BLITPRI 0x0400
135:
136: #define CYCLE_REFRESH 0x01
137: #define CYCLE_STROBE 0x02
138: #define CYCLE_MISC 0x04
139: #define CYCLE_SPRITE 0x08
140: #define CYCLE_COPPER 0x10
141: #define CYCLE_BLITTER 0x20
142: #define CYCLE_CPU 0x40
143: #define CYCLE_CPUNASTY 0x80
144:
145: extern unsigned long frametime, timeframes;
146: extern int plfstrt, plfstop, plffirstline, plflastline;
147: extern uae_u16 htotal, vtotal, beamcon0;
148:
149: /* 100 words give you 1600 horizontal pixels. Should be more than enough for
150: * superhires. Don't forget to update the definition in genp2c.c as well.
151: * needs to be larger for superhires support */
152: #ifdef CUSTOM_SIMPLE
153: #define MAX_WORDS_PER_LINE 50
154: #else
155: #define MAX_WORDS_PER_LINE 100
156: #endif
157:
158: extern uae_u32 hirestab_h[256][2];
159: extern uae_u32 lorestab_h[256][4];
160:
161: extern uae_u32 hirestab_l[256][1];
162: extern uae_u32 lorestab_l[256][2];
163:
164: #ifdef AGA
165: /* AGA mode color lookup tables */
166: extern unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256];
167: #endif
168: extern int xredcolor_s, xredcolor_b, xredcolor_m;
169: extern int xgreencolor_s, xgreencolor_b, xgreencolor_m;
170: extern int xbluecolor_s, xbluecolor_b, xbluecolor_m;
171:
172: #define RES_LORES 0
173: #define RES_HIRES 1
174: #define RES_SUPERHIRES 2
175: #define RES_MAX 2
176: #define VRES_NONDOUBLE 0
177: #define VRES_DOUBLE 1
178: #define VRES_MAX 1
179:
180: /* calculate shift depending on resolution (replaced "decided_hires ? 4 : 8") */
181: #define RES_SHIFT(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2)
182:
183: /* get resolution from bplcon0 */
184: #if AMIGA_ONLY
185: STATIC_INLINE int GET_RES_DENISE (uae_u16 con0)
186: {
187: if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE))
188: con0 &= ~0x40;
189: return ((con0) & 0x8000) ? RES_HIRES : ((con0) & 0x40) ? RES_SUPERHIRES : RES_LORES;
190: }
191: STATIC_INLINE int GET_RES_AGNUS (uae_u16 con0)
192: {
193: if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
194: con0 &= ~0x40;
195: return ((con0) & 0x8000) ? RES_HIRES : ((con0) & 0x40) ? RES_SUPERHIRES : RES_LORES;
196: }
197: #endif // AMIGA_ONLY
198:
199: /* get sprite width from FMODE */
200: #define GET_SPRITEWIDTH(FMODE) ((((FMODE) >> 2) & 3) == 3 ? 64 : (((FMODE) >> 2) & 3) == 0 ? 16 : 32)
201: /* Compute the number of bitplanes from a value written to BPLCON0 */
202: STATIC_INLINE int GET_PLANES(uae_u16 bplcon0)
203: {
204: if ((bplcon0 & 0x0010) && (bplcon0 & 0x7000))
205: return 0;
206: if (bplcon0 & 0x0010)
207: return 8;
208: return (bplcon0 >> 12) & 7;
209: }
210:
211: extern void fpscounter_reset (void);
212: extern unsigned long idletime;
213: extern int lightpen_x, lightpen_y, lightpen_cx, lightpen_cy;
214:
215: struct customhack {
216: uae_u16 v;
217: int vpos, hpos;
218: };
219: void customhack_put (struct customhack *ch, uae_u16 v, int hpos);
220: uae_u16 customhack_get (struct customhack *ch, int hpos);
221: extern void alloc_cycle_ext (int, int);
222: extern bool ispal (void);
223: extern int inprec_open(char *fname, int record);
224: extern void sleep_millis (int ms);
225: extern void mmu_do_hit (void);
226:
227: #endif /* WINUAE_CUSTOM_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.