Bank DWORD 10 
rNum DWORD ?

welcomeMsg BYTE "Welcome to the dice guess game. it costs $1.00 to play. " , 0dh, 0ah, 0
contMsg BYTE "Would you like to continue? (y/n)", 0dh, 0ah, 0
prompt1 BYTE "Please enter your guess for the next roll. It only costs $1.00 to play", 0dh, 0ah, 0
prompt2 BYTE "If you are correct I will pay you $10.00:", 0dh, 0ah, 0
winnerMsg BYTE "Winner! The dice rolled ", 0
loserMsg BYTE "Sorry you lose. The dice rolled ", 0
bankMsg BYTE "Your bank is now  $", 0
quitMsg BYTE "Thanks for Playing " , 0dh, 0ah, 0

main PROC

        mov eax, 0                                              ; seed with time of day clock
        call randSeed                                           ; Seed the random number generator
        mov edx, OFFSET welcomeMsg                              ; Output the welcome message
        call writeString
        mov edx, OFFSET contMsg                                 ; prompt to continue
        call writeString
        call readChar                                           ; Read the response
        cmp al, 'y'                                             ; Check for lower case y
        je game                                                 ; Want to play jump to game
        cmp al, 'Y'                                             ; Check for uppercase Y
        je game                                                 ; Want to play jump to game
        call exitProgram                                        ; Don't want to play let's exit


        mov eax, 6                                              ; Random number between 0 and 5
        call randRange                                          ; generate random number
        inc eax                                                 ; add 1 to up range to 1 and 6
        mov rNum, eax                                           ; store the random number

    call writeBank                                              ; write the bank
        call writePrompt                                        ; prompt for input
        call readInt                                            ; get guess

        cmp eax, rNum                                           ; compare the guess to the random number
        jne losers                                              ; jump if not equal to loser

winners:                                                                ; not loser let fall through to winnder
        mov edx, OFFSET winnerMsg                               ; write winner message
        call writeString
        add bank, 10                                            ; add winnings to bank
        jmp prompt                                              ; see if user wants to continue


        mov edx, OFFSET loserMsg                                ; write the loser message
        call writeString
        sub bank, 1                                             ; subtract bet from bank

         mov eax, rNum                                          ; output the random number
         call writeInt
         endl                                                   ; Write a newline
         call writeBank                                         ; output the current bank
         mov edx, OFFSET contMsg                                ; ask if user wants to continue
         call writeString
     call readChar                                              ; read user response
         cmp al, 'y'
         je game
         cmp al, 'Y'
         je game                                                ; jmp back to game if use want to continue
         call exitProgram                                       ; otherwise exit the program 

main ENDP

writePrompt PROC

        mov edx, OFFSET  prompt1
        call writeString
        mov edx, OFFSET prompt2
        call writeString


writePrompt ENDP

writeBank PROC


        mov edx, OFFSET bankMsg
        call writeString
        mov eax, Bank
        call writeInt


writeBank ENDP

exitProgram PROC

        mov edx, OFFSET quitMsg
        call writeString

exitProgram ENDP
END main

Hi I was wondering how I can rewrite this using .WHILE, .IF, .ELSE, ENDW, ENDIF

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.