Hi, I could really use some help, I need to finish this program made in assembly language, Its a black jack game, but the code I have is not fully functional... I need someone who is an expert in assembly language and can help me finish this code... so the game works fully, I am using irvine 16 library here is the code... someone plz help me finish it Its suppose It also uses Randomize... heres the code:
INCLUDE Irvine16.inc
.data
CompSumCards dd ? ;
CardValue dd ?
UserSumCards dd ?
charIn byte ?
MsgMoreCards db "Action [C-Continue; S-Stay; X-Stop]?", 0
MsgLOOS db "You Lose!!!", 0dh, 0ah, 0
.code
main proc
mov ax, @data
mov ds, ax
Call ClrScr
Call Randomize
; Computer Cards
Call ComputerHit
; USER CARDS
; mov cx, 3
MoreCardsForUser:
mov al, 0dh
Call WriteChar
mov al, 0ah
Call WriteChar
Call PrintCardNum
add UserSumCards, eax
Call PrintCardType
mov al, ' '
Call WriteChar
cmp UserSumCards, 21
jg UserLose
mov edx, OFFSET MsgMoreCards
Call WriteString
Call ReadChar
mov charIn, al
cmp charIn, 'C'
je MoreCardsForUser
cmp charIn, 'S'
je CompPlayAgain
jmp STOPGAME
USERLOSE:
mov edx, OFFSET MsgLOSE
Call WriteString
jmp STOPGAME
CompPlayAgain:
Call ComputerHit
mov ebx, CompSumCards
cmp ebx, UserSumCards
jge StopGame
cmp CompSumCards, 21
jl CompPlayAgain
STOPGAME:
mov eax, UserSumCards
Call WriteDec
mov ax, 4c00h
int 21h
main endp
PrintCardNum Proc
; Print the Number of Card
mov eax, 13 ; Set the value to 13 (n - 1 or eax - 1)
Call RandomRange ; Get the Number of the Card
inc eax
cmp eax, 1
je Jack
cmp eax, 11
je Jay
cmp eax, 12
je Qu
cmp eax, 13
je Ka
jmp PrintNum
Jack:
mov al, 65
jmp PrintLetter ;the ace is missing
Jay:
mov al, 74
jmp PrintLetter
Qu:
mov al, 81
jmp PrintLetter
Ka:
mov al, 75
PrintLetter:
Call WriteChar
cmp eax, 11
jge LetterJQoK
mov eax, 11
jmp Continue01
LetterJQoK:
mov eax, 10
jmp Continue01
PrintNum:
Call WriteDec ; Print the Number of the Card
mov CardValue, eax
Continue01:
ret
PrintCardNum endp
PrintCardType proc
; Print the Card
mov eax, 4 ; Set the value to 4 (n - 1 or eax - 1)
Call RandomRange ; Get the Number of the Card
inc eax
cmp eax, 1
je heart
cmp eax, 2
je diamond
cmp eax, 3
je clover
jmp Spade
heart:
mov al, 3 ; heart
jmp PrintCard
diamond:
mov al, 4 ; diamond
jmp PrintCard
clover:
mov al, 5 ; clover
jmp PrintCard
spade:
mov al, 6 ; spade
PrintCard:
Call WriteChar
ret
PrintCardType endp
ComputerHit proc
Call PrintCardNum
add CompSumCards, eax
Call PrintCardType
mov al, ' '
Call WriteChar
mov eax, CompSumCards
Call WriteDec
ret
ComputerHit endp
end main
INCLUDE Irvine16.inc
.data
CompSumCards dd ? ;
CardValue dd ?
UserSumCards dd ?
charIn byte ?
MsgMoreCards db "Action [C-Continue; S-Stay; X-Stop]?", 0
MsgLOOS db "You Lose!!!", 0dh, 0ah, 0
.code
main proc
mov ax, @data
mov ds, ax
Call ClrScr
Call Randomize
; Computer Cards
Call ComputerHit
; USER CARDS
; mov cx, 3
MoreCardsForUser:
mov al, 0dh
Call WriteChar
mov al, 0ah
Call WriteChar
Call PrintCardNum
add UserSumCards, eax
Call PrintCardType
mov al, ' '
Call WriteChar
cmp UserSumCards, 21
jg UserLose
mov edx, OFFSET MsgMoreCards
Call WriteString
Call ReadChar
mov charIn, al
cmp charIn, 'C'
je MoreCardsForUser
cmp charIn, 'S'
je CompPlayAgain
jmp STOPGAME
USERLOSE:
mov edx, OFFSET MsgLOSE
Call WriteString
jmp STOPGAME
CompPlayAgain:
Call ComputerHit
mov ebx, CompSumCards
cmp ebx, UserSumCards
jge StopGame
cmp CompSumCards, 21
jl CompPlayAgain
STOPGAME:
mov eax, UserSumCards
Call WriteDec
mov ax, 4c00h
int 21h
main endp
PrintCardNum Proc
; Print the Number of Card
mov eax, 13 ; Set the value to 13 (n - 1 or eax - 1)
Call RandomRange ; Get the Number of the Card
inc eax
cmp eax, 1
je Jack
cmp eax, 11
je Jay
cmp eax, 12
je Qu
cmp eax, 13
je Ka
jmp PrintNum
Jack:
mov al, 65
jmp PrintLetter ;the ace is missing
Jay:
mov al, 74
jmp PrintLetter
Qu:
mov al, 81
jmp PrintLetter
Ka:
mov al, 75
PrintLetter:
Call WriteChar
cmp eax, 11
jge LetterJQoK
mov eax, 11
jmp Continue01
LetterJQoK:
mov eax, 10
jmp Continue01
PrintNum:
Call WriteDec ; Print the Number of the Card
mov CardValue, eax
Continue01:
ret
PrintCardNum endp
PrintCardType proc
; Print the Card
mov eax, 4 ; Set the value to 4 (n - 1 or eax - 1)
Call RandomRange ; Get the Number of the Card
inc eax
cmp eax, 1
je heart
cmp eax, 2
je diamond
cmp eax, 3
je clover
jmp Spade
heart:
mov al, 3 ; heart
jmp PrintCard
diamond:
mov al, 4 ; diamond
jmp PrintCard
clover:
mov al, 5 ; clover
jmp PrintCard
spade:
mov al, 6 ; spade
PrintCard:
Call WriteChar
ret
PrintCardType endp
ComputerHit proc
Call PrintCardNum
add CompSumCards, eax
Call PrintCardType
mov al, ' '
Call WriteChar
mov eax, CompSumCards
Call WriteDec
ret
ComputerHit endp
end main