Advertisement
Guest User

Untitled

a guest
Apr 10th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         org 100h
  2. Start:
  3.         mov ah,09h
  4.         mov dx,EnterInfo
  5.         int 21h
  6.         call DrawNewLine
  7.         mov ah,08h
  8.         int 21h
  9.  
  10.  
  11.  
  12.         mov ah,02h
  13.         mov dl,al
  14.         int 21h
  15.  
  16.  
  17.         sub ax,30h
  18.         xor ah,ah
  19.         mov [a],ax
  20.  
  21.         call DrawNewLine
  22.         mov ah,08h
  23.         int 21h
  24.  
  25.  
  26.         mov ah,02h
  27.         mov dl,al
  28.         int 21h
  29.         sub ax,30h
  30.         xor ah,ah
  31.         mov [b],ax
  32.         call DrawNewLine
  33.  
  34.         push [a]
  35.         push [b]
  36.         push bx
  37.         push si
  38.         push di
  39.  
  40.         call Calc
  41.  
  42.         push ax
  43.         mov ah,09h
  44.         mov dx,ResultInfo
  45.         int 21h
  46.  
  47.         pop ax
  48.         add ax,30h
  49.  
  50.         mov ah,02h
  51.         mov dl,al
  52.         int 21h
  53.  
  54.         mov ax,$0C08
  55.         int 21h
  56.         test al,al
  57.         jnz @F
  58.         mov ah,$08
  59.         int 21h
  60. @@:
  61.         ret
  62. Calc:
  63.         push bp
  64.         mov bp,sp
  65.         mov ax,[bp + 12]; a
  66.         mov cx,[bp + 10]; b
  67.         Mul ax
  68.         Div cx; a^2/b = ax /\ dx
  69.         sub ax,cx
  70.  
  71.         pop bp
  72.  
  73.         ret 10
  74.  
  75. DrawNewLine:
  76.         mov ah,09h
  77.         mov dx,NewLine
  78.         int 21h
  79. ret
  80.  
  81.  
  82.  
  83.  
  84. a       dw       ?
  85. b       dw       ?
  86. EnterInfo db 'Enter a and b$'
  87. ResultInfo db 'Result is $'
  88. NewLine dw 10,13,'$'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement