1 /* Miscellaneous definitions for xz80, copyright (C) 1994 Ian Collier.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18 #define Z80_quit 1
19 #define Z80_NMI 2
20 #define Z80_reset 3
21 #define Z80_load 4
22 #define Z80_save 5
23 #define Z80_log 6
24
25 extern void z80loop(unsigned char *data,unsigned char *stacketc);
26
27 #define fetch(x) (mem[x])
28 #define fetch2(x) ((fetch(((x)+1)&0xffff)<<8)|fetch(x))
29
30 #define store(x,y) do {\
31 mem[x]=(y); \
32 } while(0)
33
34 #define store2b(x,hi,lo) do {\
35 mem[x]=lo; \
36 mem[(x+1)&0xffff]=hi; \
37 } while(0)
38
39 #define store2(x,y) store2b(x,(y)>>8,(y)&255)
40
41 #ifdef __GNUC__
storefunc(unsigned short ad,unsigned char b)42 static void inline storefunc(unsigned short ad,unsigned char b){
43 store(ad,b);
44 }
45 #undef store
46 #define store(x,y) storefunc(x,y)
47
store2func(unsigned short ad,unsigned char b1,unsigned char b2)48 static void inline store2func(unsigned short ad,unsigned char b1,unsigned char b2){
49 store2b(ad,b1,b2);
50 }
51 #undef store2b
52 #define store2b(x,hi,lo) store2func(x,hi,lo)
53 #endif
54
55 #define bc ((b<<8)|c)
56 #define de ((d<<8)|e)
57 #define hl ((h<<8)|l)
58