Re: A86: Re: Re: Assembly
[Prev][Next][Index][Thread]
Re: A86: Re: Re: Assembly
> in fact, i was thinking about something like this, except mine was a
little
> different. I was thinking about making a scripting language which can be
> translated fairly simply to asm and then compiled that way. So in essence,
one
> would be creating a sort of new many-to-one language which can be
translated to
> asm. I could help out with the script (i am afraid i am not nearly an
expert on
> z80 asm :( ) and i can write a win9x program (or a perl program, if
someone
> would want to have it on the web too, or for *nix users) which would
interpret
> the commands and then output asm, or i supposed i could even compile it
within
> the program too, or whatever, i am just spouting out ideas.
>
Not to shoot down your idea, but it's been done before. Several times.
There's at least one TI-BASIC to asm converter and several C compilers. Z80
is not an ideal cpu for a compiler, due to it's simple instruction set and
limited registers. Hand optimization is the key to good code. A good C
compiler that is targeted at z80 (like the one for the Game Boy that comes
with the GBDK) will produce fair code, assuming that the coder is conscious
and "helps" it along. Of course, this requires some knowledge of how the
compiler works and what the resulting code will be. For something like the
GB where speed and size is not as crucial (for the most part, size on GB is
irrelevant) as on the TI, a C compiler is an option. However, I would not
spend the time on it unless you really want to. It would probably be better
spent learning asm (not z80, but asm in general) because you will then have
a clear understand of how things are.
Yes, I was like you too, once. I didn't want to learn asm. It seemed hard
at first, and it was. But after a few days of writing code, I got the hang
of it fairly well. After a couple of months, it was pretty easy. I am very
glad that I didn't skimp on learning asm. Justin Karneges (guy who
programmed Jolitma) didn't learn asm at first. He wrote a lot of it with a
C compiler (a very old and good one from the CP/M days) and found that it
was impossible. He then learned asm (very quickly!) and wrote it in pure
asm, and it is a very good game. If you'll ask him, I'm sure he'll tell you
that he's glad he learned asm and didn't waste too much time avoiding it.
> i think this would be fun and useful, even asm junkies could use it for
the core
> of a program and then optimise the code later.
Wrong. You can't write code and optimize it later. Optimized code starts
at the conceptual level, before a line of code is even written. Sure, a few
bytes here and there can be saved, but a truely optimized program must be
optimized from the start.
Follow-Ups:
References: