fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
at master 87 lines 3.5 kB view raw
1/***************************************************************************** 2 * pce * 3 *****************************************************************************/ 4 5/***************************************************************************** 6 * File name: src/cpu/e6502/internal.h * 7 * Created: 2004-05-23 by Hampa Hug <hampa@hampa.ch> * 8 * Copyright: (C) 2004-2011 Hampa Hug <hampa@hampa.ch> * 9 *****************************************************************************/ 10 11/***************************************************************************** 12 * This program is free software. You can redistribute it and / or modify it * 13 * under the terms of the GNU General Public License version 2 as published * 14 * by the Free Software Foundation. * 15 * * 16 * This program is distributed in the hope that it will be useful, but * 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 * Public License for more details. * 20 *****************************************************************************/ 21 22 23#ifndef PCE_E6502_INTERNAL_H 24#define PCE_E6502_INTERNAL_H 1 25 26 27#include "e6502.h" 28 29 30#define e6502_set_clk(cpu, cnt, clk) do { \ 31 (cpu)->pc = ((cpu)->pc + (cnt)) & 0xffff; \ 32 (cpu)->delay += (clk); \ 33 } while (0) 34 35#define e6502_get_inst1(c) do { \ 36 (c)->inst[1] = e6502_get_mem8 (c, (c->pc + 1) & 0xffff); \ 37 } while (0) 38 39#define e6502_get_inst2(c) do { \ 40 (c)->inst[1] = e6502_get_mem8 (c, (c->pc + 1) & 0xffff); \ 41 (c)->inst[2] = e6502_get_mem8 (c, (c->pc + 2) & 0xffff); \ 42 } while (0) 43 44#define e6502_mk_uint16(lo, hi) \ 45 ((((hi) & 0xff) << 8) + ((lo) & 0xff)) 46 47#define e6502_mk_sint16(lo) \ 48 (((lo) & 0x80) ? ((lo) | 0xff00) : ((lo) & 0xff)) 49 50 51#define e6502_get_idx_ind_x(c) e6502_get_mem8 (c, e6502_get_ea_idx_ind_x (c)) 52#define e6502_get_zpg(c) e6502_get_mem8 (c, e6502_get_ea_zpg (c)) 53#define e6502_get_abs(c) e6502_get_mem8 (c, e6502_get_ea_abs (c)) 54#define e6502_get_ind_idx_y(c) e6502_get_mem8 (c, e6502_get_ea_ind_idx_y (c)) 55#define e6502_get_zpg_x(c) e6502_get_mem8 (c, e6502_get_ea_zpg_x (c)) 56#define e6502_get_zpg_y(c) e6502_get_mem8 (c, e6502_get_ea_zpg_y (c)) 57#define e6502_get_abs_y(c) e6502_get_mem8 (c, e6502_get_ea_abs_y (c)) 58#define e6502_get_abs_x(c) e6502_get_mem8 (c, e6502_get_ea_abs_x (c)) 59#define e6502_set_ea(c, v) e6502_set_mem8 ((c), (c)->ea, (v)) 60 61 62int e6502_hook_all (e6502_t *c); 63int e6502_hook_undefined (e6502_t *c); 64int e6502_hook_brk (e6502_t *c); 65 66 67unsigned char e6502_get_imm (e6502_t *c); 68unsigned short e6502_get_ea_idx_ind_x (e6502_t *c); 69unsigned short e6502_get_ea_zpg (e6502_t *c); 70unsigned short e6502_get_ea_abs (e6502_t *c); 71unsigned short e6502_get_ea_ind_idx_y (e6502_t *c); 72unsigned short e6502_get_ea_zpg_x (e6502_t *c); 73unsigned short e6502_get_ea_zpg_y (e6502_t *c); 74unsigned short e6502_get_ea_abs_y (e6502_t *c); 75unsigned short e6502_get_ea_abs_x (e6502_t *c); 76 77 78extern e6502_opcode_f e6502_opcodes[256]; 79 80unsigned char e6502_pull (e6502_t *c); 81unsigned short e6502_pull16 (e6502_t *c); 82void e6502_push (e6502_t *c, unsigned char val); 83void e6502_push16 (e6502_t *c, unsigned short val); 84void e6502_trap (e6502_t *c, unsigned short addr); 85 86 87#endif