flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bazizmix
This is the next step from FlatC-- (https://board.flatassembler.net/topic.php?t=19700)
and FlatC- (https://board.flatassembler.net/topic.php?t=20153). Flat assembler used as backend. Practically identical to standard C. Additions: 1) Directive #debug - output debug in x64dbg format (dd32 or dd64) 2) Directive #gui - compiling in windows gui format (default is console format) 3) Directive #dll - compiling in DLL format 4) Directive #elf - format ELF for Linux 5) The asm operator may have a list of used variables - asm (var1, var2, ...) {...} if variables are not used anywhere else. See in test.c example the strlen() function. Command line: Usage: fc.exe [/ 64] [/ debug] <source> / 64 generate 64-bit program / debug generate debug info for x64dbg (by default - generate 32-bit program) Look results from tst.bat and tst64.bat
|
|||||||||||
![]() |
|
Roman
Wow ! Output asm code from c code ! Super-druper-amazing !
SSE\AVX support ? |
|||
![]() |
|
Roman
I mean this:
_mm_shuffle_ps like in c++ And support this includes: <xmmintrin.h> SSE <emmintrin.h> SSE2 <pmmintrin.h> SSE3 <tmmintrin.h> SSSE3 <smmintrin.h> SSE4.1 <nmmintrin.h> SSE4.2 Last edited by Roman on 20 Jan 2019, 21:40; edited 1 time in total |
|||
![]() |
|
Roman
What is the code size limit ?
|
|||
![]() |
|
bazizmix
Quote:
No Quote:
I suppose - limit is the same as in fasm1 |
|||
![]() |
|
Roman
I found error.
float x = 55.0f + CamX; float z = 55.0f - CamZ; x /= 6.327272f; miss in asm code ! x = x / 6.327272f; miss in asm code ! z /= 6.327272f; miss in asm code ! z = z / 6.327272f; miss in asm code ! This code correct in asm code. float x = (55.0f + CamX) / 6.327272f; float z = (55.0f - CamZ) / 6.327272f; C flat get asm code: comiss xmm1,dword [xmm4] Fasm error ! Must be comiss xmm1,xmm4 ! |
|||
![]() |
|
Roman
C flat get asm code from my example:
comiss xmm0,dword[xmm6] Fasm error ! Must be comiss xmm0,xmm6 ! Code: // Simple windows gui program #debug #gui #include "kernel32.h" #include "user32.h" #include "msvcrt.h" char *msg = "Hi! I'm the example " #ifdef _WIN64 "64" #else "32" #endif "-bit program!"; float floorf (float wx) { asm{ roundss xmm1,[wx],9 movss [wx],xmm1 } return wx; } //float lerpA(float a,float b,float t){ return a-(a*t)+(b*t); } float Lerp(float a,float b,float t){ return (b*t); } typedef struct vec4 { float x; float y; float z; float w; } vec4; void main(){ float fir = 4; vec4 dif = {11,2,3,5}; dif.x += fir; dif.y += fir; dif.z += fir; dif.w += fir; float height; float LvlSize = 110.0f; float CamX = 50.0f; float CamZ = 50.0f; float x = (55.0f + CamX) / 6.327272f; float z = (55.0f - CamZ) / 6.327272f; float col = floorf(x); float row = floorf(z); float A = 1.0f; float B = 2.0f; float C = 3.0f; float D = 4.0f; float dx = x - col; float dz = z - row; if(dz < 1.0f - dx) { float uy = B - A; float vy = C - A; height = A + Lerp(0.0f, uy, dx) + Lerp(0.0f, vy, dz); } else { float uy = C - D; float vy = B - D; height = D + Lerp(0.0f,uy,1.0f - dx) + Lerp(0.0f, vy, 1.0f - dz); } char rrt[100]; char *tname = "result: %1.4f"; sprintf(rrt,tname,height); MessageBox(HWND_DESKTOP,rrt,MB_OK,MB_OK); ExitProcess(0); } |
|||
![]() |
|
bazizmix
Sorry for the delay, Roman. Here is a new version with bug fixes. Thanks for the feedback.
|
|||||||||||
![]() |
|
Roman
Thanks.
|
|||
![]() |
|
edfed
hello, is there any ".zip" with all ready to go package? (fc.exe, fasm.dll, includes, ...)
or at least, where to find the windows.h needed in the example? |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2019, Tomasz Grysztar.
Powered by rwasa.