annotate final_isi/wrapper.c @ 69:c13a2f8c5b10

Rename files and some minor cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 01 Jun 2012 17:41:15 +0300
parents 53676367d46f
children e76a4e19363d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #include "wrapper.h"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 /** conio stuff **/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 void gbsound(int ch,int freq)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 {
51
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
7 if(freq)pwplib_sound_nv(ch,freq<<8,pwplib.setup[SETUP_VOLUME]);
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
8 else pwplib_sound_off(ch);
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 /** fx stuff **/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
51
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
13 void fillbuf(char*d,short w16,int lgt) /* iku */
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 short*dd=(short*)d;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 for(;lgt;lgt--)*dd++=w16;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 /** uncrunch **/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 /* thedraw uncrunch */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 void uncrunch(unsigned char*src,char*dst,int lgt)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 char attr=0x07,*nxtlin=dst+160;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 for(;lgt>0;lgt--){
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 int c=*src++;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 if(c>=32){dst[0]=c;dst[1]=attr;dst+=2;}else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 if(c<16)attr=(attr&0xf0)|c;else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 if(c<24)attr=(attr&0x8f)|((c-16)<<4);else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 if(c==24){dst=nxtlin;nxtlin+=160;}else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 if(c==25){int i=1+*src++;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 for(;i;i--){dst[0]=32;dst[1]=attr;dst+=2;}lgt--;}else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 if(c==26){int i=1+src[0],t=src[1];src+=2;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 for(;i;i--){dst[0]=t;dst[1]=attr;dst+=2;}lgt-=2;}
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 else if(c==27)attr^=0x80;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 int mul32(int a,int b)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 return (a*b)>>16;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 int attr2dump(char*s0,char*s1,char*d,int lgt,int ander) /* fisi */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 {
51
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
47 int j;
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 char tmp[80*50];d=tmp;lgt=80*50;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 tmp[0]=tmp[1]=tmp[2]=tmp[3]=0;
51
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
50 for(j = lgt;j;j--)*d++=(*s0++&ander)|*s1++;
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 pwplib.videobuf.d=tmp;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 pwplib.dump_rast();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
51
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
55 void dumpbuf(char*s,char*d,int lgt) /* iku */
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
56 {
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
57 char*tmp=pwplib.videobuf.d;
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
58 pwplib.videobuf.d=s;
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
59 pwplib.dump_rast();
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
60 pwplib.videobuf.d=tmp;
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
61 }
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
62
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 int attrdump(char*s,char*d,int howmany) /* fisi */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 dumpbuf(s,d,howmany>>1);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 int dump16() /* fisi */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 fprintf(stderr,"dump16\n"); /* fisi */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 int dump216()
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 fprintf(stderr,"dump216\n"); /* fisi */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 int dumphybrid(uchar*a,uchar*b,uchar*d) /* fisi */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 char tmp[80*50*2];int y=25;d=tmp;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 for(;y;y--){int x=80;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 for(;x;x--)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 if(*a!=253){d[0]=*a;d[1]=a[1];}else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 {int z=(b[0]&0xf0)|(b[80]>>4);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 d[0]=z?220:32;d[1]=z;}
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 a+=2;d+=2;b++;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 }b+=80;}
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
51
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
90 // pwplib.videobuf.d=tmp;
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
91 // pwplib.dump_ibm();
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 int polytxloop(sint h,char*di,uint x1,sint dx0,sint dx1,char*txr,
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 sint dv,sint du) /* fisi */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 int x0=0,u=0,tpv=0;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 for(;h>0;h--){
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 {char*d=di+(x0>>8);int c=(x1>>8)&127,tp=(tpv<<4)&0xf000;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 if(c>0)for(;c;c--){*d++=txr[(tp>>8)&0xff];tp+=du;}}
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 x0+=dx0;x1+=dx1;di+=80;tpv+=dv;/*dv*/}
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 }
51
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
103
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
104 void memfill(void *buf, int c, size_t n)
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
105 {
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
106 }
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
107
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
108 void txtmode(int mode)
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
109 {
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
110 }
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
111
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
112 void picmov(char *a, char *b, int xsize, int xclip, int yclip, int method)
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
113 {
53676367d46f Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
114 }