Glass Z80 assembler

Страница 11/21
4 | 5 | 6 | 7 | 8 | 9 | 10 | | 12 | 13 | 14 | 15 | 16

By Grauw

Ascended (10821)

Аватар пользователя Grauw

16-02-2020, 13:49

Dolphin101546015 wrote:
thegeps wrote:

LoL! Is really that important to you out(c),0? For what do you plan to use it to?

Its only one fastest method to write 0 in the port on MSX.
Even Grauw mention it in his tips and tricks. Wink

What, I do, where? No, surely not. I don’t like it because on MSX it breaks R800 compatibility for very negligible gain in very specific edge cases. On other platforms where they only used the Z80 (like CPC, Spectrum, etc.) the consideration may be different, but I don’t write tips & tricks for those Smile.

By Dolphin101546015

Champion (337)

Аватар пользователя Dolphin101546015

16-02-2020, 14:12

Grauw wrote:

What, I do, where? No, surely not. I don’t like it because on MSX it breaks R800 compatibility for very negligible gain in very specific edge cases. On other platforms where they only used the Z80 (like CPC, Spectrum, etc.) the consideration may be different, but I don’t write tips & tricks for those Smile.

Realy?!
http://map.grauw.nl/articles/split_guide.php - not your site? ))
Context was about IN F,(C)
It same point with different direction ;)

But ok, I do not wanna discuss about it.
I just needed this and other commands.
Therefore I select another asm.

Also at this moment I need a more optimizing Asm, and even more - an optimizing C. SDCC generates just ugly code for the z80.

By Grauw

Ascended (10821)

Аватар пользователя Grauw

16-02-2020, 14:20

Contrary to popular belief in f,(c) is officially documented by Zilog actually, see their manual p. 270, and also works on R800. The turboR GT is my primary MSX that I use nowadays, so I would never recommend anything that wouldn’t work on it Smile.

About optimising assembler, I think it is a very interesting topic that I also mentioned when I first announced Glass, but it is not something I can tackle yet. I nowadays also wonder whether this is really the role of an assembler, which is about giving full control to the programmer as opposed to a higher level language like C. But the general concept of applying transforms on code to aid the programmer is something that I like, and optimisation is one application of that.

By ducasp

Paladin (712)

Аватар пользователя ducasp

16-02-2020, 14:53

Grauw wrote:

Contrary to popular belief in f,(c) is officially documented by Zilog actually, see their manual p. 270, and also works on R800. The turboR GT is my primary MSX that I use nowadays, so I would never recommend anything that wouldn’t work on it Smile.

About optimising assembler, I think it is a very interesting topic that I also mentioned when I first announced Glass, but it is not something I can tackle yet. I nowadays also wonder whether this is really the role of an assembler, which is about giving full control to the programmer as opposed to a higher level language like C. But the general concept of applying transforms on code to aid the programmer is something that I like, and optimisation is one application of that.

I don't think that automatic optimization in assembly is desirable, as you might need to spend extra cycles and use non efficient instructions on purpose to "waste" time... If such feature is implemented, I just think that it would be better as a command line option to turn it on. I'm just wondering on how much programmer time could be wasted trying to understand why the heck a given function did not work and vdp output is corrupt, looking at the code, counting cycles, everything seems correct.... :-?

By Grauw

Ascended (10821)

Аватар пользователя Grauw

16-02-2020, 15:08

For sure it should be optional ducasp. Perhaps a special block statement. Indeed transparency of the code suffers, for the potential benefit to be able to write more readable code. However very quickly that line of thought goes into higher level language territory (at least it does for me Big smile).

Contrary to C where you have to trust the compiler to a degree to apply the optimisations, I feel it would suit the nature of assembly better if such optimisations were more visible and more explicit. One example that comes to mind is a “jump” pseudo-instruction which picks jr or jp based on distance.

Another perspective; places where optimisations matter you probably want to hand-optimise anyway. Whereas places where it doesn’t, probably you care more about how readable the code is rather than how it performs. So I think aiding those hand-optimisations by allowing you to do them while keeping the code readable, that would be the an interesting angle to take.

By Metalion

Paragon (1628)

Аватар пользователя Metalion

16-02-2020, 15:59

I'm also confused about all the hex formats that are around. When I was starting on assembly langage in the '80s, the only format I knew and that was quite universal was the $ format. It was used everywhere, and I do not remember seeing a lot of alternate formats around.

By Dolphin101546015

Champion (337)

Аватар пользователя Dolphin101546015

16-02-2020, 16:21

ducasp wrote:

I don't think that automatic optimization in assembly is desirable, as you might need to spend extra cycles and use non efficient instructions on purpose to "waste" time... If such feature is implemented, I just think that it would be better as a command line option to turn it on. I'm just wondering on how much programmer time could be wasted trying to understand why the heck a given function did not work and vdp output is corrupt, looking at the code, counting cycles, everything seems correct.... Question

Ofc! Evenmore, when it Asm is exhaust after C or Pascal.
Its not C compiller problem, when in Asm listing u got something like:

       ...
       and  a, 7Fh
       and  a, 03h
       ...
       

Or even:

       ...
       ld   c, (#_Data+0)
       ld   b, (#_Data+1)
       ld   l, c
       ld   h, b
       ld   (#NewData+0), l
       ld   (#NewData+1), h
       ...
       

By Grauw

Ascended (10821)

Аватар пользователя Grauw

16-02-2020, 17:26

I see, so you're thinking of an optimization post-processor for c compiler output.

Optimising without structured data from the C compiler has its limits though, e.g. the first one can be optimised quite obviously, but the second depends on whether b and c are used later on, and unless they are overwritten soon after it may be very difficult to determine whether they are unused. E.g. if it returns, you don't know what called it and whether that was using bc as return value.

By Dolphin101546015

Champion (337)

Аватар пользователя Dolphin101546015

16-02-2020, 20:06

Exactly! But BC (and HL too!) not used after it))
I might show screen shots such examples so many.
Its all not so terrible as another moments with IY and stack using.
Oftern I see this fckn trick:

       ...
       jr  NZ, EndFunc
       jr  Next
       jr  EndFunc
Next:
       ...
       

This is just a holiday!
Smile

Btw this:

       and  a, 7Fh
       and  a, 03h

Is on every operations like:
(data>>1)&3
Or similar.

By spacemoai1973

Ambassador (0)

Аватар пользователя spacemoai1973

16-02-2020, 21:19

Metalion wrote:

That's quite rude.
What do you want to achieve by this post ?

You forgot one important thing in your gloating comment : it costs 25 euros.

That's quite strange.
I just point out that at least one assembler exists that succesfully solves the described problem so that can be taken into account in the question of how to move forward.

Also it doesn't (yet) cost 25 euros, but it would easily be worth that money.

Страница 11/21
4 | 5 | 6 | 7 | 8 | 9 | 10 | | 12 | 13 | 14 | 15 | 16