Is there any way to link an application programmed in TASM ASSEMBLY to a windows form application or any kind of GUI?
Thanks
You can create GUI applications in assembly for Windows, for Linux or for any other OS with graphical user interface.
You can create them even with TASM, although I am not sure how exactly this have to be done. Notice, that you will need version of TASM that supports 32bit/64bit protected mode instructions and also a linker that can link the object files produced by TASM into PE executable files (the executable format for Windows).
So, if you are not bound to TASM, there are much easier alternatives. Since the beginning of the 2000-th there are people actively programming in assembly for Windows and other 32bit platforms. The assemblers of choice are FASM, NASM and MASM32.
The first - FASM - is my favorite, because:
It can compile directly to executable files. Using linker is optional, only if you really need it.
The syntax of FASM is affected by TASM IDEAL mode syntax.
Compiles very fast, even huge projects - 500K loc source is compiled for 2..3 seconds.
Has very powerful macro preprocessor that makes things easy for the complex projects.
Supports programming for several OSes.
It is written in FASM and is self-compilable and self-sufficient. Because of that, FASM is very easy portable on new platforms is compiler of choice for OS developers. For example KolibriOS is fully written in assembly language and use FASM as an assembler.
FASM has very active and friendly community. It is in active development and every bug found disappears for hours.
GUI applications, written in assembly tend to be very small in size, with very responsive interface, fast and resource friendly.
As an example of such an application I can point you to my project Fresh IDE - it is an advanced Visual RAD IDE for FASM programming. It is very feature-rich, but the size of the executable is only 250kB.
At the end two code examples:
Very simple "Hello world" example using advanced FASM macro system:
include 'win32ax.inc'
.code
start:
invoke MessageBox,HWND_DESKTOP,"Hellow world!", "Hello!", MB_OK
invoke ExitProcess,0
.end start
More complex template application with main window:
; Template for program using standard Win32 headers
format PE GUI 4.0
entry start
include 'win32w.inc'
section '.text' code readable executable
start:
invoke GetModuleHandle,0
mov [wc.hInstance],eax
invoke LoadIcon,0,IDI_APPLICATION
mov [wc.hIcon],eax
invoke LoadCursor,0,IDC_ARROW
mov [wc.hCursor],eax
invoke RegisterClass,wc
test eax,eax
jz error
invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,256,192,NULL,NULL,[wc.hInstance],NULL
test eax,eax
jz error
msg_loop:
invoke GetMessage,msg,NULL,0,0
cmp eax,1
jb end_loop
jne msg_loop
invoke TranslateMessage,msg
invoke DispatchMessage,msg
jmp msg_loop
error:
invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK
end_loop:
invoke ExitProcess,[msg.wParam]
proc WindowProc uses ebx esi edi, hwnd,wmsg,wparam,lparam
cmp [wmsg],WM_DESTROY
je .wmdestroy
.defwndproc:
invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp .finish
.wmdestroy:
invoke PostQuitMessage,0
xor eax,eax
.finish:
ret
endp
section '.data' data readable writeable
_class TCHAR 'FASMWIN32',0
_title TCHAR 'Win32 program template',0
_error TCHAR 'Startup failed.',0
wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class
msg MSG
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL'
include 'api\kernel32.inc'
include 'api\user32.inc'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With