flat assembler
Message board for the users of flat assembler.
Index
> Main > Please help and teach me :) |
Author |
|
revolution 08 Apr 2015, 09:08
The "hello World" source codes for various systems are already included in the fasm download. See the folder named "examples".
|
|||
08 Apr 2015, 09:08 |
|
CandyMan 08 Apr 2015, 15:16
the simplest examples
Code: org 100h mov bx,Hello call PrintStr mov byte [bx+12],'2' call PrintStr mov byte [bx+12],'3' PrintStr: mov ah,9 mov dx,bx int 21h ret Hello db 'Hello World 1',13,10,36 Code: org 100h call PrintStr call PrintInc PrintInc: inc byte [Hello+12] PrintStr: mov ah,9 mov dx,Hello int 21h ret Hello db 'Hello World 1',13,10,36 Code: org 100h mov cx,3 @@: mov ah,9 mov dx,Hello int 21h inc [Hello+12] loop @B ret Hello db 'Hello World 1',13,10,36 _________________ smaller is better |
|||
08 Apr 2015, 15:16 |
|
mastek 08 Apr 2015, 20:17
CandyMan wrote: the simplest examples @CandyMan thank you soo much. Can you show me 32 bit unreal mode and win32 window versions? |
|||
08 Apr 2015, 20:17 |
|
CandyMan 09 Apr 2015, 12:53
in 32-bit unreal mode sample is the same as real mode
see also: http://board.flatassembler.net/topic.php?p=134745#134745 http://board.flatassembler.net/topic.php?p=145936#145936 http://board.flatassembler.net/topic.php?p=104631#104631 _________________ smaller is better Last edited by CandyMan on 14 Apr 2015, 17:48; edited 1 time in total |
|||
09 Apr 2015, 12:53 |
|
mastek 10 Apr 2015, 12:50
CandyMan wrote: in 32-bit unreal mode sample is the same as real mode Thank you candyman. Time to work for me |
|||
10 Apr 2015, 12:50 |
|
El Tangas 24 May 2015, 23:05
Here is an example for windows command line:
Code: format PE console ;this is a command line program include 'win32ax.inc' ;load standard fasm macros for windows define \n 13,10 ;define newline as convenience for C programmers .code start: invoke GetStdHandle,STD_OUTPUT_HANDLE ;windows funtion that returns handle to STDOUT mov [handle],eax ;save handle invoke WriteFile,[handle],string1,str_len1,n_written,0 ;this windows functtion is similar to C "fwrite" invoke WriteFile,[handle],string2,str_len2,n_written,0 ;since we are not using printf formating anyway invoke WriteFile,[handle],string3,str_len3,n_written,0 ;there is a wsprintf function in windows if you really need it mov eax,0 ;these 2 lines are C "return 0;" ret .data string1 db "Hello, World!!! 1",\n str_len1 = $-string1 ;to calculate the lenght of the string string2 db "Hello, World!!! 2",\n str_len2 = $-string2 string3 db "Hello, World!!! 3",\n str_len3 = $-string3 n_written dd 0 ;we don't use this variable, but WriteFile requires it... handle dd 0 .end start ;.end is a very convenient standard fasm macro To get details on windows functions, you can check msdn. I used 3 strings instead of a dynamically modifying string like CandyMan did, for clearness. So, you can try to write the windows version of the modifying code as exercise BTW, I notice you registered here in 2006 lol, you post even less than me |
|||
24 May 2015, 23:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.