User guide
SFSU - Embedded Systems Tutorial Nano- Electronics & Computing Research Lab
64
Basic Software Algorithm
Initialize the screen
screen_x = 319; screen_y = 239;
char text[16];
color = 0x0000; // black color
VGA_box (0, 0, screen_x, screen_y, color); // fill the screen with background
Values of switches are pointed by allocating their base address
volatile int * switch1_ptr = (int *) 0x00101810;
volatile int * switch2_ptr = (int *) 0x00101820;
volatile int * switch3_ptr = (int *) 0x00101830;
volatile int * switch4_ptr = (int *) 0x00101850;
According to the switch position, the operation of ALU is decided.
00 : Addition
01: Subtraction
10: Logical OR
11 : Logical And
if (sel1&sel2)
{
sprintf( text_top_VGA, "My ALU");
sprintf (text,"%d + %d = %d ",number1,number2,number1 + number2);
}
else if (!sel1&sel2)
{
sprintf( text_top_VGA, "My ALU");
sprintf (text,"%d - %d = %d ",number1,number2,number1 - number2);
}
else if (sel1&!sel2)
{
sprintf( text_top_VGA, "My ALU");