
/***************************************************************************
**
**    $Header:   D:/EPSLDV1/SRC/LOG/DSMEDIT2.CPP   1.8   20 Jun 1996 09:27:04   ZJRD  $
**
**    $Log:   D:/EPSLDV1/SRC/LOG/DSMEDIT2.CPP  $
** 
**    Rev 1.8   20 Jun 1996 09:27:04   ZJRD
** EasyPack/SLD Version 1.20a
** 
**    Rev 1.6   10 Jun 1996 10:21:42   ZJRD
** EasyPack/SLD Version 1.20
** 
**    Rev 1.4   29 May 1996 09:32:02   ZJRD
** No change.
** 
**    Rev 1.3   16 May 1996 09:03:14   ZJRD
** No change.
** 
**    Rev 1.2   10 May 1996 09:14:46   ZJRD
** No change.
** 
**    Rev 1.1   02 May 1996 10:22:38   ZJRD
** EasyPack/SLD Version 1.92
** 
**    Rev 1.31   18 Apr 1996 13:01:40   Shirley
** No change.
** 
**    Rev 1.30   12 Apr 1996 10:38:38   Shirley
** EasyPack/SLD Version 1.90
** 
**    Rev 1.28   15 Feb 1996 08:51:36   Shirley
** No change.
** 
**    Rev 1.27   12 Feb 1996 14:06:04   Shirley
** No change.
** 
**    Rev 1.26   06 Feb 1996 15:32:34   Shirley
** No change.
** 
**    Rev 1.25   06 Feb 1996 13:46:50   Shirley
** No change.
** 
**    Rev 1.24   01 Feb 1996 10:13:20   Shirley
** No change.
** 
**    Rev 1.23   26 Jan 1996 09:17:34   Shirley
** No change.
** 
**    Rev 1.22   25 Jan 1996 13:17:30   Shirley
** No change.
** 
**    Rev 1.21   24 Jan 1996 10:36:54   Shirley
** No change.
** 
**    Rev 1.20   23 Jan 1996 11:27:24   Shirley
** No change.
** 
**    Rev 1.19   18 Jan 1996 10:10:40   Shirley
** No change.
** 
**    Rev 1.18   15 Jan 1996 16:11:42   Shirley
** No change.
** 
**    Rev 1.17   04 Jan 1996 11:12:38   Shirley
** No change.
** 
**    Rev 1.16   30 Nov 1995 09:11:56   Shirley
** No change.
** 
**    Rev 1.15   28 Nov 1995 15:33:58   Shirley
** No change.
** 
**    Rev 1.14   21 Nov 1995 11:19:44   Shirley
** No change.
** 
**    Rev 1.13   13 Nov 1995 09:25:38   Shirley
** No change.
** 
**    Rev 1.12   12 Nov 1995 11:28:34   Shirley
** EasyPack/SLD Version 0.24
**
**    Rev 1.11   08 Nov 1995 16:29:22   Shirley
** No change.
**
**    Rev 1.10   08 Nov 1995 12:39:52   Shirley
** EasyPack/SLD Version 0.22
**
**    Rev 1.4   13 Oct 1995 13:19:42   Shirley
** No change.
**
**    Rev 1.3   29 Sep 1995 09:53:08   Shirley
** No change.
**
**    Rev 1.2   20 Sep 1995 10:54:06   Shirley
** No change.
**
**    Rev 1.1   15 Sep 1995 09:45:32   Shirley
** EasyPack/SLDV0.1a
**
**    Rev 1.0   07 Sep 1995 09:55:36   Shirley
** Initial revision.
**
****************************************************************************/

/////////////////////////////////////////////////////////////////////////////
//
//  File name:  DSMEDIT2.CPP
//
//  Description:The implement file for the class: CDsmEdit2
//
//  Author:     Lane Li &       Daniel Lin
//
//  Modification:
//      1. 10/25/95, 0.1d version       Daniel Lin
//              modified function   OnInitDialog()
//
//      1. 09/10/95, Initial version
//
//
//  Copyright (C) 1995 Microtek International. All rights reserved.
//
/////////////////////////////////////////////////////////////////////////////

// dsmedit2.cpp : implementation file
//

#include "stdafx.h"
#include "resource.h"
#include "xview.h"
#include "dsmedit2.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

extern long MemAssemble(long,char*,int);
extern void SrcUpdate(void);

/////////////////////////////////////////////////////////////////////////////
// CDsmEdit2 dialog



CDsmEdit2::CDsmEdit2(CWnd* pParent /*=NULL*/)
    : CDialog(CDsmEdit2::IDD, pParent)
{
    //{{AFX_DATA_INIT(CDsmEdit2)
        // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
    m_pParent = pParent;
}

void CDsmEdit2::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CDsmEdit2)
        // NOTE: the ClassWizard will add DDX and DDV calls here
    //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDsmEdit2, CDialog)
    //{{AFX_MSG_MAP(CDsmEdit2)
    ON_BN_CLICKED(IDC_DSMEDIT2_BUTTON1, OnDsmedit2Button1)
    ON_BN_CLICKED(IDC_DSMEDIT2_BUTTON2, OnDsmedit2Button2)
    ON_BN_CLICKED(IDC_DSMEDIT2_BUTTON3, OnDsmedit2Button3)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CDsmEdit2 message handlers

BOOL CDsmEdit2::OnInitDialog()
{
    CDialog::OnInitDialog();
    CenterWindow();

    // TODO: Add extra initialization here
    char text[20];
    CWnd* ctrl;

    sprintf(text,"%04lX",m_lAddress);
    SetDlgItemText(IDC_DSMEDIT2_EDIT1,text);

    ctrl=GetDlgItem(IDC_DSMEDIT2_EDIT2);
    ctrl->SetFocus();

    return FALSE;  // return TRUE  unless you set the focus to a control

    return TRUE;  // return TRUE  unless you set the focus to a control
}

void CDsmEdit2::OnDsmedit2Button1()
{
    // TODO: Add your control notification handler code here
    long l;
    char text[256];

    GetDlgItemText(IDC_DSMEDIT2_EDIT2,text,255);
    l = MemAssemble(m_lAddress,text,m_nSpaceType);
    if (l<0)
    {
        MessageBeep(-1);
        MessageBox("Input instruction error or HW error!",NULL,MB_OK|MB_ICONEXCLAMATION);
        return;
    }
    EndDialog(1);
    BeginWaitCursor();
    // in program area, test command should modify memory, so
    // refresh source window
    if (m_nSpaceType == 1) {
       SrcUpdate();
    }
    EndWaitCursor();

}

void CDsmEdit2::OnDsmedit2Button2()
{
    // TODO: Add your control notification handler code here
    long l;
    char text[256];

    GetDlgItemText(IDC_DSMEDIT2_EDIT2,text,255);
    l = MemAssemble(m_lAddress,text,m_nSpaceType);
    if (l<0)
    {
        MessageBeep(-1);
        MessageBox("Input instruction error or HW error!",NULL,MB_OK|MB_ICONEXCLAMATION);
        return;
    }
    else
    {
        m_pParent->InvalidateRect(NULL,FALSE);
        m_lAddress = l;
        sprintf(text,"%04lX",m_lAddress);
        SetDlgItemText(IDC_DSMEDIT2_EDIT1,text);
        SetDlgItemText(IDC_DSMEDIT2_EDIT2,"");
    }
    BeginWaitCursor();
    // in program area, test command should modify memory, so
    // refresh source window
    if (m_nSpaceType == 1) {
       SrcUpdate();
    }
    EndWaitCursor();
}

void CDsmEdit2::OnDsmedit2Button3()
{
    // TODO: Add your control notification handler code here
    EndDialog(0);
}
