Author Topic: wcc32  (Read 43969 times)

Offline Manos

  • Jr. Member
  • *
  • Posts: 24
  • Country: gr
wcc32
« on: June 05, 2015, 12:22:22 PM »
Hi all.

I implemented a new plain ANSI  C optimizing compiler that supports C99
and targets on Windows 32 bit programming.
This compiler does not use any assembler as a backend, but supports
inline assembly in NASM syntax, emits NASM assembly code and
accepts NASM assembly source, also.
That is, with wcc32 you can mix c code and NASM assembly code
together to produces applications.

Since  wcc32 C compiler has the above attributes for NASM,
I thinked to do this post here.

Anyone who is interested, can download this from here.

Manos.
« Last Edit: June 05, 2015, 12:24:41 PM by Manos »

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: wcc32
« Reply #1 on: June 06, 2015, 03:13:28 PM »
Hello,

How can you not use assembler for produce opcodes ?

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: wcc32
« Reply #2 on: June 06, 2015, 04:20:21 PM »
Hello,

How can you not use assembler for produce opcodes ?

Well... assembler is an extra layer, like a separate thing.

He produces machine code directly while parsing C code.

At least, I think so.

P.S.

Try his "CoderStudio" it boots up in a fraction of the second (Hehe... F*** YOOOU Microsoft Visual Studio, we have Manos with CoderStudio),
only problem encountered - I was unable to compile dialog application source into exe.
« Last Edit: June 06, 2015, 04:23:57 PM by encryptor256 »
Encryptor256's Investigation \ Research Department.

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: wcc32
« Reply #3 on: June 06, 2015, 04:53:26 PM »
But, are we agree to say opcode is just a hard translation of mnemonic term to binary command, so finally, it needed to translate the high level command to the low level command.


PS: I use the Intel compiler for his performance and his asm production far better compared to some existent compiler even if they should take nasm syntax :p
« Last Edit: June 06, 2015, 04:58:27 PM by shaynox »

Offline Manos

  • Jr. Member
  • *
  • Posts: 24
  • Country: gr
Re: wcc32
« Reply #4 on: June 06, 2015, 06:16:35 PM »
Hi shaynox.

encryptor256 is right.

There is a table of OPCODE structures.
This structure has three members: operands, value and flags,(machine values), like:

OPCODE popn_aaa[] =
{
    {
        OP_CODEONLY, 0x0037, 0x0000
    }
    ,
    {
        0, 0, 0
    }
    ,
};
OPCODE popn_aad[] =
{
    {
        OP_CODEONLY, 0x0ad5, 0x0200
    }
    ,
    {
        0, 0, 0
    }
    ,
};
etc.

When the compiler writes the object code, use the above table.

To encryptor256:
CoderStudio has a bug that is easy to correct.
I 'll adapt CoderStudio to support wcc32 and wlink32 soon.
This is because I worked on wcc32, wlink32, header files, libraries and testing these,
for 6 months and for 5 hours  per day and with David Lindauer help.

Manos.


Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: wcc32
« Reply #5 on: June 06, 2015, 06:21:41 PM »
But aaa and aad are asm instruction, so you translate C code into asm code, but in streaming no ?

Offline Manos

  • Jr. Member
  • *
  • Posts: 24
  • Country: gr
Re: wcc32
« Reply #6 on: June 06, 2015, 06:37:26 PM »
But aaa and aad are asm instruction, so you translate C code into asm code, but in streaming no ?

Of cource, aaa and aad are asm instructions, but popn_aad and popn_aad
are symbols for the compiler.
The compiler first translates the C code in its symbols and then generate
either machine code directly or emits assembly code.

I think that MS C compiler does not use any assembler, also.

Manos.
« Last Edit: June 06, 2015, 06:40:17 PM by Manos »

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: wcc32
« Reply #7 on: June 06, 2015, 06:44:17 PM »
ok, well I guess others compilers need asm production, for the simply reason that we can get the asm file by -S (gcc) - /FAs (icl - ms compiler) and not other languages, I think.

And for the IDE, it crash when I try to create new project, i'm on win 8.1 x64
« Last Edit: June 06, 2015, 07:28:31 PM by shaynox »

Offline Manos

  • Jr. Member
  • *
  • Posts: 24
  • Country: gr
Re: wcc32
« Reply #8 on: June 06, 2015, 07:26:55 PM »
ok, well I guess others compilers need asm production, for the simply reason that we can get the asm file by -S (gcc) - /FAs (icl - ms compiler) and not other languages, I think.

If you wish, download my package from here.
You will find an example.
If you type: wcc32 /S Demo.c
wcc32 will emits assembly code, (NASM syntax), with C commented code, instead of object file.
Then you can assembly this code using NASM assembler.

Manos.

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: wcc32
« Reply #9 on: June 06, 2015, 07:38:36 PM »
Very interesting, like that I will able to easier translate C code in nasm.

What is __imp__ prefix in function's name ? icl do that too

Will you support c++ too ?

PS: I try to assemble the asm produce by your compiler.

So I have a problem about entry point, when I try to assemble the obj file, I don't know what is the entry point so I searched and found _WinMain@16 into asm/obj produce, but GoLink don't found (Specified entry point (_WinMain) was not found.)

Else linking with wlink32 work perfectly.

I have a lot of warning, but two kind of demo.c when I try to assemble it with nasm:
- 1018: warning: label alone on a line without a colon might be in error:
Code: [Select]
L_56
DB "Demo"
DB 00H

- 892: warning: uninitialised space declared in non-BSS section `.data': zeroing:
Code: [Select]
RESB 04H
« Last Edit: June 06, 2015, 08:28:59 PM by shaynox »

Offline Manos

  • Jr. Member
  • *
  • Posts: 24
  • Country: gr
Re: wcc32
« Reply #10 on: June 06, 2015, 08:58:35 PM »
What is __imp__ prefix in function's name ? icl do that too
This __imp__ prefix resolves directly to the Import Adress Table entry, rather than to the JMP stub.

Quote
Will you support c++ too ?
No. I program for many years in C++, but I prefer plain C.
If you are interested for C++, in my forum there is the LADSoft Orange C/C++ compiler.

Quote
PS: I try to assemble the asm produce by your compiler.

So I have a problem about entry point, when I try to assemble the obj file, I don't know what is the entry point so I searched and found _WinMain@16 into asm/obj produce, but GoLink don't found (Specified entry point (_WinMain) was not found.)

Else linking with wlink32 work perfectly.

My Demo.c is for a GUI application and wlink32 has that option by default.
In other linkers you should add the switch: /SUBSYSTEM:WINDOWS
Also, if you take unresolved external symbols,  in linker command line
you should add: msvcrt.lib

Quote
I have a lot of warning, but two kind of demo.c when I try to assemble it with nasm:
- 1018: warning: label alone on a line without a colon might be in error:
Code: [Select]
L_56
DB "Demo"
DB 00H

- 892: warning: uninitialised space declared in non-BSS section `.data': zeroing:
Code: [Select]
RESB 04H

I 'll fix this very soon.
But, since this forum is for discussion about NASM,
I don't have the right to discuss here about my package.
There is my own forum for this work here.

Manos.
« Last Edit: June 06, 2015, 09:01:46 PM by Manos »

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: wcc32
« Reply #11 on: June 06, 2015, 09:01:33 PM »
ok, and for configure golink (default window app, but it's not important, cause I have success to build window through console application with golink and icl), I have already write good parameters:

Code: [Select]
/entry _WinMain 1.ASM/test/source.obj C:\Windows\System32\kernel32.dll C:\Windows\System32\user32.dll C:\Windows\System32\gdi32.dll C:\Windows\System32\msvcrt.dll C:\Windows\System32\Comctl32.dll

except the entry name.
« Last Edit: June 06, 2015, 09:05:48 PM by shaynox »

Offline Manos

  • Jr. Member
  • *
  • Posts: 24
  • Country: gr
Re: wcc32
« Reply #12 on: July 04, 2015, 09:26:49 AM »
New version of wcc32.

Now wcc32 emits correct  NASM code.
Anyone can download without registration.

Manos.

Offline Emil_halim

  • Jr. Member
  • *
  • Posts: 4
Re: wcc32
« Reply #13 on: October 29, 2018, 10:26:51 AM »
Hi all

Is aby one has the source of wcc32 , the link is not found.

thanks.

Offline Manos

  • Jr. Member
  • *
  • Posts: 24
  • Country: gr
Re: wcc32
« Reply #14 on: October 29, 2018, 11:04:18 AM »