Advertisement
shawonrog

GAME

Dec 3rd, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.74 KB | None | 0 0
  1.  
  2. ;**********________*******
  3. ;GAME VERSION_0.01
  4. ;
  5. ;
  6. .model small
  7. .stack 100h
  8. .data
  9. msg1 dw " WECOME TO PUZZLE WORD!!-V:0.01$"
  10. msg2 dw " GET READY TO CRACK YOUR BRAIN!!!$"
  11. msg3 dw " Get Ready$"
  12. msg4 dw " Give your answers in upper_cse.. Stage 1$"
  13. msg5 dw " Here Computer Will Give You Some jumble words!!!$"
  14. msg6 dw " for every right answer you will get 1 point!!! $"
  15.  
  16. Q1S1 DW "HAND$" ;QUESTION ANSWER OF FIRST STAGE
  17. Q2S1 DW "DHAKA$" ;
  18. Q3S1 DW "CAT$" ;
  19.  
  20. 1S2 DW "CHEST$" ;QUESTION ANSWER OF 2ND STAGE
  21. 2S2 DW "MANGO$" ;
  22. 3S2 DW "HORSE$" ;
  23.  
  24. USER DW 5 DUP('$')
  25. SCORE DB "WELL PLAYED...!!!.. YOUR SCORE=$"
  26. Q1 DW "REARRANGE THE JUMBLE WORD:(HINT: A PART OF BODY 'NDAH')$"
  27. Q2 DW "REARRANGE THE JUMBLE WORD:(HINT: NAME OF A DISTRICT 'HAAKD')$"
  28. Q3 DW "REARRANGE THE JUMBLE WORD:(HINT: NAME OF AN ANIMAL 'TAC')$"
  29. FAIL DW "WRONG ANSWER! NICE TRY ! YOU SHOULD TRY AGAIN...'FAILURE IS THE KEY TO SUCCESS..!!$"
  30. STAGE2 DW "Stage Two...This time No Hints...!!$"
  31. Q1S2 DW "REARRANGE THE JUMBLE WORD:('ESTHC')$"
  32. Q2S2 DW "REARRANGE THE JUMBLE WORD:('MNOGA')$"
  33. Q3S2 DW "REARRANGE THE JUMBLE WORD:('EORSH')$"
  34. ENDD DW "ALL LEVELS CLEARED..!!..WAIT FOR NEW VERSION..WITH MORE LEVELS$"
  35. ENDDD DW "...........THAN YOU FOR PLAYING ........,$"
  36.  
  37. .CODE
  38. MAIN PROC
  39. MOV AX,@DATA ;FOR ACCESSING VARIABLES SENDING ADDRESS OF THE DATA TO DS
  40. MOV DS,AX ; INISIALIZED HEAP MEMORY
  41. MOV ES,AX
  42. MOV BL,30H ;INITIALIZING SCORE
  43. ;OPENNING OF THE GAME ..
  44.  
  45. lea dx,msg1
  46. mov ah,9
  47. int 21h
  48.  
  49. CALL NEWLINE ;FOR A NEW_LINE
  50.  
  51. lea dx,msg2
  52. mov ah,9
  53. int 21h
  54.  
  55. CALL NEWLINE
  56.  
  57. lea dx,msg3
  58. mov ah,9
  59. int 21h
  60.  
  61. CALL NEWLINE
  62. CALL NEWLINE
  63. CALL NEWLINE
  64.  
  65. lea dx,msg4
  66. mov ah,9
  67. int 21h
  68.  
  69. CALL NEWLINE
  70. CALL NEWLINE
  71.  
  72. lea dx,msg5
  73. mov ah,9
  74. int 21h
  75. CALL NEWLINE
  76.  
  77. lea dx,msg6
  78. mov ah,9
  79. int 21h
  80. CALL NEWLINE
  81. ; CODE FOR GAME BEGINS !!!!!!...
  82.  
  83. ;QUESTION ONE ..
  84. CALL NEWLINE
  85.  
  86. lea dx,Q1
  87. mov ah,9
  88. int 21h
  89. CALL NEWLINE
  90.  
  91. CALL READING
  92. JMP READ1
  93. READ_END_Q1: ;FUNCTION FOR COMPARING THE INPUT AND ANSWER
  94. MOV CX,5 ;INITIALIZE HOW MANY CAR TO COMPARE /LENGTH OF THE BYTE
  95. LEA SI,Q1S1 ;TARGET STRING
  96. LEA DI,USER ;USER INPUT
  97. CLD ;START COMPARING FROM LEFT TO RIGHT
  98. REPE CMPSB ;REPEAT COMPARING STRING BYTE BY BYTE (REPE=REPAET WHILE EQUAL)(CMPSB=COMPARE STRING BYTE )
  99. JL MIS1
  100. JG MIS2
  101. MOV AX,0
  102. INC BL
  103. JMP QUESTION2
  104.  
  105. QUESTION2:
  106. CALL NEWLINE
  107. CALL NEWLINE
  108.  
  109. LEA DX,Q2
  110. MOV AH,9
  111. INT 21H
  112. CALL NEWLINE
  113. CALL READING
  114. JMP READ2
  115. READ_END_Q2:
  116.  
  117. MOV CX,5
  118. LEA SI,Q2S1
  119. LEA DI,USER
  120. CLD
  121. REPE CMPSB
  122. JL MIS1
  123. JG MIS2
  124. MOV AX,0
  125. INC BL
  126. JMP QUESTION3
  127.  
  128. QUESTION3:
  129. CALL NEWLINE
  130. CALL NEWLINE
  131.  
  132. LEA DX,Q3
  133. MOV AH,9
  134. INT 21H
  135. CALL NEWLINE
  136. CALL READING
  137. JMP READ3
  138. READ_END_Q3:
  139. MOV CX,5
  140. LEA SI,Q3S1
  141. LEA DI,USER
  142. CLD
  143. REPE CMPSB
  144. JL MIS1
  145. JG MIS2
  146. MOV AX,0
  147. INC BL
  148.  
  149. JMP STAGE_2
  150.  
  151.  
  152. ;2ND STAGE BEGINS...!!
  153.  
  154. STAGE_2:
  155. CALL NEWLINE
  156. CALL NEWLINE
  157. CALL NEWLINE
  158. LEA DX,STAGE2
  159. MOV AH,9
  160. INT 21H
  161.  
  162.  
  163. CALL NEWLINE
  164. CALL NEWLINE
  165.  
  166. LEA DX,Q1S2
  167. MOV AH,9
  168. INT 21H
  169. CALL NEWLINE
  170. CALL READING
  171. JMP READ11
  172. READ_END_Q11:
  173. MOV CX,5
  174. LEA SI,1S2
  175. LEA DI,USER
  176. CLD
  177. REPE CMPSB
  178. JL MIS1
  179. JG MIS2
  180. MOV AX,0
  181. INC BL
  182.  
  183. JMP QUESTION_2
  184.  
  185. QUESTION_2:
  186. CALL NEWLINE
  187. CALL NEWLINE
  188.  
  189. LEA DX,Q2S2
  190. MOV AH,9
  191. INT 21H
  192. CALL NEWLINE
  193. CALL READING
  194. JMP READ22
  195. READ_END_Q22:
  196. MOV CX,5
  197. LEA SI,2S2
  198. LEA DI,USER
  199. CLD
  200. REPE CMPSB
  201. JL MIS1
  202. JG MIS2
  203. MOV AX,0
  204. INC BL
  205.  
  206. JMP QUESTION_3
  207.  
  208. QUESTION_3:
  209.  
  210. CALL NEWLINE
  211. CALL NEWLINE
  212.  
  213. LEA DX,Q3S2
  214. MOV AH,9
  215. INT 21H
  216. CALL NEWLINE
  217. CALL READING
  218. JMP READ33
  219. READ_END_Q33:
  220. MOV CX,5
  221. LEA SI,3S2
  222. LEA DI,USER
  223. CLD
  224. REPE CMPSB
  225. JL MIS1
  226. JG MIS2
  227. MOV AX,0
  228. INC BL
  229.  
  230. JMP SCORE_PRINT_2
  231.  
  232.  
  233.  
  234.  
  235.  
  236. READ1: ;FUNCTION TO READ INPUT
  237. MOV AH,1
  238. INT 21H
  239. CMP AL,08H ;FOR BACK SPACE AND CORRECTION ON THAT BACK SPACE POINT ..
  240. JE B1
  241. CMP AL,13 ;ENDS READING STRING
  242. JE READ_END_Q1 ;FUNCTION FOR COMPARING
  243. MOV [SI],AL ;READS INPUT
  244. INC SI
  245.  
  246. JMP READ1
  247. B1:
  248. DEC SI
  249. DEC AX
  250. JMP READ1
  251. READ11:
  252. ;FUNCTION TO READ INPUT
  253. MOV AH,1
  254. INT 21H
  255. CMP AL,08H
  256. JE B11
  257. CMP AL,13 ;ENDS READING STRING
  258. JE READ_END_Q11 ;FUNCTION FOR COMPARING
  259. MOV [SI],AL
  260. INC SI
  261.  
  262. JMP READ11
  263. B11:
  264. DEC SI
  265. DEC AX
  266. JMP READ11
  267.  
  268. READ2:
  269. ;FUNCTION TO READ INPUT
  270. MOV AH,1
  271. INT 21H
  272. CMP AL,08H
  273. JE B2
  274. CMP AL,13 ;ENDS READING STRING
  275. JE READ_END_Q2 ;FUNCTION FOR COMPARING
  276. MOV [SI],AL
  277. INC SI
  278.  
  279. JMP READ2
  280. B2:
  281. DEC SI
  282. DEC AX
  283. JMP READ2
  284.  
  285.  
  286. READ22:
  287. ;FUNCTION TO READ INPUT
  288. MOV AH,1
  289. INT 21H
  290. CMP AL,08H
  291. JE B22
  292. CMP AL,13 ;ENDS READING STRING
  293. JE READ_END_Q22 ;FUNCTION FOR COMPARING
  294. MOV [SI],AL
  295. INC SI
  296.  
  297. JMP READ22
  298. B22:
  299. DEC SI
  300. DEC AX
  301. JMP READ22
  302.  
  303. READ3:
  304. ;FUNCTION TO READ INPUT
  305. MOV AH,1
  306. INT 21H
  307. CMP AL,08H
  308. JE B3
  309. CMP AL,13 ;ENDS READING STRING
  310. JE READ_END_Q3 ;FUNCTION FOR COMPARING
  311. MOV [SI],AL
  312. INC SI
  313.  
  314. JMP READ3
  315.  
  316. B3:
  317. DEC SI
  318. DEC AX
  319. JMP READ3
  320.  
  321. READ33:
  322. ;FUNCTION TO READ INPUT
  323. MOV AH,1
  324. INT 21H
  325. CMP AL,08H
  326. JE B33
  327. CMP AL,13 ;ENDS READING STRING
  328. JE READ_END_Q33 ;FUNCTION FOR COMPARING
  329. MOV [SI],AL
  330. INC SI
  331.  
  332. JMP READ33
  333. B33:
  334. DEC SI
  335. DEC AX
  336. JMP READ33
  337.  
  338.  
  339. SCORE_PRINT: ;PRINTS SCORE
  340. CALL NEWLINE
  341. CALL NEWLINE
  342. LEA DX,SCORE
  343. MOV AH,9
  344. INT 21H
  345.  
  346. MOV AH,2
  347. MOV DL,BL
  348. INT 21H
  349. JMP EXIT
  350.  
  351. SCORE_PRINT_2: ;AFTER FINISHING
  352. CALL NEWLINE
  353. CALL NEWLINE
  354. LEA DX,SCORE
  355. MOV AH,9
  356. INT 21H
  357.  
  358. MOV AH,2
  359. MOV DL,BL
  360. INT 21H
  361.  
  362. CALL NEWLINE
  363. CALL NEWLINE
  364.  
  365. LEA DX,ENDD
  366. MOV AH,9
  367. INT 21H
  368.  
  369. CALL NEWLINE
  370. CALL NEWLINE
  371. CALL NEWLINE
  372. LEA DX,ENDDD
  373. MOV AH,9
  374. INT 21H
  375.  
  376. JMP EXIT
  377.  
  378.  
  379. MIS1:
  380. CALL NEWLINE
  381. CALL NEWLINE
  382. MOV AX,1
  383. LEA DX,FAIL
  384. MOV AH,9
  385. INT 21H
  386. JMP SCORE_PRINT
  387. JMP EXIT
  388.  
  389. MIS2:
  390. CALL NEWLINE
  391. CALL NEWLINE
  392. MOV AX,2
  393. LEA DX,FAIL
  394. MOV AH,9
  395. INT 21H
  396. JMP SCORE_PRINT
  397. JMP EXIT
  398.  
  399. EXIT:
  400. MAIN ENDP
  401.  
  402. ;READING PROC
  403.  
  404. READING PROC
  405. MOV SI ,OFFSET USER ;SI POINTS TO 1ST INDEX OF THE STRING
  406.  
  407.  
  408. RET
  409. READING ENDP
  410. NEWLINE PROC
  411. MOV AH,2
  412. MOV DL,0AH
  413. INT 21H
  414. MOV AH,2
  415. MOV DL,0DH
  416. INT 21H
  417.  
  418. RET
  419. NEWLINE ENDP
  420. END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement