flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3 |
Author |
|
ProMiNick 02 Feb 2024, 22:03
It looks very beautyful and intuitive and very readable. thanks.
|
|||
![]() |
|
Roman 03 Feb 2024, 07:38
struct POINT
x dd ? y dd ? ends struct POINTshort x dw ? y dw ? ends Very clear and easy rewrite another programing languages. And not do this magic spells . Code: namespace ?16bit ;if only this one command auto convert struct to 16 bits woold be nice define sizeof? sizeof end namespace |
|||
![]() |
|
Tomasz Grysztar 03 Feb 2024, 09:24
Roman wrote:
With "struct" macro cleaned up to not define such constants, switching the namespaces would be enough. |
|||
![]() |
|
revolution 03 Feb 2024, 11:04
Roman wrote: POINTshort lPOINT - long point (dwords) sPOINT - short point (words) Anyone familiar with OOP would baulk at "ugly" naming requirements like that, and everything would simply be POINT where the size is inferred from the context. But assembly and OOP are at odds with each other in many ways. For example how could one correctly write this? Code: mov reg,[MY_POINT.x] ; what register size goes here? ax? eax? Code: if sizeof.MY_POINT.x = 16 movzx eax,[MY_POINT.x] else mov eax,[MY_POINT.x] end if What would be a way to embed sign information? Asm syntax doesn't have any unsigned type operator like C does. Could this exist? Code: if sizeof.MY_POINT.x = 16 if signof.MY_POINT.x = -1 ; signed? movsx eax,[MY_POINT.x] else movzx eax,[MY_POINT.x] end if else mov eax,[MY_POINT.x] end if |
|||
![]() |
|
Tomasz Grysztar 03 Feb 2024, 11:21
Tomasz Grysztar wrote: With "struct" macro cleaned up to not define such constants, switching the namespaces would be enough. Code: struct POINT x dd ? y dd ? ends namespace ?16bit struct POINT x dw ? y dw ? ends db sizeof.POINT ; 4 end namespace db sizeof.POINT ; 8 |
|||
![]() |
|
ProMiNick 03 Feb 2024, 11:28
signof could be of 3 values: undefined - no sign limit (-128..255), 0 - strict unsign (0..255), 1 strict sign (-128..127), or 0,1,-1 to be numeric, not symbolic
|
|||
![]() |
|
Roman 03 Feb 2024, 13:43
revolution
When all else fails, read the source Quote:
Nice remark. MY_POINT must inherit the type of struct. Code: If MY_POINT lPOINT mov reg,type [MY_POINT.x] ;mov eax,dword [MY_POINT.x] If MY_POINT sPOINT mov reg,type [MY_POINT.x] ;movzx eax,word [MY_POINT.x] type gives cool tricks. If MY_POINT sPOINT getAllType reg, [MY_POINT] ;generated this code movzx eax,word [MY_POINT.x] movzx ebx,word [MY_POINT.y] |
|||
![]() |
|
bitRAKE 03 May 2024, 14:34
For windows, many of the structures are an incorrect size. This happens when alignment of an element promotes structure alignment, and trailing elements are of a lesser alignment. By updating macro struct?.check name, the problems can be detected:
Code: if sizeof name mod maxalignment > 0 repeat 1, N:sizeof name display 'warning: struct ',`name,'(',`N,') not aligned to its natural boundary',10 end repeat end if This impacts a number of fasm2 structures in 64-bit: Code: warning: struct WIN32_FIND_DATA(318) not aligned to its natural boundary warning: struct WIN32_FIND_DATAA(318) not aligned to its natural boundary warning: struct CLIENTCREATESTRUCT(12) not aligned to its natural boundary warning: struct TEXTMETRIC(53) not aligned to its natural boundary warning: struct HD_ITEM(36) not aligned to its natural boundary warning: struct REBARBANDINFO(68) not aligned to its natural boundary warning: struct TOOLTIPTEXT(124) not aligned to its natural boundary warning: struct TC_ITEM(36) not aligned to its natural boundary warning: struct NM_DATETIMECHANGE(44) not aligned to its natural boundary warning: struct NM_DATETIMESTRING(52) not aligned to its natural boundary warning: struct CHOOSEFONT(100) not aligned to its natural boundary |
|||
![]() |
|
bitRAKE 10 Jun 2024, 21:43
There is a corner case that break the advanced align macro:
Code: virtual at rbp - .local .lvi dq ? .hIcon dq ? .id dd ? align.assume rbp,16 align 16|8 ; :BUG: |8 not working .local := $ - $$ rq 5 ; old registers and return .hDialog dq ? .hListview dq ? .rc RECT end virtual |
|||
![]() |
|
Goto page Previous 1, 2, 3 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.