diff --git a/source/assembler.c b/source/assembler.c index 88cae26..546494b 100644 --- a/source/assembler.c +++ b/source/assembler.c @@ -23,10 +23,11 @@ #define MOVE_IF_COUNT (MOVE_IF_END - MOVE_IF_BEGIN + 1) // Regulates displacement, immediate, label, variable, constant, string data. -/*static next * empty_from; +static next holes; +static next * empty_from; static next * empty_to; static next * imbue_with; -static next * imbue_size;*/ +static next * imbue_size; // Main function. static void place (form when, @@ -47,6 +48,24 @@ static void print (form when, place ((when != 0) && (size >= D32), (byte) ((data >> 24) & 0xff)); } +static void delay (form when, + size_index size, + next data) { + /* */ + empty_from [holes] = text_sector_size; + imbue_with [holes] = data; + imbue_size [holes] = size; + + place ((when != 0) && (size >= D8), (byte) ((data >> 0) & 0xff)); + place ((when != 0) && (size >= D16), (byte) ((data >> 8) & 0xff)); + place ((when != 0) && (size >= D32), (byte) ((data >> 16) & 0xff)); + place ((when != 0) && (size >= D32), (byte) ((data >> 24) & 0xff)); + + empty_to [holes] = text_sector_size; + + holes += when; +} + static form front (form data) { return ((data >= 4) && (data <= 7)); } static form lower (form data) { return ((data >= 0) && (data <= 7)); } static form upper (form data) { return ((data >= 8) && (data <= 15)); } @@ -276,10 +295,10 @@ static void build_move (size_index size, place ((to == MEM) && (from == IMM), (byte) (0xc6 + (size != D8))); place ((to == MEM) && (from == IMM), (byte) (0x05)); - print ((to == REG) && (from == MEM), D32, (next) ~0); - print ((to == REG) && (from == IMM), D32, source); - print ((to == MEM) && (from == REG), D32, (next) ~0); - print ((to == MEM) && (from == IMM), D32, (next) ~0); + delay ((to == REG) && (from == MEM), D32, (next) ~0); + print ((to == REG) && (from == IMM), size, source); + delay ((to == MEM) && (from == REG), D32, (next) ~0); + delay ((to == MEM) && (from == IMM), D32, (next) ~0); print ((to == MEM) && (from == IMM), size, source); } diff --git a/source/assembler.h b/source/assembler.h index e1c20c3..37184d8 100644 --- a/source/assembler.h +++ b/source/assembler.h @@ -16,13 +16,13 @@ typedef enum { } type_index; typedef enum { - XDCL, XLBL, XRPT, XLCT, + RECORD, /* HIGHLY EXPERIMENTAL CODE ABOVE... */ ADD, OR, ADC, SBB, AND, SUB, XOR, CMP, /* */ INC, DEC, NOT, NEG, - UMUL, IMUL, UDIV, IDIV, + MUL, IMUL, DIV, IDIV, /* */ NOP, RETN, RETF, LEAVE, LOCK, HLT, diff --git a/test/heyo.eax b/test/heyo.eax index 5853ae3..1b25d8e 100644 --- a/test/heyo.eax +++ b/test/heyo.eax @@ -1,4 +1,4 @@ -program heyo_world +unix program heyo_world begin