This commit is contained in:
Frater 2017-09-24 01:45:36 +02:00
commit 43352ff262
1291 changed files with 220976 additions and 0 deletions

158
TWIST/ASM Normal file
View file

@ -0,0 +1,158 @@
PUBLIC _docol,_docolset
PUBLIC _docol_mapc,_docol_maph,_docol_ycd
PUBLIC _docol_hig,_docol_higr,_docol_higrr,_docol_higrrr
PUBLIC _docol_bailout,_docol_debug
PUBLIC _docol_avg
BAILOUT equ 256
ALIGN 16
_docol_hig dd 256 dup(0)
_docol_higr dd 256 dup(0)
_docol_higrr dd 256 dup(0)
_docol_higrrr dd 256 dup(0)
_docol_ycd dd 200 dup(0)
_docol_bailout dw BAILOUT
_docol_mapc dw 0,0
_docol_maph dw 0,0
_docol_avg dw 0,0
_docol_debug dd 0
_docolset PROC FAR
CBEG
movpar ax,0
mov cx,(slf1-slf0)/BAILOUT
mul cx
add ax,OFFSET slf0
mov bx,ax
movpar ax,1
movpar dx,2
mov cs:[bx+10+2],ax
mov cs:[bx+10+4],dx
CEND
_docolset ENDP
public _doavg
_doavg PROC FAR
CBEG
mov ax,SEG _vbuf
mov es,ax
mov ds,cs:_docol_avg[2]
movpar di,0
add di,80*320
mov cx,200-80
@@1: mov bl,es:[di]
diadd=2
REPT 159
mov bh,es:[di+diadd]
mov al,ds:[bx]
mov bl,bh
mov es:[di+diadd-1],al
diadd=diadd+2
ENDM
add di,320
dec cx
jz @@2
jmp @@1
@@2:
CEND
_doavg ENDP
_docol PROC FAR
CBEG
mov ax,cs
mov ds,ax
push bp ;store C parameter start
mov fs,ds:_docol_maph[2]
mov gs,ds:_docol_mapc[2]
movpar ax,1
shl ax,7
movpar si,0
movzx esi,si
add si,ax ;basepos
xor ebx,ebx
;movpar ax,3 ;screen pos
;and ax,3
;mov bh,al ;scatterer
movpar dx,2
movsx edx,dx
shl edx,7
rol edx,16
mov bp,dx
add bp,-128 ;baseadd
xor dx,dx
;selfmod: vram/pos, docol_ycd/pos
;eax - -
;ebx indexer-tmp (+scatterpos)
;ecx - -
;edx xaddl 0
;esi xl x
;edi - -
;ebp - xaddh
;ds code
;es -
;fs maph
;gs mapc
diadd=OFFSET slf0
REPT BAILOUT
and si,16383
mov bl,fs:[si]
mov eax,ds:_docol_hig[ebx*4]
mov dword ptr ds:[diadd+0+2],eax ;set compare
add esi,edx
mov al,gs:[si]
mov byte ptr ds:[diadd+8+1],al ;set color
adc si,bp
diadd=diadd+(slf1-slf0)/BAILOUT
ENDM
jmp @@flsh
@@flsh: pop bp ;restore C parameter start
mov ax,SEG _vbuf
mov es,ax
movpar ax,3
mov bp,ax
mov di,OFFSET _docol_ycd+199*4
mov ecx,ds:[di]
xor eax,eax
;selfmod: vram/pos, docol_ycd/pos
;eax yc ycl
;ebx - -
;ecx ycaddh ycaddl
;edx - -
;esi - -
;edi - offset to ycd
;ebp - offset to vram
;ds code
;es vram
int 3
slf0: siadd=0
REPT BAILOUT
local l1,l2,l3
l3: cmp eax,12345678h ;@0 compare ray / scene
jge short l1 ;@6 hit?
mov cl,12h ;@8 load color
l2: sub eax,12345678h ;@10 adjust next ray pos
mov es:[bp+0],cl ; store color
sub di,4 ; adjust raytable pointer
sub bp,320 ; next screen pos
cmp dword ptr ds:l3[2],eax ; next ray hits too?
jge short l2 ; yup.
mov ecx,ds:[di] ; next ray direction
l1: add eax,ecx ; on we go in Z
siadd=siadd+4
ENDM
slf1: CEND
_docol ENDP

272
TWIST/ASM.ASM Normal file
View file

@ -0,0 +1,272 @@
code SEGMENT para public 'CODE'
ASSUME cs:code
.386
LOCALS
PUBLIC _vram
_vram dw 0,0a000h
PUBLIC _sin1024
include sin1024.inc
PUBLIC _setborder
_setborder PROC FAR
push bp
mov bp,sp
mov dx,3dah
in al,dx
mov dx,3c0h
mov al,11h+32
out dx,al
mov al,[bp+6]
out dx,al
pop bp
ret
_setborder ENDP
PUBLIC _inittwk
_inittwk PROC FAR
push bp
mov bp,sp
push si
push di
push ds
;clear palette
mov dx,3c8h
xor al,al
out dx,al
inc dx
mov cx,768
@@1: out dx,al
loop @@1
mov dx,3d4h
;400 rows
;mov ax,00009h
;out dx,ax
;tweak
mov ax,00014h
out dx,ax
mov ax,0e317h
out dx,ax
mov dx,3c4h
mov ax,0604h
out dx,ax
;
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov ax,0a000h
mov es,ax
xor di,di
mov cx,32768
xor ax,ax
rep stosw
;
pop ds
pop di
pop si
pop bp
ret
_inittwk ENDP
PUBLIC _setpalarea
_setpalarea PROC FAR
push bp
mov bp,sp
push si
push di
push ds
lds si,[bp+6]
mov ax,[bp+10]
mov dx,3c8h
out dx,al
mov cx,[bp+12]
mov ax,cx
shl cx,1
add cx,ax
inc dx
rep outsb
sti
pop ds
pop di
pop si
pop bp
ret
_setpalarea ENDP
PUBLIC _leftline
_leftline PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov ax,80
mul word ptr [bp+6]
mov di,ax
mov ds,cs:_vram[2]
mov cx,160
mov ax,[bp+8]
or ax,ax
jz @@1
sub cx,ax
mov bx,cx
shr bx,2
add di,bx
and cl,3
mov ax,0ff02h
shl ah,cl
mov dx,3c4h
out dx,ax
mov ah,[bp+10]
mov ds:[di],ah
inc di
inc dx
mov al,0fh
out dx,al
mov al,ah
test di,1
jz @@2
mov ds:[di],ah
inc di
inc bx
@@2: mov cx,39
sub bx,cx
add bx,bx
and bx,not 3
;bx=-4*(number of words)
add bx,OFFSET @@fill
jmp bx
zzz=80
REPT 40
zzz=zzz-2
db 89h,85h,zzz,0 ;mov ds:[di+zzz],ax
ENDM
@@fill:
@@1: pop ds
pop di
pop si
pop bp
ret
_leftline ENDP
PUBLIC _rightline
_rightline PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov ax,80
mul word ptr [bp+6]
mov di,ax
mov ds,cs:_vram[2]
mov cx,160
mov ax,[bp+8]
or ax,ax
jz @@1
add cx,ax
mov bx,cx
shr bx,2
add di,bx
and cl,3
mov ax,0f002h
rol ah,cl
mov dx,3c4h
out dx,ax
mov ah,[bp+10]
mov ds:[di],ah
dec di
inc dx
mov al,0fh
out dx,al
mov al,ah
mov cx,bx
test di,1
jnz @@2
mov ds:[di],ah
dec cx
@@2: sub cx,40
neg cx
add cx,cx
and cx,not 3
;bx=-4*(number of words)
add cx,OFFSET @@fill
sub di,bx
add di,41
jmp cx
zzz=80
REPT 40
zzz=zzz-2
db 89h,85h,zzz,0 ;mov ds:[di+zzz],ax
ENDM
@@fill:
@@1: pop ds
pop di
pop si
pop bp
ret
_rightline ENDP
testcopper PROC FAR
mov dx,3c8h
xor al,al
out dx,al
inc dx
mov al,63
out dx,al
out dx,al
out dx,al
mov cx,100
@@1: loop @@1
mov dx,3c8h
xor al,al
out dx,al
inc dx
mov al,0
out dx,al
out dx,al
out dx,al
ret
testcopper ENDP
PUBLIC _initcoppers
_initcoppers PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov bx,7
mov ax,0
mov cx,OFFSET testcopper
mov dx,cs
int 0fch
mov bx,7
mov ax,1
mov cx,OFFSET testcopper
mov dx,cs
int 0fch
mov bx,7
mov ax,2
mov cx,OFFSET testcopper
mov dx,cs
; int 0fch
pop ds
pop di
pop si
pop bp
ret
_initcoppers ENDP
code ENDS
END

BIN
TWIST/ASM.OBJ Normal file

Binary file not shown.

115
TWIST/DOL.C Normal file
View file

@ -0,0 +1,115 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <stdarg.h>
int from=6,to=198;
int cent=160;
FILE *f1;
unsigned char *vram=(char *)0xa0000000L;
void P(char *str,...)
{
char out[256];
va_list argp;
va_start(argp,str);
vsprintf(out,str,argp);
fprintf(f1,"%s\n",out);
va_end(argp);
}
int xt[320];
char palette[768];
main()
{
int i,j,x,y,a,sk1,sk2,sk3,sk4,sfl,la;
unsigned int u;
char *v;
long l;
_asm mov ax,13h
_asm int 10h
f1=fopen("tmp.uh","rb");
fread(palette,1,16,f1);
fread(palette,1,768,f1);
fread(vram,1,64000,f1);
for(u=1;u<64000;u++)
{
vram[u-1]=palette[vram[u]*3];
}
outp(0x3c8,0);
for(a=0;a<64;a++)
{
outp(0x3c9,a);
outp(0x3c9,a);
outp(0x3c9,a);
}
fclose(f1);
for(y=0;y<200;y++)
{
v=vram+y*320;
for(x=0;x<320;x++) if(x&3)
{
if(v[x+4]!=0 && v[x-4]!=0) v[x]=v[x-1];
}
}
f1=fopen("twstloop.inc","wt");
P("twistt LABEL WORD");
for(y=0;y<200;y++)
{
a=y;
P("dw OFFSET twist%il,OFFSET twist%ir",a,a);
}
P("twist PROC NEAR");
for(y=0;y<200;y++)
{
kbhit();
P("twist%il:",y);
P("mov dx,3c4h");
P("mov ax,0f02h");
P("out dx,ax");
la=-1;
for(x=0;x<160;x+=8)
{
a=vram[y*320+x];
a|=(vram[y*320+x+4])<<8;
if(la!=a)
{
la=a;
P("mov ax,0%04Xh",a);
}
P("mov ds:[di+%i],ax",x/4);
}
P("ret");
P("twist%ir:",y);
P("mov dx,3c4h");
P("mov ax,0f02h");
P("out dx,ax");
la=-1;
a=from+(long)y*(long)(to-from)/200L;
v=vram+a*320;
for(x=160;x<320;x+=8)
{
a=v[x];
a|=(v[x+4])<<8;
if(la!=a)
{
la=a;
P("mov ax,0%04Xh",a);
}
P("mov ds:[di+%i],ax",x/4);
}
P("ret");
v[0]=63;
}
P("twist ENDP");
fclose(f1);
getch();
_asm mov ax,3h
_asm int 10h
}

BIN
TWIST/DOL.EXE Normal file

Binary file not shown.

BIN
TWIST/DOL.OBJ Normal file

Binary file not shown.

129
TWIST/DOLOOP.1 Normal file
View file

@ -0,0 +1,129 @@
#include <stdio.h>
#include <conio.h>
#include <stdarg.h>
int depth=2;
int bail=150;
int group=3;
FILE *f1;
void P(char *str,...)
{
char out[256];
va_list argp;
va_start(argp,str);
vsprintf(out,str,argp);
fprintf(f1,"%s\n",out);
va_end(argp);
}
long weirdflip(unsigned long l)
{
long m,lo,hi;
lo=l&0xffff;
hi=l>>16;
m=(lo<<16)+hi;
return(m);
}
main()
{
int i,j,jm,y,a;
long l;
f1=fopen("theloop.inc","wt");
P(";Register usage: ");
P(";eax low... ray heigth ");
P(";ebx - p->screen ");
P(";ecx low... ray direction (always negative)");
P(";edx - scenary heigth ");
P(";esi - xsin ");
P(";edi - ysin ");
P(";ebp - p->ray_dir_table");
P(";ds ->codesegment");
P(";es ->screenbuffer");
P(";fs ->wavetable");
P(";gs -");
P("");
P("ALIGN 16 ;following should stay in cache");
P("theloop_waveseg dw 0");
P("theloop_xsina dw 0");
P("theloop_ysina dw 0");
P("theloop_heigth dw 0");
P("theloop_raydir LABEL DWORD");
for(y=0;y<200;y++)
{
a=(199-y)-100;
l=-(long)a*10L*256L*depth;
l=weirdflip(l);
P("dd 0%08lXh",l);
}
P("");
P(";entry: es=videbuf");
P("; bp=pointer to bottom of current column in videbuf");
P("; fs=waveXsegment");
P("; gs=waveYsegment");
P("; si=waveXpos");
P("; di=waveYpos");
P("; cx=waveXadd");
P("; dx=waveYadd");
P("; ax=camera heigth adder");
P("theloop PROC FAR");
P("mov bx,bp");
P("mov cs:theloop_xsina,cx");
P("mov cs:theloop_ysina,dx");
P("mov cs:theloop_heigth,ax");
P("mov bp,OFFSET theloop_raydir");
P("mov ax,cs");
P("mov ds,ax");
P("xor eax,eax");
P("mov ecx,ds:[bp]");
P("add bp,4");
for(i=0;i<bail;i+=group)
{
printf("%i\r",i);
jm=i+group; if(jm>bail) jm=bail;
for(j=i;j<jm;j++)
{
P("_@seek%i:",j);
P("add si,ds:theloop_xsina");
P("xor dh,dh");
P("mov dl,fs:[si]");
P("add di,ds:theloop_ysina");
P("add dl,gs:[di]");
P("add dx,ds:theloop_heigth");
P("cmp ax,dx");
P("jl short _@hit%i",j);
P("_@seekr%i:",j);
P("add eax,ecx");
P("adc ax,-1");
}
if(jm>=bail)
{
P("_@seek%i:",bail);
P("_@seekr%i:",bail);
P("ret");
}
else P("jmp _@seek%i",jm);
for(j=i;j<jm;j++)
{
l=j*10L*256;
l=weirdflip(l);
P("_@hit%i:",j);
P("add eax,0%08lXh",l*depth);
P("adc ax,0");
P("mov es:[bx],dl");
P("add bp,4");
P("sub bx,320");
P("cmp ax,dx");
P("jle short _@hit%i",j);
P("mov ecx,ds:[bp]");
P("jmp short _@seekr%i",j+1);
}
}
P("theloop ENDP");
printf(" \r",i);
fclose(f1);
}

120
TWIST/DOLOOP.C Normal file
View file

@ -0,0 +1,120 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <stdarg.h>
FILE *f1;
void P(char *str,...)
{
char out[256];
va_list argp;
va_start(argp,str);
vsprintf(out,str,argp);
fprintf(f1,"%s\n",out);
va_end(argp);
}
long weirdflip(unsigned long l)
{
long m,lo,hi;
lo=l&0xffff;
hi=l>>16;
m=(lo<<16)+hi;
return(m);
}
int xt[320];
main()
{
int i,j,x,y,a,sk1,sk2,sk3,sk4,sfl;
long l;
f1=fopen("twstloop.inc","wt");
P("zoom PROC FAR");
P(";ds:si=source bitmap row start");
P(";es:di=destination pointer");
P(";ax=zoom factor (desired screen width)");
P("cmp ax,%i",MAXZOOM);
P("jae zoom_ret");
P("xor cx,cx");
P("test ax,4");
P("jnz @@1");
P("add di,2");
P("mov cx,1");
P("@@1:");
P("mov bx,ax");
P("and bx,not 1");
P("xor edx,edx");
P("jmp cs:zoomloopt[bx]");
P("zoom_ret:");
P("ret");
P("ALIGN 16 ;following should stay in cache");
P("zoomloopt LABEL WORD");
for(y=0;y<=MAXZOOM;y+=2)
{
if(y<MINZOOM) P("dw OFFSET zoom_%i",MINZOOM&(~4));
else
{
P("dw OFFSET zoom_%i",y&(~4));
}
}
for(y=MINZOOM;y<=MAXZOOM;y+=2)
{
if(y&4) continue;
printf("%i\r",y);
for(x=0;x<320;x++)
{
a=(int)((long)(x-160)*320L/(long)y)+160;
if(a<0 || a>319) xt[x]=-1;
else xt[x]=a;
}
sk1=(int)((long)-80*(long)y/320L)+160;
sk2=(int)((long)-40*(long)y/320L)+160;
sk3=(int)((long)40*(long)y/320L)+160;
sk4=(int)((long)80*(long)y/320L)+160;
sk1&=~3;
sk2&=~3;
sk3&=~3;
sk4&=~3;
P("zoom_%i:",y);
sfl=0;
for(x=0;x<320;x+=2)
{
if(x==sk1 || x==sk2 || x==sk3 || x==sk4)
{
P("add si,cx");
}
if(xt[x]==-1 && xt[x+1]==-1 && xt[x+2]==-1 && xt[x+3]==-1 && !(x&2))
{
P("mov es:[di+%i],edx",x);
x+=2;
}
else if(xt[x]==-1 && xt[x+1]==-1)
{
P("mov es:[di+%i],dx",x);
}
else
{
if(xt[x]!=-1 && xt[x+1]!=-1 && xt[x+1]==xt[x]+1)
{
P("mov ax,ds:[si+%i]",xt[x]);
P("mov es:[di+%i],ax",x);
}
else
{
if(xt[x]==-1) P("mov al,dl");
else P("mov al,ds:[si+%i]",xt[x]);
if(xt[x+1]==xt[x]) P("mov ah,al");
else if(xt[x+1]==-1) P("mov ah,dl");
else P("mov ah,ds:[si+%i]",xt[x+1]);
P("mov es:[di+%i],ax",x);
}
}
}
P("ret");
}
P("zoom ENDP");
fclose(f1);
}

BIN
TWIST/DOLOOP.EXE Normal file

Binary file not shown.

155
TWIST/DOLOOP.OK Normal file
View file

@ -0,0 +1,155 @@
#include <stdio.h>
#include <conio.h>
#include <stdarg.h>
int depth=2;
int bail=150;
int group=150;
FILE *f1;
void P(char *str,...)
{
char out[256];
va_list argp;
va_start(argp,str);
vsprintf(out,str,argp);
fprintf(f1,"%s\n",out);
va_end(argp);
}
long weirdflip(unsigned long l)
{
long m,lo,hi;
lo=l&0xffff;
hi=l>>16;
m=(lo<<16)+hi;
return(m);
}
main()
{
int i,j,jm,y,a;
long l;
f1=fopen("theloop.inc","wt");
P(";Register usage: ");
P(";eax low... ray heigth ");
P(";ebx - p->screen ");
P(";ecx low... ray direction (always negative)");
P(";edx - scenary heigth ");
P(";esi - xsin ");
P(";edi - ysin ");
P(";ebp - p->ray_dir_table");
P(";ds ->codesegment");
P(";es ->screenbuffer");
P(";fs ->wavetable");
P(";gs -");
P("");
P("ALIGN 16 ;following should stay in cache");
P("theloop_waveseg dw 0");
P("theloop_xsina dw 0");
P("theloop_ysina dw 0");
P("theloop_heigth dw 0");
P("theloop_raydir LABEL DWORD");
for(y=0;y<200;y++)
{
a=(199-y)-100;
l=-(long)a*10L*256L*depth;
l=weirdflip(l);
P("dd 0%08lXh",l);
}
P("");
P(";entry: es=videbuf");
P("; bp=pointer to bottom of current column in videbuf");
P("; fs=waveXsegment");
P("; gs=waveYsegment");
P("; si=waveXpos");
P("; di=waveYpos");
P("; cx=waveXadd");
P("; dx=waveYadd");
P("; ax=camera heigth adder");
P("theloop PROC FAR");
P("mov bx,bp");
P("mov cs:theloop_xsina,cx");
P("mov cs:theloop_ysina,dx");
P("mov cs:theloop_heigth,ax");
P("mov bp,OFFSET theloop_raydir");
P("mov ax,cs");
P("mov ds,ax");
P("xor eax,eax");
P("mov ecx,ds:[bp]");
P("add bp,4");
for(i=0;i<bail;i+=group)
{
jm=i+group; if(jm>bail) jm=bail;
for(j=i;j<jm;j++)
{
printf("%i\r",j);
P("_@seek%i:",j);
P("add si,ds:theloop_xsina");
P("xor dh,dh");
P("mov dl,fs:[si]");
P("add di,ds:theloop_ysina");
P("add dl,gs:[di]");
P("add dx,ds:theloop_heigth");
P("cmp ax,dx");
P("jge short _@seeko%i",j);
l=j*10L*256*depth;
l=weirdflip(l);
P("_@hit%i:",j);
P("add eax,0%08lXh",l);
P("adc ax,0");
P("mov es:[bx],dl");
P("cmp ax,dx");
P("jge short _@seek1a%i",j);
P("add eax,0%08lXh",l);
P("adc ax,0");
P("mov es:[bx-320],dl");
P("cmp ax,dx");
P("jge short _@seek2a%i",j);
P("add eax,0%08lXh",l);
P("adc ax,0");
P("mov es:[bx-640],dl");
P("cmp ax,dx");
P("jge short _@seek3a%i",j);
P("add eax,0%08lXh",l);
P("adc ax,0");
P("mov es:[bx-960],dl");
P("add bp,4*4");
P("sub bx,320*4");
P("cmp ax,dx");
P("jge short _@seek0a%i",j);
P("jmp _@hit%i",j);
P("_@seek3a%i:",j);
P("add bp,4");
P("sub bx,320");
P("_@seek2a%i:",j);
P("add bp,4");
P("sub bx,320");
P("_@seek1a%i:",j);
P("add bp,4");
P("sub bx,320");
P("_@seek0a%i:",j);
P("mov ecx,ds:[bp]");
P("_@seeko%i:",j);
P("add eax,ecx");
P("adc ax,-1");
}
if(jm>=bail)
{
P("_@seek%i:",bail);
P("_@seekr%i:",bail);
P("ret");
}
else P("jmp _@seek%i",jm);
}
P("theloop ENDP");
printf(" \r",i);
fclose(f1);
}

BIN
TWIST/DP_PREFS Normal file

Binary file not shown.

6
TWIST/KOE.ASM Normal file
View file

@ -0,0 +1,6 @@
.MODEL Large
.CODE
mov es:[di+1234h],ax
END

39
TWIST/KOE.LST Normal file
View file

@ -0,0 +1,39 @@
Turbo Assembler Version 2.5 07/12/93 13:14:00 Page 1
koe.ASM
1 0000 .MODEL Large
2 0000 .CODE
3
4 0000 26: 89 85 1234 mov es:[di+1234h],ax
5
6 END
Turbo Assembler Version 2.5 07/12/93 13:14:00 Page 2
Symbol Table
Symbol Name Type Value
??DATE Text "07/12/93"
??FILENAME Text "koe "
??TIME Text "13:13:59"
??VERSION Number 0205
@CODE Text KOE_TEXT
@CODESIZE Text 1
@CPU Text 0101H
@CURSEG Text KOE_TEXT
@DATA Text DGROUP
@DATASIZE Text 1
@FILENAME Text KOE
@MODEL Text 5
@WORDSIZE Text 2
Groups & Segments Bit Size Align Combine Class
DGROUP Group
_DATA 16 0000 Word Public DATA
KOE_TEXT 16 0005 Word Public CODE

110
TWIST/MAIN.C Normal file
View file

@ -0,0 +1,110 @@
#include <stdio.h>
#include <conio.h>
#include <malloc.h>
#include "..\dis\dis.h"
int flip;
extern char far *twistvram;
extern int twist[];
extern void twister(void);
extern char far *vram;
char far *vram1=(char far *)0xa0000000L;
char far *vram2=(char far *)0xa8000000L;
extern int sin1024[];
char palette[768];
char *shiftstatus=(char *)0x0417;
int waitb()
{
if(*shiftstatus&16) setborder(0);
while(!(inp(0x3da)&8));
while((inp(0x3da)&8));
if(*shiftstatus&16) setborder(31);
return(1);
}
void line(int y,int w,int c)
{
if(w<0)
{
leftline(y,-w,c);
rightline(y,-w,c);
}
else
{
leftline(y,w,c);
rightline(y,w,c);
}
}
void doit(void)
{
int y,rot,r,ra,w,c;
int frame=0,flip=0;
rot=0; ra=0;
while(!kbhit() && frame<4444)
{
twistvram=vram;
ra++;
r=0;
for(y=0;y<200;y++)
{
w=sin1024[ ((r>>6)&511) +256]*25/64+100;
twist[y*4+0]=w;
r+=ra;
}
twister();
flip++; if(flip>1) flip=0;
switch(flip)
{
case 0 :
outp(0x3d4,0x0c);
outp(0x3d5,0x80);
frame+=waitb();
vram=vram1;
break;
case 1 :
outp(0x3d4,0x0c);
outp(0x3d5,0x00);
frame+=waitb();
vram=vram2;
break;
}
}
}
main()
{
unsigned int u,v,uc;
int a,b,x,y,xa,ya,j,k,xw,yw;
int rot=0,rsin,rcos,xwav=0,ywav=0;
dis_partstart();
_asm mov ax,13h
_asm int 10h
inittwk();
initcoppers();
memset(vram,0,64000);
for(a=0;a<256;a++)
{
b=a*3;
palette[b+0]=a/3;
palette[b+1]=a*2/3;
palette[b+2]=a;
vram[a]=a;
}
setpalarea(palette,0,256);
doit();
if(kbhit()) getch();
if(!dis_indemo())
{
_asm mov ax,3h
_asm int 10h
}
}

BIN
TWIST/MAIN.OBJ Normal file

Binary file not shown.

18
TWIST/MAKEFILE Normal file
View file

@ -0,0 +1,18 @@
all : t.exe
objs=main.obj twist.obj asm.obj ..\dis\disc.obj
asm_f = /ML /m2 /s /JJUMPS
#c_f = /AL /c /W1 /qc
c_f = /AL /c /W1 /Oxaz
.asm.obj :
tasm $(asm_f) $<
.c.obj :
cl $(c_f) $<
t.exe : $(objs)
link /E $(objs),t.exe,nul;
twist.asm : twstloop.inc

33
TWIST/SIN1024.INC Normal file
View file

@ -0,0 +1,33 @@
_sin1024 LABEL WORD
dw 0,1,3,4,6,7,9,10,12,14,15,17,18,20,21,23,25,26,28,29,31,32,34,36,37,39,40,42,43,45,46,48
dw 49,51,53,54,56,57,59,60,62,63,65,66,68,69,71,72,74,75,77,78,80,81,83,84,86,87,89,90,92,93,95,96
dw 97,99,100,102,103,105,106,108,109,110,112,113,115,116,117,119,120,122,123,124,126,127,128,130,131,132,134,135,136,138,139,140
dw 142,143,144,146,147,148,149,151,152,153,155,156,157,158,159,161,162,163,164,166,167,168,169,170,171,173,174,175,176,177,178,179
dw 181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,211
dw 212,213,214,215,216,217,217,218,219,220,221,221,222,223,224,225,225,226,227,227,228,229,230,230,231,232,232,233,234,234,235,235
dw 236,237,237,238,238,239,239,240,241,241,242,242,243,243,244,244,244,245,245,246,246,247,247,247,248,248,249,249,249,250,250,250
dw 251,251,251,251,252,252,252,252,253,253,253,253,254,254,254,254,254,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255
dw 256,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,254,254,254,254,254,253,253,253,253,252,252,252,252,251,251,251
dw 251,250,250,250,249,249,249,248,248,247,247,247,246,246,245,245,244,244,244,243,243,242,242,241,241,240,239,239,238,238,237,237
dw 236,235,235,234,234,233,232,232,231,230,230,229,228,227,227,226,225,225,224,223,222,221,221,220,219,218,217,217,216,215,214,213
dw 212,211,211,210,209,208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182
dw 181,179,178,177,176,175,174,173,171,170,169,168,167,166,164,163,162,161,159,158,157,156,155,153,152,151,149,148,147,146,144,143
dw 142,140,139,138,136,135,134,132,131,130,128,127,126,124,123,122,120,119,117,116,115,113,112,110,109,108,106,105,103,102,100,99
dw 97,96,95,93,92,90,89,87,86,84,83,81,80,78,77,75,74,72,71,69,68,66,65,63,62,60,59,57,56,54,53,51
dw 49,48,46,45,43,42,40,39,37,36,34,32,31,29,28,26,25,23,21,20,18,17,15,14,12,10,9,7,6,4,3,1
dw 0,-1,-3,-4,-6,-7,-9,-10,-12,-14,-15,-17,-18,-20,-21,-23,-25,-26,-28,-29,-31,-32,-34,-36,-37,-39,-40,-42,-43,-45,-46,-48
dw -49,-51,-53,-54,-56,-57,-59,-60,-62,-63,-65,-66,-68,-69,-71,-72,-74,-75,-77,-78,-80,-81,-83,-84,-86,-87,-89,-90,-92,-93,-95,-96
dw -97,-99,-100,-102,-103,-105,-106,-108,-109,-110,-112,-113,-115,-116,-117,-119,-120,-122,-123,-124,-126,-127,-128,-130,-131,-132,-134,-135,-136,-138,-139,-140
dw -142,-143,-144,-146,-147,-148,-149,-151,-152,-153,-155,-156,-157,-158,-159,-161,-162,-163,-164,-166,-167,-168,-169,-170,-171,-173,-174,-175,-176,-177,-178,-179
dw -181,-182,-183,-184,-185,-186,-187,-188,-189,-190,-191,-192,-193,-194,-195,-196,-197,-198,-199,-200,-201,-202,-203,-204,-205,-206,-207,-208,-209,-210,-211,-211
dw -212,-213,-214,-215,-216,-217,-217,-218,-219,-220,-221,-221,-222,-223,-224,-225,-225,-226,-227,-227,-228,-229,-230,-230,-231,-232,-232,-233,-234,-234,-235,-235
dw -236,-237,-237,-238,-238,-239,-239,-240,-241,-241,-242,-242,-243,-243,-244,-244,-244,-245,-245,-246,-246,-247,-247,-247,-248,-248,-249,-249,-249,-250,-250,-250
dw -251,-251,-251,-251,-252,-252,-252,-252,-253,-253,-253,-253,-254,-254,-254,-254,-254,-254,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255
dw -256,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-254,-254,-254,-254,-254,-254,-253,-253,-253,-253,-252,-252,-252,-252,-251,-251,-251
dw -251,-250,-250,-250,-249,-249,-249,-248,-248,-247,-247,-247,-246,-246,-245,-245,-244,-244,-244,-243,-243,-242,-242,-241,-241,-240,-239,-239,-238,-238,-237,-237
dw -236,-235,-235,-234,-234,-233,-232,-232,-231,-230,-230,-229,-228,-227,-227,-226,-225,-225,-224,-223,-222,-221,-221,-220,-219,-218,-217,-217,-216,-215,-214,-213
dw -212,-211,-211,-210,-209,-208,-207,-206,-205,-204,-203,-202,-201,-200,-199,-198,-197,-196,-195,-194,-193,-192,-191,-190,-189,-188,-187,-186,-185,-184,-183,-182
dw -181,-179,-178,-177,-176,-175,-174,-173,-171,-170,-169,-168,-167,-166,-164,-163,-162,-161,-159,-158,-157,-156,-155,-153,-152,-151,-149,-148,-147,-146,-144,-143
dw -142,-140,-139,-138,-136,-135,-134,-132,-131,-130,-128,-127,-126,-124,-123,-122,-120,-119,-117,-116,-115,-113,-112,-110,-109,-108,-106,-105,-103,-102,-100,-99
dw -97,-96,-95,-93,-92,-90,-89,-87,-86,-84,-83,-81,-80,-78,-77,-75,-74,-72,-71,-69,-68,-66,-65,-63,-62,-60,-59,-57,-56,-54,-53,-51
dw -49,-48,-46,-45,-43,-42,-40,-39,-37,-36,-34,-32,-31,-29,-28,-26,-25,-23,-21,-20,-18,-17,-15,-14,-12,-10,-9,-7,-6,-4,-3,-1

BIN
TWIST/T.EXE Normal file

Binary file not shown.

BIN
TWIST/TMP.LBM Normal file

Binary file not shown.

BIN
TWIST/TMP.UH Normal file

Binary file not shown.

49
TWIST/TWIST.ASM Normal file
View file

@ -0,0 +1,49 @@
tcode SEGMENT para public 'CODE'
ASSUME cs:tcode
.386
LOCALS
include twstloop.inc
PUBLIC _twistvram
_twistvram dw 0,0
ALIGN 16
PUBLIC _twist
_twist dw 200 dup(0,0,0,0)
PUBLIC _twister
_twister PROC FAR
push bp
mov bp,sp
push si
push di
push ds
mov ds,cs:_twistvram[2]
mov si,OFFSET _twist
xor di,di
mov cx,200
@@1: mov bx,cs:[si]
@@4: cmp bx,0
jge @@2
add bx,200
jmp @@4
@@2: cmp bx,200
jl @@3
sub bx,200
jmp @@2
@@3: shl bx,2
call cs:twistt[bx]
call cs:twistt[bx+2]
add di,80
add si,8
loop @@1
pop ds
pop di
pop si
pop bp
ret
_twister ENDP
tcode ENDS
END

BIN
TWIST/TWIST.OBJ Normal file

Binary file not shown.

11752
TWIST/TWSTLOOP.INC Normal file

File diff suppressed because it is too large Load diff