how do you program an instruction set architecture in c++?
116003
It almost sounds as if your project is going to eventually become a "virtual machine", or better yet a simulated computer.\n\nThe first step is to determine your instruction set.  The computer will probably have the ability to perform simple arithmetic, such as add, subtract, multiply, divide, shift, jump to memory locations, etc.  Each of these operations will use a unique sequence of 'bits' to identify the specific operation.  For example, you can say that your machine only supports only sixteen instructions.  Because it is sixteen, we can identify each instructions with four bits:\n\nMOV   0000 - move data\nADD   0001 - add data\nSUB   0010 - subtract data\nMPY   0011 - multiply data\nDIV   0100 - divide data\nAND   0101 - bitwise 'and'\nOR    0110 - bitwise 'or'\nXOR   0111 - bitwise 'exclusive or'\nNOT   1000 - invert bits\nJMP   1001 - unconditional jump\nCMP   1010 - compare values\nJEQ   1011 - jump if equal\nJL    1100 - jump if less than\nJG    1101 - jump if greater than\nJLE   1110 - jump if less or equal\nJGE   1111 - jump if greater or equal\n\nOnce you determine the instructions the computer will support, you need to determine your addressing modes.  For example, an "add" instruction can work with two registers, two memory addresses, a memory address and a register, or indirect combinations of both.  For each addressing mode, we will assign a sequence of bits.  I'm going to choose only four addressing modes, "immediate" (where the data in the instruction is taken as a literal value), "memory" (where the data in the instruction is a memory address), "register" (where the data in the instruction is a register number) and "indirect" (where the value in a register is a memory address to where the data points).  I will use two bits to identify the source addressing mode, an another two bits to identify the destination addressing mode.  If the instruction only uses one destination, the second two bits would be used.  This is now a total of four bits which we combine with the first four bits of the opcode.  Below are the bits we will use for the modes:\n\nImmediate - 00\nRegister - 01\nMemory - 10\nIndirect Register - 11\n\nNow, we have defined a fairly competent instruction set that identifies the operations and addressing modes with only one byte of data!\n\nJust to show "mnemonics" of the assembly language of our computer, with addressing modes, consider the following:\n\nADD 10, R2 - Add number 10 to register 2 (immediate/register)\n\nADD R1, R2  - Add register 1 to register 2 (register/register)\n\nADD @MEM1, R2 - Add value in memory at MEM1 to register 2 (memory/register)\n\nADD *R1, R2 - Add value pointed to by address in register 1 to register 2 (indirect/register)\n\nNow, they would equate, in bits to the following:\nADD 10, R2      0001 00 01  (11 in hexadecimal)\nADD R1, R2      0001 01 01  (15 in hexadecimal)\nADD @MEM1, R2   0001 10 01  (19 in hexadecimal)\nADD *R1, R2     0001 11 01  (1D in hexadecimal)\n\nNote that each instruction and addressing mode is one byte, but only part of the complete instruction.  You can use the bitwise and (&) operator in C++ in order to mask off the opcode and addressing modes from that single byte (unsigned char).  So:\n\nopcode = byte & 0xF0;       (1111 0000)\nsourcemode = byte & 0xC0;   (0000 1100)\ndestmode = byte & 0x03;     (0000 0011)\n\nOnce we've determine the addressing mode for each one, the next sequence of bytes after the opcode and mode would be either the immediate value, a register value or a memory address.  The remainder of each instruction can be either a fixed or variable number of bytes, that is your choice.\n\nFrom there, you just process a stream of bytes and you can get the extract the operation, addressing mode, data for source and destination (or just destination if its a single operand).  Next, your "virtual machine" needs to sim
1167562
Well yes! but you have to know pretty well C++ to do this. A starting tutorial for doing this, refering to OpenGL and DirectX libraries for C++ implementation is available at the link below:
1146701
These tutorials explain the C++ language from its basics up to the newest features of ANSI-C++, including basic concepts such as arrays or classes and advanced concepts such as polymorphism or templates. The tutorial is oriented in a practical way, with working example programs in all sections to start practicing each lesson right away.\n\nhttp://www.cplusplus.com/doc/tutorial/
254178
With GCC compiler (used by Dev-++) you can write:\n\nsystem("cls");
28256
If you develop the C++ dll, then wrap your function declaration with an extern "C" declaration.\n\nIf not, then you may use the Windows API functions GetProcAddress to look for the address, cast the result to a pointer to function then call.\n\nPls state if you have control over the C++ source and we will follow one or the other path.
81883
Details of the algorithm for conversion along with\nsource program written in C can be found at.\nhttp://www.codepedia.com/1/Art_Expressions_p1\n\nA good short article on this topic.\nhttp://www.cs.man.ac.uk/~pjj/cs2121/fix.html
204135
http://www.cprogramming.com/tutorial.html - is a good online resource\n\nhttp://www.developer.be/forums/index.cfm/fuseaction/dsp_threads/forumid/16.htm - a forum that has c/c++ developers ready and able to help out.\n\nAlso use the MSDN library to get a lot of information.\n\nI've always liked the "bible books" it covers a lot of great info from begginers to advance: \nISBN: 0764546546 \n\nAlso the complete refference books are garet as well:\nISBN: 0078824761
1088586
1 Machine language\n2 Assembly language\n3 High level Language
627389
Logical Block Addressing.\n\nhttp://en.wikipedia.org/wiki/Logical_block_addressing
167955
Well you can if you compile it, I forget exactly how.\n\nBut if you just have the dll I don't believe you can. It would sort of defeat the purpose if that sort of information was editable by users.
1106844
Use a compiler like Dev-C++.
1007436
http://www.freeprogrammingresources.com/cppbooks.html
150403
Microsoft .Net Framework SDK has a C++ compiler. It is available in 32 and 64 bit editions.\nIts free.
12275
Follow this link:\n\nhttp://www.thefreecountry.com/compilers/cpp.shtml\n\n:)
838210
Presumably you don't have to do any I/O here, although you're not clear on that point. So, you have to compare registers AX and DX.  Then jump to the appropriate code to print out the right answer.  \n\nWhy don't you just look at  your notes and take a crack at it?  It's really not very hard, and I'm sure your instructor has reviewed the instructions you need to use.
759983
I think u're more familiar with Windows XP operating system, load Turbo C++ IDE (Integrated Development Environment). It's the best-selling C-compiler in world. Or, if u're using Linux, then it contains built-in GCC-compiler.
747743
Can not give you the code or you shall not learn... so please see Page 534 of "Mastering C++" by  R Venugopal, Rajkumar & T Ravishankar  from Tata McGrawHill.\n\nI hope this will help you...