From 2faabd88b7f9c9f1b9269a0be1792e8aa6519035 Mon Sep 17 00:00:00 2001 From: sato_tiff Date: Mon, 29 Dec 2008 11:35:48 +0000 Subject: [PATCH] =?utf8?q?nesheader.exe=20=E9=96=A2=E9=80=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.osdn.net/svnroot/unagi@219 24ea1065-a21e-4ca1-99c9-f5125deb0858 --- client/trunk/Makefile | 7 +++++++ client/trunk/header.c | 7 ++++++- client/trunk/header.h | 3 +++ client/trunk/paralellport.h | 12 ++++++++++-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/client/trunk/Makefile b/client/trunk/Makefile index 4b10dd0..bfbe3f0 100644 --- a/client/trunk/Makefile +++ b/client/trunk/Makefile @@ -4,6 +4,7 @@ OBJ = \ flashmemory.o \ file.o textutil.o giveio.o unagi.res.o OBJ_HK = giveio.o reader_hongkongfc.o +OBJ_HD = head/nesheader.o head/header.o file.o TARGET = unagi.exe CC = gcc CFLAGS = -Wall -Werror -Wmissing-declarations #-Wcast-qual @@ -23,8 +24,14 @@ endif all: $(TARGET) unagi.d client_test.o: test/client_test.c $(CC) $(CFLAGS) -I. -c -o $@ $< +head/nesheader.o: nesheader.c + $(CC) $(CFLAGS) -DHEADEROUT -I. -c -o $@ $< +head/header.o: header.c + $(CC) $(CFLAGS) -DHEADEROUT -I. -c -o $@ $< unagi.d: $(CC) -MM $(CFLAGS) *.c > $@ +nesheader.exe: $(OBJ_HD) + $(CC) -o $@ $(OBJ_HD) hk.exe: $(OBJ_HK) $(CC) -o $@ $(OBJ_HK) iodel.exe: iodel.o giveio.o diff --git a/client/trunk/header.c b/client/trunk/header.c index 3193047..6878635 100644 --- a/client/trunk/header.c +++ b/client/trunk/header.c @@ -22,7 +22,10 @@ static const u8 NES_HEADER_INIT[NES_HEADER_SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static void nesheader_set(const struct romimage *r, u8 *header) +#ifndef HEADEROUT +static +#endif +void nesheader_set(const struct romimage *r, u8 *header) { memcpy(header, NES_HEADER_INIT, NES_HEADER_SIZE); header[4] = r->cpu_rom.size / PROGRAM_ROM_MIN; @@ -38,6 +41,7 @@ static void nesheader_set(const struct romimage *r, u8 *header) header[7] |= r->mappernum & 0xf0; } +#ifndef HEADEROUT /* returnÃÍ: error count */ @@ -311,3 +315,4 @@ int nesfile_load(const char *errorprefix, const char *file, struct romimage *r) free(buf); return OK; } +#endif diff --git a/client/trunk/header.h b/client/trunk/header.h index 6df9a31..f2c198f 100644 --- a/client/trunk/header.h +++ b/client/trunk/header.h @@ -42,6 +42,9 @@ enum{ MEMORY_ATTR_READ, MEMORY_ATTR_WRITE, MEMORY_ATTR_NOTUSE }; +#ifdef HEADEROUT +void nesheader_set(const struct romimage *r, u8 *header); +#endif int nesbuffer_malloc(struct romimage *r, int mode); void nesfile_create(struct romimage *r, const char *romfilename); void nesbuffer_free(struct romimage *r, int mode); diff --git a/client/trunk/paralellport.h b/client/trunk/paralellport.h index c1060d5..a33ad58 100644 --- a/client/trunk/paralellport.h +++ b/client/trunk/paralellport.h @@ -5,7 +5,6 @@ famicom ROM cartridge utility - unagi #ifndef _PARALELL_PORT_INLINE_H_ #define _PARALELL_PORT_INLINE_H_ #include "giveio.h" -//#include ? #include #define ASM_ENABLE (0) enum{ @@ -22,9 +21,18 @@ enum{ M2_CONTROL_TRUE, M2_CONTROL_FALSE }; +int _inp(int); #if ASM_ENABLE==0 void _outp(int, int); -int _inp(int); +#else +static inline void _outp(int address, int data){ + asm( + " movl %0,%%edx\n" + " movl %1,%%eax\n" + " out %%al,%%dx\n" + :: "q"(address), "q"(data): "%edx", "%eax" + ); +} #endif /* -- 2.11.0