Assembler Optimizer

Page 4/49
1 | 2 | 3 | | 5 | 6 | 7 | 8 | 9

Par ren

Paragon (1857)

Portrait de ren

18-06-2020, 18:35

(sideline comment: I totally approve of pyramidwarpex btw Wink)

Par Grauw

Ascended (10015)

Portrait de Grauw

18-06-2020, 18:43

You could also first focus on standard Z80 notation without all the custom syntax of the various assemblers.

The gngplay project in my repository only uses standard Z80 notation. Most of the others rely on Glass-isms like accessing symbols in macros. (It may be interesting to look into adding an option to Glass to output plain Z80 assembly with all macros etc. expanded.)

Par santiontanon

Paragon (1446)

Portrait de santiontanon

18-06-2020, 19:29

There are indeed a lot of different syntax conventions! and some of them incompatible. For example, I see that jasm uses "." to indicate local labels, were as asMSX uses "@@" for this, and uses "." for built-in functions (e.g., to print debug messages during compilation). So, if I want to support all of them, I'll need some command-line flags to indicate the parser to use...

But it's ok, this was very helpful, as I've been looking ant each assembler supports A LOT of specialized syntax, but most of those are rarely used. So, I just wanted to see which are the common constructs that are actually used in MSX projects, to support at least most of those. From what I see, if I add support for local labels, and a few more macros, I might cover already 50% of the projects linked above, so, I will be satisfied with that Smile

And yeah, an option to output plain Z80 assembly without macros, etc. would be a great feature for ALL assemblers. In that way, we would be able to share code across assemblers, while still being able to code with our favorite one!

Par Grauw

Ascended (10015)

Portrait de Grauw

18-06-2020, 19:44

santiontanon wrote:

There are indeed a lot of different syntax conventions! and some of them incompatible. For example, I see that jasm uses "." to indicate local labels, were as asMSX uses "@@" for this, and uses "." for built-in functions (e.g., to print debug messages during compilation).

And Glass only scopes labels locally if they’re in a MACRO or PROC block, because some symbols (like those for DOS2 error codes) start with a . and I feel Sjasm and TniAsm’s notation conflicts with that. Plus it allows for nesting.

Par santiontanon

Paragon (1446)

Portrait de santiontanon

18-06-2020, 22:12

Yeah, assembler syntax is tricky. I see that with their best intentions in mind, each assembler developer expanded on the plain Z80 notation to make programming easier (although some of the decisions in a few are questionable, but that's a different discussion hehe). But every assembler went in a different direction, and now they are all mostly incompatible except for the most basic core features.

In any case i have a basic parser done (which I might expand bit by bit to support more syntax) and this weekend I'll get started with generating a dependency graph given a block of assembler code. Detecting whether an instruction depends on another is easy when they interact via a register or flag, but it gets tricky when they interact via a input/output port or via memory (unless the memory address can be resolved at compile time). So, I'm planning on being conservative and err on the side of adding more dependencies than maybe needed. The result will be that maybe I will miss some possible optimizations, but at least all optimizations that are applied will be guaranteed to not break the program (again all assuming non-self modifiable code).

Par syn

Prophet (2061)

Portrait de syn

18-06-2020, 22:24

Grauw wrote:
santiontanon wrote:

There are indeed a lot of different syntax conventions! and some of them incompatible. For example, I see that jasm uses "." to indicate local labels, were as asMSX uses "@@" for this, and uses "." for built-in functions (e.g., to print debug messages during compilation).

And Glass only scopes labels locally if they’re in a MACRO or PROC block, because some symbols (like those for DOS2 error codes) start with a . and I feel Sjasm and TniAsm’s notation conflicts with that. Plus it allows for nesting.

I dont really understand your post (im not a pro coder).
you mean if I use a dos2 error code like .NCOMP as a label it will fail to compile? or do you mean "conflicts" as in "confusing for coder"?

Par AxelF

Champion (386)

Portrait de AxelF

18-06-2020, 23:00

I think both assemblers wil fail, because they are incapleble to handle these labels. (Yes i've tried)

Par Grauw

Ascended (10015)

Portrait de Grauw

18-06-2020, 23:29

syn wrote:

I dont really understand your post (im not a pro coder).
you mean if I use a dos2 error code like .NCOMP as a label it will fail to compile? or do you mean "conflicts" as in "confusing for coder"?

It will combine with a previous label that does not start with a . and form a longer label.

Par syn

Prophet (2061)

Portrait de syn

21-06-2020, 00:33

Just checked with GuyveR800 (the creator of tniASM):
- In tniASM, right now you can define those Dos error codes or any labels starting with a period by using macros, For example %macro .NCOMP \ 0FFh \ %endmacro
- tniASM already supports labels that do not participate in the parent/local mechanism
- Support for such labels starting with a period was already planned for the next version. So .NCOMP equ 0FFh will work as well

Par ARTRAG

Enlighted (6515)

Portrait de ARTRAG

21-06-2020, 13:22

Santi I I wouldn't implement anything if not standard sintax
You risk to do not start with the real core of your project if you want to deal with the plethora of dialects spawned in the last years

Page 4/49
1 | 2 | 3 | | 5 | 6 | 7 | 8 | 9