日期:2014-05-16 浏览次数:20660 次
.section .data output: .asciz "TIME IS OUT , TERMINATE!" .section .bss .lcomm buffer, 100 .section .text .globl main main: #检测是否启动设备 NotStart: inb $0x72 , %al testb $0x1 , %al jz NotStart #设定循环计算器,每次传送4个字节 movl $25, %ecx movl $buffer,%ebx movl $1000, %edx #我假设循环1000次为1秒 #检测设备准备就绪,每次读取时都要检测 READ: NotReady: decl %edx testl $1 , %edx jz TIMEOUT movl $0 , %eax inb $0x71 , %al #从71H端口读取状态 testb $0x1 , %al # 1 准备就绪 jz NotReady #读取数据信息 inl $0x70 , %eax movl %eax , %ebx incl %ebx loop READ jmp EXIT TIMEOUT: pushl $output call printf addl $4, %esp EXIT: movl $1, %eax movl $0, %ebx int $0x80