Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small
  2. .stack 100h
  3. .data
  4.     x dd 0ABCDEFh
  5.     y dd 0111111h
  6.     z dd ?
  7.     s db 0
  8. .code
  9. START:
  10.     mov ax,@Data
  11.     mov ds,ax
  12.     xor ax,ax
  13.     xor dx,dx
  14.  
  15.     mov ax, word ptr x
  16.     cmp ax, word ptr y
  17.     jge all_ok
  18.  
  19.     mov s, 1
  20.     mov ax, word ptr y
  21.     sub ax, word ptr x
  22.     mov word ptr z, ax
  23.     jmp c
  24. all_ok:
  25.     sub ax, word ptr y
  26.     mov word ptr z, ax
  27.    
  28. c:
  29.     mov ax, word ptr x + 2
  30.     sub ax, word ptr y + 2
  31.  
  32.     cmp ax,0
  33.     jge positive
  34.  
  35. ;negative
  36.     neg ax
  37.     mov word ptr z + 2, ax
  38.    
  39.     neg z ; <--- ошибка
  40.  
  41.     mov ah,4Ch
  42.     int 21h
  43. positive:
  44.     xor cx,cx
  45.     mov cl,s
  46.     cmp s,0
  47.     je was_pos
  48.     dec ax
  49.     mov dx,0FFFFh
  50.     sub dx,word ptr y
  51.     add dx,word ptr x
  52.  
  53. was_pos:
  54.     mov word ptr z, dx
  55.     mov word ptr z + 2, ax
  56.  
  57.     mov ah,4Ch
  58.     int 21h
  59. end START
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement