NAR-5050/5070 Series User
’
s Manual
35
GET_GPI_STATUS_CH PROC NEAR
push edx
push ebx
push ax
xor ch,ch ; init ch = 0
;Get_GPI Step 1 : Enable GPIO function ( Set GPIO_Index-30h_Bit0 )
mov dx,Index_IO_Port ; Point to GPIO_LDN ( LDN = 7 )
mov al,07
out dx,al
mov dx,Data_IO_Port
mov al,GPIO_LDN
out dx,al ;
mov dx,Index_IO_Port ; Read Index 30h First
mov al,30h
out dx,al
mov dx,Data_IO_Port
in al,dx
or al,01h ; Set Bit0 to 1
mov ah,al ; keep in AH
mov dx,Index_IO_Port
mov al,30h
out dx,al
mov dx,Data_IO_Port
mov al,ah
out dx,al ; Index30h_bit0P1
;Get_GPI Step 2 : Read GPIO I/O Base Address
; ( Index-60h contains A15---A8, Index-61h contains A7---A0 )
mov dx,Index_IO_Port ; Read Index 60h
mov al,60h
out dx,al
mov dx,Data_IO_Port
in al,dx
mov bh,al ; High Byte I/O Base Addr --> BH
mov dx,Index_IO_Port
mov al,61h ; Read Index 61h
out dx,al
mov dx,Data_IO_Port
in al,dx
mov bl,al ; High Byte I/O Base Addr --> BL
mov dx,bx ; Load Base Addr to DX
rol edx,10h ; Save I/O Base Addr,to EDX_Bit[31..16]