Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- jmp programaPrincipal
- caritaRusia db 001h,'$'
- caritaUSA db 002h,'$'
- USA_Empieza_msj db "Empieza USA", '$'
- Rusia_Empieza_msj db "Empieza Rusia", '$'
- Turno_Ruso_msj db "Turno de Rusia ",'$'
- Turno_Americano_msj db "Turno de USA ", '$'
- Disparos_msj db "Disparos Restantes: ", '$'
- Base_USA db 14, 20,'$'
- Base_Rusia db 10, 61, '$'
- Ganador_USA db "La victoria es de USA. Fin del juego", '$'
- Ganador_Rusia db "La victoria es de Rusia. Fin del juego", '$'
- Destruccion_BaseUSA db "Rusia destruyo la base secreta de USA",'$'
- Destruccion_BaseRusia db "USA destruyo la base secreta de Rusia",'$'
- CantidadW_USA db "Cantidad de W restantes de USA: ",'$'
- CantidadW_Rusia db "Cantidad de W restantes de Rusia: ",'$'
- numeroD_USA dw 4
- numeroU_USA dw 0
- numeroD_Rusia dw 5
- numeroU_Rusia dw 4
- 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",'$'
- continuar db " | Presione una tecla para continuar",'$'
- 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",'$'
- 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",'$'
- ganador db 0 ;21 = gana rusia, 22= gana usa
- tablero db "00..........................WAR GAMES - 1983..............................",10,13,
- db "01.......-.....:**:::*=-..-++++:............:--::=WWW***+-++-.............",10,13,
- db "02...:=WWWWWWW=WWW=:::+:..::...--....:=+W==WWWWWWWWWWWWWWWWWWWWWWWW+-.....",10,13,
- db "03..-....:WWWWWWWW=-=WW*.........--..+::+=WWWWWWWWWWWWWWWWWWWW:..:=.......",10,13,
- db "04.......+WWWWWW*+WWW=-:-.........-+*=:::::=W*W=WWWW*++++++:+++=-.........",10,13,
- db "05......*WWWWWWWWW=..............::..-:--+++::-++:::++++++++:--..-........",10,13,
- db "06.......:**WW=*=...............-++++:::::-:+::++++++:++++++++............",10,13,
- db "07........-+:...-..............:+++++::+:++-++::-.-++++::+:::-............",10,13,
- db "08..........--:-...............::++:+++++++:-+:.....::...-+:...-..........",10,13,
- db "09..............-+++:-..........:+::+::++++++:-......-....-...---.........",10,13,
- db "10..............:::++++:-............::+++:+:.............:--+--.-........",10,13,
- db "11..............-+++++++++:...........+:+::+................--.....---....",10,13,
- db "12................:++++++:...........-+::+::.:-................-++:-:.....",10,13,
- db "13.................++::+-.............::++:..:...............++++++++-....",10,13,
- db "14.................:++:-...............::-..................-+:--:++:.....",10,13,
- db "15.................:+-............................................-.....--",10,13,
- db "16.................:....................................................--",10,13,
- db "17.......UNITED STATES.........................SOVIET UNION...............",'$'
- ProgramaPrincipal:
- inicio:
- call limpiar
- xor dx,dx
- call SetCursor
- call Controles
- call IniciarJuego
- call Jugar
- call Creditos
- pedirTeclaCreditos:
- mov ah, 00h
- int 16h
- cmp al, 'a'
- je inicio
- cmp al, 's'
- jne pedirTeclaCreditos
- ret
- proc Creditos
- call limpiar
- mov dh, 0
- mov dl, 0
- call SetCursor
- cmp ganador, 21
- je ArteRusia
- ArteUSA:
- mov dx, offset felicidadesUSA
- mov ah, 9
- int 21h
- jmp finCreditos
- ArteRusia:
- mov dx, offset felicidadesRusia
- mov ah, 9
- int 21h
- finCreditos:
- ret
- endp Creditos
- proc Controles
- mov dx, offset controles_asciiart
- mov ah, 9
- int 21h
- mov ah, 00h
- int 16h
- call limpiar
- endp Controles
- ret
- proc IniciarJuego
- mov dh, 0
- mov dl, 0
- call SetCursor
- call ImprimirTablero
- mov dh, 22
- mov dl, 1
- call SetCursor
- mov dx, offset CantidadW_USA
- mov ah, 9
- int 21h
- call WUSA
- mov dh, 23
- mov dl, 1
- call SetCursor
- mov dx, offset CantidadW_Rusia
- mov ah, 9
- int 21h
- call WRusia
- call TurnoInicial
- cmp al,1
- je EmpiezaUSA
- EmpiezaRusia:
- push ax ;guardo al para saber de quien es el turno
- mov dh, 18
- mov dl, 1
- call SetCursor
- mov dx, offset Rusia_Empieza_msj
- mov ah, 9
- int 21h
- jmp fin_IniciarJuego
- EmpiezaUSA:
- push ax ;guardo al para saber de quien es el turno
- mov dh, 18
- mov dl, 1
- call SetCursor
- mov dx, offset USA_Empieza_msj
- mov ah, 9
- int 21h
- fin_IniciarJuego:
- pop ax
- ret
- endp IniciarJuego
- ;------------------------------------
- proc Jugar
- cmp al, 1
- je TurnoAmericano
- TurnoRuso:
- call PunteroUSA
- cmp ganador, 21 ;si gana Rusia
- je finJuego
- TurnoAmericano:
- call PunteroRusia
- cmp ganador, 22 ;si gana USA
- je finJuego
- jmp TurnoRuso
- finJuego:
- mov dx, offset continuar
- mov ah, 9
- int 21h
- mov ah, 00h
- int 16h
- ret
- endp Jugar
- ;-------------------------------------
- ;Imprimo Tablero
- proc ImprimirTablero
- mov ah,09
- mov dx,offset tablero
- int 21h
- ret
- imprimirTablero endp
- ;---------------------
- ;Elegir quien va primero
- proc TurnoInicial
- push bx
- otra_vez_1o2:
- mov ah, 2ch ; Esta interrupcion me entrega la hora fragmentada en los registros,
- ; CH(h) CL(m) DH(s),DL (centesimo seg)int 21h ; como este es solo un entero entre 1y6
- ;tomo solo los centesimo seg
- int 21h
- xor ah,ah
- mov al,dl
- mov bl,10
- div bl ;Divido por 10 y me quedo con el resto
- ;de la division para garantizar entero de
- ;un solo digito
- cmp al,1 ;si es 1 va a fin
- je fin_TurnoInicial
- cmp al,2
- je fin_TurnoInicial
- jmp otra_vez_1o2
- fin_TurnoInicial:
- pop bx
- ret
- endp TurnoInicial
- ;------------------------
- ;Puntero USA
- proc PunteroUSA
- mov cx, 3 ; Cantidad de disparos
- mov dh, 19 ;
- mov dl, 1 ; Posiciono el cursor en la linea donde escribo el msj de disparos
- call SetCursor ;
- mov dx, offset Disparos_msj
- mov ah, 9
- int 21h
- mov dh, 19 ;
- mov dl, 22 ; seteo cursor en donde escribo el numero de disparos
- call SetCursor ;
- mov dx,cx ;
- add dx,30h ;imprimo el numero de disparos restantes
- mov ah,2 ;
- int 21h ;
- mov dl, 3 ; Posicion del cursor columna
- mov dh, 2 ; Posicion del cursor fila
- call SetCursor
- pedirtecla:
- mov ah, 00h
- int 16h
- cmp al, 's' ;Compara que tecla se presiono, si es 's'
- je Down
- cmp al, 'w' ;Compara que tecla se presiono, si es 'w'
- je Up
- cmp al, 'a' ;Compara que tecla se presiono, si es 'a'
- je Left
- cmp al, 'd' ;Compara que tecla se presiono, si es 'd'
- je Right
- cmp al, ' ' ;Compara que tecla se presiono, si es 'espacio'
- je ShootUSA
- jmp pedirtecla ;Sino, no hace nada y vuelve a pedir una tecla
- ShootUSA:
- call CheckW
- cmp al, 'W'
- jne chequearbaseUSA
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne chequearbaseUSA
- cmp numeroU_USA, 0
- je ganaRusia
- chequearbaseUSA:
- cmp dh, 14
- jne NoEsBaseUSA
- cmp dl, 20
- jne NoEsBaseUSA
- jmp ganaRusia
- ret
- NoEsBaseUSA:
- disparoUSA1:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- add dh, 1
- call SetCursor
- cmp dh,14
- jne chequearWusa2
- cmp dl, 20
- jne chequearWusa2
- jmp DestruyenBaseUSA
- chequearWusa2:
- call CheckW
- cmp al, 'W'
- jne disparoUSA2
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA2
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA2:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- add dl,1
- call SetCursor
- cmp dh,14
- jne chequearWusa3
- cmp dl,20
- jne chequearWusa3
- jmp DestruyenBaseUSA
- chequearWusa3:
- call CheckW
- cmp al, 'W'
- jne disparoUSA3
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA3
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA3:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dl,2
- call SetCursor
- cmp dh,14
- jne chequearWusa4
- cmp dl,20
- jne chequearWusa4
- jmp DestruyenBaseUSA
- chequearWusa4:
- call CheckW
- cmp al, 'W'
- jne disparoUSA4
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA4
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA4:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dh,1
- call SetCursor
- cmp dh,14
- jne chequearWusa5
- cmp dl,20
- jne chequearWusa5
- jmp DestruyenBaseUSA
- chequearWusa5:
- call CheckW
- cmp al, 'W'
- jne disparoUSA5
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA5
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA5:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- add dl,2
- call SetCursor
- cmp dh,14
- jne chequearWusa6
- cmp dl,20
- jne chequearWusa6
- jmp DestruyenBaseUSA
- chequearWusa6:
- call CheckW
- cmp al, 'W'
- jne disparoUSA6
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA6
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA6:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dh, 1
- call SetCursor
- cmp dh,14
- jne chequearWusa7
- cmp dl,20
- jne chequearWusa7
- jmp DestruyenBaseUSA
- chequearWusa7:
- call CheckW
- cmp al, 'W'
- jne disparoUSA7
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA7
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA7:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dl,1
- call SetCursor
- cmp dh,14
- jne chequearWusa8
- cmp dl,20
- jne chequearWusa8
- jmp DestruyenBaseUSA
- chequearWusa8:
- call CheckW
- cmp al, 'W'
- jne disparoUSA8
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA8
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA8:
- push dx
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dl,1
- call SetCursor
- cmp dh,14
- jne chequearWusa9
- cmp dl,20
- jne chequearWusa9
- jmp DestruyenBaseUSA
- chequearWusa9:
- call CheckW
- cmp al, 'W'
- jne disparoUSA9
- call DecrementarW_USA
- call WUSA
- cmp numeroD_USA, 0
- jne disparoUSA9
- cmp numeroU_USA, 0
- je ganaRusia
- disparoUSA9:
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- ;
- dec cx ;decremento la cantidad de disparos
- mov dh, 19 ;
- mov dl, 22 ;posiciono el cursor para indicar la cantidad de disparos
- call SetCursor ;
- mov dx,cx ;
- add dx, 30h ;muevo a dx la cantidad de disparos e imprimo
- mov ah,2 ;
- int 21h ;
- mov dl, 3 ; Posicion del cursor columna
- mov dh, 2 ; Posicion del cursor fila
- call SetCursor ; reposiciono el cursor
- cmp cx, 0
- je pasarTurnoUSA ; paso el turno si no quedan disparos sino reposiciono y pido tecla
- mov dl, 3 ; Posicion del cursor columna
- mov dh, 2 ; Posicion del cursor fila
- jmp pedirtecla
- Right:
- cmp dl,31
- je volverizq
- add dl, 1 ;para reposicionar el cursor columna
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirtecla
- ret
- Left:
- cmp dl, 3
- je volverder
- sub dl, 1 ;para reposicionar el cursor columna
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirtecla
- ret
- Up:
- cmp dh, 2
- je volverabaj
- sub dh, 1 ;para reposicionar el cursor fila
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirtecla
- ret
- Down:
- cmp dh,15
- je volverarriba
- add dh, 1 ;para reposicionar el cursor fila
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirtecla
- ret
- volverizq:
- mov dl, 3
- call SetCursor
- jmp pedirtecla
- ret
- volverder:
- mov dl, 31
- call SetCursor
- jmp pedirtecla
- ret
- volverabaj:
- mov dh, 15
- call SetCursor
- jmp pedirtecla
- ret
- volverarriba:
- mov dh, 2
- call SetCursor
- jmp pedirtecla
- ret
- pasarTurnoUSA:
- mov dh, 18
- mov dl, 1
- call SetCursor
- mov dx, offset Turno_Americano_msj
- mov ah, 9
- int 21h
- ret
- ganaRusia:
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- mov dh, 21
- mov dl, 1
- call SetCursor
- mov dx, offset Ganador_Rusia
- mov ah, 9
- int 21h
- mov ganador,21
- ret
- DestruyenBaseUSA:
- mov dx,offset caritaUSA ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- mov dh, 21
- mov dl, 1
- call SetCursor
- mov dx, offset Destruccion_BaseUSA
- mov ah, 9
- int 21h
- mov ganador,21
- ret
- endp PunteroUSA
- ;----------------------
- ;llamo a la instruccion que setea el cursor
- SetCursor proc
- mov ah, 02h
- mov bh, 00
- int 10h ;coloca el cursor en las coordenadas de DL y DH
- ret
- SetCursor endp
- ;--------------
- proc PunteroRusia
- mov cx, 3 ; Cantidad de disparos
- mov dh, 19 ;
- mov dl, 1 ; Posiciono el cursor en la linea donde escribo el msj de disparos
- call SetCursor ;
- mov dx, offset Disparos_msj
- mov ah, 9
- int 21h
- mov dh, 19 ;
- mov dl, 22 ; seteo cursor en donde escribo el numero de disparos
- call SetCursor ;
- mov dx,cx ;
- add dx,30h ;imprimo el numero de disparos restantes
- mov ah,2 ;
- int 21h ;
- mov dl, 32 ; Posicion del cursor columna
- mov dh, 2 ; Posicion del cursor fila
- call SetCursor
- pedirteclaR:
- mov ah, 00h
- int 16h
- cmp al, 's' ;Compara que tecla se presiono, si es 's'
- je DownR
- cmp al, 'w' ;Compara que tecla se presiono, si es 'w'
- je UpR
- cmp al, 'a' ;Compara que tecla se presiono, si es 'a'
- je LeftR
- cmp al, 'd' ;Compara que tecla se presiono, si es 'd'
- je RightR
- cmp al, ' ' ;Compara que tecla se presiono, si es 'espacio'
- je ShootR
- jmp pedirteclaR
- ;Sino, no hace nada y vuelve a pedir una tecla
- ShootR:
- call CheckW
- cmp al, 'W'
- jne chequearbaseRusia
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne chequearbaseRusia
- cmp numeroU_Rusia,0
- je ganaUSA
- chequearbaseRusia:
- cmp dh, 10
- jne NoEsBaseRusia
- cmp dl, 61
- jne NoEsBaseRusia
- jmp DestruyenBaseRusia
- ret
- NoEsBaseRusia:
- disparoRusia1:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- add dh, 1
- call SetCursor
- cmp dh,10
- jne chequearWrusia2
- cmp dl, 61
- jne chequearWrusia2
- jmp DestruyenBaseRusia
- chequearWrusia2:
- call CheckW
- cmp al, 'W'
- jne disparoRusia2
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia2
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia2:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- add dl,1
- call SetCursor
- cmp dh,10
- jne chequearWrusia3
- cmp dl,61
- jne chequearWrusia3
- jmp DestruyenBaseRusia
- chequearWrusia3:
- call CheckW
- cmp al, 'W'
- jne disparoRusia3
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia3
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia3:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dl,2
- call SetCursor
- cmp dh,10
- jne chequearWrusia4
- cmp dl,61
- jne chequearWrusia4
- jmp DestruyenBaseRusia
- chequearWrusia4:
- call CheckW
- cmp al, 'W'
- jne disparoRusia4
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia4
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia4:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dh,1
- call SetCursor
- cmp dh,10
- jne chequearWrusia5
- cmp dl,61
- jne chequearWrusia5
- jmp DestruyenBaseRusia
- chequearWrusia5:
- call CheckW
- cmp al, 'W'
- jne disparoRusia5
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia5
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia5:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- add dl,2
- call SetCursor
- cmp dh,10
- jne chequearWrusia6
- cmp dl,61
- jne chequearWrusia6
- jmp DestruyenBaseRusia
- chequearWrusia6:
- call CheckW
- cmp al, 'W'
- jne disparoRusia6
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia6
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia6:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dh, 1
- call SetCursor
- cmp dh,10
- jne chequearWrusia7
- cmp dl,61
- jne chequearWrusia7
- jmp DestruyenBaseRusia
- chequearWrusia7:
- call CheckW
- cmp al, 'W'
- jne disparoRusia7
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia7
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia7:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dl,1
- call SetCursor
- cmp dh,10
- jne chequearWrusia8
- cmp dl,61
- jne chequearWrusia8
- jmp DestruyenBaseRusia
- chequearWrusia8:
- call CheckW
- cmp al, 'W'
- jne disparoRusia8
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia8
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia8:
- push dx
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- pop dx
- sub dl,1
- call SetCursor
- cmp dh,10
- jne chequearWrusia9
- cmp dl,61
- jne chequearWrusia9
- jmp DestruyenBaseRusia
- chequearWrusia9:
- call CheckW
- cmp al, 'W'
- jne disparoRusia9
- call DecrementarW_Rusia
- call WRusia
- cmp numeroD_Rusia,0
- jne disparoRusia9
- cmp numeroU_Rusia,0
- je ganaUSA
- disparoRusia9:
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- dec cx
- mov dh, 19 ;
- mov dl, 22 ;posiciono el cursor para indicar la cantidad de disparos
- call SetCursor ;
- mov dx,cx ;
- add dx, 30h ;muevo a dx la cantidad de disparos e imprimo
- mov ah,2 ;
- int 21h ;
- mov dl, 32 ; Posicion del cursor columna
- mov dh, 2 ; Posicion del cursor fila
- call SetCursor
- cmp cx, 0
- je pasarTurnoRusia
- mov dl, 32 ; Posicion del cursor columna
- mov dh, 2 ; Posicion del cursor fila
- jmp pedirteclaR
- RightR:
- cmp dl,72
- je volverizqR
- add dl, 1 ;para reposicionar el cursor columna
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirteclaR
- ret
- LeftR:
- cmp dl, 32
- je volverderR
- sub dl, 1 ;para reposicionar el cursor columna
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirteclaR
- ret
- UpR:
- cmp dh, 2
- je volverabajR
- sub dh, 1 ;para reposicionar el cursor fila
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirteclaR
- ret
- DownR:
- cmp dh,15
- je volverarribaR
- add dh, 1 ;para reposicionar el cursor fila
- call SetCursor ;llamo al procedimiento para setear cursor
- jmp pedirteclaR
- ret
- volverizqR:
- mov dl, 32
- call SetCursor
- jmp pedirteclaR
- ret
- volverderR:
- mov dl, 72
- call SetCursor
- jmp pedirteclaR
- ret
- volverabajR:
- mov dh, 15
- call SetCursor
- jmp pedirteclaR
- ret
- volverarribaR:
- mov dh, 2
- call SetCursor
- jmp pedirteclaR
- ret
- pasarTurnoRusia:
- mov dh, 18
- mov dl, 1
- call SetCursor
- mov dx, offset Turno_Ruso_msj
- mov ah, 9
- int 21h
- ret
- ganaUSA:
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- mov dh, 21
- mov dl, 1
- call SetCursor
- mov dx, offset Ganador_USA
- mov ah, 9
- int 21h
- mov ganador,22
- ret
- DestruyenBaseRusia:
- mov dx,offset caritaRusia ;
- mov ah, 9 ;ejecuto el disparo y muestro por pantalla la carita
- int 21h
- mov dh, 21
- mov dl, 1
- call SetCursor
- mov dx, offset Destruccion_BaseRusia
- mov ah, 9
- int 21h
- mov ganador,22
- ret
- endp PunteroRusia
- ;------------------------
- ; decrementa las W de USA
- proc decrementarW_USA
- cmp numeroD_USA,0
- jne restarUSA
- cmp numeroU_USA, 0
- jne restarUSA
- jmp dejarderestarUSA
- restarUSA:
- cmp numeroU_USA, 0
- je restarDecUSA
- dec numeroU_USA
- ret
- restarDecUSA:
- mov numeroU_USA, 9
- dec numeroD_USA
- ret
- dejarderestarUSA:
- ret
- endp decrementarW_USA
- ;--------------------
- ; decrementa las W de Rusia
- proc decrementarW_Rusia
- cmp numeroD_Rusia,0
- jne restarRusia
- cmp numeroU_Rusia, 0
- jne restarRusia
- jmp dejarderestarRusia
- restarRusia:
- cmp numeroU_Rusia, 0
- je restarDecRusia
- dec numeroU_Rusia
- ret
- restarDecRusia:
- mov numeroU_Rusia, 9
- dec numeroD_Rusia
- ret
- dejarderestarRusia:
- ret
- endp decrementarW_Rusia
- ;--------------------
- ;imprime las W de USA
- proc WUSA
- push dx
- mov dh, 22
- mov dl, 33
- call SetCursor
- mov dx, numeroD_USA
- add dx, 30h
- mov ah, 2
- int 21h
- mov dx, numeroU_USA
- add dx, 30h
- mov ah,2
- int 21h
- pop dx
- call SetCursor
- endp WUSA
- ret
- ;------------
- ;imprime las W de Rusia
- proc WRusia
- push dx
- mov dh, 23
- mov dl, 35
- call SetCursor
- mov dx, numeroD_Rusia
- add dx, 30h
- mov ah, 2
- int 21h
- mov dx, numeroU_Rusia
- add dx, 30h
- mov ah,2
- int 21h
- pop dx
- call SetCursor
- endp WRusia
- ret
- ;------------
- ;guarda en AL el caracter apuntado
- proc CheckW
- mov ah, 8
- int 10h
- endp CheckW
- ret
- proc limpiar
- MOV AX,0600H ;06 TO SCROLL & 00 FOR FULLJ SCREEN
- MOV BH,07H ;ATTRIBUTE 7 FOR BACKGROUND AND 1 FOR FOREGROUND
- MOV CX,0000H ;STARTING COORDINATES
- MOV DX,184FH ;ENDING COORDINATES
- INT 10H ;FOR VIDEO DISPLAY
- endp limpiar
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement