Build doom on clipv2 and clip+
[kugel-rb.git] / apps / plugins / zxbox / sp_def.h
blob931804ff9c27e845964efeaecccf386783c8a49b
1 /*
2 * Copyright (C) 1996-1998 Szeredi Miklos
3 * Email: mszeredi@inf.bme.hu
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. See the file COPYING.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "spperif.h"
23 #define MARK_SCR(addr) SPNM(scr_mark)[(addr) >> 5] |= BIT_N((addr) & 0x1F)
25 #define PUTMEM(addr, ptr, val) \
26 { \
27 register byte addrhi; \
28 addrhi = (dbyte) (addr) >> 8; \
29 if(addrhi >= 0x5B) *(ptr) = (val); \
30 else if(addrhi & 0x40) { \
31 *(ptr) = (val); \
32 MARK_SCR((dbyte) (addr)); \
33 if(DANM(next_scri) >= 0 && DANM(tc) > 86) \
34 DANM(tc) -= 2; \
35 } \
38 #define SOUNDPORT 0x10
40 /* TODO: attribute or pixel byte is present on unused ports? */
43 #define IN(porth, portl, dest) \
44 { \
45 if(!((portl) & DANM(inport_mask))) { \
46 dest = PORT(inports)[portl]; \
47 } \
48 else if(!((portl) & 1)) { \
49 if(DANM(imp_change) > DANM(tc)) { \
50 DANM(imp_change) = 0; \
51 DANM(ula_inport) ^= 0x40; \
52 } \
53 dest = SPECP(fe_inport_high)[porth] & DANM(ula_inport); \
54 DANM(tc) -= 1; \
55 } \
56 else { \
57 register int scri; \
58 scri = DANM(next_scri); \
59 dest = (scri < 0 || DANM(tc) <= 96) \
60 ? 0xFF : DANM(mem)[(scri<<5)+((224-DANM(tc))>>2)]; \
61 } \
65 #define OUT(porth, portl, source) \
66 { \
67 if(!((portl) & 1)) { \
68 if((DANM(ula_outport) ^ (source)) & SOUNDPORT) { \
69 DANM(sound_change) = 1; \
70 if((source) & SOUNDPORT) DANM(sound_sam) += DANM(tc); \
71 else DANM(sound_sam) -= DANM(tc); \
72 } \
73 DANM(ula_outport) = (source); \
74 DANM(tc) -= 1; \
75 } \
76 PORT(outports)[portl] = (source); \
79 #define DI_CHECK \
80 if(PC == LOAD_DI+1 && SPNM(quick_load)) \
81 SPNM(load_trapped) = 1, \
82 DANM(haltstate) = 1, \
83 DANM(tc) = 0;