Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:multiasm:exercisesbook:pc:sut:scenarios:win1 [2026/05/22 14:04] – created ktokarzen:multiasm:exercisesbook:pc:sut:scenarios:win1 [2026/05/22 15:14] (current) ktokarz
Line 1: Line 1:
 ====== Scenario x64_1: Hello World! ====== ====== Scenario x64_1: Hello World! ======
 +** Prerequisites **\\
 +Be familiar with the "Programming in Assembler for x64" chapter, where an introduction to writing assembler programs for the Windows OS is presented. Have the programming tools configured and ready.
 +
 +** Scenario **\\
 +First, a Hello World type program written purely in assembler.
 +
 +** Result **\\
 +The "Hello World!" text is displayed in a console.
 +
 +** Start **\\
 +Create a new assembler source file.
 +
 +** Step 1 **\\
 It will not be very surprising that the first code example will be the "Hello world!". This program uses three system functions: It will not be very surprising that the first code example will be the "Hello world!". This program uses three system functions:
   * GetStdHandle - returns the handle of the console window, which is the main window of our application.   * GetStdHandle - returns the handle of the console window, which is the main window of our application.
   * WriteConsole - displays the text in the console.   * WriteConsole - displays the text in the console.
   * ExitProcess - returns control to the operating system.   * ExitProcess - returns control to the operating system.
-The functions are implemented in a library file kernel32.lib, which is statically linked. We use the "includelib" directive to inform the linker where to search for functions. To inform the assembler about the names of functions, we declare them with the set of "extern" directives.+The functions are implemented in a library filekernel32.lib, which, in our case, is statically linked. We use the "includelib" directive to inform the linker where to search for functions. To inform the assembler about the names of functions, we declare them with the set of "extern" directives. 
 +<note info> 
 +Windows library functions can be used in a dynamic way by using dynamically linked libraries (DLLs). We will show this method in other scenarios. 
 +</note>
 The details of each statement of the program are explained in comments. The details of each statement of the program are explained in comments.
 <code asm> <code asm>
Line 49: Line 65:
  
 END                             ; end of source file</code> END                             ; end of source file</code>
 +
 +** Step 2 **\\
 +Assemble the program and observe results.
 +
 +** Result validation **\\
 +The program should print the "Hello World!" text in a console window.
 +
 +** If it does not assemble? **\\
 +Observe the messages passed by the assembler and linker programs. Refer to the documentation and instruction set. Be sure that all library files are accessible in the environment.
en/multiasm/exercisesbook/pc/sut/scenarios/win1.1779447873.txt.gz · Last modified: by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0