file.o textutil.o giveio.o unagi.res.o
OBJ_HK = giveio.o driver_hongkongfc.o
TARGET = unagi.exe
-CFLAGS = -O0 -Wall -g -DDEBUG=1
-#CFLAGS = -O2 -Wall -DDEBUG=0
+#CFLAGS = -O0 -Wall -g -DDEBUG=1
+CFLAGS = -O2 -Wall -DDEBUG=0
all: $(TARGET)
hk.exe: $(OBJ_HK)
gcc -o $@ $(OBJ_HK)
+iodel.exe: iodel.o giveio.o
+ gcc -o $@ iodel.o giveio.o
clean:
rm -f $(OBJ) $(TARGET)
$(TARGET): $(OBJ)
data_port_latch(DATA_SELECT_A7toA0, address & 0xff);
}
-static u8 data_port_get(long address)
+static u8 data_port_get(long address, int m2)
{
int s = DATA_SELECT_READ << BITNUM_CONTROL_DATA_SELECT;
s = bit_set(s, BITNUM_CONTROL_DATA_LATCH);
{
data_port_latch(DATA_SELECT_WRITEDATA, data);
data_port_latch(DATA_SELECT_CONTROL, c);
- c = bit_clear(c, BITNUM_WRITEDATA_LATCH);
+ c = bit_set(c, BITNUM_WRITEDATA_LATCH);
data_port_latch(DATA_SELECT_CONTROL, c);
}
//A15 ¤òȿž¤·¡¢ /ROMCS ¤Ë¤·¤¿¤â¤Î¤òÅϤ¹
address ^= ADDRESS_MASK_A15;
while(length != 0){
- *data = data_port_get(address);
+ *data = data_port_get(address, M2_CONTROL_TRUE);
address++;
data++;
length--;
address &= ADDRESS_MASK_A0toA12; //PPU charcter data area mask
address |= ADDRESS_MASK_A15; //CPU area disk
while(length != 0){
- *data = data_port_get(address);
+ *data = data_port_get(address, M2_CONTROL_FALSE);
address++;
data++;
length--;
//2 L->H bus:data write
//ROM Îΰè¤Î¾ì¹ç¤Ï¤³¤Î¥¿¥¤¥ß¥ó¥°¤Ç /rom ¤òÍî¤È¤¹
if(address & ADDRESS_MASK_A15){
- address_set(address & ADDRESS_MASK_A15);
+ address_set(address & ~ADDRESS_MASK_A15);
}
c = bit_clear(c, BITNUM_CPU_RW);
c = bit_set(c, BITNUM_CPU_M2);
if(address & ADDRESS_MASK_A15){
address_set(address | ADDRESS_MASK_A15);
}
- data_port_latch(DATA_SELECT_CONTROL, BITNUM_WRITEDATA_OUTPUT);
+ data_port_latch(DATA_SELECT_CONTROL, BUS_CONTROL_BUS_WRITE);
}
static void hk_ppu_write(long address, long data)
/*
execute() ÍÑ¥µ¥Ö´Ø¿ô¤È¥Ç¡¼¥¿
*/
+static int execute_connection_check(const struct driver *d)
+{
+ int ret = OK;
+ const int testsize = 0x80;
+ int testcount = 3;
+ u8 *testbuf[2];
+ testbuf[0] = malloc(testsize);
+ testbuf[1] = malloc(testsize);
+ //master read
+ d->cpu_read(0xfee0, testsize, testbuf[0]);
+
+ while(testcount != 0){
+ d->cpu_read(0xfee0, testsize, testbuf[1]);
+ if(memcmp(testbuf[0], testbuf[1], testsize) != 0){
+ ret = NG;
+ break;
+ }
+ testcount--;
+ }
+
+ free(testbuf[0]);
+ free(testbuf[1]);
+ return ret;
+}
+
enum {PPU_TEST_RAM, PPU_TEST_ROM};
const u8 PPU_TEST_DATA[] = "PPU_TEST_DATA";
#if DEBUG==0
printf("execute error: Can't Access Direct IO %d\n", gg);
return NG;
}
+ if(execute_connection_check(d) == NG){
+ printf("execute error: maybe connection error.\n");
+ return NG;
+ }
struct memory cpu_rom, ppu_rom, cpu_ram_read, cpu_ram_write;
cpu_rom = r->cpu_rom;
ppu_rom = r->ppu_rom;