-
Notifications
You must be signed in to change notification settings - Fork 0
/
tarea1.c
65 lines (54 loc) · 1.67 KB
/
tarea1.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
61
62
63
64
65
/* ** 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 1 */
unsigned int i = 0;
while(1) {
for(i = 0; i < 0x000FF000; i += 0x1000){
syscall_fondear(i);
}
}
}
unsigned char * bandera() {
ca (*buffer)[10] = (ca (*)[10]) (BANDERA_BUFFER);
int *b = (int*)(var_B);
unsigned int fil;
unsigned int col;
(*b)++; if (*b == 5) *b = 0;
for (fil = 0; fil < 5; fil++) {
for (col = 0; col < 10; col++) {
buffer[fil][col].c = 219+(*b) ;
buffer[fil][col].a = C_BG_BROWN | C_FG_LIGHT_BROWN;
}
}
syscall_bandera_fin((unsigned int) buffer);
/* Para que el compilador no tire warning... */
return 0;
}