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