use a few macros to make debugging less painful

This commit is contained in:
Ian Curtis 2018-01-06 01:18:14 +00:00
parent 314279ed25
commit 19e6aab1fa
2 changed files with 91 additions and 211 deletions

View file

@ -80,6 +80,16 @@
#include "UDPSend.h"
#include "UDPReceive.h"
// few macros to make debugging a bit less painful
// if NET_DEBUG is defined, printf works normally, otherwise it's compiled to nothing (ie removed)
#if defined(NET_DEBUG)
#include <stdio.h>
#define DPRINTF printf
#else
#define DPRINTF(a, ...)
#endif
using namespace SMUDP;
static int(*Runnet68kCB)(int cycles);
@ -149,9 +159,7 @@ UINT8 CNetBoard::Read8(UINT32 a)
switch (a & 0xff)
{
case 0x0:
#ifdef NET_DEBUG
printf("Netboard R8\tctrlrw[%x]=%x\tcommbank = %x\n", a & 0xff, ctrlrw[a & 0xff], commbank);
#endif
DPRINTF("Netboard R8\tctrlrw[%x]=%x\tcommbank = %x\n", a & 0xff, ctrlrw[a & 0xff], commbank);
return ctrlrw[a&0xff];//commbank;
break;
@ -187,44 +195,32 @@ UINT8 CNetBoard::Read8(UINT32 a)
switch (a & 0xff)
{
case 0x11: // ioreg[c0011]
#ifdef NET_DEBUG
printf("Netboard R8\tioreg[%x]=%x\t\treceive result status\n", a & 0xff, ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R8\tioreg[%x]=%x\t\treceive result status\n", a & 0xff, ioreg[a & 0xff]);
return ioreg[a&0xff];
break;
case 0x19: // ioreg[c0019]
#ifdef NET_DEBUG
printf("Netboard R8\tioreg[%x]=%x\t\ttransmit result status\n", a & 0xff, ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R8\tioreg[%x]=%x\t\ttransmit result status\n", a & 0xff, ioreg[a & 0xff]);
return ioreg[a&0xff];
break;
case 0x81: // ioreg[c0081]
#ifdef NET_DEBUG
printf("Netboard R8\tioreg[%x]=%x\t\n", a & 0xff, ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R8\tioreg[%x]=%x\t\n", a & 0xff, ioreg[a & 0xff]);
return ioreg[a&0xff];
break;
case 0x83: // ioreg[c0083]
#ifdef NET_DEBUG
printf("Netboard R8\tioreg[%x]=%x\t\tirq status\n", a & 0xff, ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R8\tioreg[%x]=%x\t\tirq status\n", a & 0xff, ioreg[a & 0xff]);
return ioreg[a&0xff];
break;
case 0x89: // ioreg[c0089]
#ifdef NET_DEBUG
printf("Netboard R8\tioreg[%x]=%x\t\n", a & 0xff, ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R8\tioreg[%x]=%x\t\n", a & 0xff, ioreg[a & 0xff]);
return ioreg[a&0xff];
break;
case 0x8a: // ioreg[c008a]
#ifdef NET_DEBUG
printf("Netboard R8\tioreg[%x]=%x\t\n", a & 0xff, ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R8\tioreg[%x]=%x\t\n", a & 0xff, ioreg[a & 0xff]);
return ioreg[a & 0xff];
break;
@ -315,16 +311,12 @@ UINT16 CNetBoard::Read16(UINT32 a)
{
case 0x88: // ioreg[c0088]
result = *(UINT16 *)&ioreg[a & 0xff];
#ifdef NET_DEBUG
printf("Netboard R16\tioreg[%x] = %x\n", a & 0xff, *(UINT16 *)&ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R16\tioreg[%x] = %x\n", a & 0xff, *(UINT16 *)&ioreg[a & 0xff]);
return result;
case 0x8a: // ioreg[c008a]
result = *(UINT16 *)&ioreg[a & 0xff];
#ifdef NET_DEBUG
printf("Netboard R16\tioreg[%x] = %x\n", a & 0xff, *(UINT16 *)&ioreg[a & 0xff]);
#endif
DPRINTF("Netboard R16\tioreg[%x] = %x\n", a & 0xff, *(UINT16 *)&ioreg[a & 0xff]);
return result;
default:
@ -441,9 +433,7 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
{
case 0x40:
ctrlrw[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tctrlrw[%x] <- %x\tIRQ 5 ack\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tctrlrw[%x] <- %x\tIRQ 5 ack\n", a & 0xff, d);
NetIRQAck(5);
//NetIRQAck(0);
M68KSetIRQ(4); // dirtdvls needs ????????????????????????????????????????????????????????????????????????????????????????????????????
@ -453,9 +443,7 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0xa0:
ctrlrw[a & 0xff] = d;
ioreg[0] = ioreg[0] | 0x01; // Do I force this myself or is it automatic, need investigation, bad init way actually ?
#ifdef NET_DEBUG
printf("Netboard W8\tctrlrw[%x] <- %x\tIRQ 2 ack\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tctrlrw[%x] <- %x\tIRQ 2 ack\n", a & 0xff, d);
NetIRQAck(2);
//NetIRQAck(0);
//M68KRun(10000);
@ -463,9 +451,7 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x80:
ctrlrw[a & 0xff] = d;
#ifdef NET_DEBUG
//printf("Netboard W8\tctrlrw[%x] <- %x\tleds <- %x\n", a & 0xff, d,d);
#endif
//DPRINTF("Netboard W8\tctrlrw[%x] <- %x\tleds <- %x\n", a & 0xff, d,d);
break;
default:
@ -510,16 +496,12 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x03: // ioreg[c0003]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x05: // ioreg[c0005]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
/*case 0x15: // 0x00 0x01 0x80 // ioreg[c0015]
@ -596,9 +578,8 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x15: // 0x00 0x01 0x80 // ioreg[c0015]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\t\t", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\t\t", a & 0xff, d);
switch (d & 0xff)
{
case 0x80:
@ -611,15 +592,12 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
auto recv_data = udpReceive.ReadData(5000);
printf("-> nb recu : %x\n", recv_data.size());
memcpy(CommRAM + recv_offset, recv_data.data(), recv_data.size());
#ifdef NET_DEBUG
printf("receive enable off=%x size=%x\n", recv_offset, recv_size);
#endif
DPRINTF("receive enable off=%x size=%x\n", recv_offset, recv_size);
}
else
{
#ifdef NET_DEBUG
printf("receive enable original value off=%x size=%x\n", recv_offset, recv_size);
#endif
DPRINTF("receive enable original value off=%x size=%x\n", recv_offset, recv_size);
slot = (recv_size >> 12) & 0x0f;
recv_size = recv_size & 0x0fff;
recv_size = (recv_size << 4) | ((recv_size >> 8) & 0x000f);
@ -629,9 +607,8 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
recv_size = recv_size * slot;
}
recv_offset = (recv_offset << 8) | (recv_offset >> 8);
#ifdef NET_DEBUG
printf("receive enable off=%x size=%x slot=%x\n", recv_offset, recv_size, slot);
#endif
DPRINTF("receive enable off=%x size=%x slot=%x\n", recv_offset, recv_size, slot);
auto recv_data = udpReceive.ReadData(5000);
printf("-> nb recu : %x\n", recv_data.size());
@ -658,15 +635,11 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
break;
case 0x00:
#ifdef NET_DEBUG
printf("??? receive disable\n");
#endif
DPRINTF("??? receive disable\n");
break;
case 0x01:
#ifdef NET_DEBUG
printf("Irq 6 ack\n");
#endif
DPRINTF("Irq 6 ack\n");
NetIRQAck(6);
break;
@ -678,22 +651,17 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x17: // 0x00 0x8c // ioreg[c0017]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\t\t", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\t\t", a & 0xff, d);
switch (d & 0xff)
{
case 0x8c:
#ifdef NET_DEBUG
printf("data receive enable\n");
#endif
DPRINTF("data receive enable\n");
M68KSetIRQ(6);
M68KRun(6000); // 6000 enough
break;
case 0x00:
#ifdef NET_DEBUG
printf("??? data receive disable\n");
#endif
DPRINTF("??? data receive disable\n");
break;
default:
printf("17 : other value %x\n",d & 0xff);
@ -705,9 +673,7 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x19: // ioreg[c0019]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\t\ttransmit result status\n");
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\t\ttransmit result status\n");
break;
// 1b 1d = send part
@ -715,9 +681,8 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x1b: // 0x80 // ioreg[c001b]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\t\t\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\t\t\n", a & 0xff, d);
switch (d & 0xff)
{
case 0x80:
@ -725,15 +690,13 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
if (send_size < 0x0011) // must find a better condition
{
udpSend.SendAsync(addr_out.data(), port_out, send_size, (const char*)CommRAM + send_offset, 1000);
#ifdef NET_DEBUG
printf("send enable off=%x size=%x\n", send_offset, send_size);
#endif
DPRINTF("send enable off=%x size=%x\n", send_offset, send_size);
}
else
{
#ifdef NET_DEBUG
printf("send enable original value off=%x size=%x\n", send_offset, send_size);
#endif
DPRINTF("send enable original value off=%x size=%x\n", send_offset, send_size);
slot = (send_size >> 12) & 0x0f;
send_size = send_size & 0x0fff;
send_size = (send_size << 4) | ((send_size >> 8) & 0x000f);
@ -748,10 +711,8 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
send_offset = (send_offset << 8) | (send_offset >> 8);
udpSend.SendAsync(addr_out.data(), port_out, send_size, (const char*)CommRAM + send_offset, 1000);
#ifdef NET_DEBUG
printf("send enable off=%x size=%x slot=%x\n", send_offset, send_size, slot);
#endif
DPRINTF("send enable off=%x size=%x slot=%x\n", send_offset, send_size, slot);
}
#ifdef NET_DEBUG
printf("transmitting : ");
@ -774,9 +735,7 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
break;
case 0x00:
#ifdef NET_DEBUG
printf("??? transmit disable\n");
#endif
DPRINTF("??? transmit disable\n");
break;
default:
@ -787,9 +746,8 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x1d: // 0x8c // ioreg[c001d]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
switch (d & 0xff)
{
case 0x8c:
@ -809,16 +767,13 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x29: // ioreg[c0029]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x2f: // 0x00 or 0x00->0x40->0x00 or 0x82// ioreg[c002f]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
/*if ((d & 0xff) == 0x00)
{
M68KSetIRQ(2);
@ -827,15 +782,11 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
if ((d & 0xff) == 0x40)
{
#ifdef NET_DEBUG
printf("********************************* trigger something ????\n");
#endif
DPRINTF("********************************* trigger something ????\n");
}
if ((d & 0xff) == 0x82)
{
#ifdef NET_DEBUG
printf("********************************* trigger something number 2 ????\n");
#endif
DPRINTF("********************************* trigger something number 2 ????\n");
}
break;
@ -843,146 +794,104 @@ void CNetBoard::Write8(UINT32 a, UINT8 d)
case 0x41: // ioreg[c0041]
ioreg[a & 0xff] = d;
recv_offset = (recv_offset >> 8) | (d << 8 );
#ifdef NET_DEBUG
//printf("recv off = %x\n",recv_offset);
printf("recv off = %x\n", d);
//printf("\n");
#endif
DPRINTF("recv off = %x\n", d);
break;
case 0x43: // ioreg[c0043]
ioreg[a & 0xff] = d;
recv_size = (recv_size >> 8) | (d << 8);
#ifdef NET_DEBUG
//printf("recv size = %x\n", recv_size);
printf("recv size = %x\n", d);
//printf("\n");
#endif
DPRINTF("recv size = %x\n", d);
break;
case 0x45: // ioreg[c0045]
ioreg[a & 0xff] = d;
send_offset = (send_offset >> 8) | (d << 8);
#ifdef NET_DEBUG
//printf("send off = %x\n", send_offset);
printf("send off = %x\n", d);
//printf("\n");
#endif
DPRINTF("send off = %x\n", d);
break;
case 0x47: // ioreg[c0047]
ioreg[a & 0xff] = d;
send_size = (send_size >> 8) | (d << 8);
#ifdef NET_DEBUG
//printf("send size = %x\n", send_size);
printf("send size = %x\n", d);
//printf("\n");
#endif
DPRINTF("send size = %x\n", d);
break;
case 0x51: //0x04 0x18 // ioreg[c0051]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x55: // ioreg[c0055]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x57: // 0x04->0x09 // ioreg[c0057]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x59: // ioreg[c0059]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x5b: // ioreg[c005b]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x5d: // ioreg[c005d]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x5f: // ioreg[c005f]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x81: // ioreg[c0081]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x83: // 0x35 once and after 0x00 always // ioreg[c0083] // just apres le ioreg[83]=0 on a ppc R32 ioreg[114] et R32 ioreg[110] et apres ack irq5
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x85: // ioreg[c0085]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x87: // ioreg[c0087]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x88: // ioreg[c0088]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x89: // ioreg[c0089] // dayto2pe loops with values 00 01 02 during type 2 frame
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x8a: // ioreg[c008a]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
case 0x8b: // ioreg[c008b]
ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
#endif
DPRINTF("Netboard W8\tioreg[%x] <- %x\n", a & 0xff, d);
break;
default:
@ -1034,9 +943,8 @@ void CNetBoard::Write16(UINT32 a, UINT16 d)
case 0x00:
*(UINT16 *)&ctrlrw[a & 0xff] = d;
commbank = d;
#ifdef NET_DEBUG
printf("Netboard W16\tctrlrw[%x] <- %x\t\tCommBank <- %x\n", a & 0xff, d,commbank & 1);
#endif
DPRINTF("Netboard W16\tctrlrw[%x] <- %x\t\tCommBank <- %x\n", a & 0xff, d,commbank & 1);
// sans swap ca avance, avec ca bloque pour scud
//CommRAM = Buffer + ((commbank & 1) ? 0x10000 : 0); //swap
//CommRAM = ((commbank & 1) ? bank : Buffer); // with bank swap harley doesn't pass to print id, no incidence in dirtdevils
@ -1054,9 +962,8 @@ void CNetBoard::Write16(UINT32 a, UINT16 d)
break;
case 0x40:
*(UINT16 *)&ctrlrw[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W16\tctrlrw[%x] <- %x\t\tIRQ 5 ack\n", a & 0xff, d);
#endif
DPRINTF("Netboard W16\tctrlrw[%x] <- %x\t\tIRQ 5 ack\n", a & 0xff, d);
NetIRQAck(5);
M68KSetIRQ(4); // ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????
//M68KRun(10000);
@ -1064,29 +971,22 @@ void CNetBoard::Write16(UINT32 a, UINT16 d)
case 0xa0:
*(UINT16 *)&ctrlrw[a & 0xff] = d;
*(UINT8 *)&ioreg[0] = *(UINT8 *)&ioreg[0] | 0x01; // Do I force this myself or is it automatic, need investigation, bad init way actually ?
#ifdef NET_DEBUG
printf("Netboard W16\tctrlrw[%x] <-%x\t\tIRQ 2 ack\n", a & 0xff, d);
#endif
DPRINTF("Netboard W16\tctrlrw[%x] <-%x\t\tIRQ 2 ack\n", a & 0xff, d);
NetIRQAck(2);
//NetIRQAck(0);
break;
case 0x80:
*(UINT16 *)&ctrlrw[a & 0xff] = d;
#ifdef NET_DEBUG
//printf("Netboard W16\tctrlrw[%x] <-%x\tleds <- %x\n",a & 0xff, d,d);
#endif
//DPRINTF("Netboard W16\tctrlrw[%x] <-%x\tleds <- %x\n",a & 0xff, d,d);
break;
case 0xc0:
*(UINT16 *)&ctrlrw[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W16\tctrlrw[%x] <-%x\tNode ID <- %x\n", a & 0xff, d, d);
#endif
DPRINTF("Netboard W16\tctrlrw[%x] <-%x\tNode ID <- %x\n", a & 0xff, d, d);
break;
case 0xe0:
*(UINT16 *)&ctrlrw[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W16\tctrlrw[%x] <-%x\t\treceive complete <- %x\n", a & 0xff, d, d);
#endif
DPRINTF("Netboard W16\tctrlrw[%x] <-%x\t\treceive complete <- %x\n", a & 0xff, d, d);
break;
default:
*(UINT16 *)&ctrlrw[a & 0xff] = d;
@ -1125,40 +1025,31 @@ void CNetBoard::Write16(UINT32 a, UINT16 d)
if (d == 0)
{
*(UINT16 *)&ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W16\tioreg[%x] <- %x\t\t", a & 0xff, d);
#endif
DPRINTF("Netboard W16\tioreg[%x] <- %x\t\t", a & 0xff, d);
}
if (d == 1)
{
*(UINT16 *)&ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W16\tioreg[%x] <- %x\t\t", a & 0xff, d);
#endif
DPRINTF("Netboard W16\tioreg[%x] <- %x\t\t", a & 0xff, d);
}
if (d == 2)
{
*(UINT16 *)&ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W16\tioreg[%x] <- %x\t\t", a & 0xff, d);
#endif
DPRINTF("Netboard W16\tioreg[%x] <- %x\t\t", a & 0xff, d);
}
if (d > 2)
{
#ifdef NET_DEBUG
printf("d=%x\n", d);
#endif
DPRINTF("d=%x\n", d);
*(UINT16 *)&ioreg[a & 0xff] = d;
//MessageBox(NULL, "d > 1", NULL, MB_OK);
//MessageBeep(MB_ICONWARNING);
}
#ifdef NET_DEBUG
printf("d = %x \n",d);
#endif
DPRINTF("d = %x \n",d);
M68KSetIRQ(4); // network error if removed
M68KRun(1000); // 1000 is enought
M68KSetIRQ(2); // oui sinon pas de trame, pas de cycle sinon crash
@ -1166,10 +1057,8 @@ void CNetBoard::Write16(UINT32 a, UINT16 d)
case 0x8a: // ioreg[c008a]
*(UINT16 *)&ioreg[a & 0xff] = d;
#ifdef NET_DEBUG
printf("Netboard W16\tioreg[%x] <- %x\t", a & 0xff, d);
printf("d = %x\n",d);
#endif
DPRINTF("Netboard W16\tioreg[%x] <- %x\t", a & 0xff, d);
DPRINTF("d = %x\n",d);
break;
default:

View file

@ -6,13 +6,10 @@
#include "OSD/Thread.h"
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
#include <thread>
#include "UDPSend.h"
#include "UDPReceive.h"
//using namespace SMUDP;
//#define NET_BUF_SIZE 32800 // 16384 not enough
class CNetBoard : public IBus
@ -27,13 +24,10 @@ public:
void Write16(UINT32 addr, UINT16 data);
void Write32(UINT32 addr, UINT32 data);
void SaveState(CBlockFile *SaveState);
void LoadState(CBlockFile *SaveState);
bool RunFrame(void);
void Reset(void);
// Returns a reference to the 68K CPU context
@ -43,7 +37,6 @@ public:
bool Init(UINT8 *netRAMPtr, UINT8 *netBufferPtr);
CNetBoard(const Util::Config::Node &config);
~CNetBoard(void);
@ -84,12 +77,10 @@ private:
// only for some tests
UINT8 *bank;
UINT8 *bank2;
UINT8 test_irq;
UINT8 test_irq;
std::thread interrupt5;
bool int5;
};
void Net_SetCB(int(*Run68k)(int cycles), void(*Int68k)(int irq));