From 4f6275d0c681a991af1eeb0c8c42fe84039d9e30 Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 15 Jul 2024 19:15:15 -0400 Subject: [PATCH 1/2] Example revised... --- test/heyo.eax | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/test/heyo.eax b/test/heyo.eax index 21a6845..c0d4891 100644 --- a/test/heyo.eax +++ b/test/heyo.eax @@ -4,7 +4,7 @@ unix program heyo_world begin nop mov eax 1 nop mov edi 1 - nop mov esi 4198610 + nop mov esi 4198618 nop mov edx 12 nop syscall /*mov eax 1 @@ -51,27 +51,6 @@ end program ASMDIRIMM, D8, 33, ASMDIRIMM, D8, 10, ASMDIRMEM, 1, - ASMDIRIMM, D8, 67, - ASMDIRIMM, D8, 121, - ASMDIRIMM, D8, 97, - ASMDIRIMM, D8, 97, - ASMDIRIMM, D8, 32, - ASMDIRIMM, D8, 102, - ASMDIRIMM, D8, 117, - ASMDIRIMM, D8, 99, - ASMDIRIMM, D8, 107, - ASMDIRIMM, D8, 105, - ASMDIRIMM, D8, 110, - ASMDIRIMM, D8, 103, - ASMDIRIMM, D8, 32, - ASMDIRIMM, D8, 119, - ASMDIRIMM, D8, 111, - ASMDIRIMM, D8, 114, - ASMDIRIMM, D8, 108, - ASMDIRIMM, D8, 100, - ASMDIRIMM, D8, 33, - ASMDIRIMM, D8, 10, - ASMDIRMEM, 2, ASMDIRIMM, D8, 77, ASMDIRIMM, D8, 101, ASMDIRIMM, D8, 109, From 9e1480c4adfa518e3af89d2f5566cd264a3de814 Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 15 Jul 2024 19:50:20 -0400 Subject: [PATCH 2/2] Implemened arrayed ASMDIRIMM thing... --- source/assembler.c | 16 +++++++--------- test/heyo.eax | 16 ++++++++-------- tool/xia32e.c | 12 +++++++++++- tool/xia32e_test.asm | 2 +- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/source/assembler.c b/source/assembler.c index 0a79796..85467ca 100644 --- a/source/assembler.c +++ b/source/assembler.c @@ -89,14 +89,8 @@ static void delay (form when, static void asmdirimm (form when, size_index size, - //~next redo, next data) { - /* */ - //~next i; - - //~for (i = 0; i < redo; ++i) { - print (when, size, data); - //~} + print (when, size, data); } static form front (form data) { return ((data >= 4) && (data <= 7)); } @@ -359,8 +353,12 @@ void assemble (next count, asmdirmem (1, array [index + 1]); index += 1; } else if (array [index] == ASMDIRIMM) { - asmdirimm (1, array [index + 1], array [index + 2]); - index += 2; + next repeat; + for (repeat = 0; repeat < array [index + 2]; ++repeat) { + asmdirimm (1, array [index + 1], + array [index + 3 + repeat]); + } + index += 2 + array [index + 2]; //~} else if (array [index] == ASMDIRREP) { } else if ((array [index] >= REGULAR_BEGIN) && (array [index] <= REGULAR_END)) { diff --git a/test/heyo.eax b/test/heyo.eax index c0d4891..2875586 100644 --- a/test/heyo.eax +++ b/test/heyo.eax @@ -1,17 +1,17 @@ unix program heyo_world - /*s8 heyo = "Heyo world!\n" - s8 cyaa = "Cyaa world!\n"*/ + s8 <12> heyo = "Heyo world!\n" + s8 <12> cyaa = "Cyaa world!\n" begin nop mov eax 1 nop mov edi 1 - nop mov esi 4198618 + nop mov esi heyo + nop mov edx 12 + nop syscall + nop mov eax 1 + nop mov edi 1 + nop mov esi cyaa nop mov edx 12 nop syscall - /*mov eax 1 - mov edi 1 - mov esi cyaa - mov edx 12 - syscall*/ nop mov eax 60 nop mov edi 60 nop syscall diff --git a/tool/xia32e.c b/tool/xia32e.c index 9f8079b..270a84e 100644 --- a/tool/xia32e.c +++ b/tool/xia32e.c @@ -176,7 +176,17 @@ int main (void) { } else if (index == token_count) { if (isdigit (buffer [offset - size - 1]) != 0) { if (scope_directive) { - tokenize (atoi (& buffer [offset - size - 1])); + scope = atoi (& buffer [offset - size - 1]); + tokenize (scope); + do { + leq_string (& buffer [offset], & word, & size); + index = 0; + do { + if (word == token_leq [index]) break; + } while (++index != token_count); + offset += size + 1; + tokenize (atoi (& buffer [offset - size - 1])); + } while (--scope != 0); scope_directive = 0; } else { buffer [offset - 1] = '\0'; diff --git a/tool/xia32e_test.asm b/tool/xia32e_test.asm index ff669c3..b171bd6 100644 --- a/tool/xia32e_test.asm +++ b/tool/xia32e_test.asm @@ -6,5 +6,5 @@ nop syscall nop mov eax 60 nop mov edi 60 nop syscall -nop . heyo db 72 db 69 db 89 db 79 db 10 +nop . heyo db 5 72 69 89 79 10 end