mirror of
https://github.com/cc65/cc65.git
synced 2025-02-26 23:30:03 +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:
parent
74ee7a44a9
commit
4858614605
@ -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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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"
|
#include "strbuf.h"
|
||||||
|
|
||||||
/* sim65 */
|
/* sim65 */
|
||||||
#include "cpu-6502.h"
|
#include "6502regs.h"
|
||||||
#include "cpuregs.h"
|
|
||||||
#include "cputype.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
@ -1037,15 +1035,11 @@ static void OPC_6502_6C (void)
|
|||||||
unsigned Addr;
|
unsigned Addr;
|
||||||
Cycles = 5;
|
Cycles = 5;
|
||||||
Addr = MemReadWord (Regs.PC+1);
|
Addr = MemReadWord (Regs.PC+1);
|
||||||
if (CPU == CPU_6502) {
|
|
||||||
/* Emulate the 6502 bug */
|
/* Emulate the 6502 bug */
|
||||||
Regs.PC = MemReadByte (Addr);
|
Regs.PC = MemReadByte (Addr);
|
||||||
Addr = (Addr & 0xFF00) | ((Addr + 1) & 0xFF);
|
Addr = (Addr & 0xFF00) | ((Addr + 1) & 0xFF);
|
||||||
Regs.PC |= (MemReadByte (Addr) << 8);
|
Regs.PC |= (MemReadByte (Addr) << 8);
|
||||||
} else {
|
|
||||||
/* 65C02 and above have this bug fixed */
|
|
||||||
Regs.PC = MemReadWord (Addr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
59
src/sim65/cpus/make/gcc.mak
Normal file
59
src/sim65/cpus/make/gcc.mak
Normal 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
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user