Assembler/header/target_code_generator.h

19 lines
650 B
C
Executable file

#include "../header/common.h"
#include "dyn_buf.h"
#include <stdint.h>
#ifndef _TAGET_CODE_GENERATOR_H_
#define _TAGET_CODE_GENERATOR_H_
#include <stdio.h>
// Get a machine code instruction from opcode and and optional adress. Returns 0 if the provides adress is too big
uint32_t get_target_instruction(uint8_t opcode, uint8_t use_adress, uint32_t adress);
// Generate the machine code from tokens into target_code. Returns 0 on success, errno integer on failure
int gen_target_code(char tokens[][MAX_TOKEN_SIZE], dynamic_buffer_t *target_code);
//Print out the machine code in target_code
void print_target_code(uint32_t *target_code);
#endif