|
how to develop an assembler in C++
the idea that i got was
__asm {
}
but do anyone have any idea more abt that?
|
|
|
|
|
emusing wrote:
how to develop an assembler in C++
This sentence means nothing ! For me, assembler is a low-level language. So, how can you 'develop' a language ??
Otherwise, yes with __asm you will be able to use write assembler code inside your C++ code. But that does not mean you are developping an assembler.
|
|
|
|
|
cedric moonen wrote:
For me, assembler is a low-level language. So, how can you 'develop' a language ??
yes but you well need an interpreter or a compiler for your language to work...
i think it is what this guy is talking about with bad-used words...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
cedric moonen wrote:
For me, assembler is a low-level language.
This is not true, an assembler is a program that translates assembly language into machine code.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Start some reading about parsers, interpreters and compilers...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
How to invoke Audio Device testing/tunning wizard.
I am using VC++ 6.0. and dont want to use DirectX feature of IID_IDirectPlayVoiceTest, because it has some limitations.
Quaidian Once, Quaidian For Ever
|
|
|
|
|
One of my program must wait that file arrive intot a directory.
I have made a infinite cycle with a thread.
a progress bar is used we can stop it by pressing a button
When the thread starting all the CPU is used and other program do runtime error
where is my problem ?
i need help.
my code:
// WaitModAuto.cpp : fichier d'implémentation
//
#include "stdafx.h"
#include "ScanOne.h"
#include "WaitModAuto.h"
// Boîte de dialogue CWaitModAuto
volatile int g_nCount,i_gMaxCount;
CEvent g_eventStart; // creates autoreset events
CEvent g_eventKill;
UINT ComputeThreadProc(LPVOID pParam)
{
volatile int nTemp;
::WaitForSingleObject(g_eventStart, INFINITE);
TRACE("starting computation\n");
for (g_nCount = 0; g_nCount < i_gMaxCount;
g_nCount++) {
for (nTemp = 0; nTemp < 10000; nTemp++) {
// Simulate computation
}
if (::WaitForSingleObject(g_eventKill, 0) == WAIT_OBJECT_0) {
break;
}
}
// Tell owner window we're finished
::PostMessage((HWND) pParam, WM_THREADFINISHED, 0, 0);
g_nCount = 0;
return 0; // ends the thread
}
IMPLEMENT_DYNAMIC(CWaitModAuto, CDialog)
CWaitModAuto::CWaitModAuto(CWnd* pParent /*=NULL*/)
: CDialog(CWaitModAuto::IDD, pParent)
{
}
CWaitModAuto::~CWaitModAuto()
{
}
void CWaitModAuto::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CWaitModAuto, CDialog)
ON_MESSAGE(WM_THREADFINISHED, OnThreadFinished)
ON_WM_TIMER()
ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
END_MESSAGE_MAP()
// Gestionnaires de messages CWaitModAuto
BOOL CWaitModAuto::OnInitDialog()
{
CDialog::OnInitDialog();
g_nCount=0;
i_gMaxCount=i_mMaxCount;
AfxBeginThread(ComputeThreadProc, GetSafeHwnd());
i_mTimer = SetTimer(1, 1000, NULL); // 1/10 second
ASSERT(i_mTimer != 0);
g_eventStart.SetEvent();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CWaitModAuto::OnTimer(UINT nIDEvent)
{
CProgressCtrl* pBar = (CProgressCtrl*) GetDlgItem(IDC_PROGRESS_WAIT);
pBar->SetPos(g_nCount * 100 / i_gMaxCount);
CDialog::OnTimer(nIDEvent);
}
void CWaitModAuto::OnBnClickedCancel()
{
if (g_nCount == 0) { // prior to Start button
// must start it before we can kill it
g_eventStart.SetEvent();
}
g_eventKill.SetEvent();
OnCancel();
}
LRESULT CWaitModAuto::OnThreadFinished(WPARAM wParam, LPARAM lParam)
{
OnOK();
return 0;
}
|
|
|
|
|
Hi and thanks in advance,
I have implemented a DLL language system for my app, but I can’t open the dialogs with a DLL language loaded if this contents any custom control. When I do the dialog.DoModal (); it returns some error (I think it is caused by some template), the dialog don’t appear and the execution continues. If I try to open the same dialog without have loaded any DLL or if the dialog doesn’t contents anyone custom control, the system runs properly. I don’t know what can I do.
Your help will be appreciate, thank you very much.
|
|
|
|
|
I want to insert icons on to any cell in the FlexiGrid control. Does anybody know how to go about this?
Sharat
|
|
|
|
|
I have to develop an assembler based on the below processor description :
M05 is a new generation processor from Lintel Technologies. It is a simple 16 bit
multipurpose processor targeted for consumer electronic devices .It has a 16 bit accumulator
A , 16 bit flag register , a 16 bit data register D and a 16 bit memory pointer register P .
It also has a 16 bit Program Counter register PC and a Stack pointer SP.
It supports the following instructions .
* Move immediate data to A,D,P and SP
* Move data pointed by P register to A or D
* Perform arithmetic operation on A register with D register( add ,sub , adc , sbb ,xor
,or ,etc)
* Move data in A register to memory pointed by P
* Call subroutine and return
* Unconditional and conditional jump ( ie jump or carry etc)
* Jump to or call to address pointed by A
The registers A and D can be accessed as 8 bit units ( AH ,AL , DH , DL)
List down the set of all possible instructions and assign your own opcodes. Your assembler
should accept decimal and hexadecimal data . HExadecimal numbers start with a '0' prefix and
terminate with a literal 'H' - for example 0FFEFH . Any text that follows ";" in the same
line should be treated as a comment . Assure that the assembler is case insensitive.
|
|
|
|
|
Good luck with that pal!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
|
Do you really expect that someone will make the entire job for you ?
|
|
|
|
|
Stlan wrote:
Do you really expect that someone will make the entire job for you ?
WHAT About RENT-A-CODER
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I spent tons of time trying to get this working, and it looks like I need someone' help.
I have three C++ functions in a DLL. One creates an object and returns pointer to this object. Second accepts the pointer of an object, and calls one of the object's member functions. Third deallocates memory. When #1 and #2 are in one function, everything works fine. When they are split, the application crashes.
Maybe there is something wrong with my setup? Is there a chance that memory gets deallocated in between somehow? Please help. Thank you.
Function #1
===========
long _stdcall InitClient( char* cErrStr )
{
CBLZQuoteManager* pQuoteManager = NULL;
CMyQuotesClient* pQuotesClient = NULL;
pQuoteManager = (CBLZQuoteManager *)(CBLZQuoteManager::GetInstance(RUNTIME_CLASS(CBLZQuoteManager)))
pQuotesClient = new CMyQuotesClient();
....
return ( long )pQuotesClient;
}
Function #2
===========
short _stdcall GetQuote( long lPtr,
double& dResult,
char* cErrStr )
{
CMyQuotesClient* pQuotesClient = ( CMyQuotesClient * ) lPtr;
pQuotesClient->DoSomething();
....
}
VB.NET side
===========
Public Declare Function InitClient Lib "quotes.dll" () As Long
Public Declare Function GetQuote Lib "quotes.dll" _
(ByVal lPtr As Long, ByRef dResult As Double, _
ByVal sError As String) As Short
......
lPtr = InitClient()
nReturn = GetQuote(lPtr, dResult, sError)
.....
|
|
|
|
|
Here's a small sample showing how i'm doing it wrong :P
I tried the gnu compiler, cause sometimes other compilers give better insight, and it told me that the friend declaration specifies a non-templated function and told me to add <> after the function name...but didn't work out. Help please.
#include <iostream>
using namespace std;
template < class Type >
class Template
{
public:
Template(Type value) : Value(value)
{ }
Type Value;
/* Overloaded stream operators ********************************************/
friend ostream & operator << <>(ostream &, const Template < Type > &);
friend istream & operator >> <>(istream &, Template< Type > &);
};
template < class Type >
ostream & operator <<(ostream & os, const Template< Type > & point)
{
os << point.Value;
return os;
}
template < class Type >
istream & operator >>(istream & is, Template< Type > & point)
{
is >> point.Value;
return is;
}
int main()
{
Template < int > tes(3);
cout<
|
|
|
|
|
'Do not treat <'s as HTML tags' will allow us to read your code. I also have articles on this site about iostream inserters and extractors.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I fixed the <'s...will look for your articlles tomorrow...gettin late over here.
|
|
|
|
|
Hello,
The following code works for me on a VC compiler:
template<class> class Template;
template< class T >
std::ostream& operator << (std::ostream& ost, Template<T> value)
{
return ost << value.m_t;
}
template <class T>
class Template
{
public:
template<class T>
friend std::ostream& operator <<(std::ostream& ost, Template<T> value);
private:
T m_t;
};
The point is that you use a template parameter in a non-template function declaration. Therefore you have to make your operator a template function too.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thanks! your example helped me make it work
Here's a shortened version of the class i needed it for...It works in gnu and vs.net
<br />
<br />
#ifndef POINT_H<br />
#define POINT_H<br />
<br />
<br />
#include < iostream ><br />
using namespace std;<br />
<br />
template < class Type ><br />
class Point<br />
{<br />
<br />
public:<br />
<br />
Point(Type x = 0, Type y = 0) : X(x), Y(y)<br />
{ }<br />
<br />
Type X, Y;<br />
<br />
<br />
<br />
template< class T ><br />
friend ostream& operator <<(ostream &, const Point< Type > &);<br />
<br />
template< class T ><br />
friend istream & operator >>(istream &, Point< Type > &);<br />
};<br />
<br />
template < class Type ><br />
ostream & operator <<(ostream & os, const Point< Type > & point)<br />
{<br />
return os << "(X: " << point.X << ", Y: " << point.Y << ")";<br />
}<br />
<br />
template < class Type ><br />
istream & operator >>(istream & is, Point< Type > & point)<br />
{<br />
return is >> point.X >> point.Y;<br />
}<br />
<br />
#endif //POINT_H<br />
<br />
|
|
|
|
|
You're welcome
FocusedWolf wrote:
using namespace std;
A little bit of advise: never and I mean NEVER use a using statement in a header file. I may not cause problems directly, but if you start to work on large projects or libraries that will be used by third party people, this little statement is likely to cause some nasty trouble.
The reason for this is the following: the using SomeNamespace keyword brings all the declarations in of SomeNamespace into the current namespace (in your case the global namespace). This feature is often called polluting a namespace. This could cause name clashes with other namespaces or whatever. This problem is hard to track down.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hello,
Here's my problem. I have a CListCtrl that supports in-place editing. I need to capture the Return key and notify the parent dialog that Enter has been pressed. I've tried the following:
void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// If Enter has been pressed, we need to post a WM_KEYUP message to our parent dialog.
if(nChar == 13)
{
// Get a handle to our dialog window
CWnd* pDialogWnd = NULL;
pDialogWnd = GetParent();
// Post the message to our dialog window
pDialogWnd->SendMessage(WM_KEYUP, VK_RETURN, 0);
}
...
I think I'm going about this the wrong way but I'm not sure of the right way to do it. Any help would be greatly appreciated! I'm Stuck!
Thanks!
-Ian
|
|
|
|
|
You need to either create a custom message ( why does the keyup HAVE to mean something happened in a child dialog ? ), or pass an instance of the parent through to the child, and call a method on it directly. I'd define the method in an abstract class and derive from it, so that it's easy to change the parent dialog.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was using the keyup message because the code used to be in a CEdit-derived class in the WM_KEYUP handler.
A custom message would work, but I'm having trouble getting a handle to the dialog...
-Ian
|
|
|
|
|
I need some help for my project. i'm using MFC C++.
Actually i need to write a program tat can select the wanted region on an given image(256 by 256) to compute some calculation.... but before i can compute the calculation i need to differentiate the selected region i wan and the region tat is unwanted... so the wanted region i need is the thickness of hollow cylinder.... i need to draw a bigger circle first capture the pixel selected and store in a array call (Index [r][c]) and follow by drawing a smaller circle in the bigger circle capture the pixel in a array call (index_inner[r][c])...the wanted region is between the bigger and the smaller circle...
can u give me some tip for how to wirte the program
|
|
|
|