1 /* Miscellaneous definitions for xz80, copyright (C) 1994 Ian Collier.
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.
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.
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.
28 #define SEG_SIZE_BITS 13
29 #define SEG_MASK 0x1FFF
30 #define NUM_SEGS (65536/SEG_SIZE)
32 extern unsigned char mem[];
33 extern unsigned char *segments[NUM_SEGS];
36 extern int hsize,vsize;
37 extern volatile int interrupted;
41 void printGBfloat(unsigned fhl, unsigned fde);
42 void switchBank( int segment, unsigned bank );
44 extern int mainloop();
46 #define fetch(x) (segments[x>>SEG_SIZE_BITS][x&SEG_MASK])
47 #define fetch2(x) ((segments[(x+1)>>SEG_SIZE_BITS][(x+1)&SEG_MASK]<<8)| segments[x>>SEG_SIZE_BITS][x&SEG_MASK])
49 #define store( addr, value ) segments[addr>>SEG_SIZE_BITS][addr&SEG_MASK]=value;
51 #define store2b(addr,hi,lo) \
52 segments[addr>>SEG_SIZE_BITS][addr&SEG_MASK]=(lo);\
53 segments[(addr+1)>>SEG_SIZE_BITS][(addr+1)&SEG_MASK]=(hi);
55 #define store2(x,y) store2b(x,(y)>>8,(y)&255)
58 static void inline storefunc(unsigned short ad,unsigned char b){
62 #define store(x,y) storefunc(x,y)
64 static void inline store2func(unsigned short ad,unsigned char b1,unsigned char b2){
68 #define store2b(x,hi,lo) store2func(x,hi,lo)