Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IDEAL
- MODEL small
- STACK 100h
- org 100h ; code starts at offset 100h
- DATASEG
- Clock equ es:6Ch ;Memory location of timer
- ran db 0 ;האיחסון של המספר הרנדומלי
- user_choice db 0 ;המספר הרנדומלי שהמשתמש בחר
- computerscore db 0 ; ניקוד המחשב
- userscore db 0 ;ניקוד המשתמש
- userw db 'you win$'
- computerw db 'you lost$'
- CODESEG
- MACRO Random_Generator maxval
- mov ax,40h
- mov es,ax
- mov ax,[Clock]
- mov ah,[byte cs:bx]
- xor al,ah
- xor ah,ah
- and al,maxval
- endm Random_Generator
- start:
- mov ax, @data
- mov ds, ax
- Random_Generator 9
- mov [ran],al
- mov ah,1
- int 21h
- sub al,30h
- ;mov [user_choice],al
- mov ah,[ran]
- cmp ah,al
- jne computerpoint
- inc [userscore]
- mov dl,'*'
- mov ah,2
- int 21h
- cmp [userscore],1
- jb start
- je userwin
- computerpoint:
- inc [computerscore]
- cmp [computerscore],1
- jb start
- je computerwin
- userwin:
- MOV dl, 10
- MOV ah, 02h
- INT 21h
- MOV dl, 13
- MOV ah, 02h
- INT 21h
- mov dx, offset userw
- mov ah, 9
- int 21h ;problem
- computerwin:
- MOV dl, 10
- MOV ah, 02h
- INT 21h
- MOV dl, 13
- MOV ah, 02h
- INT 21h
- mov dx,offset computerw
- mov ah, 9
- int 21h ;problem
- exit:
- mov ax, 4c00h
- int 21h
- END start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement