# An example of detecting an IMUL overflow
#
# 当使用带符号整数和IMUL时,记住一点很重要: 总是要检查结果中的溢出。
# 使用JO检查溢出标志,另一种方式是检查进位标志。
#
.section .text
.globl main
main:
nop
movw $680, %ax
movw $100, %cx
imulw %cx
jo over
movl $1, %eax
movl $0, %ebx
int $0x80
over:
movl $1, %eax
movl $1, %ebx
int $0x80