mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-21 02:46:10 +00:00
43 lines
1.1 KiB
NASM
43 lines
1.1 KiB
NASM
|
SUBR PROC FAR
|
|||
|
SPACE
|
|||
|
; -------------------------------------------------------------------
|
|||
|
; ADD BCD NUMBERS
|
|||
|
; THIS ROUTINE ADDS TWO BCD NUMBERS OF EQUAL LENGTH
|
|||
|
; ASSUMPTIONS:
|
|||
|
; CX CONTAINS THE LENGTH OF THE FIELDS BEING ADDED
|
|||
|
; SI POINTS TO THE LEFTMOST BYTE OF THE BCD DATA
|
|||
|
; DI POINTS TO THE SECOND OPPERAND WHICH IS OVERLAID BY RESULT
|
|||
|
; AX DESTROYED BY THIS ROUTINE
|
|||
|
;
|
|||
|
BCDADD LABEL FAR
|
|||
|
CLC ;CLEAR CARY FLAG
|
|||
|
BCD1 LABEL NEAR
|
|||
|
MOV AL,[SI] ;GET A DATA BYTE
|
|||
|
ADC AL,[DI] ;ADD A BYTE
|
|||
|
DAA ;ADJUST RESULT
|
|||
|
MOV [DI],AL ;STORE ANSWER
|
|||
|
INC SI ;BUMP POINTER
|
|||
|
INC DI ;BUMP POINTER
|
|||
|
DEC CX ;DECREMENT AND TEST
|
|||
|
JNZ BCD1 ;LOOP TILL DONE
|
|||
|
RET ;BACK TO CALLER
|
|||
|
SPACE 2
|
|||
|
; ADD ASCII NUMBERS
|
|||
|
; LINKAGE IS SAME AS ABOVE
|
|||
|
;
|
|||
|
ASCADD LABEL FAR
|
|||
|
CLC ;CLEAR CARRY FLAG
|
|||
|
ASC1 LABEL NEAR
|
|||
|
MOV AL,[SI] ;GET A BYTE
|
|||
|
ADC AL,[DI] ;ADD DATA
|
|||
|
AAA ;ADJUST RESULT
|
|||
|
MOV [DI],AL ;STORE ANSWER
|
|||
|
INC SI ;BUMP POINTER
|
|||
|
INC DI ;BUMP POINTER
|
|||
|
DEC CX ;LOOP CONTROL
|
|||
|
JNZ ASC1 ;LOOP FOR MORE
|
|||
|
RET
|
|||
|
;
|
|||
|
; -------------------------------------------------------------
|
|||
|
SUBR ENDP
|
|||
|
|