1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-01 08:29:37 +00:00

Moving around stuff. Preparation for loadable CPUs.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5645 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2012-04-06 11:35:56 +00:00
parent 74ee7a44a9
commit 4858614605
4 changed files with 67 additions and 102 deletions

View File

@ -1,88 +0,0 @@
/*****************************************************************************/
/* */
/* cpu-6502.h */
/* */
/* CPU core for the 6502 simulator */
/* */
/* */
/* */
/* (C) 2002-2012, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef CPU_6502_H
#define CPU_6502_H
/* sim65 */
#include "cpuregs.h"
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Registers */
extern CPURegs Regs;
/*****************************************************************************/
/* Code */
/*****************************************************************************/
void CPUInit (void);
/* Initialize the CPU */
void RESET (void);
/* Generate a CPU RESET */
void IRQRequest (void);
/* Generate an IRQ */
void NMIRequest (void);
/* Generate an NMI */
void Break (const char* Format, ...);
/* Stop running and display the given message */
void CPURun (void);
/* Run one CPU instruction */
/* End of cpu-6502.h */
#endif

View File

@ -1,8 +1,8 @@
/*****************************************************************************/
/* */
/* cpu-6502.c */
/* 6502.c */
/* */
/* CPU core for the 6502 simulator */
/* CPU core for the 6502 */
/* */
/* */
/* */
@ -44,9 +44,7 @@
#include "strbuf.h"
/* sim65 */
#include "cpu-6502.h"
#include "cpuregs.h"
#include "cputype.h"
#include "6502regs.h"
#include "error.h"
#include "global.h"
#include "memory.h"
@ -1037,15 +1035,11 @@ static void OPC_6502_6C (void)
unsigned Addr;
Cycles = 5;
Addr = MemReadWord (Regs.PC+1);
if (CPU == CPU_6502) {
/* Emulate the 6502 bug */
Regs.PC = MemReadByte (Addr);
Addr = (Addr & 0xFF00) | ((Addr + 1) & 0xFF);
Regs.PC |= (MemReadByte (Addr) << 8);
} else {
/* 65C02 and above have this bug fixed */
Regs.PC = MemReadWord (Addr);
}
/* Emulate the 6502 bug */
Regs.PC = MemReadByte (Addr);
Addr = (Addr & 0xFF00) | ((Addr + 1) & 0xFF);
Regs.PC |= (MemReadByte (Addr) << 8);
}

View File

@ -0,0 +1,59 @@
#
# gcc Makefile for the sim65 chip plugins
#
# Include directories
COMMON = ../../common
SIM65 = ..
CFLAGS = -g -Wall -W -std=c89
override CFLAGS += -I$(COMMON) -I$(SIM65) -fpic
CC = gcc
EBIND = emxbind
LDFLAGS =
#LIBS = $(COMMON)/common.a
CPUS = 6502.so
OBJS = $(CPUS:.so=.o)
#----------------------------------------------------------------------------
# Build rules
%.obj: %.c
$(CC) $(CFLAGS) $^
%.so: %.o
$(CC) $(CFLAGS) -shared -o $@ $(LIBS) $^ -L /usr/X11R6/lib -lX11
@if [ $(OS2_SHELL) ] ; then $(EBIND) $@ ; fi
#----------------------------------------------------------------------------
.PHONY: all
ifeq (.depend,$(wildcard .depend))
all: $(CPUS)
include .depend
else
all: depend
@$(MAKE) -f make/gcc.mak all
endif
# Admin stuff
clean:
rm -f *~ core *.lst
zap: clean
rm -f *.o $(EXECS) .depend
# ------------------------------------------------------------------------------
# Make the dependencies
.PHONY: depend dep
depend dep: $(CPUS:.so=.c)
@echo "Creating dependency information"
$(CC) $(CFLAGS) -MM $^ > .depend