home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / TASMSWAN.ZIP / ADDHEX.ASM < prev    next >
Assembly Source File  |  1989-07-17  |  811b  |  55 lines

  1. %TITLE "Sums TWO hex values"
  2.  
  3.     IDEAL
  4.     DOSSEG
  5.     MODEL    small
  6.     STACK    256
  7.  
  8.     DATASEG
  9.  
  10. exitCode    db    0
  11. prompt1        db    'Enter value 1: ', 0
  12. prompt2        db    'Enter value 2: ', 0
  13. string        db    20 DUP (?)
  14.  
  15.     CODESEG
  16.  
  17.     EXTRN    StrLength:proc
  18.     EXTRN    StrWrite:proc, StrRead:proc, NewLine:proc
  19.     EXTRN    AscToBin:proc, BinToAscHex:proc
  20.  
  21. Start:
  22.     mov    ax,@data
  23.     mov    ds,ax
  24.     mov    es,ax
  25.     mov    di, offset prompt1
  26.     call    GetValue
  27.     push    ax
  28.     mov    di, offset prompt2
  29.     call     GetValue
  30.     pop    bx
  31.     add    ax,bx
  32.     mov    cx,4
  33.     mov    di, offset string
  34.     call    BinToAscHex
  35.     call    StrWrite
  36. Exit:
  37.     mov    ah,04Ch
  38.     mov    al,[exitCode]
  39.     int    21h
  40.  
  41. PROC    GetValue
  42.     call    StrWrite
  43.     mov    di, offset string
  44.     mov    cl,4
  45.     call    StrRead
  46.     call    NewLine
  47.     call    StrLength
  48.     mov    bx,cx
  49.     mov    [word bx + di], 'h'
  50.     call    AscToBin
  51.     ret
  52. ENDP    GetValue
  53.  
  54.     END    Start
  55.