Answer To: need to be done via assembly programing
Pulkit answered on Apr 19 2021
Sol/1024.asm
.MODEL SMALL
.STACK 100H
NEW_LINE MACRO
MOV AH, 2
MOV DL, 0DH
INT 21H
MOV DL, 0AH
INT 21H
ENDM
CLRSCR MACRO
MOV AH, 6
XOR AL, AL
XOR CX, CX
MOV DX, 184FH
MOV BH, 7
INT 10H
ENDM
MOVCURSOR_R MACRO
MOV AH, 3
XOR BH, BH
INT 10H
MOV AH, 2
INC DL
INT 10H
ENDM
MOVCURSOR_L MACRO
MOV AH, 3
XOR BH, BH
INT 10H
MOV AH, 2
DEC DL
INT 10H
ENDM
SETCURSOR MACRO R, C
MOV AH, 2
XOR BH, BH
MOV DH, R
MOV DL, C
INT 10H
ENDM
NUMS MACRO LP1, LP2, LP3, LP4, CNT, OUTS, VAL
CMP CHOISE, 1
JE NUMBERS
ALPHABETS:
MOV AL, VAL
MOV AH, 9
XOR BH, BH
MOV CX, 1
MOV BL, 34H
INT 10H
JMP OUTS
NUMBERS:
MOV CX, 4
MOV DL, VAL
CMP DL, 0
JE LP4:
MOV AX, 1
MOV CX, 0
MOV CL, DL
SUB CL, 'A'
ADD CL, 1
SAL AX, CL
MOV LEN, 0
MOV BL, 10
LP1:
DIV BL
MOV CX, 0
MOV CL, AH
ADD CL, 48
PUSH CX
ADD LEN, 1
MOV AH, 0
CMP AL, 0
JNE LP1
MOV AL, 4
SUB AL, LEN
CMP AL, 0
JE CNT
MOV CX, 0
MOV CL, AL
MOV AH, 2
MOV DL, ' '
LP2:
INT 21H
LOOP LP2
CNT:
LP3:
SUB LEN, 1
POP AX
MOV AH, 9
XOR BH, BH
MOV CX, 1
MOV BL, 34H
INT 10H
MOVCURSOR_R
CMP LEN, 0
JNE LP3
MOV DL, ' '
INT 21H
JMP OUTS
MOV CX, 4
LP4:
MOV AH, 2
MOV DL, ' '
INT 21H
LOOP LP4
INT 21H
OUTS:
ENDM
MACRO C_SCORE
MOV AX, SCORE
MOV DX, 0
MOV BX, 10
MOV LEN, 0
L1:
MOV DX, 0
DIV BX
PUSH DX
ADD LEN, 1
CMP AX, 0
JNE L1
SETCURSOR 23, 25
MOV AH, 9
LEA DX, STR7
INT 21H
L2:
POP DX
ADD DL, 48
SUB LEN, 1
MOV AH, 2
INT 21H
CMP LEN, 0
JNE L2
ENDM
MACRO UNDERLINE
MOV LEN, 10
UND:
SUB LEN, 1
MOV AH, 2
MOV DL, '_'
INT 21H
CMP LEN, 0
JNE UND
ENDM
MACRO UNUNDERLINE UNUND
MOV LEN, 10
UNUND:
SUB LEN, 1
MOV AH, 2
MOV DL, ' '
INT 21H
CMP LEN, 0
JNE UNUND
ENDM
MACRO COOL G1, G2, G3, E1, STR
LEA SI, STR
G1:
MOV DL, [SI]
CMP DL, '$'
JE E1
MOV TMP1,DL
MOV TMP2, DL
MOV LEN, 12
MOV DL, TMP1
G2:
DEC LEN
INC TMP1
MOV AL, TMP1
MOV CX, 1
MOV AH, 9H
INT 10H
MOV CX, 30000
G3:
LOOP G3
CMP LEN, 0
JNE G2
MOV AL, TMP2
MOV CX, 1
MOV AH, 9H
INT 10H
MOVCURSOR_R
INC SI
JMP G1
E1:
ENDM
.DATA
ARR DB 17 DUP(0)
BEG DB 0
SCORE DW 0
TSC DW 1
CALC DB 0
USERIN DB ?
CSR DB 0 ;CURSOR ROW POSITION
CSC DB 0 ;CURSOR COLUMN POSITION
LEN DB 0
TMP DW ?
TMP1 DB ?
TMP2 DB ?
TMP3 DB ?
FLAG DB 'A'
FLAG2 DB 0
DONE DB 0
CHOISE DB 0 ;FOR GAME MODE
MODE DB 0
STR1 DB "YOU LOSE...$"
STR2 DB "YOU ARE A WINNER!$"
STR3 DB "L = LEFT, R = RIGHT, U = UP, D = DOWN"
STR4 DB "2048 GAME $"
STR5 DB "GAME ENDED... PRESS Esc$"
STR6 DB "PRESS Esc FOR MENU$"
STR7 DB "SCORE: $"
STR8 DB "** 2048 **$"
STR9 DB "1. ADVANCED MODE$"
STR10 DB "2. KID MODE$"
STR11 DB "EXIT$"
STRZ DB 2 DUP("$")
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
SETWINDOW: ;SET WINDOW SIZE TO 40*25
MOV AH, 0
MOV AL, 1
INT 10H
INITIALIZE: ;PRINT HOME PAGE
MOV SCORE, 0
MOV AH, 9
MOV AL, ' '
XOR BH, BH ;SET TEXT COLOUR FOR STR8
MOV BL, 10
MOV CX, 200
INT 10H
SETCURSOR 4, 14
COOL PP1, PP2, PP3, PP4, STR8
SETCURSOR 8, 10
MOV AH, 9
MOV...