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.
26 #define GHL DANM(cbaddr)
28 #define B7(r) (((r) & 0x80) >> 7)
29 #define B0(r) ((r) & 0x01)
31 #define SHIFTROTL(r, mod) \
36 RF = (RF & ~(AALLF)) | carry | \
37 TAB(orf_tbl)[(byte) r]; \
41 #define SHIFTROTR(r, mod) \
46 RF = (RF & ~(AALLF)) | carry | \
47 TAB(orf_tbl)[(byte) r]; \
51 #define RLC(r) SHIFTROTL(r, (r << 1) | carry)
52 #define RRC(r) SHIFTROTR(r, (r >> 1) | (carry << 7))
53 #define RLN(r) SHIFTROTL(r, (r << 1) | (RF & CF))
54 #define RRN(r) SHIFTROTR(r, (r >> 1) | ((RF & CF) << 7))
55 #define SLA(r) SHIFTROTL(r, r << 1)
56 #define SRA(r) SHIFTROTR(r, (byte) ((sbyte) r >> 1))
57 #define SLL(r) SHIFTROTL(r, (r << 1) | 0x01)
58 #define SRL(r) SHIFTROTR(r, r >> 1)
61 #define SHRR(shrn, func, an, rn, r, n) \
62 OPDEF(shrn ## _ ## rn, 0x00+an*8+n) \
68 #define SHRIHL(shrn, func, an) \
69 OPDEF(shrn ## _ihl, 0x06+an*8) \
78 #define RLC_R(rn, r, n) SHRR(rlc, RLC, 0, rn, r, n)
79 #define RRC_R(rn, r, n) SHRR(rrc, RRC, 1, rn, r, n)
80 #define RL_R(rn, r, n) SHRR(rl, RLN, 2, rn, r, n)
81 #define RR_R(rn, r, n) SHRR(rr, RRN, 3, rn, r, n)
82 #define SLA_R(rn, r, n) SHRR(sla, SLA, 4, rn, r, n)
83 #define SRA_R(rn, r, n) SHRR(sra, SRA, 5, rn, r, n)
84 #define SLL_R(rn, r, n) SHRR(sll, SLL, 6, rn, r, n)
85 #define SRL_R(rn, r, n) SHRR(srl, SRL, 7, rn, r, n)
161 RF = (RF & ~(SF | ZF | NF)) | (r & SF) | (((~r >> n) & 0x01) << 6)
163 #define BIT_N_R(bn, rn, r, n) \
164 OPDEF(bit_ ## bn ## _ ## rn, 0x40+bn*8+n) \
170 #define BIT_N_IHL(bn) \
171 OPDEF(bit_ ## bn ## _ihl, 0x46+bn*8) \
173 register byte btmp; \
252 #define RES(r, n) r &= ~(1 << n)
254 #define RES_N_R(bn, rn, r, n) \
255 OPDEF(res_ ## bn ## _ ## rn, 0x80+bn*8+n) \
261 #define RES_N_IHL(bn) \
262 OPDEF(res_ ## bn ## _ihl, 0x86+bn*8) \
264 register byte btmp; \
346 #define SET(r, n) r |= (1 << n)
348 #define SET_N_R(bn, rn, r, n) \
349 OPDEF(set_ ## bn ## _ ## rn, 0xC0+bn*8+n) \
355 #define SET_N_IHL(bn) \
356 OPDEF(set_ ## bn ## _ihl, 0x86+bn*8) \
358 register byte btmp; \