forked from mtuomi/SecondReality
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADP.C
executable file
·72 lines (71 loc) · 943 Bytes
/
READP.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
struct st_readp
{
int magic;
int wid;
int hig;
int cols;
int add;
};
void readp(char *dest,int row,char *src)
{
int bytes,a,b;
struct st_readp *hdr;
hdr=(struct st_readp *)src;
if(row==-1)
{
memcpy(dest,src+16,hdr->cols*3);
return;
}
if(row>=hdr->hig) return;
src+=hdr->add*16;
while(row)
{
src+=*(int *)src;
src+=2;
row--;
_asm
{
cmp word ptr src[0],4000h
jb k1
sub word ptr src[0],4000h
add word ptr src[2],400h
k1:
}
}
bytes=*(int *)src;
src+=2;
_asm
{
push si
push ds
push di
push es
mov cx,bytes
lds si,src
add cx,si
les di,dest
l1: mov al,ds:[si]
inc si
or al,al
jns l2
mov ah,al
and ah,7fh
mov al,ds:[si]
inc si
l4: mov es:[di],al
inc di
dec ah
jnz l4
cmp si,cx
jb l1
jmp l3
l2: mov es:[di],al
inc di
cmp si,cx
jb l1
l3: pop es
pop di
pop ds
pop si
}
}