|
|
|
发新文章 |
|
|
内嵌汇编的代码:
#define
ASM _asm
ULONG msecond(
void
)
//
毫秒数
{
UCHAR h;
//
小时
UCHAR m;
//
分
UCHAR s;
//
秒
ASM
{
MOV AH,
2
INT 1AH
MOV (h), CH
MOV (m), CL
MOV (s), DH
}
printf(
"
time: %d:%d%d\n
"
, h, m, s);

return
((h
*
60
*
60
)
+
(m
*
60
)
+
s);
}
写成这样就错了: #define ASM _asm


ULONG msecond(void) //毫秒数
  {
UCHAR h; //小时
UCHAR m; //分
UCHAR s; //秒
ASM
 {//太夸张了吧
MOV AH, 2
INT 1AH
MOV (h), CH
MOV (m), CL
MOV (s), DH
}
printf("time: %d:%d%d\n", h, m, s);

return ((h * 60 * 60) + (m * 60) + s);
}注意上面大括号的位置。必须紧接在ASM之后  ,老大作出的总结是:实践出真知,汗
|