flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
shoorick 04 Aug 2009, 05:41
so, where is the question exactly? some tips:
1. Code: name1 db 16 dup(?) 2. Code: invoke StdIn,addr name1,10 mov [name1 + eax - 2],0 ; removing trailing 0Dh,0Ah invoke StdOut ,addr name1 invoke StdOut ,addr good 3.it is MASM, while here is FASM board ![]() 4. Code: endl db 00dh,00ah,0 |
|||
![]() |
|
HtLrR 04 Aug 2009, 12:20
Thank you for quick reply
if you can't see the picture ![]() this is a question I- write a console program that receive the name of the user then print it , like this : ![]() note that the program should take the name then print it followed by the sentence "is da best" . thanks it work now ![]() if you can explain this ![]() Code: mov [name1 + eax - 2],0 ; Sorry ...... ![]() |
|||
![]() |
|
shoorick 04 Aug 2009, 12:34
you said: "this my Answer" - with this i've supposed that you have wrote that code.
even if not it is working code and there is no need to be a genius to understand how does it work and what to change to get "is da best" there. do not mix "help" and "do it all instead of me" mov [name1 + eax - 2],0 - string after StdIn (eg. name) will have "end of line" in the end (two bytes 0Dh,0Ah). since StdIn returns entered striing length in eax, it is ease to cut off this eol (put "0" there) |
|||
![]() |
|
HtLrR 04 Aug 2009, 22:56
thanks for your help
![]() if you please what's the different between Code: name1 db 16 dup(?) and Code: name1 db ? ![]() |
|||
![]() |
|
shoorick 05 Aug 2009, 04:28
name1 db ? allocates one uninitialized byte
name1 db 16 dup(?) allocates 16 uninitialized bytes you need at least 10 to fit entered name (StdIn,10) the original code does not fails due to spare space between sections. if in original code name1 were followed with another data, it would be destroyed while entering name there |
|||
![]() |
|
HtLrR 06 Aug 2009, 11:04
Thanks shoorick
|
|||
![]() |
|
Pirata Derek 27 Aug 2009, 17:27
Also you can use the "Reserve" declaration:
Code: rb 10 ; reserve 10 uninizialized bytes rw 3 ; reserve 3 uninizialized words (3 x 2 btyes) rd 1 ; reserve 1 double word They have the same function as: Code: db 5 dup (?) ; equivalent to rb 5 Also if you put all the reserved data in the end of a section you can assemble a file smaller than you imagine!!! This program will be 1024 bytes... Code: ; Demonstration 1 Format PE GUI 5.0 entry start section '.code' code readable executable start: ret ; simply exit process JUNK rb 10000h ; the reserved INVISIBLE data But this one will be 66560 bytes! Code: ; Demonstration 2 Format PE GUI 5.0 entry start section '.code' code readable executable start: ret ; simply exit process JUNK rb 10000h var_1 db 0 ; this will increase the size to declare itself |
|||
![]() |
|
Fanael 27 Aug 2009, 18:11
Pirata, it won't even compile - look at first post, HtLrR is using MASM, not FASM (very stupid idea IMO).
|
|||
![]() |
|
Pirata Derek 27 Aug 2009, 18:31
Yes, you're right
![]() But it can always be a valid help for who don't know or doesn't use the Reserve declaration in fasm. There're much more people that can read that post and learn something from it. |
|||
![]() |
|
HtLrR 29 Aug 2009, 14:17
thanks Pirata Derek i will try to understand it
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.