cpu.h 1.28 KB
//
// Created by imanol on 12/25/16.
//

#ifndef SYNACORVM_CPU_H
#define SYNACORVM_CPU_H

#include <stdio.h>
#include "mem.h"
#include "stack.h"
#include "registers.h"
#include "instructions.h"
#include "input.h"

#define MAX_INT 32767

void mov(uint16_t dst, uint16_t src);
void push(uint16_t src);
void pop(uint16_t dst);
void teq(uint16_t dst, uint16_t a, uint16_t b);
void tgt(uint16_t dst, uint16_t a, uint16_t b);
void jmp(uint16_t dst);
void jnz(uint16_t cond, uint16_t dst);
void jz(uint16_t cond, uint16_t dst);
void add(uint16_t dst, uint16_t a, uint16_t b);
void mul(uint16_t dst, uint16_t a, uint16_t b);
void mod(uint16_t dst, uint16_t a, uint16_t b);
void and(uint16_t dst, uint16_t a, uint16_t b);
void or(uint16_t dst, uint16_t a, uint16_t b);
void not(uint16_t dst, uint16_t src);
void load(uint16_t dst, uint16_t src);
void stor(uint16_t dst, uint16_t src);
void call(uint16_t dst);
uint8_t ret();
void out(uint16_t src);
void in(uint16_t dst);
void nop();

uint8_t execute_instruction(uint16_t opcode, uint16_t arg1, uint16_t arg2, uint16_t arg3);
void start_execution();
void core_dump();
void print_instruction(uint16_t opcode, uint16_t arg1, uint16_t arg2, uint16_t arg3);
void decode_instruction(uint16_t opcode, uint16_t *arg1, uint16_t *arg2, uint16_t *arg3);


#endif //SYNACORVM_CPU_H