Assembler Optimizer

Página 38/49
31 | 32 | 33 | 34 | 35 | 36 | 37 | | 39 | 40 | 41 | 42 | 43

Por mzoran

Expert (114)

imagem de mzoran

15-03-2021, 18:08

(@mzoran, the issue you mentioned above should be fixed now).
ALIGN extra parameters work, but there are new issues.
In one of the included files that define system variables this line just won't get parsed
DEVICE equ 0FD99H ; DEFB 00H
as if DEVICE is somehow reserved, but sjasmplus is not complaining
Next mdl seems alergic to files generated by MSX-BASIC due to some uncommon EOF character at the end of file, but again sjasmplus is not complaining
The last thing I noticed is that syntax for repeated instruction does not parse
ERROR: parseRestofTheLine: Cannot parse line vblank.asm#138: .18 CALL FAST_VRAM_COPY32 ; (18x (18 + 587) = 10890) left over tokens: [FAST_VRAM_COPY32, ; (18x (18 + 587) = 10890)]

Por santiontanon

Paragon (1394)

imagem de santiontanon

15-03-2021, 21:11

Thanks for this report mzoran!! Very useful! I can see why each of those 3 issues would occur (and are easy fixes that I'll work on for the next version!). For example, I had indeed prevented any variable to be defined with the name of any keyword like "device", "org", etc. since most assemblers forbid that, but knowing that sjasmplus doesn't, it's a matter of changing a single line of code to fix Smile

Thanks a lot again! Will ping back here when there is a new version fixing these issues

Por Ped7g

Rookie (31)

imagem de Ped7g

15-03-2021, 22:46

The sjasmplus does treat anything at beginning of line as label, and instruction/directive must follow after at least one space, so "DEVICE equ ..." works as symbol.

But I would personally recommend to avoid that in your asm projects, as some people actually hate that whitespace ahead of directives and use --dirbol switch to enable DIRectives at Beginning Of Line, and overall re-use of keywords makes it more difficult to syntax-highlight source correctly and even to read over the source quickly.

... people... oO ... sigh ... if I ever actually do sjasmplus v2.x, one of the changes will be to make keyword banned for symbols... even if some very good friends of me will hate me for that Big smile

The dot repeater syntax is either ".decimal_number" (only 0-9 digits are valid chars), or ".(expression/symbol/etc)" for cases like .(endSomewhere-startElsewhere), and it repeats single instruction that-many-times.

Por santiontanon

Paragon (1394)

imagem de santiontanon

16-03-2021, 01:53

Thanks for the clarifications Ped7g!

About the keyword/symbolanem issue, having everyone happy is tricky, haha I guess having a default and allowing modifying with a flag makes sense (like you say with "--dirbol")

Por jltursan

Prophet (2505)

imagem de jltursan

19-03-2021, 15:06

Just a little update to report a bug...

Sjasm has a "reusable jump labels" syntax that the optimizer has supported; but it only generates the jump instruction label, not the label itself which is pointed to, e,g.:

    jr c, _sjasm_reusable_1_1
    ld a, (bgclr)
    jr _sjasm_reusable_2_1
1:    ld a, (fgclr)
2:    and #f0

The labels "1:" and "2:" are being left untouched.

Por santiontanon

Paragon (1394)

imagem de santiontanon

19-03-2021, 16:11

Oh, interesting! Thanks for the report! This was working on a previous version, but I think I might have broken it in the latest release, hahaha! I'll look into it tonight Smile

Por santiontanon

Paragon (1394)

imagem de santiontanon

20-03-2021, 06:27

Actually, it turns out that I was wrong! this has never worked in any previous version of MDL. I just fixed it though, thanks got the report Smile

Por santiontanon

Paragon (1394)

imagem de santiontanon

21-03-2021, 23:01

I just released version 1.8.1: https://github.com/santiontanon/mdlz80optimizer/releases/tag/v1.8.1b

I didn't have as much time as I hoped this week, so, instead of going to 1.9, I decided to keep it as 1.8.1 :)

This time around, I mostly focused on improving support for sjasmplus (and a bit of sjasm). So, all the things we discussed above should now be fixed, and I was also able to increase sjasmplus support enough as for being able to parse and generate optimizations for the two projects you guys shared above (coloristic and amstrad-diagnostics). But if anyone has any pointer to some project you are aware of, or you are working on on which MDL might not yet work, any additional project links are always appreciated :)

Let's see if this week I have enough time to finish all I wanted to finish for 1.9 (I still have a long list of small issues to fix/improve that couldn't get to this past week), and then I can remove the "beta" tag if all works as expected! :)

Por santiontanon

Paragon (1394)

imagem de santiontanon

29-03-2021, 06:19

And one more weird discovery upon comparing the different assemblers, this time something funny happening in tniasm:
- tniam fails to parse lines like this:

ld hl,(10+5)+1

It seems that if the very first character of an expression in an instruction that allows for an indirection is a "(", tniasm already assumes that this is going to be an indirection, and ignores the "+1" when parsing the expression, which then sees as "unexpected extra characters" and fails to parse the line. Funnily enough, this parses fine:

ld hl,0+(10+5)+1

So, now when MDL generates tniasm code, I need to check if the first character of an expression is a "(", and if it is, and MDL knows it is not an indirection, I need to wrap the expression in a "0+(expression)" so that tniasm can parse it. Ow well... hahaha

I discovered a few more interesting differences this weekend (e.g. some assemblers parse 10+"A" fine, while others require you to use single quotes: 10+'A' to recognize "A" as a number. And others even allow you to do 10+"AB", taking "AB" as a 16bit number, while others do not let you do that...), but the tniasm one I found quite funny, since I think it's clearly a bug Smile

Por Bengalack

Champion (384)

imagem de Bengalack

29-03-2021, 16:32

santiontanon wrote:

- are not defined as "public" (in the dialects that support such type of keywords)

I'd like that in SDCC. I have some functions that are "API"s for other modules in memory. From it's own code, they may have been called zero, once or several times. Is there a way in SDCC to mark them as public or API?

Página 38/49
31 | 32 | 33 | 34 | 35 | 36 | 37 | | 39 | 40 | 41 | 42 | 43