![]() |
|
#1
|
|||
|
![]() hello mr neumann I wrote a program to emulate your architecture
| ||
|
#2
|
|||
|
![]() tell me more
| ||
|
#3
|
|||
|
![]() [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); }; | ||
|
#4
|
|||
|
![]() Thought you knew how to forumquest pal. Can't be fuckin' around in bugs/guild recruitment.
| ||
|
#5
|
|||
|
![]() "proper place" kind of thing...really? i get it. just weird to me.
__________________
![]() | ||
|
#6
|
|||
|
![]() lol got banned for having that fat girl gif ...people sure are sensitive when it comes to fat smelly jelly rolls around here
| ||
|
#7
|
||||
|
![]() Quote:
__________________
![]() | |||
|
#9
|
|||
|
![]() agreed
| ||
|
#10
|
|||
|
![]() lol@ this thread, wtf
__________________
-Aftermath-
Tasslehof - 60 Druid Barlow - 60 monk Blueberrii - 60 Mage Gigglepurr - 60 Shaman Kids - 60 Rogue Fornfamnad - 60 Cleric | ||
|
![]() |
|
|