flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Auto size value.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1719
Roman 12 Jul 2023, 17:54
Fasmw 1.73
How do this ?
Code:
macro A v,[s] { }
a val,10       ;val size dd
a val,10,20  ;val size increased to qword
a val,10,20,30,40  ;val size set dqword. This is maximum for this case

val dd 0 ;in this place we needed auto resize val
    

Using dd val.size dup(0) ?
And in macro A resize val.size equ 1 or val.size equ 2
Post 12 Jul 2023, 17:54
View user's profile Send private message Reply with quote
Dima1205



Joined: 02 Jul 2023
Posts: 23
Location: Russian, Moscow
Dima1205 13 Jul 2023, 12:38
Hello, I write this struc macro on this question.
https://board.flatassembler.net/topic.php?t=22823
Post 13 Jul 2023, 12:38
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1719
Roman 14 Jul 2023, 09:28
Code:
macro mvalz a,[p] {
      common
      ii = 0
      forward
      mov [a+ii*4],p
      ii = ii+1
    define  a#.sz  ii

      }
 
                mov     eax,valff
                mvalz   valff,1,2,3,4,5,6,7   ;after this valff.sz = 7
;problem jmp @f jump incorrect addres if   valff.sz >1 !
jmp @f+valff.sz*4-4
    if ~definite valff.sz | @f
    valff.sz = 1
    end if
    valff dd valff.sz dup (0)
@@:
;in this place asm code corrupted if  valff.sz >1 !
align valff.sz*4+4   ;not help
   mov eax,1   ;corrupted
   mov edx,2   ;corrupted
   mov ecx,3   ;corrupted
   mov esi,5    ;corrupted
    
Post 14 Jul 2023, 09:28
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1719
Roman 14 Jul 2023, 18:49
variant using malloc and put ptr to valff dd 0
Post 14 Jul 2023, 18:49
View user's profile Send private message Reply with quote
Dima1205



Joined: 02 Jul 2023
Posts: 23
Location: Russian, Moscow
Dima1205 14 Jul 2023, 21:33
https://board.flatassembler.net/topic.php?t=22832 -
ru= Попробуй посмотреть, там malloc тянется для Win32 из CRTDLL.DLL (есть даже в Win32s пакете и Windows NT 3.1). Для Windows 64 тянется сразу msvcrt.dll в секцию импорта.
en= Try to see if malloc is pulled for Win32 from CRTDLL.DLL (there is even in the Win32s package and Windows NT 3.1). For Windows 64, msvcrt.dll immediately drags into the import section.
Post 14 Jul 2023, 21:33
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.