mercredi 1 mai 2019

Trying to make a random generator for my game in assembly 8086

How to make a function that generates a random number between 0 and 80? I am trying to make a game with asteroids in assembly 8086.

I tried this code but it generates too small numbers...

 _RAND:
    mov ah,2Ch
    int 21h
    mov ax,dx
    mov ax,0Fh
    mov al,dl
    cmp al,80d
    jg _RAND

It gave me a number between 1 and 8 or something like that. It's random, but too small number for the X position of my asteroids.




Aucun commentaire:

Enregistrer un commentaire