flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Madis731 01 Aug 2008, 17:16
I don't understand your request.
It compiles, shows: "arr1arr2arr3arr4", "arr2arr3arr4", "arr3arr4", "arr4". Everything is normal!? What did you expect? If you are worried about the non-exiting program, then you must know that Windows wants ExitProcess on process exit. And if you need the arrays to be separated, then you must space them with NULL-chars. All is in the following code: Code: format PE GUI 4.0 include 'win32ax.inc' section '.data' readable writable array rb 20 section '.code' code executable .start: mov dword [array], 'arr1' mov dword [array+5d], 'arr2' mov dword [array+10d],'arr3' mov dword [array+15d],'arr4' invoke MessageBox, 0, (array), 0, 0 invoke MessageBox, 0, (array+5d), 0, 0 invoke MessageBox, 0, (array+10d),0, 0 invoke MessageBox, 0, (array+15d),0, 0 invoke ExitProcess,0 .end .start Displays "arr1", "arr2", "arr3", "arr4" and exits. |
|||
![]() |
|
illuz1oN 01 Aug 2008, 17:31
no, i dont mean like that.
although it is better... i mean like example: the array has 5 slots. each slot holds "Array#" # = array slot number and then you can access the array like, mov eax, dword [array+1d] ^ probably wrong syntax for the mov, but the array+1d will access the first slot, [array+5d] the fifth slot, etc? i hope its possible >.< |
|||
![]() |
|
okasvi 01 Aug 2008, 18:41
Code: include 'win32ax.inc' array rd 4 main: mov [array], 'ar0' mov [array+4], 'ar1' mov [array+8], 'ar2' mov [array+12], 'ar3' invoke MessageBox, 0, array, 0, 0 invoke MessageBox, 0, array+4, 0, 0 invoke MessageBox, 0, array+8, 0, 0 invoke MessageBox, 0, array+12, 0, 0 invoke ExitProcess, 0 .end main Code: include 'win32ax.inc' str0 db 'Array0',0 str1 db 'Array1',0 str2 db 'Array2',0 str3 db 'Array3',0 array rd 4 main: mov [array], str0 mov [array+4], str1 mov [array+8], str2 mov [array+12], str3 invoke MessageBox, 0, [array], 0, 0 invoke MessageBox, 0, [array+4], 0, 0 invoke MessageBox, 0, [array+8], 0, 0 invoke MessageBox, 0, [array+12], 0, 0 invoke ExitProcess, 0 .end main Does either of these do it the way you want? |
|||
![]() |
|
illuz1oN 01 Aug 2008, 18:53
Yeah, thanks!
the second one is great ![]() |
|||
![]() |
|
asmcoder 01 Aug 2008, 19:22
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:56; edited 1 time in total |
|||
![]() |
|
illuz1oN 01 Aug 2008, 20:53
asmcoder, please post your version if you disagree with okasvi's, but until then -> im using okasvi's method, as its working perfectly for me.
|
|||
![]() |
|
asmcoder 02 Aug 2008, 09:42
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:56; edited 1 time in total |
|||
![]() |
|
dxl 02 Aug 2008, 09:49
Strings of chars have to be null terminated.
() aren't needed i think It's not good to put buffers at start of a program 'cause if you dont allocate enough bytes for your buffer the code can be owerwritten. |
|||
![]() |
|
illuz1oN 02 Aug 2008, 10:09
asmcoder wrote: instead of that was his example, my situation is totally differnt. im looping through and adding it onto an array, but i still cant do it, as i dont have any registers free to be my counter. (i need it to be +4 each time, then ' mov dword [Array+counter], ebx ') Thanks for the help anyway guys, appreciate it! fasm rocks:) |
|||
![]() |
|
illuz1oN 02 Aug 2008, 11:23
sorry for the double post guys...
anyone know how to get another counter register? for some reason i can do ' mov dword [szArr+esi], ebx ' but no ' mov dword [szArr+ecx], ebx ' (probably wrong size or whatever, it just crashes anyway) but, esi, edx, ebx, are all being used. i've tried using al as a counter like so (its in a loop) Code: ... push esi ;save it from earlier use xor esi, esi mov byte [esi], al ;esi has number mov dword [szArr+esi], ebx ;append onto array add al, 4 pop esi ... but that too has no effect... really confusing me.. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.