From
Alexander Shabarshin
→
To
All
12 November 2006
Hello BlackWolf
Bla> What were the variations on the BASIC theme?
megabasic, betabasic, laserbasic, and compilers from standard basic
blast type
and the prologue was actually a microprologue with a different syntax and
more primitive
From
Dmitry Rusakov
→
To
All
12 November 2006
Hello caro
What were the variations on the basic theme?
From
TomCaT
→
To
All
12 November 2006
Hello Shaos
Although you can still take a serious approach to programming only using machine codes
without macros and procedures. :)
Well, seriously - at least ASM without macros.
From
Gavrilov Vitaly
→
To
All
12 November 2006
Hello TomCaT
Tom> Although you can still take programming seriously only on
Tom> machine codes without macros and procedures.
Tom>
Like "severe Siberian men write only in machine codes immediately in
hex dump"? Please justify your statement, because I stand by mine
From personal experience I was convinced that the most effective programming is in C
(for embedded systems).
Tom> Well, seriously - at least ASM without macros
IMHO, on the contrary, macros allow you to at least somehow bring ASM closer to the level of nuclear power. How
they say, without fish...
From
TomCaT
→
To
All
14 November 2006
Hello Vitamin
And slow down the program
Studying now Tse after Pascal, I agree that it is not bad at all. But no
arguments will not take away the palm tree and coconuts from Asma. Excuse me, you can do it with an Irishman
speak English, but as a rule he understands Irish better...
From
Gavrilov Vitaly
→
To
All
14 November 2006
Hello TomCaT
Tom> And slow down the program
Please tell me how macros can slow down the program? Or evil
does the assembler insert after each halt command when expanding the macro? :)
Tom> Studying now the CE after Pascal, I agree that it is not bad at all. But
Tom> no arguments will take away the palm tree with coconuts from Asma. Sorry,
Tom> you can speak English with an Irishman, but as a rule Irish
Tom> he understands better...
I, too, once ran and waved the flag “ASM rules, S is for the lazy.” But after that
how I had to first understand and then remake someone else’s program on ASMA
(microcontroller 8051, quite primitive), I slightly changed my opinion. Plus
Moreover, C provides cross-platform functionality - a couple of my libraries are no problem
was tested on three different processors (8051, TMS430, TMS470). No matter how much I
did you write them by hand?
So for industrial programming nothing better than C has yet been invented. And
if performance is really required, assembly language inserts have not been canceled.
(for reference, I’ve been studying ASM spec for 7 years, C/C++ for 5 years, plus a couple more
Asmov, half-forgotten Pascal/Delphi, etc.)
PS. Still, the spec lacks C with a decent development environment...
From
Dmitry Rusakov
→
To
All
14 November 2006
Hello TomCaT
Tom> And slow down the program
Tom>
Tom> Studying now the CE after Pascal, I agree that it is not bad at all.
Tom>
Oh how many wonderful discoveries we have...
Tom> But no amount of arguments will take away the palm tree and coconuts from Asma.
But what about the arguments for speed and ease of development? So what about "no
arguments" we will assume that you got carried away.
Tom> Excuse me, you can speak English with an Irishman, but how
Tom> the Irish rule is clearer to him...
Tom>
There is no need for analogies. They never fully reflect the situation being discussed.
From
Dmitry Rusakov
→
To
All
14 November 2006
Hello TomCaT
It all depends on the task at hand, if you need to lie down with bones but provide
performance then current "in machine codes immediately in a hexadecimal dump"
if the task is to make an application that meets the speed and
labor costs and initial conditions, why not use those that meet
given the criteria, available tools: macros, Java, etc.?
How many projects have been frozen and collapsed due to difficulties in implementation in the context of
labor costs? Why not reduce them (labor costs) if this can be done?
:mad:
From
Dima Kozlov
→
To
All
14 November 2006
Hello TomCaT
Tom> Studying now the CE after Pascal, I agree that it is not bad at all. But
Tom> no arguments will take away the palm tree with coconuts from Asma.
if we take modern hardware, then a good optimizing c/c++ compiler
makes code faster than the average AC programmer.
From
Robus
→
To
All
14 November 2006
Hello Vitamin
Vit> But after I had to figure it out first and then redo it
Vit> someone else's program on ASMA
You can write nasty things in any language, but you can’t write them in C
the program was adjusted in temporary huts. Although you can go the clumsy way and
hang everything on a timer, well then programming will be limited.
Vit> Plus, C provides cross-platform functionality - a couple of mine
Vit> libraries were tested on three different processors without problems
Vit> (8051, TMS430, TMS470). How many times would I write them by hand?
It's probably something very simple. Almost all the time you need to write under
processor new procedures. Especially if you only have 128 bytes of memory from
of which 128 are needed to complete the task. I want to see how it will be in SI
will this problem be solved? How many companies have I seen with initiatives to write for MK?
in SI, they are constantly searching for expensive microcontrollers to solve serious problems.
Typical gigantomania in the style of Windows programs, of the year “all steam is spent on
beep" ... =)
From
Andrey Savichev
→
To
All
14 November 2006
Hello TomCaT
Tom> But no amount of arguments will take away the palm tree with coconuts from Asma.
There is also an argument - “portability” or “porting”... fine-tuning on ASMA, if
a high-quality compiler was used, no one forbids either...
From
Andrey Savichev
→
To
All
14 November 2006
Hello Vitamin
Vit> It happens, I agree. When instead of PIC they put a fancy protsyk "so
Vit> was" :)
In our company they install it because the customers have software for QNX... and ours do it
for them hardware, drivers and tests... on PIC QNX doesn’t seem to be yet
ported... although pic PIC is different... the latest pics are very sophisticated :)
From
Gavrilov Vitaly
→
To
All
14 November 2006
Hello Robus
Rob> You can write nasty things in any language, but it’s impossible to write in C
Rob> a program adjusted in temporary huts. Although you can go clumsy
Rob> way and hang everything on a timer, well then there will be programming
Rob> limited.
It all depends on the clock sampling. For periods of milliseconds and above
A timer is just that tool. And if you need less, then here, of course,
assembler
Rob> This is probably something very simple.
Graphics library for monochrome LCD displays - all sorts of lines, dots,
proportional printing with styles, working with images, buffering,
hardware independence from implementation (it even worked on a device connected via
serial channel display). The second library is the user interface
in the style of a menu for household appliances, based on a graphics library. Not God
the news is that, but not VERY simple.
Rob> Especially if you only have 128 bytes of memory of which for execution
Rob> tasks need 128. I want to see how this one will be solved in SI
Rob> problem ?
And if you have a bunch of devices, a lot of interruption sources, a lot of different ones
timers. I want to see how this problem will be solved in assembler, and,the most important thing is how long it will take to write this program.
Rob> No matter how many companies I have seen with initiatives to write for MK in SI, they
Rob> are constantly searching for expensive microcontrollers to solve serious problems.
I'll tell you a secret, a powerful bourgeois microprocessor costs less than ours
weak monsters (but with 5 acceptance...), while he does not need more
parts of the harness, and in terms of setup and stability it is much easier. A
expensive-cheap - it's all relative, if you save on the price, you'll lose on
writing a program.
Rob> Typical gigantomania in the style of Windows programs, the whole year
Rob> goes to the whistle"
It happens, I agree. When instead of PIC they put a fancy protsyk "so that it is" :)
From
Andrey Savichev
→
To
All
14 November 2006
Hello Vitamin
Vit> PS. Still, the spec lacks C with a decent development environment...
+1
but on GB there is... 5 minutes after I installed this compiler I was already running it
some demo on an emulator... how nice it is to still find an abandoned but used one
millions of users an item that works flawlessly :)
From
Gavrilov Vitaly
→
To
All
14 November 2006
Hello andrews
and> in our company they install it because the customers have software for QNX...a
and> ours make hardware, drivers and tests for them...on PIC, but QNX for now
and> seems to have not been ported...although pic PIC is different...the last peaks are very
and> so sophisticated
no, I’m not talking about such a situation, but specifically about “it was a mistake”%)
elf> if we take modern hardware, then a good optimizing compiler
elf> c/c++ makes code faster than the average AC programmer
yeah. I would also strongly advise you to pee on ASM under an automated workstation :)))
From
Andrey Savichev
→
To
All
14 November 2006
Hello, boo_boo
Write...so far this doesn’t seem to be the case with normal graphics and sound
libraries and hardware support.
From
Stanislav Lomakin
→
To
All
14 November 2006
Hello andrews
and> +1
and> but on GB there is...5 minutes after I installed this compiler for myself
and> I already ran some demo on an emulator...how nice to find it
and> an abandoned item, but used by millions of users
and> works flawlessly :)
for GameBoy? so this is a cross-compiler that works on “large” machines, such
and enough has been written for the Spectrum (z88dk, SDCC)
and by the way, there is ACK - a cross-compiler with C, pascal, fortran, modula, occam and
Vasika.
but on zx - only hisoft C :(
From
TomCaT
→
To
All
14 November 2006
Hello andrews
Okay. I take my words back. C + assembler, but at least up to 20-30 MHz -- c
bias towards the latter, i.e. after transfer and before final assembly,
of course.
From
Gavrilov Vitaly
→
To
All
14 November 2006
Hello TomCaT
Tom> C + assembler, but at least up to 20-30 MHz - with a bias to the side
Tom> of the last one, i.e. after the transfer and before the final assembly, of course.
8051@1MHz quite tolerably executes code compiled from C. And this takes into account
one single 16-bit register. It should be better for spec...
Has anyone found a GCC version for Zetnik? And then I looked through a lot of links - only
scraps of information, no sorts or binaries. Otherwise it would be a shame to collect it
source code for spec :) Because writing from scratch is very resource-intensive...
From
Max Kuleshov
→
To
All
15 November 2006
Hello Vitamin
Vit> Has anyone found a GCC version for Zetnik? And then I rummaged through a lot
Vit> links - just scraps of information, no sorts or binaries.
Same bullshit. But there is an open compiler from ACK, and it can be
optimize. IMHO, this task is an order of magnitude easier than writing a back-end to gcc.
From
Max Kuleshov
→
To
All
15 November 2006
Hello Vitamin
Vit> Can you provide more details? I haven't heard of something like this...
ACK = Amsterdam Compiler Kit.
http://tack.sourceforge.net/
A whole package of development tools. The C compiler, like others (still
several languages are supported) produces intermediate code, and back-ends from
it creates code for the target platform. Moreover, how to broadcast the intermediate
The bytecode in real life is described in a special language. And corresponding
There is already a description for generating the z80 code! But, as stated in the document, it is not
optimal, because the version from i8080 was taken as a basis.
From
Gavrilov Vitaly
→
To
All
15 November 2006
Hello, maximk
max> ACK = Amsterdam Compiler Kit.
I’ve read it, I’ll download it tomorrow and try to compile and run it under niks. I want to
look at the output ASM. Because all existing cross-compilers are such crap
they are making a fuss... Unless IAR, according to rumors, is behaving quite decently (you need to get
try).
From
Gavrilov Vitaly
→
To
All
15 November 2006
Hello, maximk
max> But there is an open compiler from ACK, and it can be optimized.
Can you tell me more? I haven't heard of something like this...
max> IMHO, this task is an order of magnitude easier than writing a back-end to gcc.
Hm... Sometimes it's easier to write again than to redo what has already been written :)
From
Robus
→
To
All
15 November 2006
Hello Vitamin
Vit> Graphics library for monochrome LCD displays - all sorts of lines
Vit> points, proportional printing with styles, working with images,
Vit> buffering, hardware independence from implementation (worked even on
Vit> display connected via a serial link). Second
Vit> library - menu-style user interface for household
Vit> technique, based on a graphics library. God knows what, but not
Vit> VERY simple.
Almost every time I write output procedures for each LCD, since each
LCD is very different from the previous one. I use support almost everywhere
windows, it is, of course, standard and written only in assemblere. Latest
attempts to use the proposed libraries ended with the output
characters, of course of different widths, looked like the print on the “vasik”, although ours is not
"vasik" is about 10 times faster. In short, the speed is simply terrible and fits
to display some extremely static images. Moreover, I
I constantly work part-time at companies where they ask me to speed up
displaying information on LCDs. Next week I'm going to do work for
company Kvazar-Micro, which is exhibiting at the exhibition on stands. TheirProgrammers cannot make normal animation with 25 mips of Intel51. I
I program only in ASMA, the development speed is certainly not the best,
about a week for any task with peripherals (and therefore LCD), and the rest is
already little things that are added along the way. Last time I made the device
a month ago with LCD 240x128 (epson), the entire module was written in a day
graphics with all the windows, fonts and other little things. So I don't see the point
write in C, just waste time searching - “why is this all so
slows down..." ...
From
Gavrilov Vitaly
→
To
All
15 November 2006
Hello Robus
A little off-topic, but with a rational grain
Rob> Almost every time I write output procedures for each LCD
Rob> because each LCD is very different from the previous one.
I chose a different approach for myself. The library is designed for working with displays
128x64 (8 lines of 128 bytes, vertical pixels). But thanks to the buffer
allows you to work with displays with any(!) raster organization (worked successfully
on a multi-page display with a "raster" organization). Naturally slower
(throwing the entire buffer onto the screen), but “everything is inside”.
Well, and the user interface library. Included with it
program designer and converter to C.
Rob> I use window support almost everywhere, it is, of course, standard
Rob> and is written only in assemblere.
And by what manipulations do you port it to other processors? Rewriting?
Rob> The last attempts to use the proposed libraries have ended
Rob> in that the output of characters, of course of different widths, looked like print
Rob> on "vasik", although no, our "vasik" is about 10 times faster.
The aforementioned 8051 at 1 MHz prints the entire screen (with direct rendering in
display) in about 0.4s. This is with proportional printing with processing(Italic font is especially difficult to implement due to its structure).
Rob> Their programmers cannot make a normal one with 25 mips of "Intel51"
Rob> animation.
Hmmm :) I remember, for the sake of humor, I wrote a program for 470 (48 mips, I think, but not sure),
which received image frames via a serial channel, unpacked
them in real time on the screen. And another program on the computer from Avishnik converted and
sent. It produced up to 25fps with a frame size of 1k, compression by 1.5...3 times
it worked. Everything was limited by the port speed - I could only squeeze up to 200 kbit
(the converter did not allow further). I'll have to try this same trick just for fun
to 8051...
Rob> I program only in ASMA, the speed of development is certainly not
Rob> is the best, about a week for any task with peripherals (and therefore
Rob> LCD), and the rest is just little things that are added along the way.
My peripherals include 6 counting channels (16-bit counters
pulses), LCD display (character, with blunt organization), LSD matrix
(primitive...), serial port, plus mathematics inside. And all this on
one 8051 and in S. The program took a very long time to write, the assembler version is almost
uncontrollable (constant modifications and alterations), now I’m rewriting it in C.The second option features a graphic LCD, 8 counting channels, 2
serial ports. The percentage is the same, the program was originally written in C,
making modification relatively simple.
Rob> Therefore, I see no point in writing in C, just wasting time searching, -
Rob> "why is it all so slow..."
Why waste time? We need to use logic! :) In the main loop the programs are different
non-time-critical processes (user interface, post-processing
data, printing to buffers, etc.), and data reception and pre-processing
interruptions. You place control points for setting/resetting levels between blocks
subroutine-processor and look at the oscilloscope who is eating what and how much. A
then you rewrite the critical sections in ASMA. Well, plus it’s clean
algorithmic optimization.
From
Max Kuleshov
→
To
All
15 November 2006
Hello Vitamin
Vit> I would like to see the ASM at the output.
I looked. Bullshit. But the point is different. How to write a code generator from scratch
you can try the monstrous gcc (if you want, of course, but that’s exactly
this is what we were talking about :) ) _optimize_ the already existing back-end from ACK.
From
SfS
→
To
All
15 November 2006
Hello Vitamin
Vit> Why waste time? We need to use logic! :) In the main loop
Vit> programs various non-time-critical processes (user
Vit> interface, post-processing of data, printing to buffers, etc.), and reception
Vit> data and pre-processing on interrupts. You bet
Vit> control points for setting/resetting levels between blocks
Vit> handler subroutine and look at who and how many on an oscilloscope
Vit> what is he eating? And then you rewrite the critical sections in ASMA. Well
Vit> plus purely algorithmic optimization.
I completely agree. This is a kind of “youthful complex” - writing everything in
ASME... And not at all justified. As practice and experience have shown -
thinking through the algorithm and prioritizing tasks is much more
an effective way to do it “so that it doesn’t slow down” than rewriting everything in
ASME. Chunks on ASMA are a different matter (for example, in processors of very critical codes)
interrupt time). But everything on ASMA is perversion :)
From
Gavrilov Vitaly
→
To
All
15 November 2006
Hello, maximk
SfS> As practice and experience have shown - thinking through the algorithm and distribution
SfS> by task priorities is a much more efficient way to do
SfS> “so that it doesn’t slow down” than rewriting everything in ACM. Pieces on asma
SfS> is another matter (for example, in very time-critical handlers
SfS> interrupts). But everything on ASMA is perversion
Slowly but surely, I also came to the same conclusion :) Especially if I have to
redoing someone's code - sometimes it is enough to format the source code
to understand what's what. But on ASMA you usually need to understand deeply...
max> I looked. Bullshit. But the point is different. How to write a code generator from scratch
max> under the monstrous gcc you can try (if you want, of course
max> but this is exactly what we were talking about) _optimize_ an existing one
max> back-end from ACK.
I just saw one implementation of a compiler in C. Everything was done head-on, advanced
grammar parses are not used (I suspect that the standard is not completely
is observed and the optimization is rather weak), but everything is relatively clear and understandable.
From
van Yu Shinn
→
To
All
16 November 2006
Hello BlackWolf
Here's another google:
http://www.softools.com/scz180.htm
http://www.ticalc.org/pub/text/z80/
From
van Yu Shinn
→
To
All
16 November 2006
Hello BlackWolf
If we talk about the z80 in general, then there are many different languages for CP/M - dig around
on file storages.
Documentation for one of the Modula-2 compilers (freeware since 2002):
http://www.hartetechnologies.com/manuals/Modula2/
From
Sergey Akimov
→
To
All
16 November 2006
Hello, maximk
max> No alternatives are visible. If someone wants to do better than in z88dk
max> or sdcc, then, IMHO, it is best to start with ACK.
max> ...
max> 10 years is nothing :) How many BSD or kernels are there in some places?
max> ancient vile utilities? :)
max>
Hehe. I recently compared: the last SDCC generates from the same
source code is twice as large as CP/M Hitec C
one thousand nine hundred furry
max> C99 is not needed for spec and nafik. IMHO, even if there was Small C
max> (a subset, that is), but generated mega-code - it would be real
max> rulez. So what if sdcc ANSI-compliant?
max>
In general, you need at least one language more or less similar to C with the original
support for normal data types (32bit integer, float)
But they are not there! All unfinished ones either generate monstrous code or do nothing
compatible except with themselves.
From
Max Kuleshov
→
To
All
16 November 2006
Hello NovaStorm
bdsc generates code for i8080. The code is relatively normal, but with hisoft it is no longer
compare, but the fact that it is not for the z80 makes it of little use...
From
Max Kuleshov
→
To
All
16 November 2006
Hello, boo_boo
IMHO, of the open projects z88dk in terms of code quality/feature frequency rules
at the moment, but everyone understands, especially looking back at hitech, that this is not
ideal :)
From
Alexey Goncharov
→
To
All
16 November 2006
Hello andrews
AnyC is probably dead.
But libraries... I think that everyone will have their own, because there is no normal
The OS for which they should be made.
From
Alexey Goncharov
→
To
All
16 November 2006
Hello, captain cobalt
Yes, under CP/M there is, for example, this:
http://www.bdsoft.com/resources/bdsc.html, but the source is on ASMA 8080 =(
Has anyone collected Small C?
++
Yeah! The situation is becoming clearer... Z88DK is a descendant of Small C.
Now I'm looking at AnyC.
We should make the FAQ sticky so as not to be crowded...
From
Alexey Goncharov
→
To
All
16 November 2006
Hello, maximk
Ideal/not ideal... Where are the benchmarks? =) For such testing it would be necessary to do
test package.
From
Andrey Savichev
→
To
All
16 November 2006
Hello NovaStorm
Nov> Has anyone collected Small C?
I collected...this is the simplest thing, but you need good graphics and others
libraries (in particular those working with specific Spectrum hardware)
From
Stanislav Lomakin
→
To
All
16 November 2006
Hello andrews
and> I collected...this is the simplest, but I need good graphics and others
and> libraries (in particular those working with specific hardware
and> Spectrums)
still problems too))
If only there was a normal compiler, it wouldn't be a matter of libraries, I'm ready personally
take part :rolleyes;
This; if we are talking about native C for zx.
and if it’s a cross-compiler, then why is z88dk not satisfied? with splib you can do quite tolerable
write toys (sprites, tiles, interrupts, polling keyboard/joysticks/mouse,
working with memory... phantomas infinity is written on it)... the rest
Screwed on from asm materials in 5 minutes.
and the z88dk, by the way, is made based on small C
From
Max Kuleshov
→
To
All
16 November 2006
Hello NovaStorm
Well, there is Dhrystone, although they also test processors, but we will succeed
Compilers will be tested on the same processor.
From
Max Kuleshov
→
To
All
16 November 2006
Hello caro
car> Easily converted to source with Z80 mnemonics.
car> By the way, I posted it on the forum as part of ZXCPM, having recompiled it
car> to work from address 6100h.
car>
This is all yes, but it continues to generate code for the i8080 and support for features
z80 will not appear :) In addition, it seems that bdsc immediately compiles into binary code, without
assembly text, which is not good.
From
van Yu Shinn
→
To
All
16 November 2006
Hello BlackWolf
Err> 32bit integer
Why else?
How will this work on the z80?
From
Alexey Goncharov
→
To
All
16 November 2006
Hello, maximk
I'm afraid I'm completely out of touch with the realities of spec =) especially from memory.
From
Gavrilov Vitaly
→
To
All
16 November 2006
Hello, captain cobalt
cap> Why is this still necessary?
cap> How will this work on the z80?
For some reason, no questions arose about the need for float, although there were a lot
calculations can be carried out with fixed rather than floating point (which
incomparably faster and easier). It is for these purposes that a 32-bit integer is needed.
Perfectly stored in a couple of registers (as well as float)
From
Kamil Karimov
→
To
All
16 November 2006
Hello NovaStorm
Nov> under CP/M there is, for example, this
Nov> http://www.bdsoft.com/resources/bdsc.html, but the source is on ASMA 8080
Nov> =(
It will be easily converted into a source with Z80 mnemonics.
By the way, I posted it on the forum as part of ZXCPM, recompiling it for work
from address 6100h.
Nov> Has anyone collected Small C?
I assembled it, but it is very bulky and requires at least 50 to work even in CP/M
KB TPA.
From
Sergey Akimov
→
To
All
16 November 2006
Hello, captain cobalt
cap> Quote:
cap> Message from Error404
cap> 32bit integer
cap>
cap> Why is this still necessary?
cap> How will this work on the z80?
It will work fine. And this is necessary so as not to reinvent wheels, but
take ready-made code from any platforms. There are ready-made implementations, for example, TCP/IP
or FAT32 in C, and in a minimalist form (especially for 8-bit). Yes and
in general, I often came across the need for 32 bit int, and shovel and
debugging code because the compiler can't is a bit of an amateur thing to do. From
So far I know of (tried) only 2 CP/M native C compilers
compiler from the whole set, initially (and not through stupid char conversions)
supporting an acceptable set of types - these are
Hitec C and Mix C. But there is a fly in the ointment: both store their libs in unique
formats, whereas it would be more convenient if it were rel/irl.
I also tried Bdsc, SmallC, C80, MsxC but didn’t like them because of their extreme
asceticism of supported types.
From
Max Kuleshov
→
To
All
17 November 2006
Hello, SfS
SfS> So why change this?
As I understand it, no one suggested changing it, the problem is that in some
In C subcompilers, the long int type is missing as a class or is also equal to 2 bytes
:)
I’m generally silent about long long :)
From
SfS
→
To
All
17 November 2006
Hello, Error404
Err> It will work normally. And this is necessary so as not to invent
Err> bicycles, and take ready-made code from any platforms. There are ready ones
Err> implementation, for example, TCP/IP or FAT32 in C, and in a minimalist
Err> form (especially for 8-bits). And in general, I often came across
Err> the need for 32 bit int, and to shovel and debug the code because
Err> what the compiler cannot do is very amateurish.
Actually, int in C for all 8 and 16-bit processors that I know is 16 bits, not 32
(AVR, PIC, I196, etc.). So why change this? Use 32-bit long int
or 64bit long long int. Moreover, only where it is needed. This is more optimal.
From
Pavel Fedin
→
To
All
17 November 2006
Hello Vitamin
Vit> Has anyone found a GCC version for Zetnik? And then I rummaged through a lot
Vit> links - just scraps of information, no sorts or binaries. Otherwise it was b
Vit> it’s a shame to collect his own source code for the spec :) Because writing from scratch is quite
Vit> resource-intensive...
AFAIK you'll never find him. As far as I understand, it does not exist
maybe, at least for the classic z80. Maybe for the eZ80 only... At gcc
also has its limitations - it is focused on 32-bit/64-bit architectures and
Flat memory model. The ZX has neither one nor the other.
There are other open source compilers, including z80-targeted.
Besides, C for ZX would be really interesting if it also worked on
ZX itself (I'm a supporter of native systems). And even if we imagine that gcc
somehow exists on Spec, then Hello world it would compile several
days. gcc is too complex a system using several intermediates
representations.
From
Sergey Akimov
→
To
All
17 November 2006
Hello, SfS
SfS> Actually, int in C for all 8 and 16-bit processors that I know is 16
SfS> bits, not 32 (AVR, PIC, I196, etc.). So why change it?
SfS> Use 32-bit long int or 64-bit long long int. Moreover,
SfS> only where it is needed. This is more optimal.
Are you kidding? :v2_biggr;
Offtopic:; Meets the “new Russian” (HP) and the “old Russian” (SR):
HP: - How are you?
SR: - Well, I haven’t eaten for three days...
HP: Well, bro, you have to force yourself somehow....
:smile;
A; seriously: I would be glad to use it, but I can’t: I don’t know the long type (32bit)
most 8080/Z80 C compilers (at least native ones, not PC ones).
Naturally, I meant long... That is. fundamental opportunity to use
native 32bit integer type.
From
Gavrilov Vitaly
→
To
All
17 November 2006
Hello, Error404
Err> That is. fundamental ability to use native integer
Err> type 32bit.
There is no such native type. and for native types int(16) and char(8) are defined
only operations + and -. Everything else (*/%) is written with pens. Just like everyone else
list of operations for long(32) and float(32). If there is support, there will be type.
From
Sergey Akimov
→
To
All
17 November 2006
Hello Vitamin
Vit> there is no such native type. and for native types int(16) and char(8)
Vit> only + and - operations are defined. Everything else (*/%) is written
Vit> handles. As well as the entire list of operations for long(32) and float(32).
Vit> If there is support, there will be a type.
Anything can be written without being tied to the processor. What does the hardware have to do with it?
support? Any arithmetic is done. Only the kernel should do this
compiler (this is what I meant by the definition of “native types” - with
terminology trouble :smile; ).; In order not to invent additional
libraries pornography of the form:
typedef LONG char*
void plus32(LONG op1, op2, result)
{}
char[4] a,b,c;
plus32(a,b,c); /* c=a+b */
And almost all compilers for the 8080/Z80 do this - they will make 3 types, and
the rest is do-it-yourself. It is clear that with this approach no third parties
you don’t use sources (everywhere it’s customary to write c=a+b , not plus32(a,b,c) ), yes
and such arithmetic “screwed on to the side” slows down terribly.
The authors of Hitec C in the CP/M version of the compiler, for example, had enough resources
implement all the most frequently required types on the same z80. So far it's
the best I've seen from the free version (including the PC version) and, it seems,
the only one more or less usable.
From
Gavrilov Vitaly
→
To
All
18 November 2006
Hello, Error404
Err> And almost all compilers for 8080/Z80 do this - they will do 3
Err> type, and the rest is do-it-yourself.
As much as C++ is a step forward in relation to C (class::operator ...), so
these compilers are a step back from the same C...
Normal compilers have a runtime library where functions like
__inttofloat __add32 etc, and the compiler is busy calling them. Those.
All native (for the language) types are provided, and it doesn’t matter which one
bit capacity of the target machine.
It's sad that they didn't do this...
From
Kirill Frolov
→
To
All
18 November 2006
Hello NovaStorm
Nov> Writing a back-end for EM is almost futile. Maybe it's better to the side
Nov> www.cminusminus.org go there
Nov> at least serious guys are working, of course there will be work there sooner
Nov>
If they are so serious, then why are they inventing bicycles?
are engaged. This bike is called PL/M and has been known for almost 30 years
how. For the Z80, by the way, it should be and should be launched with ease into CP/M. Those.
on Pentagon/Scorpio it is quite possible. And the documentation, everything is there.
From
Kirill Frolov
→
To
All
18 November 2006
Hello Vitamin
Vit> 8051@1MHz quite tolerably executes code compiled from S. And this is S
Vit> taking into account one single 16-bit register.
Yep, DPTR. For the second year now, I’ve been scared to look into listings because of this. Here
I don't even look. In the small model, by the way, it is much more fun.
> Has anyone found a GCC version for ztnik? And then I rummaged through a lot
> links - just scraps of information, no sorts or binaries. And then it was
>
A few years ago I searched on the Internet and I still have a patch for the old GCC
(2.x, like 2.95 approximately) version of GCC. Another thing is that a lot depends on this
from:
1) code-generating backend. And he is clearly bad.
2) coding style. It should be different from the pisish one.
I would say 50% of the compiler's usability is determined by
programmer. And 50% by the compiler. The compiler is - I repeat - hitech. Better
for Z80 (and PIC) no.
> it’s a shame to collect his own source code for the spec :) Because writing from scratch is quite
> resource-intensive...
small C compiler.
From
Kirill Frolov
→
To
All
18 November 2006
Hello Vitamin
Vit> Please tell me how macros can slow down the program?
Vit>
"Comments in the body of a loop slow it down."
Didn't you know? Low.
> I, too, once ran and waved the flag “ASM rules, C is for the lazy.” But
>
In principle, I would wave now. Concepts are often implemented in ASMA
unavailable in subtongues like Pascal. Or C. Although the latter is not all that true
and bad, compared to some... External ones are also screwed on
macroprocessors. Or you can slowly migrate towards the C-two-cross.
> So for industrial programming, nothing is better with C yet
> invented.
>
Java. There are no such scary signs there. And memory allocation
absolutely safe (until the OOM killer shoots).
No, of course this is not the most important thing. The most important thing is that
Even baboons learn Java. That's the whole point.
> PS. Still, the spec lacks C with a decent development environment...
www.htsoft.com? Nobody canceled it. Only Z80 versus modern RISC CPUs,
even the smallest microcontrollers,
loses a lot. In the sense that C is on him with his distribution paradigm
memory sucks.
From
Gavrilov Vitaly
→
To
All
18 November 2006
Hello fk0
fk0> "Comments in the body of the loop slow down its operation."
fk0> Didn't you know? Hizachot.
I sprinkle my head with ashes from the burned sources and go to the monastery. Female :))))
fk0> ASMA often implements concepts that are not available in sublanguages like
fk0> pascal.
I would say this - everything is realized in asma, for it is primordial matter. Another thing is that
along with complete freedom of action, we get half-meter hemorrhoids with
development, refactoring, reverse engineering and debugging...
fk0> Java. There are no such scary signs there. And memory allocation
fk0> absolutely safe (until the OOM killer shoots).
This is if there is a Java compiler (or hardware support)
fk0> www.htsoft.com? Nobody canceled it. Only Z80 versus modern ones
fk0> RISC CPUs, even the smallest microcontrollers
fk0> loses a lot. In the sense that he is C with his paradigm
fk0> memory allocation is terrible.
Well, I compared the zetnik and the arm... To be honest, when writing for a controller
I don’t use memory allocation functions at all, just everything statically. If
I need to take my minimalist memory manager and not suffer.fk0> Yep, DPTR. This is the second year I've been scared about listings because of this
fk0> look. So I don't look. In the small model, by the way,
fk0> is much more fun.
no, the project only applies to huge...
fk0> 2) coding style. It should be different from the pisish one
damn it... I've encountered this more than once:
xdata unsigned char* ext_dev _at_ 0xff00;
much worse than
#define (*(xdata unsigned char*)0xff00) ext_dev
although the logic is the same...
fk0> Compiler - I repeat - hitech. There is no better option for the Z80 (and PIC).
pleasant discovery - it takes 8051 and msp430. we'll have to race against time
there will be...
PS. Is there a free version? Otherwise, on the website they say “only for coupons”...
From
Sergey Akimov
→
To
All
18 November 2006
Hello fk0
fk0> "Comments in the body of the loop slow down its operation."
fk0> Didn't you know? Hizachot.
fk0>
For some reason I always thought that macros and inline procedures work faster than usual
type of subroutines, because they are not subroutines and do not require calling and
accompanying manipulations with the stack.
However, I don’t dare to say so.
fk0> In principle, I would wave now. In ASMA they are often implemented
fk0> concepts not available in sublanguages like Pascal. Or C.
fk0>
Actually, when you need 100% results, the concepts are implemented in the language
block diagrams. And the implementation language in most cases is not of fundamental importance
has - it's just a matter of technology and implementation details. Accordingly, in
properly designed systems do not require special equipment
type ASM (well, except for a few time-critical places or in the case of programming
some very wonderful microcontrollers).
The last messages in this thread talked about C from the point of view
portability of code from platform to platform. From this point of view, usability
AFM tends to zero.
fk0> Java. There are no such scary signs there. And memory allocation
fk0> absolutely safe (until the OOM killer shoots).fk0> No, of course this is not the most important thing. The most important thing is that
fk0> Even baboons learn Java. That's the whole point.
fk0>
Well yes. And ten years ago they said the same about Basic. And even earlier about Fortran. A
in another 20 years they will be talking about something else. By the way, is there
Java machines for Z80? It would be interesting to see...
fk0> Only Z80 versus modern RISC CPUs, even the smallest ones
fk0> small-scale controllers, loses a lot. I mean, C on him with his
fk0> memory allocation paradigm sucks.
What's so special about memory allocation in C?
From
Aprisobal
→
To
All
19 November 2006
Hello, Error404
And the version of the Hi-tech compiler that was posted by [post]53431[/post] is not
suitable?
From
Kirill Frolov
→
To
All
19 November 2006
Hello caro
car> All attempts to download the file from RapidShare were unsuccessful for me personally
car> success :)
Hitech I can give.
From
Kirill Frolov
→
To
All
19 November 2006
Hello jdigreze
jdi> Wah-wah! HI-TECH C Z80/Z180 = $950 - nice price! :)
Which is noticeably cheaper than KEIL. So how can I say...
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
11.Calling a function with arguments. Determining Unreachable Code
┌─- CODE ───
.const_data
?PLC6; .byte; "This line should not be printed",0
.program
;although there are no frills here, the parameters are in registers
ld de,?PLC6
ld hl,1
call_dead_code
└── CODE ───
┌─- CODE ───
_dead_code; .equal; $
;terrible prologue!
push ix
push de
push hl
ld ix,-?TSC1
add ix,sp
push af
ld l,(ix+0+?TSC1)
ld h,(ix+0+?TSC1+1)
ld(ix-2),l
ld(ix-2+1),h
;fear and horror!
ld a,0
cp a,0
jp z,?BOL8
?PLC7; .equal; $
.const_data
?PLC8; .byte; "%s",0ah,0
.program
ld e,(ix+2+?TSC1)
ld d,(ix+2+?TSC1+1)
ld hl,?PLC8
call_printf
?BOL8; .equal; $
?BOF1; .equal; $
;and no less terrible epilogue
pop bc
pop bc
pop bc
pop ix
ret
└── CODE ───
12.Calling a function without arguments. Eliminating loops
┌─- CODE ───
;as usual, we don’t transmit anything anywhere
call_unnecessary_loop
└── CODE ───
┌─- CODE ───
_unnecessary_loop; .equal; $
push ix
ld ix,-?TSC2
add ix,sp
push af
;same nightmarish prologue...
ld hl,0
ld(ix-2),l
ld(ix-2+1),h
ld hl,0ld (_i),hl
?FLC9; .equal; $
ld the,5
ld hl,(_i)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL9
jr +3
jp po,?BOL9
jp ?FLB9
?FLA9; .equal; $
ld hl,(_i)
inc hl
ld (_i),hl
jp ?FLC9
?FLB9; .equal; $
;constant computations, here even the notorious
;note hands down :)
ld then,(_j5)
ld l,(ix-2)
ld h,(ix-2+1)
add hl,de
ld (_k5),hl
jp ?FLA9
?BOL9; .equal; $
?BOF2; .equal; $
pop bc
pop ix
ret
└── CODE ───
13. Merge Loop Headers
┌─- CODE ───
_loop_jamming; .equal; $
push ix
push hl
ld ix,-?TSC3
add ix,sp
ld hl,0
ld (_i),hl
?FLC10; .equal; $
ld the,5
ld hl,(_i)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL10
jr +3
jp po,?BOL10
jp ?FLB10
?FLA10; .equal; $
ld hl,(_i)
inc hl
ld (_i),hl
jp ?FLC10
?FLB10; .equal; $
ld then,(_i)
ld hl,(_j5)
call __mult_int
ld e,l
ld d,h
ld l,(ix+0+?TSC3)
ld h,(ix+0+?TSC3+1)
add hl,de
ld (_k5),hl
jp ?FLA10
?BOL10; .equal; $
;no fusion plus scary computationsld hl,0
ld (_i),hl
?FLC11; .equal; $
ld de,5
ld hl,(_i)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL11
jr +3
jp po,?BOL11
jp ?FLB11
?FLA11; .equal; $
ld hl,(_i)
inc hl
ld (_i),hl
jp ?FLC11
?FLB11; .equal; $
ld de,(_k5)
ld l,(ix+0+?TSC3)
ld h,(ix+0+?TSC3+1)
call __mult_int
ld e,l
ld d,h
ld hl,(_i)
call __mult_int
ld (_i5),hl
jp ?FLA11
?BOL11; .equal; $
?BOF3; .equal; $
pop bc
pop ix
ret
└── CODE ───
14.Разворачивание циклов
┌─- CODE ───
_loop_unrolling; .equal; $
push ix
push hl
ld ix,-?TSC4
add ix,sp
ld hl,0
ld (_i),hl
?FLC12; .equal; $
;разворота нет
ld de,6
ld hl,(_i)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL12
jr +3
jp po,?BOL12
jp ?FLB12
?FLA12; .equal; $
ld hl,(_i)
inc hl
ld (_i),hl
jp ?FLC12
?FLB12; .equal; $
;да еще и вычисления страшные
ld hl,(_i)
;хоть не догадался умножать на 2 процедурой...
add hl,hl
ld bc,_ivector4
add hl,bc
ld e,l
ld d,h
ld hl,0
push depop iy
ld (iy+0),l
ld (iy+1),h
jp ?FLA12
?BOL12; .equal; $
?BOF4; .equal; $
pop bc
pop ix
ret
└── CODE ───
15.Сжатие цепочки переходов
┌─- CODE ───
_jump_compression; .equal; $
push ix
push de
push hl
ld ix,-?TSC5
add ix,sp
.c_start 0ba1h,260
?beg_1; .equal; $
ld e,(ix+2+?TSC5)
ld d,(ix+2+?TSC5+1)
ld l,(ix+0+?TSC5)
ld h,(ix+0+?TSC5+1)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL13
jr +3
jp po,?BOL13
?PLC9; .equal; $
ld e,(ix+8+?TSC5)
ld d,(ix+8+?TSC5+1)
ld l,(ix+2+?TSC5)
ld h,(ix+2+?TSC5+1)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL14
jr +3
jp po,?BOL14
?PLC10; .equal; $
ld e,(ix+10+?TSC5)
ld d,(ix+10+?TSC5+1)
ld l,(ix+8+?TSC5)
ld h,(ix+8+?TSC5+1)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL15
jr +3
jp po,?BOL15
?PLC11; .equal; $
ld e,(ix+12+?TSC5)
ld d,(ix+12+?TSC5+1)
ld l,(ix+10+?TSC5)
ld h,(ix+10+?TSC5+1)
and a
sbc hl,de
jp p,$+8
jp pe,?BOL16
jr +3
jp po,?BOL16
?PLC12; .equal; $ld e,(ix+12+?TSC5)
ld d,(ix+12+?TSC5+1)
ld l,(ix+10+?TSC5)
ld h,(ix+10+?TSC5+1)
add hl,de
ld (ix+10+?TSC5),l
ld (ix+10+?TSC5+1),h
jp ?EOI16
?BOL16; .equal; $
;no optimization
jp ?end_1
?EOI16; .equal; $
jp ?EOI15
?BOLL15; .equal; $
ld e,(ix+10+?TSC5)
ld d,(ix+10+?TSC5+1)
ld l,(ix+8+?TSC5)
ld h,(ix+8+?TSC5+1)
add hl,de
ld (ix+8+?TSC5),l
ld (ix+8+?TSC5+1),h
?EOI15; .equal; $
jp ?EOI14
?BOL14; .equal; $
ld e,(ix+8+?TSC5)
ld d,(ix+8+?TSC5+1)
ld l,(ix+2+?TSC5)
ld h,(ix+2+?TSC5+1)
add hl,de
ld (ix+2+?TSC5),l
ld (ix+2+?TSC5+1),h
?end_1; .equal; $
jp ?small_1
?EOI14; .equal; $
jp ?EOI13
?BOL13; .equal; $
ld e,(ix+2+?T
;And further text why lost.
└── CODE ───
Final score- 4/10. Would put 3/10, yeah liked it pretty easy
loop header.
Plus the given compiler propagates with the development and debug environment under
window. The customization options I didn't find- they were asked in the project settings, but in
helpe I found not all specified options. There was no mention of optimization there
words. After all, it's just a translator with a primitive convolution constant (andonly!). The output assembler file without specifying the lines of the source file is quite
It’s uncomfortable to climb on it.
In short, it is not recommended to use :)
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
11.Calling a function with arguments. Determining Unreachable Code
┌─- CODE ───
;TEST.C; 175:; dead_code( 1, "This line should not be printed" );
;call type fastcall - all that is possible through registers
ld bc,u39
ld de,01h
call_dead_code
└── CODE ───
┌─- CODE ───
;TEST.C; 192:; void dead_code( a, b )
;TEST.C; 193:; int a;
;TEST.C; 194:; char *b;
;TEST.C; 195:; {
_dead_code;
;TEST.C:; 196; int; idea_store;
;TEST.C; 198:; idea_store = a;
;O! first use of registers
;variables
; _idead_store allocated to hl
ld l,e
ld h,d
;TEST.C; 199:; if( 0 )
;the pacifier is safely folded. honor and praise!
ret
;TEST.C; 201:; }
└── CODE ───
12.Calling a function without arguments. Eliminating loops
┌─- CODE ───
;TEST.C; 181:; unnecessary_loop();
;simple and tasteful :)
call_unnecessary_loop
└── CODE ───
┌─- CODE ───
;TEST.C; 211:; void unnecessary_loop()
;TEST.C; 212:; {
_unnecessary_loop;
;TEST.C:; 213; int; x;
;TEST.C; 215:; x = 0;
;another register variable
; _x allocated to bc
ld bc,0
;TEST.C; 216:; for( i = 0; i < 5; i++ )
;a deeper analysis would have eliminated this cycle...
;but see note about re-uploading
ld l,c
ld h,b
ld(_i),hl
ld de,05h
call wrelop
ret p
l25;
;TEST.C:; 218; k5; = x + j5;
;did not fold x=0... addition that no one needs
ld hl,(_j5)
add hl,bcld (_k5),hl
ld hl,(_i)
inc hl
ld (_i),hl
ld de,05h
call wrelop
jp m,l25
;TEST.C; 219:; }
ret
└── CODE ───
13. Слияние заголовков циклов
┌─- CODE ───
;TEST.C; 228:; void loop_jamming( x )
;TEST.C; 229:; int x;
;TEST.C; 230:; {
_loop_jamming;
;пролог; функции- выделение стека под локальные
;переменные и параметр
push ix
ld ix,0
add ix,sp
push bc
;_x stored from de
ld (ix+-2),e
ld (ix+-1),d
;TEST.C; 231:; for( i = 0; i < 5; i++ )
ld hl,0
ld (_i),hl
ld de,05h
ld hl,(_i)
call wrelop
jp p,l30
l29;
;TEST.C:; 232; k5; = x + j5 * i;
ld de,(_i)
ld hl,(_j5)
call amul
ld e,(ix+-2)
ld d,(ix+-1)
add hl,de
ld (_k5),hl
ld hl,(_i)
inc hl
ld (_i),hl
ld de,05h
call wrelop
jp m,l29
l30;
;TEST.C:; 233; for(; i = 0; i < 5; i++ )
;чуда нет- слияния заголовков циклов тоже
ld hl,0
ld (_i),hl
ld de,05h
ld hl,(_i)
call wrelop
jp p,l28
l32;
;TEST.C:; 234; i5; = x * k5 * i;
ld de,(_k5)
ld l,(ix+-2)
ld h,(ix+-1)
call amul
ld de,(_i)
call amul
ld (_i5),hl
ld hl,(_i)
inc hl
ld (_i),hl
ld de,05h
call wrelop
jp m,l32
;TEST.C; 235:; }
l28;
└──; CODE ───
14.Разворачивание циклов
┌─- CODE ───
;TEST.C; 246:; void loop_unrolling( x );TEST.C; 247:; int x;
;TEST.C; 248:; {
_loop_unrolling;
;TEST.C:; 249; for(; i = 0; i < 6; i++ )
;also without a miracle - perhaps the number of loop iterations
;too big for reversal, but didn't find any options
ld hl,0
ld(_i),hl
ld de,06h
ld hl,(_i)
call wrelop
ret p
l36;
;TEST.C:; 250; ivector4[; i ] = 0;
ld hl,(_i)
add hl,hl
ld de,_ivector4
add hl,de
ld(hl),0
inc hl
ld(hl),0
ld hl,(_i)
inc hl
ld(_i),hl
ld de,06h
call wrelop
jp m,l36
;TEST.C; 251:; }
ret
└── CODE ───
15.Compression of the transition chain
┌─- CODE ───
;TEST.C; 260:; int jump_compression( i, j, k, l, m )
;TEST.C; 261:; int i, j, k, l, m;
;TEST.C; 262:; {
_jump_compression;
;monstrous; prolog - many input variables
;still not optimal...
push ix
ld ix,0
add ix,sp
push bc
push bc
;_j stored from bc
ld (ix+-4),c
ld (ix+-3),b
;_i stored from de
ld(ix+-2),e
ld(ix+-1),d
l40;
;; _l loaded to bc
ld c,(ix+6)
ld b,(ix+7)
;TEST.C; 263:; beg_1;
;TEST.C:; 264; if(; i < j )
ld e,(ix+-4)
ld d,(ix+-3)
ld l,(ix+-2)
ld h,(ix+-1)
call wrelop
jp p,l41
;TEST.C; 265:; if( j < k )
ld e,(ix+4)
ld d,(ix+5)
ld l,(ix+-4)
ld h,(ix+-3)
call wrelop
jp p,l42
;TEST.C; 266:; if( k < l )
ld e,c
ldd,b
ld l,(ix+4)ld h,(ix+5)
call wrelop
jp p,l43
;TEST.C; 267:; if( l < m )
ld e,(ix+8)
ld d,(ix+9)
ld l,c
ld h,b
call wrelop
;сжатия нет- помешало невесть откуда взявшееся
;сохранение l (bc), хотя к данному моменту оно не менялось
jp p,l46
;TEST.C; 268:; l += m;
ld l,(ix+8)
ld h,(ix+9)
add hl,bc
push hl
pop bc
;TEST.C; 269:; else
jp l49
;TEST.C; 271:; else
l43;
;TEST.C:; 272; k; += l;
ld l,(ix+4)
ld h,(ix+5)
add hl,bc
ld (ix+4),l
ld (ix+5),h
;TEST.C; 273:; else {
jp l49
l42;
;TEST.C:; 274; j; += k;
ld e,(ix+4)
ld d,(ix+5)
ld l,(ix+-4)
ld h,(ix+-3)
add hl,de
ld (ix+-4),l
ld (ix+-3),h
l46;
;TEST.C:; 275; end_1:;
;_l stored from bc
ld (ix+6),c
ld (ix+7),b
;TEST.C; 276:; goto beg_1;
jp l40
;TEST.C; 277:; }
;TEST.C; 278:; else
l41;
;TEST.C:; 279; i; += j;
ld e,(ix+-4)
ld d,(ix+-3)
ld l,(ix+-2)
ld h,(ix+-1)
add hl,de
ld (ix+-2),l
ld (ix+-1),h
l49;
;TEST.C:; 280; return(; i + j + k + l + m );
ld e,(ix+8)
ld d,(ix+9)
ld l,(ix+-4)
ld h,(ix+-3)
add hl,de
ld e,(ix+4)
ld d,(ix+5)
add hl,de
ld e,c
ld d,b
add hl,de
ld e,(ix+-2)
ld d,(ix+-1)
add hl,de
;TEST.C; 281:; }
;эпилог- очистка стека, не рационально...
ld sp,ix
pop ix
pop bcpop af
pop af
pop af
push bc
ret
└── CODE ───
Phew! Looks like I've done everything.
Final rating (subjective) - 8/10. Suitable for quickly testing ideas, for
Creating off-the-shelf programs should be approached with caution.
Comrades, please test other compilers and comment on them in the same way
code :)
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
11.Calling a function with arguments. Determining Unreachable Code
┌─- CODE ───
;dead_code( 1, "This line should not be printed" );
;parameters through the stack, from left to right (although it should be the other way around...)
ld hl,1 ;const
push hl
ld hl,i_1+97
push hl
call_dead_code
pop bc
pop bc
└── CODE ───
┌─- CODE ───
;void dead_code( a, b )
;int a;
;char *b;
._dead_code
;{
;int idead_store;
;idead_store = a;
ld hl,6-2 ;const
add hl,sp
call l_gint ;
push hl
;if( 0 )
;transition executes
jp i_27
;printf( "%s
", b);
;but it generates code for a dummy!
ld hl,i_1+129
push hl
ld hl,6 ;const
add hl,sp
call l_gint ;
push hl
call_printf
pop bc
pop bc
;}
.i_27
pop bc
ret
└── CODE ───
12.Calling a function without arguments. Eliminating loops
┌─- CODE ───
call_unnecessary_loop
└── CODE ───
┌─- CODE ───
;void unnecessary_loop()
;{
._unnecessary_loop
;int x;
;x = 0;
;register variable - good
ld hl,0 ;const
;but on the stack - bad
push hl
;for( i = 0; i < 5; i++ )
ld hl,0 ;const
ld(_i),hl
jp i_30
.i_28
;k5 = x + j5;
;cool :)
pop de
push de
ld hl,(_j5)
add hl,de
ld(_k5),hl
ld hl,(_i)
inc hl
ld(_i),hl
dec hl
.i_30
ld hl,(_i)
ld de,5 ;const
ex de,hlcall l_lt
jp c,i_28
.i_29
;}
pop bc
ret
└── CODE ───
13. Слияние заголовков циклов
┌─- CODE ───
;void loop_jamming( x )
;int x;
._loop_jamming
;{
;for( i = 0; i < 5; i++ )
ld hl,0 ;const
ld (_i),hl
jp i_33
.i_31
;k5 = x + j5 * i;
;наверное ошибка- на стеке на один параметр меньше
pop bc
pop hl
push hl
push bc
push hl
ld de,(_j5)
ld hl,(_i)
call l_mult
pop de
add hl,de
ld (_k5),hl
ld hl,(_i)
inc hl
ld (_i),hl
dec hl
.i_33
ld hl,(_i)
ld de,5 ;const
ex de,hl
call l_lt
jp c,i_31
.i_32
;for( i = 0; i < 5; i++ )
;второй цикл точная копия первого
ld hl,0 ;const
ld (_i),hl
jp i_36
.i_34
;i5 = x * k5 * i;
pop bc
pop hl
push hl
push bc
ex de,hl
ld hl,(_k5)
call l_mult
ex de,hl
ld hl,(_i)
call l_mult
ld (_i5),hl
ld hl,(_i)
inc hl
ld (_i),hl
dec hl
.i_36
ld hl,(_i)
ld de,5 ;const
ex de,hl
call l_lt
jp c,i_34
.i_35
;}
ret
└── CODE ───
14.Разворачивание циклов
┌─- CODE ───
;void loop_unrolling( x )
;int x;
._loop_unrolling
;{
;for( i = 0; i < 6; i++ )
ld hl,0 ;const
ld (_i),hl
jp i_39
.i_37
;ivector4[ i ] = 0;
;нет разворота, да и загрузка достаточно тяжела
ld hl,_ivector4
push hlld hl,(_i)
add hl,hl
pop de
add hl,de
ld (hl),#(0 % 256)
inc hl
ld (hl),#(0 / 256)
ld hl,(_i)
inc hl
ld (_i),hl
dec hl
.i_39
ld hl,(_i)
ld de,6 ;const
ex de,hl
call l_lt
jp c,i_37
.i_38
;}
ret
└── CODE ───
15.Сжатие цепочки переходов
┌─- CODE ───
;int jump_compression( i, j, k, l, m )
;int i, j, k, l, m;
._jump_compression
;{
;beg_1;
.i_40;
;if( i < j )
;вот тут бы не помешали индексные регистры, да не
;используются совсем...
ld hl,10 ;const
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,10 ;const
add hl,sp
call l_gint ;
pop de
call l_lt
jp nc,i_41
;{
;if( j < k )
ld hl,8 ;const
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,8 ;const
add hl,sp
call l_gint ;
pop de
call l_lt
jp nc,i_42
;{
;if( k < l )
ld hl,6 ;const
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,6 ;const
add hl,sp
call l_gint ;
pop de
call l_lt
jp nc,i_43
;{
;if( l < m )
ld hl,4 ;const
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,4 ;const
add hl,sp
call l_gint ;
pop de
call l_lt
jp nc,i_44
;l += m;
ld hl,4 ;const
add hl,sppush hl
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,6 ;const
add hl,sp
call l_gint ;
pop de
add hl,de
pop de
call l_pint
;else
jp i_45
.i_44
;goto end_1;
;нет оптимизации переходов
jp i_46
.i_45
;}
;else
jp i_47
.i_43
;k += l;
ld hl,6 ;const
add hl,sp
push hl
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,8 ;const
add hl,sp
call l_gint ;
pop de
add hl,de
pop de
call l_pint
.i_47
;}
;else
jp i_48
.i_42
;{
;j += k;
ld hl,8 ;const
add hl,sp
push hl
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,10 ;const
add hl,sp
call l_gint ;
pop de
add hl,de
pop de
call l_pint
;end_1;
.i_46;
.i_49
;goto beg_1;
jp i_40
;}
.i_48
;}
;else
jp i_50
.i_41
;i += j;
ld hl,10 ;const
add hl,sp
push hl
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,12 ;const
add hl,sp
call l_gint ;
pop de
add hl,de
pop de
call l_pint
.i_50
;return( i + j + k + l + m );
ld hl,10 ;const
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
push de
ld hl,10 ;const
add hl,sp
call l_gint ;
pop de
add hl,de
ex de,hl
ld hl,8-2 ;const
add hl,sp
call l_gint ;add hl,de
ex de,hl
ld hl,6-2 ;const
add hl,sp
call l_gint ;
add hl,de
ex de,hl
ld hl,4-2 ;const
add hl,sp
call l_gint ;
add hl,de
ret
;}
└── CODE ───
Final rating: 5/10. A dull compiler that occasionally finds
insight and it generates good code. Not recommended for use...
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
11.Calling a function with arguments. Determining Unreachable Code
┌─- CODE ───
;test.c:173; dead_code(; 1, "This line should not be printed" );
;normal parameter passing via stack and clearing
ld hl,#__str_2
push hl
ldhl,#0x0001
push hl
call_dead_code
pop af
pop af
└── CODE ───
┌─- CODE ───
_dead_code;
;extra; stack space allocation, but full optimization
;function internals
push ix
ld ix,#0
add ix,sp
;test.c:196; printf(; "%s
", b);
00103$:
pop ix
ret
└── CODE ───
12.Calling a function without arguments. Eliminating loops
┌─- CODE ───
;test.c:179; unnecessary_loop();;
call_unnecessary_loop
00129$:
└── CODE ───
┌─- CODE ───
_unnecessary_loop;
;test.c:212:; for( i = 0; i < 5; i++ )
ld iy,#_i
;note - the compiler reversed the loop!
ld 0(iy),#0x05
ld 1(iy),#0x00
00103$:
;test.c:214; k5; = x + j5;
;multiplying the constant x = 0
;but there is a re-download, forgivable
ld hl,(_j5)
ld iy,#_k5
ld 0(iy),l
ld 1(iy),h
ld hl,(_i)
dec hl
ld(_i),hl
;test.c:212; for(; i = 0; i < 5; i++ )
;original ending!
ld iy,#_i
ld a,0(iy)
or a,1(iy)
jp nz,00103$
;and this code because i is a globally variable
ld 0(iy),#0x05
ld 1(iy),#0x00
00104$:
ret
└── CODE ───
13. Merging Loop Headers┌─- CODE ───
_loop_jamming;
push; ix
ld ix,#0
add ix,sp
;test.c:226; for(; i = 0; i < 5; i++ )
ld iy,#_i
ld 0(iy),#0x00
ld 1(iy),#0x00
00101$:
ld iy,#_i
ld a,0(iy)
sub a,#0x05
ld a,1(iy)
sbc a,#0x00
jp p,00104$
;test.c:227; k5; = x + j5 * i;
ld hl,(_i)
push hl
ld hl,(_j5)
push hl
call __mulint_rrx_s
ld b,h
ld c,l
pop af
pop af
;переменная x хранится в стеке
ld hl,#_k5
ld a,4(ix)
add a,c
ld (hl),a
ld a,5(ix)
adc a,b
inc hl
ld (hl),a
;test.c:226; for(; i = 0; i < 5; i++ )
ld iy,#_i
inc 0(iy)
jp nz,00115$
inc 1(iy)
00115$:
jp 00101$
00104$:
;test.c:228; for(; i = 0; i < 5; i++ )
;слияния заголовков нет
ld iy,#_i
ld 0(iy),#0x00
ld 1(iy),#0x00
00105$:
ld iy,#_i
ld a,0(iy)
sub a,#0x05
ld a,1(iy)
sbc a,#0x00
jp p,00109$
;test.c:229; i5; = x * k5 * i;
ld hl,(_k5)
push hl
ld l,4(ix)
ld h,5(ix)
push hl
call __mulint_rrx_s
ld b,h
ld c,l
pop af
pop af
ld hl,(_i)
push hl
push bc
call __mulint_rrx_s
ld b,h
ld c,l
pop af
pop af
ld iy,#_i5
ld 0(iy),c
ld 1(iy),b
;test.c:228; for(; i = 0; i < 5; i++ )
ld iy,#_i
inc 0(iy)
jp nz,00116$
inc 1(iy)
00116$:jp 00105$
00109$:
pop ix
ret
└── CODE ───
14.Preparation of snowflakes
┌─- CODE ───
_loop_unrolling;
push; ix
ld ix,#0
add ix,sp
; test . c : 243 ; for ( ; i = 0 ; i < 6 ; i ++ ) ;
;small scale нет
ld iy,#_i
ld 0 ( i ), # 0x00
ld 1 ( i ), # 0x00
00101$:
ld iy,#_i
ld a,0(iy)
sub a, #0x0
ld a,1(iy)
sbc a , # 0x00
jp p.00105$
; test . c : 244 ; vector4[; i ] = 0 ;
;this is the first time :)
ld c,0(iy)
ld b,1(iy)
sla c
rl b
ld hl,#_vector4
add hl,bc
ld c,l
ld b,h
ld ( hl ) , # 0x00
inc hl
ld ( hl ) , # 0x00
; test . c : 243 ; for ( ; i = 0 ; i < 6 ; i ++ ) ;
ld iy,#_i
inc 0(iy)
jp nz,00111$
inc 1(iy)
00111$:
jp 00101$
00105$:
pop ix
ret
└── CODE ───
15.Preparation of snowflakes
┌─- CODE ───
_jump_compression;
push; ix
ld ix,#0
add ix,sp
; test . c : 256 ; beg_1:;
ld a,8(ix)
sub a,10(ix)
ld a,9(ix)
sbc a,11(ix)
;интересный в С С вуультас k и l
rlca
and a, #0x0
ld c,a
ld a,10(ix)
sub a,12(ix)
ld a,11(ix)
sbc a,13(ix)
;а в А cosmetics l и m
rlca
and a, #0x0
;только он почеу-то не испольуется, а теряется.
00101$:
; test . c : 257 ; if ( ; i < j )
ld a,4(ix)
sub a,6(ix)
ld a,5(ix)
sbc a,7(ix)
jp p.00113$
; test . c : 259 ; if ( ; j < k )
ld a,6(ix)
sub a,8(ix)
ld a,7(ix)sbc a,9(ix)
jp p.00110$
; test . c : 261 ; if (; k < l )
;It's not the same as this
xor a,a
or a,c
jp z.00106$
; test . c : 263 ; if ( ; l < m )
;watch this page... не понимкак работает.
or a,a
;Eсть свертка перехода!
jp z.00101$
; test . c : 264 ; l; += m;
ld a,10(ix)
add a,12(ix)
ld 10(ix),a
ld a,11(ix)
adc a,13(ix)
ld 11(ix),a
jp 00114$
; test . c : 266 ; goto; end_1;
; genLabel
00106$:
; test . c : 269 ; k; += l;
ld a,8(ix)
add a,10(ix)
ld 8(ix),a
ld a,9(ix)
adc a,11(ix)
Ld 9(ix),a
jp 00114$
00110$:
; test . c : 273 ; j; += k;
ld a,6(ix)
add a,8(ix)
Ld 6(ix),a
ld a,7(ix)
adc a,9(ix)
Ld 7(ix),a
; test . c : 275 ; goto; beg_1;
jp 00101$
00113$:
; test . c : 279 ; i; += j;
ld a,4(ix)
add a,6(ix)
ld 4(ix),a
ld a,5(ix)
adc a,7(ix)
ld 5(ix),a
00114$:
; test . c : 280 ; return (; i + j + k + l + m );
ld a,4(ix)
add a,6(ix)
ld c,a
ld a,5(ix)
adc a,7(ix)
ld b,a
ld a,c
add a,8(ix)
ld c,a
ld a,b
adc a,9(ix)
ld b,a
ld a,c
add a,10(ix)
ld c,a
ld a,b
adc a,11(ix)
ld b,a
ld l,12(ix)
ld h,13(ix)
add hl,bc
00115$:
pop ix
ret
└── CODE ───
Price review- 7/1 Умное распространение констант, вжжатие переходов,acceptable loop header, various optimizations, but ubiquitous
using index register to store global variables all
spoils. It will be necessary to check how it behaves on static variables and
Is it possible to remove work with index registers? If it works, then this
The compiler can be recommended for use! :)
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
Well, I ran HitechC through the test and was left with a very pleasant impression.
Of course, I would like to improve some things, but still.
So, what did he actually screw up? Tests were carried out taking into account the maximum
optimization level
0. Prologue. Very short:
┌─- CODE ───
_main;
push; ix
ld ix,0
add ix,sp
└── CODE ───
Next comes the code itself
1. Test for reproduction of constants and copies.
┌─- CODE ───
;TEST.C; 62:; j4 = 2;
ld hl,02h
ld(_j4),hl
;TEST.C; 63:; if( i2 < j4 && i4 < j4 )
;extra loading from j4 is a consequence of the fact that for
;comparison function is used with fixed
;positions for the parameter, but still, I could
;use de to initialize or do
;ld d,h:ld e,l
ld de,(_j4)
ld hl,(_i2)
call wrelop
;also using jp is not good. abbreviated
;calculations are used in accordance with the standard
jp p,l4
ld de,(_j4)
ld hl,(_i4)
call wrelop
jp p,l4
;TEST.C; 64:; i2 = 2;
ld hl,02h
ld(_i2),hl
l4;
;TEST.C:; 66; j4; = k5;
ld hl,(_k5)
ld(_j4),hl
;TEST.C; 67:; if( i2 < j4 && i4 < j4 )
;the picture is completely similar
ld de,(_j4)
ld hl,(_i2)
call wrelop
jp p,l5
ld de,(_j4)
ld hl,(_i4)
call wrelop
;TEST.C; 68:; i5 = 3;
ld hl,03h
jp p,L2
ld(_i5),hl
l5;
└──; CODE ───
2.Convolution of constants┌─- CODE ───
;TEST.C; 75:; i3 = 1 + 2;
;successfully
ld hl,03h
L2;
ld; (_i3),hl
;TEST.C; 76:; flt_1 = 2.4 + 6.3;
;similar
ld de,(e1)
ld hl,(e1+02h)
ld(_flt_1),de
ld (_flt_1+02h),hl
;TEST.C; 77:; i2 = 5;
ld hl,05h
ld(_i2),hl
;TEST.C; 78:; j2 = i + 0;
;I didn’t add anything, well done :)
ld hl,(_i)
ld(_j2),hl
;TEST.C; 79:; k2 = i / 1;
; just as he didn’t divide, plus he didn’t do it again
;do loading!
ld(_k2),hl
;TEST.C; 80:; i4 = i * 1;
;similar
ld(_i4),hl
;TEST.C; 81:; i5 = i * 0;
;well, I also recognized multiplication by zero
ld hl,0
ld(_i5),hl
└── CODE ───
┌─- CODE ───
;TEST.C; 94:; flt_3 = 2.4 / 1.0;
;collapsed division
ld de,(e2)
ld hl,(e2+02h)
ld(_flt_3),de
ld (_flt_3+02h),hl
;TEST.C; 95:; flt_4 = 1.0 + 0.0000001;
;collapsed addition
ld de,(e3)
ld hl,(e3+02h)
ld(_flt_4),de
ld (_flt_4+02h),hl
;TEST.C; 96:; flt_5 = flt_6 * 0.0;
;but here I messed up - probably there is no check for 0
;for floating point constants
ld hl,(e4+02h)
push hl
ld hl,(e4)
push hl
ld de,(_flt_6)
ld hl,(_flt_6+02h)
call flmul
ld(_flt_5),de
ld (_flt_5+02h),hl
;TEST.C; 97:; flt_6 = flt_2 * flt_3;
;nothing interesting
ld hl,(_flt_3+02h)
push hl
ld hl,(_flt_3)
push hl
ld de,(_flt_2)
ld hl,(_flt_2+02h)call flmul
ld(_flt_6),de
ld (_flt_6+02h),hl
└── CODE ───
2.1.The division by zero error was successfully recognized and the compiler did nothing
collected until I determined NO_ZERO_DIVIDE
3. Extra assignment
┌─- CODE ───
;TEST.C; 103:; k3 = 1;
ld hl,01h
ld(_k3),hl
;TEST.C; 104:; k3 = 1;
;saved load, but performed unnecessary assignment
;due to the fact that the compiler for embedded systems is based on
;microcontroller base, reassignment (and
;also reading) have their own meaning. So it's not a mistake
ld(_k3),hl
└── CODE ───
4.Power reduction
┌─- CODE ───
;TEST.C; 110:; k2 = 4 * j5;
;quite logically collapsed multiplication by 4
ld hl,(_j5)
add hl,hl
add hl,hl
ld(_k2),hl
;TEST.C; 111:; for( i = 0; i <= 5; i++ )
;but I just made a disgusting loop from the beginning
;known conditions - according to a template
ld hl,0
ld(_i),hl
ld de,06h
ld hl,(_i)
call wrelop
jp p,l7
l6;
;TEST.C:; 112; ivector4[; i ] = i * 2;
;no miracle happened - no reduction in power
;in principle, for such a template without register
;variables, this is logical...
ld de,_ivector4
ld hl,(_i)
add hl,hl
add hl,de
ex de,hl
ld hl,(_i)
add hl,hl
ld a,l
ld(de),a
inc de
ld a,h
ld(de),a
ld hl,(_i)
inc hl
ld(_i),hl
ld de,06h
call wrelop
jp m,l6
l7;
└──; CODE ───5.Simple loop
┌─- CODE ───
;TEST.C; 118:; j5 = 0;
ld hl,0
ld(_j5),hl
;TEST.C; 119:; k5 = 10000;
ld hl,02710h
ld(_k5),hl
l11;
;TEST.C:; 120; do; {
;TEST.C; 121:; k5 = k5 - 1;
;disadvantages of not having register variables in
;all its beauty...
ld hl,(_k5)
dec hl
ld(_k5),hl
;TEST.C; 122:; j5 = j5 + 1;
ld hl,(_j5)
inc hl
ld(_j5),hl
;TEST.C; 123:; i5 = (k5 * 3) / (j5 * 5);
;although here their absence is quite natural, otherwise
;would have to struggle with the stack
;decent convolution of multiplication constants
ld b,h
ld c,l
add hl,hl
add hl,hl
add hl,bc
ex de,hl
ld hl,(_k5)
ld b,h
ld c,l
add hl,hl
add hl,bc
call adiv
ld(_i5),hl
;TEST.C; 124:; } while ( k5 > 0 );
;stupid comparison for >=1...
ld de,01h
ld hl,(_k5)
call wrelop
jp p,l11
└── CODE ───
6.Variable induction cycle control
┌─- CODE ───
;TEST.C; 129:; for( i = 0; i < 100; i++ )
;same mess with the cycle
ld hl,0
ld(_i),hl
ld de,064h
call wrelop
jp p,l13
l12;
;TEST.C:; 130; ivector5[; i * 2 + 3 ] = 5;
;there is no variable induction (not register)
;but the index offset is converted to the base offset
;array
ld hl,(_i)
add hl,hl
add hl,hl
ld de,_ivector5+06h
add hl,de
ld (hl),05h
inc hl
ld(hl),0
ld hl,(_i)
inc hl
ld(_i),hl
ld de,064hcall wrelop
jp m,l12
l13;
└──; CODE ───
7.Deep subexpressions
┌─- CODE ───
;TEST.C; 136:; if( i < 10 )
ld de,0Ah
ld hl,(_i)
call wrelop
;TEST.C; 137:; j5 = i5 + i2;
;very clever - loading of parameters was carried out before
;transition, and addition after, so as not to spoil the flag
ld hl,(_i5)
ld de,(_i2)
jp p,L1
add hl,de
ld(_j5),hl
;TEST.C; 138:; else
jp l16
;TEST.C; 139:; k5 = i5 + i2;
L1;
add; hl,de
ld(_k5),hl
l16;
└──; CODE ───
8.Generating the address of a variable with a constant index, reproducing copies and
registers
┌─- CODE ───
;TEST.C; 147:; ivector[ 0 ] = 1;
;logical
ld hl,01h
ld(_ivector),hl
;TEST.C; 148:; ivector[ i2 ] = 2;
ld hl,(_i2)
add hl,hl
ld de,_ivector
add hl,de
ld (hl),02h
inc hl
ld(hl),0
;TEST.C; 149:; ivector[ i2 ] = 2;
;repeating calculations, but remembering the offset-
;disadvantage of the register distribution model
ld hl,(_i2)
add hl,hl
add hl,de
ld (hl),02h
inc hl
ld(hl),0
;TEST.C; 150:; ivector[ 2 ] = 3;
;also logical :)
ld hl,03h
ld(_ivector+04h),hl
└── CODE ───
9. Removing common subexpressions
┌─- CODE ───
;TEST.C; 157:; if(( h3 + k3 ) < 0 || ( h3 + k3 ) > 5 )
ld hl,(_h3)
ld de,(_k3)
add hl,de
;finally remembered about bit operations...
bit 07h,h
jp nz,u90
;and here’s the problem - why the hell are such calculations?;variables are not volatile...
ld de,06h
ld hl,(_h3)
ld bc,(_k3)
add hl,bc
call wrelop
jp m,u91
u90;
;TEST.C:; 158; printf("Common; subexpression elimination
");
ld hl,u29
push hl
call_printf
pop bc
;TEST.C; 159:; else {
jp l18
u91;
;TEST.C:; 160; m3; = ( h3 + k3 ) / i3;
;calculation again from scratch
ld de,(_i3)
ld hl,(_h3)
ld bc,(_k3)
add hl,bc
call adiv
ld(_m3),hl
;TEST.C; 161:; g3 = i3 + (h3 + k3);
;fiasco! no intermediate saving of results
ld hl,(_i3)
ld de,(_h3)
add hl,de
ld de,(_k3)
add hl,de
ld(_g3),hl
l18;
;TEST.C:; 162; };
└── CODE ───
10. Identification of the invariant code
┌─- CODE ───
;TEST.C; 168:; for( i4 = 0; i4 <= 2; i4++)
;same mad cycle...
ld hl,0
ld(_i4),hl
ld de,03h
ld hl,(_i4)
call wrelop
jp p,l20
l19;
;TEST.C:; 169; ivector2[; i4 ] = j * k;
;full J... calculation of j * k in each iteration of the loop
ld a,(_k)
ld e,a
ld d,0
ld a,(_j)
ld l,a
ld h,d
call lmul
ld a,l
ld hl,(_i4)
ld de,_ivector2
add hl,de
ld(hl),a
ld hl,(_i4)
inc hl
ld(_i4),hl
ld de,03h
call wrelop
jp m,l19
l20;
└──; CODE ───
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
The last available patient is z88dk. I suffered quite a bit until I forced him
generate assembler source code. If asked, inserts lines into the source text
in C, but honestly warns that in this case some optimization will not
it will work out. I will clarify in which places the difference arose.
Optimization level 2 was used
0.Prologue
It simply doesn't exist. The main code goes straight away.
1. Test for reproduction of constants and copies.
┌─- CODE ───
;j4 = 2;
ld hl,2 ;const
ld(_j4),hl
;if( i2 < j4 && i4 < j4 )
;no multiplication of constants plus functions for comparison
ld de,(_i2)
ld hl,(_j4)
call l_lt
jp nc,i_4
ld de,(_i4)
ld hl,(_j4)
call l_lt
;note - use of short commands
;transition
;but at the same time, a transition system can (and should)
;would be optimized
jr c,i_5_i_4
.i_4
jp i_3
.i_5_i_4
;i2 = 2;
ld hl,2 ;const
ld(_i2),hl
;j4 = k5;
.i_3
;same picture
ld hl,(_k5)
ld(_j4),hl
;if( i2 < j4 && i4 < j4 )
ld de,(_i2)
ld hl,(_j4)
call l_lt
jp nc,i_7
ld de,(_i4)
ld hl,(_j4)
call l_lt
jr c,i_8_i_7
.i_7
jp i_6
.i_8_i_7
;i5 = 3;
ld hl,3 ;const
ld(_i5),hl
.i_6
└── CODE ───
2.Convolution of constants
┌─- CODE ───
;i3 = 1 + 2;
;rolled up
ld hl,3 ;const
ld(_i3),hl
;flt_1 = 2.4 + 6.3;
;op-pa! didn't turn!
ld hl,i_2+0call dldpsh
ld hl,i_2+6
call dload
call dad
ld hl,_flt_1
call dstore
;i2 = 5;
;load constant
ld hl,5 ;const
ld(_i2),hl
;j2 = i + 0;
;0 did not add
ld hl,(_i)
ld(_j2),hl
;k2 = i / 1;
;but I didn’t disdain to divide by 1....
ld hl,(_i)
ld de,1 ;const
ex de,hl
call l_div
ld(_k2),hl
;i4 = i * 1;
;and multiply too
ld hl,(_i)
ld de,1
call l_mult
ld(_i4),hl
;i5 = i * 0;
;and to zero too...
ld hl,(_i)
ld de,0
call l_mult
ld(_i5),hl
;printf( "This compiler handles divide-by-zero as an error
");
;yes, he screwed up division by the zero constant
;parameters via stack
ld hl,i_1+0
push hl
call_printf
pop bc
;flt_3 = 2.4 / 1.0;
;darkness... also divides by 1, and in real time...
ld hl,i_2+0
call dldpsh
ld hl,i_2+12
call dload
call ddiv
ld hl,_flt_3
call dstore
;flt_4 = 1.0 + 0.0000001;
;without words...
ld hl,i_2+12
call dldpsh
ld hl,i_2+18
call dload
call dad
ld hl,_flt_4
call dstore
;flt_5 = flt_6 * 0.0;
;...only emotions
ld hl,_flt_6
call dldpsh
ld hl,i_2+24
call dload
call dmul
ld hl,_flt_5
call dstore
;flt_6 = flt_2 * flt_3;
;well, it’s no different here
ld hl,_flt_2call dldpsh
ld hl,_flt_3
call dload
call dmul
ld hl,_flt_6
call dstore
└── CODE ───
3. Extra assignment
┌─- CODE ───
;k3 = 1;
ld hl,1 ;const
ld(_k3),hl
;k3 = 1;
;in the worst traditions...
ld hl,1 ;const
ld(_k3),hl
└── CODE ───
4.Power reduction
┌─- CODE ───
;k2 = 4 * j5;
;didn’t notice the possibility of multiplying with “little blood”
ld hl,(_j5)
ld de,4
call l_mult
ld(_k2),hl
;for( i = 0; i <= 5; i++ )
;implementation of the for loop in the best traditions!
ld hl,0 ;const
ld(_i),hl
jp i_11
.i_9
;ivector4[ i ] = i * 2;
;it’s good that at least I guessed to multiply the shifts by the size
;types, not functions, but unnecessary stack operations
ld hl,_ivector4
push hl
ld hl,(_i)
add hl,hl
pop de
add hl,de
push hl
ld hl,(_i)
add hl,hl
pop de
call l_pint
;classic!
ld hl,(_i)
inc hl
ld(_i),hl
dec hl
.i_11
;darkness...
ld hl,(_i)
ld de,5 ;const
ex de,hl
call l_le
jp c,i_9
.i_10
└── CODE ───
5.Simple loop
┌─- CODE ───
;j5 = 0;
ld hl,0 ;const
ld(_j5),hl
;k5 = 10000;
ld hl,10000 ;const
ld(_k5),hl
;do {
.i_14
;k5 = k5 - 1;
;recognized the subtraction of one!
ld hl,(_k5)
dec hl
ld(_k5),hl
;j5 = j5 + 1;
;and its addition
ld hl,(_j5)
inc hl
ld(_j5),hl;i5 = (k5 * 3) / (j5 * 5);
;Well, you can multiply whenever you want!
ld hl,(_k5)
ld b,h
ld c,l
add hl,bc
add hl,bc
push hl
ld hl,(_j5)
ld b,h
ld c,l
add hl,hl
add hl,hl
add hl,bc
pop de
call l_div
ld(_i5),hl
;} while ( k5 > 0 );
.i_12
;original check at the end of the cycle
ld hl,(_k5)
xor a
or h
jp m,i_13
or l
jp nz,i_14
.i_13
└── CODE ───
6.Variable induction cycle control
┌─- CODE ───
;for( i = 0; i < 100; i++ )
ld hl,0 ;const
ld(_i),hl
jp i_17
.i_15
;ivector5[ i * 2 + 3 ] = 5;
;specific, but generally tolerable
ld hl,_ivector5
push hl
ld hl,(_i)
add hl,hl
inc hl
inc hl
inc hl
add hl,hl
pop de
add hl,de
ld (hl),#(5% 256)
inc hl
ld (hl),#(5 / 256)
ld hl,(_i)
inc hl
ld(_i),hl
;why is this???
dec hl
.i_17
;optimization for for was not completed...
ld hl,(_i)
ld de,100 ;const
ex de,hl
call l_lt
jp c,i_15
.i_16
└── CODE ───
7.Deep subexpressions
┌─- CODE ───
;if( i < 10 )
;sucks comparison!
ld hl,(_i)
ld de,10 ;const
ex de,hl
call l_lt
jp nc,i_18
;j5 = i5 + i2;
;but at least it folds normally
ld de,(_i5)
ld hl,(_i2)
add hl,de
ld(_j5),hl
;else
jp i_19
.i_18
;k5 = i5 + i2;
;no subexpression selectionld de,(_i5)
ld hl,(_i2)
add hl,de
ld(_k5),hl
.i_19
└── CODE ───
8.Generating the address of a variable with a constant index, reproducing copies and
registers
┌─- CODE ───
;ivector[ 0 ] = 1;
;that's right
ld hl,1 ;const
ld(_ivector),hl
;ivector[ i2 ] = 2;
;unnecessary operations with the stack, a simple rearrangement gave
;would be an increase in efficiency
ld hl,_ivector
push hl
ld hl,(_i2)
add hl,hl
pop de
add hl,de
ld de,2 ;const
ex de,hl
;what darkness!
call l_pint
;ivector[ i2 ] = 2;
;did not use the result of the previous operation
ld hl,_ivector
push hl
ld hl,(_i2)
add hl,hl
pop de
add hl,de
ld de,2 ;const
ex de,hl
call l_pint
;ivector[ 2 ] = 3;
;everything is correct here
ld hl,3 ;const
ld(_ivector+4),hl
└── CODE ───
9. Removing common subexpressions
┌─- CODE ───
;if(( h3 + k3 ) < 0 || ( h3 + k3 ) > 5 )
;good start, but not so much further
ld de,(_h3)
ld hl,(_k3)
add hl,de
ld de,0 ;const
ex de,hl
call l_lt
jp c,i_21
;results are not used...
ld de,(_h3)
ld hl,(_k3)
add hl,de
ld de,5 ;const
ex de,hl
call l_gt
jp nc,i_20
.i_21
;printf("Common subexpression elimination
");
;parameters via stack
ld hl,i_1+63
push hl
call_printf
pop bc
;else {
jp i_23
.i_20;m3 = ( h3 + k3 ) / i3;
;not used at all...
ld de,(_h3)
ld hl,(_k3)
add hl,de
ex de,hl
ld hl,(_i3)
call l_div
ld(_m3),hl
;g3 = i3 + (h3 + k3);
ld hl,(_i3)
push hl
ld de,(_h3)
ld hl,(_k3)
add hl,de
pop de
add hl,de
ld(_g3),hl
;}
.i_23
└── CODE ───
10. Identification of the invariant code
┌─- CODE ───
;for( i4 = 0; i4 <= 2; i4++)
ld hl,0 ;const
ld(_i4),hl
jp i_26
.i_24
;ivector2[ i4 ] = j * k;
;regular array index processing
ld de,_ivector2
ld hl,(_i4)
add hl,de
push hl
;but there is no code removal
ld de,(_j)
ld hl,(_k)
call l_mult
pop de
ld a,l
ld(de),a
ld hl,(_i4)
inc hl
ld(_i4),hl
dec hl
.i_26
ld hl,(_i4)
ld de,2 ;const
ex de,hl
call l_le
jp c,i_24
.i_25
└── CODE ───
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
The next candidate is Small Device C Compiler
Tests were carried out with optimization in size and speed - the result
identical.
0. Prologue.
┌─- CODE ───
;classics of the genre for variables on the stack
_main;
push; ix
ld ix,#0
add ix,sp
└── CODE ───
1. Test for reproduction of constants and copies.
┌─- CODE ───
;bold-bold minus-use of heavy
;artillery in the form of index registers
;test.c:59; j4; = 2;
ld iy,#_j4
ld 0(iy),#0x02
ld 1(iy),#0x00
;test.c:60; if(; i2 < j4 && i4 < j4 )
;here it is - propagation of constants in action!!!
ld iy,#_i2
;instead of subtracting j4, subtracting a constant is used
ld a,0(iy)
sub a,#0x02
ld a,1(iy)
sbc a,#0x00
jpp,00102$
;similar to the second half
ld iy,#_i4
ld a,0(iy)
sub a,#0x02
ld a,1(iy)
sbc a,#0x00
jpp,00102$
;test.c:61; i2; = 2;
;again IY...
ld iy,#_i2
ld 0(iy),#0x02
ld 1(iy),#0x00
00102$:
;test.c:63; j4; = k5;
;well, why did the loading work fine, but saving
;so lame?
ld hl,(_k5)
ld iy,#_j4
ld 0(iy),l
ld 1(iy),h
;test.c:64; if(; i2 < j4 && i4 < j4 )
;just a terrible reboot!!! no use
;previous operand in hl!!!
ld iy,#_i2
ld a,0(iy)
ld iy,#_j4
sub a,0(iy)
ld iy,#_i2
ld a,1(iy)
ld iy,#_j4
sbc a,1(iy)
jpp,00105$
;same thing...ld iy,#_i4
ld a,0(iy)
ld iy,#_j4
sub a,0(iy)
ld iy,#_i4
ld a,1(iy)
ld iy,#_j4
sbc a,1(iy)
jpp,00105$
;test.c:65; i5; = 3;
ld iy,#_i5
ld 0(iy),#0x03
ld 1(iy),#0x00
00105$:
└── CODE ───
2.Convolution of constants
┌─- CODE ───
;test.c:72; i3; = 1 + 2;
;rolled up
ld iy,#_i3
ld 0(iy),#0x03
ld 1(iy),#0x00
;test.c:73; flt_1; = 2.4 + 6.3;
;here you can use index registers
;justify, and even then with a stretch...
ld iy,#_flt_1
ld 0(iy),#0x33
ld 1(iy),#0x33
ld 2(iy),#0x0B
ld 3(iy),#0x41
;test.c:74; i2; = 5;
ld iy,#_i2
ld 0(iy),#0x05
ld 1(iy),#0x00
;test.c:75; j2; = i + 0;
;0 I didn’t add it, just copying it
ld hl,(_i)
ld iy,#_j2
ld 0(iy),l
ld 1(iy),h
;test.c:76; k2; = i / 1;
;and did not divide by 1
ld hl,(_i)
ld iy,#_k2
ld 0(iy),l
ld 1(iy),h
;test.c:77; i4; = i * 1;
;yes, and multiply too
ld hl,(_i)
ld iy,#_i4
ld 0(iy),l
ld 1(iy),h
;test.c:78; i5; = i * 0;
;smart guy :)
ld iy,#_i5
ld 0(iy),#0x00
ld 1(iy),#0x00
;test.c:88; printf(; "This compiler handles divide-by-zero as
;division by 0 was not caught at the compilation stage, trying
;print
;passing parameters via the stack is not very good...
ld hl,#__str_0
push hl
call_printf
;and cleanup by the calling function is classic;paradigm _cdecl
pop af
;test.c:91; flt_3; = 2.4 / 1.0;
;Floating point constants are also collapsed
ld iy,#_flt_3
ld 0(iy),#0x9A
ld 1(iy),#0x99
ld 2(iy),#0x19
ld 3(iy),#0x40
;test.c:92; flt_4; = 1.0 + 0.0000001;
ld iy,#_flt_4
ld 0(iy),#0x01
ld 1(iy),#0x00
ld 2(iy),#0x80
ld 3(iy),#0x3F
;test.c:93; flt_5; = flt_6 * 0.0;
;well done :)
ld iy,#_flt_5
ld 0(iy),#0x00
ld 1(iy),#0x00
ld 2(iy),#0x00
ld 3(iy),#0x00
;test.c:94; flt_6; = flt_2 * flt_3;
;propagation of the constant flt_3 = 2.4
ldhl,#0x4019
push hl
ldhl,#0x999A
push hl
ld hl,(_flt_2 + 2)
push hl
ld hl,(_flt_2)
push hl
call ___fsmul
;worried about hl...
ld b,h
ld c,l
;free stack - 8 bytes
pop af
pop af
pop af
pop af
ld iy,#_flt_6
ld 0(iy),c
ld 1(iy),b
ld 2(iy),e
ld 3(iy),d
└── CODE ───
3. Extra assignment
┌─- CODE ───
;test.c:101; k3; = 1;
;was safely deleted!
ld iy,#_k3
ld 0(iy),#0x01
ld 1(iy),#0x00
└── CODE ───
4.Power reduction
┌─- CODE ───
;test.c:107; k2; = 4 * j5;
;this is simply a “masterpiece”! this is a must see!!!
ld iy,#_j5
ld a,0(iy)
ld iy,#_k2
ld 0(iy),a
ld iy,#_j5
ld a,1(iy)
ld iy,#_k2
ld 1(iy),a
;for the first time in the arena SUCH perversions when trying;replace multiplication with shifts :)
ld a,#0x02+1
jp 00146$
00145$:
ld iy,#_k2
sla 0(iy)
rl 1(iy)
00146$:
dec a
jp nz,00145$
;test.c:108; for(; i = 0; i <= 5; i++ )
;the loop variable is also in the index... sad...
ld iy,#_i
ld 0(iy),#0x00
ld 1(iy),#0x00
00117$:
ld a,#0x05
ld iy,#_i
sub a,0(iy)
ld a,#0x00
sbc a,1(iy)
jp m,00120$
;test.c:109; ivector4[; i ] = i * 2;
;gloomy...
ld c,0(iy)
ld b,1(iy)
sla c
rl b
ld hl,#_ivector4
add hl,bc
;I still don’t understand what these two commands are for...
ld e,l
ld d,h
ld(hl),c
inc hl
ld(hl),b
;test.c:108; for(; i = 0; i <= 5; i++ )
;but this is a small feint - half-recalculation
ld iy,#_i
inc 0(iy)
jp nz,00149$
inc 1(iy)
00149$:
jp 00117$
00120$:
└── CODE ───
5.Simple loop
┌─- CODE ───
;test.c:115; j5; = 0;
ld iy,#_j5
ld 0(iy),#0x00
ld 1(iy),#0x00
;test.c:116; k5; = 10000;
ld iy,#_k5
ld 0(iy),#0x10
ld 1(iy),#0x27
;test.c:117; do; {
00107$:
;test.c:118; k5; = k5 - 1;
;well, quite a logical design - why in the rest
;places IY????
ld hl,(_k5)
dec hl
ld(_k5),hl
;test.c:119; j5; = j5 + 1;
;for example, here????
ld iy,#_j5
inc 0(iy)
jp nz,00150$
inc 1(iy)
00150$:
;test.c:120; i5; = (k5 * 3) / (j5 * constant5);
;well, just sweetie! :)ld day,(_k5)
ld l,e
ld h,d
add hl,hl
add hl,de
ld c,l
ld b,h
;he even deployed a constant!!!
ld of,(_j5)
ld l,e
ld h,d
add hl,hl
add hl,hl
add hl,de
ld e,l
ld d,h
;parameters via stack
push the
push bc
call __divsint_rrx_s
;unclear purpose design.
ld b,h
ld c,l
pop af
pop af
ld ii,#_i5
ld 0(iy),c
ld 1(iy),b
;test.c:121; }; while ( k5 > 0 );
;scary design...
ld a,#0x00
ld ii,#_k5
sub a,0(iy)
ld a,#0x00
sbc a,1(iy)
jp m,00107$
└── CODE ───
6.Control of loop induction variable
┌─- CODE ───
;test.c:126; for(; i = 0; i < 100; i++ )
;standard loop header
ld ii,#_i
ld 0(iy),#0x00
ld 1(iy),#0x00
$00121:
ld ii,#_i
ld a,0(iy)
sub a,#0x64
ld a,1(iy)
sbc a,#0x00
jp p,00124$
;test.c:127; ivector5[; i * 2 + 3 ] = 5;
;highlight induction is missing, but interestingly- noticed that
; loop variable is put into one byte
ld c,0(iy)
ld a,c
add a,a
ld c,a
;eh, didn't guess the array base to shift :)
inc c
inc c
inc c
;don't forget about the size
ld a,c
add a,a
ld c,a
; here is this interestingly- use of half-words address
ld a,#<_vector5
Add a,c
ld c,a
ld a,#>_vector5
adc a,#0x00
ld b,a;he saves HL for unknown purposes...
ld l,c
ld h,b
ld (hl),#0x05
inc hl
ld (hl),#0x00
;test.c:126; for(; i = 0; i < 100; i++ )
;standard increment
inc 0(iy)
jp nz,00151$
inc 1(iy)
00151$:
jp 00121$
00124$:
└── CODE ───
7.Deep subexpressions
┌─- CODE ───
;test.c:133; if(; i < 10 )
ld iy,#_i
ld a,0(iy)
sub a,#0x0A
ld a,1(iy)
sbc a,#0x00
jpp,00111$
;test.c:134; j5; = i5 + i2;
;fearful design...
ld hl,#_i2
push de
ld iy,#_j5
push iy
pop de
ld iy,#_i5
ld a,0(iy)
add a,(hl)
ld(de),a
ld a,1(iy)
inc hl
adc a,(hl)
inc de
ld(de),a
pop de
jp 00112$
00111$:
;test.c:136; k5; = i5 + i2;
;in other words, there is no selection of a common subexpression
ld hl,#_i2
push de
ld iy,#_k5
push iy
pop de
ld iy,#_i5
ld a,0(iy)
add a,(hl)
ld(de),a
ld a,1(iy)
inc hl
adc a,(hl)
inc de
ld(de),a
pop de
00112$:
└── CODE ───
8.Generating the address of a variable with a constant index, reproducing copies and
registers
┌─- CODE ───
;test.c:144; ivector[; 0 ] = 1;
;well, why isn’t this in the usual version???
ld hl,#_ivector
ld (hl),#0x01
inc hl
ld (hl),#0x00
;test.c:145; ivector[; i2 ] = 2;
;what passions...
ld iy,#_i2
ld c,0(iy)
ld b,1(iy)sla c
rl b
dec hl
add hl,bc
ld c,l
ld b,h
ld (hl),#0x02
inc hl
ld (hl),#0x00
;test.c:146; ivector[; i2 ] = 2;
;these two commands are superfluous, but in general they are used
;result of previous calculations
ld l,c
ld h,b
ld (hl),#0x02
inc hl
ld (hl),#0x00
;test.c:147; ivector[; 2 ] = 3;
;why is it so strange?
ld bc,#_ivector + 4
ld l,c
ld h,b
ld (hl),#0x03
inc hl
ld (hl),#0x00
└── CODE ───
9. Removing common subexpressions
┌─- CODE ───
;test.c:154; if((; h3 + k3 ) < 0 || ( h3 + k3 ) > 5 )
;I advise you to take a closer look - the compiler
;remembered that k3 did not change and is equal to 1 - reproduction
;constants plus abbreviated calculations plus immediately
;two comparisons
;PS. close your eyes to the implementation of the idea :)
ld iy,#_h3
ld c,0(iy)
ld b,1(iy)
;this is what we add to 3
inc bc
;checking for <0 is as easy as shelling pears
ld a,b
bit 7,a
jp nz,00113$
;as well as >5
ld a,#0x05
sub a,c
ld a,#0x00
sbc a,b
jpp,00114$
00113$:
;test.c:155; printf("Common; subexpression elimination
");
;parameters via stack
ld hl,#__str_1
push hl
call_printf
pop af
jp 00115$
00114$:
;test.c:157; m3; = ( h3 + k3 ) / i3;
;selection of common subexpressions works!- expression
;in brackets is not recalculated but stored in bc
push bc
ld hl,(_i3)
push hlpush bc
call __divsint_rrx_s
ld d,h
ld e,l
pop off
pop off
pop bc
ld iy,#_m3
ld 0(yes),e
ld 1(year),d
; test . c : 158 ; g3; = i3 + (h3 + k3);
;available и здесь
ld hl,#_g3
ld iy,#_i3
ld a,0(iy)
add a,c
ld (hl),a
ld a,1(iy)
adc a,b
inc hl
ld (hl),a
00115$:
└── CODE ───
10.Environmentally friendly
┌─- CODE ───
; test . c : 166 ; for ( ; i4 = 0 ; i4 <= max_vector ; i4 ++ ) ;
ld iy,#_i4
ld 0 ( i ), # 0x00
ld 1 ( i ), # 0x00
00125$:
ld a, #0x0
ld iy,#_i4
sub a,0(iy)
ld a, #0x0
sbc a,1(iy)
jp m.00128$
; test . c : 167 ; vector2[; i4] = j*k;
;subject to the snowflake snowflakes
ld hl,#_i4
ld a,#<_vector2
add a,(hl)
ld c,a
ld a,#>_vector2
inc hl
adc a,(hl)
ld b,a
;It's slightly slightly slightly- stable
;small snowflakes
ld iy,#_j
ld e,0(iy)
ld iy,#_k
ld d,0(iy)
push bc
push there
inc sp
ld a,e
push off
inc sp
call __mulschar_rrx_s
ld e,l
pop off
pop bc
ld a,e
ld (bc),a
; test . c : 166 ; for ( ; i4 = 0 ; i4 <= max_vector ; i4 ++ ) ;
ld iy,#_i4
inc 0(iy)
jp nz,00154$
inc 1(iy)
00154$:
jp 00125$
00128$:
└── CODE ───
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello Vitamin
I took impressions from Avoset, sdcc, z88dk. I'll try to analyze it soon
and their code. Who else has any compilers lying around?
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello caro
car> And the version of the Hi-tech compiler that I posted
car> http://zx.pk.ru/showthread.php?p=53431 not suitable?
I downloaded it and am checking it out for the first time.
Test code (taken from codenet.ru):
┌─- CODE ───
/* ---------------------------------------------------------- *
| |
| PC Tech Journal Test Series |
| C code optimization test |
| |
| Copyright (c) 1988 Ziff-Devis Publishing Company |
| |
| This test program was designed to test |
| code optimization methods used by the compiler |
| Si. It does not produce reasonable results and does not |
| represents good programming style. |
| |
+ ---------------------------------------------------------- */
//#include
//#include
#define max_vector 2
#define constant5 5
typedef unsigned char uchar;
int i, j, k, l, m;
int i2, j2, k2;
int g3, h3, i3, k3, m3;
int i4, j4;
int i5, j5, k5;
double flt_1, flt_2, flt_3, flt_4, flt_5, flt_6;
int ivector[ 3 ];
uchar ivector2[ 3 ];short ivector4[ 6 ];
int ivector5[ 100 ];
#ifndef NO_PROTOTYPES
void dead_code( int, char * );
void unnecessary_loop( void );
void loop_jamming( int );
void loop_unrolling( int );
int jump_compression( int, int, int, int, int );
#else
void dead_code();
void unnecessary_loop();
void loop_jamming();
void loop_unrolling();
int jump_compression();
#endif
int main( argc, argv ) /* optbench */
int argc;
char **argv;
{
/* ---------------------------- *
| Reproduction of constants and copies |
*------------------------------*/
j4 = 2;
if( i2 < j4 && i4 < j4 )
i2 = 2;
j4 = k5;
if( i2 < j4 && i4 < j4 )
i5 = 3;
/* ------------------------------------------ *
| Convolution of constants, arithmetic identities |
| and unnecessary load/save operations |
* ------------------------------------------ */
i3 = 1 + 2;
flt_1 = 2.4 + 6.3;
i2 = 5;
j2 = i + 0;
k2 = i / 1;
i4 = i * 1;
i5 = i * 0;
#ifndef NO_ZERO_DIVIDE
/*
* Some compilers recognize the error
* divisions by zero and do not generate object code
*/
i2 = i / 0;
flt_2 = flt_1 / 0.0;
#else
printf( "This compiler handles divide-by-zero as \n
an error
");
#endif
flt_3 = 2.4 / 1.0;
flt_4 = 1.0 + 0.0000001;flt_5 = flt_6 * 0.0;
flt_6 = flt_2 * flt_3;
/* -------------------- *
| Extra assignment |
* -------------------- */
k3 = 1;
k3 = 1;
/* ------------------ *
| Power reduction |
* ------------------ */
k2 = 4 * j5;
for( i = 0; i <= 5; i++ )
ivector4[ i ] = i * 2;
/* ------------- *
| Simple loop |
* ------------- */
j5 = 0;
k5 = 10000;
do {
k5 = k5 - 1;
j5 = j5 + 1;
i5 = (k5 * 3) / (j5 * constant5);
} while ( k5 > 0 );
/* -------------------------------------- *
| Variable loop induction control |
*--------------------------------------- */
for( i = 0; i < 100; i++ )
ivector5[ i * 2 + 3 ] = 5;
/* ----------------------- *
| Deep Subexpressions |
*-----------------------*/
if( i < 10 )
j5 = i5 + i2;
else
k5 = i5 + i2;
/* ------------------------------------------------ *
| Checking how the compiler generates an address |
| variable with a constant index, multiplies |
| copies and registers |
* ------------------------------------------------ */
ivector[ 0 ] = 1; /* generate a constant address */
ivector[ i2 ] = 2; /* i2 value must be copied*/ivector[ i2 ] = 2; /* copy registers */
ivector[ 2 ] = 3; /* generation of a constant address */
/* ----------------------------- *
| Removing common subexpressions |
* ----------------------------- */
if(( h3 + k3 ) < 0 || ( h3 + k3 ) > 5 )
printf("Common subexpression elimination
");
else {
m3 = ( h3 + k3 ) / i3;
g3 = i3 + (h3 + k3);
}
/* -------------------------------------- *
| Exposing invariant code |
| (j * k) can be taken out of the loop |
*--------------------------------------- */
for( i4 = 0; i4 <= max_vector; i4++)
ivector2[ i4 ] = j * k;
/* ----------------------------- *
| Calling a function with arguments |
* ----------------------------- */
dead_code( 1, "This line should not be printed" );
/* ------------------------------ *
| Calling a function without arguments |
* ------------------------------ */
unnecessary_loop();
} /* End of main function */
/* ------------------------------------------------------ *
| Function: dead_code |
| Checking for unreachable and redundant code |
| assignments. No code should be generated. |
+------------------------------------------------------- */
void dead_code( a, b )
int a;char *b;
{
int idea_store;
idea_store = a;
if( 0 )
printf( "%s
", b);
} /* End of dead_code */
/* ---------------------------------------------------- *
| Function: unnecessary_loop |
| The loop in the following function is unnecessary because |
| the value of the assignment is constant. Ideally |
| the loop must be removed. |
+ ---------------------------------------------------- */
void unnecessary_loop()
{
int x;
x = 0;
for( i = 0; i < 5; i++ ) /* The loop should not
generated*/
k5 = x + j5;
} /* End of unnecessary_loop */
/* ---------------------------------------------------- *
| Function: loop_jamming |
| The two loops in this function have the same |
| headers and can be merged into one. |
+ ---------------------------------------------------- */
void loop_jamming( x )
int x;
{
for( i = 0; i < 5; i++ )
k5 = x + j5 * i;
for( i = 0; i < 5; i++ )
i5 = x * k5 * i;
} /* End loop_jamming */
/* ------------------------------------------------------ *
| Function: loop_unrolling |
| The loop in this function must be replaced || three assignments using |
| constant array indexing or machine- |
| dependent commands for initialization |
| memory block. |
+------------------------------------------------------- */
void loop_unrolling( x )
int x;
{
for( i = 0; i < 6; i++ )
ivector4[i] = 0;
} /* End loop_unrolling */
/* ------------------------------------------------------- *
| Function: jump_compression |
| This program is useful for demonstrating |
| compression of the transition chain. goto end_1 can |
| be replaced by a direct jump to beg_1. |
+ --------------------------------------- */
int jump_compression( i, j, k, l, m )
int i, j, k, l, m;
{
beg_1;
if(; i < j )
if( j < k )
if( k < l )
if( l < m )
l += m;
else
goto end_1;
else
k += l;
else {
j += k;
end_1;
goto; beg_1;
}
else
i += j;
return( i + j + k + l + m );
} /* End jump_compression */
└── CODE ───
From
Gavrilov Vitaly
→
To
All
19 November 2006
Hello fk0
So, the one being prepared is Avocet. This compiler did not understand the old test syntax
(see function headings), so I had to slightly modify it with a file.
This is what he generated (extra directives were cut out).
0.Prologue
┌─- CODE ───
;it doesn’t matter, it’s done once anyway...
push ix
push de
push hl
ld ix,-?TSC0
add ix,sp
push af
└── CODE ───
1. Reproduction of constants and copies
┌─- CODE ───
ld hl,2
ld(_j4),hl
;unnecessary operation
ld de,(_j4)
ld hl,(_i2)
and a
;using native operations is a plus
sbc hl,de
;cunning system of transitions - bold minus
jpp,$+8
jp pe,?BOL0
jr +3
jp po,?BOL0
?ACC0; .equal; $
ld de,(_j4)
ld hl,(_i4)
and a
sbc hl,de
jpp,$+8
jp pe,?BOL0
jr +3
jp po,?BOL0
?PLC0; .equal; $
ld hl,2
ld(_i2),hl
?BOL0; .equal; $
;in short, no multiplication of constants is used
;and this piece is almost a complete copy of the previous one
ld hl,(_k5)
ld(_j4),hl
ld e,l
ld d,h
ld hl,(_i2)
and a
sbc hl,de
jpp,$+8
jp pe,?BOL1
jr +3
jp po,?BOL1
?ACC1; .equal; $
ld de,(_j4)
ld hl,(_i4)and a
sbc hl,de
jpp,$+8
jp pe,?BOL1
jr +3
jp po,?BOL1
?PLC1; .equal; $
ld hl,3
ld(_i5),hl
?BOL1; .equal; $
└── CODE ───
2.Convolution of constants
┌─- CODE ───
;safely collapsed integer constants
ld hl,3
ld(_i3),hl
.const_data
?CGL0; .double; 8.69999999999999930000
.program
;also collapsed fractional
ldde,?CGL0
ld hl,_flt_1
call __store_double
;just a constant
ld hl,5
ld(_i2),hl
;and this is squalor...
ld de,0
ld hl,(_i)
add hl,de
ld(_j2),hl
;I didn’t realize here that you don’t need to divide by 1...
ld de,1
ld hl,(_i)
call __div_int
ld(_k2),hl
;yes, and multiply too...
ld de,1
ld hl,(_i)
call __mult_int
ld(_i4),hl
;and this is generally a joke
ld de,0
ld hl,(_i)
call __mult_int
ld(_i5),hl
;and we can divide by 0 too! :)
;as an integer...
ld de,0
ld hl,(_i)
call __div_int
ld(_i2),hl
.const_data
?CGL1; .double; 0.0
.program
;...same with floating point
ldde,?CGL1
ld hl,_flt_1
call __div_double
ex de,hl
ld hl,_flt_2
call __store_double
.const_data?CGL2; .double; 2.39999999999999990000
.program
;here is the division of a constant by a constant, he collapsed
ldde,?CGL2
ld hl,_flt_3
call __store_double
.const_data
?CGL3; .double; 1.00000010000000010000
.program
;addition too
ldde,?CGL3
ld hl,_flt_4
call __store_double
.const_data
?CGL4; .double; 0.0
.program
;but I didn’t think to refine multiplication by 0
ldde,?CGL4
ld hl,_flt_6
call __mult_double
ex de,hl
ld hl,_flt_5
call __store_double
;nothing interesting
ld de,_flt_3
ld hl,_flt_2
call __mult_double
ex de,hl
ld hl,_flt_6
call __store_double
└── CODE ───
3. Extra assignment
┌─- CODE ───
;You have to tear your hands off for this...
ld hl,1
ld(_k3),hl
ld hl,1
ld(_k3),hl
└── CODE ───
4.Power reduction
┌─- CODE ───
;no imagination...
ld de,(_j5)
ld hl,4
call __mult_int
ld(_k2),hl
ld hl,0
ld(_i),hl
?FLC2; .equal; $
ld de,5
ld hl,(_i)
and a
sbc hl,de
;again a complex transition system
jr z,+11
jpp,$+8
jp pe,?BOL2
jr +3
jp po,?BOL2
jp ?FLB2
?FLA2; .equal; $;register variables are not supported,
;at least here
ld hl,(_i)
inc hl
ld(_i),hl
jp ?FLC2
?FLB2; .equal; $
;it's just darkness...
ld de,2
ld hl,(_i)
call __mult_int
ld(ix+0),l
ld(ix+0+1),h
ld hl,(_i)
add hl,hl
ld bc,_ivector4
add hl,bc
ld e,l
ld d,h
;people, don't look at this :)
ld l,(ix+0)
ld h,(ix+0+1)
push de
pop iy
ld(iy+0),l
ld(iy+1),h
jp ?FLA2
?BOL2; .equal; $
└── CODE ───
5.Simple loop
┌─- CODE ───
ld hl,0
ld(_j5),hl
ld hl,10000
ld(_k5),hl
?TOL3; .equal; $
;just no intelligence, no imagination...
ld de,1
ld hl,(_k5)
and a
sbc hl,de
ld(_k5),hl
ld de,1
ld hl,(_j5)
add hl,de
ld(_j5),hl
ld de,3
ld hl,(_k5)
call __mult_int
ld(ix+0),l
ld(ix+0+1),h
ld de,5
ld hl,(_j5)
call __mult_int
ld e,l
ld d,h
ld l,(ix+0)
ld h,(ix+0+1)
call __div_int
ld(_i5),hl
?DCL3; .equal; $
;simply the height of a coder's mind - a comparison of 0...
ld de,0
ld hl,(_k5)
and a
sbc hl,de
jp z,?BOL3jpp,$+8
jp po,?BOL3
jr +3
jp pe,?BOL3
?PLC2; .equal; $
jp ?TOL3
?BOL3; .equal; $
└── CODE ───
6.Variable induction cycle control
┌─- CODE ───
;decent enough cycle title
ld hl,0
ld(_i),hl
?FLC4; .equal; $
ld de,100
ld hl,(_i)
and a
sbc hl,de
jpp,$+8
jp pe,?BOL4
jr +3
jp po,?BOL4
jp ?FLB4
?FLA4; .equal; $
ld hl,(_i)
inc hl
ld(_i),hl
jp ?FLC4
?FLB4; .equal; $
;and here the terrible calculations begin without any
;any traces of optimization
ld de,2
ld hl,(_i)
call __mult_int
ld e,l
ld d,h
ld hl,3
add hl,de
add hl,hl
ld bc,_ivector5
add hl,bc
ld e,l
ld d,h
ld hl,5
push de
pop iy
ld(iy+0),l
ld(iy+1),h
jp ?FLA4
?BOL4; .equal; $
└── CODE ───
7. Deep subexpressions
┌─- CODE ───
;without words. everything is clear...
ld de,10
ld hl,(_i)
and a
sbc hl,de
jpp,$+8
jp pe,?BOL5
jr +3
jp po,?BOL5
?PLC3; .equal; $
ld de,(_i2)
ld hl,(_i5)
add hl,de
ld(_j5),hl
jp ?EOI5
?BOL5; .equal; $ld de,(_i2)
ld hl,(_i5)
add hl,de
ld(_k5),hl
?EOI5; .equal; $
└── CODE ───
8.Generating the address of a variable with a constant index, reproducing copies and
registers
┌─- CODE ───
ld hl,_ivector+0
ld e,l
ld d,h
ld hl,1
;the guys probably don’t know about the ld (hl) team..
push de
pop iy
ld(iy+0),l
ld(iy+1),h
ld hl,(_i2)
add hl,hl
ld bc,_ivector
add hl,bc
ld e,l
ld d,h
ld hl,2
push de
pop iy
ld(iy+0),l
ld(iy+1),h
ld hl,(_i2)
add hl,hl
ld bc,_ivector
add hl,bc
ld e,l
ld d,h
ld hl,2
push de
pop iy
ld(iy+0),l
ld(iy+1),h
ld hl,_ivector+4
ld e,l
ld d,h
ld hl,3
push de
pop iy
ld(iy+0),l
ld(iy+1),h
└── CODE ───
9. Removing common subexpressions
┌─- CODE ───
ld de,(_k3)
ld hl,(_h3)
add hl,de
ld de,0
and a
sbc hl,de
jpp,$+8
jp po,?PLC4
jr +3
jppe,?PLC4
?OCC2; .equal; $
ld de,(_k3)
ld hl,(_h3)
add hl,de
ld de,5
and a
sbc hl,de
jp z,?BOL6
jpp,$+8jp po,?BOL6
jr +3
jp pe,?BOL6
?PLC4; .equal; $
.const_data
?PLC5; .byte; "Common subexpression elimination",0ah,0
.program
ld hl,?PLC5
call_printf
jp ?EOI6
?BOL6; .equal; $
;in other words, no allocations are made
ld de,(_k3)
ld hl,(_h3)
add hl,de
ld de,(_i3)
call __div_int
ld(_m3),hl
ld de,(_k3)
ld hl,(_h3)
add hl,de
ld e,l
ld d,h
ld hl,(_i3)
add hl,de
ld(_g3),hl
?EOI6; .equal; $
└── CODE ───
10. Identification of the invariant code
┌─- CODE ───
;acceptable start of cycle
ld hl,0
ld(_i4),hl
?FLC7; .equal; $
ld de,2
ld hl,(_i4)
and a
sbc hl,de
jr z,+11
;but its structure in the code is simply terrible!
jpp,$+8
jp pe,?BOL7
jr +3
jp po,?BOL7
jp ?FLB7
?FLA7; .equal; $
ld hl,(_i4)
inc hl
ld(_i4),hl
jp ?FLC7
?FLB7; .equal; $
;there is no rendering - calculations at each iteration
ld de,(_k)
ld hl,(_j)
call __mult_int
ld(ix+0),l
ld(ix+0+1),h
ld hl,(_i4)
ld bc,_ivector2
add hl,bc
ld e,l
ld d,h
ld l,(ix+0) ld h,(ix+0+1)
ld a,l
ld (de),a
jp ?FLA7
└── CODE ───
From
Igor Afonkin
→
To
All
19 November 2006
Hello Vitamin
Wah-wah! HI-TECH C Z80/Z180 = $950 - nice price! :)
From
Kamil Karimov
→
To
All
19 November 2006
Hello, Aprisobal
Apr> And the version of the Hi-tech compiler, which was posted by [post]53431[/post]
Apr> is not suitable?
All attempts to download a file from RapidShare were unsuccessful for me personally :)
Outputs:
You have requested the file
Embedded_Systems_-_Avocet_WideUI_V3.28_ANSI-C_Compiler_for_Z80.rar (3749 KB).
This file has been downloaded 1 times already.
ERROR; Please; enable JavaScript.
PS. I have Java enabled.
From
Kamil Karimov
→
To
All
19 November 2006
Hello Vitamin
Vit> Test code (taken from codenet.ru)
You expect too much from a compiler for the Z80.
I'm almost sure that it will not perform any optimization for this test,
Honestly, everything that is given to him will be inserted into the code :)
From
Sergey Akimov
→
To
All
19 November 2006
Hello jdigreze
jdi> Wah-wah! HI-TECH C Z80/Z180 = $950 - nice price! :)
the latest CP/M version is free
From
Max Kuleshov
→
To
All
20 November 2006
Hello Vitamin
Still, it seems to me that the test is somewhat synthetic.
For example, multiplying by 1 and dividing by it - what's the point? Will someone write
so in the program? Well, okay, but what if it’s a constant expression? Well, that's the deal
fixable. Yes, readability will decrease, but it will be far from being as good.
Or, for example, a cycle that can be removed. Well, let the programmer clean it up. Not
is it always visible? So, good programming style assumes that everything is visible.
Ultimately, with crooked sources, it will be worse for you.
What I mean is that there is no need to blame the compiler by looking at how it kicks out, you need to
look at more real code.
From
Alexey Goncharov
→
To
All
20 November 2006
Hello Vitamin
Thanks, interesting research. That means sdcc... But what confuses me is that on
sdcc.sf.net is constantly referred to as "freeware", despite its GPL status.
As for variables, there will probably be many global ones in real projects
static, so that the compiler simply puts them in memory without messing with the stack
or IX/IY.
From
Gavrilov Vitaly
→
To
All
20 November 2006
Hello NovaStorm
Nov> Thank you, interesting research. That means sdcc... But it confuses me
Nov> that “freeware” is constantly mentioned on sdcc.sf.net, despite it
Nov> GPL'ed.
Nov> As for variables, there will probably be a lot in real projects
Nov> global static ones, so that the compiler simply puts them in memory, not
Nov> perverting with a stack or IX/IY.
It is frivolous - the sours are included, the docks too.
I checked the static variables - the same eggs, only in profile.
The problem can be partially solved using the built-in
peephole optimizer. An autocorrect file is written and the code is very, very easy, but
this is not a panacea, because optimizing the use of registers (in particular, IY)
sometimes leads to post-optimization errors.
So you need to tinker with the code generator part - it’s in the sorts separately, I
I really haven’t figured it out yet.
In general, I made a very pleasant impression.
From
poisoned cyberjack
→
To
All
21 November 2006
Hello caro
Vit> I have no illusions about what C will be used for
Vit> writing programs.
if a cross-compiler appears that generates more or less adequate code, then I personally
I would start using it in our next demos. Despite everyone's opinion,
that the demos are squeezing the impossible out of the machine, the time-critical code is not so much
and a lot - 20-40 percent, the rest is taken up by management and data managers
and events - their execution on ASMA takes negligible time (up to 10-15%
interrupts), and writing them in pure asm takes up to 80% of the time!!! Of course I
I speak from my own experience, for some it’s completely the opposite - but the logic is correct
writing is very stressful, unlike open and linear demo code...
From
Alexey Goncharov
→
To
All
21 November 2006
Hello Vitamin
Alas =( "Dynamic C runs on a PC and connects to the processor though a serial
connection to the Rabbit Microprocessor core module."
Only for rabbits. But there the command system is different.
From
Gavrilov Vitaly
→
To
All
21 November 2006
Hello caro
car> For this reason, I removed the latest version of C Warp from the forum,
car> realizing that I won’t hear anything good other than swearing
car> I like it already because it works on my favorite Speck,
car> although it generates terribly “monstrous” code
Can you run it on a test and post an overview of the result? With maximum
optimization, of course, if there is one.
psn> if a cross-compiler appears that generates more or less adequate code
psn> then personally I would start using it in our next demos.
HiTechC or SDCC+Peephole. To choose from.
From
Andrey Savichev
→
To
All
21 November 2006
Hello Vitamin
Vit> SDCC+Peephole
I was still thinking the old fashioned way, on Maznitsinsky C-- (pc110)
From
Gavrilov Vitaly
→
To
All
21 November 2006
Hello andrews
and> ...can I look at an example of a small project for ZX Spectrum on
and> German. Otherwise I was thinking the old fashioned way, on Maznitsinsky C-- (pc110)
It depends on what is meant by “small project”... You can download the compiler from
Internet (freely available) and check. There are code examples above (it's a bit heavy).
An optimization file can be written in half an hour by hand after analyzing the resulting code.
From
Andrey Savichev
→
To
All
21 November 2006
Hello Vitamin
Vit> Depending on what is meant by “small project”...
something with sprites...Maznitsa has libraries from Laser Basica screwed in...in
as a demo of the game Kladova... everything compiles o'k.
From
Gavrilov Vitaly
→
To
All
22 November 2006
Hello andrews
and> something with sprites...Maznitsa's library from Laser Basica
and> screwed...as a demo of the game Kladova...everything compiles o'k.
We need to see what libraries are included. Basically, write your own
The withdrawal procedure (even on ASMA) is not very difficult. What about
Laserbasic is more difficult here, I think...
PS. How is C different from full C?
From
Slavik Tretiak
→
To
All
22 November 2006
Hello Vitamin
Vitamin
everyone ;) this is a completely different programming language. (only the syntax is a little bit different
C is similar)
Is there already a C-generating code for the z80?
From
Gavrilov Vitaly
→
To
All
22 November 2006
Hello Sinus
Sin> everyone, this is a completely different programming language. (only the syntax is slightly
Sin> looks a little like C)
I just heard about this language. It seems that it was developed for some OS?
Sin> is there already a C-generating code for z80?
Apparently, yes. For details, contact Andrews :)
From
Dmitry Malychev
→
To
All
23 November 2006
Hello, psndcj
psn> if a cross-compiler appears that generates more or less adequate code
psn> then personally I would start using it in our next demos.
psn> Despite the general opinion that the demos squeeze the impossible out of the machine,
psn> There is not so much time-critical code - 20-40 percent, that's all
psn> the rest is occupied by management and data and event managers - them
psn> execution on ASMA takes negligible time (up to 10-15% interruption), and
psn> writing them in pure asm takes up to 80% of the time!!! Of course I say
psn> from my own experience, for some it’s completely the opposite - but the logic is correct
psn> writing is very stressful, in contrast to open and linear
psn> demo code...
It is better to write logic on “small” computers in Forth. True, Spec's versions are not
so cool... it’s easier to write a version “for yourself” once from scratch and there will be no further problems
have.
From
Kamil Karimov
→
To
All
23 November 2006
Hello Lethargeek
Let> It is better to write logic on “small” computers in Forth.
Forth is certainly good, but “better” is a controversial statement,
especially since there is not a single example of implementing logic on it for the Spectrum
At least I haven't seen it.
Let> True, Spec's versions are not so hot...
And this is not entirely true.
Forth implementations for Spectrum are based on the Forth79 and Fig-Forth standards and
practically
identical to their CP/M and early PC variants.
Yes, and programming in Forth requires a slightly “different” way of thinking than in
traditional nuclear power plants.
From
Kamil Karimov
→
To
All
23 November 2006
Hello, Vitamin
Vit> С-- чем отличается от полноценного С?
Вот выдержки из описания:
0 Introduction
^^^^^^^^^^^^^^^
0.1 C--, what can it do?
C-- was designed to build small and fast programs. It is most suitable for
memory resident programs (TSRs), programs requiring interrupt handling or
programs that have limited resources.
C-- supports, among other things, inline assembly and recursion. Also the
internal C-- library of functions and macros, contains code support for
files, sound, graphics and access to extended memory by the use of the XMS
standard 2.0.
-+---------------------------------------------------------------------------
0.2 C--, what is it like?
Nothing you have experienced before. :-)
Seriously, its sort of like C and kinda like assembly.
=============================================================================
1 THE C-- LANGUAGE
^^^^^^^^^^^^^^^^^^^
1.0 SECTION INTRODUCTION
After pondering for quite some time over what the best method to explain C--
to a new user, I came to the conclusion of describing some of its syntax and
usage as a contrast to C. This does limit the explanation's usefulness to
only C programmers, but since anyone who is anyone knows C, I don't see it a
problem. :-)
-+---------------------------------------------------------------------------It really generates very compact code, but only under DOS :)
The package itself, together with many examples, weighs about
260 kb in RAR.
I can send it to anyone interested, contact k2k()list.ru
From
Southern Bear
→
To
All
24 November 2006
Hello caro
car> Indeed it generates very compact code, but only under DOS
Yes, and for MD it’s quite a compact generator. About 4 years ago, keygen wrote on it under
WinTarif and KX-TA616 programmer. For Windows console 2.5 kilos, for Guy 3 kilos
(and even then only because of the icon).
From
Dmitry Rusakov
→
To
All
24 November 2006
Hello caro
It's funny. A rare coincidence. Just today at work I was discussing with my colleagues
RSDN magazine and one employee put forward the thesis that this magazine is only for
"Sishnikov", the question immediately arose: for which C or C++, someone joked C--
It turns out this isn't such a joke after all :rolleyes:
From
Dmitry Malychev
→
To
All
24 November 2006
Hello caro
car> Forth is certainly good, but “better” is a controversial statement,
car> especially since there is not a single example of implementing logic on it for
car> In any case, I haven’t seen the Spectrum.
And for some reason I didn’t see it. :v2_conf3; Although; on other eight-bit cards - quite often.
As for “better” - it will most likely be about saving memory and speed
debugging, but there is hardly anything significantly “better” here.
car> And this is not entirely true.
car> Spectrum's Forth implementations are based on the Forth79 and standards
car> Fig-Forth and are almost identical to their CP/M and early PC variants.
This is what is bad in these times. The editor is outdated, some things are missing
enough... Nowadays it is generally more profitable to debug in a cross-platform version, and in
the finished product is inserted into a heavily trimmed core. In which from Forth can
Only the principle itself remains.
car> Yes, and programming in Forth requires a slightly “different” way of thinking
car> than on traditional nuclear power plants.
Yes, then yes. The main thing here is to get involved... :)
From
Kirill Trofimov
→
To
All
27 November 2006
Hello BlackWolf
Bla> Funny. A rare coincidence. Just today at work we discussed with
Bla> colleagues of the RSDN magazine and one employee put forward the thesis that this magazine
Bla> only for "Sishnikov", the question immediately arose: for which C or C++,
Bla> someone made a joke S--
Bla> It turns out that this is not such a joke :rolleyes;
This one; The magazine is mainly for venduzyatniks.
From
Kirill Trofimov
→
To
All
27 November 2006
Hello Vitamin
Vit> I’ve read it, I’ll download it tomorrow and try to compile and run it under niks.
Vit> I would like to see the ASM at the output. For all existing
Vit> cross-compilers make such crap... Except that IAR is rumored to be quite
Vit> behaves with dignity (you need to get it and try).
I tried it. Shit is rare. Especially if you look at the Asmov code, which
he generates. And in general, for Speck only Asm. The rest is bullshit and not sporty :p
From
Gavrilov Vitaly
→
To
All
28 November 2006
Hello sinn_dtr
sin> I tried it. Shit is rare. Especially if you watch Asmov
sin> the code it generates.
Can I have a listing with analysis?
sin> And in general, for speck only Asm. The rest is bullshit and not sporty
To Caesar is Caesar's. Complex mathematics (within the limits of the available power)
of course) and algorithmics on ASMA sometimes turns out to be almost mind-blowing
do...
PS. I had an idea to sketch an “ideal” compiler, and
more precisely the result of his work on the above test. I'll have to think about it...
sin> This magazine is mainly for cyber-weapons enthusiasts.
If desired, a programmer even under Linux in C++ can find a lot of useful things
in the article about Delphi... And the magazine is not bad, there is a lot of interesting stuff there.
From
Kirill Trofimov
→
To
All
28 November 2006
Hello Vitamin
Vit> Can I have a listing with analysis?
Vit>
I picked it about 3 years ago. Listings are not saved :)
Vit> To Caesar is what is Caesar's. Complex mathematics (within the limits provided
Vit> power of course) and algorithmics on ASMA sometimes only almost going crazy
Vit> brains can be done...
Vit>
Well, we're talking about the Spectrum, aren't we? There is no other option here other than asm.
All sorts of C are only suitable for programs at the “Hello world” level.
Vit> If desired, a programmer can find a lot of things even under Linux in C++
Vit> useful in the article about Delphi... And the magazine is not bad, there’s a lot of things
Vit> there are interesting things there.
But I like the RSDN forum more than the magazine.
From
Kirill Trofimov
→
To
All
28 November 2006
Hello Vitamin
Vit> Congratulations. You are completely surrounded by Hello world level programs ;) Because
Vit> C finds its application in embedded systems and operating systems
Vit> systems (along with C++).
Vit>
Vit>
Vit> Yes, yes. At least because this is a forum and there is a search there :)
You took it out of context:
“Well, we’re talking about the Spectrum, right? There’s no other option here other than asm.”
This way you can take any post to the point of absurdity.
From
Gavrilov Vitaly
→
To
All
28 November 2006
Hello sinn_dtr
sin> All sorts of Cs are only suitable for programs at the "Hello world" level.
Congratulations. You are completely surrounded by Hello world level programs ;) Because C finds
its use in embedded systems and operating systems (along with
C++).
sin> But I like the RSDN forum more than the magazine.
Yes it is. At least because this is a forum and there is a search there :)
From
Kirill Frolov
→
To
All
28 November 2006
Hello caro
car> So you haven't seen the ZED package from Rick Murray.
car> This is a mail editor-echo processor for the ZX Spectrum.
car> It is written mainly in HiSoft C, and specifically on Spectrum.
But I saw it. Until they added a disk cache with 512k memory to it -
it was impossible to work. And then Lara Croft appeared and ZED was quickly
abandoned.
From
Kirill Trofimov
→
To
All
28 November 2006
Hello Vitamin
Vit> Why is speck worse than some built-in microcontroller? On the contrary,
Vit> is even more powerful. And they even have C on them...
I'm not saying that C has no right to exist.
My IMHO is that writing large programs in C will not work.
From
Kirill Trofimov
→
To
All
28 November 2006
Hello Vitamin
Vit> The quality of the product depends very indirectly on the language of writing. On asma
Vit> also a lot of worthless crafts have been done, so what? This is not a reason to declare
Vit> that "ASM is not for spec"
It's time to unleash the empty chatter.
My opinion is that on the Spectrum ASM is our FSE.
I do not see and will NOT see a single quality program here.
Your opinion is different.
The dispute is pointless.
From
Kirill Trofimov
→
To
All
28 November 2006
Hello caro
car> So you haven't seen the ZED package from Rick Murray.
car> This is a mail editor-echo processor for the ZX Spectrum.
car> It is written mainly in HiSoft C, and specifically on Spectrum.
Have you seen the speed of his work?
There is an echo processor editor from KVA (I don’t remember the name). I think that you would
I chose the latter because the speed was very different. Not to mention the quality
product.
From
Gavrilov Vitaly
→
To
All
28 November 2006
Hello sinn_dtr
sin> Not to mention the quality of the product.
The quality of the product depends very indirectly on the language in which it is written. On Asma too
a lot of worthless crafts have been done, so what? This is not a reason to declare that “ASM is not
for speck"
From
Gavrilov Vitaly
→
To
All
28 November 2006
Hello sinn_dtr
sin> You took it out of context:
sin> "Well, we're talking about the Spectrum, aren't we? There's no other choice here than
sin> asm."
Why is speck worse than some built-in microcontroller? On the contrary, more powerful
even. And they even have C on them...
From
Kamil Karimov
→
To
All
28 November 2006
Hello sinn_dtr
sin> "Well, we're talking about the Spectrum, aren't we? There's no other choice here than
sin> asm."
Why on earth?
Everything that allows the Spectrum to be called a computer is given here.
From
Kamil Karimov
→
To
All
28 November 2006
Hello sinn_dtr
sin> Have you seen the speed of its work?
I was fine with it.
sin> There is an echo processor editor from KVA (I don’t remember the name). I think
sin> that you would choose the latter, because the speed was very different.
I don't know, I haven't seen it.
sin> Not to mention the quality of the product.
The quality is excellent, I like it. Especially when I looked at the sources.
From
Kamil Karimov
→
To
All
28 November 2006
Hello sinn_dtr
sin> I'm not saying that C has no right to exist.
sin> My IMHO is that you won’t be able to write large programs in C.
So you haven't seen the ZED package from Rick Murray.
This is a mail editor-echo processor for the ZX Spectrum.
It is written mainly in HiSoft C, and specifically on Spectrum.
From
van Yu Shinn
→
To
All
29 November 2006
Hello BlackWolf
On the echo tag there are main brakes on displaying on the screen.
If they screw in the distant chip, you can use Pascal.
From
Gavrilov Vitaly
→
To
All
29 November 2006
Hello sinn_dtr
sin> I do not see and will NOT see a single high-quality program here.
To put some limits on the chatter, determine the quality indicators of the program
(without reference to language).
cap> If they screw in the distant chip, you can use Pascal.
Just not pascal! %)
From
Nikolay Gribeshchenko
→
To
All
29 November 2006
Hello, boo_boo
boo> and in general, everyone just talks about OOP, but in reality 9 out of 10
boo> programmers practically do not use inheritance, polymorphism, and
boo> encapsulation, i.e. their programs are essentially structural, and the classes in them
boo> can be easily replaced with functions to which a pointer to is passed
boo> object data.
Many years of experience in coding in procedural languages takes its toll. I know it from myself :)
From
Andrey Savichev
→
To
All
29 November 2006
Hello Vitamin
PL/2 was on IBM/360 mainframes in the early 70s... when our people tore them apart (series
EU) was also in our computing centers... and therefore there were many application software packages
and books about this language. PL/M (I wrote programs on it in the early 80s for
embedded systems MSUVT V7 on 8080) stood on the KRAM debugging complexes (
Soviet clone of Intellec MDS series II) under Intel's ISIS-II operating system and
also on SM1800 complexes.
From
Andrey Savichev
→
To
All
29 November 2006
Hello Vitamin
Vit> Why is speck worse than some built-in microcontroller? On the contrary,
Vit> is even more powerful.
it, as I was surprised to find out yesterday, is more powerful even than GB, GBC, because
there is not enough Z80... regarding the topic, I’ll note that that program on ASMA is more useful,
which is written by an advanced programmer... the quality of the code is not so important (if we are talking
we are talking about 20-40% memory overuse and cpu underutilization)...how much
the thoughtfulness of the entire project, the structure of the code, its style and documentation...
I had to support someone else's project on MASM with a volume of more than 100 thousand.
lines...under a home-made SRV...hardware-intensive digital PBX...with
Since then I have had a persistent allergy to serious projects implemented on
assembler. Although in terms of intellectual property protection and
They are perfect for non-portability :)
From
Andrey Savichev
→
To
All
29 November 2006
Hello Vitamin
Vit> Just not pascal!
there was also PL/Z... in short, you need a Javascript with classes, but one that takes into account the peculiarities well
z80
From
Andrey Savichev
→
To
All
29 November 2006
Hello andrews
The disadvantage of C in relation specifically to the z80 is that it is by no means stack-based
percent in the sense that it has a rich set of registers and operations with them,
which known C implementations are clearly underutilized... and therefore the loss of C
prog becomes more noticeable.
From
Andrey Savichev
→
To
All
29 November 2006
Hello andrews
Yeah! And here is more accurate information about this language...the correct name is PLZ on
on the same site (I apologize for expressing my opinion a few minutes earlier
a long-standing misconception... the many-year-old fog of mystery has only cleared for me
now :) )
So, get acquainted PLZ!
http://hopl.murdoch.edu.au/showlanguage.prx?exp=865&language=PLZ
From
Andrey Savichev
→
To
All
29 November 2006
Hello caro
I was not mistaken, PL/Z is an implementation of PL/M for U880A (DDR z80a)... included in the software
I don’t remember which Robotron complex...I first read about it in some
translated book about microprocessors in the early 80s. Hold the truth in your hands
I didn't have a chance. The PL/M sources, which are publicly available on the Internet, unfortunately
Fortran, and therefore I really wanted to repeat the feat of the German comrades, but
:(
And I converted it to C... I converted it, but it wasn’t any easier to parse. There is also PL/M
based on yacc+lex, but this is also a lot of work.
From
Andrey Savichev
→
To
All
29 November 2006
Hello, ng_dead
For those interested in the pedigree of programming languages, here is a very interesting
link
http://hopl.murdoch.edu.au/findlanguages.prx?year=1972&which=byyea
From
Gavrilov Vitaly
→
To
All
29 November 2006
Hello andrews
and> the quality of the code is not so important (if we are talking about 20-40% overrun
and> memory and underutilization of cpu)...how much thoughtfulness of everything
and> project, code structure, its style and documentation...
Well, memory overuse is usually limited from above. What about the thoughtfulness of the project and
code structures - I agree. Sometimes a simple revision of the source code, a slight change
concepts allow you to achieve significant results.
and> persistent allergy to serious projects implemented in assembly language.
and> Although in the sense of intellectual property protection and non-portability
and> they are perfect
I fully support this. Especially if you see that the same compiler
would generate better code than your predecessor, in whose code you need
figure it out.
and> The disadvantage of C in relation specifically to the z80 is that it is not at all
and> stack percent in the sense that it has a rich set of registers and
and> operations with them that are known to C implementations explicitly
and> underutilized...
Yes it is. Either they use the stack for a while, or they push a bunch of left calls.
and> was also PL/Z...
PL/2
From
Gavrilov Vitaly
→
To
All
29 November 2006
Hello caro
car> PL/M (English Programming Language for Microcomputers)
Exactly. Although I remember there was a language with “fraction two”, I just don’t remember what was there...
From
Kamil Karimov
→
To
All
29 November 2006
Hello Vitamin
Vit> PL/2
PL/M (English Programming Language for Microcomputers) -
procedural programming language developed in 1972
by Digital Research for Intel microprocessors.
The language borrowed ideas from PL/I, ALGOL, XPL and had
integrated macro processor. The language was used in
implementation of the CP/M operating system.
PL/M compilers existed for early models
Intel processors; Intel; 4004, 8008, 8080, 8051, 8086, 286, and 386.
From
Stanislav Lomakin
→
To
All
29 November 2006
Hello andrews
and> was also PL/Z...in short, you need a Javascript with classes, but one that takes it into account well
and> z80 features
The OOP approach is justified only in the case of a well-constructed class hierarchy, with
using polymorphism and encapsulation. but in the case of ZX it will be too much
resource-intensive.
and in general, everyone just talks about OOP, but in reality 9 out of 10 programmers
practically do not use inheritance, polymorphism and encapsulation, i.e. them
programs are essentially structural, and classes in them can be easily replaced with functions,
to which a pointer to the object data is passed.
From
van Yu Shinn
→
To
All
29 November 2006
Hello, BlackWolf
Вот нашлась такая вещь:
http://archive.computerhistory.org/resources/text/Zilog/
Это сканированные рекламные брошюры 70-х годов.
Цитата из самой последней:
> PLZ
>
> PLZ is Zilog's own family of system implementation languages.
> Designed specifically with the system programmer in mind, PLZ
> provides an extremely sophisticated structured programming
> environment. Implemented at two separate language levels and distinct
> translator packages, PLZ offers a complete solution to microcomputer
> system programming problems.
>
> In its highest level, PLZ is a fully block structured language with
> an IF-THEN-ELSE clause, a case selector (actually implemented in the
> syntax of the IF statement), block REPEAT and EXIT statements,
> procedure references and, of course, RETURN's. Data types include
> BYTE, WORD, INTEGER, SHORT INTEGER and POINTER as well as ARRAYS of
> any type and RECORD's composed of groupings of the various basic
> types, arrays, or even other records.>
> At this language level, both an Interpreter and a Compiler are
> available. The interpreter provides a fast and convenient means of
> program development and debugging, while the highly efficient
> Compiler generates Z80 Object code.
>
> For applications requiring total control of hardware resources, a
> second level of PLZ provides all the block structuring and control
> conventions of the full compiler, but uses assembly language
> statements rather than compiler level expressions and assignments.
> Thus, it acts as PLZ compatible structured assembler and produces
> code which can be linked directly to modules translated by the
> compiler.
>
> Regardless of the scope or complexity of a system programming
> problem, PLZ will provide a simple, elegant, and complete environment
> for its solution.
From
Andrey Savichev
→
To
All
29 November 2006
Hello, captain cobalt
Comics are great, of course, but it seems like this is just an example of what was
the language itself, there was no Internet yet, and now there is no longer a language :( True, there is a patent and
there is a description to it, but access there is only to those who are members, i.e. pays
grandmas. So the competition for the best language VU candidate for the z80 remains for now
no contenders.
From
Max Kuleshov
→
To
All
30 November 2006
Hello Vitamin
Vit> Try to compile the test with this peephole optimizer file
Vit> (how to connect is written in the compiler help)
Well, it turned out like Hitech with register - 2607 ticks. :))
From
Max Kuleshov
→
To
All
30 November 2006
Hello andrews
I decided to test z80 compilers on dhryston.
Here are the results for 10,000 starts:
z88dk - 3852 ticks ~ 130 dps (same with register)
sdcc - 2613 ticks ~ 191 dps (same with register)
hitech - 2621 ticks ~ 191 dps
hitech register - 2607 ticks ~ 192 dps
I still don’t understand why hitech without register turned out to be worse than sdcc.
Additional notes. Testing was carried out under the unreal emulator, in
dhrystone 2.1 source code has been modified to accommodate
compiler, since some features are not supported.
Time was measured by reading the SOS FRAMES variable.
Of the library functions, only strcpy and strcmp are called within the test. These
used from the compiler's own libraries. They are written differently, but
everyone is on ASMA, so it seems like the conditions are more or less equal.
Comments on compiler capabilities:
hitech compiled everything with minimal changes.
sdcc can do almost everything, but cannot assign structures by value. Posted by
for it memcpy on ASMA via LDIR (hitech LDIR is built into the code itself).
z88dk does not do a number of very important things, namely:
* does not support multidimensional arrays. Working with multidimensional arrays in text
replaced by working with one-dimensional via arr[y*width+x]
* some problems with typedef. Can't define arrays, typedef type,
being a pointer to a structure also does not support.* does not support(!) function pointers. I found out this later, but in the test this
The feature is not used, although it’s so needed!
sdcc and z88dk did not react to register. Apparently they work anyway
the limit of your strength. But for hitech register this is not an empty phrase.
Based also on the analysis carried out by Vitamin, I can say that Hitech,
of course the best. But sdcc lags behind it quite a bit. Apparently Hitech
it just copes better with tricks from the compiler features test, but in
In real programs this is not really required.
What is Dhrystone and why you should pay attention to it:
http://en.wikipedia.org/wiki/Dhrystone
From
Gavrilov Vitaly
→
To
All
30 November 2006
Hello, maximk
max> Well, it turned out like Hitech with register - 2607 ticks. )
Total two leaders in the team
From
Gavrilov Vitaly
→
To
All
30 November 2006
Hello, maximk
max> sdcc - 2613 ticks ~ 191 dps (same with register)
hmm. I expected a worse result due to this compiler's love for
index register.
Try compiling the test with this peephole optimizer file (like
connect is written in the compiler help)
┌─- CODE ───
replace restart {
ld iy,%1
ld 0(iy),#0x%2
ld 1(iy),#0x%3
ld 2(iy),#0x%4
ld 3(iy),#0x%5
} by {
ld de,#0x%3%2
ld (%1),de
ld de,#0x%5%4
ld (%1+2),de
}
replace restart {
ld iy,%1
ld 0(iy),#0x%2
ld 1(iy),#0x%3
} by {
ld de,#0x%3%2
ld (%1),de
}
replace restart {
ld iy,%1
ld 0(iy),l
ld 1(iy),h
} by {
ld (%1),hl
}
replace {
ld iy,%1
ld 0(iy),c
ld 1(iy),b
ld 2(iy),e
ld 3(iy),d
} by {
ld (%1),bc
ld (%1+2),de
}
replace {
ld iy,%1
ld 0(iy),c
ld 1(iy),b
} by {
ld (%1),bc
}
replace {
jp %5
} by {
ret
} if labelIsReturnOnly
replace {
jp %1,%5
} by {
ret %1
} if labelIsReturnOnly
replace {
jp %5
} by {
jr %5
} if labelInRangereplace {
jp z,%5
} by {
jr z,%5
} if labelInRange
replace {
jp nz,%5
} by {
jr nz,%5
} if labelInRange
replace {
jp c,%5
} by {
jr c,%5
} if labelInRange
replace {
jp nc,%5
} by {
jr nc,%5
} if labelInRange
replace {
ld iy,%1
ld a,0(iy)
ld iy,%2
sub a,0(iy)
ld iy,%1
ld a,1(iy)
ld iy,%2
sbc a,1(iy)
} by {
and a,a
ld hl,(%1)
ld de,(%2)
sbc hl,de
}
replace {
ld iy,%1
ld a,0(iy)
sub a,#0x%2
ld a,1(iy)
sbc a,#0x%3
} by {
ld hl,(%1)
ld de,#0x%3%2
and a,a
sbc hl,de
}
└── CODE ───
From
Kirill Frolov
→
To
All
30 November 2006
Hello, maximk
max> I decided to test the z80 compilers on dhryston.
max>
max> These are the results for 10,000 starts:
max> z88dk - 3852 ticks ~ 130 dps (same with register)
max> sdcc - 2613 ticks ~ 191 dps (same with register)
max> hitech - 2621 ticks ~ 191 dps
max> hitech register - 2607 ticks ~ 192 dps
max>
max> I still don’t understand why hitech without register turned out to be worse than sdcc.
max>
I don’t understand why it doesn’t outperform the z88dk even by a factor of 2. Into what sdcc
They finally finished it up to working condition, it’s hard to believe. What's the matter then?
I'd like to see:
1) what versions of compilers were used in all cases;
2) what command lines were used to build the test.
Maybe hitech simply didn’t have optimization turned on?
> Apparently Hitech is simply better at dealing with tricks from the test
> compiler features, but in real programs this is not so true
> required.
>
A few years ago hitech mid-late 90s (DOS version)
It outperformed SDCC simply in terms of listing size in lines, MANY TIMES. :-/
From
SfS
→
To
All
30 November 2006
Hello Vitamin
Does anyone have source codes-patches for bent utilities for z80? gcc and binutils,
which ones?
If there is, please post a link, I’d like to see what it is.
From
Alexey Goncharov
→
To
All
30 November 2006
Hello, SfS
GCC for Z80 is a myth =)
Quite a lot of people have tried to make a port.
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01546.html there is even a patch.
http://gcc.gnu.org/ml/gcc/2003-05/msg02369.html and here’s even the Moscow one
phone.
http://gcc.gnu.org/ml/gcc/2003-03/msg01402.html why gcc is bad/good for
different prots.
From
Alexey Goncharov
→
To
All
30 November 2006
Hello Vitamin
So this is 2003. And the work of gcc is most likely due to the fact that under x86 it
sharpening. If we are talking about i386 and AMD64, then everything is not as bad as in 8086.
and there are enough addressing modes, and registers in many cases are equal, 32-48
bit addressing... But this monstrous bike is certainly not a fountain either =)
From
Gavrilov Vitaly
→
To
All
30 November 2006
Hello NovaStorm
Nov> http://gcc.gnu.org/ml/gcc/2003-03/msg01402.html why gcc is bad/good
Nov> for different percentages.
Interesting review. It’s just not clear how gcc works on x86 then?
The architecture is not orthogonal, there are not many RONs, the physical address depends on
segment registers.
And in general, the z80 is essentially the ancestor of the x86....
From
Gavrilov Vitaly
→
To
All
30 November 2006
Hello NovaStorm
Nov> And the work of gcc is most likely due to the fact that it runs on x86.
Judging by the requirements, it was sharpened for ARM - there you have an orthogonal structure and
a ton of RONs and a bunch of other goodies (I’m not talking about the fly in the ointment in the form
restrictions on direct loading of constants)
From
SfS
→
To
All
1 December 2006
Hello, yoko_ono
yok> Apparently because the avr has 32 equal (well, almost) registers.
yok> 8-bit, true, but nonetheless.
Well, that’s not why... For x86x gcc also generates code, although it’s the same
discrepancy with the registers on the Z80...
And in AVR the registers r0, r1-r15, r16-r25 and r26-r31 are far from equal...
From
Gavrilov Vitaly
→
To
All
4 December 2006
Hello, yoko_ono
yok> Do you work with arm and therefore decided that gcc was sharpened for arm?
For some reason you omitted the previous phrase from Comrade. NovaStorm where he said gcc
designed for x86. For some reason she didn't raise any questions. But my objection is
which I cited as an argument, AWP immediately “offended the power.” You except
x86 didn't work on anything else?
yok> Bravo, even blondes will envy your logic...
I officially give you permission to envy even you.
yok> What are you talking about.
Yes. You accused me of insufficient knowledge of ALASM's capabilities (with which,
I actually agree), but have not proven their worth in this matter.
Instead, they rather clumsily avoided the conversation. So...
From
Elena Tarasova
→
To
All
4 December 2006
Hello, SfS
SfS> Well, that’s not why... For x86x gcc also generates code, although there is such one
SfS> same discrepancy with the registers as on the Z80...
SfS>
At least in ia32 we can say that the available 7 registers are more or less
equal rights, with rare exceptions like 8-bit downloads and
multiplication-division.
> And in AVR the registers r0, r1-r15, r16-r25 and r26-r31 are far from
> are equal...
So what? There are 32 of them, and with all of them (absolutely all) 2-address logical
and arithmetic operations. Inequality is only in operations with constants and
16-bit pointers to memory.
From
Elena Tarasova
→
To
All
4 December 2006
Hello Vitamin
Vit> I’m talking about automated workstations because I work quite closely with it. And if
Vit> this simple fact did not occur to your bright head, it’s sad.
Vit>
Do you work with arm and therefore decided that gcc was sharpened for arm? Bravo, yours
Even blondes will envy the logic...
> PS. I owe you a favor! ;)
What are you talking about?
From
Raydac
→
To
All
21 December 2006
Hello Vitamin
Does anyone still have my PC110 C->Z80 Asm translator? what about me
Nostalgia started to torment me, could they send it to rrgforth.org.ru
From
Kamil Karimov
→
To
All
21 December 2006
Hello Raydac
Ray> does anyone still have my PC110 C->Z80 Asm translator?
Catch it in the mail.
From
deathsoft
→
To
All
31 December 2006
Hello, SfS
SfS> Why isn't this available for the Z80?
Because no one needs it. Nobody uses the Z80 in new developments,
That's why they don't make a port for gcc. gcc for example supports 68hc11, 68hc12 and
etc., although support for these controllers is more difficult than support for the Z80.
From
Dmitry Malychev
→
To
All
1 January 2007
Hello andrews
and> The disadvantage of C in relation specifically to the z80 is that it is not at all
and> stack percent in the sense that it has a rich set of registers and
and> operations with them that are known to C implementations explicitly
and> are underused... and because of this, the loss of major progs becomes more noticeable.
(offtopic) And the vaunted low-risk processor 6502 finally has complete darkness with Java, especially
compilers :p (/offtopic)
From
Kamil Karimov
→
To
All
1 January 2007
Hello Lethargeek
Let> (offtopic) And the vaunted low-risk processor 6502 finally has complete darkness with Java,
Let> especially compilers :p (/offtopic)
Controversial statement. For Comodore 64 there is ANSI C compatible CC64.
The same Contiki for C64 compiles perfectly with SDCC.