C administering machine for each port is assigned an address (called a port number), is formed in a separate memory space, I / O address space.
Please enter: a traditional PC, I / O address space range
CPU operation is accomplished by peripheral ports dedicated read and write commands. With IN instruction read port, write port with the OUT instruction.
IN AL,21H;表示从21H端口读取一字节数据到AL
IN AX,21H;表示从端口地址21H读取1字节数据到AL,从端口地址22H读取1字节到AH
OUT 21H,AL;将AL的值写入21H端口
OUT 21H,AX;将AX的值写入端口地址21H开始的连续两个字节。(port[21H]=AL,port[22h]=AH)