Advertisement
tsnaik

MFP lab8

Sep 14th, 2015
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. steps:
  2.  
  3. >tasm file1.asm
  4. >tasm file2.asm
  5.  
  6. >tlink f1.obj f2.obj
  7. >type f1.map
  8.  
  9. >f1.exe ;like before
  10.  
  11.  
  12.  
  13. 1. Find LCM using far proc
  14.  
  15.  
  16. ;------------------------file1.asm---------
  17.  
  18. extrn x : far
  19.  
  20. public a
  21. public b
  22. public ans
  23.  
  24. data segment
  25.     a db 5
  26.     b db 10
  27.     ans dw ?
  28.    
  29. data ends
  30.  
  31. code segment
  32.     assume cs:code, ds:data
  33.     mov ax,data
  34.     mov ds,ax
  35.     xor ax,ax
  36.    
  37.     call x
  38.     int 3
  39.    
  40. code ends
  41. end
  42.  
  43.  
  44.  
  45. ;------------------file2.asm----------
  46.  
  47. public x
  48. extrn a:byte
  49. extrn b:byte
  50. extrn ans:word
  51.  
  52.  
  53. c4 segment
  54.  
  55.     assume cs:c4
  56.    
  57.     x proc far
  58.    
  59.     mov al,a
  60.     mov bl,b
  61. one:    cmp al,bl
  62.     jc loop1
  63.    
  64. loop1:  xchg al,bl
  65.     jmp read
  66.    
  67. read:   sub al,bl
  68.     jnz one
  69.     mov al,bl
  70.     mov al,a
  71.     mov cl,b
  72.     mul cl
  73.     div bl
  74.    
  75.     int 3
  76.     ret
  77.     x endp
  78. c4 ends
  79. end
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86. 2. Convert celcius to fahrenheit using far proc
  87.  
  88.  
  89. 3. Given a string "hello world hello" find out the occurence of hello. After that, replace "hello" with "hi".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement