Pelles C forum
Pelles C => Bug reports => Topic started by: Vortex on May 06, 2023, 10:00:52 PM
-
Hi Pelle,
I coded a Poasm macro to easily handle rip-relative addressing on Windows 64-bit programming. The purpose is to replace the following syntax :
mov rip+hBrush,rax
with
mov hBrush,rax
The second hBrush statement is an equate defined as rip+_hBrush where _hBrush is declared in the .data? section by the macro.
ripVar MACRO var,type
@CatStr( <_>,<var>,< >,<type>,< >,<?>)
.echo @CatStr( <_>,<var>,< >,<type>,< >,<?>)
var CATSTR <rip>,<+>,<_>,var
.echo var
ENDM
Usage of the macro :
.data?
ripVar hBrush,QWORD
The .echo statements are for debugging purpose.
Poasm Version 11.00.0 reports the following correct outputs and the source code is assembled without any issues:
"_hBrush QWORD ?"
"rip+_hBrush"
"_hModule QWORD ?"
"rip+_hModule"
Poasm Version 12.00.0 reports the following error messages :
ColorDlg.asm(26): error: Invalid use of '_hBrush'.
"_hBrush "
"rip"
ColorDlg.asm(27): error: Invalid use of '_hModule'.
"_hModule "
"rip"
Attached is the source code assembled with Poasm V11. Kindly, could you try the code with Poasm V12? Thanks.
-
I think it's the same problem that was also recently reported through email:
new Unicode handling counted terminator in the length for literal strings, so from "aa\0" and "bb\0" concat produced "aa\0bb\0\0" rather than "aabb\0".
Should be fixed by this version:
http://www.smorgasbordet.com/pellesc/1200/poasm_12_00_1.zip
-
Hi Pelle,
Thanks for the attachment. Poasm Version 12.00.1 solved the problem.
-
Great news, thanks. This version of POASM will be in the next Setup (either final or RC3, depending on events...)
-
Hi Pelle,
I wrote a second macro to handle structures :
ripSt MACRO var,type
; .echo command for debugging purpose
LOCAL t
t TEXTEQU <{}>
@CatStr( <_>,var,< >,type,< >,t )
; .echo @CatStr( <_>,var,< >,type,< >,t )
var CATSTR <rip+_>,var
.echo var
ENDM
The test of this new macro reports an error message :
.data?
.
.
ripSt pnt,POINT
error: Symbol 'pnt' is undefined :
mov pnt.y,10
The POINT structure :
POINT STRUCT
x DWORD ?
y DWORD ?
POINT ENDS
-
Version 12.00 is done. I will see if this can be improved in any possible future version...
EDIT: In this case pnt.y is expanded to rip+_pnt.y, and it's unclear how to get a type from rip+_pnt...