Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Fri Aug 01, 2003 2:55 am Post subject: Retrieving HiWord, LoWord etc. in plain VDS |
|
|
Code: |
#-----------------------------------------------------------------------------#
# #
# Byte and Word Conversion in plain VDS #
# #
# Author: Tommy Sools #
# #
# Copyright: Public Domain #
# #
#-----------------------------------------------------------------------------#
#define function,hibyte
#define function,lobyte
#define function,makeword
#define function,hiword
#define function,loword
%A = %Ahigh byte of $3022 = @hibyte($3022)@cr()
%A = %Alow byte of $3022 = @lobyte($3022)@cr()
%A = %Amakeword with $30 and $22 = @makeword($30,$22)@cr()
%A = %Ahigh word of $80251305 = @hiword($80251305)@cr()
%A = %Alow word of $80251305 = @loword($80251305)@cr()
%A = %Amakelong with $8025 and $1305 = @makelong($8025,$1305)@cr()
info %A
exit
:hibyte
rem %1 = word value
exit $@substr(@strdel(@hex(%1,4),1,-4),1,2)
:lobyte
rem %1 = word value
exit $@substr(@strdel(@hex(%1,4),1,-4),3,4)
:makeword
rem %1 = high byte value
rem %2 = low byte value
exit $@strdel(@hex(%1,2),1,-2)@strdel(@hex(%2,2),1,-2)
:hiword
rem %1 = long integer value
exit $@substr(@strdel(@hex(%1,8),1,-8),1,4)
:loword
rem %1 = long integer value
exit $@substr(@strdel(@hex(%1,8),1,-8),5,8)
:makelong
rem %1 = high word value
rem %2 = low word value
exit $@strdel(@hex(%1,4),1,-4)@strdel(@hex(%2,4),1,-4)
|
|
|