aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-04-14 02:34:28 +0630
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-04-14 02:34:28 +0630
commit38a24f172f31e66bd11cd98d93f86824e9f3a11f (patch)
tree7146882edcafc19afc1f6756fae713340e6d6aee
parent4e9eb0a42eacdf11c9f5f3d2d9e16ef1b7ce9610 (diff)
downloadovm-38a24f172f31e66bd11cd98d93f86824e9f3a11f.tar.gz
ovm-38a24f172f31e66bd11cd98d93f86824e9f3a11f.tar.bz2
ovm-38a24f172f31e66bd11cd98d93f86824e9f3a11f.zip
Finished todo on importing another file
-rw-r--r--todo.org78
1 files changed, 39 insertions, 39 deletions
diff --git a/todo.org b/todo.org
index b8bda39..2fac332 100644
--- a/todo.org
+++ b/todo.org
@@ -19,45 +19,6 @@
Like in FASM or NASM where we can give certain helpful instructions to
the assembler. I'd use the ~%~ symbol to designate preprocessor
directives.
-** WIP Import another file
-Say I have two "asm" files: /a.asm/ and /b.asm/.
-
-#+CAPTION: a.asm
-#+begin_src asm
- global main
-main:
- push.word 1
- push.word 1
- push.word 1
- sub.word
- sub.word
- call b-println
- halt
-#+end_src
-
-#+CAPTION: b.asm
-#+begin_src asm
-b-println:
- print.word
- push.byte '\n'
- print.char
- ret
-#+end_src
-
-How would one assemble this? We've got two files, with /a.asm/
-depending on /b.asm/ for the symbol ~b-println~. It's obvious they
-need to be assembled "together" to make something that could work. A
-possible "correct" program would be having the file /b.asm/ completely
-included into /a.asm/, such that compiling /a.asm/ would lead to
-classical symbol resolution without much hassle. As a feature, this
-would be best placed in the preprocessor as symbol resolution occurs
-in the third stage of parsing (~process_presults~), whereas the
-preprocessor is always the first stage.
-
-That would be a very simple way of solving the static vs dynamic
-linking problem: just include the files you actually need. Even the
-standard library would be fine and not require any additional work.
-Let's see how this would work.
** TODO Macros
Essentially constants expressions which take literal parameters
(i.e. tokens) and can use them throughout the body. Something like
@@ -243,3 +204,42 @@ memory to use in the stack).
2024-04-09: Found the ~hto_e~ functions under =endian.h= that provide
both way host to specific endian conversion of shorts, half words and
words. This will make it super simple to just convert.
+** DONE Import another file
+Say I have two "asm" files: /a.asm/ and /b.asm/.
+
+#+CAPTION: a.asm
+#+begin_src asm
+ global main
+main:
+ push.word 1
+ push.word 1
+ push.word 1
+ sub.word
+ sub.word
+ call b-println
+ halt
+#+end_src
+
+#+CAPTION: b.asm
+#+begin_src asm
+b-println:
+ print.word
+ push.byte '\n'
+ print.char
+ ret
+#+end_src
+
+How would one assemble this? We've got two files, with /a.asm/
+depending on /b.asm/ for the symbol ~b-println~. It's obvious they
+need to be assembled "together" to make something that could work. A
+possible "correct" program would be having the file /b.asm/ completely
+included into /a.asm/, such that compiling /a.asm/ would lead to
+classical symbol resolution without much hassle. As a feature, this
+would be best placed in the preprocessor as symbol resolution occurs
+in the third stage of parsing (~process_presults~), whereas the
+preprocessor is always the first stage.
+
+That would be a very simple way of solving the static vs dynamic
+linking problem: just include the files you actually need. Even the
+standard library would be fine and not require any additional work.
+Let's see how this would work.