I have this task in assembly to do some game, for this game I need to get two numbers from array and make the to one number, like if I have 2, 3
i need to make it 23
, how can i do it? I don't know really how can I give more information, I will glad if you can tell me how to help you.
from the comment I can see that assembly can hold string variables, I don't know how to do it but I guess it will be much easier, the items in the array are int values (I think), here is the game code:
IDEAL
MODEL small
STACK 100h
DATASEG
CODESEG
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',10,13,'$'
computerw db 'you lose',10,13,'$'
message db 5 dup (?)
lengthi dw ?
firstMsg db 'Enter the maximum number that the computer can draw (the max is 2 digits):',10,13,'$'
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
proc lineBreak
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
ret
endp lineBreak
start:
mov ax, @data
mov ds, ax
;;;;;;;;;;;;;;;;;;;;;;
push seg firstMsg
pop ds
mov dx, offset firstMsg
mov ah, 9h
int 21h
mov dx, offset message
mov bx, dx
mov [byte ptr bx], 3
mov ah, 0Ah
int 21h
call lineBreak
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:
call lineBreak
push seg userw
pop ds
mov dx, offset userw
mov ah, 9h
int 21h
jmp exit
computerwin:
call lineBreak
push seg computerw
pop ds
mov dx, offset computerw
mov ah, 9h
int 21h
exit:
mov ax, 4c00h
int 21h
END start
here's the part of the array:
message db 5 dup (?)
mov dx, offset message
mov bx, dx
mov [byte ptr bx], 3
mov ah, 0Ah
int 21h
if it matter, I need the numbers for the user can say what's the max number that the computer can draw