Assembler/header/target_code_generator.h

19 lines
640 B
C
Raw Normal View History

2023-01-12 00:12:12 +01:00
#include "../header/common.h"
2023-09-21 22:51:01 +02:00
#include "dyn_buf.h"
2023-01-12 00:12:12 +01:00
#ifndef _TAGET_CODE_GENERATOR_H_
#define _TAGET_CODE_GENERATOR_H_
2023-02-25 19:41:58 +01:00
#include <stdio.h>
// Get a machine code instruction from opcode and and optional adress. Returns 0 if the provides adress is too big
2023-01-12 00:12:12 +01:00
__uint32_t get_target_instruction(__uint8_t opcode, __uint8_t use_adress, __uint32_t adress);
2023-02-25 19:41:58 +01:00
// Generate the machine code from tokens into target_code. Returns 0 on success, errno integer on failure
2023-09-21 22:51:01 +02:00
int gen_target_code(char tokens[][MAX_TOKEN_SIZE], dynamic_buffer_t *target_code);
2023-01-12 00:12:12 +01:00
//Print out the machine code in target_code
void print_target_code(__uint32_t *target_code);
2023-02-25 19:41:58 +01:00
#endif