CR equ 13 ;Move to next line LF equ 10 ;return to the left hand side JMP START ;skip over variables cmsg: DB 'The coin comes up $' hmsg: DB 'Heads!', CR,LF,'$' tmsg: DB 'Tails!', CR,LF,'$' emsg DB 'Enter 1 for heads of 0 for tails:', CR,LF,'$' enum DB '?' ;place to store the input lmsg DB 'You lose! Good day sir!', CR,LF,'$' wmsg DB 'You won! Well done...', CR,LF,'$' START: LEA DX,emsg ;tell them to enter 1 or 0 MOV AH,9 INT 21H MOV AH,01H INT 21H MOV enum,AL ;get the users input from AL and put it into enum LEA DX,cmsg ;'the coin has come up..' MOV AH,9 INT 21H MOV AH,2cH INT 21H TEST DL,1 ;sample computer clock, test secinds to see if they are odd or even JNZ heads ;if even go to heads LEA DX,tmsg ;else its tails, tell them it came up tails MOV AH,9 INT 21H CMP enum,30h ;compare our input to 30h (0) JNE lose ;not equal then they lose JMP win ;else they win! heads: LEA DX,hmsg ;say it came up heads MOV AH,9 INT 21H CMP enum,31h ;did they get it right? JNE lose ;go to lose JMP win ;go to win lose: LEA DX,lmsg ;tell them they lost mov AH,9 int 21H JMP exit ;move to exit win: LEA DX,wmsg ;tell them they won! mov AH,9 int 21H JMP exit ;jump to exit exit: MOV AH,4ch ;ms-dos exit system call INT 21H