flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > High Level Languages > Flat C--

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
bazizmix



Joined: 15 Jan 2016
Posts: 23
Flat C--
Really flat.
FlatC-- Version 0.81 XAC(C)2017.
Based on ideas Peter Cellik & Tomasz Grysztar.
Usage: fc--.exe [/list] [/debug] <Source file>
/list << generate asm listing
/debug << generate .dd32 - debug info for x64dbg
Sorry, no documentation...


Description:
Download
Filename: fc--.zip
Filesize: 162.5 KB
Downloaded: 98 Time(s)

Post 30 Jan 2017, 19:07
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 323
Nice !
But how compile c examples ?

And what mean FlatC ?
Post 31 Jan 2017, 08:58
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23
Thanks!
Just enter in command line:
fc-- hello.c--
FlatC-- = Sphinx C-- language with FASM syntax inside
Produced exe has only one section - FlatC--
Post 31 Jan 2017, 12:39
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23
Re: Flat C--

Roman wrote:
But how compile c examples ?


Sorry for missunderstanding Sad
C example (if you mean JuliaWC02.c) there only for comparison with C--
Post 31 Jan 2017, 13:12
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
Hi bazizmix,

I liked SphinxC-- very much, and i was ,and still ,developing it. sooner i will release one.

why you choosed old SphinxC-- that created by Peter Cellik ?

there was a recent one that made by Michael Shecker , https://github.com/jossk/c--sphinx

by the way my avast refused to download yor zip , and detects a virus in it!!!!!!!!.
Post 09 Feb 2017, 19:19
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23
Hello Emil, it's a long story. I know about Sphinx C-- Michael. His desire to introduce elements of C ++ in C-- I consider superfluous ... My prototype is taken from 32.exe by XAC. Self hosted compiler without any other compilers...
Don't worry - all files in zip-archive clear from viruses. I checked by Kaspersky antivirus. It is possible your Avast found signatures similar real viruses in my exe files.
Post 09 Feb 2017, 19:42
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
Hi bazizmix,

my Avast still refuse to accept the zip file.

it says fc--.exe infection with Win32:Evo-gen[Susp]

BTW , with my developing , i have mixed SphinxC-- ,HJWasm , fasm , SmallerC , borland c++ 5.5 and alink . in one package by allowing SphinxC-- itself uses a plugin system , so any one can added a new features with out changed it.

there are tow plugins is considered as part of SphinxC-- it self, the macro.dll and linker.dll plugins.

the plugin "macro.dll" automatically takes order zero , so that it will be executed at the first , also the plugin "linker.dd" will be executed at the last.

each other plugin tells SphinxC-- in which order will be executed.

as i mentioned , i will release it sooner.
[/img]
Post 10 Feb 2017, 12:16
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14783
Location: Not in LAX

emil wrote:
my Avast still refuse to accept the zip file.

Time to kill your AV then. It is clearly not working for you. Rolling Eyes
Post 10 Feb 2017, 12:20
View user's profile Send private message Visit poster's website Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
Hi revolution,

sorry i dont get you well , please more clear.
Post 10 Feb 2017, 14:26
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14783
Location: Not in LAX
Delete/remove/uninstall Avast.
Post 10 Feb 2017, 15:52
View user's profile Send private message Visit poster's website Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
Hi bazizmix,

Is it will be open source or not?

finally i downloaded it , still testing , but how dll is linked with exe?

thanks.
Post 13 Feb 2017, 07:48
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23
Hi Emil,

Quote:

Is it will be open source or not?


not now - maybe later

Quote:

finally i downloaded it , still testing ,


Congratulations! Smile

Quote:

but how dll is linked with exe?


as well as any program that accesses dll-file
Post 13 Feb 2017, 12:15
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
sorry , i was not clear enough, i meant that how fc-- in linking stage will linke the dll?

consider c language , we feed the .lib file to the linker so that it will know about the functions contained in dll.

is fc-- support fasm preprocessor ?

when declare a string variable why there is not "=" as we do for any other assignment ?
Post 13 Feb 2017, 14:20
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23

emil wrote:
sorry , i was not clear enough, i meant that how fc-- in linking stage will linke the dll?

consider c language , we feed the .lib file to the linker so that it will know about the functions contained in dll.
?


This is done so as in fasm, without using a linker.

Quote:

is fc-- support fasm preprocessor ?
?


No

Quote:

when declare a string variable why there is not "=" as we do for any other assignment ?


This is litle similar to the assembler: <type> <label> <string>;
Sign = used for multiple initializations:
byte regs={"al","cl","dl"};
Post 13 Feb 2017, 15:43
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
Hi bazizmix,

what dose docase keyword do ?

is there any progress in fc-- ?

when the local variables will be inside any function body , just like modern c?
Post 17 Feb 2017, 15:50
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23

Quote:
what dose docase keyword do ?


same as if..elsif..endif in some languages.

Quote:
is there any progress in fc-- ?


slowly

Quote:
when the local variables will be inside any function body , just like modern c?


Not soon
Post 17 Feb 2017, 16:18
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
fc-- crashes when using this line


Code:

#import "msvcrt.dll"


Post 17 Feb 2017, 19:11
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23
I have no problems with this dll-file
Post 17 Feb 2017, 21:36
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 70
Location: egypt
ok here is the source and fc-- output when craching.


Code:

#list
#debug
#import "kernel32.dll"
#import "user32.dll"
#import "msvcrt.dll"

#define wsprintf wsprintfA
dword handle;
word w;
void main(){
handle=GetStdHandle(-11);
esi=5; w=3;
docase{
   case(esi>1&&w<=3){
      print("esi",esi); esi--; continue;
   }
   case(w>0){
      print("w"w); w--; continue;
   }
   default{
      print("That's all!!!",-1);
   }
}
//system("pause");
ExitProcess();
}
byte mapstr[80];
void print(dword txt,dig){
wsprintf(#mapstr,"%s=%d\n",txt,dig); esp+=16;
WriteFile(handle,#mapstr,strlen(#mapstr),#dWriteFileCount,0);
}
void strlen(dword s){
   push esi;
   esi=s;
   pxor    mm0mm0;
@compare_64:
   movq    mm1qword [esi]; esi+=8;
   pcmpeqb mm1mm0;
   pmovmskb eaxmm1;
   bsf     eaxeax;
   jz     @compare_64;
   lea     eax, [esi-8+eax];
   eax-=s;
   pop esi;
}




and here is the output

Quote:

FlatC-- Version 0.81 XAC(C)2017.
Based on ideas Peter Cellik & Tomasz Grysztar.
Compiling ...

// docase.c-- 46:
###Error: unuseable input: tok=06D.

// docase.c-- 46:
###Error: unuseable input: tok=055.

// docase.c-- 46:
###Error: unuseable input: tok=060.

// docase.c-- 46:
###Error: unuseable input: tok=033.

// docase.c-- 46:
###Error: unuseable input: tok=003.

// docase.c-- 46:
###Error: unuseable input: tok=05A.

// docase.c-- 46:
###Error: unuseable input: tok=070.

// docase.c-- 46:
###Error: unuseable input: tok=074.

// docase.c-- 46:
###Error: unuseable input: tok=05B.

// docase.c-- 46:
###Error: unuseable input: tok=074.

// docase.c-- 46:
###Error: unuseable input: tok=05A.

Post 18 Feb 2017, 14:15
View user's profile Send private message Reply with quote
bazizmix



Joined: 15 Jan 2016
Posts: 23
In msvcrt.dll we already have function strlen. You should rename or comment this function in example.
Post 18 Feb 2017, 22:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.