Closed Philip-The-Developer closed 9 years ago
Why is point
needed?
You need point, if you want to return strings from a routine; like:
.STRING test "Hallo Welt"
.FUNCT main aString
call getMyFantasticString -> aString
print_addr aString
new_line
quit
.FUNCT getMyFantasticString myString
point myString test
ret myString
We have store
for that purpose.
store myString test
And why not just return the adress by value?
.FUNCT getMyFantasticString myString
ret test
Yestarday evening I my opinon was, that store stores the value at an adress instead of the adress themselfe. But today (after an intensive thinking session) I think, that the directives could interprete as variables which contains a byte-adress. I will implement that fact today in the routine generator, with the result that every opcode, which can use Variables, also will usable with directives. In a nutshell you get your functionallity for store and ret.
Directives should create an address for a name. That name can then be used elsewhere in the assembly, but is replaced with the address constant that the assembler creates.
For example, if I declare a .STRING foo = "foo"
and the assembler generates address 0xF00
for the string, then print_addr foo
should be translated the same as print_addr 0xF00
would.
You don't even need any typechecking. When someone decides to print_addr
a byte-array or to perform a storeb
on a string, then that's the programmers fault.
You can now create static strings in your Dynamic Memory with:
Moreover you can print your string with the oppcode:
Or you can pass the adress of your string to a variable with:
Have fun ☀