home *** CD-ROM | disk | FTP | other *** search
- %TITLE "Sums TWO hex values"
-
- IDEAL
- DOSSEG
- MODEL small
- STACK 256
-
- DATASEG
-
- exitCode db 0
- prompt1 db 'Enter value 1: ', 0
- prompt2 db 'Enter value 2: ', 0
- string db 20 DUP (?)
-
- CODESEG
-
- EXTRN StrLength:proc
- EXTRN StrWrite:proc, StrRead:proc, NewLine:proc
- EXTRN AscToBin:proc, BinToAscHex:proc
-
- Start:
- mov ax,@data
- mov ds,ax
- mov es,ax
- mov di, offset prompt1
- call GetValue
- push ax
- mov di, offset prompt2
- call GetValue
- pop bx
- add ax,bx
- mov cx,4
- mov di, offset string
- call BinToAscHex
- call StrWrite
- Exit:
- mov ah,04Ch
- mov al,[exitCode]
- int 21h
-
- PROC GetValue
- call StrWrite
- mov di, offset string
- mov cl,4
- call StrRead
- call NewLine
- call StrLength
- mov bx,cx
- mov [word bx + di], 'h'
- call AscToBin
- ret
- ENDP GetValue
-
- END Start