Author Topic: Proc using VARARG and multidimensionnal arrays  (Read 241 times)


  • Member
  • *****
  • Posts: 1805
    • EditMasm
Proc using VARARG and multidimensionnal arrays
« on: August 08, 2021, 04:05:58 PM »
Proc using VARARG and Multidimensionnal arrays are two subjects missing in this forum with masm.
Here the soluce in 32 and 64 bits for arrays of 2,3,4 dimensions.
The use of those arrays allow to use index instead of adress and simplify greatly many complex problems.
The more simple is the 32 bits.
The size of the parameters is in the intruction just after the call and it is not too much difficult
to retrieve the number of args.
In 64 bits,it seems that this information is lost.The proc must know how many paramaters he need.
Here,it is a pointer on data who give this information.

I have tested it with uasm,jwasm and asmc64.
Take care that uasm dont find the fifty element at the same place    (64 bits sample debut.asm)
This obliges to modify the code for your own compiler
Code: [Select]
.If NBdim == 4
mov rdx,0
mov ecx,[rbx+12]
.if ecx == 0
jmp NullDim
;mov eax,[rbp+50h]                     ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< uasm
mov         eax,dword ptr [rbp+30h]    ;<<<<<<<<<<<<<<<< jwasm ,asmc64
mul ecx
add cumul,eax

The c optimize this giving only the result for the various calcul needed to solve the adress.

« Last Edit: August 11, 2021, 04:45:45 PM by TouEnMasm »
Fa is a musical note to play with CL