File name: ports.cpp/ports.h


Variables

extern unsigned char cycle;
extern char mouse_bytes[3];
extern byte mouse_cycle;     //unsigned char
extern sbyte mouse_x;         //signed char
extern sbyte mouse_y;         //signed char


Functions


Effect: it does a delay of "segundos" seconds
Require: positive interger
***********************************************************************
void hacerRetardo(int segundos);


Effect: returna byte from the port "_port"
Require: a valid port
***********************************************************************
unsigned char in(unsigned short _port);


Effect: write the word  "_data" to the port "_port"
Require: a valid port
***********************************************************************
void outw(unsigned short _port, unsigned short _data);


Effect: write the byte  "_data" to the port "_port"
Require: a valid port
***********************************************************************
void out(unsigned short _port, unsigned char _data);


Effect: wait until the mouse is ready to send/recieve data
Require: an installed mouse
Credits: houbysoft, http://houbysoft.com/download/ps2mouse.html
***********************************************************************
void mouse_wait(unsigned char type);


Effect: send a command byte to the mouse
Require: an installed mouse
Credits: houbysoft, http://houbysoft.com/download/ps2mouse.html
***********************************************************************
void mouse_write(byte a_write);


Effect: turn on the mouse and its cpu interrupts, load the
         default mouse options
Require: an installed mouse
Credits: houbysoft, http://houbysoft.com/download/ps2mouse.html
***********************************************************************
void mouse_install();


Effect: reads the "mouse_bytes" array and translate the moves
         buttons: 1,2,3
         moves: u(up),l(left),r(right),d(down)
         4(down,left),
         5(down,right),
         6(up,left),
         7(up,right)
Require: an installed mouse, the mouse_bytes and cycle
             variables
***********************************************************************
char mouse_handler_char();


Effect: if the mouse buffer has an input return the output of
          the mouse_handler_char function
Require:
***********************************************************************
char mouse_read_char();


Effect: wait until the keyboard has a non empty buffer
Require: a keyboard installed
***********************************************************************
byte esperarClick();


Effect: if the keyboard buffer is not empty return a scancode
         but if not it returns a 0
Require: a keyboard installed
***********************************************************************
unsigned char leerTecla();


Effect: return a+b
***********************************************************************
extern "C" short sumar(short a,short b);