0 Members and 6 Guests are viewing this topic.
s32 read32(u32 address){ return *(s32*)(mem_array+address);}s16 read16(u32 address){ return *(s16*)(mem_array+(address^2));}s8 read8(u32 address){ return *(s8*)(mem_array+(address^3));}
int readmemory_long(int pointer){ unsigned int r_pointer = pointer - 0x80000000; if (r_pointer > 0x00FFFFFF) return 0; int result = 0; char * p_result = &result; for (int index = 0; index <4; index++) { *p_result = memory[result + index]; p_result++; } return result;}void writememory_long(int pointer, int data){ unsigned int r_pointer = pointer - 0x80000000; if (r_pointer > 0x00FFFFFF) return; int * p_data = &data; for (int index = 0; index <4; index++) { memory[r_pointer + index] = *p_data; p_data++; }}
#define ADD_v 0x300C#define MOVi_v 0xE000#define ADDi_v 0x7000#define MOVLi_v 0xD000#define MOVr_v 0x6003#define MOVLin_v 0x2002#define MOVLim_v 0x6002#define MOVLpush_v 0x2006#define MOVLpop_v 0x6006#define CMPEQr_v 0x3000#define DT_v 0x4010#define SUB_v 0x3008#define ANDr_v 0x2009#define NOT_v 0x6007#define ORr_v 0x200B#define TSTr_v 0x2008#define XORr_v 0x200A#define BF_v 0x8B00#define BT_v 0x8D00#define NOP_v 0x0009#define END_v 0xFFFF#define PAUSE_v 0xFFFE
bool end = true; //if false then end executionint speed; //speed in Hzint tempspeed = time(0); //second counterwhile (end) //main loop{ cout << " \b"; //space then backspace for every command. Program fails without it ? end = decode(); //execution. returns if false if code ends speed++; //increments speed in Hz for every instruction if (tempspeed != time(0); //checks if timer has changed { display_reg(speed); // shows content of registers and speed speed = 0; //resets variables tempspeed = time(0); }}
Cool to see new progress. I assume we can do nothing like on the calc yet, right? (Noticing the lack of an interface or something)