; This program is for testing the random2 tsr ; You see the randomness visually! title test random number generator ; ; Prints random 0/1 values in random locations on the screen, ; each with a random attribute (color). ; To exit, type any key. ; .model small .stack 100h .data X db 0 ; temp space Y dw 350 ; prints Y many random 0/1 values Z dw 50000 ; delay parameter: ; -- loop Z many times between printing values ; -- increase this value if you want to slow things ; further ZZ dw 100 ; -- inner loop of Z delays .code if1 include ..\mac\basic.mac endif main proc ; init mov ax,@data mov ds,ax ; save old mode mov ah,0fh int 10h push ax push bx ; mode 13h mov ah,0 mov al,13h int 10h AGAIN: ; row mov ax,24 ; want random number from 0 to 24 int 62h ; call random number generator mov dh,al ; save random number (in AX) into DH. ; col mov ax,39 int 62h mov dl,al ; move cursor to row,col mov ah,2 xor bh,bh int 10h ; attribute mov ax,255 int 62h mov x,al ; 0 or 1 mov ax,2 int 62h add al,30h mov ah,9 mov cx,1 xor bh,bh mov bl,x int 10h ; delay mov cx,z DELAY: push cx mov cx,zz DELAY_: loop DELAY_ pop cx loop DELAY sub y,1 test y, 0FFFFh jnz AGAIN ; wait for key stroke to end xor ah,ah int 16h ; restore old mode pop bx pop ax xor ah,ah int 10h mov al,bh mov ah,5 int 10h ; dos return mov ah,4ch int 21h main endp end main