26 lines
463 B
C
26 lines
463 B
C
#ifndef ASSEMBLER_H
|
|
#define ASSEMBLER_H
|
|
|
|
#include "../vm/common.h"
|
|
#include "../vm/vm.h"
|
|
#include "parser.h"
|
|
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
|
|
#define AS_FIXED(v) ((float)(i32)(v) / 65536.0f)
|
|
#define TO_FIXED(f) ((u32)((i32)( \
|
|
((f) >= 0.0f) ? ((f) * 65536.0f + 0.5f) : ((f) * 65536.0f - 0.5f) \
|
|
)))
|
|
|
|
typedef struct {
|
|
char *name;
|
|
u32 address;
|
|
} Label;
|
|
|
|
void assemble(VM *vm, ExprNode *program);
|
|
|
|
#endif
|