-#include "..\dis\dis.h"\r
+#include <stdio.h>\r
+#include "../dis/dis.h"\r
+#include "graphics.h"\r
+#include "opengl.h"\r
+#include "common.h"\r
\r
-extern plz();\r
-extern vect();\r
+extern void plz();\r
+extern void vect();\r
\r
-main() {\r
+int main(int argc, char **argv) {\r
+ int a = adjust_framerate();\r
dis_partstart();\r
+\r
+ if (init_graphics("Plzpart", argc, argv) < 0) {\r
+ fprintf(stderr, "Can't init graphics\n");\r
+ return -1;\r
+ };\r
+\r
+ init_opengl();\r
init_copper();\r
initvect();\r
plz();\r
- vect();\r
+ //vect();\r
close_copper();\r
- }
\ No newline at end of file
+ return 0;\r
+ }\r
--- /dev/null
+
+PLZPART_OBJS = plz.o copper.o asmyt.o tweak.o vect.o vga.o opengl.o \
+ plza.o plzfill.o sinit.o spline.o main.o
+
+PLZPART_PATH = plzpart
+
+PLZPART_PATH_OBJS = $(addprefix $(PLZPART_PATH)/,$(PLZPART_OBJS))
+
+PLZPART_BIN = plzpart
+
+OBJS += $(PLZPART_PATH_OBJS)
+
+default-plzpart:
+ $(MAKE) -C .. plzpart-all
+
+plzpart-all: $(PLZPART_PATH)/$(PLZPART_BIN)
+
+$(PLZPART_PATH)/$(PLZPART_BIN): $(PLZPART_PATH_OBJS)
+ $(LD) -o $@ $(LDFLAGS) $(PLZPART_PATH_OBJS) $(LIBS)
+
+plz.c: tweak.h ptau.pre
#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
#include <math.h>\r
-#include <conio.h>\r
-#include <dos.h>\r
+//#include <conio.h>\r
+//#include <dos.h>\r
#include "tweak.h"\r
+#include "../dis/dis.h"\r
+#include "opengl.h"\r
+#include "graphics.h"\r
+#include "common.h"\r
\r
-//#define DO_TABLES\r
-//#define DPII (3.1415926535*2.0)\r
+#define DO_TABLES\r
+#define DPII (3.1415926535*2.0)\r
\r
#define LINELEN 41\r
#define MAXY 280\r
extern int plzline(int y, int vseg);\r
extern int setplzparas(int c1, int c2, int c3, int c4);\r
extern int set_plzstart(int y);\r
-extern char far psini[16384];\r
-extern int far lsini4[8192];\r
-extern int far lsini16[8192];\r
+//extern char far psini[16384];\r
+//extern int far lsini4[8192];\r
+//extern int far lsini16[8192];\r
+\r
+unsigned char *psini;\r
+short *lsini4;\r
+short *lsini16;\r
\r
//int (* vmem)[LINELEN]=MK_FP(0x0a000,0);\r
//char psini[16384]=\r
//char lsini[16384]=\r
//#include "lsini.pre"\r
\r
+void init_plz(void);\r
+\r
char ptau[256]=\r
#include "ptau.pre"\r
\r
-int pals[6][768];\r
+int16_t pals[6][768];\r
int curpal=0;\r
int timetable[10]={64*6*2-45,64*6*4-45,64*6*5-45,64*6*6-45,64*6*7+90,0};\r
int ttptr=0;\r
{1000,2000,3000,4000,3500,2300,3900,3670},\r
{1000,2000,3000,4000,3500,2300,3900,3670}};\r
\r
-plz(){\r
- register int x,y;\r
- int *ptr;\r
+int fixme_dis_getmframe()\r
+{\r
+ static int s_nResult = 0;\r
+ s_nResult++;\r
+ return s_nResult;\r
+}\r
+\r
+void plz(){\r
+ register int /*x,*/y;\r
+ //int *ptr;\r
long tim=0,count=0;\r
- int ch=0,sync=2;\r
+ //int ch=0,sync=2;\r
\r
while(dis_musplus()<0 && !dis_exit());\r
dis_setmframe(0);\r
\r
init_plz();\r
cop_drop=128;\r
- cop_fadepal=pals[curpal++];\r
+ cop_fadepal=(char *)pals[curpal++];\r
\r
frame_count=0;\r
while(!dis_exit())\r
{\r
tim+=frame_count; frame_count=0; count++;\r
- if(dis_getmframe()>timetable[ttptr])\r
+ if(fixme_dis_getmframe()>timetable[ttptr])\r
{\r
memset(fadepal,0,768);\r
cop_drop=1;\r
- cop_fadepal=pals[curpal++];\r
+ cop_fadepal=(char *)pals[curpal++];\r
ttptr++;\r
il1=inittable[ttptr][0];\r
il2=inittable[ttptr][1];\r
}\r
if(curpal==5 && cop_drop>64) break;\r
\r
- asm mov dx, 3c4h\r
- asm mov ax, 0a02h\r
- asm out dx, ax\r
+ // [nk] VGA: select bit planes 0,2 (?)\r
+ //asm mov dx, 3c4h\r
+ //asm mov ax, 0a02h\r
+ //asm out dx, ax\r
+\r
+ vga_select_bitplanes_02();\r
\r
setplzparas(k1,k2,k3,k4);\r
for(y=0;y<MAXY;y+=2)\r
- plzline(y,0x0a000+y*6+YADD*6);\r
+ plzline(y,y*6+YADD*6);\r
setplzparas(l1,l2,l3,l4);\r
for(y=1;y<MAXY;y+=2)\r
- plzline(y,0x0a000+y*6+YADD*6);\r
+ plzline(y,y*6+YADD*6);\r
\r
+ // [nk] VGA: select bit planes 1,3 (?)\r
+ //asm mov dx, 3c4h\r
+ //asm mov ax, 0502h\r
+ //asm out dx, ax\r
\r
- asm mov dx, 3c4h\r
- asm mov ax, 0502h\r
- asm out dx, ax\r
+ vga_select_bitplanes_13();\r
\r
setplzparas(k1,k2,k3,k4);\r
for(y=1;y<MAXY;y+=2)\r
- plzline(y,0x0a000+y*6+YADD*6);\r
+ plzline(y,y*6+YADD*6);\r
setplzparas(l1,l2,l3,l4);\r
for(y=0;y<MAXY;y+=2)\r
- plzline(y,0x0a000+y*6+YADD*6);\r
+ plzline(y,y*6+YADD*6);\r
+\r
+ vga_show_framebuffer();\r
+ draw_bg();\r
+ swap_buffers();\r
}\r
- cop_drop=0; frame_count=0; while(frame_count==0);\r
+ cop_drop=0; frame_count=0; //while(frame_count==0);\r
set_plzstart(500);\r
cop_plz=0;\r
}\r
\r
-init_plz()\r
+void init_plz()\r
{\r
- int a,b,c,z;\r
- int *pptr=pals;\r
+ int a/*,b,c,z*/;\r
+ int16_t *pptr=(int16_t *)pals;\r
\r
+ psini = malloc(16384 + 2 * 8192 + 2 * 8192);\r
+ lsini4 = (short *)psini + 8192;\r
+ lsini16 = lsini4 + 8192;\r
+ \r
#ifdef DO_TABLES\r
- {\r
- FILE *f1,*f2,*f3,*f4;\r
- f1=fopen("lsini4.inc","wb");\r
- f2=fopen("lsini16.inc","wb");\r
- f3=fopen("psini.inc","wb");\r
- f4=fopen("ptau.inc","wb");\r
-\r
for(a=0;a<1024*16;a++)\r
{\r
if(a<1024*8)\r
lsini16[a]=(sin(a*DPII/4096)*55+sin(a*DPII/4096*4)*5+sin(a*DPII/4096*17)*3+64)*16;\r
}\r
psini[a]=sin(a*DPII/4096)*55+sin(a*DPII/4096*6)*5+sin(a*DPII/4096*21)*4+64;\r
- if((a&15)==0)\r
- {\r
- if(a<1024*8)\r
- {\r
- fprintf(f1,"\ndw %4d",lsini4[a]);\r
- fprintf(f2,"\ndw %4d",lsini16[a]);\r
- }\r
- fprintf(f3,"\ndb %4d",psini[a]);\r
- }\r
- else {\r
- if(a<1024*8)\r
- {\r
- fprintf(f1,",%4d",lsini4[a]);\r
- fprintf(f2,",%4d",lsini16[a]);\r
- }\r
- fprintf(f3,",%4d",psini[a]);\r
- }\r
- }\r
+ }\r
\r
- fprintf(f4,"{\n%d",ptau[0]=0);\r
for(a=1;a<=128;a++)\r
- {\r
- fprintf(f4,",%3d",ptau[a]=cos(a*DPII/128+3.1415926535)*31+32);\r
- if(!(a&15)) fputc('\n',f4);\r
- }\r
- fputc('}',f4); fputc(';',f4);\r
-\r
- fclose(f1); fclose(f2); fclose(f3); fclose(f4);\r
+ {\r
+ ptau[a]=cos(a*DPII/128+3.1415926535)*31+32;\r
}\r
#endif\r
+\r
tw_opengraph2();\r
cop_start=96*(682-400);\r
set_plzstart(60);\r
for(a=0;a<106;a++)*pptr++=0,*pptr++=0,*pptr++=0;\r
for(a=0;a<75;a++) *pptr++=ptau[a*64/75]*8/10,*pptr++=ptau[a*64/75]*9/10,*pptr++=ptau[a*64/75];\r
\r
- pptr=pals;\r
+ pptr=&pals[0][0];\r
for(a=0;a<768;a++,pptr++) *pptr=(*pptr-63)*2;\r
for(a=768;a<768*5;a++,pptr++) *pptr*=8;\r
}\r
#include <stdio.h>\r
-#include <conio.h>\r
-#include <dos.h>\r
+//#include <conio.h>\r
+//#include <dos.h>\r
#include <math.h>\r
#include "tweak.h"\r
\r
-extern far do_line(char far *to, int dx, int dy, int cnt, char far *from, long txx1, long txy1, long txx2, long txy2, int dseg);\r
-extern far do_block(int ycnt);\r
-extern far do_clear(char far *vmem, int far *otau, int far *ntau);\r
+extern far void do_line(char far *to, int dx, int dy, int cnt, char far *from, long txx1, long txy1, long txx2, long txy2, int dseg);\r
+extern far void do_block(int ycnt);\r
+extern far void do_clear(char far *vmem, int far *otau, int far *ntau);\r
\r
extern int acstau[256];\r
int sini[2000];\r
char (* far vmem)[160]=MK_FP(0x0a000,0);\r
-extern char far kuva1[128][256];\r
-extern char far kuva2[128][256];\r
-extern char far kuva3[128][256];\r
-extern char far dist1[128][256];\r
+/*extern*/ char far kuva1[128][256];\r
+/*extern*/ char far kuva2[128][256];\r
+/*extern*/ char far kuva3[128][256];\r
+/*extern*/ char far dist1[128][256];\r
char far buu[1000];\r
char sinx[128], siny[128];\r
char pal[768];\r
int clrtau[8][256][2];\r
int clrptr=0;\r
\r
-initvect() {\r
- int a,b,x,y,s,d=0,p=0,ch;\r
+void initvect() {\r
+ int a/*,b*/,x,y,s/*,d=0,p=0,ch*/;\r
\r
for(a=0;a<1524;a++)\r
{\r
extern far long txx1,txy1,tay1,tax1;\r
extern far long txx2,txy2,tay2,tax2;\r
\r
-int kuvataus[]={FP_SEG(kuva1),FP_SEG(kuva2),FP_SEG(kuva3),FP_SEG(kuva1)};\r
-int disttaus[]={FP_SEG(dist1),FP_SEG(dist1),FP_SEG(dist1),FP_SEG(dist1)};\r
+char* kuvataus[]={&kuva1[0][0],&kuva2[0][0],&kuva3[0][0],&kuva1[0][0]};\r
+char* disttaus[]={&dist1[0][0],&dist1[0][0],&dist1[0][0],&dist1[0][9]};\r
\r
-do_poly(x1,y1,x2,y2,x3,y3,x4,y4,color, dd)\r
+void do_poly(x1,y1,x2,y2,x3,y3,x4,y4,color, dd)\r
int x1,y1,x2,y2,x3,y3,x4,y4,color, dd;\r
{\r
- int a,b,c,d,n=0,m,s1,s2,d1,d2,dx1,dy1,dx2,dy2;\r
+ int a,/*b,c,d,*/n=0,m,s1,s2,d1,d2,dx1,dy1,dx2,dy2;\r
\r
struct points {\r
int x,y; } pnts[4],txt[4]={{64,4},{190,4},{190,60},{64,60}};\r
}\r
}\r
\r
-clear()\r
+void clear()\r
{\r
int *otau=clrtau[(clrptr-3)&7], *ntau=clrtau[clrptr];\r
\r
+++ /dev/null
-\r
- Start Stop Length Name Class\r
-\r
- 00000H 027C3H 027C4H _TEXT CODE\r
- 027C4H 027C4H 00000H ASMYT_TEXT CODE\r
- 027D0H 0FC7BH 0D4ACH PORO CODE\r
- 0FC7CH 10605H 0098AH COPPER_TEXT CODE\r
- 10606H 10606H 00000H INCLUDE_TEXT CODE\r
- 10606H 10606H 00000H PLZA_TEXT CODE\r
- 10610H 12CCDH 026BEH LERSSICODE CODE\r
- 12CCEH 12EA6H 001D9H TWEAK_TEXT CODE\r
- 12EA7H 136D0H 0082AH PLZ_TEXT CODE\r
- 136D1H 14382H 00CB2H PLZFILL_TEXT CODE\r
- 14383H 14D78H 009F6H VECT_TEXT CODE\r
- 14D79H 14D9BH 00023H MAIN_TEXT CODE\r
- 14DA0H 14E73H 000D4H text_disc CODE\r
- 14E74H 160EDH 0127AH SPLINE_TEXT CODE\r
- 160F0H 18866H 02777H EMU_PROG CODE\r
- 18870H 18E37H 005C8H E87_PROG CODE\r
- 18E40H 18E40H 00000H _FARDATA FAR_DATA\r
- 18E40H 1CE3FH 04000H KAKKA2 FAR_DATA\r
- 1CE40H 24E3FH 08000H KAKKA6 FAR_DATA\r
- 24E40H 28E3FH 04000H KAKKA3 FAR_DATA\r
- 28E40H 2CE3FH 04000H KAKKA4 FAR_DATA\r
- 2CE40H 2D84EH 00A0FH KAKKA5 FAR_DATA\r
- 2D850H 2DC3BH 003ECH PLZFILL5_DATA FAR_DATA\r
- 2DC40H 2DF3FH 00300H VECT5_DATA FAR_DATA\r
- 2DF40H 2DF40H 00000H _FARBSS FAR_BSS\r
- 2DF40H 2DF40H 00000H _OVERLAY_ OVRINFO\r
- 2DF40H 2DF40H 00000H _1STUB_ STUBSEG\r
- 2DF40H 31025H 030E6H _DATA DATA\r
- 31026H 31029H 00004H _CVTSEG DATA\r
- 3102AH 31035H 0000CH _SCNSEG DATA\r
- 31036H 31036H 00000H _CONST CONST\r
- 31036H 31041H 0000CH _INIT_ INITDATA\r
- 31042H 31042H 00000H _INITEND_ INITDATA\r
- 31042H 31047H 00006H _EXIT_ EXITDATA\r
- 31048H 31048H 00000H _EXITEND_ EXITDATA\r
- 31048H 36C7FH 05C38H _BSS BSS\r
- 36C80H 36C80H 00000H _BSSEND BSSEND\r
- 36C80H 36D8FH 00110H _STACK STACK\r
-\r
-\r
-Detailed map of segments\r
-\r
- 0000:0000 0295 C=CODE S=_TEXT G=(none) M=c0.ASM ACBP=28\r
- 0000:0295 0258 C=CODE S=_TEXT G=(none) M=FPINIT ACBP=28\r
- 0000:04ED 0000 C=CODE S=_TEXT G=(none) M=E87TRAP ACBP=28\r
- 0000:04ED 0000 C=CODE S=_TEXT G=(none) M=PROTFLAG ACBP=28\r
- 0000:04ED 0000 C=CODE S=_TEXT G=(none) M=DEFLT87 ACBP=28\r
- 0000:04ED 0000 C=CODE S=_TEXT G=(none) M=HUGEVAL ACBP=28\r
- 0000:04ED 009A C=CODE S=_TEXT G=(none) M=LDTRUNC ACBP=28\r
- 0000:0587 0000 C=CODE S=_TEXT G=(none) M=MATHWHY ACBP=28\r
- 0000:0587 01BD C=CODE S=_TEXT G=(none) M=REALCVT ACBP=28\r
- 0000:0744 0395 C=CODE S=_TEXT G=(none) M=SCANTOD ACBP=28\r
- 0000:0AD9 020C C=CODE S=_TEXT G=(none) M=XCVT ACBP=28\r
- 0000:0CE5 00B1 C=CODE S=_TEXT G=(none) M=FPERR ACBP=28\r
- 0000:0D96 00C9 C=CODE S=_TEXT G=(none) M=_POW10 ACBP=28\r
- 0000:0E5F 000B C=CODE S=_TEXT G=(none) M=POW10D ACBP=28\r
- 0000:0E6A 002A C=CODE S=_TEXT G=(none) M=MATHERR ACBP=28\r
- 0000:0E94 0052 C=CODE S=_TEXT G=(none) M=SIN ACBP=28\r
- 0000:0EE6 00A9 C=CODE S=_TEXT G=(none) M=_MATHERR ACBP=28\r
- 0000:0F8F 002C C=CODE S=_TEXT G=(none) M=FFTOL ACBP=28\r
- 0000:0FBB 002D C=CODE S=_TEXT G=(none) M=ATEXIT ACBP=28\r
- 0000:0FE8 0000 C=CODE S=_TEXT G=(none) M=CTYPE ACBP=28\r
- 0000:0FE8 0093 C=CODE S=_TEXT G=(none) M=EXIT ACBP=28\r
- 0000:107B 0000 C=CODE S=_TEXT G=(none) M=FILES ACBP=28\r
- 0000:107B 0000 C=CODE S=_TEXT G=(none) M=FILES2 ACBP=28\r
- 0000:107B 0000 C=CODE S=_TEXT G=(none) M=FPSTKLEN ACBP=28\r
- 0000:107B 001C C=CODE S=_TEXT G=(none) M=F_SCOPY ACBP=28\r
- 0000:1097 0021 C=CODE S=_TEXT G=(none) M=H_LLSH ACBP=28\r
- 0000:10B8 0060 C=CODE S=_TEXT G=(none) M=H_PADD ACBP=28\r
- 0000:1118 004B C=CODE S=_TEXT G=(none) M=IOERROR ACBP=28\r
- 0000:1163 0011 C=CODE S=_TEXT G=(none) M=ISATTY ACBP=28\r
- 0000:1174 00A2 C=CODE S=_TEXT G=(none) M=LONGTOA ACBP=28\r
- 0000:1216 0029 C=CODE S=_TEXT G=(none) M=LSEEK ACBP=28\r
- 0000:123F 0021 C=CODE S=_TEXT G=(none) M=N_PCMP ACBP=28\r
- 0000:1260 00BA C=CODE S=_TEXT G=(none) M=SETUPIO ACBP=28\r
- 0000:131A 0000 C=CODE S=_TEXT G=(none) M=SIGDATA ACBP=28\r
- 0000:131A 0000 C=CODE S=_TEXT G=(none) M=STKLEN ACBP=28\r
- 0000:131A 04DB C=CODE S=_TEXT G=(none) M=VPRINTER ACBP=28\r
- 0000:17F5 001F C=CODE S=_TEXT G=(none) M=CVTFAK ACBP=28\r
- 0000:1814 0432 C=CODE S=_TEXT G=(none) M=FARHEAP ACBP=28\r
- 0000:1C46 0140 C=CODE S=_TEXT G=(none) M=FBRK ACBP=28\r
- 0000:1D86 0004 C=CODE S=_TEXT G=(none) M=REALCVT ACBP=28\r
- 0000:1D8A 001C C=CODE S=_TEXT G=(none) M=SETBLOCK ACBP=28\r
- 0000:1DA6 00CD C=CODE S=_TEXT G=(none) M=FFLUSH ACBP=28\r
- 0000:1E73 0042 C=CODE S=_TEXT G=(none) M=FLUSHALL ACBP=28\r
- 0000:1EB5 001C C=CODE S=_TEXT G=(none) M=FPRINTF ACBP=28\r
- 0000:1ED1 01E2 C=CODE S=_TEXT G=(none) M=FSEEK ACBP=28\r
- 0000:20B3 0024 C=CODE S=_TEXT G=(none) M=MEMCPY ACBP=28\r
- 0000:20D7 0043 C=CODE S=_TEXT G=(none) M=MEMSET ACBP=28\r
- 0000:211A 03C8 C=CODE S=_TEXT G=(none) M=PUTC ACBP=28\r
- 0000:24E2 011D C=CODE S=_TEXT G=(none) M=SETVBUF ACBP=28\r
- 0000:25FF 0151 C=CODE S=_TEXT G=(none) M=WRITE ACBP=28\r
- 0000:2750 003C C=CODE S=_TEXT G=(none) M=WRITEA ACBP=28\r
- 0000:278C 0038 C=CODE S=_TEXT G=(none) M=XFFLUSH ACBP=28\r
- 027C:0004 0000 C=CODE S=ASMYT_TEXT G=(none) M=ASMYT.ASM ACBP=48\r
- 027D:0000 D4AC C=CODE S=PORO G=(none) M=ASMYT.ASM ACBP=60\r
- 0FC7:000C 098A C=CODE S=COPPER_TEXT G=(none) M=COPPER.ASM ACBP=48\r
- 1060:0006 0000 C=CODE S=INCLUDE_TEXT G=(none) M=INCLUDE.ASM ACBP=48\r
- 1060:0006 0000 C=CODE S=PLZA_TEXT G=(none) M=PLZA.ASM ACBP=48\r
- 1061:0000 26BE C=CODE S=LERSSICODE G=(none) M=PLZA.ASM ACBP=68\r
- 12CC:000E 01D9 C=CODE S=TWEAK_TEXT G=(none) M=TWEAK.ASM ACBP=48\r
- 12EA:0007 082A C=CODE S=PLZ_TEXT G=(none) M=PLZ.C ACBP=28\r
- 136D:0001 0CB2 C=CODE S=PLZFILL_TEXT G=(none) M=PLZFILL.C ACBP=28\r
- 1438:0003 09F6 C=CODE S=VECT_TEXT G=(none) M=VECT.C ACBP=28\r
- 14D7:0009 0023 C=CODE S=MAIN_TEXT G=(none) M=MAIN.C ACBP=28\r
- 14DA:0000 00D4 C=CODE S=text_disc G=(none) M=disc.asm ACBP=68\r
- 14E7:0004 127A C=CODE S=SPLINE_TEXT G=(none) M=SPLINE.ASM ACBP=48\r
- 160F:0000 0000 C=CODE S=EMU_PROG G=(none) M=FPINIT ACBP=68\r
- 160F:0000 2777 C=CODE S=EMU_PROG G=(none) M=EMU086 ACBP=68\r
- 1887:0000 0000 C=CODE S=E87_PROG G=(none) M=FPINIT ACBP=68\r
- 1887:0000 03E3 C=CODE S=E87_PROG G=(none) M=EMU087 ACBP=68\r
- 1887:03F0 01D8 C=CODE S=E87_PROG G=(none) M=E87TRAP ACBP=68\r
- 18E4:0000 0000 C=FAR_DATA S=_FARDATA G=(none) M=c0.ASM ACBP=68\r
- 18E4:0000 4000 C=FAR_DATA S=KAKKA2 G=(none) M=INCLUDE.ASM ACBP=60\r
- 1CE4:0000 8000 C=FAR_DATA S=KAKKA6 G=(none) M=INCLUDE.ASM ACBP=60\r
- 24E4:0000 4000 C=FAR_DATA S=KAKKA3 G=(none) M=INCLUDE.ASM ACBP=60\r
- 28E4:0000 4000 C=FAR_DATA S=KAKKA4 G=(none) M=INCLUDE.ASM ACBP=60\r
- 2CE4:0000 0A0F C=FAR_DATA S=KAKKA5 G=(none) M=INCLUDE.ASM ACBP=60\r
- 2D85:0000 03EC C=FAR_DATA S=PLZFILL5_DATA G=(none) M=PLZFILL.C ACBP=68\r
- 2DC4:0000 0300 C=FAR_DATA S=VECT5_DATA G=(none) M=VECT.C ACBP=68\r
- 2DF4:0000 0000 C=FAR_BSS S=_FARBSS G=(none) M=c0.ASM ACBP=68\r
- 2DF4:0000 0000 C=OVRINFO S=_OVERLAY_ G=(none) M=c0.ASM ACBP=68\r
- 2DF4:0000 0000 C=STUBSEG S=_1STUB_ G=(none) M=c0.ASM ACBP=68\r
- 2DF4:0000 0093 C=DATA S=_DATA G=DGROUP M=c0.ASM ACBP=68\r
- 2DF4:0094 0000 C=DATA S=_DATA G=DGROUP M=ASMYT.ASM ACBP=48\r
- 2DF4:0094 0000 C=DATA S=_DATA G=DGROUP M=COPPER.ASM ACBP=48\r
- 2DF4:0094 0000 C=DATA S=_DATA G=DGROUP M=INCLUDE.ASM ACBP=48\r
- 2DF4:0094 0000 C=DATA S=_DATA G=DGROUP M=PLZA.ASM ACBP=48\r
- 2DF4:0094 0000 C=DATA S=_DATA G=DGROUP M=TWEAK.ASM ACBP=48\r
- 2DF4:0094 01D8 C=DATA S=_DATA G=DGROUP M=PLZ.C ACBP=48\r
- 2DF4:026C 0036 C=DATA S=_DATA G=DGROUP M=PLZFILL.C ACBP=48\r
- 2DF4:02A2 28A4 C=DATA S=_DATA G=DGROUP M=VECT.C ACBP=48\r
- 2DF4:2B46 0000 C=DATA S=_DATA G=DGROUP M=MAIN.C ACBP=48\r
- 2DF4:2B46 0000 C=DATA S=_DATA G=DGROUP M=SPLINE.ASM ACBP=48\r
- 2DF4:2B50 0002 C=DATA S=_DATA G=DGROUP M=FPINIT ACBP=68\r
- 2DF4:2B60 0000 C=DATA S=_DATA G=DGROUP M=E87TRAP ACBP=68\r
- 2DF4:2B60 0003 C=DATA S=_DATA G=DGROUP M=PROTFLAG ACBP=48\r
- 2DF4:2B64 0002 C=DATA S=_DATA G=DGROUP M=DEFLT87 ACBP=48\r
- 2DF4:2B66 0024 C=DATA S=_DATA G=DGROUP M=HUGEVAL ACBP=48\r
- 2DF4:2B8A 0000 C=DATA S=_DATA G=DGROUP M=LDTRUNC ACBP=48\r
- 2DF4:2B8A 0043 C=DATA S=_DATA G=DGROUP M=MATHWHY ACBP=48\r
- 2DF4:2BCE 0000 C=DATA S=_DATA G=DGROUP M=REALCVT ACBP=48\r
- 2DF4:2BCE 0018 C=DATA S=_DATA G=DGROUP M=SCANTOD ACBP=48\r
- 2DF4:2BE6 0000 C=DATA S=_DATA G=DGROUP M=XCVT ACBP=48\r
- 2DF4:2BE6 009A C=DATA S=_DATA G=DGROUP M=FPERR ACBP=48\r
- 2DF4:2C80 0080 C=DATA S=_DATA G=DGROUP M=_POW10 ACBP=48\r
- 2DF4:2D00 0000 C=DATA S=_DATA G=DGROUP M=POW10D ACBP=48\r
- 2DF4:2D00 0000 C=DATA S=_DATA G=DGROUP M=MATHERR ACBP=48\r
- 2DF4:2D00 000C C=DATA S=_DATA G=DGROUP M=SIN ACBP=48\r
- 2DF4:2D0C 000E C=DATA S=_DATA G=DGROUP M=_MATHERR ACBP=48\r
- 2DF4:2D1A 0000 C=DATA S=_DATA G=DGROUP M=FFTOL ACBP=48\r
- 2DF4:2D1A 0002 C=DATA S=_DATA G=DGROUP M=ATEXIT ACBP=48\r
- 2DF4:2D1C 0101 C=DATA S=_DATA G=DGROUP M=CTYPE ACBP=48\r
- 2DF4:2E1E 000C C=DATA S=_DATA G=DGROUP M=EXIT ACBP=48\r
- 2DF4:2E2A 0190 C=DATA S=_DATA G=DGROUP M=FILES ACBP=48\r
- 2DF4:2FBA 002A C=DATA S=_DATA G=DGROUP M=FILES2 ACBP=48\r
- 2DF4:2FE4 0002 C=DATA S=_DATA G=DGROUP M=FPSTKLEN ACBP=48\r
- 2DF4:2FE6 0000 C=DATA S=_DATA G=DGROUP M=F_SCOPY ACBP=48\r
- 2DF4:2FE6 0000 C=DATA S=_DATA G=DGROUP M=H_LLSH ACBP=48\r
- 2DF4:2FE6 0000 C=DATA S=_DATA G=DGROUP M=H_PADD ACBP=48\r
- 2DF4:2FE6 005B C=DATA S=_DATA G=DGROUP M=IOERROR ACBP=48\r
- 2DF4:3042 0000 C=DATA S=_DATA G=DGROUP M=ISATTY ACBP=48\r
- 2DF4:3042 0000 C=DATA S=_DATA G=DGROUP M=LONGTOA ACBP=48\r
- 2DF4:3042 0000 C=DATA S=_DATA G=DGROUP M=LSEEK ACBP=48\r
- 2DF4:3042 0000 C=DATA S=_DATA G=DGROUP M=N_PCMP ACBP=48\r
- 2DF4:3042 0000 C=DATA S=_DATA G=DGROUP M=SETUPIO ACBP=48\r
- 2DF4:3042 0000 C=DATA S=_DATA G=DGROUP M=SIGDATA ACBP=48\r
- 2DF4:3042 0002 C=DATA S=_DATA G=DGROUP M=STKLEN ACBP=48\r
- 2DF4:3044 0067 C=DATA S=_DATA G=DGROUP M=VPRINTER ACBP=48\r
- 2DF4:30AC 0031 C=DATA S=_DATA G=DGROUP M=CVTFAK ACBP=48\r
- 2DF4:30DE 0000 C=DATA S=_DATA G=DGROUP M=FARHEAP ACBP=48\r
- 2DF4:30DE 0002 C=DATA S=_DATA G=DGROUP M=FBRK ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=REALCVT ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=SETBLOCK ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=FFLUSH ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=FLUSHALL ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=FPRINTF ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=FSEEK ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=MEMCPY ACBP=48\r
- 2DF4:30E0 0000 C=DATA S=_DATA G=DGROUP M=MEMSET ACBP=48\r
- 2DF4:30E0 0001 C=DATA S=_DATA G=DGROUP M=PUTC ACBP=48\r
- 2DF4:30E2 0004 C=DATA S=_DATA G=DGROUP M=SETVBUF ACBP=48\r
- 2DF4:30E6 0000 C=DATA S=_DATA G=DGROUP M=WRITE ACBP=48\r
- 2DF4:30E6 0000 C=DATA S=_DATA G=DGROUP M=WRITEA ACBP=48\r
- 2DF4:30E6 0000 C=DATA S=_DATA G=DGROUP M=XFFLUSH ACBP=48\r
- 2DF4:30E6 0000 C=DATA S=_CVTSEG G=DGROUP M=c0.ASM ACBP=48\r
- 2DF4:30E6 0002 C=DATA S=_CVTSEG G=DGROUP M=REALCVT ACBP=48\r
- 2DF4:30E8 0002 C=DATA S=_CVTSEG G=DGROUP M=CVTFAK ACBP=48\r
- 2DF4:30EA 0000 C=DATA S=_CVTSEG G=DGROUP M=REALCVT ACBP=48\r
- 2DF4:30EA 0000 C=DATA S=_SCNSEG G=DGROUP M=c0.ASM ACBP=48\r
- 2DF4:30EA 0006 C=DATA S=_SCNSEG G=DGROUP M=SCANTOD ACBP=48\r
- 2DF4:30F0 0006 C=DATA S=_SCNSEG G=DGROUP M=CVTFAK ACBP=48\r
- 2DF4:30F6 0000 C=CONST S=_CONST G=DGROUP M=c0.ASM ACBP=48\r
- 2DF4:30F6 0000 C=INITDATA S=_INIT_ G=DGROUP M=c0.ASM ACBP=48\r
- 2DF4:30F6 0006 C=INITDATA S=_INIT_ G=DGROUP M=FPINIT ACBP=48\r
- 2DF4:30FC 0006 C=INITDATA S=_INIT_ G=DGROUP M=SETUPIO ACBP=48\r
- 2DF4:3102 0000 C=INITDATA S=_INITEND_ G=DGROUP M=c0.ASM ACBP=28\r
- 2DF4:3102 0000 C=EXITDATA S=_EXIT_ G=DGROUP M=c0.ASM ACBP=48\r
- 2DF4:3102 0006 C=EXITDATA S=_EXIT_ G=DGROUP M=FPINIT ACBP=48\r
- 2DF4:3108 0000 C=EXITDATA S=_EXITEND_ G=DGROUP M=c0.ASM ACBP=28\r
- 2DF4:3108 0000 C=BSS S=_BSS G=DGROUP M=c0.ASM ACBP=48\r
- 2DF4:3108 2400 C=BSS S=_BSS G=DGROUP M=PLZ.C ACBP=48\r
- 2DF4:5508 33A0 C=BSS S=_BSS G=DGROUP M=PLZFILL.C ACBP=48\r
- 2DF4:88A8 0412 C=BSS S=_BSS G=DGROUP M=VECT.C ACBP=48\r
- 2DF4:8CBA 0000 C=BSS S=_BSS G=DGROUP M=MAIN.C ACBP=48\r
- 2DF4:8CBA 0000 C=BSS S=_BSS G=DGROUP M=LDTRUNC ACBP=48\r
- 2DF4:8CBA 0000 C=BSS S=_BSS G=DGROUP M=REALCVT ACBP=48\r
- 2DF4:8CBA 0000 C=BSS S=_BSS G=DGROUP M=SCANTOD ACBP=48\r
- 2DF4:8CBA 0000 C=BSS S=_BSS G=DGROUP M=XCVT ACBP=48\r
- 2DF4:8CBA 0000 C=BSS S=_BSS G=DGROUP M=_POW10 ACBP=48\r
- 2DF4:8CBA 0000 C=BSS S=_BSS G=DGROUP M=SIN ACBP=48\r
- 2DF4:8CBA 0080 C=BSS S=_BSS G=DGROUP M=ATEXIT ACBP=48\r
- 2DF4:8D3A 0000 C=BSS S=_BSS G=DGROUP M=IOERROR ACBP=48\r
- 2DF4:8D3A 0000 C=BSS S=_BSS G=DGROUP M=ISATTY ACBP=48\r
- 2DF4:8D3A 0000 C=BSS S=_BSS G=DGROUP M=LONGTOA ACBP=48\r
- 2DF4:8D3A 0000 C=BSS S=_BSS G=DGROUP M=LSEEK ACBP=48\r
- 2DF4:8D3A 0000 C=BSS S=_BSS G=DGROUP M=SETUPIO ACBP=48\r
- 2DF4:8D3A 0004 C=BSS S=_BSS G=DGROUP M=SIGDATA ACBP=48\r
- 2DF4:8D3E 0000 C=BSS S=_BSS G=DGROUP M=VPRINTER ACBP=48\r
- 2DF4:8D3E 0000 C=BSS S=_BSS G=DGROUP M=SETBLOCK ACBP=48\r
- 2DF4:8D3E 0000 C=BSS S=_BSS G=DGROUP M=MEMCPY ACBP=48\r
- 2DF4:8D3E 0000 C=BSS S=_BSS G=DGROUP M=MEMSET ACBP=48\r
- 2DF4:8D3E 0001 C=BSS S=_BSS G=DGROUP M=PUTC ACBP=48\r
- 2DF4:8D40 0000 C=BSS S=_BSS G=DGROUP M=WRITEA ACBP=48\r
- 2DF4:8D40 0000 C=BSSEND S=_BSSEND G=DGROUP M=c0.ASM ACBP=28\r
- 36C8:0000 0110 C=STACK S=_STACK G=(none) M=c0.ASM ACBP=74\r
- 36C8:0000 0080 C=STACK S=_STACK G=(none) M=EMUVARS ACBP=78\r
-\r
- Address Publics by Name\r
-\r
- 2DF4:0000 idle DATASEG@\r
- 0000:0291 idle DGROUP@\r
- 160F:2152 e086_Entry\r
- 160F:26E0 e086_Shortcut\r
- 1887:0306 e087_Entry\r
- 1887:03C6 e087_Shortcut\r
- 1887:0430 e087_Trap\r
- 0000:FE32 idle FIARQQ\r
- 0000:0E32 idle FICRQQ\r
- 0000:5C32 Abs FIDRQQ\r
- 0000:1632 Abs FIERQQ\r
- 0000:0632 idle FISRQQ\r
- 0000:A23D Abs FIWRQQ\r
- 0000:4000 idle FJARQQ\r
- 0000:C000 idle FJCRQQ\r
- 0000:8000 idle FJSRQQ\r
- 0000:0F8F idle FTOL@\r
- 0000:0F8F F_FTOL@\r
- 0000:109A idle F_LXLSH@\r
- 0000:10BB idle F_PADD@\r
- 0000:10EA idle F_PSUB@\r
- 0000:107B F_SCOPY@\r
- 0000:109A idle LXLSH@\r
- 0000:1097 N_LXLSH@\r
- 0000:10B8 N_PADD@\r
- 0000:123F N_PCMP@\r
- 0000:10E7 idle N_PSUB@\r
- 0000:10BB idle PADD@\r
- 0000:10EA idle PSUB@\r
- 0000:107B idle SCOPY@\r
- 0000:027A _abort\r
- 0000:0FBB idle _atexit\r
- 1061:07E8 _ax1\r
- 1061:07F0 _ax2\r
- 1061:07E4 idle _ay1\r
- 1061:07EC idle _ay2\r
- 2D85:0004 idle _buu\r
- 1438:00B4 idle _calculate\r
- 136D:0C5C _clear\r
- 0FC7:001C _close_copper\r
- 2DF4:026C idle _clrptr\r
- 2DF4:5508 idle _clrtau\r
- 0FC7:000E _cop_drop\r
- 0FC7:07E8 _cop_fadepal\r
- 0FC7:0010 _cop_pal\r
- 0FC7:001A _cop_plz\r
- 0FC7:0018 _cop_scrl\r
- 0FC7:0016 _cop_start\r
- 1438:0177 idle _count_const\r
- 1061:081E _ctau\r
- 2DF4:0194 idle _curpal\r
- 2DF4:88B8 idle _cxx\r
- 2DF4:88B6 idle _cxy\r
- 2DF4:88B4 idle _cxz\r
- 2DF4:88B2 idle _cyx\r
- 2DF4:88B0 idle _cyy\r
- 2DF4:88AE idle _cyz\r
- 2DF4:88AC idle _czx\r
- 2DF4:88AA idle _czy\r
- 2DF4:88A8 idle _czz\r
- 2DF4:2B2C _dis\r
- 1CE4:0000 _dist1\r
- 2DF4:0276 idle _disttaus\r
- 14DA:005A _dis_exit\r
- 14DA:00BE _dis_getmframe\r
- 14DA:0060 idle _dis_indemo\r
- 14DA:0066 idle _dis_msgarea\r
- 14DA:0073 idle _dis_muscode\r
- 14DA:0080 _dis_musplus\r
- 14DA:008F idle _dis_musrow\r
- 14DA:0040 _dis_partstart\r
- 14DA:009B idle _dis_setcopper\r
- 14DA:00AE _dis_setmframe\r
- 14DA:00CA idle _dis_sync\r
- 14DA:0000 idle _dis_version\r
- 14DA:0023 idle _dis_waitb\r
- 1061:0824 _do_block\r
- 1061:2612 _do_clear\r
- 0FC7:0014 _do_pal\r
- 136D:02D7 _do_poly\r
- 1438:079F idle _draw\r
- 1061:081C _dseg\r
- 2DF4:007F _errno\r
- 0000:1040 _exit\r
- 0FC7:01E8 _fadepal\r
- 0000:1954 idle _farfree\r
- 0000:1A68 idle _farmalloc\r
- 0000:1BCC idle _farrealloc\r
- 0000:1DA6 _fflush\r
- 0000:1E73 _flushall\r
- 2DC4:0000 idle _fpal\r
- 0000:1EB5 _fprintf\r
- 0000:2136 idle _fputc\r
- 0000:22CB idle _fputchar\r
- 2DF4:2B40 idle _frames\r
- 0FC7:000C _frame_count\r
- 0000:1954 _free\r
- 1061:0818 _from\r
- 0000:1F53 _fseek\r
- 0000:1FD3 idle _ftell\r
- 14E7:1084 _getspl\r
- 2DF4:01C4 _ik1\r
- 2DF4:01C6 _ik2\r
- 2DF4:01C8 _ik3\r
- 2DF4:01CA _ik4\r
- 2DF4:01BC _il1\r
- 2DF4:01BE _il2\r
- 2DF4:01C0 _il3\r
- 2DF4:01C2 _il4\r
- 2DF4:01CC idle _inittable\r
- 136D:0001 _initvect\r
- 0FC7:0047 _init_copper\r
- 12EA:02B1 idle _init_plz\r
- 0000:1163 _isatty\r
- 1061:0000 idle _jmp_tau\r
- 2DF4:01B4 _k1\r
- 2DF4:01B6 _k2\r
- 2DF4:01B8 _k3\r
- 2DF4:01BA _k4\r
- 2CE4:0200 _kosinit\r
- 18E4:0000 _kuva1\r
- 24E4:0000 _kuva2\r
- 28E4:0000 _kuva3\r
- 2DF4:026E idle _kuvataus\r
- 2DF4:2B26 _kx\r
- 2DF4:2B28 _ky\r
- 2DF4:2B2A _kz\r
- 2DF4:01AC _l1\r
- 2DF4:01AE _l2\r
- 2DF4:01B0 _l3\r
- 2DF4:01B2 _l4\r
- 2DF4:2B0E idle _light_src\r
- 2DF4:2B1A idle _lls\r
- 0000:1216 _lseek\r
- 027D:8000 idle _lsini16\r
- 027D:4000 idle _lsini4\r
- 2DF4:2B32 _ls_kx\r
- 2DF4:2B34 _ls_ky\r
- 2DF4:2B36 _ls_kz\r
- 2DF4:2B38 idle _ls_x\r
- 2DF4:2B3A idle _ls_y\r
- 2DF4:2B3C idle _ls_z\r
- 14D7:0009 _main\r
- 0000:1A5E _malloc\r
- 0000:0E6A _matherr\r
- 0000:20B3 _memcpy\r
- 0000:20FB _memset\r
- 0FC7:0107 idle _moveplz\r
- 2DF4:02A2 idle _object\r
- 2DF4:2B3E idle _page\r
- 2DF4:7508 _pal\r
- 2DF4:3108 idle _pals\r
- 12EA:0007 _plz\r
- 027D:C000 _plzline\r
- 2DF4:2B0C idle _polys\r
- 0FC7:00D9 idle _pompota\r
- 0000:0E5F _pow10\r
- 027D:0000 idle _psini\r
- 2DF4:0094 idle _ptau\r
- 2DF4:88BA idle _ptodraw\r
- 0000:1BC5 idle _realloc\r
- 1438:043C idle _rotate\r
- 12CC:0012 idle _scr_seg\r
- 0000:1D8A _setblock\r
- 0000:20D7 idle _setmem\r
- 027D:C618 _setplzparas\r
- 0000:24E2 _setvbuf\r
- 027D:D48E _set_plzstart\r
- 1061:2584 _shadepal\r
- 0000:0E94 _sin\r
- 2DF4:7908 idle _sini\r
- 2CE4:0000 _sinit\r
- 2DF4:7888 idle _sinx\r
- 2DF4:7808 idle _siny\r
- 1438:0556 idle _sort_faces\r
- 1438:08C5 idle _swappage\r
- 1061:0804 _tax1\r
- 1061:080C _tax2\r
- 1061:0808 _tay1\r
- 1061:0810 _tay2\r
- 2DF4:0196 idle _timetable\r
- 1061:0814 _to\r
- 2DF4:01AA idle _ttptr\r
- 12CC:007C idle _tw_closegraph\r
- 12CC:0062 idle _tw_clrscr\r
- 12CC:00BB idle _tw_getpixel\r
- 12CC:0014 _tw_opengraph\r
- 12CC:0035 _tw_opengraph2\r
- 12CC:0141 idle _tw_pictovmem\r
- 12CC:0082 idle _tw_putpixel\r
- 12CC:010B idle _tw_setpalarea\r
- 12CC:00F2 idle _tw_setpalette\r
- 12CC:01CD _tw_setrgbpalette\r
- 12CC:012C idle _tw_setstart\r
- 12CC:01BF idle _tw_waitvr\r
- 2DF4:2B2E _tx\r
- 1061:07F4 _txx1\r
- 1061:07FC _txx2\r
- 1061:07F8 _txy1\r
- 1061:0800 _txy2\r
- 2DF4:2B30 _ty\r
- 1438:0003 _vect\r
- 2D85:0000 _vmem\r
- 1061:07D0 idle _xx\r
- 1061:07D8 _xx1\r
- 1061:07E0 _xx2\r
- 1061:07D2 _yy\r
- 1061:07D4 idle _yy1\r
- 1061:07DC idle _yy2\r
- 2DF4:2B50 __8087\r
- 0000:1000 idle __AHINCR\r
- 0000:000C idle __AHSHIFT\r
- 2DF4:2D1A __atexitcnt\r
- 2DF4:8CBA __atexittbl\r
- 0000:1CBC __brk\r
- 2DF4:008B __brklvl\r
- 2DF4:006B idle __C0argc\r
- 2DF4:006D idle __C0argv\r
- 2DF4:0071 idle __C0environ\r
- 0000:1061 idle __cexit\r
- 0000:016A __checknull\r
- 0000:0157 __cleanup\r
- 2DF4:2D1C __ctype\r
- 0000:0000 Abs __cvtfak\r
- 0000:106F idle __c_exit\r
- 2DF4:2B64 __default87\r
- 2DF4:2FE6 idle __doserrno\r
- 0000:1151 idle __DOSERROR\r
- 2DF4:2FE8 idle __dosErrorToSV\r
- 36C8:0000 __emu\r
- 2DF4:0075 idle __envLng\r
- 2DF4:0077 idle __envseg\r
- 2DF4:0079 idle __envSize\r
- 0000:104F __exit\r
- 2DF4:2E1E __exitbuf\r
- 2DF4:2E22 idle __exitfopen\r
- 2DF4:2E26 idle __exitopen\r
- 0000:8087 idle __floatconvert\r
- 0000:0CE5 __fperror\r
- 2DF4:2FE4 __fpstklen\r
- 0000:04E9 __fpuint\r
- 0000:211A idle __fputc\r
- 0000:22DF __FPUTN\r
- 2DF4:0087 __heapbase\r
- 2DF4:008F __heaptop\r
- 2DF4:2B6A __huge_dble\r
- 2DF4:2B66 idle __huge_flt\r
- 2DF4:2B72 idle __huge_ldble\r
- 2DF4:2B7C idle __indefinite\r
- 2DF4:005B idle __Int0Vector\r
- 2DF4:005F idle __Int4Vector\r
- 2DF4:0063 idle __Int5Vector\r
- 2DF4:0067 idle __Int6Vector\r
- 0000:1118 __IOERROR\r
- 2DF4:2B61 __LDT\r
- 0000:04ED __LDTRUNC\r
- 0000:1174 __LONGTOA\r
- 0000:0EE6 __matherr\r
- 2DF4:2B8A __mathwhy\r
- 0000:0293 idle __MMODEL\r
- 2DF4:2FBA __nfile\r
- 2DF4:2FBC __openfd\r
- 2DF4:007D idle __osmajor\r
- 2DF4:007E idle __osminor\r
- 2DF4:007D idle __osversion\r
- 0000:0D96 __POW10\r
- 2DF4:2B60 __protected\r
- 2DF4:007B __psp\r
- 0000:1D86 __REALCVT\r
- 2DF4:30E6 __RealCvtVector\r
- 0000:01C0 __restorezero\r
- 0000:1CFB __sbrk\r
- 2DF4:30EA idle __ScanTodVector\r
- 0000:1260 __setupio\r
- 2DF4:0081 idle __StartTime\r
- 2DF4:3042 __stklen\r
- 2DF4:2E2A __streams\r
- 0000:016B __terminate\r
- 2DF4:2B80 idle __tiny_ldble\r
- 0000:0000 Abs __turboCvt\r
- 0000:8087 Abs __turboFloat\r
- 0000:11F6 idle __UTOA\r
- 2DF4:007D __version\r
- 0000:1332 __VPRINTER\r
- 0000:2750 __write\r
- 0000:0AD9 __XCVT\r
- 0000:278C __xfflush\r
- 2DF4:0085 idle ___brklvl\r
- 0000:1814 idle ___first\r
- 0000:0402 idle ___fpreset\r
- 0000:1816 idle ___last\r
- 0000:1818 idle ___rover\r
- 2DF4:8D3A ___SignalPtr\r
- 0000:25FF ___write\r
-\r
- Address Publics by Value\r
-\r
- 0000:0000 Abs __turboCvt\r
- 0000:0000 Abs __cvtfak\r
- 0000:000C idle __AHSHIFT\r
- 0000:0157 __cleanup\r
- 0000:016A __checknull\r
- 0000:016B __terminate\r
- 0000:01C0 __restorezero\r
- 0000:027A _abort\r
- 0000:0291 idle DGROUP@\r
- 0000:0293 idle __MMODEL\r
- 0000:0402 idle ___fpreset\r
- 0000:04E9 __fpuint\r
- 0000:04ED __LDTRUNC\r
- 0000:0632 idle FISRQQ\r
- 0000:0AD9 __XCVT\r
- 0000:0CE5 __fperror\r
- 0000:0D96 __POW10\r
- 0000:0E32 idle FICRQQ\r
- 0000:0E5F _pow10\r
- 0000:0E6A _matherr\r
- 0000:0E94 _sin\r
- 0000:0EE6 __matherr\r
- 0000:0F8F F_FTOL@\r
- 0000:0F8F idle FTOL@\r
- 0000:0FBB idle _atexit\r
- 0000:1000 idle __AHINCR\r
- 0000:1040 _exit\r
- 0000:104F __exit\r
- 0000:1061 idle __cexit\r
- 0000:106F idle __c_exit\r
- 0000:107B F_SCOPY@\r
- 0000:107B idle SCOPY@\r
- 0000:1097 N_LXLSH@\r
- 0000:109A idle LXLSH@\r
- 0000:109A idle F_LXLSH@\r
- 0000:10B8 N_PADD@\r
- 0000:10BB idle F_PADD@\r
- 0000:10BB idle PADD@\r
- 0000:10E7 idle N_PSUB@\r
- 0000:10EA idle F_PSUB@\r
- 0000:10EA idle PSUB@\r
- 0000:1118 __IOERROR\r
- 0000:1151 idle __DOSERROR\r
- 0000:1163 _isatty\r
- 0000:1174 __LONGTOA\r
- 0000:11F6 idle __UTOA\r
- 0000:1216 _lseek\r
- 0000:123F N_PCMP@\r
- 0000:1260 __setupio\r
- 0000:1332 __VPRINTER\r
- 0000:1632 Abs FIERQQ\r
- 0000:1814 idle ___first\r
- 0000:1816 idle ___last\r
- 0000:1818 idle ___rover\r
- 0000:1954 _free\r
- 0000:1954 idle _farfree\r
- 0000:1A5E _malloc\r
- 0000:1A68 idle _farmalloc\r
- 0000:1BC5 idle _realloc\r
- 0000:1BCC idle _farrealloc\r
- 0000:1CBC __brk\r
- 0000:1CFB __sbrk\r
- 0000:1D86 __REALCVT\r
- 0000:1D8A _setblock\r
- 0000:1DA6 _fflush\r
- 0000:1E73 _flushall\r
- 0000:1EB5 _fprintf\r
- 0000:1F53 _fseek\r
- 0000:1FD3 idle _ftell\r
- 0000:20B3 _memcpy\r
- 0000:20D7 idle _setmem\r
- 0000:20FB _memset\r
- 0000:211A idle __fputc\r
- 0000:2136 idle _fputc\r
- 0000:22CB idle _fputchar\r
- 0000:22DF __FPUTN\r
- 0000:24E2 _setvbuf\r
- 0000:25FF ___write\r
- 0000:2750 __write\r
- 0000:278C __xfflush\r
- 0000:4000 idle FJARQQ\r
- 0000:5C32 Abs FIDRQQ\r
- 0000:8000 idle FJSRQQ\r
- 0000:8087 Abs __turboFloat\r
- 0000:8087 idle __floatconvert\r
- 0000:A23D Abs FIWRQQ\r
- 0000:C000 idle FJCRQQ\r
- 0000:FE32 idle FIARQQ\r
- 027D:0000 idle _psini\r
- 027D:4000 idle _lsini4\r
- 027D:8000 idle _lsini16\r
- 027D:C000 _plzline\r
- 027D:C618 _setplzparas\r
- 027D:D48E _set_plzstart\r
- 0FC7:000C _frame_count\r
- 0FC7:000E _cop_drop\r
- 0FC7:0010 _cop_pal\r
- 0FC7:0014 _do_pal\r
- 0FC7:0016 _cop_start\r
- 0FC7:0018 _cop_scrl\r
- 0FC7:001A _cop_plz\r
- 0FC7:001C _close_copper\r
- 0FC7:0047 _init_copper\r
- 0FC7:00D9 idle _pompota\r
- 0FC7:0107 idle _moveplz\r
- 0FC7:01E8 _fadepal\r
- 0FC7:07E8 _cop_fadepal\r
- 1061:0000 idle _jmp_tau\r
- 1061:07D0 idle _xx\r
- 1061:07D2 _yy\r
- 1061:07D4 idle _yy1\r
- 1061:07D8 _xx1\r
- 1061:07DC idle _yy2\r
- 1061:07E0 _xx2\r
- 1061:07E4 idle _ay1\r
- 1061:07E8 _ax1\r
- 1061:07EC idle _ay2\r
- 1061:07F0 _ax2\r
- 1061:07F4 _txx1\r
- 1061:07F8 _txy1\r
- 1061:07FC _txx2\r
- 1061:0800 _txy2\r
- 1061:0804 _tax1\r
- 1061:0808 _tay1\r
- 1061:080C _tax2\r
- 1061:0810 _tay2\r
- 1061:0814 _to\r
- 1061:0818 _from\r
- 1061:081C _dseg\r
- 1061:081E _ctau\r
- 1061:0824 _do_block\r
- 1061:2584 _shadepal\r
- 1061:2612 _do_clear\r
- 12CC:0012 idle _scr_seg\r
- 12CC:0014 _tw_opengraph\r
- 12CC:0035 _tw_opengraph2\r
- 12CC:0062 idle _tw_clrscr\r
- 12CC:007C idle _tw_closegraph\r
- 12CC:0082 idle _tw_putpixel\r
- 12CC:00BB idle _tw_getpixel\r
- 12CC:00F2 idle _tw_setpalette\r
- 12CC:010B idle _tw_setpalarea\r
- 12CC:012C idle _tw_setstart\r
- 12CC:0141 idle _tw_pictovmem\r
- 12CC:01BF idle _tw_waitvr\r
- 12CC:01CD _tw_setrgbpalette\r
- 12EA:0007 _plz\r
- 12EA:02B1 idle _init_plz\r
- 136D:0001 _initvect\r
- 136D:02D7 _do_poly\r
- 136D:0C5C _clear\r
- 1438:0003 _vect\r
- 1438:00B4 idle _calculate\r
- 1438:0177 idle _count_const\r
- 1438:043C idle _rotate\r
- 1438:0556 idle _sort_faces\r
- 1438:079F idle _draw\r
- 1438:08C5 idle _swappage\r
- 14D7:0009 _main\r
- 14DA:0000 idle _dis_version\r
- 14DA:0023 idle _dis_waitb\r
- 14DA:0040 _dis_partstart\r
- 14DA:005A _dis_exit\r
- 14DA:0060 idle _dis_indemo\r
- 14DA:0066 idle _dis_msgarea\r
- 14DA:0073 idle _dis_muscode\r
- 14DA:0080 _dis_musplus\r
- 14DA:008F idle _dis_musrow\r
- 14DA:009B idle _dis_setcopper\r
- 14DA:00AE _dis_setmframe\r
- 14DA:00BE _dis_getmframe\r
- 14DA:00CA idle _dis_sync\r
- 14E7:1084 _getspl\r
- 160F:2152 e086_Entry\r
- 160F:26E0 e086_Shortcut\r
- 1887:0306 e087_Entry\r
- 1887:03C6 e087_Shortcut\r
- 1887:0430 e087_Trap\r
- 18E4:0000 _kuva1\r
- 1CE4:0000 _dist1\r
- 24E4:0000 _kuva2\r
- 28E4:0000 _kuva3\r
- 2CE4:0000 _sinit\r
- 2CE4:0200 _kosinit\r
- 2D85:0000 _vmem\r
- 2D85:0004 idle _buu\r
- 2DC4:0000 idle _fpal\r
- 2DF4:0000 idle DATASEG@\r
- 2DF4:005B idle __Int0Vector\r
- 2DF4:005F idle __Int4Vector\r
- 2DF4:0063 idle __Int5Vector\r
- 2DF4:0067 idle __Int6Vector\r
- 2DF4:006B idle __C0argc\r
- 2DF4:006D idle __C0argv\r
- 2DF4:0071 idle __C0environ\r
- 2DF4:0075 idle __envLng\r
- 2DF4:0077 idle __envseg\r
- 2DF4:0079 idle __envSize\r
- 2DF4:007B __psp\r
- 2DF4:007D idle __osversion\r
- 2DF4:007D idle __osmajor\r
- 2DF4:007D __version\r
- 2DF4:007E idle __osminor\r
- 2DF4:007F _errno\r
- 2DF4:0081 idle __StartTime\r
- 2DF4:0085 idle ___brklvl\r
- 2DF4:0087 __heapbase\r
- 2DF4:008B __brklvl\r
- 2DF4:008F __heaptop\r
- 2DF4:0094 idle _ptau\r
- 2DF4:0194 idle _curpal\r
- 2DF4:0196 idle _timetable\r
- 2DF4:01AA idle _ttptr\r
- 2DF4:01AC _l1\r
- 2DF4:01AE _l2\r
- 2DF4:01B0 _l3\r
- 2DF4:01B2 _l4\r
- 2DF4:01B4 _k1\r
- 2DF4:01B6 _k2\r
- 2DF4:01B8 _k3\r
- 2DF4:01BA _k4\r
- 2DF4:01BC _il1\r
- 2DF4:01BE _il2\r
- 2DF4:01C0 _il3\r
- 2DF4:01C2 _il4\r
- 2DF4:01C4 _ik1\r
- 2DF4:01C6 _ik2\r
- 2DF4:01C8 _ik3\r
- 2DF4:01CA _ik4\r
- 2DF4:01CC idle _inittable\r
- 2DF4:026C idle _clrptr\r
- 2DF4:026E idle _kuvataus\r
- 2DF4:0276 idle _disttaus\r
- 2DF4:02A2 idle _object\r
- 2DF4:2B0C idle _polys\r
- 2DF4:2B0E idle _light_src\r
- 2DF4:2B1A idle _lls\r
- 2DF4:2B26 _kx\r
- 2DF4:2B28 _ky\r
- 2DF4:2B2A _kz\r
- 2DF4:2B2C _dis\r
- 2DF4:2B2E _tx\r
- 2DF4:2B30 _ty\r
- 2DF4:2B32 _ls_kx\r
- 2DF4:2B34 _ls_ky\r
- 2DF4:2B36 _ls_kz\r
- 2DF4:2B38 idle _ls_x\r
- 2DF4:2B3A idle _ls_y\r
- 2DF4:2B3C idle _ls_z\r
- 2DF4:2B3E idle _page\r
- 2DF4:2B40 idle _frames\r
- 2DF4:2B50 __8087\r
- 2DF4:2B60 __protected\r
- 2DF4:2B61 __LDT\r
- 2DF4:2B64 __default87\r
- 2DF4:2B66 idle __huge_flt\r
- 2DF4:2B6A __huge_dble\r
- 2DF4:2B72 idle __huge_ldble\r
- 2DF4:2B7C idle __indefinite\r
- 2DF4:2B80 idle __tiny_ldble\r
- 2DF4:2B8A __mathwhy\r
- 2DF4:2D1A __atexitcnt\r
- 2DF4:2D1C __ctype\r
- 2DF4:2E1E __exitbuf\r
- 2DF4:2E22 idle __exitfopen\r
- 2DF4:2E26 idle __exitopen\r
- 2DF4:2E2A __streams\r
- 2DF4:2FBA __nfile\r
- 2DF4:2FBC __openfd\r
- 2DF4:2FE4 __fpstklen\r
- 2DF4:2FE6 idle __doserrno\r
- 2DF4:2FE8 idle __dosErrorToSV\r
- 2DF4:3042 __stklen\r
- 2DF4:30E6 __RealCvtVector\r
- 2DF4:30EA idle __ScanTodVector\r
- 2DF4:3108 idle _pals\r
- 2DF4:5508 idle _clrtau\r
- 2DF4:7508 _pal\r
- 2DF4:7808 idle _siny\r
- 2DF4:7888 idle _sinx\r
- 2DF4:7908 idle _sini\r
- 2DF4:88A8 idle _czz\r
- 2DF4:88AA idle _czy\r
- 2DF4:88AC idle _czx\r
- 2DF4:88AE idle _cyz\r
- 2DF4:88B0 idle _cyy\r
- 2DF4:88B2 idle _cyx\r
- 2DF4:88B4 idle _cxz\r
- 2DF4:88B6 idle _cxy\r
- 2DF4:88B8 idle _cxx\r
- 2DF4:88BA idle _ptodraw\r
- 2DF4:8CBA __atexittbl\r
- 2DF4:8D3A ___SignalPtr\r
- 36C8:0000 __emu\r
-\r
-Program entry point at 0000:0000\r
-\r
+#define far\r
+#define MK_FP(x,y) ((void *)x)\r
+#define FP_SEG(x) (x)\r
+\r
extern void tw_opengraph();\r
+extern void tw_opengraph2();\r
extern void tw_closegraph();\r
extern void tw_putpixel(int x, int y, int color);\r
extern int tw_getpixel(int x, int y);\r
extern void tw_pictovmem(void far *pic, int to, int len);\r
extern void tw_crlscr();\r
\r
-extern int far scr_seg;
\ No newline at end of file
+extern int far scr_seg;\r
#include <stdio.h>\r
-#include <conio.h>\r
-#include <dos.h>\r
+//#include <conio.h>\r
+//#include <dos.h>\r
#include <math.h>\r
-#include <io.h>\r
+//#include <io.h>\r
#include <fcntl.h>\r
#include "tweak.h"\r
+#include "../dis/dis.h"\r
\r
#define SX sinit[kx]\r
#define SY sinit[ky]\r
extern far char (* far vmem)[160];\r
extern char far pal[768];\r
\r
-extern clear();\r
-extern init();\r
-extern shadepal(char far *fpal, char far *ppal, int shade);\r
-extern init_copper();\r
-extern close_copper();\r
+extern void clear();\r
+//extern init();\r
+extern void shadepal(char far *fpal, char far *ppal, int shade);\r
+extern int init_copper();\r
+extern int close_copper();\r
extern int far cop_rotatev;\r
extern far int frame_count;\r
extern far char * far cop_pal;\r
int page=0;\r
int frames=0;\r
\r
-vect()\r
+void sort_faces(void);\r
+void draw(int);\r
+void swappage(void);\r
+void rotate(void);\r
+void count_const(void);\r
+void calculate(int);\r
+\r
+void vect()\r
{\r
- int c=0,a;\r
+ int /*c=0,*/a;\r
\r
tw_opengraph();\r
\r
- while(dis_musplus()<13 && !dis_exit()); frame_count=0;\r
+ //while(dis_musplus()<13 && !dis_exit());\r
+ frame_count=0;\r
while(!dis_exit())\r
{\r
a=dis_musplus();\r
// tw_closegraph();\r
}\r
\r
-calculate(int k)\r
+void calculate(int k)\r
{\r
- int a;\r
- static int px=0,py=256;\r
+ //int a;\r
+ //static int px=0,py=256;\r
\r
getspl(4*256+frames*4);\r
kx=kx&1023;\r
sort_faces();\r
}\r
\r
-count_const()\r
+void count_const()\r
{\r
//matrix equations:\r
//X Y Z -> nX\r
//12=Xcos*Zcos*Ysin 14=Xcos*Ysin*Zsin 16=Ycos*Xcos\r
// +Xsin*Zsin -Xsin*Zcos\r
\r
- cxx=(long)CY*(long)CZ>>15+7;\r
- cxy=(long)CY*(long)SZ>>15+7;\r
- cxz=-(long)SY>>7;\r
+ cxx=CY*CZ>>(15+7);\r
+ cxy=CY*SZ>>(15+7);\r
+ cxz=-SY>>7;\r
\r
- cyx=((long)SX*(long)CZ+16384L>>15)*(long)SY - (long)CX*(long)SZ>>15+7;\r
- cyy=((long)SX*(long)SY+16384L>>15)*(long)SZ + (long)CX*(long)CZ>>15+7;\r
- cyz=(long)CY*(long)SX>>15+7;\r
+ cyx=(((SX*CZ+16384L)>>15)*SY - CX*SZ)>>(15+7);\r
+ cyy=(((SX*SY+16384L)>>15)*SZ + CX*CZ)>>(15+7);\r
+ cyz=CY*SX>>(15+7);\r
\r
- czx=((long)CX*(long)CZ+16384L>>15)*(long)SY + (long)SX*(long)SZ>>15+7;\r
- czy=((long)CX*(long)SY+16384L>>15)*(long)SZ - (long)SX*(long)CZ>>15+7;\r
- czz=(long)CY*(long)CX>>15+7;\r
+ czx=(((CX*CZ+16384L)>>15)*SY + SX*SZ)>>(15+7);\r
+ czy=(((CX*SY+16384L)>>15)*SZ - SX*CZ)>>(15+7);\r
+ czz=CY*CX>>(15+7);\r
\r
}\r
\r
-rotate()\r
+void rotate()\r
{\r
- int a,b,x,y,z,xx,yy,zz;\r
+ int a,/*b,*/x,y,z,xx,yy,zz;\r
\r
for(a=0;a<object.pnts;a++)\r
{\r
x=object.point[a].x; y=object.point[a].y; z=object.point[a].z;\r
\r
- object.point[a].xx=xx=((x*cxx>>1) + (y*cxy>>1) + (z*cxz>>1)>>7)+tx;\r
- object.point[a].yy=yy=((x*cyx>>1) + (y*cyy>>1) + (z*cyz>>1)>>7)+ty;\r
- object.point[a].zz=zz=((x*czx>>1) + (y*czy>>1) + (z*czz>>1)>>7)+dis;\r
+ object.point[a].xx=xx=(((x*cxx>>1) + (y*cxy>>1) + (z*cxz>>1))>>7)+tx;\r
+ object.point[a].yy=yy=(((x*cyx>>1) + (y*cyy>>1) + (z*cyz>>1))>>7)+ty;\r
+ object.point[a].zz=zz=(((x*czx>>1) + (y*czy>>1) + (z*czz>>1))>>7)+dis;\r
\r
/*\r
1000,1000,1000\r
}\r
}\r
\r
-sort_faces()\r
+void sort_faces()\r
{\r
- int a=0,b,c,x,y,z,p=0;\r
- long ax,ay,az,bx,by,bz,kx,ky,kz,nx,ny,nz,s,l;\r
+ int a=0,/*b,*/c,x,y,z,p=0;\r
+ long ax,ay,az,bx,by,bz,/*kx,ky,kz,*/nx,ny,nz,s/*,l*/;\r
\r
while(a<object.faces)\r
{\r
}\r
\r
\r
-draw()\r
+void draw(int notused)\r
{\r
- int a=0,b,c,f,x,y,z;\r
- long ax,ay,az,bx,by,bz,kx,ky,kz,nx,ny,nz,s;\r
+ int a=0,/*b,*/c/*,f,x,y,z*/;\r
+ //long ax,ay,az,bx,by,bz,kx,ky,kz,nx,ny,nz,s;\r
\r
for(a=0;a<polys;a++)\r
{\r
}\r
}\r
\r
-swappage()\r
+void swappage()\r
{\r
page=(page+1)%6;\r
if(page==0){\r
--- /dev/null
+/*
+ * Written by Nick Kovac with minor changes by Claudio Matsuoka
+ */
+
+#include "common.h"
+
+static uint16_t selfmod[5][84];
+extern char *psini;
+
+#define PSINI_OFFSET 0
+#define LSINI4_OFFSET 16384
+#define LSINI16_OFFSET (16384 + 2 * 8192)
+
+
+int plzline(int y, int vseg)
+{
+ // vseg represented a segment, so multiply by sixteen (shift left by 4)
+ // to convert into an offset.
+ int nVgaYOffset = vseg << 4;
+
+ int cccTable[] = {
+ 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, 19, 18,
+ 17, 16, 23, 22, 21, 20, 27, 26, 25, 24, 31, 30, 29, 28, 35,
+ 34, 33, 32, 39, 38, 37, 36, 43, 42, 41, 40, 47, 46, 45, 44,
+ 51, 50, 49, 48, 55, 54, 53, 52, 59, 58, 57, 56, 63, 62, 61,
+ 60, 67, 66, 65, 64, 71, 70, 69, 68, 75, 74, 73, 72, 79, 78,
+ 77, 76, 83, 82, 81, 80
+ };
+ uint8_t ah = 0;
+ uint8_t al = 0;
+ uint32_t eax = 0;
+ int i;
+
+ for (i = 0; i < 84; i++) {
+ int ccc = cccTable[i];
+ uint16_t offs;
+ int bx;
+
+ if ((ccc & 1) == 1) {
+ // within lsini16
+ offs = (y * 2) + selfmod[2][ccc];
+ bx = *(short *)&psini[offs];
+
+ // within psini
+ offs = bx + selfmod[1][ccc];
+ ah = psini[offs];
+
+ // within lsini4
+ offs = (y * 2) + selfmod[4][ccc];
+ bx = *(short *)&psini[offs];
+
+ // within psini
+ offs = bx + (y * 2) + selfmod[3][ccc];
+ ah += psini[offs];
+ } else {
+ offs = (y * 2) + selfmod[2][ccc];
+ bx = *(short *)&psini[offs];
+
+ offs = bx + selfmod[1][ccc];
+ al = psini[offs];
+
+ offs = (y * 2) + selfmod[4][ccc];
+ bx = *(short *)&psini[offs];
+
+ offs = bx + (y * 2) + selfmod[3][ccc];
+ al += psini[offs];
+ }
+
+ if ((ccc & 3) == 2) {
+ eax = (ah << 8) | al;
+ eax <<= 16;
+ }
+
+ if ((ccc & 3) == 0) {
+ eax |= (ah << 8) | al;
+ vga_write32(nVgaYOffset + ccc, eax);
+ }
+ }
+
+ return 0;
+}
+
+int setplzparas(int c1, int c2, int c3, int c4)
+{
+ int ccc;
+
+ for (ccc = 0; ccc < 84; ccc++) {
+ uint16_t lc1, lc2, lc3, lc4;
+
+ lc1 = c1 + PSINI_OFFSET + (ccc * 8);
+ selfmod[1][ccc] = lc1;
+
+ lc2 = (c2 * 2) + LSINI16_OFFSET - (ccc * 8) + (80 * 8);
+ selfmod[2][ccc] = lc2;
+
+ lc3 = c3 + PSINI_OFFSET - (ccc * 4) + (80 * 4);
+ selfmod[3][ccc] = lc3;
+
+ lc4 = (c4 * 2) + LSINI4_OFFSET + (ccc * 32);
+ selfmod[4][ccc] = lc4;
+ }
+
+ return 0;
+}
+
+int set_plzstart(int y)
+{
+ vga_set_line_compare(y);
+
+ return 0;
+}
--- /dev/null
+
+#include <stdint.h>
+
+
+uint16_t psini_read16(int);
+uint8_t psini_read8(int);
+void psini_write16(int, uint16_t);
+void psini_write8(int, uint8_t);
+
+void vga_select_bitplanes_02(void);
+void vga_select_bitplanes_13(void);
+void vga_select_bitplanes_0123(void);
+void vga_write32(int, int);
+void vga_set_line_compare(int);
+void vga_set_palette_entry(int, int, int, int);
+void vga_show_framebuffer(void);
+void vga_set_hscroll_offset(int);
+void vga_upload_palette(uint8_t *);
+
+void initvect(void);
+
+int init_copper(void);
+int close_copper(void);
+void copper1(void);
+void copper2(void);
--- /dev/null
+/*
+ * Written by Nick Kovac with minor changes by Claudio Matsuoka
+ */
+
+#include "common.h"
+
+int frame_count = 0;
+int cop_drop = 0;
+uint8_t *cop_pal;
+int do_pal = 0;
+int cop_start = 0;
+int cop_scrl = 0;
+int cop_plz = 1;
+
+static int dtau[65];
+
+uint8_t fadepal[768 * 2];
+uint8_t *cop_fadepal;
+
+extern int l1, l2, l3, l4;
+extern int k1, k2, k3, k4;
+extern int il1, il2, il3, il4;
+extern int ik1, ik2, ik3, ik4;
+extern int ttptr;
+
+
+void pompota(void);
+void moveplz(void);
+void do_drop(void);
+void initpparas(void);
+
+
+int init_copper()
+{
+ int ccc;
+
+ for (ccc = 0; ccc < 65; ccc++) {
+ dtau[ccc] = ccc * ccc / 4 * 43 / 128 + 60;
+ }
+
+ return 0;
+}
+
+int close_copper()
+{
+ return 0;
+}
+
+// [nk] just before retrace
+void copper1()
+{
+ // There is also assembly code to set the first pixel of
+ // display memory here, but it may not be necessary.
+
+ vga_set_hscroll_offset(cop_scrl);
+}
+
+// [nk] in retrace
+void copper2()
+{
+ // [nk] Don't think this is used.
+ frame_count++;
+
+ if (do_pal != 0) {
+ do_pal = 0;
+ vga_upload_palette(cop_pal);
+ }
+
+ pompota();
+ moveplz();
+
+ if (cop_drop != 0)
+ {
+ do_drop();
+ }
+}
+
+void pompota()
+{
+
+ // [NK 18/1/2014] Disable this for now, as it looks a bit jittery.
+ return;
+
+#if 0
+ // [NK] This function toggles the horizontal split point every frame
+ // [NK] between line 60 and 61, and toggles the horizontal offset between 0 and 4.
+ // [NK] I think the original intention of this code was to give more variation
+ // [NK] cheaply, almost like a cheap alpha blend between two plasmas, but
+ // [NK] it seems to cause a lot of flicker in the port. Perhaps more precise timing is
+ // [NK] required to give the original effect? In any case I disabled this code
+ // [NK] temporarily.
+
+ vga_set_line_compare(60);
+ cop_scrl = 4;
+
+ pompi++;
+
+ if ((pompi & 1) != 0)
+ {
+ // [NK 12/1/2014] Moving the starting line up and down each alternate frame
+ // [NK 12/1/2014] doesn't look good in windowed mode.
+ // [NK 13/1/2014] Seems to work okay in fullscreen mode though.
+ vga_set_line_compare(61);
+ cop_scrl = 0;
+ }
+#endif
+}
+
+void moveplz()
+{
+ k1 += -3;
+ k1 &= 4095;
+ k2 += -2;
+ k2 &= 4095;
+ k3 += 1;
+ k3 &= 4095;
+ k4 += 2;
+ k4 &= 4095;
+
+ l1 += -1;
+ l1 &= 4095;
+ l2 += -2;
+ l2 &= 4095;
+ l3 += 2;
+ l3 &= 4095;
+ l4 += 3;
+ l4 &= 4095;
+}
+
+void do_drop()
+{
+ cop_drop++;
+
+ if (cop_drop <= 64) {
+ vga_set_line_compare(dtau[cop_drop]);
+ } else {
+ //@@over
+
+ int bShouldFade = 0;
+
+ if (cop_drop >= 256) {
+ } else if (cop_drop >= 128) {
+ bShouldFade = 1;
+ } else if (cop_drop > 96) {
+ } else /*if (cop_drop > 64) */{
+ bShouldFade = 1;
+ }
+
+ if (bShouldFade) {
+ cop_pal = fadepal;
+ do_pal = 1;
+
+ if (cop_drop == 65) {
+ vga_set_line_compare(400);
+ initpparas();
+ } else {
+ int i, ccc;
+
+ vga_set_line_compare(60);
+
+ // [NK 9/1/2014] Fade the palette using 8.8 fixed point numbers.
+
+ uint8_t* pcop_fadepal = cop_fadepal;
+ uint8_t* pfadepal = fadepal;
+
+ for (i = 0; i < (768 / 16); i++) {
+ for (ccc = 0; ccc < 16; ccc++) {
+ uint8_t al = pcop_fadepal[ccc*2];
+ uint8_t ah = pcop_fadepal[(ccc*2) + 1];
+
+ uint8_t oldval = pfadepal[ccc + 768];
+ pfadepal[ccc + 768] += al;
+ uint8_t newval = pfadepal[ccc + 768];
+ uint8_t carry = 0;
+ if (newval < oldval) {
+ carry = 1;
+ }
+
+ pfadepal[ccc] += ah + carry;
+ }
+
+ pcop_fadepal += 32;
+ pfadepal += 16;
+ }
+ }
+ } else {
+ cop_drop = 0;
+ }
+ }
+}
+
+void initpparas()
+{
+ l1 = il1;
+ l2 = il2;
+ l3 = il3;
+ l4 = il4;
+
+ k1 = ik1;
+ k2 = ik2;
+ k3 = ik3;
+ k4 = ik4;
+}
+
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GLES2/gl2.h>
+#include "u2gl.h"
+#include "opengl.h"
+
+static int view_width;
+static int view_height;
+
+static struct u2gl_program bg_program;
+
+float obj[9];
+
+float bg_obj[12] = {
+ 0.0f, 0.0f, 0.0f,
+ 320.0f, 0.0f, 0.0f,
+ 0.0f, 200.0f, 0.0f,
+ 320.0f, 200.0f, 0.0f
+};
+
+static const char vertex_shader_texture[] =
+"uniform mat4 pMatrix;\n"
+"uniform mat4 uMatrix;\n"
+"attribute vec4 aPosition;\n"
+"varying vec3 vPosition;\n"
+"attribute vec2 aTexPosition;\n"
+"varying vec2 vTexPosition;\n"
+"\n"
+"void main() {\n"
+" mat4 Matrix = pMatrix * uMatrix;\n"
+" vec4 position = Matrix * aPosition;\n"
+" gl_Position = position;\n"
+" vTexPosition = aTexPosition;\n"
+" vPosition = vec3(position);\n"
+"}\n";
+
+static const char fragment_shader_texture[] =
+"precision mediump float;\n"
+"uniform sampler2D uTexture;\n"
+"uniform vec4 uColor;\n"
+"varying vec3 vPosition;\n"
+"varying vec2 vTexPosition;\n"
+"\n"
+"void main() {\n"
+" gl_FragColor = texture2D(uTexture, vTexPosition);\n"
+"}\n";
+
+
+int uTime_location;
+int uPos_location;
+int uTexPos_location;
+int uRadius_location;
+int uLensTex_location;
+int uRotTex_location;
+
+static float tex_coords[] = {
+ 0.0f, 1.0f,
+ 1.0f, 1.0f,
+ 0.0f, 0.0f,
+ 1.0f, 0.0f
+};
+
+static float color[256][4];
+
+unsigned char *image;
+
+
+#define CC 32
+
+void setrgb(int c, int r, int g, int b)
+{
+ float alpha = 0.5f;
+
+ color[c][0] = (float)r / CC;
+ color[c][1] = (float)g / CC;
+ color[c][2] = (float)b / CC;
+ color[c][3] = alpha;
+}
+
+void getrgb(int c, char *p)
+{
+ p[0] = color[c][0] * CC;
+ p[1] = color[c][1] * CC;
+ p[2] = color[c][2] * CC;
+}
+
+void draw_bg()
+{
+ //glActiveTexture(GL_TEXTURE0);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 320, 400, GL_RGB,
+ GL_UNSIGNED_BYTE, image);
+ glUseProgram(bg_program.program);
+ u2gl_draw_textured_triangle_strip(&bg_program, bg_obj, 4);
+}
+
+static void init_texture()
+{
+ GLuint tex[3];
+
+ u2gl_set_tex_coords(tex_coords);
+
+ glGenTextures(1, tex);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, tex[0]);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ image = calloc(3, 320 * 400);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 320, 400, 0, GL_RGB,
+ GL_UNSIGNED_BYTE, image);
+ glGenerateMipmap(GL_TEXTURE_2D);
+ u2gl_check_error("init_texture 1");
+}
+
+
+int init_opengl()
+{
+ GLuint v, f;
+
+ view_width = 320;
+ view_height = 200;
+
+ v = u2gl_compile_vertex_shader(vertex_shader_texture);
+ f = u2gl_compile_fragment_shader(fragment_shader_texture);
+ u2gl_create_program(&bg_program, f, v);
+ u2gl_check_error("create program bg");
+
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+
+ //glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glClearColor(.0, .0, .0, 0);
+ u2gl_check_error("init_opengl");
+
+ init_texture();
+ u2gl_check_error("init_texture");
+
+ u2gl_projection(0, view_width, 0, view_height, &bg_program);
+
+ return 0;
+}
+
+void clear_screen()
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+}
--- /dev/null
+
+int init_opengl(void);
+void clear_screen(void);
+void draw_bg(void);
--- /dev/null
+
+
+int xx;
+int yy;
+int yy1;
+int xx1;
+int yy2;
+int xx2;
+int ay1;
+int ax1;
+int ay2;
+int ax2;
+int txx1;
+int txy1;
+int txx2;
+int txy2;
+int tax1;
+int tay1;
+int tax2;
+int tay2;
+int to = 0x0a0000000;
+int from;
+int dseg = 0;
+int ctau;
+
+void do_block(int ycnt)
+{
+}
+
+void shadepal(char *fpal, char *ppal, int shade)
+{
+}
+
+int ycnt = 0;
+
+void do_clear(char *vmem, int *otau, int *ntau)
+{
+}
--- /dev/null
+\r
+unsigned char sinit[] = {\r
+ 0,0,201,0,146,1,91,2,36,3,237,3,182,4,127,\r
+ 5,72,6,17,7,217,7,162,8,106,9,51,10,251,10,195,\r
+ 11,140,12,84,13,28,14,227,14,171,15,114,16,58,17,1,\r
+ 18,200,18,143,19,85,20,28,21,226,21,168,22,109,23,51,\r
+ 24,248,24,189,25,130,26,71,27,11,28,207,28,147,29,86,\r
+ 30,25,31,220,31,159,32,97,33,35,34,229,34,166,35,103,\r
+ 36,39,37,232,37,168,38,103,39,38,40,229,40,163,41,97,\r
+ 42,31,43,220,43,152,44,85,45,16,46,204,46,135,47,65,\r
+ 48,251,48,181,49,110,50,38,51,222,51,150,52,77,53,3,\r
+ 54,185,54,111,55,36,56,216,56,140,57,63,58,242,58,164,\r
+ 59,86,60,7,61,183,61,103,62,22,63,197,63,115,64,32,\r
+ 65,205,65,121,66,37,67,208,67,122,68,35,69,204,69,116,\r
+ 70,28,71,195,71,105,72,14,73,179,73,87,74,250,74,157,\r
+ 75,63,76,224,76,128,77,32,78,191,78,93,79,250,79,151,\r
+ 80,51,81,206,81,104,82,1,83,154,83,50,84,201,84,95,\r
+ 85,244,85,137,86,29,87,175,87,65,88,211,88,99,89,242,\r
+ 89,129,90,15,91,156,91,40,92,179,92,61,93,198,93,79,\r
+ 94,214,94,93,95,226,95,103,96,235,96,110,97,239,97,112,\r
+ 98,240,98,112,99,238,99,107,100,231,100,98,101,220,101,86,\r
+ 102,206,102,69,103,187,103,49,104,165,104,24,105,138,105,252,\r
+ 105,108,106,219,106,73,107,182,107,34,108,142,108,248,108,96,\r
+ 109,200,109,47,110,149,110,250,110,93,111,192,111,33,112,130,\r
+ 112,225,112,63,113,156,113,248,113,83,114,173,114,6,115,94,\r
+ 115,180,115,10,116,94,116,177,116,3,117,84,117,164,117,242,\r
+ 117,64,118,140,118,215,118,34,119,106,119,178,119,249,119,62,\r
+ 120,131,120,198,120,8,121,73,121,136,121,199,121,4,122,64,\r
+ 122,123,122,181,122,237,122,37,123,91,123,144,123,196,123,247,\r
+ 123,40,124,88,124,135,124,181,124,226,124,13,125,56,125,97,\r
+ 125,136,125,175,125,212,125,249,125,28,126,61,126,94,126,125,\r
+ 126,155,126,184,126,212,126,238,126,8,127,32,127,54,127,76,\r
+ 127,96,127,115,127,133,127,150,127,165,127,179,127,192,127,204,\r
+ 127,215,127,224,127,232,127,239,127,244,127,248,127,252,127,253,\r
+ 127,254,127,253,127,252,127,248,127,244,127,239,127,232,127,224,\r
+ 127,215,127,204,127,192,127,179,127,165,127,150,127,133,127,115,\r
+ 127,96,127,76,127,54,127,32,127,8,127,238,126,212,126,184,\r
+ 126,155,126,125,126,94,126,61,126,28,126,249,125,212,125,175,\r
+ 125,136,125,97,125,56,125,13,125,226,124,181,124,135,124,88,\r
+ 124,40,124,247,123,196,123,144,123,91,123,37,123,237,122,181,\r
+ 122,123,122,64,122,4,122,199,121,136,121,73,121,8,121,198,\r
+ 120,131,120,62,120,249,119,178,119,106,119,34,119,215,118,140,\r
+ 118,64,118,242,117,164,117,84,117,3,117,177,116,94,116,10,\r
+ 116,180,115,94,115,6,115,173,114,83,114,248,113,156,113,63,\r
+ 113,225,112,130,112,33,112,192,111,93,111,250,110,149,110,47,\r
+ 110,200,109,96,109,248,108,142,108,34,108,182,107,73,107,219,\r
+ 106,108,106,252,105,138,105,24,105,165,104,49,104,187,103,69,\r
+ 103,206,102,86,102,220,101,98,101,231,100,107,100,238,99,112,\r
+ 99,240,98,112,98,239,97,110,97,235,96,103,96,226,95,93,\r
+ 95,214,94,79,94,198,93,61,93,179,92,40,92,156,91,15,\r
+ 91,129,90,242,89,99,89,211,88,65,88,175,87,29,87,137,\r
+ 86,244,85,95,85,201,84,50,84,154,83,1,83,104,82,206,\r
+ 81,51,81,151,80,250,79,93,79,191,78,32,78,128,77,224,\r
+ 76,63,76,157,75,250,74,87,74,179,73,14,73,105,72,195,\r
+ 71,28,71,116,70,204,69,35,69,122,68,208,67,37,67,121,\r
+ 66,205,65,32,65,115,64,197,63,22,63,103,62,183,61,7,\r
+ 61,86,60,164,59,242,58,63,58,140,57,216,56,36,56,111,\r
+ 55,185,54,3,54,77,53,150,52,222,51,38,51,110,50,181,\r
+ 49,251,48,65,48,135,47,204,46,16,46,85,45,152,44,220,\r
+ 43,31,43,97,42,163,41,229,40,38,40,103,39,168,38,232,\r
+ 37,39,37,103,36,166,35,229,34,35,34,97,33,159,32,220,\r
+ 31,25,31,86,30,147,29,207,28,11,28,71,27,130,26,189,\r
+ 25,248,24,51,24,109,23,168,22,226,21,28,21,85,20,143,\r
+ 19,200,18,1,18,58,17,114,16,171,15,227,14,28,14,84,\r
+ 13,140,12,195,11,251,10,51,10,106,9,162,8,217,7,17,\r
+ 7,72,6,127,5,182,4,237,3,36,3,91,2,146,1,201,\r
+ 0,0,0,56,255,111,254,166,253,221,252,20,252,75,251,130,\r
+ 250,185,249,240,248,40,248,95,247,151,246,206,245,6,245,62,\r
+ 244,117,243,173,242,229,241,30,241,86,240,143,239,199,238,0,\r
+ 238,57,237,114,236,172,235,229,234,31,234,89,233,148,232,206,\r
+ 231,9,231,68,230,127,229,186,228,246,227,50,227,110,226,171,\r
+ 225,232,224,37,224,98,223,160,222,222,221,28,221,91,220,154,\r
+ 219,218,218,25,218,89,217,154,216,219,215,28,215,94,214,160,\r
+ 213,226,212,37,212,105,211,172,210,241,209,53,209,122,208,192,\r
+ 207,6,207,76,206,147,205,219,204,35,204,107,203,180,202,254,\r
+ 201,72,201,146,200,221,199,41,199,117,198,194,197,15,197,93,\r
+ 196,171,195,250,194,74,194,154,193,235,192,60,192,142,191,225,\r
+ 190,52,190,136,189,220,188,49,188,135,187,222,186,53,186,141,\r
+ 185,229,184,62,184,152,183,243,182,78,182,170,181,7,181,100,\r
+ 180,194,179,33,179,129,178,225,177,66,177,164,176,7,176,106,\r
+ 175,206,174,51,174,153,173,0,173,103,172,207,171,56,171,162,\r
+ 170,13,170,120,169,228,168,82,168,192,167,46,167,158,166,15,\r
+ 166,128,165,242,164,101,164,217,163,78,163,196,162,59,162,178,\r
+ 161,43,161,164,160,31,160,154,159,22,159,147,158,18,158,145,\r
+ 157,17,157,145,156,19,156,150,155,26,155,159,154,37,154,171,\r
+ 153,51,153,188,152,70,152,208,151,92,151,233,150,119,150,5,\r
+ 150,149,149,38,149,184,148,75,148,223,147,115,147,9,147,161,\r
+ 146,57,146,210,145,108,145,7,145,164,144,65,144,224,143,127,\r
+ 143,32,143,194,142,101,142,9,142,174,141,84,141,251,140,163,\r
+ 140,77,140,247,139,163,139,80,139,254,138,173,138,93,138,15,\r
+ 138,193,137,117,137,42,137,223,136,151,136,79,136,8,136,195,\r
+ 135,126,135,59,135,249,134,184,134,121,134,58,134,253,133,193,\r
+ 133,134,133,76,133,20,133,220,132,166,132,113,132,61,132,10,\r
+ 132,217,131,169,131,122,131,76,131,31,131,244,130,201,130,160,\r
+ 130,121,130,82,130,45,130,8,130,229,129,196,129,163,129,132,\r
+ 129,102,129,73,129,45,129,19,129,249,128,225,128,203,128,181,\r
+ 128,161,128,142,128,124,128,107,128,92,128,78,128,65,128,53,\r
+ 128,42,128,33,128,25,128,18,128,13,128,9,128,5,128,4,\r
+ 128,3,128,4,128,5,128,9,128,13,128,18,128,25,128,33,\r
+ 128,42,128,53,128,65,128,78,128,92,128,107,128,124,128,142,\r
+ 128,161,128,181,128,203,128,225,128,249,128,19,129,45,129,73,\r
+ 129,102,129,132,129,163,129,196,129,229,129,8,130,45,130,82,\r
+ 130,121,130,160,130,201,130,244,130,31,131,76,131,122,131,169,\r
+ 131,217,131,10,132,61,132,113,132,166,132,220,132,20,133,76,\r
+ 133,134,133,193,133,253,133,58,134,121,134,184,134,249,134,59,\r
+ 135,126,135,195,135,8,136,79,136,151,136,223,136,42,137,117,\r
+ 137,193,137,15,138,93,138,173,138,254,138,80,139,163,139,247,\r
+ 139,77,140,163,140,251,140,84,141,174,141,9,142,101,142,194,\r
+ 142,32,143,127,143,224,143,65,144,164,144,7,145,108,145,210,\r
+ 145,57,146,161,146,9,147,115,147,223,147,75,148,184,148,38,\r
+ 149,149,149,5,150,119,150,233,150,92,151,208,151,70,152,188,\r
+ 152,51,153,171,153,37,154,159,154,26,155,150,155,19,156,145,\r
+ 156,17,157,145,157,18,158,147,158,22,159,154,159,31,160,164,\r
+ 160,43,161,178,161,59,162,196,162,78,163,217,163,101,164,242,\r
+ 164,128,165,15,166,158,166,46,167,192,167,82,168,228,168,120,\r
+ 169,13,170,162,170,56,171,207,171,103,172,0,173,153,173,51,\r
+ 174,206,174,106,175,7,176,164,176,66,177,225,177,129,178,33,\r
+ 179,194,179,100,180,7,181,170,181,78,182,243,182,152,183,62,\r
+ 184,229,184,141,185,53,186,222,186,135,187,49,188,220,188,136,\r
+ 189,52,190,225,190,142,191,60,192,235,192,154,193,74,194,250,\r
+ 194,171,195,93,196,15,197,194,197,117,198,41,199,221,199,146,\r
+ 200,72,201,254,201,180,202,107,203,35,204,219,204,147,205,76,\r
+ 206,6,207,192,207,122,208,53,209,241,209,172,210,105,211,37,\r
+ 212,226,212,160,213,94,214,28,215,219,215,154,216,89,217,25,\r
+ 218,218,218,154,219,91,220,28,221,222,221,160,222,98,223,37,\r
+ 224,232,224,171,225,110,226,50,227,246,227,186,228,127,229,68,\r
+ 230,9,231,206,231,148,232,89,233,31,234,229,234,172,235,114,\r
+ 236,57,237,0,238,199,238,143,239,86,240,30,241,229,241,173,\r
+ 242,117,243,62,244,6,245,206,245,151,246,95,247,40,248,240,\r
+ 248,185,249,130,250,75,251,20,252,221,252,166,253,111,254,56,\r
+ 255,\r
+ 0,0,201,0,146,1,91,2,36,3,237,3,182,4,127,\r
+ 5,72,6,17,7,217,7,162,8,106,9,51,10,251,10,195,\r
+ 11,140,12,84,13,28,14,227,14,171,15,114,16,58,17,1,\r
+ 18,200,18,143,19,85,20,28,21,226,21,168,22,109,23,51,\r
+ 24,248,24,189,25,130,26,71,27,11,28,207,28,147,29,86,\r
+ 30,25,31,220,31,159,32,97,33,35,34,229,34,166,35,103,\r
+ 36,39,37,232,37,168,38,103,39,38,40,229,40,163,41,97,\r
+ 42,31,43,220,43,152,44,85,45,16,46,204,46,135,47,65,\r
+ 48,251,48,181,49,110,50,38,51,222,51,150,52,77,53,3,\r
+ 54,185,54,111,55,36,56,216,56,140,57,63,58,242,58,164,\r
+ 59,86,60,7,61,183,61,103,62,22,63,197,63,115,64,32,\r
+ 65,205,65,121,66,37,67,208,67,122,68,35,69,204,69,116,\r
+ 70,28,71,195,71,105,72,14,73,179,73,87,74,250,74,157,\r
+ 75,63,76,224,76,128,77,32,78,191,78,93,79,250,79,151,\r
+ 80,51,81,206,81,104,82,1,83,154,83,50,84,201,84,95,\r
+ 85,244,85,137,86,29,87,175,87,65,88,211,88,99,89,242,\r
+ 89,129,90,15,91,156,91,40,92,179,92,61,93,198,93,79,\r
+ 94,214,94,93,95,226,95,103,96,235,96,110,97,239,97,112,\r
+ 98,240,98,112,99,238,99,107,100,231,100,98,101,220,101,86,\r
+ 102,206,102,69,103,187,103,49,104,165,104,24,105,138,105,252,\r
+ 105,108,106,219,106,73,107,182,107,34,108,142,108,248,108,96,\r
+ 109,200,109,47,110,149,110,250,110,93,111,192,111,33,112,130,\r
+ 112,225,112,63,113,156,113,248,113,83,114,173,114,6,115,94,\r
+ 115,180,115,10,116,94,116,177,116,3,117,84,117,164,117,242,\r
+ 117,64,118,140,118,215,118,34,119,106,119,178,119,249,119,62,\r
+ 120,131,120,198,120,8,121,73,121,136,121,199,121,4,122,64,\r
+ 122,123,122,181,122,237,122,37,123,91,123,144,123,196,123,247,\r
+ 123,40,124,88,124,135,124,181,124,226,124,13,125,56,125,97,\r
+ 125,136,125,175,125,212,125,249,125,28,126,61,126,94,126,125,\r
+ 126,155,126,184,126,212,126,238,126,8,127,32,127,54,127,76,\r
+ 127,96,127,115,127,133,127,150,127,165,127,179,127,192,127,204,\r
+ 127,215,127,224,127,232,127,239,127,244,127,248,127,252,127,253,\r
+ 127,254,127,253,127,252,127,248,127,244,127,239,127,232,127,224\r
+};\r
+\r
+unsigned char *kosinit = sinit + 512;\r
--- /dev/null
+
+
+
+int getspl(int where)
+{
+ return 0;
+}
--- /dev/null
+#include "common.h"
+#include "tweak.h"
+
+void tw_opengraph()
+{
+}
+
+void tw_opengraph2()
+{
+}
+
+void tw_setrgbpalette(int pal, int r, int g, int b)
+{
+ vga_set_palette_entry(pal, r, g, b);
+}
--- /dev/null
+/*
+ * Written by Nick Kovac with minor changes by Claudio Matsuoka
+ */
+
+#include <string.h>
+#include "common.h"
+
+static int plane_select[4] = { 0, 0, 0, 0 };
+static int line_compare = 0;
+static int hscroll_offset = 0;
+static uint8_t palette[256 * 3];
+
+#define SCREEN_WIDTH 320
+#define SCREEN_HEIGHT 400
+#define FRAME_BUFFER_WIDTH 384
+#define FRAME_BUFFER_HEIGHT 400
+
+uint8_t fb[FRAME_BUFFER_WIDTH * FRAME_BUFFER_HEIGHT];
+
+
+void vga_select_bitplanes_02()
+{
+ plane_select[0] = 1;
+ plane_select[1] = 0;
+ plane_select[2] = 1;
+ plane_select[3] = 0;
+}
+
+void vga_select_bitplanes_13()
+{
+ plane_select[0] = 0;
+ plane_select[1] = 1;
+ plane_select[2] = 0;
+ plane_select[3] = 1;
+}
+
+void vga_select_bitplanes_0123()
+{
+ plane_select[0] = 1;
+ plane_select[1] = 1;
+ plane_select[2] = 1;
+ plane_select[3] = 1;
+}
+
+void vga_write32(int offset, int val)
+{
+ int i, j;
+
+ // For each selected plane, calculate 4 pixel offsets and write 4 bytes.
+ // offset = 0, 4, 8, etc
+
+ for (i = 0; i < 4; i++) {
+ if (plane_select[i]) {
+ for (j = 0; j < 4; j++) {
+ // Get byte to write.
+ uint8_t b = (val >> (j * 8));
+
+ // Calculate offset.
+ int fb_offs = i + (offset + j) * 4;
+
+ // Write pixel.
+ fb[fb_offs] = b;
+ }
+ }
+ }
+}
+
+void vga_set_line_compare(int y)
+{
+ line_compare = y;
+}
+
+void vga_set_palette_entry(int index, int r, int g, int b)
+{
+ index *= 3;
+ palette[index++] = r;
+ palette[index++] = g;
+ palette[index] = b;
+}
+
+extern unsigned char *image; // The OpenGL background image texture
+
+void vga_show_framebuffer()
+{
+ int x, y;
+
+ // Clear the screen.
+ memset(image, 0, FRAME_BUFFER_WIDTH * FRAME_BUFFER_HEIGHT * 3);
+
+ copper1();
+ copper2();
+
+ int nFirstLineIndex = (line_compare + 1);
+
+ // Plot the palettised frame buffer.
+ uint8_t *ptr = fb;
+
+ for (y = nFirstLineIndex; y < SCREEN_HEIGHT; y++) {
+ for (x = 0; x < SCREEN_WIDTH; x++) {
+ //ASSERT(x + hscroll_offset < FRAME_BUFFER_WIDTH);
+ uint8_t r, g, b;
+ int idx = ptr[x + hscroll_offset] * 3;
+
+ r = palette[idx++];
+ g = palette[idx++];
+ b = palette[idx];
+
+ int ofs = (y * 320 + x) * 3;
+ image[ofs++] = r << 2;
+ image[ofs++] = g << 2;
+ image[ofs] = b << 2;
+ }
+
+ ptr += FRAME_BUFFER_WIDTH;
+ }
+}
+
+void vga_set_hscroll_offset(int offset)
+{
+ hscroll_offset = offset;
+}
+
+void vga_upload_palette(uint8_t *pal)
+{
+ memcpy(palette, pal, 256 * 3);
+}
--- /dev/null
+
+PLZPART_OBJS = opengl.o main.o
+
+PLZPART_PATH = plzpart-gl
+
+PLZPART_PATH_OBJS = $(addprefix $(PLZPART_PATH)/,$(PLZPART_OBJS))
+
+PLZPART_BIN = plzpart
+
+OBJS += $(PLZPART_PATH_OBJS)
+
+default-plzpart:
+ $(MAKE) -C .. plzpart-all
+
+plzpart-all: $(PLZPART_PATH)/$(PLZPART_BIN)
+
+$(PLZPART_PATH)/$(PLZPART_BIN): $(PLZPART_PATH_OBJS)
+ $(LD) -o $@ $(LDFLAGS) $(PLZPART_PATH_OBJS) $(LIBS)
+
+plz.c: tweak.h ptau.pre
--- /dev/null
+
+#include <stdint.h>
+
+
+uint16_t psini_read16(int);
+uint8_t psini_read8(int);
+void psini_write16(int, uint16_t);
+void psini_write8(int, uint8_t);
+
+void vga_select_bitplanes_02(void);
+void vga_select_bitplanes_13(void);
+void vga_select_bitplanes_0123(void);
+void vga_write32(int, int);
+void vga_set_line_compare(int);
+void vga_set_palette_entry(int, int, int, int);
+void vga_show_framebuffer(void);
+void vga_set_hscroll_offset(int);
+void vga_upload_palette(uint8_t *);
+
+void initvect(void);
+
+int init_copper(void);
+int close_copper(void);
+void copper1(void);
+void copper2(void);
--- /dev/null
+#include <stdio.h>\r
+#include "../dis/dis.h"\r
+#include "graphics.h"\r
+#include "opengl.h"\r
+#include "common.h"\r
+\r
+extern void plz();\r
+extern void vect();\r
+\r
+int main(int argc, char **argv) {\r
+ dis_partstart();\r
+ float time = 0.0;\r
+\r
+ if (init_graphics("Plzpart", argc, argv) < 0) {\r
+ fprintf(stderr, "Can't init graphics\n");\r
+ return -1;\r
+ };\r
+\r
+ init_opengl();\r
+ //init_copper();\r
+ //initvect();\r
+\r
+ while(!dis_exit() && time < 32.32) {\r
+ draw_bg(time);\r
+ swap_buffers();\r
+ time += (float)adjust_framerate() / 60;\r
+ }\r
+\r
+ //vect();\r
+ //close_copper();\r
+ return 0;\r
+}\r
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GLES2/gl2.h>
+#include "u2gl.h"
+#include "opengl.h"
+
+static int view_width;
+static int view_height;
+
+static struct u2gl_program bg_program;
+
+float obj[9];
+
+float bg_obj[12] = {
+ 0.0f, 0.0f, 0.0f,
+ 320.0f, 0.0f, 0.0f,
+ 0.0f, 200.0f, 0.0f,
+ 320.0f, 200.0f, 0.0f
+};
+
+static const char vertex_shader_texture[] =
+"uniform mat4 pMatrix;\n"
+"uniform mat4 uMatrix;\n"
+"attribute vec4 aPosition;\n"
+"varying vec3 vPosition;\n"
+"attribute vec2 aTexPosition;\n"
+"varying vec2 vTexPosition;\n"
+"\n"
+"void main() {\n"
+" mat4 Matrix = pMatrix * uMatrix;\n"
+" vec4 position = Matrix * aPosition;\n"
+" gl_Position = position;\n"
+" vTexPosition = aTexPosition;\n"
+" vPosition = vec3(position);\n"
+"}\n";
+
+static char fragment_shader_texture[20000];
+
+int uRes_location;
+int uTime_location;
+
+static float tex_coords[] = {
+ 0.0f, 1.0f,
+ 1.0f, 1.0f,
+ 0.0f, 0.0f,
+ 1.0f, 0.0f
+};
+
+void draw_bg(float t)
+{
+ glUniform1f(uTime_location, t);
+
+ //glActiveTexture(GL_TEXTURE0);
+ //glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 320, 400, GL_RGB,
+ // GL_UNSIGNED_BYTE, image);
+ glUseProgram(bg_program.program);
+ u2gl_draw_textured_triangle_strip(&bg_program, bg_obj, 4);
+}
+
+#if 0
+static void init_texture()
+{
+ GLuint tex[3];
+
+ u2gl_set_tex_coords(tex_coords);
+
+ glGenTextures(1, tex);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, tex[0]);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ image = calloc(3, 320 * 400);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 320, 400, 0, GL_RGB,
+ GL_UNSIGNED_BYTE, image);
+ glGenerateMipmap(GL_TEXTURE_2D);
+ u2gl_check_error("init_texture 1");
+}
+#endif
+
+extern int window_width;
+extern int window_height;
+
+int init_opengl()
+{
+ GLuint v, f;
+ FILE *in;
+
+ view_width = 320;
+ view_height = 200;
+
+ in = fopen("plz.glsl", "r");
+ if (in != NULL) {
+ fread(fragment_shader_texture, 20000, 1, in);
+ fclose(in);
+ }
+
+ v = u2gl_compile_vertex_shader(vertex_shader_texture);
+ f = u2gl_compile_fragment_shader(fragment_shader_texture);
+ u2gl_create_program(&bg_program, f, v);
+ u2gl_check_error("create program bg");
+
+ uRes_location = glGetUniformLocation(bg_program.program, "iResolution");
+ uTime_location = glGetUniformLocation(bg_program.program, "iGlobalTime");
+ u2gl_check_error("get uniform locations");
+
+ glUniform3f(uRes_location, (float)window_width, (float)window_height, 0.0f);
+ u2gl_check_error("set resolution");
+
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+
+ //glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glClearColor(.0, .0, .0, 0);
+ u2gl_check_error("init_opengl");
+
+ //init_texture();
+ //u2gl_check_error("init_texture");
+
+ u2gl_projection(0, view_width, 0, view_height, &bg_program);
+
+ return 0;
+}
+
+void clear_screen()
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+}
--- /dev/null
+
+int init_opengl(void);
+void clear_screen(void);
+void draw_bg(float);
--- /dev/null
+precision mediump float;
+
+uniform vec3 iResolution; // viewport resolution (in pixels)
+uniform float iGlobalTime; // shader playback time (in seconds)
+
+#define PI 3.1415926535
+#define DPII (PI*2.0)
+
+int GetPerPlasmaTime(int t)
+{
+ // Get the time since this plasma started using the total time.
+ // Times for each plasma are (from the timetable array): 723, 1491,
+ // 1875, 2259, 2278. (64 is added to each time because it takes 64
+ // frames to drop the current plasma offscreen before switching to
+ // the new one.)
+
+ if (t < 723+64) {
+
+ } else if (t < 1491+64) {
+ t -= 723+64;
+ } else if (t < 1875+64) {
+ t -= 1491+64;
+ } else if (t < 2259+64) {
+ t -= 1875+64;
+ } else if (t < 2278+64) {
+ t -= 2259+64;
+ } else {
+ t = 0;
+ }
+
+ return t;
+}
+
+int GetPlasmaIndex(int t)
+{
+ int nPlasmaIndex = 0;
+
+ if (t < 723+64) {
+ nPlasmaIndex = 0;
+ } else if (t < 1491+64) {
+ nPlasmaIndex = 1;
+ } else if (t < 1875+64) {
+ nPlasmaIndex = 2;
+ }
+
+ return nPlasmaIndex;
+}
+
+int GetYOffset(int t)
+{
+ int nResult = 60;
+ bool bDrop = false;
+
+ if ( (t >= 723) && (t < (723+64)) ) {
+ t -= 723;
+ bDrop = true;
+ } else if ( (t >= 1491) && (t < (1491+64)) ) {
+ t -= 1491;
+ bDrop = true;
+ } else if ( (t >= 1875) && (t < (1875+64)) ) {
+ t -= 1875;
+ bDrop = true;
+ } else if ( (t >= 2259) && (t < (2259+64)) ) {
+ t -= 2259;
+ bDrop = true;
+ }
+
+ if (bDrop) {
+ nResult = t * t / 4 * 43 / 128 + 60;
+ }
+
+ return nResult;
+}
+
+float FadeColourComponent(float c, int t)
+{
+ float fResult = c;
+ float fProportion = 0.0;
+
+ if ((t >= 0) && (t < 128)) {
+ // For plasma 1, fade from white to the palette.
+ fProportion = float(t) / 127.0;
+ fResult = (fProportion * c) + ((1.0 - fProportion) * 1.0);
+ } else if ( (t >= (723+64)) && (t < (723+64+32)) ) {
+ // For plasma 2, fade from black to the palette.
+ fProportion = float(t-723-64) / 31.0;
+ fResult = (fProportion * c) + ((1.0 - fProportion) * 0.0);
+ } else if ( (t >= (1491+64)) && (t < (1491+64+32)) ) {
+ // For plasma 3, fade from black to the palette.
+ fProportion = float(t-1491-64) / 31.0;
+ fResult = (fProportion * c) + ((1.0 - fProportion) * 0.0);
+ }
+
+ return fResult;
+}
+
+int GetInitialL1(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 1000;
+ } else if (nPlasmaIndex == 1) {
+ return 1000;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 3500;
+ }
+}
+int GetInitialL2(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 2000;
+ } else if (nPlasmaIndex == 1) {
+ return 2000;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 1000;
+ }
+}
+
+int GetInitialL3(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 3000;
+ } else if (nPlasmaIndex == 1) {
+ return 4000;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 3000;
+ }
+}
+
+int GetInitialL4(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 4000;
+ } else if (nPlasmaIndex == 1) {
+ return 4000;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 1000;
+ }
+}
+
+int GetInitialK1(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 3500;
+ } else if (nPlasmaIndex == 1) {
+ return 1500;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 3500;
+ }
+}
+
+int GetInitialK2(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 2300;
+ } else if (nPlasmaIndex == 1) {
+ return 2300;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 3300;
+ }
+}
+
+int GetInitialK3(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 3900;
+ } else if (nPlasmaIndex == 1) {
+ return 3900;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 2900;
+ }
+}
+
+int GetInitialK4(int nPlasmaIndex)
+{
+ if (nPlasmaIndex == 0) {
+ return 3670;
+ } else if (nPlasmaIndex == 1) {
+ return 1670;
+ } else /* if (nPlasmaIndex == 2) */ {
+ return 2670;
+ }
+}
+
+int GetC1(int nXOffset0or1, int t)
+{
+ int nPlasmaIndex = GetPlasmaIndex(t);
+ t = GetPerPlasmaTime(t);
+
+ int nResult = 0;
+ if (nXOffset0or1 == 0) {
+ nResult = GetInitialK1(nPlasmaIndex) + (-3 * t);
+ } else {
+ nResult = GetInitialL1(nPlasmaIndex) + (-1 * t);
+ }
+
+ float fResult = float(nResult);
+ fResult = mod(fResult, 4096.0);
+
+ if (fResult < 0.0) {
+ fResult += 4096.0;
+ }
+
+ return int(fResult);
+}
+
+int GetC2(int nXOffset0or1, int t)
+{
+ int nPlasmaIndex = GetPlasmaIndex(t);
+ t = GetPerPlasmaTime(t);
+
+ int nResult = 0;
+ if (nXOffset0or1 == 0) {
+ nResult = GetInitialK2(nPlasmaIndex) + (-2 * t);
+ } else {
+ nResult = GetInitialL2(nPlasmaIndex) + (-2 * t);
+ }
+
+ float fResult = float(nResult);
+ fResult = mod(fResult, 4096.0);
+
+ if (fResult < 0.0) {
+ fResult += 4096.0;
+ }
+
+ return int(fResult);
+}
+
+int GetC3(int nXOffset0or1, int t)
+{
+ int nPlasmaIndex = GetPlasmaIndex(t);
+ t = GetPerPlasmaTime(t);
+
+ int nResult = 0;
+ if (nXOffset0or1 == 0) {
+ nResult = GetInitialK3(nPlasmaIndex) + (1 * t);
+ } else {
+ nResult = GetInitialL3(nPlasmaIndex) + (2 * t);
+ }
+
+ float fResult = float(nResult);
+ fResult = mod(fResult, 4096.0);
+
+ if (fResult < 0.0) {
+ fResult += 4096.0;
+ }
+
+ return int(fResult);
+}
+
+int GetC4(int nXOffset0or1, int t)
+{
+ int nPlasmaIndex = GetPlasmaIndex(t);
+ t = GetPerPlasmaTime(t);
+
+ int nResult = 0;
+ if (nXOffset0or1 == 0) {
+ nResult = GetInitialK4(nPlasmaIndex) + (2 * t);
+ } else {
+ nResult = GetInitialL4(nPlasmaIndex) + (3 * t);
+ }
+
+ float fResult = float(nResult);
+ fResult = mod(fResult, 4096.0);
+
+ if (fResult < 0.0) {
+ fResult += 4096.0;
+ }
+
+ return int(fResult);
+}
+
+float Palette0_GetRed(float nIndex)
+{
+ float a = 0.0;
+
+ if ((nIndex >= 0.0) && (nIndex < 64.0)) {
+ a = nIndex;
+ } else if ((nIndex >= 64.0) && (nIndex < 128.0)) {
+ a = 63.0 - (nIndex - 64.0);
+ } else if ((nIndex >= 128.0) && (nIndex < 192.0)) {
+ a = 0.0;
+ } else {
+ a = nIndex - 192.0;
+ }
+
+ return (cos(a*DPII/128.0+PI)*31.0+32.0) / 63.0;
+}
+
+float Palette0_GetGreen(float nIndex)
+{
+ return 0.0;
+}
+
+float Palette0_GetBlue(float nIndex)
+{
+ float a = 0.0;
+
+ if ((nIndex >= 0.0) && (nIndex < 128.0)) {
+ a = 0.0;
+ } else if ((nIndex >= 128.0) && (nIndex < 192.0)) {
+ a = nIndex - 128.0;
+ } else {
+ a = 63.0 - (nIndex - 192.0);
+ }
+
+ return (cos(a*DPII/128.0+PI)*31.0+32.0) / 63.0;
+}
+
+float Palette1_GetGreen(float nIndex)
+{
+ float a = 0.0;
+
+ if ((nIndex >= 0.0) && (nIndex < 128.0)) {
+ a = 0.0;
+ } else if ((nIndex >= 128.0) && (nIndex < 192.0)) {
+ a = nIndex - 128.0;
+ } else {
+ a = 63.0;
+ }
+
+ return (cos(a*DPII/128.0+PI)*31.0+32.0) / 63.0;
+}
+
+float Palette1_GetBlue(float nIndex)
+{
+ float a = 0.0;
+
+ if ((nIndex >= 0.0) && (nIndex < 64.0)) {
+ a = 0.0;
+ } else if ((nIndex >= 64.0) && (nIndex < 128.0)) {
+ a = nIndex - 64.0;
+ } else if ((nIndex >= 128.0) && (nIndex < 192.0)) {
+ a = 63.0 - (nIndex - 128.0);
+ } else {
+ a = nIndex - 192.0;
+ }
+
+ return (cos(a*DPII/128.0+PI)*31.0+32.0) / 63.0;
+}
+
+float Palette2_GetRed(float nIndex)
+{
+ float a = 0.0;
+
+ if ((nIndex >= 0.0) && (nIndex < 64.0)) {
+ a = 0.0;
+ } else if ((nIndex >= 64.0) && (nIndex < 128.0)) {
+ a = nIndex - 64.0;
+ } else if ((nIndex >= 128.0) && (nIndex < 192.0)) {
+ a = 63.0 - (nIndex - 128.0);
+ } else {
+ a = 0.0;
+ }
+
+ return (cos(a*DPII/128.0+PI)*31.0+32.0) / 63.0 / 2.0;
+}
+
+float Palette_GetRed(float nIndex, int t)
+{
+ int nPlasmaIndex = GetPlasmaIndex(t);
+ t = GetPerPlasmaTime(t);
+ float fResult = 0.0;
+
+ if (nPlasmaIndex == 0) {
+ fResult = Palette0_GetRed(nIndex);
+ } else if (nPlasmaIndex == 1) {
+ fResult = Palette0_GetRed(nIndex);
+ } else if (nPlasmaIndex == 2) {
+ fResult = Palette2_GetRed(nIndex);
+ }
+
+ return fResult;
+}
+
+float Palette_GetGreen(float nIndex, int t)
+{
+ int nPlasmaIndex = GetPlasmaIndex(t);
+ t = GetPerPlasmaTime(t);
+ float fResult = 0.0;
+
+ if (nPlasmaIndex == 0) {
+ fResult = Palette0_GetGreen(nIndex);
+ } else if (nPlasmaIndex == 1) {
+ fResult = Palette1_GetGreen(nIndex);
+ } else if (nPlasmaIndex == 2) {
+ fResult = Palette2_GetRed(nIndex);
+ }
+
+ return fResult;
+}
+
+float Palette_GetBlue(float nIndex, int t)
+{
+ int nPlasmaIndex = GetPlasmaIndex(t);
+ t = GetPerPlasmaTime(t);
+ float fResult = 0.0;
+
+ if (nPlasmaIndex == 0) {
+ fResult = Palette0_GetBlue(nIndex);
+ } else if (nPlasmaIndex == 1) {
+ fResult = Palette1_GetBlue(nIndex);
+ } else if (nPlasmaIndex == 2) {
+ fResult = Palette2_GetRed(nIndex);
+ }
+
+ return fResult;
+}
+
+void main(void)
+{
+ // t is an integer frame count.
+ int t = int(iGlobalTime * 60.0);
+
+ // Wrap t when it exceeds 2323, so that the plasmas will repeat.
+ float fT = float(t);
+ t = int(mod(fT, 1939.0));
+
+ // fPlasmaX is a float from 0 to 319,
+ // fPlasmaY is a float from 0 to 399.
+ float fPlasmaX = (gl_FragCoord.x / iResolution.x) * 319.0;
+ float fPlasmaY = (gl_FragCoord.y / iResolution.y) * 399.0;
+ fPlasmaY = 399.0 - fPlasmaY;
+
+ fPlasmaY -= float(GetYOffset(t));
+ /* fPlasmaX += float(GetXOffset(t)); */
+
+ float fRed = 0.0;
+ float fGreen = 0.0;
+ float fBlue = 0.0;
+
+ if ( (fPlasmaY >= 0.0) && (fPlasmaY < 280.0) ) {
+ float fScreenX = gl_FragCoord.x;
+ float fScreenY = gl_FragCoord.y;
+ float ah = 0.0;
+ float ccc = fPlasmaX / 4.0;
+ float fOffset = 0.0;
+ float bx = 0.0;
+
+ int nXOffset0or1 = int(mod(fScreenX, 2.0));
+
+ // On every odd row, toggle the x offset. This causes different
+ // plasma constants to be read for these pixels, achieving a
+ // chequered overlay of two plasmas.
+
+ int xor = int(mod(fScreenY, 2.0));
+ if (xor == 1) {
+ if (nXOffset0or1 == 0) {
+ nXOffset0or1 = 1;
+ } else {
+ nXOffset0or1 = 0;
+ }
+ }
+
+ float c1 = float(GetC1(nXOffset0or1, t));
+ float c2 = float(GetC2(nXOffset0or1, t));
+ float c3 = float(GetC3(nXOffset0or1, t));
+ float c4 = float(GetC4(nXOffset0or1, t));
+
+ fOffset = ((fPlasmaY * 2.0) + (c2 * 2.0) - (ccc * 8.0) + (80.0 * 8.0)) / 2.0;
+ bx = ((sin(fOffset*DPII/4096.0)*55.0+sin(fOffset*DPII/4096.0*4.0)*5.0+sin(fOffset*DPII/4096.0*17.0)*3.0+64.0)*16.0);
+
+ fOffset = bx + c1 + (ccc * 8.0);
+ ah = (sin(fOffset*DPII/4096.0)*55.0+sin(fOffset*DPII/4096.0*6.0)*5.0+sin(fOffset*DPII/4096.0*21.0)*4.0+64.0);
+
+ fOffset = ((fPlasmaY * 2.0) + (c4 * 2.0) + (ccc * 32.0)) / 2.0;
+ bx = ((sin(fOffset*DPII/4096.0)*55.0+sin(fOffset*DPII/4096.0*5.0)*8.0+sin(fOffset*DPII/4096.0*15.0)*2.0+64.0)*8.0);
+
+ fOffset = bx + (fPlasmaY * 2.0) + c3 - (ccc * 4.0) + (80.0 * 4.0);
+ ah += (sin(fOffset*DPII/4096.0)*55.0+sin(fOffset*DPII/4096.0*6.0)*5.0+sin(fOffset*DPII/4096.0*21.0)*4.0+64.0);
+
+ fRed = Palette_GetRed(ah, t);
+ fGreen = Palette_GetGreen(ah, t);
+ fBlue = Palette_GetBlue(ah, t);
+ }
+
+ fRed = FadeColourComponent(fRed, t);
+ fGreen = FadeColourComponent(fGreen, t);
+ fBlue = FadeColourComponent(fBlue, t);
+
+ gl_FragColor = vec4(fRed, fGreen, fBlue, 1.0);
+}
+
--- /dev/null
+#include "..\dis\dis.h"\r
+\r
+extern plz();\r
+extern vect();\r
+\r
+main() {\r
+ dis_partstart();\r
+ init_copper();\r
+ initvect();\r
+ plz();\r
+ vect();\r
+ close_copper();\r
+ }
\ No newline at end of file
--- /dev/null
+#include <stdio.h>\r
+#include <math.h>\r
+#include <conio.h>\r
+#include <dos.h>\r
+#include "tweak.h"\r
+\r
+//#define DO_TABLES\r
+//#define DPII (3.1415926535*2.0)\r
+\r
+#define LINELEN 41\r
+#define MAXY 280\r
+#define YADD 0\r
+#define XADD 0\r
+#define SINMASK 4095\r
+#define PLZSINI(p1,p2,p3,p4) *ptr++ = (psini[x*32+lsini[y*2+p2]*16+p1] + psini[y*4+lsini[x*64+p4]*4+p3]) + (psini[x*32+16+lsini[y*2+p2]*16+p1] + psini[y*4+lsini[x*64+32+p4]*4+p3])*256;\r
+\r
+extern int init_copper();\r
+extern int close_copper();\r
+extern int far frame_count;\r
+extern int far cop_drop;\r
+extern int far cop_plz;\r
+extern int far cop_start;\r
+extern char far * far cop_fadepal;\r
+extern char far fadepal[768];\r
+extern far char * far cop_pal;\r
+extern far int do_pal;\r
+\r
+extern int plzline(int y, int vseg);\r
+extern int setplzparas(int c1, int c2, int c3, int c4);\r
+extern int set_plzstart(int y);\r
+extern char far psini[16384];\r
+extern int far lsini4[8192];\r
+extern int far lsini16[8192];\r
+\r
+//int (* vmem)[LINELEN]=MK_FP(0x0a000,0);\r
+//char psini[16384]=\r
+//#include "psini.pre"\r
+//char lsini[16384]=\r
+//#include "lsini.pre"\r
+\r
+char ptau[256]=\r
+#include "ptau.pre"\r
+\r
+int pals[6][768];\r
+int curpal=0;\r
+int timetable[10]={64*6*2-45,64*6*4-45,64*6*5-45,64*6*6-45,64*6*7+90,0};\r
+int ttptr=0;\r
+\r
+int l1=1000, l2=2000, l3=3000, l4=4000;\r
+int k1=3500, k2=2300, k3=3900, k4=3670;\r
+\r
+int il1=1000, il2=2000, il3=3000, il4=4000;\r
+int ik1=3500, ik2=2300, ik3=3900, ik4=3670;\r
+\r
+int inittable[10][8]={{1000,2000,3000,4000,3500,2300,3900,3670},\r
+ {1000,2000,4000,4000,1500,2300,3900,1670},\r
+ {3500,1000,3000,1000,3500,3300,2900,2670},\r
+ {1000,2000,3000,4000,3500,2300,3900,3670},\r
+ {1000,2000,3000,4000,3500,2300,3900,3670},\r
+ {1000,2000,3000,4000,3500,2300,3900,3670}};\r
+\r
+plz(){\r
+ register int x,y;\r
+ int *ptr;\r
+ long tim=0,count=0;\r
+ int ch=0,sync=2;\r
+\r
+ while(dis_musplus()<0 && !dis_exit());\r
+ dis_setmframe(0);\r
+\r
+ init_plz();\r
+ cop_drop=128;\r
+ cop_fadepal=pals[curpal++];\r
+\r
+ frame_count=0;\r
+ while(!dis_exit())\r
+ {\r
+ tim+=frame_count; frame_count=0; count++;\r
+ if(dis_getmframe()>timetable[ttptr])\r
+ {\r
+ memset(fadepal,0,768);\r
+ cop_drop=1;\r
+ cop_fadepal=pals[curpal++];\r
+ ttptr++;\r
+ il1=inittable[ttptr][0];\r
+ il2=inittable[ttptr][1];\r
+ il3=inittable[ttptr][2];\r
+ il4=inittable[ttptr][3];\r
+ ik1=inittable[ttptr][4];\r
+ ik2=inittable[ttptr][5];\r
+ ik3=inittable[ttptr][6];\r
+ ik4=inittable[ttptr][7];\r
+ }\r
+ if(curpal==5 && cop_drop>64) break;\r
+\r
+ asm mov dx, 3c4h\r
+ asm mov ax, 0a02h\r
+ asm out dx, ax\r
+\r
+ setplzparas(k1,k2,k3,k4);\r
+ for(y=0;y<MAXY;y+=2)\r
+ plzline(y,0x0a000+y*6+YADD*6);\r
+ setplzparas(l1,l2,l3,l4);\r
+ for(y=1;y<MAXY;y+=2)\r
+ plzline(y,0x0a000+y*6+YADD*6);\r
+\r
+\r
+ asm mov dx, 3c4h\r
+ asm mov ax, 0502h\r
+ asm out dx, ax\r
+\r
+ setplzparas(k1,k2,k3,k4);\r
+ for(y=1;y<MAXY;y+=2)\r
+ plzline(y,0x0a000+y*6+YADD*6);\r
+ setplzparas(l1,l2,l3,l4);\r
+ for(y=0;y<MAXY;y+=2)\r
+ plzline(y,0x0a000+y*6+YADD*6);\r
+ }\r
+ cop_drop=0; frame_count=0; while(frame_count==0);\r
+ set_plzstart(500);\r
+ cop_plz=0;\r
+ }\r
+\r
+init_plz()\r
+ {\r
+ int a,b,c,z;\r
+ int *pptr=pals;\r
+\r
+#ifdef DO_TABLES\r
+ {\r
+ FILE *f1,*f2,*f3,*f4;\r
+ f1=fopen("lsini4.inc","wb");\r
+ f2=fopen("lsini16.inc","wb");\r
+ f3=fopen("psini.inc","wb");\r
+ f4=fopen("ptau.inc","wb");\r
+\r
+ for(a=0;a<1024*16;a++)\r
+ {\r
+ if(a<1024*8)\r
+ {\r
+ lsini4[a]=(sin(a*DPII/4096)*55+sin(a*DPII/4096*5)*8+sin(a*DPII/4096*15)*2+64)*8;\r
+ lsini16[a]=(sin(a*DPII/4096)*55+sin(a*DPII/4096*4)*5+sin(a*DPII/4096*17)*3+64)*16;\r
+ }\r
+ psini[a]=sin(a*DPII/4096)*55+sin(a*DPII/4096*6)*5+sin(a*DPII/4096*21)*4+64;\r
+ if((a&15)==0)\r
+ {\r
+ if(a<1024*8)\r
+ {\r
+ fprintf(f1,"\ndw %4d",lsini4[a]);\r
+ fprintf(f2,"\ndw %4d",lsini16[a]);\r
+ }\r
+ fprintf(f3,"\ndb %4d",psini[a]);\r
+ }\r
+ else {\r
+ if(a<1024*8)\r
+ {\r
+ fprintf(f1,",%4d",lsini4[a]);\r
+ fprintf(f2,",%4d",lsini16[a]);\r
+ }\r
+ fprintf(f3,",%4d",psini[a]);\r
+ }\r
+ }\r
+\r
+ fprintf(f4,"{\n%d",ptau[0]=0);\r
+ for(a=1;a<=128;a++)\r
+ {\r
+ fprintf(f4,",%3d",ptau[a]=cos(a*DPII/128+3.1415926535)*31+32);\r
+ if(!(a&15)) fputc('\n',f4);\r
+ }\r
+ fputc('}',f4); fputc(';',f4);\r
+\r
+ fclose(f1); fclose(f2); fclose(f3); fclose(f4);\r
+ }\r
+#endif\r
+ tw_opengraph2();\r
+ cop_start=96*(682-400);\r
+ set_plzstart(60);\r
+ init_copper();\r
+ for(a=0;a<256;a++) tw_setrgbpalette(a,63,63,63);\r
+\r
+// RGB\r
+ pptr=&pals[0][3];\r
+ for(a=1;a<64;a++) *pptr++=ptau[a ],*pptr++=ptau[0 ],*pptr++=ptau[0 ];\r
+ for(a=0;a<64;a++) *pptr++=ptau[63-a],*pptr++=ptau[0 ],*pptr++=ptau[0 ];\r
+ for(a=0;a<64;a++) *pptr++=ptau[0 ],*pptr++=ptau[0 ],*pptr++=ptau[a];\r
+ for(a=0;a<64;a++) *pptr++=ptau[a ],*pptr++=ptau[0 ],*pptr++=ptau[63-a];\r
+\r
+// RB-black\r
+ pptr=&pals[1][3];\r
+ for(a=1;a<64;a++) *pptr++=ptau[a ],*pptr++=ptau[0 ],*pptr++=ptau[0 ];\r
+ for(a=0;a<64;a++) *pptr++=ptau[63-a],*pptr++=ptau[0 ],*pptr++=ptau[a ];\r
+ for(a=0;a<64;a++) *pptr++=ptau[0 ],*pptr++=ptau[a ],*pptr++=ptau[63-a];\r
+ for(a=0;a<64;a++) *pptr++=ptau[a ],*pptr++=ptau[63 ],*pptr++=ptau[a ];\r
+\r
+// RB-white\r
+ pptr=&pals[3][3];\r
+ for(a=1;a<64;a++) *pptr++=ptau[a ],*pptr++=ptau[0 ],*pptr++=ptau[0 ];\r
+ for(a=0;a<64;a++) *pptr++=ptau[63 ],*pptr++=ptau[a ],*pptr++=ptau[a ];\r
+ for(a=0;a<64;a++) *pptr++=ptau[63-a],*pptr++=ptau[63-a],*pptr++=ptau[63 ];\r
+ for(a=0;a<64;a++) *pptr++=ptau[0 ],*pptr++=ptau[0 ],*pptr++=ptau[63 ];\r
+\r
+// white\r
+ pptr=&pals[2][3];\r
+ for(a=1;a<64;a++) *pptr++=ptau[0 ]/2,*pptr++=ptau[0 ]/2,*pptr++=ptau[0 ]/2;\r
+ for(a=0;a<64;a++) *pptr++=ptau[a ]/2,*pptr++=ptau[a ]/2,*pptr++=ptau[a ]/2;\r
+ for(a=0;a<64;a++) *pptr++=ptau[63-a]/2,*pptr++=ptau[63-a]/2,*pptr++=ptau[63-a]/2;\r
+ for(a=0;a<64;a++) *pptr++=ptau[0 ]/2,*pptr++=ptau[0 ]/2,*pptr++=ptau[0 ]/2;\r
+\r
+// white II\r
+ pptr=&pals[4][3];\r
+ for(a=1;a<75;a++) *pptr++=ptau[63-a*64/75],*pptr++=ptau[63-a*64/75],*pptr++=ptau[63-a*64/75];\r
+ for(a=0;a<106;a++)*pptr++=0,*pptr++=0,*pptr++=0;\r
+ for(a=0;a<75;a++) *pptr++=ptau[a*64/75]*8/10,*pptr++=ptau[a*64/75]*9/10,*pptr++=ptau[a*64/75];\r
+\r
+ pptr=pals;\r
+ for(a=0;a<768;a++,pptr++) *pptr=(*pptr-63)*2;\r
+ for(a=768;a<768*5;a++,pptr++) *pptr*=8;\r
+ }\r
+\r
--- /dev/null
+#include <stdio.h>\r
+#include <conio.h>\r
+#include <dos.h>\r
+#include <math.h>\r
+#include "tweak.h"\r
+\r
+extern far do_line(char far *to, int dx, int dy, int cnt, char far *from, long txx1, long txy1, long txx2, long txy2, int dseg);\r
+extern far do_block(int ycnt);\r
+extern far do_clear(char far *vmem, int far *otau, int far *ntau);\r
+\r
+extern int acstau[256];\r
+int sini[2000];\r
+char (* far vmem)[160]=MK_FP(0x0a000,0);\r
+extern char far kuva1[128][256];\r
+extern char far kuva2[128][256];\r
+extern char far kuva3[128][256];\r
+extern char far dist1[128][256];\r
+char far buu[1000];\r
+char sinx[128], siny[128];\r
+char pal[768];\r
+\r
+int clrtau[8][256][2];\r
+int clrptr=0;\r
+\r
+initvect() {\r
+ int a,b,x,y,s,d=0,p=0,ch;\r
+\r
+ for(a=0;a<1524;a++)\r
+ {\r
+ sini[a]=s=sin(a/1024.0*M_PI*4)*127;\r
+ s-=sini[a];\r
+ }\r
+\r
+/* for(a=0;a<65;a++) for(b=0;b<256;b++) // chessboard\r
+ { x=1; if((a>>4)&1) x^=3; if((b>>5)&1) x^=3; kuva[a][b]=x; }\r
+\r
+ pal[0*192+3*1]=pal[0*192+3*1+1]=pal[0*192+3*1+2]=40;\r
+ pal[0*192+3*2]=pal[0*192+3*2+1]=pal[0*192+3*2+2]=60;\r
+*/\r
+ for(a=1;a<32;a++) // must-sini-valk\r
+ { pal[0*192+a*3]=0; pal[0*192+a*3+1]=0; pal[0*192+a*3+2]=a*2; }\r
+ for(a=0;a<32;a++)\r
+ { pal[0*192+a*3+32*3]=a*2; pal[0*192+a*3+1+32*3]=a*2; pal[0*192+a*3+2+32*3]=63; }\r
+\r
+ for(a=0;a<32;a++) // must-pun-kelt\r
+ { pal[1*192+a*3]=a*2; pal[1*192+a*3+1]=0; pal[1*192+a*3+2]=0; }\r
+ for(a=0;a<32;a++)\r
+ { pal[1*192+a*3+32*3]=63; pal[1*192+a*3+1+32*3]=a*2; pal[1*192+a*3+2+32*3]=0; }\r
+\r
+\r
+ for(a=0;a<32;a++) // must-orans-viol\r
+ { pal[2*192+a*3]=a; pal[2*192+a*3+1]=0; pal[2*192+a*3+2]=a*2/3; }\r
+ for(a=0;a<32;a++)\r
+ { pal[2*192+a*3+32*3]=31-a; pal[2*192+a*3+1+32*3]=a*2; pal[2*192+a*3+2+32*3]=21; }\r
+\r
+\r
+ for(y=0;y<64;y++) for(x=0;x<256;x++)\r
+ {\r
+ kuva1[y][x]=sini[(y*4+sini[x*2])&511]/4+32;\r
+ kuva2[y][x]=sini[(y*4+sini[x*2])&511]/4+32+64;\r
+ kuva3[y][x]=sini[(y*4+sini[x*2])&511]/4+32+128;\r
+ }\r
+\r
+ for(y=0;y<128;y++) for(x=0;x<256;x++)\r
+ dist1[y][x]=sini[y*8]/3;\r
+\r
+ for(a=0;a<8*256;a++) { clrtau[0][a][0]=640; clrtau[0][a][1]=0; }\r
+ }\r
+\r
+extern far char * to;\r
+extern far char * from;\r
+extern far int * ctau;\r
+extern far int dseg;\r
+extern far int xx, yy;\r
+extern far long ay1,ay2,ax1,ax2,xx1,yy1,xx2,yy2;\r
+extern far long txx1,txy1,tay1,tax1;\r
+extern far long txx2,txy2,tay2,tax2;\r
+\r
+int kuvataus[]={FP_SEG(kuva1),FP_SEG(kuva2),FP_SEG(kuva3),FP_SEG(kuva1)};\r
+int disttaus[]={FP_SEG(dist1),FP_SEG(dist1),FP_SEG(dist1),FP_SEG(dist1)};\r
+\r
+do_poly(x1,y1,x2,y2,x3,y3,x4,y4,color, dd)\r
+int x1,y1,x2,y2,x3,y3,x4,y4,color, dd;\r
+ {\r
+ int a,b,c,d,n=0,m,s1,s2,d1,d2,dx1,dy1,dx2,dy2;\r
+\r
+ struct points {\r
+ int x,y; } pnts[4],txt[4]={{64,4},{190,4},{190,60},{64,60}};\r
+// int x,y; } pnts[4],txt[4]={{1,1},{63,1},{63,63},{1,63}};\r
+\r
+ dd=(dd+1)&63;\r
+\r
+ pnts[0].x=x1; pnts[0].y=y1;\r
+ pnts[1].x=x2; pnts[1].y=y2;\r
+ pnts[2].x=x3; pnts[2].y=y3;\r
+ pnts[3].x=x4; pnts[3].y=y4;\r
+\r
+ for(n=0,a=1;a<4;a++) if(pnts[a].y<pnts[n].y) n=a;\r
+\r
+ s1=n; s2=n; d1=(s1+1)&3; d2=(s2-1)&3;\r
+ dx1=pnts[d1].x-pnts[s1].x;\r
+ dy1=pnts[d1].y-pnts[s1].y; if(dy1==0) dy1++;\r
+ ax1=65536L*dx1/dy1;\r
+ xx1=((long)pnts[s1].x<<16)+0x8000L;\r
+ txx1=((long)txt[s1].x<<16)+0x8000L;\r
+ txy1=((long)txt[s1].y<<16)+0x8000L;\r
+ tax1=65536L*(txt[d1].x-txt[s1].x)/dy1;\r
+ tay1=65536L*(txt[d1].y-txt[s1].y)/dy1;\r
+\r
+ dx2=pnts[d2].x-pnts[s2].x;\r
+ dy2=pnts[d2].y-pnts[s2].y; if(dy2==0) dy2++;\r
+ ax2=65536L*dx2/dy2;\r
+ xx2=((long)pnts[s2].x<<16)+0x8000L;\r
+ txx2=((long)txt[s2].x<<16)+0x8000L;\r
+ txy2=((long)txt[s2].y<<16)+0x8000L;\r
+ tax2=65536L*(txt[d2].x-txt[s2].x)/dy2;\r
+ tay2=65536L*(txt[d2].y-txt[s2].y)/dy2;\r
+\r
+ yy=(long)pnts[s1].y;\r
+ from=MK_FP(kuvataus[color],0);\r
+ to=vmem[yy]; // initialize gfx pointers\r
+ dseg=disttaus[color]+dd*16;\r
+ ctau=&clrtau[clrptr][yy];\r
+ for(n=0;n<4;)\r
+ {\r
+ if(pnts[d1].y<pnts[d2].y) m=pnts[d1].y; else m=pnts[d2].y;\r
+ do_block(m-yy); yy=m;\r
+\r
+ if(pnts[d1].y==pnts[d2].y)\r
+ {\r
+ s1=d1; d1=(s1+1)&3;\r
+ s2=d2; d2=(s2-1)&3; n+=2;\r
+\r
+ dx1=pnts[d1].x-pnts[s1].x;\r
+ dy1=pnts[d1].y-pnts[s1].y; if(dy1==0) dy1++;\r
+ ax1=65536L*dx1/dy1;\r
+ xx1=((long)pnts[s1].x<<16)+0x8000L;\r
+ txx1=((long)txt[s1].x<<16)+0x8000L;\r
+ txy1=((long)txt[s1].y<<16)+0x8000L;\r
+ tax1=65536L*(txt[d1].x-txt[s1].x)/dy1;\r
+ tay1=65536L*(txt[d1].y-txt[s1].y)/dy1;\r
+\r
+ dx2=pnts[d2].x-pnts[s2].x;\r
+ dy2=pnts[d2].y-pnts[s2].y; if(dy2==0) dy2++;\r
+ ax2=65536L*dx2/dy2;\r
+ xx2=((long)pnts[s2].x<<16)+0x8000L;\r
+ txx2=((long)txt[s2].x<<16)+0x8000L;\r
+ txy2=((long)txt[s2].y<<16)+0x8000L;\r
+ tax2=65536L*(txt[d2].x-txt[s2].x)/dy2;\r
+ tay2=65536L*(txt[d2].y-txt[s2].y)/dy2;\r
+ }\r
+ else if(pnts[d1].y<pnts[d2].y)\r
+ {\r
+ s1=d1; d1=(s1+1)&3; n++;\r
+ dx1=pnts[d1].x-pnts[s1].x;\r
+ dy1=pnts[d1].y-pnts[s1].y; if(dy1==0) dy1++;\r
+ ax1=65536L*dx1/dy1;\r
+ xx1=((long)pnts[s1].x<<16)+0x8000L;\r
+ txx1=((long)txt[s1].x<<16)+0x8000L;\r
+ txy1=((long)txt[s1].y<<16)+0x8000L;\r
+ tax1=65536L*(txt[d1].x-txt[s1].x)/dy1;\r
+ tay1=65536L*(txt[d1].y-txt[s1].y)/dy1;\r
+ }\r
+ else {\r
+ s2=d2; d2=(s2-1)&3; n++;\r
+ dx2=pnts[d2].x-pnts[s2].x;\r
+ dy2=pnts[d2].y-pnts[s2].y; if(dy2==0) dy2++;\r
+ ax2=65536L*dx2/dy2;\r
+ xx2=((long)pnts[s2].x<<16)+0x8000L;\r
+ txx2=((long)txt[s2].x<<16)+0x8000L;\r
+ txy2=((long)txt[s2].y<<16)+0x8000L;\r
+ tax2=65536L*(txt[d2].x-txt[s2].x)/dy2;\r
+ tay2=65536L*(txt[d2].y-txt[s2].y)/dy2;\r
+ }\r
+ }\r
+ }\r
+\r
+clear()\r
+ {\r
+ int *otau=clrtau[(clrptr-3)&7], *ntau=clrtau[clrptr];\r
+\r
+ clrptr=(clrptr+1)&7;\r
+\r
+ do_clear(vmem[0],otau,ntau);\r
+ }\r
+\r
--- /dev/null
+{
+0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10
+, 11, 12, 13, 14, 16, 17, 18, 20, 21, 23, 24, 25, 27, 28, 30, 31
+, 33, 35, 36, 38, 39, 40, 42, 43, 45, 46, 47, 49, 50, 51, 52, 53
+, 54, 55, 56, 57, 58, 59, 60, 60, 61, 61, 62, 62, 62, 62, 62, 63
+, 62, 62, 62, 62, 62, 61, 61, 60, 60, 59, 58, 57, 56, 55, 54, 53
+, 52, 51, 50, 49, 47, 46, 45, 43, 42, 40, 39, 38, 36, 35, 33, 32
+, 30, 28, 27, 25, 24, 23, 21, 20, 18, 17, 16, 14, 13, 12, 11, 10
+, 9, 8, 7, 6, 5, 4, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1
+};
\ No newline at end of file
--- /dev/null
+extern void tw_opengraph();\r
+extern void tw_closegraph();\r
+extern void tw_putpixel(int x, int y, int color);\r
+extern int tw_getpixel(int x, int y);\r
+extern void tw_setpalette(void far *pal);\r
+extern void tw_setpalarea(void far *pal,int start,int cnt);\r
+extern void tw_setrgbpalette(int pal, int r, int g, int b);\r
+extern void tw_setstart(int start);\r
+extern void tw_pictovmem(void far *pic, int to, int len);\r
+extern void tw_crlscr();\r
+\r
+extern int far scr_seg;
\ No newline at end of file
--- /dev/null
+#include <stdio.h>\r
+#include <conio.h>\r
+#include <dos.h>\r
+#include <math.h>\r
+#include <io.h>\r
+#include <fcntl.h>\r
+#include "tweak.h"\r
+\r
+#define SX sinit[kx]\r
+#define SY sinit[ky]\r
+#define SZ sinit[kz]\r
+#define CX kosinit[kx]\r
+#define CY kosinit[ky]\r
+#define CZ kosinit[kz]\r
+\r
+extern far char (* far vmem)[160];\r
+extern char far pal[768];\r
+\r
+extern clear();\r
+extern init();\r
+extern shadepal(char far *fpal, char far *ppal, int shade);\r
+extern init_copper();\r
+extern close_copper();\r
+extern int far cop_rotatev;\r
+extern far int frame_count;\r
+extern far char * far cop_pal;\r
+extern far int do_pal;\r
+extern far int cop_start;\r
+extern far int cop_scrl;\r
+\r
+extern int do_poly();\r
+extern int getspl(int where);\r
+extern int far sinit[1024];\r
+extern int far kosinit[1024];\r
+\r
+char far fpal[768];\r
+\r
+struct object {\r
+ char name[100];\r
+\r
+ int pnts;\r
+ struct points_3d {\r
+ int x;\r
+ int y;\r
+ int z;\r
+ int xx;\r
+ int yy;\r
+ int zz;\r
+ int xxx;\r
+ int yyy;\r
+ } point[256];\r
+\r
+ int faces;\r
+ struct polygon {\r
+ int p1;\r
+ int p2;\r
+ int p3;\r
+ int p4;\r
+ int p5;\r
+ int p6;\r
+ int n;\r
+ int color;\r
+ } pg[256];\r
+\r
+ int lines;\r
+ struct lines {\r
+ int p1;\r
+ int p2;\r
+ int n;\r
+ int col;\r
+ } lin[256];\r
+ } object={\r
+ "Cube",\r
+ 8, // points\r
+ {\r
+ {125,125,125},\r
+ {125,-125,125},\r
+ {-125,-125,125},\r
+ {-125,125,125},\r
+ {125,125,-125},\r
+ {125,-125,-125},\r
+ {-125,-125,-125},\r
+ {-125,125,-125},\r
+ },\r
+ 6, // faces\r
+ {\r
+ {1,2,3,0,0,0,0,0},\r
+ {7,6,5,4,0,0,0,0},\r
+ {0,4,5,1,0,0,0,1},\r
+ {1,5,6,2,0,0,0,2},\r
+ {2,6,7,3,0,0,0,1},\r
+ {3,7,4,0,0,0,0,2}}\r
+ };\r
+\r
+struct polygons_to_draw {\r
+ int p;\r
+ int dis;\r
+ } ptodraw[256];\r
+int polys=0;\r
+\r
+int light_src[6]={0};\r
+int lls[6]={0};\r
+\r
+int cxx, cxy, cxz, cyx, cyy, cyz, czx, czy, czz;\r
+int kx=0,ky=0,kz=0,dis=320,tx=0,ty=-50;\r
+int ls_kx=0,ls_ky=0,ls_kz=0,ls_x=0,ls_y=0,ls_z=128;\r
+int page=0;\r
+int frames=0;\r
+\r
+vect()\r
+ {\r
+ int c=0,a;\r
+\r
+ tw_opengraph();\r
+\r
+ while(dis_musplus()<13 && !dis_exit()); frame_count=0;\r
+ while(!dis_exit())\r
+ {\r
+ a=dis_musplus();\r
+ if(a>=-4 && a<0) break;\r
+ swappage();\r
+ while(frame_count<1); frames+=frame_count; frame_count=0;\r
+ cop_pal=fpal; do_pal=1;\r
+\r
+ calculate(1);\r
+ draw(15);\r
+ clear();\r
+ }\r
+// tw_closegraph();\r
+ }\r
+\r
+calculate(int k)\r
+ {\r
+ int a;\r
+ static int px=0,py=256;\r
+\r
+ getspl(4*256+frames*4);\r
+ kx=kx&1023;\r
+ ky=ky&1023;\r
+ kz=kz&1023;\r
+ ls_kx=ls_kx&1023;\r
+ ls_ky=ls_ky&1023;\r
+\r
+ ls_y=kosinit[ls_kx]>>8;\r
+ ls_x=(sinit[ls_kx]>>8)*(sinit[ls_ky]>>8)>>7;\r
+ ls_z=(sinit[ls_kx]>>8)*(kosinit[ls_ky]>>8)>>7;\r
+\r
+ count_const();\r
+ rotate();\r
+ sort_faces();\r
+ }\r
+\r
+count_const()\r
+ {\r
+ //matrix equations:\r
+ //X Y Z -> nX\r
+ //X Y Z -> nY\r
+ //X Y Z -> nZ\r
+ //\r
+ // 0=Ycos*Zcos 2=Ycos*Zsin 4=-Ysin\r
+ // 6=Xsin*Zcos*Ysin 8=Xsin*Ysin*Zsin 10=Ycos*Xsin\r
+ // -Xcos*Zsin +Xcos*Zcos\r
+ //12=Xcos*Zcos*Ysin 14=Xcos*Ysin*Zsin 16=Ycos*Xcos\r
+ // +Xsin*Zsin -Xsin*Zcos\r
+\r
+ cxx=(long)CY*(long)CZ>>15+7;\r
+ cxy=(long)CY*(long)SZ>>15+7;\r
+ cxz=-(long)SY>>7;\r
+\r
+ cyx=((long)SX*(long)CZ+16384L>>15)*(long)SY - (long)CX*(long)SZ>>15+7;\r
+ cyy=((long)SX*(long)SY+16384L>>15)*(long)SZ + (long)CX*(long)CZ>>15+7;\r
+ cyz=(long)CY*(long)SX>>15+7;\r
+\r
+ czx=((long)CX*(long)CZ+16384L>>15)*(long)SY + (long)SX*(long)SZ>>15+7;\r
+ czy=((long)CX*(long)SY+16384L>>15)*(long)SZ - (long)SX*(long)CZ>>15+7;\r
+ czz=(long)CY*(long)CX>>15+7;\r
+\r
+ }\r
+\r
+rotate()\r
+ {\r
+ int a,b,x,y,z,xx,yy,zz;\r
+\r
+ for(a=0;a<object.pnts;a++)\r
+ {\r
+ x=object.point[a].x; y=object.point[a].y; z=object.point[a].z;\r
+\r
+ object.point[a].xx=xx=((x*cxx>>1) + (y*cxy>>1) + (z*cxz>>1)>>7)+tx;\r
+ object.point[a].yy=yy=((x*cyx>>1) + (y*cyy>>1) + (z*cyz>>1)>>7)+ty;\r
+ object.point[a].zz=zz=((x*czx>>1) + (y*czy>>1) + (z*czz>>1)>>7)+dis;\r
+\r
+/*\r
+ 1000,1000,1000\r
+\r
+ x*256, y*213, / (\r
+*/\r
+\r
+ object.point[a].xxx=(xx*256L)/zz+160+160;\r
+ object.point[a].yyy=(yy*142L)/zz+66;\r
+ }\r
+ }\r
+\r
+sort_faces()\r
+ {\r
+ int a=0,b,c,x,y,z,p=0;\r
+ long ax,ay,az,bx,by,bz,kx,ky,kz,nx,ny,nz,s,l;\r
+\r
+ while(a<object.faces)\r
+ {\r
+ x=object.point[object.pg[a].p1].xx;\r
+ y=object.point[object.pg[a].p1].yy;\r
+ z=object.point[object.pg[a].p1].zz;\r
+\r
+ ax=object.point[object.pg[a].p2].xx-x;\r
+ ay=object.point[object.pg[a].p2].yy-y;\r
+ az=object.point[object.pg[a].p2].zz-z;\r
+\r
+ bx=object.point[object.pg[a].p3].xx-x;\r
+ by=object.point[object.pg[a].p3].yy-y;\r
+ bz=object.point[object.pg[a].p3].zz-z;\r
+\r
+ nx = ay * bz - az * by;\r
+ ny = az * bx - ax * bz;\r
+ nz = ax * by - ay * bx; // normal\r
+\r
+ kx = -x;\r
+ ky = -y;\r
+ kz = -z; // view_vector\r
+\r
+ s = kx*nx + ky*ny + kz*nz; // skalaaritulo\r
+\r
+ if(s>0) { a++; continue; }\r
+\r
+ s=(ls_x*nx+ls_y*ny+ls_z*nz)/250000+32;\r
+ light_src[p]=s;\r
+ c=object.pg[a].color;\r
+ if(lls[p]!=light_src[p])\r
+ {\r
+ shadepal(&fpal[c*64*3],&pal[c*64*3], light_src[p]);\r
+ lls[p]=light_src[p];\r
+ }\r
+\r
+ ptodraw[p++].p=a++;\r
+ }\r
+ polys=p;\r
+ }\r
+\r
+\r
+draw()\r
+ {\r
+ int a=0,b,c,f,x,y,z;\r
+ long ax,ay,az,bx,by,bz,kx,ky,kz,nx,ny,nz,s;\r
+\r
+ for(a=0;a<polys;a++)\r
+ {\r
+ c=object.pg[ptodraw[a].p].color;\r
+ do_poly(object.point[object.pg[ptodraw[a].p].p1].xxx+(page&1)*2, object.point[object.pg[ptodraw[a].p].p1].yyy,\r
+ object.point[object.pg[ptodraw[a].p].p2].xxx+(page&1)*2, object.point[object.pg[ptodraw[a].p].p2].yyy,\r
+ object.point[object.pg[ptodraw[a].p].p3].xxx+(page&1)*2, object.point[object.pg[ptodraw[a].p].p3].yyy,\r
+ object.point[object.pg[ptodraw[a].p].p4].xxx+(page&1)*2, object.point[object.pg[ptodraw[a].p].p4].yyy,\r
+ c, frames&63);\r
+ }\r
+ }\r
+\r
+swappage()\r
+ {\r
+ page=(page+1)%6;\r
+ if(page==0){\r
+ vmem=MK_FP(0x0a000,0x0000);\r
+ cop_start=0xaa00+40;\r
+ cop_scrl=4;\r
+ }\r
+ else if(page==1){\r
+ vmem=MK_FP(0x0a000,0x5500);\r
+ cop_start=0x0000+40;\r
+ cop_scrl=0;\r
+ }\r
+ else if(page==2){\r
+ vmem=MK_FP(0x0a000,0xaa00);\r
+ cop_start=0x5500+40;\r
+ cop_scrl=4;\r
+ }\r
+ else if(page==3){\r
+ vmem=MK_FP(0x0a000,0x0000);\r
+ cop_start=0xaa00+40;\r
+ cop_scrl=0;\r
+ }\r
+ else if(page==4){\r
+ vmem=MK_FP(0x0a000,0x5500);\r
+ cop_start=0x0000+40;\r
+ cop_scrl=4;\r
+ }\r
+ else if(page==5){\r
+ vmem=MK_FP(0x0a000,0xaa00);\r
+ cop_start=0x5500+40;\r
+ cop_scrl=0;\r
+ }\r
+ }\r
+\r