Hi Rob,
The values in a word/dword arein the following format....
byte mirrored not bits...
Intel - DWORD (32-bit) 0x11223344
Motorola - UInt32 (32-bit) 0x44332211
Intel - WORD (16-bit) 0x1122
Motorola - UInt16 (16-bit) 0x2211
Win32 (intel) Assembler Routines...
;*********************
;
; INPUT: eax = source word
; OUTPUT: eax = output converted word
; Registers Destroyed : eax, ecx, edx
;
;*********************
DWordConvertBetweenMotorolaAndIntel proc
push ebx ; save ebx
mov edx, eax
mov ebx, 0FF000000h
and edx, ebx
shr edx, 24
mov ecx, eax
and ecx, 00FF0000h
shr ecx, 8
or edx, ecx
mov ecx, eax
and ecx, 0000FF00h
shl ecx, 8
or edx, ecx
pop ebx ; restore ebx
and eax, 000000FFh
shl eax, 24
or eax, edx
ret
DWordConvertBetweenMotorolaAndIntel endp
;*********************
;
; INPUT: ax = source word
; OUTPUT: ax = output converted word
; Registers Destroyed : ecx
;
;*********************
WordConvertBetweenMotorolaAndIntel proc
mov cx, ax
and cx, 00FFh
shl cx, 8
and ax, 0FF00h
shr ax, 8
or ax, cx
ret
WordConvertBetweenMotorolaAndIntel endp
These are just to give you an idea, you can now easily write C-routines..
...
Hope this helps,
Prashant Gupta
----- Original Message -----
From: "Rob Cochran" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, March 20, 2001 10:40 AM
Subject: Palm to Desktop type conversions
> Hi,
>
> I've been unable to find any documentation or examples showing how to
> convert big endian to little endian types, and vice versa.
> Specifically, I need functions to convert palm integers (16-bit) to and
> from desktop (Intel) integers (32-bits). It would also be beneficial to
> have a desktop routine to create Palm formatted dates.
>
> Any help would be greatly appreciated. Thanks.
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/