Advertisement
varli_ketanpl

Lab 3 smp

Mar 21st, 2024
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ; You may customize this and other start-up templates;
  3. ; The location of this template is c:\emu8086\inc\0_com_template.txt
  4.  
  5. org 100h
  6.  
  7. include 'emu8086.inc'
  8. start:
  9.     CALL PTHIS
  10.     DB 13, 10, 'Enter the number: ', 0
  11.     CALL scan_num
  12.     MOV AX, CX
  13.     PUSH AX
  14.     MOV BL, 2
  15.     DIV BX  
  16.     MOV BL, AL
  17.     POP AX  
  18.     MOV DL, 2
  19. check_numbers:
  20.     PUSH AX
  21.     PUSH BX
  22.     MOV BL, DL
  23.     DIV BL
  24.     CMP AH, 0
  25.     JE print_is_not_prime
  26.     POP BX
  27.     POP AX
  28.     INC DX
  29.     CMP DX, BX  
  30.     JL check_numbers
  31. print_is_prime:
  32.     CALL PTHIS
  33.     DB 13, 10, 'The number is prime.', 0
  34.     JMP exit
  35. print_is_not_prime:
  36.     CALL PTHIS
  37.     DB 13, 10, 'The number is not prime.', 0
  38. exit:
  39. HLT
  40. DEFINE_SCAN_NUM
  41. DEFINE_PRINT_NUM
  42. DEFINE_PRINT_NUM_UNS
  43. DEFINE_PTHIS
  44. ret
  45.  
  46.  
  47.  
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement