Specialised Projects > Compiler Based Assembler

NewSphinxCmm

(1/5) > >>

Emil_halim:
Hi all,

  Just want you to know that , I released the beta version of NewSphinxCmm.

 here is the site , check it out and do not miss it.
   
 http://newsphinxcmm.webs.com
         
 Enjoy the power of NewSphinxCmm.

Emil_halim:
   The NewSphinxCmm is a mixing of SphinxC-- ,HJWasm , fasm , fasmg ,SmallerC , borland c++ 6.0 and alink  in one package.

So SphinxC-- ,HJWasm , fasm   always compile to Coff object file,  borland c 6.0 always compile to OMF object file  , then linked later by alink linker.

fasmg , SmallerC  always compile to asm code that inserted into SphinxC code.

also SmallerC  compiles to masm code.

see my following Examples to got it well.

Emil_halim:
Hi All,

Here is the first Example that mix SphinxC and HJWasm.

some roles you have to care of.

1- masm block of code must started with term '^^' and end with the same term.
2- masm bolck will extract from sphinxc then compile and later linked with alink.
3- this process will accomplished by MasmPlgIn , you have not use the cpu directive.
4- MasmPlgIn will specify tha path of include directory.
5- take care of function call convention , it may crash your code.


the next masm code was taken from http://www.masmforum.com/board/index.php?topic=14696.105
it determines the cpu of computer.
 

--- Code: ---/*************************************
*         New Sphinx Cmm             * 
*                                    *
*           masm test                *
*                                    *
*         by Emil_halim              *         
*                                    *
*************************************/

#pragma option w32c       //create Windows console EXE.
#pragma option OS         //speed optimization

#pragma option dbg
#pragma option lst

#Entry  main
#includelib  win32.lib MSVCRT.lib ole32.lib

// $ will replaced with SphinxC-- main path
#includepath "$\winlib" 
 
#include <windows.h> 
#include <MSVCRT.H-->

// tells SphinxC about masm ShowCpu function
extern stdcall ShowCpu(dword v);

^^ //start of Masm code
.nolist
include masm32rt.inc

include m32lib/dwtoa.asm
include m32lib/stdout.asm

.code
;//  masm code taken from the next link
;//  http://www.masmforum.com/board/index.php?topic=14696.105
ShowCpu proc stdcall ; mode:DWORD
COMMENT @ Usage:
  push 0, call ShowCpu ; simple, no printing, just returns SSE level
  push 1, call ShowCpu ; prints the brand string and returns SSE level @
 
  pushad
  sub esp, 80     ; create a buffer for the brand string
  mov edi, esp ; point edi to it
  xor ebp, ebp
  .Repeat
  lea eax, [ebp+80000002h]
db 0Fh, 0A2h ; cpuid 80000002h-80000004h
stosd
mov eax, ebx
stosd
mov eax, ecx
stosd
mov eax, edx
stosd
inc ebp
  .Until ebp>=3
  push 1
  pop eax
  db 0Fh, 0A2h ; cpuid 1
  xor ebx, ebx ; CpuSSE
  xor esi, esi ; add zero plus the carry flag
  bt edx, 25 ; edx bit 25, SSE1
  adc ebx, esi
  bt edx, 26 ; edx bit 26, SSE2
  adc ebx, esi
  bt ecx, esi ; ecx bit 0, SSE3
  adc ebx, esi
  bt ecx, 9 ; ecx bit 9, SSE4
  adc ebx, esi
  dec dword ptr [esp+4+32+80] ; dec mode in stack
  .if Zero?
mov edi, esp ; restore pointer to brand string
  .Repeat
.Break .if byte ptr [edi]!=32 ; mode was 1, so show a string but skip leading blanks
inc edi
.Until 0
.if byte ptr [edi]<32
print chr$("pre-P4")
.else
print edi ; CpuBrand
.endif
.if ebx
print chr$(32, 40, "SSE") ; info on SSE level, 40=(
print str$(ebx), 41, 13, 10 ; 41=)
.endif
  .endif
  add esp, 80 ; discard brand buffer (after printing!)
  mov [esp+32-4], ebx ; move ebx into eax stack position - returns eax to main for further use
  popad
  ret 4
ShowCpu endp

^^ //End of Masm code


;//***********************************************************************************//


main()
{
   ShowCpu(1); // print brand string and SSE level
     
   system("pause");   
 
}

--- End code ---

Vortex:
Hi Emil,

The compiler does not work on Windows XP SP3 :


--- Quote ---c--.exe is not a valid win32 application
--- End quote ---

Tested on XP 32-bit and 64-bit, the result is the same.

The old version 0.239 from narod.ru works fine on XP :

http://c--sphinx.narod.ru/indexe.htm


--- Quote ---NewSphinxCmm is the opensource code of C-- . ported to MSVC2012
--- End quote ---

VC++ 2012 does not support WinXP.  Any chance to rebuild the project with VC2010 Express?

Emil_halim:
Hi Vortex,

I am afraid , i have no machine with MSVC2010.

i have an idea , does MSVC2010 linker can link obj file that done by MSVC2012.

also my problem is how to import MSVC2012 project to codeblocks , so i can rebuild it with any another compiler?

Navigation

[0] Message Index

[#] Next page

Go to full version