Text Practice Mode
Assembly Code
created Oct 20th 2021, 08:56 by McT
1
128 words
9 completed
0
Rating visible after 3 or more votes
00:00
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
; lets just take the lower bits of DL for a start..
MOV BH, 57 ; set limit to 57 (ASCII for 9)
MOV AH, DL
CMP AH, BH ; compare with value in DL,
JA RANDSTART ; if more, regenerate. if not, continue...
MOV BH, 49 ; set limit to 48 (ASCII FOR 0)
MOV AH, DL
CMP AH, BH ; compare with value in DL
JB RANDSTART ; if less, regenerate.
; if not, this is what we need
mov ah, 2h ; call interrupt to display a value in DL
int 21h
RET
RANDSTART:
MOV AH, 00h ; interrupts to get system time
INT 1AH ; CX:DX now hold number of clock ticks since midnight
; lets just take the lower bits of DL for a start..
MOV BH, 57 ; set limit to 57 (ASCII for 9)
MOV AH, DL
CMP AH, BH ; compare with value in DL,
JA RANDSTART ; if more, regenerate. if not, continue...
MOV BH, 49 ; set limit to 48 (ASCII FOR 0)
MOV AH, DL
CMP AH, BH ; compare with value in DL
JB RANDSTART ; if less, regenerate.
; if not, this is what we need
mov ah, 2h ; call interrupt to display a value in DL
int 21h
RET
saving score / loading statistics ...