flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
JohnFound
Well you can't define labels inside <repeat> structure.
The reason for this is that on the stage where repeat is executed (assembling) all labels are already created (in preprocessing/parsing stage), you simply can't create new. The simplest solution, if you want to create repeated static data, is to use macroses instead of structs: Code: ; Note that there are no labels. macro MyStruc fld1, fld2, fld3 { dd fld1 db fld2 db fld3 } repeat 10000 MyStruc 3424, 32, 27 end repeat BTW: IMHO in 99.9% of the cases, creating of this kind of data is not very good style of programming. Better create not initialized data and then fill it on run-time. Regards |
|||
![]() |
|
terex
Thanks, but i have allready suspected for this way too
![]() JohnFound wrote: Well you can't define labels inside <repeat> structure. It's exactly that 1 percent! I write a simple code for get understanding of pmode interrupts handle. I define selectors for code, data & stack segments so that base = address of place where dos loads my .com app, and size = 64k. I do it spesial for cansel need for calculate addresses of interrupts handlers on run-time. Ofcause, in a real code it is not very good. _________________ sorry for my english |
|||
![]() |
|
vid
privalov: couldn't you slightly modify 'struc' so it can be used without label preceding it? strutures defined with 'struc' should beheave in my opinion like all other data defines. You can use 'db 5' and 'name db 5' both, but you cant define data with structure without preceding it with label.
Nice workaround for structures without preceding name is just to append all symbol starting with dot to some dummy (local) label. |
|||
![]() |
|
terex
vid, it's really good idea. Privalov, isn't it?
![]() _________________ sorry for my english |
|||
![]() |
|
JohnFound
terex wrote: vid, it's really good idea. Privalov, isn't it? Well I am not Privalov, but IMHO it is not good idea. Every structure have local labels inside. These labels needs parent label. If you define structure without main label, the local labels inside will be attached to the last global label, that is not very correct. Regards. |
|||
![]() |
|
Tommy
I agree with John! If you need to define data without parent label, use macros instead!
![]() |
|||
![]() |
|
vid
john, tommy: i think i explained it badly. I meant, that 'struc' when used withuot label should set current global label to some dummy (local) name, and reset it on the end of struc. Defining both macro and struc for one structure is not very good method.
|
|||
![]() |
|
terex
Hehe
![]() _________________ sorry for my english |
|||
![]() |
|
Tomasz Grysztar
The idea behind the current mechanism is that you can define both struc and macro of the same name, with whatever contents (and even syntax) you want in both cases, for example:
Code: struc RECT left,top,right,bottom { .left dd left+0 .top dd top+0 .right dd right+0 .bottom dd bottom+0 } macro RECT left,top,right,bottom { .left dd left .top dd top .right dd right .bottom dd bottom } First one to use with label, second without it (and in second case its defined the way that forces you to initialize it with some values - just as an example). Changing it would hurt the whole logic of current fasm's macro system and even make some of the current macro solutions not working (when it started to treat unlabelled RECT at a struc instead of a macro, for instance). |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2019, Tomasz Grysztar.
Powered by rwasa.