Advertisement
NicoTheReaper

Tablero orga "bueno"

Nov 15th, 2019
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.24 KB | None | 0 0
  1. org 100h
  2. jmp programaPrincipal
  3.  
  4. caritaRusia db 001h,'$'
  5. caritaUSA db 002h,'$'
  6. USA_Empieza_msj db "Empieza USA", '$'
  7. Rusia_Empieza_msj db "Empieza Rusia", '$'
  8. Turno_Ruso_msj db "Turno de Rusia ",'$'
  9. Turno_Americano_msj db "Turno de USA ", '$'
  10. Disparos_msj db "Disparos Restantes: ", '$'
  11. Base_USA db 14, 20,'$'
  12. Base_Rusia db 10, 61, '$'
  13. Ganador_USA db "La victoria es de USA. Fin del juego", '$'
  14. Ganador_Rusia db "La victoria es de Rusia. Fin del juego", '$'
  15. Destruccion_BaseUSA db "Rusia destruyo la base secreta de USA",'$'
  16. Destruccion_BaseRusia db "USA destruyo la base secreta de Rusia",'$'
  17. CantidadW_USA db "Cantidad de W restantes de USA: ",'$'
  18. CantidadW_Rusia db "Cantidad de W restantes de Rusia: ",'$'
  19. numeroD_USA dw 4
  20. numeroU_USA dw 0
  21. numeroD_Rusia dw 5
  22. numeroU_Rusia dw 4
  23. controles_asciiart db " / ____| | | | | ",10,13," | | ___ _ __ | |_ _ __ ___ | | ___ ___ ",10,13," | | / _ \| '_ \| __| '__/ _ \| |/ _ \/ __|",10,13," | |___| (_) | | | | |_| | | (_) | | __/\__ \",10,13," \_____\___/|_| |_|\__|_| \___/|_|\___||___/",10,13,10,13,10,13,10,13,"Arriba: W",10,13,"Izquierda: A", 10,13, "Derecha: D",10,13, "Abajo: S", 10,13, "Disparar: Espacio",10,13,10,13,10,13,"Presione una tecla para empezar",'$'
  24. continuar db " | Presione una tecla para continuar",'$'
  25. felicidadesRusia db " ______ _ _ _ _ _ _____ _ ",10,13,"| ____| | (_) (_) | | | | | __ \ (_) ",10,13,"| |__ ___| |_ ___ _ __| | __ _ __| | ___ ___ | |__) | _ ___ _ __ _ ",10,13,"| __/ _ \ | |/ __| |/ _` |/ _` |/ _` |/ _ \/ __| | _ / | | / __| |/ _` |",10,13, "| | | __/ | | (__| | (_| | (_| | (_| | __/\__ \ | | \ \ |_| \__ \ | (_| |",10,13, "|_| \___|_|_|\___|_|\__,_|\__,_|\__,_|\___||___/ |_| \_\__,_|___/_|\__,_|",10,13,10,13,10,13,10,13,10,13,10,13,"Programado por: Costilla Santiago, Gauna Nicolas",10,13,"Presione: A para jugar de nuevo",10,13, "Presione: S para terminar",'$'
  26. felicidadesUSA db " ______ _ _ _ _ _ _ _ _____ ",10,13, "| ____| | (_) (_) | | | | | | | |/ ____| /\ ",10,13,"| |__ ___| |_ ___ _ __| | __ _ __| | ___ ___ | | | | (___ / \ ",10,13, "| __/ _ \ | |/ __| |/ _` |/ _` |/ _` |/ _ \/ __| | | | |\___ \ / /\ \ ",10,13,"| | | __/ | | (__| | (_| | (_| | (_| | __/\__ \ | |__| |____) / ____ \ ",10,13,"|_| \___|_|_|\___|_|\__,_|\__,_|\__,_|\___||___/ \____/|_____/_/ \_\",10,13,10,13,10,13,10,13,10,13,10,13,"Programado por: Costilla Santiago, Gauna Nicolas",10,13, "Presione: A para jugar de nuevo",10,13, "Presione: S para terminar",'$'
  27. ganador db 0 ;21 = gana rusia, 22= gana usa
  28.  
  29.  
  30. tablero db "00..........................WAR GAMES - 1983..............................",10,13,
  31. db "01.......-.....:**:::*=-..-++++:............:--::=WWW***+-++-.............",10,13,
  32. db "02...:=WWWWWWW=WWW=:::+:..::...--....:=+W==WWWWWWWWWWWWWWWWWWWWWWWW+-.....",10,13,
  33. db "03..-....:WWWWWWWW=-=WW*.........--..+::+=WWWWWWWWWWWWWWWWWWWW:..:=.......",10,13,
  34. db "04.......+WWWWWW*+WWW=-:-.........-+*=:::::=W*W=WWWW*++++++:+++=-.........",10,13,
  35. db "05......*WWWWWWWWW=..............::..-:--+++::-++:::++++++++:--..-........",10,13,
  36. db "06.......:**WW=*=...............-++++:::::-:+::++++++:++++++++............",10,13,
  37. db "07........-+:...-..............:+++++::+:++-++::-.-++++::+:::-............",10,13,
  38. db "08..........--:-...............::++:+++++++:-+:.....::...-+:...-..........",10,13,
  39. db "09..............-+++:-..........:+::+::++++++:-......-....-...---.........",10,13,
  40. db "10..............:::++++:-............::+++:+:.............:--+--.-........",10,13,
  41. db "11..............-+++++++++:...........+:+::+................--.....---....",10,13,
  42. db "12................:++++++:...........-+::+::.:-................-++:-:.....",10,13,
  43. db "13.................++::+-.............::++:..:...............++++++++-....",10,13,
  44. db "14.................:++:-...............::-..................-+:--:++:.....",10,13,
  45. db "15.................:+-............................................-.....--",10,13,
  46. db "16.................:....................................................--",10,13,
  47. db "17.......UNITED STATES.........................SOVIET UNION...............",'$'
  48.  
  49. ProgramaPrincipal:
  50. inicio:
  51. call limpiar
  52. xor dx,dx
  53. call SetCursor
  54. call Controles
  55. call IniciarJuego
  56. call Jugar
  57. call Creditos
  58.  
  59. pedirTeclaCreditos:
  60. mov ah, 00h
  61. int 16h
  62. cmp al, 'a'
  63. je inicio
  64. cmp al, 's'
  65. jne pedirTeclaCreditos
  66.  
  67. ret
  68.  
  69. proc Creditos
  70. call limpiar
  71. mov dh, 0
  72. mov dl, 0
  73. call SetCursor
  74. cmp ganador, 21
  75. je ArteRusia
  76.  
  77. ArteUSA:
  78.  
  79. mov dx, offset felicidadesUSA
  80. mov ah, 9
  81. int 21h
  82. jmp finCreditos
  83.  
  84. ArteRusia:
  85. mov dx, offset felicidadesRusia
  86. mov ah, 9
  87. int 21h
  88.  
  89. finCreditos:
  90. ret
  91.  
  92. endp Creditos
  93.  
  94. proc Controles
  95.  
  96. mov dx, offset controles_asciiart
  97. mov ah, 9
  98. int 21h
  99.  
  100. mov ah, 00h
  101. int 16h
  102.  
  103. call limpiar
  104.  
  105. endp Controles
  106. ret
  107.  
  108. proc IniciarJuego
  109. mov dh, 0
  110. mov dl, 0
  111. call SetCursor
  112. call ImprimirTablero
  113.  
  114. mov dh, 22
  115. mov dl, 1
  116. call SetCursor
  117. mov dx, offset CantidadW_USA
  118. mov ah, 9
  119. int 21h
  120.  
  121. call WUSA
  122.  
  123. mov dh, 23
  124. mov dl, 1
  125. call SetCursor
  126. mov dx, offset CantidadW_Rusia
  127. mov ah, 9
  128. int 21h
  129.  
  130. call WRusia
  131.  
  132.  
  133.  
  134. call TurnoInicial
  135. cmp al,1
  136. je EmpiezaUSA
  137.  
  138. EmpiezaRusia:
  139. push ax ;guardo al para saber de quien es el turno
  140. mov dh, 18
  141. mov dl, 1
  142. call SetCursor
  143. mov dx, offset Rusia_Empieza_msj
  144. mov ah, 9
  145. int 21h
  146.  
  147. jmp fin_IniciarJuego
  148.  
  149. EmpiezaUSA:
  150. push ax ;guardo al para saber de quien es el turno
  151. mov dh, 18
  152. mov dl, 1
  153. call SetCursor
  154. mov dx, offset USA_Empieza_msj
  155. mov ah, 9
  156. int 21h
  157.  
  158.  
  159. fin_IniciarJuego:
  160. pop ax
  161. ret
  162. endp IniciarJuego
  163. ;------------------------------------
  164.  
  165. proc Jugar
  166. cmp al, 1
  167. je TurnoAmericano
  168.  
  169. TurnoRuso:
  170. call PunteroUSA
  171. cmp ganador, 21 ;si gana Rusia
  172. je finJuego
  173.  
  174. TurnoAmericano:
  175. call PunteroRusia
  176. cmp ganador, 22 ;si gana USA
  177. je finJuego
  178.  
  179.  
  180. jmp TurnoRuso
  181.  
  182. finJuego:
  183. mov dx, offset continuar
  184. mov ah, 9
  185. int 21h
  186.  
  187. mov ah, 00h
  188. int 16h
  189. ret
  190. endp Jugar
  191.  
  192. ;-------------------------------------
  193.  
  194. ;Imprimo Tablero
  195. proc ImprimirTablero
  196.  
  197. mov ah,09
  198. mov dx,offset tablero
  199. int 21h
  200.  
  201. ret
  202. imprimirTablero endp
  203. ;---------------------
  204.  
  205. ;Elegir quien va primero
  206. proc TurnoInicial
  207. push bx
  208.  
  209. otra_vez_1o2:
  210. mov ah, 2ch ; Esta interrupcion me entrega la hora fragmentada en los registros,
  211. ; CH(h) CL(m) DH(s),DL (centesimo seg)int 21h ; como este es solo un entero entre 1y6
  212. ;tomo solo los centesimo seg
  213. int 21h
  214. xor ah,ah
  215. mov al,dl
  216. mov bl,10
  217. div bl ;Divido por 10 y me quedo con el resto
  218. ;de la division para garantizar entero de
  219. ;un solo digito
  220.  
  221. cmp al,1 ;si es 1 va a fin
  222. je fin_TurnoInicial
  223.  
  224. cmp al,2
  225. je fin_TurnoInicial
  226. jmp otra_vez_1o2
  227.  
  228.  
  229. fin_TurnoInicial:
  230. pop bx
  231. ret
  232. endp TurnoInicial
  233.  
  234. ;------------------------
  235.  
  236. ;Puntero USA
  237. proc PunteroUSA
  238.  
  239. mov cx, 3 ; Cantidad de disparos
  240.  
  241. mov dh, 19 ;
  242. mov dl, 1 ; Posiciono el cursor en la linea donde escribo el msj de disparos
  243. call SetCursor ;
  244.  
  245. mov dx, offset Disparos_msj
  246. mov ah, 9
  247. int 21h
  248.  
  249. mov dh, 19 ;
  250. mov dl, 22 ; seteo cursor en donde escribo el numero de disparos
  251. call SetCursor ;
  252.  
  253. mov dx,cx ;
  254. add dx,30h ;imprimo el numero de disparos restantes
  255. mov ah,2 ;
  256. int 21h ;
  257.  
  258. mov dl, 3 ; Posicion del cursor columna
  259. mov dh, 2 ; Posicion del cursor fila
  260. call SetCursor
  261.  
  262. pedirtecla:
  263. mov ah, 00h
  264. int 16h
  265.  
  266. cmp al, 's' ;Compara que tecla se presiono, si es 's'
  267. je Down
  268.  
  269. cmp al, 'w' ;Compara que tecla se presiono, si es 'w'
  270. je Up
  271.  
  272. cmp al, 'a' ;Compara que tecla se presiono, si es 'a'
  273. je Left
  274.  
  275. cmp al, 'd' ;Compara que tecla se presiono, si es 'd'
  276. je Right
  277.  
  278. cmp al, ' ' ;Compara que tecla se presiono, si es 'espacio'
  279. je ShootUSA
  280.  
  281. jmp pedirtecla ;Sino, no hace nada y vuelve a pedir una tecla
  282.  
  283. ShootUSA:
  284. call CheckW
  285. cmp al, 'W'
  286. jne chequearbaseUSA
  287. call DecrementarW_USA
  288. call WUSA
  289. cmp numeroD_USA, 0
  290. jne chequearbaseUSA
  291. cmp numeroU_USA, 0
  292. je ganaRusia
  293.  
  294.  
  295. chequearbaseUSA:
  296. cmp dh, 14
  297. jne NoEsBaseUSA
  298. cmp dl, 20
  299. jne NoEsBaseUSA
  300. jmp ganaRusia
  301. ret
  302.  
  303. NoEsBaseUSA:
  304.  
  305. disparoUSA1:
  306. push dx
  307. mov dx,offset caritaUSA ;
  308. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  309. int 21h
  310. pop dx
  311.  
  312.  
  313.  
  314. add dh, 1
  315. call SetCursor
  316.  
  317. cmp dh,14
  318. jne chequearWusa2
  319. cmp dl, 20
  320. jne chequearWusa2
  321. jmp DestruyenBaseUSA
  322.  
  323. chequearWusa2:
  324. call CheckW
  325. cmp al, 'W'
  326. jne disparoUSA2
  327. call DecrementarW_USA
  328. call WUSA
  329. cmp numeroD_USA, 0
  330. jne disparoUSA2
  331. cmp numeroU_USA, 0
  332. je ganaRusia
  333.  
  334. disparoUSA2:
  335. push dx
  336. mov dx,offset caritaUSA ;
  337. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  338. int 21h
  339. pop dx
  340.  
  341. add dl,1
  342. call SetCursor
  343.  
  344. cmp dh,14
  345. jne chequearWusa3
  346. cmp dl,20
  347. jne chequearWusa3
  348. jmp DestruyenBaseUSA
  349.  
  350. chequearWusa3:
  351. call CheckW
  352. cmp al, 'W'
  353. jne disparoUSA3
  354. call DecrementarW_USA
  355. call WUSA
  356. cmp numeroD_USA, 0
  357. jne disparoUSA3
  358. cmp numeroU_USA, 0
  359. je ganaRusia
  360.  
  361. disparoUSA3:
  362. push dx
  363. mov dx,offset caritaUSA ;
  364. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  365. int 21h
  366. pop dx
  367.  
  368. sub dl,2
  369. call SetCursor
  370.  
  371. cmp dh,14
  372. jne chequearWusa4
  373. cmp dl,20
  374. jne chequearWusa4
  375. jmp DestruyenBaseUSA
  376.  
  377. chequearWusa4:
  378. call CheckW
  379. cmp al, 'W'
  380. jne disparoUSA4
  381. call DecrementarW_USA
  382. call WUSA
  383. cmp numeroD_USA, 0
  384. jne disparoUSA4
  385. cmp numeroU_USA, 0
  386. je ganaRusia
  387.  
  388. disparoUSA4:
  389. push dx
  390. mov dx,offset caritaUSA ;
  391. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  392. int 21h
  393. pop dx
  394.  
  395. sub dh,1
  396. call SetCursor
  397.  
  398. cmp dh,14
  399. jne chequearWusa5
  400. cmp dl,20
  401. jne chequearWusa5
  402. jmp DestruyenBaseUSA
  403.  
  404. chequearWusa5:
  405. call CheckW
  406. cmp al, 'W'
  407. jne disparoUSA5
  408. call DecrementarW_USA
  409. call WUSA
  410. cmp numeroD_USA, 0
  411. jne disparoUSA5
  412. cmp numeroU_USA, 0
  413. je ganaRusia
  414.  
  415. disparoUSA5:
  416. push dx
  417. mov dx,offset caritaUSA ;
  418. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  419. int 21h
  420. pop dx
  421.  
  422. add dl,2
  423. call SetCursor
  424.  
  425. cmp dh,14
  426. jne chequearWusa6
  427. cmp dl,20
  428. jne chequearWusa6
  429. jmp DestruyenBaseUSA
  430.  
  431. chequearWusa6:
  432. call CheckW
  433. cmp al, 'W'
  434. jne disparoUSA6
  435. call DecrementarW_USA
  436. call WUSA
  437. cmp numeroD_USA, 0
  438. jne disparoUSA6
  439. cmp numeroU_USA, 0
  440. je ganaRusia
  441.  
  442. disparoUSA6:
  443. push dx
  444. mov dx,offset caritaUSA ;
  445. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  446. int 21h
  447. pop dx
  448.  
  449. sub dh, 1
  450. call SetCursor
  451.  
  452. cmp dh,14
  453. jne chequearWusa7
  454. cmp dl,20
  455. jne chequearWusa7
  456. jmp DestruyenBaseUSA
  457.  
  458. chequearWusa7:
  459. call CheckW
  460. cmp al, 'W'
  461. jne disparoUSA7
  462. call DecrementarW_USA
  463. call WUSA
  464. cmp numeroD_USA, 0
  465. jne disparoUSA7
  466. cmp numeroU_USA, 0
  467. je ganaRusia
  468.  
  469. disparoUSA7:
  470. push dx
  471. mov dx,offset caritaUSA ;
  472. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  473. int 21h
  474. pop dx
  475.  
  476. sub dl,1
  477. call SetCursor
  478.  
  479. cmp dh,14
  480. jne chequearWusa8
  481. cmp dl,20
  482. jne chequearWusa8
  483. jmp DestruyenBaseUSA
  484.  
  485. chequearWusa8:
  486. call CheckW
  487. cmp al, 'W'
  488. jne disparoUSA8
  489. call DecrementarW_USA
  490. call WUSA
  491. cmp numeroD_USA, 0
  492. jne disparoUSA8
  493. cmp numeroU_USA, 0
  494. je ganaRusia
  495.  
  496. disparoUSA8:
  497. push dx
  498. mov dx,offset caritaUSA ;
  499. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  500. int 21h
  501. pop dx
  502.  
  503. sub dl,1
  504. call SetCursor
  505.  
  506. cmp dh,14
  507. jne chequearWusa9
  508. cmp dl,20
  509. jne chequearWusa9
  510. jmp DestruyenBaseUSA
  511.  
  512. chequearWusa9:
  513. call CheckW
  514. cmp al, 'W'
  515. jne disparoUSA9
  516. call DecrementarW_USA
  517. call WUSA
  518. cmp numeroD_USA, 0
  519. jne disparoUSA9
  520. cmp numeroU_USA, 0
  521. je ganaRusia
  522.  
  523. disparoUSA9:
  524. mov dx,offset caritaUSA ;
  525. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  526. int 21h
  527. ;
  528.  
  529. dec cx ;decremento la cantidad de disparos
  530.  
  531. mov dh, 19 ;
  532. mov dl, 22 ;posiciono el cursor para indicar la cantidad de disparos
  533. call SetCursor ;
  534.  
  535. mov dx,cx ;
  536. add dx, 30h ;muevo a dx la cantidad de disparos e imprimo
  537. mov ah,2 ;
  538. int 21h ;
  539.  
  540. mov dl, 3 ; Posicion del cursor columna
  541. mov dh, 2 ; Posicion del cursor fila
  542. call SetCursor ; reposiciono el cursor
  543. cmp cx, 0
  544. je pasarTurnoUSA ; paso el turno si no quedan disparos sino reposiciono y pido tecla
  545.  
  546.  
  547. mov dl, 3 ; Posicion del cursor columna
  548. mov dh, 2 ; Posicion del cursor fila
  549.  
  550.  
  551. jmp pedirtecla
  552.  
  553. Right:
  554. cmp dl,31
  555. je volverizq
  556. add dl, 1 ;para reposicionar el cursor columna
  557. call SetCursor ;llamo al procedimiento para setear cursor
  558. jmp pedirtecla
  559. ret
  560.  
  561. Left:
  562. cmp dl, 3
  563. je volverder
  564. sub dl, 1 ;para reposicionar el cursor columna
  565. call SetCursor ;llamo al procedimiento para setear cursor
  566. jmp pedirtecla
  567. ret
  568.  
  569. Up:
  570. cmp dh, 2
  571. je volverabaj
  572. sub dh, 1 ;para reposicionar el cursor fila
  573. call SetCursor ;llamo al procedimiento para setear cursor
  574. jmp pedirtecla
  575. ret
  576.  
  577. Down:
  578. cmp dh,15
  579. je volverarriba
  580. add dh, 1 ;para reposicionar el cursor fila
  581. call SetCursor ;llamo al procedimiento para setear cursor
  582. jmp pedirtecla
  583. ret
  584.  
  585. volverizq:
  586. mov dl, 3
  587. call SetCursor
  588. jmp pedirtecla
  589. ret
  590.  
  591. volverder:
  592. mov dl, 31
  593. call SetCursor
  594. jmp pedirtecla
  595. ret
  596.  
  597. volverabaj:
  598. mov dh, 15
  599. call SetCursor
  600. jmp pedirtecla
  601. ret
  602.  
  603. volverarriba:
  604. mov dh, 2
  605. call SetCursor
  606. jmp pedirtecla
  607. ret
  608.  
  609. pasarTurnoUSA:
  610. mov dh, 18
  611. mov dl, 1
  612. call SetCursor
  613. mov dx, offset Turno_Americano_msj
  614. mov ah, 9
  615. int 21h
  616. ret
  617.  
  618. ganaRusia:
  619. mov dx,offset caritaUSA ;
  620. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  621. int 21h
  622.  
  623. mov dh, 21
  624. mov dl, 1
  625. call SetCursor
  626.  
  627.  
  628. mov dx, offset Ganador_Rusia
  629. mov ah, 9
  630. int 21h
  631. mov ganador,21
  632. ret
  633.  
  634.  
  635. DestruyenBaseUSA:
  636. mov dx,offset caritaUSA ;
  637. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  638. int 21h
  639.  
  640. mov dh, 21
  641. mov dl, 1
  642. call SetCursor
  643.  
  644.  
  645. mov dx, offset Destruccion_BaseUSA
  646. mov ah, 9
  647. int 21h
  648. mov ganador,21
  649. ret
  650.  
  651.  
  652. endp PunteroUSA
  653. ;----------------------
  654.  
  655. ;llamo a la instruccion que setea el cursor
  656.  
  657. SetCursor proc
  658. mov ah, 02h
  659. mov bh, 00
  660. int 10h ;coloca el cursor en las coordenadas de DL y DH
  661. ret
  662.  
  663. SetCursor endp
  664. ;--------------
  665.  
  666. proc PunteroRusia
  667.  
  668.  
  669. mov cx, 3 ; Cantidad de disparos
  670.  
  671. mov dh, 19 ;
  672. mov dl, 1 ; Posiciono el cursor en la linea donde escribo el msj de disparos
  673. call SetCursor ;
  674.  
  675. mov dx, offset Disparos_msj
  676. mov ah, 9
  677. int 21h
  678.  
  679. mov dh, 19 ;
  680. mov dl, 22 ; seteo cursor en donde escribo el numero de disparos
  681. call SetCursor ;
  682.  
  683. mov dx,cx ;
  684. add dx,30h ;imprimo el numero de disparos restantes
  685. mov ah,2 ;
  686. int 21h ;
  687.  
  688. mov dl, 32 ; Posicion del cursor columna
  689. mov dh, 2 ; Posicion del cursor fila
  690. call SetCursor
  691.  
  692. pedirteclaR:
  693. mov ah, 00h
  694. int 16h
  695.  
  696. cmp al, 's' ;Compara que tecla se presiono, si es 's'
  697. je DownR
  698.  
  699. cmp al, 'w' ;Compara que tecla se presiono, si es 'w'
  700. je UpR
  701.  
  702. cmp al, 'a' ;Compara que tecla se presiono, si es 'a'
  703. je LeftR
  704.  
  705. cmp al, 'd' ;Compara que tecla se presiono, si es 'd'
  706. je RightR
  707.  
  708. cmp al, ' ' ;Compara que tecla se presiono, si es 'espacio'
  709. je ShootR
  710.  
  711. jmp pedirteclaR
  712.  
  713. ;Sino, no hace nada y vuelve a pedir una tecla
  714.  
  715. ShootR:
  716. call CheckW
  717. cmp al, 'W'
  718. jne chequearbaseRusia
  719. call DecrementarW_Rusia
  720. call WRusia
  721. cmp numeroD_Rusia,0
  722. jne chequearbaseRusia
  723. cmp numeroU_Rusia,0
  724. je ganaUSA
  725.  
  726.  
  727. chequearbaseRusia:
  728. cmp dh, 10
  729. jne NoEsBaseRusia
  730. cmp dl, 61
  731. jne NoEsBaseRusia
  732. jmp DestruyenBaseRusia
  733. ret
  734.  
  735. NoEsBaseRusia:
  736. disparoRusia1:
  737. push dx
  738. mov dx,offset caritaRusia ;
  739. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  740. int 21h
  741. pop dx
  742.  
  743.  
  744.  
  745. add dh, 1
  746. call SetCursor
  747.  
  748. cmp dh,10
  749. jne chequearWrusia2
  750. cmp dl, 61
  751. jne chequearWrusia2
  752. jmp DestruyenBaseRusia
  753.  
  754. chequearWrusia2:
  755. call CheckW
  756. cmp al, 'W'
  757. jne disparoRusia2
  758. call DecrementarW_Rusia
  759. call WRusia
  760. cmp numeroD_Rusia,0
  761. jne disparoRusia2
  762. cmp numeroU_Rusia,0
  763. je ganaUSA
  764.  
  765. disparoRusia2:
  766. push dx
  767. mov dx,offset caritaRusia ;
  768. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  769. int 21h
  770. pop dx
  771.  
  772. add dl,1
  773. call SetCursor
  774.  
  775. cmp dh,10
  776. jne chequearWrusia3
  777. cmp dl,61
  778. jne chequearWrusia3
  779. jmp DestruyenBaseRusia
  780.  
  781. chequearWrusia3:
  782. call CheckW
  783. cmp al, 'W'
  784. jne disparoRusia3
  785. call DecrementarW_Rusia
  786. call WRusia
  787. cmp numeroD_Rusia,0
  788. jne disparoRusia3
  789. cmp numeroU_Rusia,0
  790. je ganaUSA
  791.  
  792. disparoRusia3:
  793. push dx
  794. mov dx,offset caritaRusia ;
  795. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  796. int 21h
  797. pop dx
  798.  
  799. sub dl,2
  800. call SetCursor
  801.  
  802. cmp dh,10
  803. jne chequearWrusia4
  804. cmp dl,61
  805. jne chequearWrusia4
  806. jmp DestruyenBaseRusia
  807.  
  808. chequearWrusia4:
  809. call CheckW
  810. cmp al, 'W'
  811. jne disparoRusia4
  812. call DecrementarW_Rusia
  813. call WRusia
  814. cmp numeroD_Rusia,0
  815. jne disparoRusia4
  816. cmp numeroU_Rusia,0
  817. je ganaUSA
  818.  
  819. disparoRusia4:
  820. push dx
  821. mov dx,offset caritaRusia ;
  822. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  823. int 21h
  824. pop dx
  825.  
  826. sub dh,1
  827. call SetCursor
  828.  
  829. cmp dh,10
  830. jne chequearWrusia5
  831. cmp dl,61
  832. jne chequearWrusia5
  833. jmp DestruyenBaseRusia
  834.  
  835. chequearWrusia5:
  836. call CheckW
  837. cmp al, 'W'
  838. jne disparoRusia5
  839. call DecrementarW_Rusia
  840. call WRusia
  841. cmp numeroD_Rusia,0
  842. jne disparoRusia5
  843. cmp numeroU_Rusia,0
  844. je ganaUSA
  845.  
  846. disparoRusia5:
  847. push dx
  848. mov dx,offset caritaRusia ;
  849. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  850. int 21h
  851. pop dx
  852.  
  853. add dl,2
  854. call SetCursor
  855.  
  856. cmp dh,10
  857. jne chequearWrusia6
  858. cmp dl,61
  859. jne chequearWrusia6
  860. jmp DestruyenBaseRusia
  861.  
  862. chequearWrusia6:
  863. call CheckW
  864. cmp al, 'W'
  865. jne disparoRusia6
  866. call DecrementarW_Rusia
  867. call WRusia
  868. cmp numeroD_Rusia,0
  869. jne disparoRusia6
  870. cmp numeroU_Rusia,0
  871. je ganaUSA
  872.  
  873. disparoRusia6:
  874. push dx
  875. mov dx,offset caritaRusia ;
  876. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  877. int 21h
  878. pop dx
  879.  
  880. sub dh, 1
  881. call SetCursor
  882.  
  883. cmp dh,10
  884. jne chequearWrusia7
  885. cmp dl,61
  886. jne chequearWrusia7
  887. jmp DestruyenBaseRusia
  888.  
  889. chequearWrusia7:
  890. call CheckW
  891. cmp al, 'W'
  892. jne disparoRusia7
  893. call DecrementarW_Rusia
  894. call WRusia
  895. cmp numeroD_Rusia,0
  896. jne disparoRusia7
  897. cmp numeroU_Rusia,0
  898. je ganaUSA
  899.  
  900. disparoRusia7:
  901. push dx
  902. mov dx,offset caritaRusia ;
  903. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  904. int 21h
  905. pop dx
  906.  
  907. sub dl,1
  908. call SetCursor
  909.  
  910. cmp dh,10
  911. jne chequearWrusia8
  912. cmp dl,61
  913. jne chequearWrusia8
  914. jmp DestruyenBaseRusia
  915.  
  916. chequearWrusia8:
  917. call CheckW
  918. cmp al, 'W'
  919. jne disparoRusia8
  920. call DecrementarW_Rusia
  921. call WRusia
  922. cmp numeroD_Rusia,0
  923. jne disparoRusia8
  924. cmp numeroU_Rusia,0
  925. je ganaUSA
  926.  
  927. disparoRusia8:
  928. push dx
  929. mov dx,offset caritaRusia ;
  930. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  931. int 21h
  932. pop dx
  933.  
  934. sub dl,1
  935. call SetCursor
  936.  
  937. cmp dh,10
  938. jne chequearWrusia9
  939. cmp dl,61
  940. jne chequearWrusia9
  941. jmp DestruyenBaseRusia
  942.  
  943. chequearWrusia9:
  944. call CheckW
  945. cmp al, 'W'
  946. jne disparoRusia9
  947. call DecrementarW_Rusia
  948. call WRusia
  949. cmp numeroD_Rusia,0
  950. jne disparoRusia9
  951. cmp numeroU_Rusia,0
  952. je ganaUSA
  953.  
  954. disparoRusia9:
  955. mov dx,offset caritaRusia ;
  956. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  957. int 21h
  958.  
  959. dec cx
  960.  
  961. mov dh, 19 ;
  962. mov dl, 22 ;posiciono el cursor para indicar la cantidad de disparos
  963. call SetCursor ;
  964.  
  965. mov dx,cx ;
  966. add dx, 30h ;muevo a dx la cantidad de disparos e imprimo
  967. mov ah,2 ;
  968. int 21h ;
  969.  
  970. mov dl, 32 ; Posicion del cursor columna
  971. mov dh, 2 ; Posicion del cursor fila
  972. call SetCursor
  973.  
  974. cmp cx, 0
  975. je pasarTurnoRusia
  976.  
  977. mov dl, 32 ; Posicion del cursor columna
  978. mov dh, 2 ; Posicion del cursor fila
  979.  
  980.  
  981. jmp pedirteclaR
  982.  
  983. RightR:
  984. cmp dl,72
  985. je volverizqR
  986. add dl, 1 ;para reposicionar el cursor columna
  987. call SetCursor ;llamo al procedimiento para setear cursor
  988. jmp pedirteclaR
  989. ret
  990.  
  991. LeftR:
  992. cmp dl, 32
  993. je volverderR
  994. sub dl, 1 ;para reposicionar el cursor columna
  995. call SetCursor ;llamo al procedimiento para setear cursor
  996. jmp pedirteclaR
  997. ret
  998.  
  999. UpR:
  1000. cmp dh, 2
  1001. je volverabajR
  1002. sub dh, 1 ;para reposicionar el cursor fila
  1003. call SetCursor ;llamo al procedimiento para setear cursor
  1004. jmp pedirteclaR
  1005. ret
  1006.  
  1007. DownR:
  1008. cmp dh,15
  1009. je volverarribaR
  1010. add dh, 1 ;para reposicionar el cursor fila
  1011. call SetCursor ;llamo al procedimiento para setear cursor
  1012. jmp pedirteclaR
  1013. ret
  1014.  
  1015. volverizqR:
  1016. mov dl, 32
  1017. call SetCursor
  1018. jmp pedirteclaR
  1019. ret
  1020.  
  1021. volverderR:
  1022. mov dl, 72
  1023. call SetCursor
  1024. jmp pedirteclaR
  1025. ret
  1026.  
  1027. volverabajR:
  1028. mov dh, 15
  1029. call SetCursor
  1030. jmp pedirteclaR
  1031. ret
  1032.  
  1033. volverarribaR:
  1034. mov dh, 2
  1035. call SetCursor
  1036. jmp pedirteclaR
  1037. ret
  1038.  
  1039. pasarTurnoRusia:
  1040. mov dh, 18
  1041. mov dl, 1
  1042. call SetCursor
  1043. mov dx, offset Turno_Ruso_msj
  1044. mov ah, 9
  1045. int 21h
  1046.  
  1047. ret
  1048.  
  1049. ganaUSA:
  1050. mov dx,offset caritaRusia ;
  1051. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  1052. int 21h
  1053.  
  1054. mov dh, 21
  1055. mov dl, 1
  1056. call SetCursor
  1057.  
  1058.  
  1059. mov dx, offset Ganador_USA
  1060. mov ah, 9
  1061. int 21h
  1062. mov ganador,22
  1063. ret
  1064.  
  1065. DestruyenBaseRusia:
  1066. mov dx,offset caritaRusia ;
  1067. mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
  1068. int 21h
  1069.  
  1070. mov dh, 21
  1071. mov dl, 1
  1072. call SetCursor
  1073.  
  1074.  
  1075. mov dx, offset Destruccion_BaseRusia
  1076. mov ah, 9
  1077. int 21h
  1078. mov ganador,22
  1079. ret
  1080.  
  1081. endp PunteroRusia
  1082. ;------------------------
  1083.  
  1084. ; decrementa las W de USA
  1085.  
  1086. proc decrementarW_USA
  1087.  
  1088. cmp numeroD_USA,0
  1089. jne restarUSA
  1090. cmp numeroU_USA, 0
  1091. jne restarUSA
  1092. jmp dejarderestarUSA
  1093.  
  1094.  
  1095. restarUSA:
  1096.  
  1097. cmp numeroU_USA, 0
  1098. je restarDecUSA
  1099. dec numeroU_USA
  1100. ret
  1101.  
  1102.  
  1103. restarDecUSA:
  1104. mov numeroU_USA, 9
  1105. dec numeroD_USA
  1106. ret
  1107.  
  1108. dejarderestarUSA:
  1109. ret
  1110. endp decrementarW_USA
  1111.  
  1112. ;--------------------
  1113.  
  1114. ; decrementa las W de Rusia
  1115.  
  1116. proc decrementarW_Rusia
  1117.  
  1118. cmp numeroD_Rusia,0
  1119. jne restarRusia
  1120. cmp numeroU_Rusia, 0
  1121. jne restarRusia
  1122. jmp dejarderestarRusia
  1123.  
  1124.  
  1125. restarRusia:
  1126.  
  1127. cmp numeroU_Rusia, 0
  1128. je restarDecRusia
  1129. dec numeroU_Rusia
  1130. ret
  1131.  
  1132.  
  1133. restarDecRusia:
  1134. mov numeroU_Rusia, 9
  1135. dec numeroD_Rusia
  1136. ret
  1137.  
  1138. dejarderestarRusia:
  1139. ret
  1140. endp decrementarW_Rusia
  1141.  
  1142. ;--------------------
  1143.  
  1144. ;imprime las W de USA
  1145. proc WUSA
  1146.  
  1147. push dx
  1148. mov dh, 22
  1149. mov dl, 33
  1150. call SetCursor
  1151.  
  1152. mov dx, numeroD_USA
  1153. add dx, 30h
  1154. mov ah, 2
  1155. int 21h
  1156.  
  1157. mov dx, numeroU_USA
  1158. add dx, 30h
  1159. mov ah,2
  1160. int 21h
  1161. pop dx
  1162. call SetCursor
  1163. endp WUSA
  1164. ret
  1165. ;------------
  1166.  
  1167. ;imprime las W de Rusia
  1168. proc WRusia
  1169.  
  1170. push dx
  1171. mov dh, 23
  1172. mov dl, 35
  1173. call SetCursor
  1174.  
  1175. mov dx, numeroD_Rusia
  1176. add dx, 30h
  1177. mov ah, 2
  1178. int 21h
  1179.  
  1180. mov dx, numeroU_Rusia
  1181. add dx, 30h
  1182. mov ah,2
  1183. int 21h
  1184. pop dx
  1185. call SetCursor
  1186. endp WRusia
  1187. ret
  1188. ;------------
  1189.  
  1190. ;guarda en AL el caracter apuntado
  1191. proc CheckW
  1192. mov ah, 8
  1193. int 10h
  1194. endp CheckW
  1195. ret
  1196.  
  1197. proc limpiar
  1198. MOV AX,0600H ;06 TO SCROLL & 00 FOR FULLJ SCREEN
  1199. MOV BH,07H ;ATTRIBUTE 7 FOR BACKGROUND AND 1 FOR FOREGROUND
  1200. MOV CX,0000H ;STARTING COORDINATES
  1201. MOV DX,184FH ;ENDING COORDINATES
  1202. INT 10H ;FOR VIDEO DISPLAY
  1203. endp limpiar
  1204. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement