#include "lidia_elf.h"

	.text
	.align 4
	.globl USCORE(DigitAdd)
USCORE(DigitAdd):
	pushl %ebx
	movl 8(%esp),%ebx
	movl 12(%esp),%ecx
	movl 16(%esp),%edx
	movl 20(%esp),%eax
	btl $0,%eax
	adcl %edx,%ecx
	setc %al
	andl $255,%eax
	movl %ecx,(%ebx)
	popl %ebx
	ret

	.align 4
	.globl USCORE(DigitSub)
USCORE(DigitSub):
	pushl %ebx
	movl 8(%esp),%ebx
	movl 12(%esp),%edx
	movl 16(%esp),%eax
	movl 20(%esp),%ecx
	btl $0,%ecx
	sbbl %eax,%edx
	setc %al
	andl $255,%eax
	movl %edx,(%ebx)
	popl %ebx
	ret

	.align 4
	.globl USCORE(DigitMult)
USCORE(DigitMult):
	pushl %ebx
	movl 8(%esp),%ebx
	movl 12(%esp),%eax
	movl 16(%esp),%ecx
	mull %ecx
        movl %eax,(%ebx)
	movl %edx,%eax
	popl %ebx
	ret

	.align 4
	.globl USCORE(DigitMultAdd)
USCORE(DigitMultAdd):
	pushl %ebx
	movl 8(%esp),%ebx
	movl 12(%esp),%eax
	movl 16(%esp),%edx
	movl 20(%esp),%ecx
	mull %edx
	addl %ecx,%eax
	adcl $0,%edx
        movl %eax,(%ebx)
	movl %edx,%eax
	popl %ebx
	ret
