forked from mtuomi/SecondReality
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDOL.C
executable file
·115 lines (106 loc) · 1.78 KB
/
DOL.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <stdarg.h>
int from=6,to=198;
int cent=160;
FILE *f1;
unsigned char *vram=(char *)0xa0000000L;
void P(char *str,...)
{
char out[256];
va_list argp;
va_start(argp,str);
vsprintf(out,str,argp);
fprintf(f1,"%s\n",out);
va_end(argp);
}
int xt[320];
char palette[768];
main()
{
int i,j,x,y,a,sk1,sk2,sk3,sk4,sfl,la;
unsigned int u;
char *v;
long l;
_asm mov ax,13h
_asm int 10h
f1=fopen("tmp.uh","rb");
fread(palette,1,16,f1);
fread(palette,1,768,f1);
fread(vram,1,64000,f1);
for(u=1;u<64000;u++)
{
vram[u-1]=palette[vram[u]*3];
}
outp(0x3c8,0);
for(a=0;a<64;a++)
{
outp(0x3c9,a);
outp(0x3c9,a);
outp(0x3c9,a);
}
fclose(f1);
for(y=0;y<200;y++)
{
v=vram+y*320;
for(x=0;x<320;x++) if(x&3)
{
if(v[x+4]!=0 && v[x-4]!=0) v[x]=v[x-1];
}
}
f1=fopen("twstloop.inc","wt");
P("twistt LABEL WORD");
for(y=0;y<200;y++)
{
a=y;
P("dw OFFSET twist%il,OFFSET twist%ir",a,a);
}
P("twist PROC NEAR");
for(y=0;y<200;y++)
{
kbhit();
P("twist%il:",y);
P("mov dx,3c4h");
P("mov ax,0f02h");
P("out dx,ax");
la=-1;
for(x=0;x<160;x+=8)
{
a=vram[y*320+x];
a|=(vram[y*320+x+4])<<8;
if(la!=a)
{
la=a;
P("mov ax,0%04Xh",a);
}
P("mov ds:[di+%i],ax",x/4);
}
P("ret");
P("twist%ir:",y);
P("mov dx,3c4h");
P("mov ax,0f02h");
P("out dx,ax");
la=-1;
a=from+(long)y*(long)(to-from)/200L;
v=vram+a*320;
for(x=160;x<320;x+=8)
{
a=v[x];
a|=(v[x+4])<<8;
if(la!=a)
{
la=a;
P("mov ax,0%04Xh",a);
}
P("mov ds:[di+%i],ax",x/4);
}
P("ret");
v[0]=63;
}
P("twist ENDP");
fclose(f1);
getch();
_asm mov ax,3h
_asm int 10h
}