• Welcome to Jose's Read Only Forum 2023.
 

Equivalent of PB MAK function

Started by Chris Chancellor, November 15, 2018, 04:34:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chris Chancellor

Hello Charles

what is the equivalent of  PB  MAK function ? 

see http://www.manmrk.net/tutorials/basic/PowerBASIC/PBWINH/MAK_function.html

from PB Manual it is
Quote
MAK function
Purpose
Create an integral class value of a specified data type.

Syntax
resultvar = MAK(datatype, loworderval, highorderval)

Remarks
Create an integral class value of a specified data type (WORD, DWORD, PTR, INTEGER, LONG, QUAD) from a low-order and a high-order part.

The complements to this function are the HI and LO  functions, which may be used to split a single 32-bit value into two 16-bit components.

Restrictions
MAK supercedes the MAKWRD, MAKDWD, and MAKPTR functions. Those functions are no longer supported, so update your code to use the new syntax.

See also
HI, LO

Example
dwResult = MAK(DWORD, x??, y??)








Charles Pegge

Hi Chris,

Something like this:


function makword(byte lower,upper) as word
  return upper*0x100+lower
end function

function makdword(word lower,upper) as dword
  return upper*0x10000+lower
end function

'masking tests
int a,b
a=0x30101
b=0x30202
print hex makword a,b '201
print hex makdword a,b '2020101


Chris Chancellor

Thanxx a lot Charles

i will test it out against PB to see if they work out