/ void bcdinc( / unsigned char x1[ISIZE], / const int c); / add 1 to a bcd number, c is the max of number of digits in x1 / / Copyright John Moyer 1996 / permission is granted to use this for any purpose provided proper / credit is given to the author #ident "@(#)bcdinc.s 1.2 5/24/96 11:29:57" .file "bcdinc.s" .text .globl bcdinc .align 4 COUNT = 12 XONE = 8 bcdinc: pushl %ebp movl %esp,%ebp pushl %eax pushl %ecx pushl %edx pushl %esi pushl %edi movl XONE(%ebp),%esi movl COUNT(%ebp),%ecx xorl %eax,%eax movb $1,%ah myloop: movb %ah,%al xorb %ah,%ah addb (%esi),%al / if your assembler does not like aaa, then uncomment the following instead / .byte 0x37 aaa movb %al,(%esi) incl %esi loop myloop / assume that a store is faster than a conditional jump / testb %ah,%ah / jz myexit movb %ah,%al movb %al,(%esi) / myexit: popl %edi popl %esi popl %edx popl %ecx popl %eax leave ret .type bcdinc,@function .size bcdinc,.-bcdinc