top of page

TITLE Program Template     (template.asm)

; Program Description:
; Author:
; Date Created:
; Last Modification Date:

INCLUDE Irvine32.inc

; (insert symbol definitions here)

.data

random byte ?
string byte "enter your guess between <0-240>",0
string1 byte "too low",0
string2 byte "too high",0
string3 byte "yes,you hit the number",0
string4 byte "Number of trial is : ",0
string5 byte "!!! you exeeded the interval !!!",0

; (insert variables here)

.code
main PROC

mov random,al                     ;bl de random sayi sakli
mov ebx,0                         ;count trials


l1:
       mov edx,offset string
       call writestring

       call crlf
       
       call readint            

       cmp eax,240
       ja wrong_Input

       cmp al,random   ;random sayiyi tut
       ja _high
       jb _low
       je _equal
_high:
      mov edx,offset string2
      call writestring
      call crlf
      inc ebx
      jmp l1
_low:
      mov edx,offset string1
      call writestring
      call crlf
      inc ebx
      jmp l1

wrong_Input:
           mov edx,offset string5
           call writestring 
           inc ebx
           call crlf   
           jmp l1      

_equal:
       inc ebx
       mov eax,ebx
       mov edx,offset string3
       call writestring
       call crlf
       mov edx,offset string4
       call writestring
       call writedec
       


; (insert executable instructions here)

    exit    ; exit to operating system
main ENDP

; (insert additional procedures here)

END main

bottom of page