MalwareSourceCode/MSDOS/S-Index/Virus.MSDOS.Unknown.subr.asm
vxunderground 4b9382ddbc re-organize
push
2022-08-21 04:07:57 -05:00

43 lines
1.1 KiB
NASM
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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