Dear All,
hello,
i have Windows 7, 64-bit, in my computer, and do not have Linux, at present. this is why i downloaded Euroasm assembler developed for Windows 64-bit operating systems.
i am a beginner in learning Euroasm. i looked in Manual presented on the Internet-site of Euroasm, and have impression, that Euroasm is very powerful Assembler (or, software) for Windows (64-bit) OS, and that can have access to the internal Windows functions (let's, say, C/C++-like functions, similar to those presented in windows.h) - is that true ?
i have very little experience in programming in 16-bit MASM fro DOS. for this reason, it would be easier for me to understand Euroasm Assembler based on some knwoledge of 16-bit MASM for DOS, at present.
can anyone in the Forum recommend me a comprehensive (!!!), and detailed (!!!) Tutorials in Euroasm Assembler, including an explantion of the syntaxes (!!!) of Euroasm, that is how to write codes in Euroasm, explanation of interruts (of course, if they exist), how to call, and even how to write (for oneself) functions, procedures, libraries, and, even, complicated projects, thaat consist of multiple files, etc.
to be certain, i present the MASM (16-bit, DOS) code, below, as an example,
-------------------------------------
cseg1 segment
org 100h
Begin:
mov ah,9
mov dx,offset Message1
int 21h
int 20h
Message1 db 'Hello, World !$'
cseg1 ends
end Begin
-------------------------------------
and, for example, the question is - how to write (to transfer to) that code, using Euroasm Assembler syntaxes, for the case of Windows 64 bit operating system ?
Thank you.
detailed Tutorial in Euroasm
- vitsoft
- Site Admin
- Posts: 51
- Joined: 04 Nov 2017 20:08
- Location: Vítkov, The Czech Republic
- Contact:
Re: detailed Tutorial in Euroasm
Welcome to the exciting world of assembler, ialmiew1!
Syntax of plain assembler (machine instruction) is almost identical in MASM, TASM, FASM, GoASM, NASM, €ASM. Only special directives (pseudoinstructions) are different. You can search for their explanation at Index page of €ASM site.
Source program in €ASM usually begins with pseudoinstruction EUROASM, which specifies options and directives known from other assemblers, for instance CPU=386 or CPU=X64
and its instructions should be wrapped between pseudoinstructions PROGRAM and ENDPROGRAM.
I tried to rewrite your example for €ASM:
This should create "hello16.com" which you can try to run in DosBox.
The same program can also be elegantly written using €ASM macroinstructions defined in macrolibrary dosapi.htm:
You will need to use debuggers to find errors in your programs. I prefer TurboDebugger TD.EXE for 16bit programs (in DosBox), OllyDebugger for 32bit programs, and x64dbg for 64bit programs.
Of course, you can use any of functions defined in Windows API and link other functions from dynamic or static object libraries, if you have documentation to them.
No tutorial specialized to EuroAssembler exists at the moment, I'm afraid, but there's lot of other assembly tutorials, see Links.ialmiev1 wrote: can anyone in the Forum recommend me a comprehensive (!!!), and detailed (!!!) Tutorials in Euroasm Assembler, including an explantion of the syntaxes (!!!) of Euroasm,
Syntax of plain assembler (machine instruction) is almost identical in MASM, TASM, FASM, GoASM, NASM, €ASM. Only special directives (pseudoinstructions) are different. You can search for their explanation at Index page of €ASM site.
Source program in €ASM usually begins with pseudoinstruction EUROASM, which specifies options and directives known from other assemblers, for instance CPU=386 or CPU=X64
and its instructions should be wrapped between pseudoinstructions PROGRAM and ENDPROGRAM.
I tried to rewrite your example for €ASM:
;cseg1 segment ; €ASM syntax is [cseg1] segment, but you don't have to bother with segments and sections in TINY and FLAT memory model. ;org 100h ; €ASM syntax is $ EQU 100h, but this statement is not necessary in program format COM. €ASM automaticly assumes the entry at 100h in COM format. ;Begin: ; Thats OK but unnecessary, because €ASM knows that the program entry is always at 100h in COM format. mov ah,9 ; Thats OK. mov dx,offset Message1 ; €ASM syntax is mov dx,Message1 or mov dx,offset# Message1. int 21h ; Thats OK. int 20h ; Thats OK, can be replaced with instruction RET in COM format or with macro TerminateProgram. Message1 db 'Hello, World !$' ; Thats OK, we dont have to switch to DATA sections, €ASM does it implicitly. ;cseg1 ends ; Segments are never explicitly terminated in €ASM, this statement should be omitted. ;end Begin ; End of program is signalized with directive endprogram ; and the entry point can be specified with directive program entry=Begin, but it is not necessary in COM format.Your program rewritten to EuroAssembler might look like this:
hello16 PROGRAM Format=COM ; This specifies that we want to create DOS 16bit TINY program "hello16.com". mov ah,9 mov dx,Message1 int 21h ; DOS service WRITE STRING TO STANDARD OUTPUT int 20h ; DOS service TERMINATE PROGRAM Message1 db 'Hello, World !$' ENDPROGRAMSave this text as "hello16.asm" and assemble with euroasm hello16.asm.
This should create "hello16.com" which you can try to run in DosBox.
The same program can also be elegantly written using €ASM macroinstructions defined in macrolibrary dosapi.htm:
hello16 PROGRAM Format=COM INCLUDE dosapi.htm StdOutput Message1 TerminateProgram Message1 db 'Hello, World of 16bit DOS!',13,10,0 ENDPROGRAMWhen you want to program for Windows, it will look very similar, you need only to include different macrolibrary:
hello32 PROGRAM Format=PE, ENTRY=Begin INCLUDE winapi.htm Begin: NOP ; Begin with any machine instruction, so €ASM knows to autoswitch to code segment. StdOutput Message1 TerminateProgram Message1 db 'Hello, World of 32bit Windows!',13,10,0 endprogramSwitching to 64bit is easy, because all differences in WinAPI/WinABI invokations are hidden in the macros with identical names:
hello64 PROGRAM Format=PE, ENTRY=Begin, CPU=X64 ; Allow to use 64bit CPU instructions. INCLUDE winabi.htm Begin: NOP ; Begin with any machine instruction, so €ASM knows to autoswitch to code segment. StdOutput Message1 TerminateProgram Message1 db 'Hello, World of 64bit Windows!',13,10,0 endprogramI would recommend to forget obsolete 16bit programs for DOS and write 32bit programs for MS Windows instead, its easier. There are some sample programs in prowin32 folder, for instance cpmix32.htm (console application) or skelet32.htm (skeleton of graphic window application).
You will need to use debuggers to find errors in your programs. I prefer TurboDebugger TD.EXE for 16bit programs (in DosBox), OllyDebugger for 32bit programs, and x64dbg for 64bit programs.
EuroAssembler itself is a complicated project which consists of multiple files.ialmiev1 wrote: how to write (for oneself) functions, procedures, libraries, and, even, complicated projects, that consist of multiple files, etc.
Re: detailed Tutorial in Euroasm
Dear Vitsoft,
děkuji za vaši zprávu, podrobné vysvětlení mých jednoduchých otázek a cenné rady.
> When you want to program for Windows, it will look very similar, you need only to include different macrolibrary ...
> ... using €ASM macroinstructions ...
ok, intuitivně vám rozumím. to znamená, že všechny příkazy assembleru (instrukce) (např. mov, add, sub, offset atd.) jsou v makroinstrukcích Euroassembleru (např. StdOutput, TerminateProgram, endprogram, NOP, formát hello64 PROGRAM = PE, ENTRY = Begin, CPU = X64 a podobně, atd.).
> I would recommend to forget obsolete (zastaralý) 16bit programs for DOS and write 32bit programs for MS Windows instead, its easier ...
pokud vám rozumím správně, pak byste chtěli říci, že nemusíte používat styl nebo syntaxi nebo „slovník“ Assembleru, který přišel (styl, slovní zásoba) z DOS, tj. příkazy assembleru, které jsou blíže a podrobněji popisují stroj (radio- a mikro-elektronické) příkazy procesoru (nebo procesory). Místo toho doporučujeme zejména „hrát“ (studovat, programovat, experimentovat) pomocí zjednodušených (!!!) příkazů (nebo, řekněme, makro příkazů nebo makro instrukcí apod.), Které byly napsány ( naprogramováno) pro operační systémy Windows 32-bit a 64-bit.
Rozumím Vám správně ?
Ještě jednou děkuji za vaši odpověď.
děkuji za vaši zprávu, podrobné vysvětlení mých jednoduchých otázek a cenné rady.
> When you want to program for Windows, it will look very similar, you need only to include different macrolibrary ...
> ... using €ASM macroinstructions ...
ok, intuitivně vám rozumím. to znamená, že všechny příkazy assembleru (instrukce) (např. mov, add, sub, offset atd.) jsou v makroinstrukcích Euroassembleru (např. StdOutput, TerminateProgram, endprogram, NOP, formát hello64 PROGRAM = PE, ENTRY = Begin, CPU = X64 a podobně, atd.).
> I would recommend to forget obsolete (zastaralý) 16bit programs for DOS and write 32bit programs for MS Windows instead, its easier ...
pokud vám rozumím správně, pak byste chtěli říci, že nemusíte používat styl nebo syntaxi nebo „slovník“ Assembleru, který přišel (styl, slovní zásoba) z DOS, tj. příkazy assembleru, které jsou blíže a podrobněji popisují stroj (radio- a mikro-elektronické) příkazy procesoru (nebo procesory). Místo toho doporučujeme zejména „hrát“ (studovat, programovat, experimentovat) pomocí zjednodušených (!!!) příkazů (nebo, řekněme, makro příkazů nebo makro instrukcí apod.), Které byly napsány ( naprogramováno) pro operační systémy Windows 32-bit a 64-bit.
Rozumím Vám správně ?
Ještě jednou děkuji za vaši odpověď.
- vitsoft
- Site Admin
- Posts: 51
- Joined: 04 Nov 2017 20:08
- Location: Vítkov, The Czech Republic
- Contact:
Re: detailed Tutorial in Euroasm
I'm afraid not. Neither do I understand your response when it was mechanically translated to Czech language, please let's stick by English.
Machine instructions MOV, ADD, CALL etc are the same as in most other assemblers, you can use Intel manuals or any tutorial of your choice.
Macroinstructions are specific to EuroAssembler, they encapsulate the most common tasks, such as how to read or write to console, convert numeric digits to a binary number and vice versa, terminate the program. Macrolibraries, where those macros are stored, have different names depending on the OS (dosapi, winapi, linapi) but names of macros in them (StdInput, StdOutput, LodD, StoD, TerminateProgram etc) are almost identical.
Thanks to this, beginners in assembly language doesn't have to struggle with OS functions and calling conventions when they want to write something on the screen, and they can concentrate to the actual assembly task, for instance to make some calculation with numbers obtained from the user.
Look at my recommendation at the bottom of sample projects.
Who is online
Users browsing this forum: No registered users and 2 guests