-
Notifications
You must be signed in to change notification settings - Fork 0
/
tarea5.c
60 lines (52 loc) · 1.63 KB
/
tarea5.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* ** por compatibilidad se omiten tildes **
================================================================================
TRABAJO PRACTICO 3 - System Programming - ORGANIZACION DE COMPUTADOR II - FCEN
================================================================================
*/
#include "colors.h"
#include "defines.h"
#include "game.h"
#include "syscall.h"
#include "i386.h"
#define BANDERA_BUFFER 0x40001000
/*
* Estructura de la tarea :
*
* 0x40000000 - 0x40001000 : codigo tarea ( 5 KB)
* 0x40001000 - 0x40001400 : area de banderas ( 1 KB)
* 0x40001400 - 0x40001c00 : pila tarea ( 2 KB)
* 0x40001c00 - 0x40001ffc : pila bandera (1020 B )
* 0x40001ffc - 0x40002000 : dir. funcion bandera ( 4 B )
*/
/* Estructura de para acceder a memoria de video */
typedef struct {
unsigned char c;
unsigned char a;
} ca;
unsigned char * bandera();
// global var
#define GLOBAL_START 0x40000000
#define var_B GLOBAL_START+0x2000-0x200
void task() {
/* Tarea 5 */
// MUERE, una tarea NO puede llamar a la int 66
while(1) {
syscall_bandera_fin((unsigned int) 0);
};
}
unsigned char * bandera() {
ca (*buffer)[10] = (ca (*)[10]) (BANDERA_BUFFER);
int *b = (int*)(var_B);
unsigned int fil;
unsigned int col;
(*b)++; if (*b == 3) *b = 0;
for (fil = 0; fil < 5; fil++) {
for (col = 0; col < 10; col++) {
buffer[fil][col].c = 176+(*b) ;
buffer[fil][col].a = C_BG_BLACK | C_FG_LIGHT_CYAN;
}
}
syscall_bandera_fin((unsigned int) buffer);
/* Para que el compilador no tire warning... */
return 0;
}