You are on page 1of 8

PSEUDO-CODE

Loop_Principal_Mensaje_Logo

If (START_BUTTON==1)
{ goto PULSACION_START ; }
Else
{ call Logo_Hangman ;
goto Loop_Principal_Mensaje_Logo ; }

-----------------------------------------------------------------------------PULSACION_START
If ( Cont==50 )
{ Clrf Cont ;
Goto Link_0 ;}
Else
{ Incf Cont ;
Goto Link_0 ;}

-----------------------------------------------------------------------------Link_0

If ( START_BUTTON==ON )
{goto PULSACION_START ;}
Else
{ call Funcion_RANDOM ;

call Funcion_PASAR_DATOS ; }
-----------------------------------------------------------------------------Game

Call Pantalla ;
Goto Check ;
-----------------------------------------------------------------------------Check
If ( ENTER_BUTTON ==ON )
{ goto Fin_Eleccion ;}
Else
{ If ( DECISION_BUTTON_DOWN ==ON )
{ goto PULSACION_DECISION_DOWN ;}

Else
{ If ( DECISION_BUTTON_UP==ON )
{goto PULSACION_DECISION_UP ; }
Else
{goto Check ;}
{
{
-----------------------------------------------------------------------------PULSACION_DECISION_UP
If ( NoPulsado >0)
{ goto Decremento_NoPulsado ; }
Else
{ NoPulsado = 26 ;
goto Link_1 ;}

------------------------------------------------------------------------------

-----------------------------------------------------------------------------Decremento_NoPulsado
Decf NoPulsado ;
Goto Link_1 ;
-----------------------------------------------------------------------------PULSACION_DECISION_DOWN
If ( NoPulsado ==26)
{ goto Incremento_NoPulsado ; }
Else
{ NoPulsado = 0 ;
goto Link_1 ; }

-----------------------------------------------------------------------------Incremento_NoPulsado
Incf NoPulsado ;
Goto Link_1 ;
-----------------------------------------------------------------------------Link_1
Call Pantalla ;
Goto Check ;
-----------------------------------------------------------------------------Fin_Eleccin
Call Comprobacin ;
If ( CORRECTO.7==OFF)
{ goto Mistake ; }
Else
{ Clrf CORRECTO.7 ;

If ( Contador_Correctos=4 )
{ goto FIN_JUEGO_VENCEDOR ; }
Else
{ goto Game ; }
-----------------------------------------------------------------------------Mistake
Decf Lifes ;
If ( Lifes==0)
{ goto FIN_JUEGO_PERDEDOR ;}
Else

{ goto RESTAR_1_Vida ;}
-----------------------------------------------------------------------------RESTAR_1_Vida
* FSR_Fallos // A pointer to Fallos
INDF FSR_Fallos = LETRA_ELEGIDA ;
goto Game ;

------------------------------------------------------------------------------

------------------------------------------------------------------------------

FIN_JUEGO_PERDEDOR

Call

Pantalla ;

Call
Call
Call
Call
Call
goto

Delay_500ms ;
LCD_ClearDisplay ;
Mensaje_Derrota ;
Delay_10s ;
LCD_ClearDisplay ;
Inicializaciones ;

-----------------------------------------------------------------------------FIN_JUEGO_VENCEDOR
Call Pantalla ;
Call
Delay_500ms ;
Call
LCD_ClearDisplay ;
Call
Mensaje_Victoria ;
Call
Delay_5s ;
goto Inicializaciones ;

------------------------------------------------------------------------------

Pantalla
Var1aux = Var1 ;
Call
Delay_500ms ;
Call
LCD_ClearDisplay ;
Clrf
i;
FSR = &Var1aux ;

-----------------------------------------------------------------------------For ( i =0; < i = 5; i++)


{ Wreg=* FSR ;
Call LCD_WriteCharacter ;
I++ ;
INCF FSR ; }

-----------------------------------------------------------------------------Call
Call
Call
Call

LCD_CursorInc ;
LCD_CursorInc ;
LCD_CursorInc ;
LCD_CursorInc ;

-----------------------------------------------------------------------------Clrf

i;

-----------------------------------------------------------------------------buclevidas
If ( Caracter = 0)
{goto End_bucle_vidas ; }
Else

{ Wreg == i ;
Call Vida ;
// Mensaje
Caracter == Wreg ;
Calll LCD_WriteCharacter ;
goto buclevidas ; }

-----------------------------------------------------------------------------End_bucle_vidas
Wreg == Lifes ;
Call
ASCII_CODE
Call
LCD_WriteCharacter
Call
LCD_Line2

-----------------------------------------------------------------------------Fallos
Clrf
i;
FSR = &Fallo1 ;

-----------------------------------------------------------------------------For ( i =0; < i = 8; i++)


{ Wreg=* FSR ;
Call LCD_WriteCharacter ;
I++ ;
INCF FSR ; }

-----------------------------------------------------------------------------Call LCD_CursorInc ;

-----------------------------------------------------------------------------Bucle2
If ( Caracter = 0)
{goto Endbucle; }
Else

{ Wreg == i ;
Call Letra ;
// Mensaje
Caracter == Wreg ;
Calll LCD_WriteCharacter ;
goto Bucle2 ; }

-----------------------------------------------------------------------------Endbucle
Wreg == NoPulsado ;:
Call
Abecedario;
Call
LCD_WriteCharacter;
RETURN

Logo_Hangman
Wreg == Position_Mensaje_Hangman;
Call LCD_CursorPosition;
Clrf i
-----------------------------------------------------------------------------Bucle_Mensaje1
If ( Caracter = 0)
{goto End_ Bucle_Mensaje1; }
Else

{ Wreg == i ;
Call Mensaje1 ;
// Mensaje
Caracter == Wreg ;
Calll LCD_WriteCharacter ;
goto Bucle_Mensaje1 ; }

-----------------------------------------------------------------------------End_ Bucle_Mensaje1
Wreg == Position_Mensaje_Do_you_want;
Call LCD_CursorPosition;
Clrf i
-----------------------------------------------------------------------------Bucle_Mensaje2
If ( Caracter = 0)
{goto End_ Bucle_Mensaje2; }
Else

{ Wreg == i ;
Call Mensaje2 ;
// Mensaje
Caracter == Wreg ;
Calll LCD_WriteCharacter ;
goto Bucle_Mensaje2 ; }

-----------------------------------------------------------------------------End_ Bucle_Mensaje2
If ( Position_Mensaje_Do_you_want = 14 )
{ goto Fin;}
Else
{ Decf Position_Mensaje_Do_you_want;
If ( Position_Mensaje_Do_you_want =3f)
{Position_Mensaje_Do_you_want=27}
Else
{goto HaNgMaN;}
-----------------------------------------------------------------------------Fin
Position_Mensaje_Do_you_want == 4f;

-----------------------------------------------------------------------------HaNgMaN
Wreg == Position_Mensaje_Hangman;
IF ( Aux,7 == ON )
{ goto fin2 ;}
Else
{ If ( Position_Mensaje_Hangman =9)
{goto fin2}
Else
{ Incf Position_Mensaje_Hangman
goto Fintotal_Logo; }

-----------------------------------------------------------------------------fin2
Aux,7==ON;
Wreg = Position_Mensaje_Hangman;
If ( Position_Mensaje_Hangman=0 )
{decf
Position_Mensaje_Hangman
goto
Fintotal_Logo ;}
Else
{ goto fin3 ;}3

-----------------------------------------------------------------------------fin3
incf
clrf

Position_Mensaje_Hangman
Aux,7

-----------------------------------------------------------------------------Fintotal_Logo
call
call
return

Delay_500ms
LCD_ClearDisplay

Funcion_RANDOM
Cont=i;
FSR = Var1;
Clrf Cont;
-----------------------------------------------------------------------------Bucle_Funcion_RANDOM
If ( i < 0)
{ incf Cont;
incf Cont;
incf Cont;
incf Cont;
incf Cont;:
decf i;
goto Bucle_Funcion_RANDOM}
Else
{goto End_Funcion_RANDOM
End_Funcion_RANDOM
return

Funcion_PASAR_DATOS
Clrf i;
FSR = Var1;
-----------------------------------------------------------------------------Bucle_Funcion_PASAR_DATOS
Wreg = i;
For ( i = 0; i =5; i++)
{Wreg = Cont;
Call Base_Datos;
Movwf INDF;
incf FSR;
incf i;
incf Cont; }
{goto END_Bucle_Funcion_PASAR_DATOS }
END_Bucle_Funcion_PASAR_DATOS
return

You might also like