summaryrefslogtreecommitdiff
path: root/apps/plugins/zxbox/sp_def.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/zxbox/sp_def.h')
-rw-r--r--apps/plugins/zxbox/sp_def.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/apps/plugins/zxbox/sp_def.h b/apps/plugins/zxbox/sp_def.h
new file mode 100644
index 0000000000..1030be120c
--- /dev/null
+++ b/apps/plugins/zxbox/sp_def.h
@@ -0,0 +1,84 @@
1/*
2 * Copyright (C) 1996-1998 Szeredi Miklos
3 * Email: mszeredi@inf.bme.hu
4 *
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.
9 *
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.
14 *
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.
18 *
19 */
20
21#include "spperif.h"
22
23#define MARK_SCR(addr) SPNM(scr_mark)[(addr) >> 5] |= 1 << ((addr) & 0x1F)
24
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 } \
36}
37
38#define SOUNDPORT 0x10
39
40/* TODO: attribute or pixel byte is present on unused ports? */
41
42
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 } \
62}
63
64
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); \
77}
78
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;
84