;<![CDATA[

IFDEF PFF32			; add the header only for 32-bit code
.686
.MODEL FLAT, STDCALL
ENDIF

include pff.asm

.DATA?
port_base  PVOID ?
port_index DWORD ?

.DATA
buffer     WORD 5 DUP (20h)

.CODE
main PROC
 lea rax, [buffer]		; acts the same in both modes

 mov@ [port_base], rax
 mov@ [port_index], 1

 mov@ r8, [port_base]
 mov@ r9d, [port_index]		; (acts as movzx in 64-bit mode)

 mov@ r11w, 2
 add@ [r8+r9*2], r11w

 mov@ r12w, 22h
 cmp@ r12w, [r8+r9*2]
 jne main
main ENDP

END

;]]>
