Topics: ;OFFSET Operator
;PTR Operator
;TYPE Operator
;LENGTHOF Operator
;SIZEOF Operator
.
Sample Code:
;OFFSET Operator
;PTR Operator
;TYPE Operator
;LENGTHOF Operator
;SIZEOF Operator
.386
.model flat, stdcall
.stack 4096
include Irvine32.inc
;-- Data segment to make variables
.data
myarray DB 10h, 12h, 14h
WordArray DW 2223h, 6665h, 9995h, 3 DUP (1254h)
DwordArray DD 12345678h, 87654321h, 11223344h
QwordArray DQ 1234567887654321h
;-- code segment starts here
.code
main proc
mov eax, 0
mov ebx,0
mov eax, Dword PTR QwordArray
mov ebx, Dword PTR QwordArray+4
call dumpregs
COMMENT !
mov eax,0
mov eax,DWORD PTR WordArray
call dumpregs
; Little Endian 2223h
; 23 then 22
; display 2223
; 2223
; 2322
!
COMMENT !
mov eax, 0
mov ebx,0
mov ax, WORD PTR DwordArray ; 5678h
mov bx, WORD PTR DwordArray+2 ; 12345h
mov WordArray, bx
mov WordArray+2, ax
mov cx, WordArray
mov dx, WordArray+2
call dumpregs
!
COMMENT !
mov eax,0
mov ebx, 0
mov ecx, 0
mov eax, SIZEOF myarray
mov ebx, SIZEOF WordArray
mov ecx, SIZEOF DwordArray
;mov al, myarray+TYPE myarray
;mov bx, WordArray + TYPE WordArray
;mov ecx, DwordArray + TYPE DwordArray
;mov eax, TYPE myarray
;mov ebx, TYPE WordArray
;Mov ecx, TYPE DwordArray
!
COMMENT !
mov eax, 0
mov ebx,0
;mov ebx, myarray
mov eax, OFFSET myarray+2 ; do work of & sign
;int a = 10;
;int *b = &a;
!
call dumpregs
invoke ExitProcess,0
main endp
end main
Ещё видео!