Answers for "HOW TO GENERATE RANDOM NUMBER IN 8086"

0

HOW TO GENERATE RANDOM NUMBER IN 8086

RANDGEN:         ; generate a rand no using the system time
RANDSTART:
   MOV AH, 00h  ; interrupts to get system time        
   INT 1AH      ; CX:DX now hold number of clock ticks since midnight      

   mov  ax, dx
   xor  dx, dx
   mov  cx, 10    
   div  cx       ; here dx contains the remainder of the division - from 0 to 9

   add  dl, '0'  ; to ascii from '0' to '9'
   mov ah, 2h   ; call interrupt to display a value in DL
   int 21h    
RET
Posted by: Guest on April-26-2020

Code answers related to "HOW TO GENERATE RANDOM NUMBER IN 8086"

Browse Popular Code Answers by Language