Minor changes: 1.0.1
This commit is contained in:
parent
d83aef84a7
commit
d77733d29f
2 changed files with 48 additions and 49 deletions
21
cpu.hpp
21
cpu.hpp
|
@ -16,16 +16,15 @@ You should have received a copy of the GNU General Public License along with thi
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace plutoisa {
|
using namespace std;
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
uint8_t *registers = ( uint8_t * ) malloc ( 8 * sizeof ( uint8_t ) );
|
uint8_t *registers = ( uint8_t * ) malloc ( 8 * sizeof ( uint8_t ) );
|
||||||
uint8_t *memory = ( uint8_t * ) malloc ( 128 * sizeof ( uint8_t ) );
|
uint8_t *memory = ( uint8_t * ) malloc ( 128 * sizeof ( uint8_t ) );
|
||||||
uint8_t *pointer = ( uint8_t * ) malloc ( sizeof ( uint8_t ) );
|
uint8_t *pointer = ( uint8_t * ) malloc ( sizeof ( uint8_t ) );
|
||||||
|
|
||||||
void cpuInstructions ( uint8_t *rom ) {
|
void cpuInstructions ( uint8_t *rom ) {
|
||||||
cout << static_cast<int>(rom[*pointer]) << endl;
|
cout << static_cast<int> ( rom[*pointer] ) << endl;
|
||||||
cout << static_cast<int>(*pointer) << endl;
|
cout << static_cast<int> ( *pointer ) << endl;
|
||||||
switch ( rom[*pointer] ) {
|
switch ( rom[*pointer] ) {
|
||||||
case 0x00: // GET
|
case 0x00: // GET
|
||||||
registers[rom[*pointer + 1]] = rom[*pointer + 2];
|
registers[rom[*pointer + 1]] = rom[*pointer + 2];
|
||||||
|
@ -59,13 +58,13 @@ namespace plutoisa {
|
||||||
cout << "Invalid Instruction, quitting." << endl;
|
cout << "Invalid Instruction, quitting." << endl;
|
||||||
exit ( 1 );
|
exit ( 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpuEmulation ( uint8_t *rom ) {
|
void cpuEmulation ( uint8_t *rom ) {
|
||||||
*pointer = 0;
|
*pointer = 0;
|
||||||
|
|
||||||
while ( true ) {
|
while ( true ) {
|
||||||
cpuInstructions ( rom );
|
cpuInstructions ( rom );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
main.cpp
4
main.cpp
|
@ -11,11 +11,11 @@ You should have received a copy of the GNU General Public License along with thi
|
||||||
|
|
||||||
#include "cpu.hpp"
|
#include "cpu.hpp"
|
||||||
|
|
||||||
using namespace plutoisa;
|
using namespace std;
|
||||||
|
|
||||||
int main ( int argc, char *argv[] ) {
|
int main ( int argc, char *argv[] ) {
|
||||||
const char *filename = argv[1];
|
const char *filename = argv[1];
|
||||||
const int rom_size = 16;
|
const int rom_size = 256;
|
||||||
|
|
||||||
ifstream file ( filename, ios::binary );
|
ifstream file ( filename, ios::binary );
|
||||||
|
|
||||||
|
|
Reference in a new issue