Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; You may customize this and other start-up templates;
- ; The location of this template is c:\emu8086\inc\0_com_template.txt
- org 100h
- include 'emu8086.inc'
- start:
- CALL PTHIS
- DB 13, 10, 'Enter the number: ', 0
- CALL scan_num
- MOV AX, CX
- PUSH AX
- MOV BL, 2
- DIV BX
- MOV BL, AL
- POP AX
- MOV DL, 2
- check_numbers:
- PUSH AX
- PUSH BX
- MOV BL, DL
- DIV BL
- CMP AH, 0
- JE print_is_not_prime
- POP BX
- POP AX
- INC DX
- CMP DX, BX
- JL check_numbers
- print_is_prime:
- CALL PTHIS
- DB 13, 10, 'The number is prime.', 0
- JMP exit
- print_is_not_prime:
- CALL PTHIS
- DB 13, 10, 'The number is not prime.', 0
- exit:
- HLT
- DEFINE_SCAN_NUM
- DEFINE_PRINT_NUM
- DEFINE_PRINT_NUM_UNS
- DEFINE_PTHIS
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement