Files
Work/m68hc11/backup/MAIN.CPP
2024-08-07 09:16:27 -04:00

121 lines
3.3 KiB
C++

#include <m68hc11/mainfrm.hpp>
int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/)
{
MainFrame frameWindow;
// frameWindow.splash();
frameWindow.createWindow("M68HC11","M68HC11 v1.00","mainMenu","MOT");
return frameWindow.messageLoop();
}
#if 0
#include <m68hc11/commctrl.hpp>
int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/)
{
CommControl commControl;
CommStatus commStatus;
DeviceControlBlock deviceControlBlock;
BYTE charByte(0xFF);
commControl.open(CommControl::PortCOM1);
if(!commControl.isOkay())return FALSE;
if(!commControl.setDeviceControlBlock("baud=1200 data=8 stop=1 parity=N"))::OutputDebugString("Set operation failed\n");
String strString;
charByte='a';
while(TRUE)
{
commControl.write(&charByte,sizeof(charByte));
// commControl.waitForData();
commControl.read(&charByte,sizeof(charByte));
::sprintf(strString,"%02x\n",(int)charByte);
::OutputDebugString(strString);
charByte++;
// commControl.clearError(commStatus);
// if(commStatus.bytesInReceiveQueue())
// {
// commControl.read(&charByte,sizeof(charByte));
// ::sprintf(strString,"%02x\n",(int)charByte);
// ::OutputDebugString(strString);
// break;
// }
::Sleep(250);
}
/*
::OutputDebugString("waiting for break signal...\n");
commControl.setEventMask(CommControl::EventBreak); // EventBreak
if(!commControl.waitEvent())::OutputDebugString("timeout waiting for break.\n");
else ::OutputDebugString("break received, loading code...\n");
BYTE ioBuffer[256];
for(int index=0;index<256;index++)ioBuffer[index]=index;
charByte=0xFF;
commControl.write(&charByte,sizeof(charByte));
// commControl.clearError(commStatus);
// if(commStatus.bytesInReceiveQueue())commControl.read(ioBuffer,commStatus.bytesInReceiveQueue());
commControl.write(ioBuffer,sizeof(ioBuffer));
::memset(ioBuffer,0,sizeof(ioBuffer));
String strString;
::OutputDebugString("receiving echo\n");
while(TRUE)
{
commControl.clearError(commStatus);
if(commStatus.bytesInReceiveQueue())
{
commControl.read(ioBuffer,sizeof(ioBuffer));
for(index=0;index+8<sizeof(ioBuffer);index+=8)
{
::sprintf(strString,"%02x %02x %02x %02x %02x %02x %02x %02x\n",
ioBuffer[index],ioBuffer[index+1],ioBuffer[index+2],ioBuffer[index+3],ioBuffer[index+4],
ioBuffer[index+5],ioBuffer[index+6],ioBuffer[index+7]);
::OutputDebugString(strString);
}
break;
}
::Sleep(1000);
}
*/
return FALSE;
}
#if 0
for(int index=0;index<256;index++)ioBuffer[index]=index;
charByte=0xFF;
commControl.write(&charByte,sizeof(charByte));
commControl.write(ioBuffer,sizeof(ioBuffer));
::memset(ioBuffer,0,sizeof(ioBuffer));
::OutputDebugString("receiving echo\n");
while(TRUE)
{
commControl.clearError(commStatus);
if(commStatus.bytesInReceiveQueue())
{
commControl.read(ioBuffer,sizeof(ioBuffer));
for(index=0;index+8<sizeof(ioBuffer);index+=8)
{
::sprintf(strString,"%02x %02x %02x %02x %02x %02x %02x %02x\n",
ioBuffer[index],ioBuffer[index+1],ioBuffer[index+2],ioBuffer[index+3],ioBuffer[index+4],
ioBuffer[index+5],ioBuffer[index+6],ioBuffer[index+7]);
::OutputDebugString(strString);
}
break;
}
::Sleep(1000);
}
#endif
#endif