/* common */
#include "coll.h"
+#include "print.h"
#include "xmalloc.h"
/* sim65 */
-static int CmpChips (void* Data attribute ((unused)),
+static int CmpChips (void* Data attribute ((unused)),
const void* lhs, const void* rhs)
/* Compare function for CollSort */
{
Chip* C;
void* H;
const char* Msg;
+ unsigned Ver;
+ const char* Name;
/* Locate the library */
- char* PathName = FindChip (LibName);
+ char* PathName = FindChipLib (LibName);
if (PathName == 0) {
/* Library not found */
Error ("Cannot find chip plugin library `%s'", LibName);
C = NewChip (H, LibName);
/* Read function pointers */
- C->InitChip = GetSym (C, "InitChip");
+/* C->InitChip = GetSym (C, "InitChip"); */
C->GetName = GetSym (C, "GetName");
C->GetVersion = GetSym (C, "GetVersion");
- C->WriteCtrl = GetSym (C, "WriteCtrl");
- C->Write = GetSym (C, "Write");
- C->ReadCtrl = GetSym (C, "ReadCtrl");
- C->Read = GetSym (C, "Read");
+/* C->WriteCtrl = GetSym (C, "WriteCtrl"); */
+/* C->Write = GetSym (C, "Write"); */
+/* C->ReadCtrl = GetSym (C, "ReadCtrl"); */
+/* C->Read = GetSym (C, "Read"); */
/* Insert the structure into the list of all chips */
CollAppend (&Chips, C);
+
+ /* Call the functions */
+ Name = C->GetName ();
+ Ver = C->GetVersion ();
+ printf ("%s version %u\n", Name, Ver);
}
-const Chip* GetChip (const char* Name)
+const Chip* FindChip (const char* Name)
/* Find a chip by name. Returns the Chip data structure or NULL if the chip
* could not be found.
*/
void InitChips (void);
/* Initialize the chips. Must be called *after* all chips are loaded */
-const Chip* GetChip (const char* Name);
+const Chip* FindChip (const char* Name);
/* Find a chip by name. Returns the Chip data structure or NULL if the chip
* could not be found.
*/
--- /dev/null
+/*****************************************************************************/
+/* */
+/* chipif.h */
+/* */
+/* Interface header file for plugins - unused by sim65 */
+/* */
+/* */
+/* */
+/* (C) 2002 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@musoftware.de */
+/* */
+/* */
+/* 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 CHIPIF_H
+#define CHIPIF_H
+
+
+
+/* sim65 */
+#include "simdata.h"
+
+
+
+/* End of chipif.h */
+
+#endif
+
+
+
-char* FindChip (const char* LibName)
+char* FindChipLib (const char* LibName)
/* Find a chip library. Return a pointer to a malloced area that contains
* the complete path, if found, return 0 otherwise.
*/
void AddChipPath (const char* NewPath);
/* Add a search path for chips */
-char* FindChip (const char* LibName);
+char* FindChipLib (const char* LibName);
/* Find a chip library. Return a pointer to a malloced area that contains
* the complete path, if found, return 0 otherwise.
*/
--- /dev/null
+.depend
+*.so
--- /dev/null
+#
+# gcc Makefile for the sim65 chip plugins
+#
+
+# Library dir
+SIM65 = ..
+
+CFLAGS = -g -O2 -Wall -W -I$(SIM65) -fpic
+CC = gcc
+EBIND = emxbind
+LDFLAGS =
+
+CHIPS = ram.so
+
+OBJS = $(CHIPS:.so=.o)
+
+.PHONY: all
+ifeq (.depend,$(wildcard .depend))
+all: $(CHIPS)
+include .depend
+else
+all: depend
+ @$(MAKE) -f make/gcc.mak all
+endif
+
+
+ram.so: ram.o
+ $(CC) $(CFLAGS) -shared -o $@ $^
+ @if [ $(OS2_SHELL) ] ; then $(EBIND) $@ ; fi
+
+clean:
+ rm -f *~ core *.lst
+
+zap: clean
+ rm -f *.o $(EXECS) .depend
+
+# ------------------------------------------------------------------------------
+# Make the dependencies
+
+.PHONY: depend dep
+depend dep: $(CHIPS:.so=.c)
+ @echo "Creating dependency information"
+ $(CC) -I$(SIM65) -MM $^ > .depend
+
+
--- /dev/null
+/*****************************************************************************/
+/* */
+/* ram.c */
+/* */
+/* RAM plugin for the sim65 6502 simulator */
+/* */
+/* */
+/* */
+/* (C) 2002 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@musoftware.de */
+/* */
+/* */
+/* 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. */
+/* */
+/*****************************************************************************/
+
+
+
+/* sim65 */
+#include "chipif.h"
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+const char* GetName (void)
+{
+ return "RAM";
+}
+
+
+
+unsigned GetVersion (void)
+{
+ return 1;
+}
+
+
+
#include "print.h"
#include "version.h"
-/* sim65 */
+/* sim65 */
+#include "chip.h"
+#include "chippath.h"
#include "cpucore.h"
#include "cputype.h"
#include "global.h"
}
/* Initialize modules */
+ AddChipPath ("chips");
+ LoadChip ("ram.so");
MemInit ();
MemLoad ("uz.bin", 0x200, 0);
CPUInit ();
error.o \
global.o \
main.o \
- memory.o
+ memory.o \
+ simdata.o
LIBS = $(COMMON)/common.a
--- /dev/null
+/*****************************************************************************/
+/* */
+/* simdata.c */
+/* */
+/* Simulator data passed to the chip plugins */
+/* */
+/* */
+/* */
+/* (C) 2002 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@musoftware.de */
+/* */
+/* */
+/* 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. */
+/* */
+/*****************************************************************************/
+
+
+
+/* sim65 */
+#include "simdata.h"
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+/* SimData instance */
+const SimData Sim65Data = {
+ 1, /* MajorVersion */
+ 1 /* MinorVersion */
+};
+
+
+
--- /dev/null
+/*****************************************************************************/
+/* */
+/* simdata.h */
+/* */
+/* Simulator data passed to the chip plugins */
+/* */
+/* */
+/* */
+/* (C) 2002 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@musoftware.de */
+/* */
+/* */
+/* 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 SIMDATA_H
+#define SIMDATA_H
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+/* SimData structure */
+typedef struct SimData SimData;
+struct SimData {
+ unsigned MajorVersion;
+ unsigned MinorVersion;
+};
+
+/* SimData instance */
+extern const SimData Sim65Data;
+
+
+
+/* End of simdata.h */
+
+#endif
+
+
+