Project 1999

Go Back   Project 1999 > General Community > Rants and Flames

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 06-14-2013, 02:53 PM
r00t r00t is offline
Sarnak


Join Date: Jun 2013
Posts: 330
Default

[You must be logged in to view images. Log in or Register.]

Code:
#include <iostream>
#include <stdlib.h>
#include <string>

#include "VonEmu.h"

int main(int argc, char* argv[])
{
    std::string inputBuffer;
    VonEmu* von = new VonEmu();

    while (getline(std::cin, inputBuffer))  // read redirected input file line b
y line
        von->feedInput(atoi(inputBuffer.c_str()));  // add it to the emulated me
mory

    // use do-while to print out initial values
    do std::cout << *von << std::endl;
    while (von->runProgram());     // repeat forever until terminates

    delete von;
    return 0;
}
Code:
###############################################################*/
class VonEmu
{

    public:
        VonEmu();

        enum Opcode { Load = 1, Store, Add, Subtract, Branch, Stop };

        // overload << to cout the object's memory, PC, ACC, etc.
        friend std::ostream& operator<<(std::ostream &os, const VonEmu &v);

        bool feedInput(int input);
        bool runProgram(); // executes single next instruction pointed to by _pr
ogramCounter

    protected:
        int _accumulator;
        int _programCounter;

        int _memory[VONEMU_MAX_MEMORY];

        int _inputOffset;  // offset representing the current memory location to
 store data in
        bool _inputDataFlag; // true if storing data, false if storing to locati
ons

    private:
        bool _executeInstruction(int instructionOpcode, int instructionData);
};
Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:17 PM.


Everquest is a registered trademark of Daybreak Game Company LLC.
Project 1999 is not associated or affiliated in any way with Daybreak Game Company LLC.
Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.