To get our collection of ASM GEM's forward, here are some SHIFTING Macros.
' #REGISTER:
' ESI - PB Registervar 1
' EDI - PB Registervar 2
' Shift BYTE v by s to left
MACRO FUNCTION SHL_B(V, S)
MACROTEMP V1
DIM V1 AS BYTE
! pushad
! xor eax, eax
! xor ecx, ecx
! mov al, v
! mov cl, s
! shl eax, cl
! mov v1, al
! popad
END MACRO = V1
' Shift BYTE v by s to right
MACRO FUNCTION SHR_B(V, S)
MACROTEMP V1
DIM V1 AS BYTE
! pushad
! xor eax, eax
! xor ecx, ecx
! mov al, v
! mov cl, s
! shr eax, cl
! mov v1, al
! popad
END MACRO = V1
And here the Shift DWORD Macros.
' Shift DWORD v by s to left
MACRO FUNCTION SHL_D(V, S)
MACROTEMP V1
DIM V1 AS DWORD
! pushad
! mov eax, v
! mov ecx, s
! shl eax, cl
! mov v1, eax
! popad
END MACRO = V1
' Shift DWORD v by s to right
MACRO FUNCTION SHR_D(V, S)
MACROTEMP V1
DIM V1 AS DWORD
! pushad
! mov eax, v
! mov ecx, s
! shr eax, cl
! mov v1, eax
! popad
END MACRO = V1