-
Notifications
You must be signed in to change notification settings - Fork 66
/
memorylist.c
99 lines (95 loc) · 2.18 KB
/
memorylist.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include"nasmfunc.h"
#include"memory.h"
#include"sheet.h"
#include"graphic.h"
#include"buffer.h"
#include"timer.h"
#include"mtask.h"
#include"mouse.h"
#include"memorylist.h"
#include<stdio.h>
void showMemory(struct Sheet *memoryListSheet)
{
int curPosY=0;
makeWindow(memoryListSheet,470,710,"Memory List");
char str[70]=" From To Status";
putStrAndBackOnSht(memoryListSheet,18,32+curPosY*30,BLACK,WHITE,str,36);
curPosY=1;
for (int i=0;i<128;i++)
{
if (meml->used[i].flag==1)
{
sprintf (str,"0x%08x 0x%08x %s",meml->used[i].addr,meml->used[i].addr+meml->used[i].size,meml->used[i].status);
putStrAndBackOnSht(memoryListSheet,18,32+curPosY*30,BLACK,WHITE,str,36);
curPosY++;
}
}
}
void memoryListTask_Main(struct Task *task)
{
//初始化缓冲区
char bufferArray[128];
struct Buffer bufferTime;
initBuffer(&bufferTime,128,bufferArray);
//初始化定时器
struct Timer *timerCur;
timerCur=allocTimer();
initTimer(timerCur,&bufferTime,1);
setTimer(timerCur,100);
//显示窗口
struct Sheet *memoryListSheet;
unsigned char *memoryListBuffer;
memoryListSheet=allocSheet();
slideSheet(memoryListSheet,400,20);
memoryListBuffer=(unsigned char *)allocMem(470*710,"Memory List UI");//申请内存空间
setBufInSheet(memoryListSheet,memoryListBuffer,470,710,-1);
makeWindow(memoryListSheet,470,710,"Memory List");
setHeightSheet(memoryListSheet,task->winID+1);
//显示信息
showMemory(memoryListSheet);
refreshSheet(memoryListSheet);
unsigned char data;
int flag=0;
while (1)
{
flag=0;
io_cli();
if (getBuffer(&task->bufAll.mouse,&data))
{
io_sti();
flag=2;
switch(data)
{
//左键移动
case 0:
slideSheet(memoryListSheet,mdec.x,mdec.y);
break;
//右键关闭
case 2:
freeSheet(memoryListSheet);
freeMem((unsigned int)memoryListBuffer,470*710);
deleteWindow(task);
deleteTask(task);
break;
}
}
//定时刷新
if (getBuffer(&bufferTime,&data))
{
io_sti();
flag=3;
switch (data)
{
case 1:
initTimer(timerCur,&bufferTime,1);
//显示信息
showMemory(memoryListSheet);
refreshSheet(memoryListSheet);
setTimer(timerCur,100);
break;
}
}
if (flag==0)
io_sti();
}
}