flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
It depends upon how you define your Point structure.
You could do it like this: Code: struc Point replications { dd replications dup (?,?) } |
|||
![]() |
|
extra_12345
revolution wrote: It depends upon how you define your Point structure. For example point contains x and y arguments,so I've define my structure like this: struc Point replications { dd replications dup (?,?) x dd ? y dd ? } Then in my procedure: Local replications 25 Right? Can you please be a little bit more specific?thank you |
|||
![]() |
|
revolution
To define labels within that you might want to do this:
Code: struc Point replications { x dd ? y dd ? dd replications-1 dup (?,?) } Code: Local my_points Point 25 |
|||
![]() |
|
extra_12345
so let me get this straight,i have this structure:
Code: struct EnochFA alpha dd ? x dd ? y dd ? bright dd ? lpstr dd ? timer dd ? dum1 dd ? dum2 dd ? ends to be able to define it more than once i have to modify it such as: Code: struct EnochFA alpha dd ? x dd ? y dd ? bright dd ? lpstr dd ? timer dd ? dum1 dd ? dum2 dd ? dd EnochFA dup (?,?) ends and in my procedure: Code: local enochl EnochFA 25 but at runtime " invalid argument" pops up right on the above local definition,i think i did something wrong?! |
|||
![]() |
|
revolution
When you use struct that is a macro, not the fasm native struc.
If you are using the normal fasm package struct then it doesn't support repetitions like that. |
|||
![]() |
|
Tomasz Grysztar
It is one of the questions that had been answered in the old FAQ:
Quote: How to define an array of structures? I considered this FAQ deprecated, in favor of more recently updated FAQs on this board, but if such questions keep showing up perhaps we should copy these old answers to the forum-hosted FAQs somewhere. |
|||
![]() |
|
extra_12345
Tomasz Grysztar wrote: It is one of the questions that had been answered in the old FAQ: That worked flawlessly,thank you Tomasz. |
|||
![]() |
|
revolution
Tomasz Grysztar wrote: It is one of the questions that had been answered in the old FAQ: But like this we can make the label StrucArray more useful. Code: StrucArray MYSTRUC rept 100-1 { local ..s ..s MYSTRUC } Code: mov eax,[StrucArray.x] ; access the x value within MYSTRUC |
|||
![]() |
|
Tomasz Grysztar
revolution wrote: Neither of those gives access to the structure labels. Code: mov eax,[ebx+MYSTRUC.x] |
|||
![]() |
|
revolution
Tomasz Grysztar wrote:
|
|||
![]() |
|
Roman
Quote: StrucArray MYSTRUC How get from 10 StrucArray mov eax,[StrucArray.x+sizeof.MYSTRUC*10] ? Or exist another way ? mov eax,[StrucArray.x] get first from StrucArray |
|||
![]() |
|
revolution
It would be best if we can pick up the size from the defined label, not the structure itself.
Code: mov eax,[StrucArray.x + sizeof.StrucArray * 10] Code: StrucArray MYSTRUC2 ; new name rept 100-1 { local ..s ..s MYSTRUC2 ; new name } ;... mov eax,[StrucArray.x + sizeof.StrucArray * 10] ; no change |
|||
![]() |
|
Tomasz Grysztar
revolution wrote: It would be best if we can pick up the size from the defined label, not the structure itself. Code: include 'macro/struct.inc' include 'cpu/p6.inc' struct MYSTRUC2 x dd ? ends StrucArray MYSTRUC2 rept 100-1 MYSTRUC2 end rept mov eax,[StrucArray.x + sizeof StrucArray * 10] Code: struc starr? name*, count:1 label . : sizeof name * count .item name rept count-1 name end rept end struc StrucArray starr MYSTRUC2,100 mov ecx,sizeof StrucArray mov eax,[StrucArray.item.x + sizeof StrucArray.item * 10] I would say that seeing all the differing preferences for code/syntax patterns (discussed on the forums from the beginning of their history) was probably one of the main motivators for me to design fasmg with its frenzied levels of customizability. |
|||
![]() |
|
bitRAKE
Reading through your latest struct implementation, I couldn't think of a situation where it didn't work. Just amazing, and a great "go-to" for what is possible.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.