; BCDOPS.ASM - Add, subtract, and negate BCD numbers
; Prototypes: void BCDAdd(BCD num1, BCD num2, BCD* sum)
; void BCDSub(BCD num1, BCD num2, BCD* diff)
; void BCDNeg(BCD num1, BCD* opp)
; To assemble: TASM /zi /ml bcdops
; Copyright 1994 - Mark R. Parker
masm
.MODEL small, C
.CODE
PUBLIC BCDAdd ;, BCDSub, BCDNeg
BCDAdd PROC NEAR
ARG Add1: WORD, Add2: WORD, Sum: WORD
USES di, si
mov si, WORD PTR[Add1]
finit
fbld TBYTE PTR [si] ; Load 1st BCD num
mov si, WORD PTR[Add2]
fbld TBYTE PTR [si] ; Load 2nd BCD num
fadd ; Add them, pop st
mov di, WORD PTR[Sum] ; Put addr. of Sum
mov si, [di] ; into SI
fbstp TBYTE PTR [si] ; Store Sum where
ret ; SI points
BCDAdd ENDP
END ; End of file BCDOPS.ASM
; End of File