Ophir Braude
Ophir Braude

Reputation: 1

illegal instruction: PRINTN

I'm trying to build a program that check if ax is divisible by 7 with no remainder.

org 100h   
  mov ax,14
  mov cl,7
  div cl
  cmp ah,0
  je positive
    PRINTN   "The number has a remainder"
  jmp finish
 positive:
    PRINTN   "The number has no remainder"
 finish:
     PRINTN   "After comparison"  
mov ah, 0
int 16h
ret

Assembling this program gives me these errors:

(7) illegal instruction: PRINTN   "The number has a remainder" or wrong parameters.
(10) illegal instruction: PRINTN   "The number has no remainder" or wrong parameters.
(12) illegal instruction: PRINTN   "After comparison" or wrong parameters.

Upvotes: 0

Views: 869

Answers (1)

Ahamed_TJ
Ahamed_TJ

Reputation: 21

To use any of the functions in emu8086.inc you should have the following line at the beginning of your source file:

include 'emu8086.inc'

org 100h    
  include 'emu8086.inc'
  mov ax,14
  mov cl,7
  div cl
  cmp ah,0
  je positive
    PRINTN   "The number has a remainder"
  jmp finish
 positive:
    PRINTN   "The number has no remainder"
 finish:
     PRINTN   "After comparison"  
mov ah, 0
int 16h
ret

Have a look at this website for more reference: https://jbwyatt.com/253/emu/asm_tutorial_05.html

Upvotes: 2

Related Questions