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

59
GLENZ/ADATA.ASM Normal file
View file

@ -0,0 +1,59 @@
PUBLIC newdata1
data_new1 SEGMENT para public 'FARDATA'
newdata1 db 0fff0h dup(0)
data_new1 ENDS
PUBLIC background,_background
data_new2 SEGMENT para public 'FARDATA'
_background LABEL BYTE
background db 0fff0h dup(0)
data_new2 ENDS
data_v SEGMENT para public 'DATA'
PUBLIC rows
rows dw 512 dup(0)
PUBLIC wminx,wminy,wmaxx,wmaxy
wminx dw 0
wminy dw 0
wmaxx dw 100
wmaxy dw 100
PUBLIC video,vram,rowsadd,framerate10,truevram,truerowsadd
video dd 16 dup(0) ;far offsets to vid routines
vram dw 0
rowsadd dw 0
framerate10 dw 0
truevram dw 0
truerowsadd dw 0
ALIGN 4
PUBLIC projxmul,projymul,projxadd,projyadd,projminz,projminzshr
projxmul dd 0
projymul dd 0
projxadd dw 0
projyadd dw 0
projminz dd 0
projminzshr dw 0
PUBLIC color,color1,color2
color LABEL WORD
color1 db 0
color2 db 0
ALIGN 4
PUBLIC xadd,yadd,zadd
xadd dd 0
yadd dd 0
zadd dd 0
ALIGN 16 ;TEMPORARY WORK AREA FOR:
PUBLIC borders
borders LABEL WORD ;polygon drawing
db 8192 dup(0)
workoverflow dw 00fch
data_v ENDS
END

30
GLENZ/ADATA.INC Normal file
View file

@ -0,0 +1,30 @@
extrn newdata1:word
;extrn newdata2:word
extrn background:word
extrn projxmul:dword
extrn projymul:dword
extrn projxadd:word
extrn projyadd:word
extrn projminz:dword
extrn projminzshr:word
extrn wminx:word
extrn wminy:word
extrn wmaxx:word
extrn wmaxy:word
extrn vram:word
extrn rowsadd:word
extrn truerowsadd:word
extrn truevram:word
extrn rows:word
extrn framerate10:word
extrn color:word
extrn color1:byte
extrn color2:byte
extrn video:dword
extrn borders:word
extrn xadd:dword
extrn yadd:dword
extrn zadd:dword

BIN
GLENZ/ADATA.OBJ Normal file

Binary file not shown.

5
GLENZ/AOBJ.INC Normal file
View file

@ -0,0 +1,5 @@
vobj struc
xyz dd 3 dup(0)
matrix dw 9 dup(0)
element dd 0
vobj ends

545
GLENZ/ASM.A Normal file
View file

@ -0,0 +1,545 @@
;FIND "386opt" TO FIND OPTIMIZABLE PLACES NOTED
include clink.inc
extrn _everyframe:far
extrn _fromasmdraw:far
extrn _toasmdraw:far
;----------------------------------------------------------------
data_seg SEGMENT para public 'DATA'
public sintable16
public costable16
public tantable32
include calcsin.inc
public _splinecoef
_splinecoef LABEL WORD
include spline.inc
ALIGN 16 ;temporary working area, used by:
;- polyn() for scanline min/mix storage
public workarea
public borders
workarea LABEL WORD
borders LABEL WORD ;should be enough for 680 normal hlines in group
db 8192 dup(0)
workareaoverflow dw 012fch
data_seg ENDS
;----------------------------------------------------------------
extrn _worldroot
asm_objs SEGMENT para public 'DATA'
;contents in obj.asm
asm_objs ENDS
asm_text SEGMENT para public 'CODE'
ASSUME cs:asm_text
ASSUME gs:data_seg ;when data used, generally in gs
.386
;****************************************************************
;PUBLICS
;****************************************************************
PUBLIC _asminit,_asmdeinit,_asm,_asmclear
PUBLIC _testinit
PUBLIC _setborder
PUBLIC _borders
PUBLIC _autofly
PUBLIC _horizon
;****************************************************************
;GLOBAL VARIABLES
;****************************************************************
MAXY equ 159
MAXX equ 319
;vector window coordinates (for clipping)
public _vecwindow
_vecwindow label word
WMINX dw 4
WMINY dw 4
WMAXX dw 315
WMAXY dw 155
videot LABEL WORD
dw OFFSET v320x200x256
dw OFFSET v320x240x256
dw OFFSET v320x350x256
dw OFFSET v320x350x256unr
dw OFFSET vtseng640x400x256
dw OFFSET valien ;5
video LABEL WORD
vvinit = cs:video[0]
dw 0 ;init screen
vvswitch = cs:video[2]
dw 0 ;switch pages
vvclear = cs:video[4]
dw 0 ;clear
;all following gfx routines require:
;es=vram; OUT 3C4,2
vvpset = cs:video[6]
dw 0 ;pset (DX,BX),CS:COLOR - plot a plot. Saves DS:SI/CX
vvlineto = cs:video[8]
dw 0 ;lineto - (CX,AX)->(DX,BX),CS:COLOR - draw a line - OPTIMIZE ME!-)
vvhline = cs:video[10]
dw 0 ;hline - (AX,BX)->(DX,BX),CS:COLOR - draw a horizontal line
vvhlinegroup = cs:video[12]
dw 0 ;hlinegroup - GS:SI->list of hlines:
;word:start row
;REPT
;word:X1 (-32767=end of list)
;word:X2
;ENDM
vvthlinegroup = cs:video[14]
dw 0 ;thlinegroup - GS:SI->list of hline, FS=texture segment
;word:start row
;REPT
;word:X1 (-32767=end of list)
;word:X2
;word:TextureX1Y1
;word:TextureX2Y2
;ENDM
video9 LABEL WORD
public _framebuf ;used by nrm modes (=>vram)
_framebuf dw 0,0
PUBLIC _framemul
_framemul dw 0
supervga db 1
db 0
ALIGN 4
rows dw 512 dup(0)
rowsadd dw 0
truerowsadd dw 0
vecvram dw ? ;used by vector drawer
public _asmvramseg
_asmvramseg LABEL WORD
truevram dw ?
vram dw 0a5f0h ;-"- old
PUBLIC _texture
_texture dw 0,0
color LABEL WORD
color1 db 0
color2 db 0
colorl dw 0
PUBLIC _asmexit
_asmexit db 0
fatalss dw 0
fatalsp dw 0
PUBLIC _inunreal
_inunreal db 0
PUBLIC _framestaken
_framestaken dw 0
PUBLIC _subpart
_subpart db 2
PUBLIC _wireframe,_nohidden,_curlist
_wireframe db 0
_nohidden db 0
_curlist dw 0
PUBLIC _mousedotx,_mousedoty
PUBLIC _mouse0dotx,_mouse0doty
_mousedotx dw 160
_mousedoty dw 80
_mouse0dotx dw 160
_mouse0doty dw 80
public _font3x5
_font3x5 dw 0,0
_horizon dw 0,0
_horizonenabled db 1
nowaitborder db 0
_borders db 0 ;1=show bordertimings
_autofly db 0
ALIGN 2
dataseg dw data_seg
cdataseg dw 0 ;DS of the C routines
public _depthtable
_depthtable dw 0
depthseg dw 0
public _asmdebugmode,_asmvideomode
_asmvideomode dw 0
_asmdebugmode dw 0
public _debugw
;****************************************************************
;SCREEN ROUTINES:
;waitborder
;LOW LEVEL ROUTINES:
;hline1 (AX,BX)-(DX,BX), color REQ: color1=color2, ds=cs,
; es=vram, OUT 3C4,2, EAXhi=0
;pset (DX,BX), color REQ: ds=cs, es=vram, OUT 3C4,2
;?line (DX,BX), color
;****************************************************************
include vid.asm
;INITIALIZATION ROUTINES & COPPER EMULATION:
include copper.asm ;calls copper_doit() every frame
.386 ;for copper.asm sets .286
;****************************************************************
;POLYGONS: call poly
;polygon with 1 sides is a dot
;polygon with 2 sides is a line
;following variables must be set (used as parameters)
;****************************************************************
include poly.asm
;****************************************************************
;VECTOR ROUTINES:
;doobject
;MACRO sinbx2ax ;ax=sin(bx) req: ds=cs
;MACRO cosbx2ax ;ax=cos(bx) req: ds=cs
;****************************************************************
include calc.asm
include spline.asm
include vec.asm
include matrix.asm
include horiz.asm
;****************************************************************
;(OBJECT) MEMORY MANAGEMENT
;****************************************************************
include omem.asm
;****************************************************************
;C-interface
;****************************************************************
copper_doit PROC NEAR
;called every frame by copper, must save all but AX/BX/CX/DX
sti
pushad
push ds
push es
;call dos timer
pushf
call cs:oldint8 ;from copper
mov ds,cs:cdataseg
cmp cs:_inunreal,0
je nodoni
mov ah,9
int 60h ;musicmixer
nodoni: ;call _everyframe ;if uses scrn, should restore all VGA regs
pop es
pop ds
popad
cli
ret
copper_doit ENDP
_testinit PROC FAR
CBEG
CEND
_testinit ENDP
_asmclear PROC FAR
CBEG
call vvclear
CEND
_asmclear ENDP
ALIGN 2
INTER equ 0h
oldint dd ?
_asminit PROC FAR
CBEG
mov cs:cdataseg,ds
;
mov si,cs:_asmvideomode
shl si,1
mov si,cs:videot[si]
mov di,OFFSET video
cld
mov ax,cs
mov ds,ax
mov es,ax
mov cx,(video9-video)/2
rep movsw
;
call vvinit
call vvclear
call vvswitch
cmp cs:_asmdebugmode,0
je noadm
call tweak320x200
noadm:
cli
mov ax,0
mov es,ax
mov ax,es:[INTER*4]
mov WORD PTR cs:[oldint+0],ax
mov ax,es:[INTER*4+2]
mov WORD PTR cs:[oldint+0+2],ax
mov ax,OFFSET intti
mov es:[INTER*4],ax
mov word ptr es:[INTER*4+2],cs
sti
call clearpal
;call testmem
CEND
_asminit ENDP
_asmdeinit PROC FAR
CBEG
cli
mov ax,0
mov es,ax
mov ax,WORD PTR cs:[oldint+0]
mov es:[INTER*4],ax
mov ax,WORD PTR cs:[oldint+0+2]
mov es:[INTER*4+2],ax
sti
;mov ax,3
;int 10h
CEND
_asmdeinit ENDP
m_diverror db 'FATAL: divide overflow',0
m_workflow db 'FATAL: work area overflow',0
m_oldpoly db 'FATAL: old style polygons no longer supported',0
m_outofvx db 'FATAL: too many vertices in object',0
m_press db ' Press ESC to return to dos ',0
dosmsgp dw 0
dosmsg PROC NEAR
mov ax,cs
mov ds,ax
mov ax,0b800h
mov es,ax
mov di,ds:dosmsgp
mov ah,4eh
doe2: lodsb
cmp al,0
je doe1
stosw
jmp doe2
doe1: add ds:dosmsgp,di
ret
dosmsg ENDP
intti PROC FAR
;DIVIDE OVERFLOW
sti
mov si,OFFSET m_diverror
jmp fatalexit
fatalexit:
mov ax,3
int 10h
call dosmsg
mov si,OFFSET m_press
call dosmsg
iiia: mov ax,0
int 16h
cmp al,27
jne iiia
mov cs:_asmexit,1
mov ss,cs:fatalss
mov sp,cs:fatalsp
CEND
intti ENDP
public _camera,_tmpxyz
_camera LABEL WORD
dd 0
dd 0
dd 0
dw ?,?,?
dw 0
dw 0
dw 0
_tmpxyz dd -200000000,0,0
lastcoppercount dw 0
clearit dw 1
PUBLIC _doclear
_doclear PROC FAR
CBEG
call doclear
CEND
_doclear ENDP
doclear PROC NEAR
ret
mov dx,3c4h
mov ax,0f02h
out dx,ax
xor di,di
mov ax,0a000h
mov es,ax
mov cx,65535
xor ax,ax
doc1: mov es:[di],al
nop
inc di
loop doc1
ret
doclear ENDP
_asm PROC FAR
CBEG
mov cs:fatalss,ss
mov cs:fatalsp,sp
sti
cmp cs:_asmvideomode,5
je nothis1
mov ds,cs:cdataseg
call _toasmdraw
nothis1:
call cs:video[2] ;switchpages, returns cs:vram
mov ax,cs:vram
mov cs:vecvram,ax
;mov ax,cs:vram
;add ax,02dh ;add 8 rows
;mov ax,asm_framebuf
;mov ax,asm_framebuf
;mov cs:vecvram,ax
;mov ax,0a000h
;mov cs:vram,ax
cmp cs:nowaitborder,0
jne asm1b
cmp cs:_inunreal,0
je asmnormal
;waitborder with copper
asm2: mov ah,10
int 60h
cmp ax,cs:lastcoppercount
je asm2
asm1: mov bx,ax
sub bx,cs:lastcoppercount
mov cs:_framestaken,bx
mov cs:lastcoppercount,ax
jmp asmunr
asmnormal:
;waitborder with copper
asm2b: mov ax,cs:coppercount
cmp ax,cs:lastcoppercount
je asm2b
asm1b: mov bx,ax
sub bx,cs:lastcoppercount
mov cs:_framestaken,bx
mov cs:lastcoppercount,ax
asmunr: setborder 1
;mov cs:color,0000h
;call vecclearscreen
;enable all planes for debugdots
mov dx,3c4h
mov ax,0f02h
out dx,ax
;do the vecs
;call dofirstnew
setborder 2
call dofirstnrs
setborder 0
;do the mousedot
IFDEF MOUSEDOT
mov dx,3c4h
mov al,2
out dx,al
mov ax,cs:vecvram
mov es,ax
mov ax,cs
mov ds,ax
mov dx,cs:_mouse0dotx
mov bx,cs:_mouse0doty
mov cs:color1,15
call pset1
mov dx,cs:_mousedotx
mov bx,cs:_mousedoty
mov cs:color1,14
call pset1
ENDIF
;check workareaoverflow
mov gs,cs:dataseg
cmp gs:workareaoverflow,012fch
je workok
mov si,OFFSET m_workflow
jmp fatalexit
workok: ;done
cmp cs:_asmvideomode,5
je nothis2
mov ds,cs:cdataseg
call _fromasmdraw
nothis2:
CEND
_asm ENDP
public _softice
_softice PROC FAR
CBEG
mov ah,9
mov al,11h
mov si,'FG'
mov di,'JM'
movpar ds,1
movpar dx,0
int 3
CEND
_softice ENDP
copybmap PROC NEAR
;enable all planes for debugdots
mov ax,OFFSET cbj2
mov cs:bmapjmp,ax
mov bx,cs:bmapwid
shr bx,1
cbm3: mov cs:bmapdi,di
mov dx,3c4h
mov ax,0102h
cbm4: push ax
push si
out dx,ax
mov cx,bx
jmp cs:bmapjmp
cbmb: mov di,cs:bmapdi
pop si
pop ax
shl ah,1
add si,80
cmp ah,16
jb cbm4
sub si,320
ret
cbj1: rep movsw
jmp cbmb
cbj2: movsb
dec cx
rep movsw
movsb
jmp cbmb
cbj3: rep movsw
movsb
jmp cbmb
cbj4: movsb
rep movsw
jmp cbmb
copybmap ENDP
.8086
asm_text ENDS
END

152
GLENZ/ASM.ASM Normal file
View file

@ -0,0 +1,152 @@
include asm.inc
text__asm SEGMENT para public 'CODE'
ASSUME cs:text__asm
.386
tmp1 dw 0
tmp2 dw 0
PUBLIC _testpset
_testpset PROC FAR
CBEG
LOADDS
mov dx,3c4h
mov al,2
out dx,al
mov es,ds:vram
mov ax,[bp+10]
mov ds:color,ax
mov bx,[bp+8]
mov dx,[bp+6]
call VIDPSET
CEND
_testpset ENDP
PUBLIC _testline
_testline PROC FAR
CBEG
LOADDS
mov es,ds:vram
mov ax,[bp+14]
mov ds:color,ax
mov ax,[bp+12]
mov cx,[bp+10]
mov bx,[bp+8]
mov dx,[bp+6]
call VIDLINE
CEND
_testline ENDP
PUBLIC _testasm
_testasm PROC FAR
CBEG
LOADDS
mov si,OFFSET video
mov ax,0
call setvmode
call VIDINIT
CEND
CBEG
LOADDS
setborder 0
mov si,OFFSET video
mov ax,0
call setvmode
call VIDINIT
;call VIDSWITCH
;call VIDCLEAR64
mov ax,13h
int 10h
;
mov dx,3c8h
mov al,0
out dx,al
inc dx
xor al,al
out dx,al
out dx,al
out dx,al
mov al,11
mov cx,255
@@1: out dx,al
out dx,al
out dx,al
inc al
loop @@1
call VIDSWITCH
push ds:vram
call VIDSWITCH
pop ds:vram
mov ax,13h
int 10h
CEND
LOADDS
mov ds:color1,60
@@aga: LOADDS
call VIDSWITCH
mov dx,3c4h
mov al,2
out dx,al
add ds:color,1
add cs:tmp1,3
add cs:tmp2,4
mov cx,0
mov ax,cs:tmp1
shr ax,2
and ax,255
mov dx,cs:tmp2
shr dx,2
and dx,255
mov bx,199
mov es,ds:vram
call VIDLINE
mov ah,1
mov ax,3
int 10h
CEND
_testasm ENDP
PUBLIC _asmtestmode
_asmtestmode db 0
PUBLIC _asm
_asm PROC FAR
CBEG
LOADDS
push word ptr [bp+6]
push word ptr [bp+8]
cmp cs:_asmtestmode,0
je @@1
@@2: setborder 0
call VIDWAITB
call VIDWAITB
call VIDWAITB
mov ax,0a000h
mov es,ax
mov cx,32000
xor ax,ax
rep stosw
pop es
pop di
CEND
@@1: setborder 0
call VIDWAITB
pop es
pop di
CEND
_asm ENDP
text__asm ENDS
END

61
GLENZ/ASM.INC Normal file
View file

@ -0,0 +1,61 @@
include adata.inc
include aobj.inc
INT3 MACRO
int 3
ENDM
LOADDS MACRO
mov ax,SEG rows
mov ds,ax
ENDM
LOADGS MACRO
mov ax,SEG rows
mov gs,ax
ENDM
movpar MACRO reg,par ;loads parameter [par(0..)] to register [reg]
mov reg,word ptr [bp+par*2+6]
ENDM
CBEG MACRO ;C/Assembler procedure begin
push bp
mov bp,sp
push si
push di
push ds
ENDM
CEND MACRO ;C/Assembler procedure end
pop ds
pop di
pop si
pop bp
ret
ENDM
setborder MACRO col
mov al,col
push ax
; call _setborder
add sp,2
ENDM
LOCALS
;VID.ASM
global setvmode:far
global _setborder:far
VIDINIT equ ds:video[0]
VIDSWITCH equ ds:video[4]
VIDCLEAR64 equ ds:video[8]
VIDPSET equ ds:video[12]
VIDLINE equ ds:video[16]
VIDHLINE equ ds:video[20]
VIDHGROUP equ ds:video[24]
VIDTHGROUP equ ds:video[28]
VIDPOLYGROUP equ ds:video[32]
VIDCLEAR equ ds:video[36]
VIDWAITB equ ds:video[40]
VIDNEWPOLYGROUP equ ds:video[44]

BIN
GLENZ/ASM.OBJ Normal file

Binary file not shown.

1
GLENZ/BACKX.BAT Normal file
View file

@ -0,0 +1 @@
pkzip %1 %2 -Pr -x*.exe -x*.obj -x*.~* -x*.ob

37
GLENZ/DEMO1.CUT Normal file
View file

@ -0,0 +1,37 @@
mov ax,es:[bx-2]
xor ax,8000h
test ax,4000h
jz @@5
mov dl,al
and dl,1
shl dl,5
mov al,dl
@@5: mov es:[bx-2],ax
@@7: pop ax
;lightsource
;push es
;push bx
;mov bx,0a000h
;mov es,bx
;mov bx,ax
;sar bx,8
;add bx,320
;inc byte ptr es:[bx]
;pop bx
;pop es
mov cl,cs:_lightshift
shrd ax,dx,cl
cmp ax,0
jge @@s1
mov ax,0
@@s1: cmp ax,15
jle @@s2
mov ax,15
@@s2: ;mov dx,15
;sub dx,ax
mov dx,ax
; mov ax,es:[bx-2]
; and ax,not 15
; or ax,dx
; mov es:[bx-2],ax
ret

32
GLENZ/DOC Normal file
View file

@ -0,0 +1,32 @@
pointlist:
word points in list
word -
dword x,y,z
...
projectedpointlist:
word points in list
word -
.
word sx
word sy
word fl
word -
dword z
polygroup:
word sides (0=end)
word color
word x,y
...
edgelist:
word edges
word -
.
word v1,v2,f,0 f&8000:hidden edge
hline list:
word starty
...
word x1(-32767=end),x2

123
GLENZ/DOLOOP.C Normal file
View file

@ -0,0 +1,123 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <stdarg.h>
#define MAXZOOM 340
#define MINZOOM 160
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("zoomloop.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
GLENZ/DOLOOP.EXE Normal file

Binary file not shown.

BIN
GLENZ/DP_PREFS Normal file

Binary file not shown.

176
GLENZ/EDGE.BBK Normal file
View file

@ -0,0 +1,176 @@
#include <stdio.h>
#include <graph.h>
char far *vram=(char far *)0xa0000000L;
int edge[256];
int ep[200];
int ec;
struct
{
int c,next;
int y1,y2;
long x1,x; // x used, x1=original
long dx;
} e[256];
int list[256],listc;
unsigned draworders[32000],dop;
void pass3(void)
{
unsigned int u,ut,i,c;
for(i=c=u=0;i<dop;i+=2)
{
ut=draworders[i+0];
while(u<ut) vram[u++]=c;
c^=draworders[i+1];
}
#if 0
{
for(u=0;u<64000;u+=320)
{
c=0;
for(x=0;x<320;x++)
{
c^=vram[x+u]&0x7;
vram[x+u]=c;
}
}
}
#endif
}
void pass2(void)
{
int j,k,i,y,c;
long x,lx;
listc=0;
dop=0;
for(y=0;y<200;y++)
{
// add new ones this row
i=ep[y];
while(i)
{
list[listc++]=i;
e[i].x=e[i].x1;
i=e[i].next;
}
// sort list
for(k=1;k<listc;k++)
{
x=e[i=list[k]].x;
for(j=k-1;j>=0 && x<e[list[j]].x;j--)
list[j+1]=list[j];
list[j+1]=i;
}
// do list & kill completed ones
for(k=j=0;j<listc;j++)
{
i=list[j];
if(y>=e[i].y2) continue;
if(k!=j) list[k]=i;
k++;
x=e[i].x;
if(lx==x) draworders[dop-1]^=e[i].c;
else
{
draworders[dop++]=y*320+(lx=(e[i].x>>16));
draworders[dop++]=e[i].c;
}
//vram[(e[i].x>>16)+y*320]=k; // e[i].c;
e[i].x+=e[i].dx;
}
listc=k;
}
printf("%i\n",dop);
}
void pass1(int *edge)
{
int dy,y1,y2,x1,x2,a;
ec=1; memset(ep,0,200*2);
while(*edge!=0x8000)
{
e[ec].c=edge[0];
y1=edge[3];
y2=edge[5];
if(y1>y2)
{
x1=y1; y1=y2; y2=x1; // y1<=>y2
x1=edge[4];
x2=edge[2];
}
else
{
x1=edge[2];
x2=edge[4];
}
e[ec].x1=(long)x1<<16;
e[ec].dx=((long)(x2-x1)<<16)/(y2-y1);
// if y1<0 clip
e[ec].y1=y1;
e[ec].y2=y2;
if(a=ep[y1])
{ // add
ep[y1]=ec;
e[ec].next=a;
}
else
{ // first
ep[y1]=ec;
e[ec].next=0;
}
#if 0
_setcolor(8);
_moveto(0,y1);
_lineto(319,y1);
_setcolor(15);
_setpixel(x1,y1);
#endif
ec++;
edge+=6;
}
}
main()
{
int a,b,c,x,y;
_setvideomode(_MRES256COLOR);
x=100; y=100; for(a=0;a<60;a++) rand();
for(a=b=0;a<8;a++)
{
edge[b++]=2; // color
b++;
edge[b++]=x; // X1
edge[b++]=y; // Y1
x=edge[b++]=rand()%320; // X2
y=edge[b++]=rand()%200; // Y2
}
edge[b++]=2; // color
b++;
edge[b++]=x; // X1
edge[b++]=y; // Y1
edge[b++]=100; // X2
edge[b++]=100; // Y2
edge[b++]=0x8000; // end of list
#if 0
_setcolor(8);
for(b=0;edge[b]!=0x8000;b+=6)
{
_moveto(edge[b+2],edge[b+3]);
_lineto(edge[b+4],edge[b+5]);
}
#endif
pass1(edge);
//getch();
pass2();
getch();
pass3();
getch();
_setvideomode(_DEFAULTMODE);
}

159
GLENZ/EDGE.C Normal file
View file

@ -0,0 +1,159 @@
#include <stdio.h>
#include <graph.h>
char far *vram=(char far *)0xa0000000L;
int edge[512];
int ep[200];
int ec;
struct
{
int c,next;
int y1,y2;
long x1,x; // x used, x1=original
long dx;
} e[256];
int list[256],listc;
unsigned draworders[32000],dop;
void pass3(void)
{
unsigned int u,ut,i,c;
for(i=c=u=0;i<dop;i+=2)
{
ut=draworders[i+0];
while(u<ut) vram[u++]=c;
c^=draworders[i+1];
}
}
void pass2(void)
{
int j,k,i,y,c;
long x,lx;
listc=0;
dop=0;
for(y=0;y<200;y++)
{
// add new ones this row
i=ep[y];
while(i)
{
list[listc++]=i;
e[i].x=e[i].x1;
i=e[i].next;
}
// sort list
for(k=1;k<listc;k++)
{
x=e[i=list[k]].x;
for(j=k-1;j>=0 && x<e[list[j]].x;j--)
list[j+1]=list[j];
list[j+1]=i;
}
// do list & kill completed ones
for(k=j=0;j<listc;j++)
{
i=list[j];
if(y>=e[i].y2) continue;
if(k!=j) list[k]=i;
k++;
x=e[i].x;
if(lx==x) draworders[dop-1]^=e[i].c;
else
{
draworders[dop++]=y*320+(lx=(e[i].x>>16));
draworders[dop++]=e[i].c;
}
vram[(e[i].x>>16)+y*320]=e[i].c;
e[i].x+=e[i].dx;
}
listc=k;
}
}
void pass1(int *edge)
{
int dy,y1,y2,x1,x2,a;
ec=1; memset(ep,0,200*2);
while(*edge!=0x8000)
{
e[ec].c=edge[0];
y1=edge[3];
y2=edge[5];
if(y1>y2)
{
x1=y1; y1=y2; y2=x1; // y1<=>y2
x1=edge[4];
x2=edge[2];
}
else
{
x1=edge[2];
x2=edge[4];
}
e[ec].x1=(long)x1<<16;
e[ec].dx=((long)(x2-x1)<<16)/(y2-y1);
// if y1<0 clip
e[ec].y1=y1;
e[ec].y2=y2;
if(a=ep[y1])
{ // add
ep[y1]=ec;
e[ec].next=a;
}
else
{ // first
ep[y1]=ec;
e[ec].next=0;
}
ec++;
edge+=6;
}
}
main()
{
int a,b,c,x,y;
_setvideomode(_MRES256COLOR);
for(a=0;a<60;a++) rand();
b=0;
for(c=1;c<=4;c<<=1)
{
x=100+c*10; y=100+c*10;
for(a=0;a<8;a++)
{
edge[b++]=c; // color
b++;
edge[b++]=x; // X1
edge[b++]=y; // Y1
x=edge[b++]=rand()%320; // X2
y=edge[b++]=rand()%200; // Y2
}
edge[b++]=c; // color
b++;
edge[b++]=x; // X1
edge[b++]=y; // Y1
edge[b++]=100+c*10; // X2
edge[b++]=100+c*10; // Y2
}
edge[b++]=0x8000; // end of list
#if 0
_setcolor(8);
for(b=0;edge[b]!=0x8000;b+=6)
{
_moveto(edge[b+2],edge[b+3]);
_lineto(edge[b+4],edge[b+5]);
}
#endif
pass1(edge);
pass2();
getch();
pass3();
getch();
_setvideomode(_DEFAULTMODE);
}

BIN
GLENZ/EDGE.EXE Normal file

Binary file not shown.

BIN
GLENZ/EYE4.UH Normal file

Binary file not shown.

BIN
GLENZ/FC.BBK Normal file

Binary file not shown.

BIN
GLENZ/FC.LBM Normal file

Binary file not shown.

BIN
GLENZ/FC.UH Normal file

Binary file not shown.

BIN
GLENZ/FCX.LBM Normal file

Binary file not shown.

3
GLENZ/G.BAT Normal file
View file

@ -0,0 +1,3 @@
echo off
..\beg\beg
v

BIN
GLENZ/GL10.LIB Normal file

Binary file not shown.

14
GLENZ/KOE.C Normal file
View file

@ -0,0 +1,14 @@
main()
{
int a=0;
_asm mov ax,13h
_asm int 10h
while(!kbhit())
{
printf(".");
while(!(inp(0x3da)&8));
printf(".");
while((inp(0x3da)&8));
printf("%i\r",a++);
}
}

BIN
GLENZ/KOE.EXE Normal file

Binary file not shown.

241
GLENZ/MAIN.1 Normal file
View file

@ -0,0 +1,241 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
char far *vram=(char far *)0xa0000000L;
extern char lightshift;
extern int _ndebug1;
extern char asmtestmode;
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
extern int ceasypolylist(int *polylist,int *polys,long *points3);
long cubepoints[]={8,
-666,-666,-666,
666,-666,-666,
666,666,-666,
-666,666,-666,
-666,-666,666,
666,-666,666,
666,666,666,
-666,666,666
};
int cubeepolys[]={
4,0x4002,0,1,2,3,
4,0x4004,4,5,6,7,
4,0x4006,0,1,5,4,
4,0x4008,1,2,6,5,
4,0x4003,2,3,7,6,
4,0x4005,3,0,4,7,
0};
long points[64]={14,
-1000,-1000,-1000,
1000,-1000,-1000,
1000,1000,-1000,
-1000,1000,-1000,
-1000,-1000,1000,
1000,-1000,1000,
1000,1000,1000,
-1000,1000,1000,
0,0,-1700,
0,0,1700,
1700,0,0,
-1700,0,0,
0,1700,0,
0,-1700,0};
long points2[256];
int points3[256*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x4010,0,1,2,3,
4,0x4008,0,8,4,9,
4,0x4010,1,9,5,10,
4,0x4020,2,10,6,11,
4,0x4040,3,11,7,12,
4,0x4080,4,5,6,7,
0};
int epolys[]={
3,0x4010,0,1,8,
3,0x4020,1,2,8,
3,0x4010,2,3,8,
3,0x4020,3,0,8,
3,0x4010,2,1,10,
3,0x4020,1,5,10,
3,0x4010,5,6,10,
3,0x4020,6,2,10,
3,0x4010,2,6,12,
3,0x4020,6,7,12,
3,0x4010,7,3,12,
3,0x4020,3,2,12,
3,0x4010,0,3,11,
3,0x4020,3,7,11,
3,0x4010,7,4,11,
3,0x4020,4,0,11,
3,0x4010,5,1,13,
3,0x4020,1,0,13,
3,0x4010,0,4,13,
3,0x4020,4,5,13,
3,0x4010,5,4,9,
3,0x4020,4,7,9,
3,0x4010,7,6,9,
3,0x4020,6,5,9,
0};
int polylist[256];
int matrix[9];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2,r,g,zpos=7000;
testasm();
//initnewgroup();
outp(0x3c8,0);
for(a=0;a<256;a++)
{
r=g=b=0;
c=16+(a&15)*3;
if(a&0x10) { b+=40*c/64; }
if(a&0x20) { r+=50*c/64; g+=50*c/64; b+=50*c/64; }
if(a&0x40) { b+=10; }
if(a&0x80) { r+=10; g+=10; b+=20; }
if(a==1) { r=60; g=0; b=0; }
if(a==2) { r=0; g=60; b=0; }
if(a==3) { r=0; g=0; b=60; }
if(a==4) { r=50; g=50; b=50; }
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
outp(0x3c9,r);
outp(0x3c9,g);
outp(0x3c9,b);
}
outp(0x3c8,7);
outp(0x3c9,40);
outp(0x3c9,40);
outp(0x3c9,40);
for(a=0;a<256;a++) vram[a]=a;
lightshift=8;
for(;;)
{
if(kbhit())
{
a=getch();
if(a==27) break;
if(a=='l') lightshift=2;
if(a=='+') zpos+=200;
if(a=='-') zpos-=200;
if(a=='<') lightshift--;
if(a=='>') lightshift++;
if(a=='t') asmtestmode=1;
if(a=='c') { if(zpos==3200) { lightshift=8; zpos=7000; } else { zpos=3200; lightshift=11; } }
}
asm();
setborder(1);
rx+=16; ry+=15; rz+=7;
rx%=3600; ry%=3600; rz%=3600;
//if(rz==0) printf(".");
/*
a=0;
while(polylist[a])
{
a+=polylist[a]*2+2;
}
polylist[a++]=4;
polylist[a++]=19;
polylist[a++]=160-60; polylist[a++]=100-40;
polylist[a++]=160+60; polylist[a++]=100-40;
polylist[a++]=160+60; polylist[a++]=100+40;
polylist[a++]=160-60; polylist[a++]=100+40;
polylist[a++]=0;
*/
cglenzinit();
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,zpos);
points2[0]=0; crotlist(points2,points);
//cclipedges(edges2,edges,points2);
points3[0]=0; cprojlist((long *)points3,points2);
//cpolylist(polylist,polys,edges,points3);
ceasypolylist(polylist,epolys,points3);
cglenzpolylist(polylist);
cmatrix_yxz(rx*2,-ry,rz*2,matrix);
csetmatrix(matrix,0,0,zpos);
points2[0]=0; crotlist(points2,cubepoints);
points3[0]=0; cprojlist((long *)points3,points2);
ceasypolylist(polylist,cubeepolys,points3);
cglenzpolylist(polylist);
cglenzdone();
//cdrawpolylist(polylist);
//cdrawpolylist(testlist);
//setborder(3);
//drawnewgroup();
#if 0
n=edges[0];
for(a=2,b=0;b<n;b++)
{
p1=edges[a++];
p2=edges[a++];
a+=2;
testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
}
#endif
}
_asm mov ax,3
_asm int 10h
#if 0
for(a=0;a<100;)
{
b=polylist[a++];
c=polylist[a++];
if(!b) break;
printf("s:%i c:%i v:",b,c);
for(x=0;x<b;x++)
{
printf("%i,%i ",polylist[a+0],polylist[a+1]);
a+=2;
}
printf("\n");
}
printf("points2: %Fp\n",points2);
#endif
printf("Z:%i LS:%i \n",zpos,lightshift);
}

294
GLENZ/MAIN.2 Normal file
View file

@ -0,0 +1,294 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
char far *vram=(char far *)0xa0000000L;
extern char lightshift;
extern int _ndebug1;
extern char asmtestmode;
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
extern int ceasypolylist(int *polylist,int *polys,long *points3);
long cubepoints[]={8,
-666,-666,-666,
666,-666,-666,
666,666,-666,
-666,666,-666,
-666,-666,666,
666,-666,666,
666,666,666,
-666,666,666
};
int cubeepolys[]={
4,0x4002,0,1,2,3,
4,0x4004,4,5,6,7,
4,0x4006,0,1,5,4,
4,0x4008,1,2,6,5,
4,0x4003,2,3,7,6,
4,0x4005,3,0,4,7,
0};
long points[64]={14,
-1000,-1000,-1000,
1000,-1000,-1000,
1000,1000,-1000,
-1000,1000,-1000,
-1000,-1000,1000,
1000,-1000,1000,
1000,1000,1000,
-1000,1000,1000,
0,0,-1700,
0,0,1700,
1700,0,0,
-1700,0,0,
0,1700,0,
0,-1700,0};
long pointsb[64]={14,
-600,-600,-600,
600,-600,-600,
600,600,-600,
-600,600,-600,
-600,-600,600,
600,-600,600,
600,600,600,
-600,600,600,
0,0,-900,
0,0,900,
900,0,0,
-900,0,0,
0,900,0,
0,-900,0};
long points2[256];
int points3[256*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x4010,0,1,2,3,
4,0x4008,0,8,4,9,
4,0x4010,1,9,5,10,
4,0x4020,2,10,6,11,
4,0x4040,3,11,7,12,
4,0x4080,4,5,6,7,
0};
int epolys[]={
3,0x4010,0,1,8,
3,0x4020,1,2,8,
3,0x4010,2,3,8,
3,0x4020,3,0,8,
3,0x4010,2,1,10,
3,0x4020,1,5,10,
3,0x4010,5,6,10,
3,0x4020,6,2,10,
3,0x4010,2,6,12,
3,0x4020,6,7,12,
3,0x4010,7,3,12,
3,0x4020,3,2,12,
3,0x4010,0,3,11,
3,0x4020,3,7,11,
3,0x4010,7,4,11,
3,0x4020,4,0,11,
3,0x4010,5,1,13,
3,0x4020,1,0,13,
3,0x4010,0,4,13,
3,0x4020,4,5,13,
3,0x4010,5,4,9,
3,0x4020,4,7,9,
3,0x4010,7,6,9,
3,0x4020,6,5,9,
0};
int epolysb[]={
3,0x4001,0,1,8,
3,0x4002,1,2,8,
3,0x4001,2,3,8,
3,0x4002,3,0,8,
3,0x4001,2,1,10,
3,0x4002,1,5,10,
3,0x4001,5,6,10,
3,0x4002,6,2,10,
3,0x4001,2,6,12,
3,0x4002,6,7,12,
3,0x4001,7,3,12,
3,0x4002,3,2,12,
3,0x4001,0,3,11,
3,0x4002,3,7,11,
3,0x4001,7,4,11,
3,0x4002,4,0,11,
3,0x4001,5,1,13,
3,0x4002,1,0,13,
3,0x4001,0,4,13,
3,0x4002,4,5,13,
3,0x4001,5,4,9,
3,0x4002,4,7,9,
3,0x4001,7,6,9,
3,0x4002,6,5,9,
0};
int polylist[256];
int matrix[9];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2,r,g,zpos=7000;
testasm();
//initnewgroup();
outp(0x3c8,0);
for(a=0;a<256;a++)
{
r=g=b=0;
if(a&0x01) { r+=40; }
if(a&0x02) { g+=40; r+=40; b+=40; }
if(a&0x04) { r+=0; }
if(a&0x08) { g+=10; r+=10; b+=10; }
if(a&0x10) { b+=40; }
if(a&0x20) { g+=40; r+=40; b+=40; }
if(a&0x40) { b+=0; }
if(a&0x80) { g+=10; r+=10; b+=10; }
r=r*4/6;
g=g*4/6;
b=b*4/6;
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
outp(0x3c9,r);
outp(0x3c9,g);
outp(0x3c9,b);
}
for(a=0;a<256;a++) vram[a]=a;
lightshift=8;
for(;;)
{
if(kbhit())
{
a=getch();
if(a==27) break;
if(a=='l') lightshift=2;
if(a=='+') zpos+=200;
if(a=='-') zpos-=200;
if(a=='<') lightshift--;
if(a=='>') lightshift++;
if(a=='t') asmtestmode=1;
if(a=='c') { if(zpos==3200) { lightshift=8; zpos=7000; } else { zpos=3200; lightshift=11; } }
}
asm();
setborder(1);
rx+=16; ry+=15; rz+=7;
rx%=3600; ry%=3600; rz%=3600;
//if(rz==0) printf(".");
/*
a=0;
while(polylist[a])
{
a+=polylist[a]*2+2;
}
polylist[a++]=4;
polylist[a++]=19;
polylist[a++]=160-60; polylist[a++]=100-40;
polylist[a++]=160+60; polylist[a++]=100-40;
polylist[a++]=160+60; polylist[a++]=100+40;
polylist[a++]=160-60; polylist[a++]=100+40;
polylist[a++]=0;
*/
cglenzinit();
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,zpos);
points2[0]=0; crotlist(points2,points);
//cclipedges(edges2,edges,points2);
points3[0]=0; cprojlist((long *)points3,points2);
//cpolylist(polylist,polys,edges,points3);
ceasypolylist(polylist,epolys,points3);
cglenzpolylist(polylist);
cmatrix_yxz(-rx,-ry,rz,matrix);
csetmatrix(matrix,0,0,zpos);
points2[0]=0; crotlist(points2,pointsb);
//cclipedges(edges2,edges,points2);
points3[0]=0; cprojlist((long *)points3,points2);
//cpolylist(polylist,polys,edges,points3);
ceasypolylist(polylist,epolysb,points3);
//cmatrix_yxz(rx*2,-ry,rz*2,matrix);
//csetmatrix(matrix,0,0,zpos);
//points2[0]=0; crotlist(points2,cubepoints);
//points3[0]=0; cprojlist((long *)points3,points2);
//ceasypolylist(polylist,cubeepolys,points3);
cglenzpolylist(polylist);
cglenzdone();
//cdrawpolylist(polylist);
//cdrawpolylist(testlist);
//setborder(3);
//drawnewgroup();
#if 0
n=edges[0];
for(a=2,b=0;b<n;b++)
{
p1=edges[a++];
p2=edges[a++];
a+=2;
testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
}
#endif
}
_asm mov ax,3
_asm int 10h
#if 0
for(a=0;a<100;)
{
b=polylist[a++];
c=polylist[a++];
if(!b) break;
printf("s:%i c:%i v:",b,c);
for(x=0;x<b;x++)
{
printf("%i,%i ",polylist[a+0],polylist[a+1]);
a+=2;
}
printf("\n");
}
printf("points2: %Fp\n",points2);
#endif
printf("Z:%i LS:%i \n",zpos,lightshift);
}

609
GLENZ/MAIN.BBK Normal file
View file

@ -0,0 +1,609 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#include "..\dis\dis.h"
extern int sin1024[];
extern void zoomer1(char *pic);
char bgpic[65535];
extern char fc[];
char *fcrow[100];
char *fcrow2[16];
char far *vram=(char far *)0xa0000000L;
extern char lightshift;
extern int _ndebug1;
extern char asmtestmode;
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int ccliplist(long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
extern int ceasypolylist(int *polylist,int *polys,long *points3);
extern int demomode[];
long cubepoints[]={8,
-999,-999,-999,
999,-999,-999,
999,999,-999,
-999,999,-999,
-999,-999,999,
999,-999,999,
999,999,999,
-999,999,999
};
int cubeepolys[]={
4,0x4002,0,1,2,3,
4,0x4004,4,5,6,7,
4,0x4008,0,1,5,4,
4,0x4006,1,2,6,5,
4,0x400c,2,3,7,6,
4,0x400a,3,0,4,7,
0};
#define ZZZ 50
#define QQQ 99
long points[64]={14,
-100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,100*ZZZ,100*ZZZ,
-100*ZZZ,100*ZZZ,100*ZZZ,
0*ZZZ,0*ZZZ,-170*ZZZ,
0*ZZZ,0*ZZZ,170*ZZZ,
170*ZZZ,0*ZZZ,0*ZZZ,
-170*ZZZ,0*ZZZ,0*ZZZ,
0*ZZZ,170*ZZZ,0*ZZZ,
0*ZZZ,-170*ZZZ,0*ZZZ};
long pointsb[64]={14,
-60*QQQ,-60*QQQ,-60*QQQ,
60*QQQ,-60*QQQ,-60*QQQ,
60*QQQ,60*QQQ,-60*QQQ,
-60*QQQ,60*QQQ,-60*QQQ,
-60*QQQ,-60*QQQ,60*QQQ,
60*QQQ,-60*QQQ,60*QQQ,
60*QQQ,60*QQQ,60*QQQ,
-60*QQQ,60*QQQ,60*QQQ,
0,0,-105*QQQ,
0,0,105*QQQ,
105*QQQ,0,0,
-105*QQQ,0,0,
0,105*QQQ,0,
0,-105*QQQ,0};
long points2[256];
long points2b[256];
int points3[256*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x4010,0,1,2,3,
4,0x4008,0,8,4,9,
4,0x4010,1,9,5,10,
4,0x4020,2,10,6,11,
4,0x4040,3,11,7,12,
4,0x4080,4,5,6,7,
0};
int epolys[]={
3,0x4002,0,1,8,
3,0x4004,1,2,8,
3,0x4006,2,3,8,
3,0x4008,3,0,8,
3,0x400a,2,1,10,
3,0x400c,1,5,10,
3,0x400e,5,6,10,
3,0x4010,6,2,10,
3,0x4012,2,6,12,
3,0x4014,6,7,12,
3,0x4016,7,3,12,
3,0x4018,3,2,12,
3,0x401a,0,3,11,
3,0x401c,3,7,11,
3,0x401e,7,4,11,
3,0x4020,4,0,11,
3,0x4022,5,1,13,
3,0x4024,1,0,13,
3,0x4026,0,4,13,
3,0x4028,4,5,13,
3,0x402a,5,4,9,
3,0x402c,4,7,9,
3,0x402e,7,6,9,
3,0x4030,6,5,9,
0};
int epolysb[]={
3,0x4004,0,1,8,
3,0x4002,1,2,8,
3,0x4004,2,3,8,
3,0x4002,3,0,8,
3,0x4004,2,1,10,
3,0x4002,1,5,10,
3,0x4004,5,6,10,
3,0x4002,6,2,10,
3,0x4004,2,6,12,
3,0x4002,6,7,12,
3,0x4004,7,3,12,
3,0x4002,3,2,12,
3,0x4004,0,3,11,
3,0x4002,3,7,11,
3,0x4004,7,4,11,
3,0x4002,4,0,11,
3,0x4004,5,1,13,
3,0x4002,1,0,13,
3,0x4004,0,4,13,
3,0x4002,4,5,13,
3,0x4004,5,4,9,
3,0x4002,4,7,9,
3,0x4004,7,6,9,
3,0x4002,6,5,9,
0};
int polylist[256];
int matrix[9];
extern char backpal[16*3];
char pal[768];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
void waitb(void)
{
while(!(inp(0x3da)&8));
while((inp(0x3da)&8));
}
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2,r,g,zpos=7000,y1,y2,rya,ypos,yposa;
int ya,yy,boingm=6,boingd=7;
int jello=0,jelloa=0;
int xscale=120,yscale=120,zscale=120,bscale=0;
int repeat;
int oxp=0,oyp=0,ozp=0;
int oxb=0,oyb=0,ozb=0;
int pdy;
int frame=0;
char *ps,*pd;
unsigned int u;
dis_partstart();
/*
_asm mov ax,3
_asm int 10h
while(!kbhit()) printf("musplus: %i\n",dis_musplus());
*/
/*
_asm mov ax,13h
_asm int 10h
for(x=0;x<320;x++)
{
for(y=0;y<200;y++)
{
if(x<50 || y<30 || x>270 || y>170) a=15;
else a=(x&63)+(y&63);
vram[x+y*320]=a;
}
}
*/
while(!kbhit() && dis_musplus()<-20) ;
dis_setmframe(0);
zoomer2();
memset(vram+32000,0,32768);
_asm
{
mov ax,13h
int 010h
}
for(y=0;y<=200;y++)
{
if(y>=130 && y<=137) memset(vram+y*320,7,320);
else memset(vram+y*320,0,320);
}
testasm();
for(a=0;a<100;a++)
{
fcrow[a]=fc+768+16+a*320;
}
for(a=0;a<16;a++)
{
fcrow2[a]=fc+768+16+a*320+100*320;
}
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,fc[a+16]);
yy=0; ya=0;
while(!kbhit())
{
ya++; yy+=ya;
if(yy>48*16)
{
yy-=ya;
ya=-ya*2/3;
if(ya>-4 && ya<4) break;
}
y=yy/16;
y1=130+y/2;
y2=130+y*3/2;
if(y2!=y1) b=25600/(y2-y1);
pd=vram+(y1-4)*320; pdy=y1;
for(ry=y1-4;ry<y1;ry++,pd+=320)
{
if(ry>199) continue;
memset(pd,0,320);
}
for(c=0,ry=y1;ry<y2;ry++,pd+=320,c+=b)
{
if(ry>199) continue;
memcpy(pd,fcrow[c/256],320);
}
for(c=0;c<16;c++,pd+=320,ry++)
{
if(ry>199) continue;
if(c>7) memset(pd,0,320);
else memcpy(pd,fcrow2[c],320);
}
waitb();
}
while(!kbhit() && dis_getmframe()<300);
dis_waitb();
//initnewgroup();
outp(0x3c8,0);
for(a=0;a<16;a++)
{
ps=fc+0x10+a*3;
pd=backpal+a*3;
pd[0]=ps[0];
pd[1]=ps[1];
pd[2]=ps[2];
}
for(a=0;a<256;a++)
{
if(a<16) b=a;
else
{
b=a&7;
}
r=backpal[b*3+0];
g=backpal[b*3+1];
b=backpal[b*3+2];
if((a&8) && a>15)
{
r+=16;
g+=16;
b+=16;
}
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
outp(0x3c9,r);
outp(0x3c9,g);
outp(0x3c9,b);
}
lightshift=9;
rx=ry=rz=0;
ypos=-9000; yposa=0;
dis_waitb();
memcpy(bgpic,vram,64000);
while(!kbhit() && dis_getmframe()<333);
dis_waitb();
memcpy(pal,backpal,16*3);
dis_partstart();
while(frame<7000 && !dis_exit())
{
a=dis_musplus(); if(a<0 && a>-16) break;
/*
if(kbhit())
{
a=getch();
if(a==27) break;
if(a=='l') lightshift=2;
if(a=='+') zpos+=200;
if(a=='-') zpos-=200;
if(a=='<') lightshift--;
if(a=='>') lightshift++;
if(a=='t') asmtestmode=1;
if(a=='c') { if(zpos==3200) { lightshift=8; zpos=7000; } else { zpos=3200; lightshift=11; } }
if(a=='8') ry-=16;
if(a=='2') ry+=16;
if(a=='4') rz-=16;
if(a=='6') rz+=16;
}
*/
//asm();
//for(a=0;a<256;a++) vram[a]=a;
rx%=3*3600; ry%=3*3600; rz%=3*3600;
//if(rz==0) printf(".");
/*
a=0;
while(polylist[a])
{
a+=polylist[a]*2+2;
}
polylist[a++]=4;
polylist[a++]=19;
polylist[a++]=160-60; polylist[a++]=100-40;
polylist[a++]=160+60; polylist[a++]=100-40;
polylist[a++]=160+60; polylist[a++]=100+40;
polylist[a++]=160-60; polylist[a++]=100+40;
polylist[a++]=0;
*/
cglenzinit();
//setborder(0);
repeat=dis_waitb();
//setborder(1);
if(frame>1280+789)
{
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,pal[a]);
b=1280+789+64-frame;
if(b<0) b=0;
for(a=0;a<16*3;a++) pal[a]=backpal[a]*b/64;
}
else if(frame>700)
{
if(frame<765)
{
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,pal[a]);
b=764-frame;
if(b<0) b=0;
for(a=0;a<16*3;a++) pal[a]=backpal[a]*b/64;
}
else if(frame<790)
{
y=150+(frame-765)*2;
memset(bgpic+y*320,0,640);
memset(vram+y*320,0,640);
if(frame>785) for(a=0;a<16;a++)
{
r=g=b=0;
if(a&1)
{
r+=10;
}
if(a&2)
{
r+=30;
}
if(a&4)
{
r+=20;
}
if(a&8)
{
r+=16;
g+=16;
b+=16;
}
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
backpal[a*3+0]=r;
backpal[a*3+1]=g;
backpal[a*3+2]=b;
}
memcpy(pal,backpal,16*3);
}
else if(frame<795)
{
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,backpal[a]);
}
}
while(repeat--)
{
frame++;
rx+=32; ry+=7;
if(frame>900)
{
a=frame-900;
b=frame-900; if(b>50) b=50;
oxp=sin1024[(a*3)&1023]*b/10;
oyp=sin1024[(a*5)&1023]*b/10;
ozp=(sin1024[(a*4)&1023]+128)*b/16;
oxb=-sin1024[(a*1)&1023];
oyb=-sin1024[(a*2)&1023];
ozb=-(sin1024[(a*3)&1023]+128);
}
if(frame>800)
{
if(frame>1220+789)
{
if(xscale>0) xscale-=1;
if(yscale>0) yscale-=1;
if(zscale>0) zscale-=1;
}
else if(frame>1400+789)
{
if(bscale>0) bscale-=8;
if(bscale<0) bscale=0;
}
else
{
if(bscale<190) bscale+=2;
}
if(bscale>xscale) lightshift=10;
}
else
{
if(frame<640+60)
{
yposa+=15;
ypos+=yposa/20;
if(ypos>-300)
{
ypos-=yposa/20;
yposa=-yposa*boingm/boingd;
boingm+=2; boingd++;
//jelloa=500;
}
if(ypos>-900 && yposa>0)
{
jello=(ypos+900)*5/3;
jelloa=0;
}
}
else
{
if(ypos>-2800) ypos-=16;
else if(ypos<-2800) ypos+=16;
}
yscale=xscale=120+jello/30;
zscale=120-jello/30;
a=jello;
jello+=jelloa;
if((a<0 && jello>0) || (a>0 && jello<0))
{
jelloa=jelloa*5/6;
}
a=jello/20;
jelloa-=a;
}
}
/*
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,ypos+1500,zpos);
points2[0]=0; crotlist(points2,points);
*/
if(xscale>4)
{
demomode[0]=demomode[1];
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,0);
points2b[0]=0; crotlist(points2b,points);
matrix[0]=xscale*64;
matrix[1]=0;
matrix[2]=0;
matrix[3]=0;
matrix[4]=yscale*64;
matrix[5]=0;
matrix[6]=0;
matrix[7]=0;
matrix[8]=zscale*64;
csetmatrix(matrix,0+oxp,ypos+1500+oyp,zpos+ozp);
points2[0]=0; crotlist(points2,points2b);
if(frame<800) ccliplist(points2);
points3[0]=0; cprojlist((long *)points3,points2);
ceasypolylist(polylist,epolys,points3);
cglenzpolylist(polylist);
}
if(frame>800)
{
demomode[0]=demomode[2];
cmatrix_yxz(3600-rx/3,3600-ry/3,3600-rz/3,matrix);
csetmatrix(matrix,0,0,0);
points2b[0]=0; crotlist(points2b,pointsb);
matrix[0]=bscale*64;
matrix[1]=0;
matrix[2]=0;
matrix[3]=0;
matrix[4]=bscale*64;
matrix[5]=0;
matrix[6]=0;
matrix[7]=0;
matrix[8]=bscale*64;
csetmatrix(matrix,0+oxb,ypos+1500+oyb,zpos+ozb);
points2[0]=0; crotlist(points2,points2b);
points3[0]=0; cprojlist((long *)points3,points2);
ceasypolylist(polylist,epolysb,points3);
cglenzpolylist(polylist);
}
cglenzdone();
#if 0
n=edges[0];
for(a=2,b=0;b<n;b++)
{
p1=edges[a++];
p2=edges[a++];
a+=2;
testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
}
#endif
}
if(!dis_indemo())
{
_asm mov ax,3
_asm int 10h
}
#if 0
for(a=0;a<100;)
{
b=polylist[a++];
c=polylist[a++];
if(!b) break;
printf("s:%i c:%i v:",b,c);
for(x=0;x<b;x++)
{
printf("%i,%i ",polylist[a+0],polylist[a+1]);
a+=2;
}
printf("\n");
}
printf("points2: %Fp\n",points2);
printf("%i,%i,%i Z:%i LS:%i \n",rx,ry,rz,zpos,lightshift);
#endif
}

648
GLENZ/MAIN.C Normal file
View file

@ -0,0 +1,648 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#include "..\dis\dis.h"
extern int sin1024[];
extern void zoomer1(char *pic);
char bgpic[65535];
extern char fc[];
char *fcrow[100];
char *fcrow2[16];
char far *vram=(char far *)0xa0000000L;
extern char lightshift;
extern int _ndebug1;
extern char asmtestmode;
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int ccliplist(long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
extern int ceasypolylist(int *polylist,int *polys,long *points3);
extern int demomode[];
long cubepoints[]={8,
-999,-999,-999,
999,-999,-999,
999,999,-999,
-999,999,-999,
-999,-999,999,
999,-999,999,
999,999,999,
-999,999,999
};
int cubeepolys[]={
4,0x4002,0,1,2,3,
4,0x4004,4,5,6,7,
4,0x4008,0,1,5,4,
4,0x4006,1,2,6,5,
4,0x400c,2,3,7,6,
4,0x400a,3,0,4,7,
0};
#define ZZZ 50
#define QQQ 99
long points[64]={14,
-100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,100*ZZZ,100*ZZZ,
-100*ZZZ,100*ZZZ,100*ZZZ,
0*ZZZ,0*ZZZ,-170*ZZZ,
0*ZZZ,0*ZZZ,170*ZZZ,
170*ZZZ,0*ZZZ,0*ZZZ,
-170*ZZZ,0*ZZZ,0*ZZZ,
0*ZZZ,170*ZZZ,0*ZZZ,
0*ZZZ,-170*ZZZ,0*ZZZ};
long points1[64]={14,
-100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,100*ZZZ,100*ZZZ,
-100*ZZZ,100*ZZZ,100*ZZZ,
0*ZZZ,0*ZZZ,-170*ZZZ,
0*ZZZ,0*ZZZ,170*ZZZ,
170*ZZZ,0*ZZZ,0*ZZZ,
-170*ZZZ,0*ZZZ,0*ZZZ,
0*ZZZ,170*ZZZ,0*ZZZ,
0*ZZZ,-170*ZZZ,0*ZZZ};
long points9[64]={14,
-111*ZZZ,-111*ZZZ,-111*ZZZ,
111*ZZZ,-111*ZZZ,-111*ZZZ,
111*ZZZ,111*ZZZ,-111*ZZZ,
-111*ZZZ,111*ZZZ,-111*ZZZ,
-111*ZZZ,-111*ZZZ,111*ZZZ,
111*ZZZ,-111*ZZZ,111*ZZZ,
111*ZZZ,111*ZZZ,111*ZZZ,
-111*ZZZ,111*ZZZ,111*ZZZ,
0*ZZZ,0*ZZZ,-122*ZZZ,
0*ZZZ,0*ZZZ,144*ZZZ,
122*ZZZ,0*ZZZ,0*ZZZ,
-144*ZZZ,0*ZZZ,0*ZZZ,
0*ZZZ,122*ZZZ,0*ZZZ,
0*ZZZ,-144*ZZZ,0*ZZZ};
long points8[64]={14,
-140*ZZZ,-140*ZZZ,-140*ZZZ,
140*ZZZ,-140*ZZZ,-140*ZZZ,
140*ZZZ,140*ZZZ,-140*ZZZ,
-140*ZZZ,140*ZZZ,-140*ZZZ,
-140*ZZZ,-140*ZZZ,140*ZZZ,
140*ZZZ,-140*ZZZ,140*ZZZ,
140*ZZZ,140*ZZZ,140*ZZZ,
-140*ZZZ,140*ZZZ,140*ZZZ,
0*ZZZ,0*ZZZ,-140*ZZZ,
0*ZZZ,0*ZZZ,140*ZZZ,
190*ZZZ,0*ZZZ,0*ZZZ,
-190*ZZZ,0*ZZZ,0*ZZZ,
0*ZZZ,140*ZZZ,0*ZZZ,
0*ZZZ,-140*ZZZ,0*ZZZ};
long points7[64]={14,
-100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,100*ZZZ,100*ZZZ,
-100*ZZZ,100*ZZZ,100*ZZZ,
0*ZZZ,0*ZZZ,-170*ZZZ,
0*ZZZ,0*ZZZ,170*ZZZ,
170*ZZZ,0*ZZZ,0*ZZZ,
-170*ZZZ,0*ZZZ,0*ZZZ,
0*ZZZ,170*ZZZ,0*ZZZ,
0*ZZZ,-170*ZZZ,0*ZZZ};
long pointsb[64]={14,
-60*QQQ,-60*QQQ,-60*QQQ,
60*QQQ,-60*QQQ,-60*QQQ,
60*QQQ,60*QQQ,-60*QQQ,
-60*QQQ,60*QQQ,-60*QQQ,
-60*QQQ,-60*QQQ,60*QQQ,
60*QQQ,-60*QQQ,60*QQQ,
60*QQQ,60*QQQ,60*QQQ,
-60*QQQ,60*QQQ,60*QQQ,
0,0,-105*QQQ,
0,0,105*QQQ,
105*QQQ,0,0,
-105*QQQ,0,0,
0,105*QQQ,0,
0,-105*QQQ,0};
long points2[256];
long points2b[256];
int points3[256*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x4010,0,1,2,3,
4,0x4008,0,8,4,9,
4,0x4010,1,9,5,10,
4,0x4020,2,10,6,11,
4,0x4040,3,11,7,12,
4,0x4080,4,5,6,7,
0};
int epolys[]={
3,0x4002,0,1,8,
3,0x4004,1,2,8,
3,0x4006,2,3,8,
3,0x4008,3,0,8,
3,0x400a,2,1,10,
3,0x400c,1,5,10,
3,0x400e,5,6,10,
3,0x4010,6,2,10,
3,0x4012,2,6,12,
3,0x4014,6,7,12,
3,0x4016,7,3,12,
3,0x4018,3,2,12,
3,0x401a,0,3,11,
3,0x401c,3,7,11,
3,0x401e,7,4,11,
3,0x4020,4,0,11,
3,0x4022,5,1,13,
3,0x4024,1,0,13,
3,0x4026,0,4,13,
3,0x4028,4,5,13,
3,0x402a,5,4,9,
3,0x402c,4,7,9,
3,0x402e,7,6,9,
3,0x4030,6,5,9,
0};
int epolysb[]={
3,0x4004,0,1,8,
3,0x4002,1,2,8,
3,0x4004,2,3,8,
3,0x4002,3,0,8,
3,0x4004,2,1,10,
3,0x4002,1,5,10,
3,0x4004,5,6,10,
3,0x4002,6,2,10,
3,0x4004,2,6,12,
3,0x4002,6,7,12,
3,0x4004,7,3,12,
3,0x4002,3,2,12,
3,0x4004,0,3,11,
3,0x4002,3,7,11,
3,0x4004,7,4,11,
3,0x4002,4,0,11,
3,0x4004,5,1,13,
3,0x4002,1,0,13,
3,0x4004,0,4,13,
3,0x4002,4,5,13,
3,0x4004,5,4,9,
3,0x4002,4,7,9,
3,0x4004,7,6,9,
3,0x4002,6,5,9,
0};
int polylist[256];
int matrix[9];
extern char backpal[16*3];
char pal[768];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
void waitb(void)
{
while(!(inp(0x3da)&8));
while((inp(0x3da)&8));
}
char tmppal[768];
int repeat=0;
int frame=0;
#pragma check_stack(off)
void _loadds copper(void)
{
int a;
repeat++;
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,pal[a]);
}
#pragma check_stack(on)
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2,r,g,zpos=7500,y1,y2,rya,ypos,yposa;
int ya,yy,boingm=6,boingd=7;
int jello=0,jelloa=0,bigjello=0,bigjelloa=0;
int xscale=120,yscale=120,zscale=120,bscale=0;
int oxp=0,oyp=0,ozp=0;
int oxb=0,oyb=0,ozb=0;
int bscaleflag=0;
int repec;
int pdy;
int lasta=-1;
char *ps,*pd,*pp;
unsigned int u;
dis_partstart();
while(!dis_exit() && dis_musplus()<-19) ;
dis_setmframe(0);
zoomer2();
_asm mov dx,3c4h
_asm mov ax,0f02h
_asm out dx,ax
memset(vram,0,65535);
_asm
{
mov ax,13h
int 010h
}
testasm();
for(a=0;a<100;a++)
{
fcrow[a]=fc+768+16+a*320;
}
for(a=0;a<16;a++)
{
fcrow2[a]=fc+768+16+a*320+100*320;
}
outp(0x3c8,0);
for(a=0;a<768;a++) outp(0x3c9,0);
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,fc[a+16]);
yy=0; ya=0;
while(!dis_exit())
{
ya++; yy+=ya;
if(yy>48*16)
{
yy-=ya;
ya=-ya*2/3;
if(ya>-4 && ya<4) break;
}
y=yy/16;
y1=130+y/2;
y2=130+y*3/2;
if(y2!=y1) b=25600/(y2-y1);
pd=vram+(y1-4)*320; pdy=y1;
for(ry=y1-4;ry<y1;ry++,pd+=320)
{
if(ry>199) continue;
memset(pd,0,320);
}
for(c=0,ry=y1;ry<y2;ry++,pd+=320,c+=b)
{
if(ry>199) continue;
memcpy(pd,fcrow[c/256],320);
}
for(c=0;c<16;c++,pd+=320,ry++)
{
if(ry>199) continue;
if(c>7) memset(pd,0,320);
else memcpy(pd,fcrow2[c],320);
}
waitb();
}
while(!dis_exit() && dis_getmframe()<300);
dis_waitb();
//initnewgroup();
for(a=0;a<16;a++)
{
ps=fc+0x10+a*3;
pd=backpal+a*3;
pd[0]=ps[0];
pd[1]=ps[1];
pd[2]=ps[2];
}
pp=tmppal;
for(a=0;a<256;a++)
{
if(a<16) b=a;
else
{
b=a&7;
}
r=backpal[b*3+0];
g=backpal[b*3+1];
b=backpal[b*3+2];
if((a&8) && a>15)
{
r+=16;
g+=16;
b+=16;
}
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
*pp++=r;
*pp++=g;
*pp++=b;
}
outp(0x3c8,0);
for(a=0;a<768;a++)
{
outp(0x3c9,tmppal[a]);
}
lightshift=9;
rx=ry=rz=0;
ypos=-9000; yposa=0;
dis_waitb();
memcpy(bgpic,vram,64000);
while(!dis_exit() && dis_getmframe()<333);
memcpy(pal,backpal,16*3);
dis_partstart();
dis_waitb();
outp(0x3c7,0);
for(a=0;a<16*3;a++) pal[a]=inp(0x3c9);
dis_setcopper(0,copper);
while(frame<7000 && !dis_exit())
{
a=dis_musplus(); if(a<0 && a>-16) break;
repeat=dis_waitb();
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,pal[a]);
while(repeat--)
{
frame++;
rx+=32; ry+=7;
rx%=3*3600; ry%=3*3600; rz%=3*3600;
if(frame>900)
{
b=frame-900;
/*
if(b<=256)
{
c=256-b;
for(a=1;a<14*3+1;a++)
{
points[a]=(points1[a]*c+points9[a]*b)/256L;
}
}
else if(b<=512)
{
b-=256;
c=256-b;
for(a=1;a<14*3+1;a++)
{
points[a]=(points9[a]*c+points8[a]*b)/256L;
}
}
else if(b<=768)
{
b-=512;
c=256-b;
for(a=1;a<14*3+1;a++)
{
points[a]=(points8[a]*c+points7[a]*b)/256L;
}
}
*/
a=frame-900;
b=frame-900; if(b>50) b=50;
oxp=sin1024[(a*3)&1023]*b/10;
oyp=sin1024[(a*5)&1023]*b/10;
ozp=(sin1024[(a*4)&1023]/2+128)*b/16;
if(frame>1800)
{
a=frame-1800+64;
if(a>1024) a=1024;
oxb=(long)(-sin1024[(a*6)&1023])*(long)a/40L;
oyb=(long)(-sin1024[(a*7)&1023])*(long)a/40L;
ozb=(long)(sin1024[(a*8)&1023]+128)*(long)a/40L;
}
else
{
oxb=-sin1024[(a*6)&1023];
oyb=-sin1024[(a*7)&1023];
ozb=sin1024[(a*8)&1023]+128;
}
b=1800-frame;
if(b<0)
{
if(b<-99) b=-99;
oyp-=b*b/2;
}
}
if(frame>800)
{
if(frame>1220+789)
{
if(xscale>0) xscale-=1;
if(yscale>0) yscale-=1;
if(zscale>0) zscale-=1;
if(bscale>0) bscale-=1;
}
else if(frame>1400+789)
{
if(bscale>0) bscale-=8;
if(bscale<0) bscale=0;
}
else
{
if(bscale<180) bscale+=2;
else bscale=180;
}
if(bscale>xscale) lightshift=10;
}
else
{
if(frame<640+70)
{
yposa+=31;
ypos+=yposa/40;
if(ypos>-300)
{
ypos-=yposa/40;
yposa=-yposa*boingm/boingd;
boingm+=2; boingd++;
//jelloa=500;
}
if(ypos>-900 && yposa>0)
{
jello=(ypos+900)*5/3;
jelloa=0;
}
}
else
{
if(ypos>-2800) ypos-=16;
else if(ypos<-2800) ypos+=16;
}
yscale=xscale=120+jello/30;
zscale=120-jello/30;
a=jello;
jello+=jelloa;
if((a<0 && jello>0) || (a>0 && jello<0))
{
jelloa=jelloa*5/6;
}
a=jello/20;
jelloa-=a;
}
if(frame>1280+789)
{
b=1280+789+64-frame;
if(b<0) b=0;
for(a=0;a<16*3;a++) pal[a]=backpal[a]*b/64;
}
else if(frame>700)
{
if(frame<765)
{
b=764-frame;
if(b<0) b=0;
for(a=0;a<16*3;a++) pal[a]=backpal[a]*b/64;
}
else if(frame<790)
{
y=150+(frame-765)*2;
memset(bgpic+y*320,0,640);
memset(vram+y*320,0,640);
if(frame>785) for(a=0;a<16;a++)
{
r=g=b=0;
if(a&1)
{
r+=10;
}
if(a&2)
{
r+=30;
}
if(a&4)
{
r+=20;
}
if(a&8)
{
r+=16;
g+=16;
b+=16;
}
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
backpal[a*3+0]=r;
backpal[a*3+1]=g;
backpal[a*3+2]=b;
}
}
else if(frame<795)
{
memcpy(pal,backpal,16*3);
}
}
}
cglenzinit();
if(xscale>4)
{
demomode[0]=demomode[1];
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,0);
points2b[0]=0; crotlist(points2b,points);
matrix[0]=xscale*64;
matrix[1]=0;
matrix[2]=0;
matrix[3]=0;
matrix[4]=yscale*64;
matrix[5]=0;
matrix[6]=0;
matrix[7]=0;
matrix[8]=zscale*64;
csetmatrix(matrix,0+oxp,ypos+1500+oyp,zpos+ozp);
points2[0]=0; crotlist(points2,points2b);
if(frame<800) ccliplist(points2);
points3[0]=0; cprojlist((long *)points3,points2);
ceasypolylist(polylist,epolys,points3);
cglenzpolylist(polylist);
}
if(frame>800 && bscale>4)
{
demomode[0]=demomode[2];
cmatrix_yxz(3600-rx/3,3600-ry/3,3600-rz/3,matrix);
csetmatrix(matrix,0,0,0);
points2b[0]=0; crotlist(points2b,pointsb);
matrix[0]=bscale*64;
matrix[1]=0;
matrix[2]=0;
matrix[3]=0;
matrix[4]=bscale*64;
matrix[5]=0;
matrix[6]=0;
matrix[7]=0;
matrix[8]=bscale*64;
csetmatrix(matrix,0+oxb,ypos+1500+oyb,zpos+ozb);
points2[0]=0; crotlist(points2,points2b);
points3[0]=0; cprojlist((long *)points3,points2);
ceasypolylist(polylist,epolysb,points3);
cglenzpolylist(polylist);
}
cglenzdone();
}
dis_setcopper(0,NULL);
if(!dis_indemo())
{
_asm mov ax,3
_asm int 10h
}
}

BIN
GLENZ/MAIN.OBJ Normal file

Binary file not shown.

531
GLENZ/MAIN.S Normal file
View file

@ -0,0 +1,531 @@
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#include "..\dis\dis.h"
extern int sin1024[];
extern void zoomer1(char *pic);
char bgpic[65535];
extern char fc[];
char *fcrow[100];
char *fcrow2[16];
char far *vram=(char far *)0xa0000000L;
extern char lightshift;
extern int _ndebug1;
extern char asmtestmode;
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int ccliplist(long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
extern int ceasypolylist(int *polylist,int *polys,long *points3);
extern int demomode[];
long cubepoints[]={8,
-999,-999,-999,
999,-999,-999,
999,999,-999,
-999,999,-999,
-999,-999,999,
999,-999,999,
999,999,999,
-999,999,999
};
int cubeepolys[]={
4,0x4002,0,1,2,3,
4,0x4004,4,5,6,7,
4,0x4008,0,1,5,4,
4,0x4006,1,2,6,5,
4,0x400c,2,3,7,6,
4,0x400a,3,0,4,7,
0};
#define ZZZ 50
#define QQQ 99
long points[64]={14,
-100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,-100*ZZZ,-100*ZZZ,
100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,100*ZZZ,-100*ZZZ,
-100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,-100*ZZZ,100*ZZZ,
100*ZZZ,100*ZZZ,100*ZZZ,
-100*ZZZ,100*ZZZ,100*ZZZ,
0*ZZZ,0*ZZZ,-170*ZZZ,
0*ZZZ,0*ZZZ,170*ZZZ,
170*ZZZ,0*ZZZ,0*ZZZ,
-170*ZZZ,0*ZZZ,0*ZZZ,
0*ZZZ,170*ZZZ,0*ZZZ,
0*ZZZ,-170*ZZZ,0*ZZZ};
long pointsb[64]={14,
-60*QQQ,-60*QQQ,-60*QQQ,
60*QQQ,-60*QQQ,-60*QQQ,
60*QQQ,60*QQQ,-60*QQQ,
-60*QQQ,60*QQQ,-60*QQQ,
-60*QQQ,-60*QQQ,60*QQQ,
60*QQQ,-60*QQQ,60*QQQ,
60*QQQ,60*QQQ,60*QQQ,
-60*QQQ,60*QQQ,60*QQQ,
0,0,-105*QQQ,
0,0,105*QQQ,
105*QQQ,0,0,
-105*QQQ,0,0,
0,105*QQQ,0,
0,-105*QQQ,0};
long points2[256];
long points2b[256];
int points3[256*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x4010,0,1,2,3,
4,0x4008,0,8,4,9,
4,0x4010,1,9,5,10,
4,0x4020,2,10,6,11,
4,0x4040,3,11,7,12,
4,0x4080,4,5,6,7,
0};
int epolys[]={
3,0x4002,0,1,8,
3,0x4004,1,2,8,
3,0x4006,2,3,8,
3,0x4008,3,0,8,
3,0x400a,2,1,10,
3,0x400c,1,5,10,
3,0x400e,5,6,10,
3,0x4010,6,2,10,
3,0x4012,2,6,12,
3,0x4014,6,7,12,
3,0x4016,7,3,12,
3,0x4018,3,2,12,
3,0x401a,0,3,11,
3,0x401c,3,7,11,
3,0x401e,7,4,11,
3,0x4020,4,0,11,
3,0x4022,5,1,13,
3,0x4024,1,0,13,
3,0x4026,0,4,13,
3,0x4028,4,5,13,
3,0x402a,5,4,9,
3,0x402c,4,7,9,
3,0x402e,7,6,9,
3,0x4030,6,5,9,
0};
int epolysb[]={
3,0x4004,0,1,8,
3,0x4002,1,2,8,
3,0x4004,2,3,8,
3,0x4002,3,0,8,
3,0x4004,2,1,10,
3,0x4002,1,5,10,
3,0x4004,5,6,10,
3,0x4002,6,2,10,
3,0x4004,2,6,12,
3,0x4002,6,7,12,
3,0x4004,7,3,12,
3,0x4002,3,2,12,
3,0x4004,0,3,11,
3,0x4002,3,7,11,
3,0x4004,7,4,11,
3,0x4002,4,0,11,
3,0x4004,5,1,13,
3,0x4002,1,0,13,
3,0x4004,0,4,13,
3,0x4002,4,5,13,
3,0x4004,5,4,9,
3,0x4002,4,7,9,
3,0x4004,7,6,9,
3,0x4002,6,5,9,
0};
int polylist[256];
int matrix[9];
extern char backpal[16*3];
char pal[768];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
void waitb(void)
{
while(!(inp(0x3da)&8));
while((inp(0x3da)&8));
}
int repeat=0;
int frame=0;
#pragma check_stack(off)
void _loadds copper(void)
{
int a;
repeat++;
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,pal[a]);
}
#pragma check_stack(on)
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2,r,g,zpos=7000,y1,y2,rya,ypos,yposa;
int ya,yy,boingm=6,boingd=7;
int jello=0,jelloa=0;
int xscale=120,yscale=120,zscale=120,bscale=0;
int oxp=0,oyp=0,ozp=0;
int oxb=0,oyb=0,ozb=0;
int repec;
int pdy;
char *ps,*pd;
unsigned int u;
dis_partstart();
while(!kbhit() && dis_musplus()<-20) ;
dis_setmframe(0);
zoomer2();
memset(vram+32000,0,32768);
_asm
{
mov ax,13h
int 010h
}
for(y=0;y<=200;y++)
{
if(y>=130 && y<=137) memset(vram+y*320,7,320);
else memset(vram+y*320,0,320);
}
testasm();
for(a=0;a<100;a++)
{
fcrow[a]=fc+768+16+a*320;
}
for(a=0;a<16;a++)
{
fcrow2[a]=fc+768+16+a*320+100*320;
}
outp(0x3c8,0);
for(a=0;a<16*3;a++) outp(0x3c9,fc[a+16]);
yy=0; ya=0;
while(!kbhit())
{
ya++; yy+=ya;
if(yy>48*16)
{
yy-=ya;
ya=-ya*2/3;
if(ya>-4 && ya<4) break;
}
y=yy/16;
y1=130+y/2;
y2=130+y*3/2;
if(y2!=y1) b=25600/(y2-y1);
pd=vram+(y1-4)*320; pdy=y1;
for(ry=y1-4;ry<y1;ry++,pd+=320)
{
if(ry>199) continue;
memset(pd,0,320);
}
for(c=0,ry=y1;ry<y2;ry++,pd+=320,c+=b)
{
if(ry>199) continue;
memcpy(pd,fcrow[c/256],320);
}
for(c=0;c<16;c++,pd+=320,ry++)
{
if(ry>199) continue;
if(c>7) memset(pd,0,320);
else memcpy(pd,fcrow2[c],320);
}
waitb();
}
while(!kbhit() && dis_getmframe()<300);
dis_waitb();
//initnewgroup();
outp(0x3c8,0);
for(a=0;a<16;a++)
{
ps=fc+0x10+a*3;
pd=backpal+a*3;
pd[0]=ps[0];
pd[1]=ps[1];
pd[2]=ps[2];
}
for(a=0;a<256;a++)
{
if(a<16) b=a;
else
{
b=a&7;
}
r=backpal[b*3+0];
g=backpal[b*3+1];
b=backpal[b*3+2];
if((a&8) && a>15)
{
r+=16;
g+=16;
b+=16;
}
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
outp(0x3c9,r);
outp(0x3c9,g);
outp(0x3c9,b);
}
lightshift=9;
rx=ry=rz=0;
ypos=-9000; yposa=0;
dis_waitb();
memcpy(bgpic,vram,64000);
while(!kbhit() && dis_getmframe()<333);
memcpy(pal,backpal,16*3);
dis_partstart();
dis_waitb();
outp(0x3c7,0);
for(a=0;a<16*3;a++) pal[a]=inp(0x3c9);
dis_setcopper(0,copper);
while(frame<7000 && !dis_exit())
{
a=dis_musplus(); if(a<0 && a>-16) break;
//dis_waitb();
//copper();
if(repeat) for(repec=repeat,repeat=0;repec;repec--)
{
frame++;
rx+=32; ry+=7;
rx%=3*3600; ry%=3*3600; rz%=3*3600;
if(frame>900)
{
a=frame-900;
b=frame-900; if(b>50) b=50;
oxp=sin1024[(a*3)&1023]*b/10;
oyp=sin1024[(a*5)&1023]*b/10;
ozp=(sin1024[(a*4)&1023]+128)*b/16;
oxb=-sin1024[(a*1)&1023];
oyb=-sin1024[(a*2)&1023];
ozb=-(sin1024[(a*3)&1023]+128);
}
if(frame>800)
{
if(frame>1220+789)
{
if(xscale>0) xscale-=1;
if(yscale>0) yscale-=1;
if(zscale>0) zscale-=1;
}
else if(frame>1400+789)
{
if(bscale>0) bscale-=8;
if(bscale<0) bscale=0;
}
else
{
if(bscale<190) bscale+=2;
}
if(bscale>xscale) lightshift=10;
}
else
{
if(frame<640+60)
{
yposa+=15;
ypos+=yposa/20;
if(ypos>-300)
{
ypos-=yposa/20;
yposa=-yposa*boingm/boingd;
boingm+=2; boingd++;
//jelloa=500;
}
if(ypos>-900 && yposa>0)
{
jello=(ypos+900)*5/3;
jelloa=0;
}
}
else
{
if(ypos>-2800) ypos-=16;
else if(ypos<-2800) ypos+=16;
}
yscale=xscale=120+jello/30;
zscale=120-jello/30;
a=jello;
jello+=jelloa;
if((a<0 && jello>0) || (a>0 && jello<0))
{
jelloa=jelloa*5/6;
}
a=jello/20;
jelloa-=a;
}
if(frame>1280+789)
{
b=1280+789+64-frame;
if(b<0) b=0;
for(a=0;a<16*3;a++) pal[a]=backpal[a]*b/64;
}
else if(frame>700)
{
if(frame<765)
{
b=764-frame;
if(b<0) b=0;
for(a=0;a<16*3;a++) pal[a]=backpal[a]*b/64;
}
else if(frame<790)
{
y=150+(frame-765)*2;
memset(bgpic+y*320,0,640);
memset(vram+y*320,0,640);
if(frame>785) for(a=0;a<16;a++)
{
r=g=b=0;
if(a&1)
{
r+=10;
}
if(a&2)
{
r+=30;
}
if(a&4)
{
r+=20;
}
if(a&8)
{
r+=16;
g+=16;
b+=16;
}
if(r>63) r=63;
if(g>63) g=63;
if(b>63) b=63;
backpal[a*3+0]=r;
backpal[a*3+1]=g;
backpal[a*3+2]=b;
}
memcpy(pal,backpal,16*3);
}
else if(frame<795)
{
memcpy(pal,backpal,16*3);
}
}
}
cglenzinit();
if(xscale>4)
{
demomode[0]=demomode[1];
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,0);
points2b[0]=0; crotlist(points2b,points);
matrix[0]=xscale*64;
matrix[1]=0;
matrix[2]=0;
matrix[3]=0;
matrix[4]=yscale*64;
matrix[5]=0;
matrix[6]=0;
matrix[7]=0;
matrix[8]=zscale*64;
csetmatrix(matrix,0+oxp,ypos+1500+oyp,zpos+ozp);
points2[0]=0; crotlist(points2,points2b);
if(frame<800) ccliplist(points2);
points3[0]=0; cprojlist((long *)points3,points2);
ceasypolylist(polylist,epolys,points3);
cglenzpolylist(polylist);
}
if(frame>800)
{
demomode[0]=demomode[2];
cmatrix_yxz(3600-rx/3,3600-ry/3,3600-rz/3,matrix);
csetmatrix(matrix,0,0,0);
points2b[0]=0; crotlist(points2b,pointsb);
matrix[0]=bscale*64;
matrix[1]=0;
matrix[2]=0;
matrix[3]=0;
matrix[4]=bscale*64;
matrix[5]=0;
matrix[6]=0;
matrix[7]=0;
matrix[8]=bscale*64;
csetmatrix(matrix,0+oxb,ypos+1500+oyb,zpos+ozb);
points2[0]=0; crotlist(points2,points2b);
points3[0]=0; cprojlist((long *)points3,points2);
ceasypolylist(polylist,epolysb,points3);
cglenzpolylist(polylist);
}
cglenzdone();
}
dis_setcopper(0,NULL);
if(!dis_indemo())
{
_asm mov ax,3
_asm int 10h
}
}

101
GLENZ/MAIN1.C Normal file
View file

@ -0,0 +1,101 @@
#include <stdio.h>
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
long points[32]={8,
-1000,-1000,-1000,
1000,-1000,-1000,
1000,1000,-1000,
-1000,1000,-1000,
-1000,-1000,1000,
1000,-1000,1000,
1000,1000,1000,
-1000,1000,1000};
long points2[64];
int points3[64*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x0010,0,1,2,3,
4,0x0018,0,8,4,9,
4,0x0020,1,9,5,10,
4,0x0028,2,10,6,11,
4,0x0030,3,11,7,12,
4,0x8038,4,5,6,7,
0};
int polylist[256];
int matrix[9];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2;
printf("Starting");
testasm();
while(!kbhit())
{
initnewgroup();
rz+=5; ry+=7; rz+=6;
rx%=3600; ry%=3600; rz%=3600;
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,4000);
points2[0]=0; crotlist(points2,points);
//cclipedges(edges2,edges,points2);
points3[0]=0; cprojlist(points3,points2);
cpolylist(polylist,polys,edges,points3);
asm();
cdrawpolylist(polylist);
//cdrawpolylist(testlist);
setborder(40);
drawnewgroup();
setborder(10);
#if 0
n=edges[0];
for(a=2,b=0;b<n;b++)
{
p1=edges[a++];
p2=edges[a++];
a+=2;
testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
}
#endif
}
_asm mov ax,3
_asm int 10h
for(a=0;a<100;)
{
b=polylist[a++];
c=polylist[a++];
if(!b) break;
printf("s:%i c:%i v:",b,c);
for(x=0;x<b;x++)
{
printf("%i,%i ",polylist[a+0],polylist[a+1]);
a+=2;
}
printf("\n");
}
printf("points2: %Fp\n",points2);
}

103
GLENZ/MAINNORM.C Normal file
View file

@ -0,0 +1,103 @@
#include <stdio.h>
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
long points[32]={8,
-1000,-1000,-1000,
1000,-1000,-1000,
1000,1000,-1000,
-1000,1000,-1000,
-1000,-1000,1000,
1000,-1000,1000,
1000,1000,1000,
-1000,1000,1000};
long points2[64];
int points3[64*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x0010,0,1,2,3,
4,0x0018,0,8,4,9,
4,0x0020,1,9,5,10,
4,0x0028,2,10,6,11,
4,0x0030,3,11,7,12,
4,0x8038,4,5,6,7,
0};
int polylist[256];
int matrix[9];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2;
printf("Starting");
testasm();
initnewgroup();
initnewgroup();
while(!kbhit())
{
initnewgroup();
rz+=5; ry+=7; rz+=6;
rx%=3600; ry%=3600; rz%=3600;
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,4000);
points2[0]=0; crotlist(points2,points);
//cclipedges(edges2,edges,points2);
points3[0]=0; cprojlist(points3,points2);
cpolylist(polylist,polys,edges,points3);
asm();
cdrawpolylist(polylist);
//cdrawpolylist(testlist);
setborder(40);
drawnewgroup();
setborder(10);
#if 0
n=edges[0];
for(a=2,b=0;b<n;b++)
{
p1=edges[a++];
p2=edges[a++];
a+=2;
testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
}
#endif
}
_asm mov ax,3
_asm int 10h
for(a=0;a<100;)
{
b=polylist[a++];
c=polylist[a++];
if(!b) break;
printf("s:%i c:%i v:",b,c);
for(x=0;x<b;x++)
{
printf("%i,%i ",polylist[a+0],polylist[a+1]);
a+=2;
}
printf("\n");
}
printf("points2: %Fp\n",points2);
}

115
GLENZ/MAINTRAN.C Normal file
View file

@ -0,0 +1,115 @@
#include <stdio.h>
extern int csetmatrix(int *,long,long,long);
extern int crotlist(long *,long *);
extern int cclipedges(int *,int *,long *); // modifies given point list
extern int cprojlist(long *,long *);
extern int cdrawpolylist(int *);
extern int cmatrix_yxz(int,int,int,int *);
extern int cpolylist(int *polylist,int *polys,int *edges,long *points3);
long points[32]={8,
-1000,-1000,-1000,
1000,-1000,-1000,
1000,1000,-1000,
-1000,1000,-1000,
-1000,-1000,1000,
1000,-1000,1000,
1000,1000,1000,
-1000,1000,1000};
long points2[64];
int points3[64*2];
int edges[64]={12,0,
0,1,0,0,
1,2,0,0,
2,3,0,0,
3,0,0,0,
4,5,0,0, // 4
5,6,0,0,
6,7,0,0,
7,4,0,0,
0,4,0,0, // 8
1,5,0,0,
2,6,0,0,
3,7,0,0};
int edges2[64];
int polys[64]={
4,0x4004,0,1,2,3,
4,0x4008,0,8,4,9,
4,0x4010,1,9,5,10,
4,0x4020,2,10,6,11,
4,0x4040,3,11,7,12,
4,0x4080,4,5,6,7,
0};
int polylist[256];
int matrix[9];
int testlist[]={
3,16, 190,100, 90,50, 110,150,
3,20, 10,100, 90,50, 99,150,
0};
main()
{
int a,b,c,x,y,rx,ry,rz,n=8,p1,p2;
printf("Starting");
testasm();
outp(0x3c8,0);
for(a=0;a<256;a++)
{
int r=0,g=0,b=0;
if(a&4) r+=30;
if(a&8) g+=30;
if(a&16) b+=30;
if(a&32) { r+=30; g+=30; }
if(a&64) { g+=30; b+=30; }
if(a&128) { b+=30; r+=30; }
outp(0x3c9,r);
outp(0x3c9,g);
outp(0x3c9,b);
}
while(!kbhit())
{
initnewgroup();
rz+=5; ry+=7; rz+=6;
rx%=3600; ry%=3600; rz%=3600;
cmatrix_yxz(rx,ry,rz,matrix);
csetmatrix(matrix,0,0,4000);
points2[0]=0; crotlist(points2,points);
//cclipedges(edges2,edges,points2);
points3[0]=0; cprojlist(points3,points2);
cpolylist(polylist,polys,edges,points3);
asm();
cdrawpolylist(polylist);
//cdrawpolylist(testlist);
setborder(40);
drawnewgroup();
setborder(10);
#if 0
n=edges[0];
for(a=2,b=0;b<n;b++)
{
p1=edges[a++];
p2=edges[a++];
a+=2;
testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
}
#endif
}
_asm mov ax,3
_asm int 10h
for(a=0;a<100;)
{
b=polylist[a++];
c=polylist[a++];
if(!b) break;
printf("s:%i c:%i v:",b,c);
for(x=0;x<b;x++)
{
printf("%i,%i ",polylist[a+0],polylist[a+1]);
a+=2;
}
printf("\n");
}
printf("points2: %Fp\n",points2);
}

26
GLENZ/MAKEFILE Normal file
View file

@ -0,0 +1,26 @@
all : v.exe edge.exe
objs=zoomer.obj main.obj vid.obj zoom.obj adata.obj asm.obj vec.obj math.obj _fc.obk ..\dis\disc.obj
asm_f = /ML /m2 /s /JJUMPS
c_f = /AL /c /Oxaz /W2
.asm.obj :
tasm $(asm_f) $<
.c.obj :
cl /qc $(c_f) $<
v.exe : $(objs)
link /E $(objs),v.exe,v.map,gl10.lib;
copy v.exe ..\main\data\glenz.exe
vid.asm : vidpoly.asm vidinit.asm vidmisc.asm vidtwe.asm vidnrm.asm
vec.asm : veccmd.asm
vid.asm : new.asm
main.c : zoomer.c
edge.exe : edge.c
cl /qc /AL edge.c
zoom.asm : zoomloop.inc

426
GLENZ/MATH.ASM Normal file
View file

@ -0,0 +1,426 @@
include asm.inc
text__math SEGMENT para public 'CODE'
ASSUME cs:text__math
.386
include mathsin.inc
;rotate sins/coss
rxsin dw 0
rxcos dw 0
rysin dw 0
rycos dw 0
rzsin dw 0
rzcos dw 0
checkdeg MACRO reg
local l0,l1,l2
l0: cmp reg,3600
jb l1
jl l2
;>3600
sub reg,3600
jmp l0
l2: ;<0
add reg,3600
jmp l0
l1: ENDM
public _cmatrix_yxz
_cmatrix_yxz PROC FAR
CBEG
movpar ds,4
movpar si,3
mov di,si
movpar ax,0 ;rotx
mov ds:[si+2],ax
movpar ax,1 ;roty
mov ds:[si+0],ax
movpar ax,2 ;rotz
mov ds:[si+4],ax
call calcmatrix
CEND
_cmatrix_yxz ENDP
calcmatrix PROC NEAR ;rY*rX*rZ
;ds:[si+0]=rotx
;ds:[si+2]=roty
;ds:[si+4]=rotz
;dest: ds:[di]
;load values, check 'em and calc sin/cos
;ROT-X
mov bx,ds:[si]
checkdeg bx
mov ds:[si],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rxsin,ax
mov ax,cs:costable16[bx]
mov cs:rxcos,ax
;ROT-Y
mov bx,ds:[si+2]
checkdeg bx
mov ds:[si+2],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rysin,ax
mov ax,cs:costable16[bx]
mov cs:rycos,ax
;ROT-Z
mov bx,ds:[si+4]
checkdeg bx
mov ds:[si+4],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rzsin,ax
mov ax,cs:costable16[bx]
mov cs:rzcos,ax
;matrix equations: rY*rX*rZ
; 0=Ycos*Zcos- 2=Xsin*Ysin*Zcos+ 4=-Xcos*Ysin
; Xsin*Ysin*Zsin Ycos*Zsin
; 6=-Xcos*Zsin 8=Xcos*Zcos 10=Xsin
;
;12=Xsin*Ycos*Zsin+ 14=Ysin*Zsin- 16=Xcos*Ycos
; Ysin*Zcos Xsin*Ycos*Zcos\
mov ax,cs:rysin
imul cs:rzsin
shld dx,ax,1
mov ds:[di+14],dx ;14a
mov ax,cs:rycos
imul cs:rzcos
shld dx,ax,1
mov ds:[di+0],dx ;0a
mov ax,dx
imul cs:rxsin
shld dx,ax,1
sub ds:[di+14],dx ;14b
mov ax,cs:rxsin
imul cs:rysin
shld dx,ax,1
mov cx,dx
mov ax,cs:rzsin
imul dx
shld dx,ax,1
sub ds:[di+0],dx ;0b
mov ax,cs:rzcos
imul cx
shld dx,ax,1
mov ds:[di+2],dx ;2a
mov ax,cs:rycos
imul cs:rzsin
shld dx,ax,1
add ds:[di+2],dx ;2b
mov ax,cs:rxsin
imul dx
shld dx,ax,1
mov ds:[di+12],dx ;12a
mov ax,cs:rysin
imul cs:rzcos
shld dx,ax,1
add ds:[di+12],dx ;12b
mov ax,cs:rxcos
imul cs:rzsin
shld dx,ax,1
neg dx
mov ds:[di+6],dx ;6
mov ax,cs:rxcos
imul cs:rzcos
shld dx,ax,1
mov ds:[di+8],dx ;8
mov ax,cs:rxcos
imul cs:rysin
shld dx,ax,1
neg dx
mov ds:[di+4],dx ;4
mov ax,cs:rxcos
imul cs:rycos
shld dx,ax,1
mov ds:[di+16],dx ;16
mov ax,cs:rxsin
mov ds:[di+10],ax ;10
ret
calcmatrix ENDP
calcmatrixsep PROC NEAR ;calc 3 separate matrices
;ds:[si+0]=rotx
;ds:[si+2]=roty
;ds:[si+4]=rotz
;dest: ds:[di]
;load values, check 'em and calc sin/cos
;ROT-X
mov bx,ds:[si]
checkdeg bx
mov ds:[si],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rxsin,ax
mov ax,cs:costable16[bx]
mov cs:rxcos,ax
;ROT-Y
mov bx,ds:[si+2]
checkdeg bx
mov ds:[si+2],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rysin,ax
mov ax,cs:costable16[bx]
mov cs:rycos,ax
;ROT-Z
mov bx,ds:[si+4]
checkdeg bx
mov ds:[si+4],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rzsin,ax
mov ax,cs:costable16[bx]
mov cs:rzcos,ax
mov bx,0
mov cx,32767
;rX
mov ds:[di+0],cx
mov ds:[di+2],bx
mov ds:[di+4],bx
mov ds:[di+6],bx
mov ax,cs:rxcos
mov ds:[di+8],ax
mov ax,cs:rxsin
mov ds:[di+10],ax
mov ds:[di+12],bx
mov ax,cs:rxsin
neg ax
mov ds:[di+14],ax
mov ax,cs:rxcos
mov ds:[di+16],ax
add di,18
;rY
mov ax,cs:rycos
mov ds:[di+0],ax
mov ds:[di+2],bx
mov ax,cs:rysin
neg ax
mov ds:[di+4],ax
mov ds:[di+6],bx
mov ds:[di+8],cx
mov ds:[di+10],bx
mov ax,cs:rysin
mov ds:[di+12],ax
mov ds:[di+14],bx
mov ax,cs:rycos
mov ds:[di+16],ax
add di,18
;rZ
mov ax,cs:rzcos
mov ds:[di+0],ax
mov ax,cs:rzsin
mov ds:[di+2],ax
mov ds:[di+4],bx
mov ax,cs:rzsin
neg ax
mov ds:[di+6],ax
mov ax,cs:rzcos
mov ds:[di+8],ax
mov ds:[di+10],bx
mov ds:[di+12],bx
mov ds:[di+14],bx
mov ds:[di+16],cx
add di,18
ret
calcmatrixsep ENDP
calcmatrix0 PROC NEAR ;rX*rY*rZ
;ds:[si]=rotx
;ds:[si]=roty
;ds:[si]=rotz
;dest: ds:[di]
;load values, check 'em and calc sin/cos
;ROT-X
mov bx,ds:[si]
checkdeg bx
mov ds:[si],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rxsin,ax
mov ax,cs:costable16[bx]
mov cs:rxcos,ax
;ROT-Y
mov bx,ds:[si+2]
checkdeg bx
mov ds:[si+2],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rysin,ax
mov ax,cs:costable16[bx]
mov cs:rycos,ax
;ROT-Z
mov bx,ds:[si+4]
checkdeg bx
mov ds:[si+4],bx
shl bx,1
mov ax,cs:sintable16[bx]
mov cs:rzsin,ax
mov ax,cs:costable16[bx]
mov cs:rzcos,ax
;matrix equations: rX*rY*rZ ;rZ*rY*rX
; 0=Ycos*Zcos 2=Ycos*Zsin 4=-Ysin
; 6=Xsin*Zcos*Ysin 8=Xsin*Ysin*Zsin 10=Ycos*Xsin
; -Xcos*Zsin +Xcos*Zcos
;12=Xcos*Zcos*Ysin 14=Xcos*Ysin*Zsin 16=Ycos*Xcos
; +Xsin*Zsin -Xsin*Zcos
;calculate rotation matrix
;0,2,10,16,4
mov bx,cs:rycos
mov ax,cs:rzcos
imul bx
shld dx,ax,1
mov ds:[di+0],dx
;
mov ax,cs:rzsin
imul bx
shld dx,ax,1
mov ds:[di+2],dx
;
mov ax,cs:rxsin
imul bx
shld dx,ax,1
mov ds:[di+10],dx
;
mov ax,cs:rxcos
imul bx
shld dx,ax,1
mov ds:[di+16],dx
;
mov ax,cs:rysin
neg ax
mov ds:[di+4],ax
;6,8
mov ax,cs:rxsin
imul cs:rysin
shld dx,ax,1
mov cx,dx
;
mov ax,cx
imul cs:rzcos
shld dx,ax,1
mov ds:[di+6],dx
;
mov ax,cx
imul cs:rzsin
shld dx,ax,1
mov ds:[di+8],dx
;
mov bx,cs:rxcos
mov ax,cs:rzsin
imul bx
shld dx,ax,1
sub ds:[di+6],dx
;
mov ax,cs:rzcos
imul bx
shld dx,ax,1
add ds:[di+8],dx
;12,14
mov ax,cs:rxcos
imul cs:rysin
shld dx,ax,1
mov cx,dx
;
mov ax,cx
imul cs:rzcos
shld dx,ax,1
mov ds:[di+12],dx
;
mov ax,cx
imul cs:rzsin
shld dx,ax,1
mov ds:[di+14],dx
;
mov bx,cs:rxsin
mov ax,cs:rzsin
imul bx
shld dx,ax,1
add ds:[di+12],dx
;
mov ax,cs:rzcos
imul bx
shld dx,ax,1
sub ds:[di+14],dx
ret
calcmatrix0 ENDP
mulmacro MACRO row,col
mov ax,ds:[si+0+row*6]
imul word ptr es:[di+0+col*2]
mov cx,dx
mov bx,ax
mov ax,ds:[si+2+row*6]
imul word ptr es:[di+6+col*2]
add cx,dx
add bx,ax
mov ax,ds:[si+4+row*6]
imul word ptr es:[di+12+col*2]
add cx,dx
add bx,ax
shld cx,bx,1
ENDM
mulmatrices PROC NEAR
;ds:si=matrix1,es:di=matrix2 => ds:si (overwrite)
mulmacro 0,0
push cx
mulmacro 0,1
push cx
mulmacro 0,2
push cx
mulmacro 1,0
push cx
mulmacro 1,1
push cx
mulmacro 1,2
push cx
mulmacro 2,0
push cx
mulmacro 2,1
push cx
mulmacro 2,2
mov ds:[si+4+12],cx
pop word ptr ds:[si+2+12]
pop word ptr ds:[si+0+12]
pop word ptr ds:[si+4+6]
pop word ptr ds:[si+2+6]
pop word ptr ds:[si+0+6]
pop word ptr ds:[si+4]
pop word ptr ds:[si+2]
pop word ptr ds:[si+0]
ret
mulmatrices ENDP
text__math ENDS
END

BIN
GLENZ/MATH.OBJ Normal file

Binary file not shown.

547
GLENZ/MATHSIN.INC Normal file
View file

@ -0,0 +1,547 @@
sintable16 LABEL WORD
dw 0, 57, 114, 172, 229, 286, 343, 400, 457, 515
dw 572, 629, 686, 743, 801, 858, 915, 972, 1029, 1086
dw 1144, 1201, 1258, 1315, 1372, 1429, 1486, 1544, 1601, 1658
dw 1715, 1772, 1829, 1886, 1943, 2000, 2057, 2115, 2172, 2229
dw 2286, 2343, 2400, 2457, 2514, 2571, 2628, 2685, 2742, 2799
dw 2856, 2913, 2970, 3027, 3084, 3141, 3197, 3254, 3311, 3368
dw 3425, 3482, 3539, 3596, 3653, 3709, 3766, 3823, 3880, 3937
dw 3993, 4050, 4107, 4164, 4220, 4277, 4334, 4390, 4447, 4504
dw 4560, 4617, 4674, 4730, 4787, 4843, 4900, 4956, 5013, 5069
dw 5126, 5182, 5239, 5295, 5352, 5408, 5465, 5521, 5577, 5634
dw 5690, 5746, 5803, 5859, 5915, 5971, 6028, 6084, 6140, 6196
dw 6252, 6308, 6364, 6421, 6477, 6533, 6589, 6645, 6701, 6757
dw 6813, 6869, 6924, 6980, 7036, 7092, 7148, 7204, 7259, 7315
dw 7371, 7427, 7482, 7538, 7594, 7649, 7705, 7760, 7816, 7872
dw 7927, 7983, 8038, 8093, 8149, 8204, 8260, 8315, 8370, 8425
dw 8481, 8536, 8591, 8646, 8701, 8757, 8812, 8867, 8922, 8977
dw 9032, 9087, 9142, 9197, 9251, 9306, 9361, 9416, 9471, 9525
dw 9580, 9635, 9689, 9744, 9799, 9853, 9908, 9962, 10017, 10071
dw 10126, 10180, 10234, 10289, 10343, 10397, 10451, 10506, 10560, 10614
dw 10668, 10722, 10776, 10830, 10884, 10938, 10992, 11046, 11099, 11153
dw 11207, 11261, 11314, 11368, 11422, 11475, 11529, 11582, 11636, 11689
dw 11743, 11796, 11849, 11903, 11956, 12009, 12062, 12115, 12169, 12222
dw 12275, 12328, 12381, 12434, 12487, 12539, 12592, 12645, 12698, 12750
dw 12803, 12856, 12908, 12961, 13013, 13066, 13118, 13171, 13223, 13275
dw 13328, 13380, 13432, 13484, 13536, 13588, 13640, 13692, 13744, 13796
dw 13848, 13900, 13952, 14003, 14055, 14107, 14158, 14210, 14261, 14313
dw 14364, 14415, 14467, 14518, 14569, 14621, 14672, 14723, 14774, 14825
dw 14876, 14927, 14978, 15029, 15079, 15130, 15181, 15231, 15282, 15333
dw 15383, 15434, 15484, 15534, 15585, 15635, 15685, 15735, 15786, 15836
dw 15886, 15936, 15986, 16036, 16085, 16135, 16185, 16235, 16284, 16334
dw 16383, 16433, 16482, 16532, 16581, 16631, 16680, 16729, 16778, 16827
dw 16876, 16925, 16974, 17023, 17072, 17121, 17169, 17218, 17267, 17315
dw 17364, 17412, 17461, 17509, 17557, 17606, 17654, 17702, 17750, 17798
dw 17846, 17894, 17942, 17990, 18038, 18085, 18133, 18181, 18228, 18276
dw 18323, 18370, 18418, 18465, 18512, 18559, 18607, 18654, 18701, 18748
dw 18794, 18841, 18888, 18935, 18981, 19028, 19074, 19121, 19167, 19214
dw 19260, 19306, 19352, 19398, 19445, 19491, 19537, 19582, 19628, 19674
dw 19720, 19765, 19811, 19856, 19902, 19947, 19993, 20038, 20083, 20128
dw 20173, 20218, 20263, 20308, 20353, 20398, 20443, 20487, 20532, 20576
dw 20621, 20665, 20710, 20754, 20798, 20842, 20886, 20931, 20974, 21018
dw 21062, 21106, 21150, 21193, 21237, 21280, 21324, 21367, 21411, 21454
dw 21497, 21540, 21583, 21626, 21669, 21712, 21755, 21798, 21840, 21883
dw 21925, 21968, 22010, 22053, 22095, 22137, 22179, 22221, 22263, 22305
dw 22347, 22389, 22431, 22472, 22514, 22555, 22597, 22638, 22679, 22721
dw 22762, 22803, 22844, 22885, 22926, 22967, 23007, 23048, 23089, 23129
dw 23170, 23210, 23251, 23291, 23331, 23371, 23411, 23451, 23491, 23531
dw 23571, 23610, 23650, 23689, 23729, 23768, 23808, 23847, 23886, 23925
dw 23964, 24003, 24042, 24081, 24120, 24158, 24197, 24235, 24274, 24312
dw 24351, 24389, 24427, 24465, 24503, 24541, 24579, 24617, 24654, 24692
dw 24730, 24767, 24804, 24842, 24879, 24916, 24953, 24990, 25027, 25064
dw 25101, 25138, 25174, 25211, 25247, 25284, 25320, 25356, 25393, 25429
dw 25465, 25501, 25537, 25572, 25608, 25644, 25679, 25715, 25750, 25785
dw 25821, 25856, 25891, 25926, 25961, 25996, 26031, 26065, 26100, 26134
dw 26169, 26203, 26238, 26272, 26306, 26340, 26374, 26408, 26442, 26475
dw 26509, 26543, 26576, 26610, 26643, 26676, 26709, 26742, 26775, 26808
dw 26841, 26874, 26907, 26939, 26972, 27004, 27036, 27069, 27101, 27133
dw 27165, 27197, 27229, 27261, 27292, 27324, 27355, 27387, 27418, 27450
dw 27481, 27512, 27543, 27574, 27605, 27635, 27666, 27697, 27727, 27758
dw 27788, 27818, 27848, 27879, 27909, 27938, 27968, 27998, 28028, 28057
dw 28087, 28116, 28146, 28175, 28204, 28233, 28262, 28291, 28320, 28348
dw 28377, 28406, 28434, 28462, 28491, 28519, 28547, 28575, 28603, 28631
dw 28659, 28686, 28714, 28741, 28769, 28796, 28823, 28851, 28878, 28905
dw 28932, 28958, 28985, 29012, 29038, 29065, 29091, 29117, 29144, 29170
dw 29196, 29222, 29247, 29273, 29299, 29324, 29350, 29375, 29400, 29426
dw 29451, 29476, 29501, 29526, 29550, 29575, 29600, 29624, 29648, 29673
dw 29697, 29721, 29745, 29769, 29793, 29817, 29840, 29864, 29887, 29911
dw 29934, 29957, 29980, 30004, 30026, 30049, 30072, 30095, 30117, 30140
dw 30162, 30184, 30207, 30229, 30251, 30273, 30295, 30316, 30338, 30360
dw 30381, 30402, 30424, 30445, 30466, 30487, 30508, 30529, 30549, 30570
dw 30591, 30611, 30631, 30652, 30672, 30692, 30712, 30732, 30752, 30771
dw 30791, 30810, 30830, 30849, 30868, 30888, 30907, 30926, 30944, 30963
dw 30982, 31000, 31019, 31037, 31056, 31074, 31092, 31110, 31128, 31146
dw 31163, 31181, 31198, 31216, 31233, 31250, 31268, 31285, 31302, 31318
dw 31335, 31352, 31368, 31385, 31401, 31418, 31434, 31450, 31466, 31482
dw 31498, 31513, 31529, 31545, 31560, 31575, 31591, 31606, 31621, 31636
dw 31650, 31665, 31680, 31694, 31709, 31723, 31738, 31752, 31766, 31780
dw 31794, 31807, 31821, 31835, 31848, 31862, 31875, 31888, 31901, 31914
dw 31927, 31940, 31953, 31965, 31978, 31990, 32003, 32015, 32027, 32039
dw 32051, 32063, 32075, 32086, 32098, 32109, 32121, 32132, 32143, 32154
dw 32165, 32176, 32187, 32197, 32208, 32218, 32229, 32239, 32249, 32259
dw 32269, 32279, 32289, 32299, 32308, 32318, 32327, 32336, 32345, 32355
dw 32364, 32372, 32381, 32390, 32399, 32407, 32415, 32424, 32432, 32440
dw 32448, 32456, 32464, 32472, 32479, 32487, 32494, 32501, 32509, 32516
dw 32523, 32530, 32537, 32543, 32550, 32556, 32563, 32569, 32575, 32581
dw 32587, 32593, 32599, 32605, 32611, 32616, 32622, 32627, 32632, 32637
dw 32642, 32647, 32652, 32657, 32661, 32666, 32670, 32675, 32679, 32683
dw 32687, 32691, 32695, 32699, 32702, 32706, 32709, 32713, 32716, 32719
dw 32722, 32725, 32728, 32731, 32733, 32736, 32738, 32741, 32743, 32745
dw 32747, 32749, 32751, 32753, 32754, 32756, 32757, 32759, 32760, 32761
dw 32762, 32763, 32764, 32765, 32765, 32766, 32766, 32767, 32767, 32767
costable16 LABEL WORD
dw 32767, 32767, 32767, 32767, 32766, 32766, 32765, 32765, 32764, 32763
dw 32762, 32761, 32760, 32759, 32757, 32756, 32754, 32753, 32751, 32749
dw 32747, 32745, 32743, 32741, 32738, 32736, 32733, 32731, 32728, 32725
dw 32722, 32719, 32716, 32713, 32709, 32706, 32702, 32699, 32695, 32691
dw 32687, 32683, 32679, 32675, 32670, 32666, 32661, 32657, 32652, 32647
dw 32642, 32637, 32632, 32627, 32622, 32616, 32611, 32605, 32599, 32593
dw 32587, 32581, 32575, 32569, 32563, 32556, 32550, 32543, 32537, 32530
dw 32523, 32516, 32509, 32501, 32494, 32487, 32479, 32472, 32464, 32456
dw 32448, 32440, 32432, 32424, 32415, 32407, 32399, 32390, 32381, 32372
dw 32364, 32355, 32345, 32336, 32327, 32318, 32308, 32299, 32289, 32279
dw 32269, 32259, 32249, 32239, 32229, 32218, 32208, 32197, 32187, 32176
dw 32165, 32154, 32143, 32132, 32121, 32109, 32098, 32086, 32075, 32063
dw 32051, 32039, 32027, 32015, 32003, 31990, 31978, 31965, 31953, 31940
dw 31927, 31914, 31901, 31888, 31875, 31862, 31848, 31835, 31821, 31807
dw 31794, 31780, 31766, 31752, 31738, 31723, 31709, 31694, 31680, 31665
dw 31650, 31636, 31621, 31606, 31591, 31575, 31560, 31545, 31529, 31513
dw 31498, 31482, 31466, 31450, 31434, 31418, 31401, 31385, 31368, 31352
dw 31335, 31318, 31302, 31285, 31268, 31250, 31233, 31216, 31198, 31181
dw 31163, 31146, 31128, 31110, 31092, 31074, 31056, 31037, 31019, 31000
dw 30982, 30963, 30944, 30926, 30907, 30888, 30868, 30849, 30830, 30810
dw 30791, 30771, 30752, 30732, 30712, 30692, 30672, 30652, 30631, 30611
dw 30591, 30570, 30549, 30529, 30508, 30487, 30466, 30445, 30424, 30402
dw 30381, 30360, 30338, 30316, 30295, 30273, 30251, 30229, 30207, 30184
dw 30162, 30140, 30117, 30095, 30072, 30049, 30026, 30004, 29980, 29957
dw 29934, 29911, 29887, 29864, 29840, 29817, 29793, 29769, 29745, 29721
dw 29697, 29673, 29648, 29624, 29600, 29575, 29550, 29526, 29501, 29476
dw 29451, 29426, 29400, 29375, 29350, 29324, 29299, 29273, 29247, 29222
dw 29196, 29170, 29144, 29117, 29091, 29065, 29038, 29012, 28985, 28958
dw 28932, 28905, 28878, 28851, 28823, 28796, 28769, 28741, 28714, 28686
dw 28659, 28631, 28603, 28575, 28547, 28519, 28491, 28462, 28434, 28406
dw 28377, 28348, 28320, 28291, 28262, 28233, 28204, 28175, 28146, 28116
dw 28087, 28057, 28028, 27998, 27968, 27938, 27909, 27879, 27848, 27818
dw 27788, 27758, 27727, 27697, 27666, 27635, 27605, 27574, 27543, 27512
dw 27481, 27450, 27418, 27387, 27355, 27324, 27292, 27261, 27229, 27197
dw 27165, 27133, 27101, 27069, 27036, 27004, 26972, 26939, 26907, 26874
dw 26841, 26808, 26775, 26742, 26709, 26676, 26643, 26610, 26576, 26543
dw 26509, 26475, 26442, 26408, 26374, 26340, 26306, 26272, 26238, 26203
dw 26169, 26134, 26100, 26065, 26031, 25996, 25961, 25926, 25891, 25856
dw 25821, 25785, 25750, 25715, 25679, 25644, 25608, 25572, 25537, 25501
dw 25465, 25429, 25393, 25356, 25320, 25284, 25247, 25211, 25174, 25138
dw 25101, 25064, 25027, 24990, 24953, 24916, 24879, 24842, 24804, 24767
dw 24730, 24692, 24654, 24617, 24579, 24541, 24503, 24465, 24427, 24389
dw 24351, 24312, 24274, 24235, 24197, 24158, 24120, 24081, 24042, 24003
dw 23964, 23925, 23886, 23847, 23808, 23768, 23729, 23689, 23650, 23610
dw 23571, 23531, 23491, 23451, 23411, 23371, 23331, 23291, 23251, 23210
dw 23170, 23129, 23089, 23048, 23007, 22967, 22926, 22885, 22844, 22803
dw 22762, 22721, 22679, 22638, 22597, 22555, 22514, 22472, 22431, 22389
dw 22347, 22305, 22263, 22221, 22179, 22137, 22095, 22053, 22010, 21968
dw 21925, 21883, 21840, 21798, 21755, 21712, 21669, 21626, 21583, 21540
dw 21497, 21454, 21411, 21367, 21324, 21280, 21237, 21193, 21150, 21106
dw 21062, 21018, 20974, 20931, 20886, 20842, 20798, 20754, 20710, 20665
dw 20621, 20576, 20532, 20487, 20443, 20398, 20353, 20308, 20263, 20218
dw 20173, 20128, 20083, 20038, 19993, 19947, 19902, 19856, 19811, 19765
dw 19720, 19674, 19628, 19582, 19537, 19491, 19445, 19398, 19352, 19306
dw 19260, 19214, 19167, 19121, 19074, 19028, 18981, 18935, 18888, 18841
dw 18794, 18748, 18701, 18654, 18607, 18559, 18512, 18465, 18418, 18370
dw 18323, 18276, 18228, 18181, 18133, 18085, 18038, 17990, 17942, 17894
dw 17846, 17798, 17750, 17702, 17654, 17606, 17557, 17509, 17461, 17412
dw 17364, 17315, 17267, 17218, 17169, 17121, 17072, 17023, 16974, 16925
dw 16876, 16827, 16778, 16729, 16680, 16631, 16581, 16532, 16482, 16433
dw 16383, 16334, 16284, 16235, 16185, 16135, 16085, 16036, 15986, 15936
dw 15886, 15836, 15786, 15735, 15685, 15635, 15585, 15534, 15484, 15434
dw 15383, 15333, 15282, 15231, 15181, 15130, 15079, 15029, 14978, 14927
dw 14876, 14825, 14774, 14723, 14672, 14621, 14569, 14518, 14467, 14415
dw 14364, 14313, 14261, 14210, 14158, 14107, 14055, 14003, 13952, 13900
dw 13848, 13796, 13744, 13692, 13640, 13588, 13536, 13484, 13432, 13380
dw 13328, 13275, 13223, 13171, 13118, 13066, 13013, 12961, 12908, 12856
dw 12803, 12750, 12698, 12645, 12592, 12539, 12487, 12434, 12381, 12328
dw 12275, 12222, 12169, 12115, 12062, 12009, 11956, 11903, 11849, 11796
dw 11743, 11689, 11636, 11582, 11529, 11475, 11422, 11368, 11314, 11261
dw 11207, 11153, 11099, 11046, 10992, 10938, 10884, 10830, 10776, 10722
dw 10668, 10614, 10560, 10506, 10451, 10397, 10343, 10289, 10234, 10180
dw 10126, 10071, 10017, 9962, 9908, 9853, 9799, 9744, 9689, 9635
dw 9580, 9525, 9471, 9416, 9361, 9306, 9251, 9197, 9142, 9087
dw 9032, 8977, 8922, 8867, 8812, 8757, 8701, 8646, 8591, 8536
dw 8481, 8425, 8370, 8315, 8260, 8204, 8149, 8093, 8038, 7983
dw 7927, 7872, 7816, 7760, 7705, 7649, 7594, 7538, 7482, 7427
dw 7371, 7315, 7259, 7204, 7148, 7092, 7036, 6980, 6924, 6869
dw 6813, 6757, 6701, 6645, 6589, 6533, 6477, 6421, 6364, 6308
dw 6252, 6196, 6140, 6084, 6028, 5971, 5915, 5859, 5803, 5746
dw 5690, 5634, 5577, 5521, 5465, 5408, 5352, 5295, 5239, 5182
dw 5126, 5069, 5013, 4956, 4900, 4843, 4787, 4730, 4674, 4617
dw 4560, 4504, 4447, 4390, 4334, 4277, 4220, 4164, 4107, 4050
dw 3993, 3937, 3880, 3823, 3766, 3709, 3653, 3596, 3539, 3482
dw 3425, 3368, 3311, 3254, 3197, 3141, 3084, 3027, 2970, 2913
dw 2856, 2799, 2742, 2685, 2628, 2571, 2514, 2457, 2400, 2343
dw 2286, 2229, 2172, 2115, 2057, 2000, 1943, 1886, 1829, 1772
dw 1715, 1658, 1601, 1544, 1486, 1429, 1372, 1315, 1258, 1201
dw 1144, 1086, 1029, 972, 915, 858, 801, 743, 686, 629
dw 572, 515, 457, 400, 343, 286, 229, 172, 114, 57
dw 0, -56, -113, -171, -228, -285, -342, -399, -456, -514
dw -571, -628, -685, -742, -800, -857, -914, -971, -1028, -1085
dw -1143, -1200, -1257, -1314, -1371, -1428, -1485, -1543, -1600, -1657
dw -1714, -1771, -1828, -1885, -1942, -1999, -2056, -2114, -2171, -2228
dw -2285, -2342, -2399, -2456, -2513, -2570, -2627, -2684, -2741, -2798
dw -2855, -2912, -2969, -3026, -3083, -3140, -3196, -3253, -3310, -3367
dw -3424, -3481, -3538, -3595, -3652, -3708, -3765, -3822, -3879, -3936
dw -3992, -4049, -4106, -4163, -4219, -4276, -4333, -4389, -4446, -4503
dw -4559, -4616, -4673, -4729, -4786, -4842, -4899, -4955, -5012, -5068
dw -5125, -5181, -5238, -5294, -5351, -5407, -5464, -5520, -5576, -5633
dw -5689, -5745, -5802, -5858, -5914, -5970, -6027, -6083, -6139, -6195
dw -6251, -6307, -6363, -6420, -6476, -6532, -6588, -6644, -6700, -6756
dw -6812, -6868, -6923, -6979, -7035, -7091, -7147, -7203, -7258, -7314
dw -7370, -7426, -7481, -7537, -7593, -7648, -7704, -7759, -7815, -7871
dw -7926, -7982, -8037, -8092, -8148, -8203, -8259, -8314, -8369, -8424
dw -8480, -8535, -8590, -8645, -8700, -8756, -8811, -8866, -8921, -8976
dw -9031, -9086, -9141, -9196, -9250, -9305, -9360, -9415, -9470, -9524
dw -9579, -9634, -9688, -9743, -9798, -9852, -9907, -9961,-10016,-10070
dw -10125,-10179,-10233,-10288,-10342,-10396,-10450,-10505,-10559,-10613
dw -10667,-10721,-10775,-10829,-10883,-10937,-10991,-11045,-11098,-11152
dw -11206,-11260,-11313,-11367,-11421,-11474,-11528,-11581,-11635,-11688
dw -11742,-11795,-11848,-11902,-11955,-12008,-12061,-12114,-12168,-12221
dw -12274,-12327,-12380,-12433,-12486,-12538,-12591,-12644,-12697,-12749
dw -12802,-12855,-12907,-12960,-13012,-13065,-13117,-13170,-13222,-13274
dw -13327,-13379,-13431,-13483,-13535,-13587,-13639,-13691,-13743,-13795
dw -13847,-13899,-13951,-14002,-14054,-14106,-14157,-14209,-14260,-14312
dw -14363,-14414,-14466,-14517,-14568,-14620,-14671,-14722,-14773,-14824
dw -14875,-14926,-14977,-15028,-15078,-15129,-15180,-15230,-15281,-15332
dw -15382,-15433,-15483,-15533,-15584,-15634,-15684,-15734,-15785,-15835
dw -15885,-15935,-15985,-16035,-16084,-16134,-16184,-16234,-16283,-16333
dw -16382,-16432,-16481,-16531,-16580,-16630,-16679,-16728,-16777,-16826
dw -16875,-16924,-16973,-17022,-17071,-17120,-17168,-17217,-17266,-17314
dw -17363,-17411,-17460,-17508,-17556,-17605,-17653,-17701,-17749,-17797
dw -17845,-17893,-17941,-17989,-18037,-18084,-18132,-18180,-18227,-18275
dw -18322,-18369,-18417,-18464,-18511,-18558,-18606,-18653,-18700,-18747
dw -18793,-18840,-18887,-18934,-18980,-19027,-19073,-19120,-19166,-19213
dw -19259,-19305,-19351,-19397,-19444,-19490,-19536,-19581,-19627,-19673
dw -19719,-19764,-19810,-19855,-19901,-19946,-19992,-20037,-20082,-20127
dw -20172,-20217,-20262,-20307,-20352,-20397,-20442,-20486,-20531,-20575
dw -20620,-20664,-20709,-20753,-20797,-20841,-20885,-20930,-20973,-21017
dw -21061,-21105,-21149,-21192,-21236,-21279,-21323,-21366,-21410,-21453
dw -21496,-21539,-21582,-21625,-21668,-21711,-21754,-21797,-21839,-21882
dw -21924,-21967,-22009,-22052,-22094,-22136,-22178,-22220,-22262,-22304
dw -22346,-22388,-22430,-22471,-22513,-22554,-22596,-22637,-22678,-22720
dw -22761,-22802,-22843,-22884,-22925,-22966,-23006,-23047,-23088,-23128
dw -23169,-23209,-23250,-23290,-23330,-23370,-23410,-23450,-23490,-23530
dw -23570,-23609,-23649,-23688,-23728,-23767,-23807,-23846,-23885,-23924
dw -23963,-24002,-24041,-24080,-24119,-24157,-24196,-24234,-24273,-24311
dw -24350,-24388,-24426,-24464,-24502,-24540,-24578,-24616,-24653,-24691
dw -24729,-24766,-24803,-24841,-24878,-24915,-24952,-24989,-25026,-25063
dw -25100,-25137,-25173,-25210,-25246,-25283,-25319,-25355,-25392,-25428
dw -25464,-25500,-25536,-25571,-25607,-25643,-25678,-25714,-25749,-25784
dw -25820,-25855,-25890,-25925,-25960,-25995,-26030,-26064,-26099,-26133
dw -26168,-26202,-26237,-26271,-26305,-26339,-26373,-26407,-26441,-26474
dw -26508,-26542,-26575,-26609,-26642,-26675,-26708,-26741,-26774,-26807
dw -26840,-26873,-26906,-26938,-26971,-27003,-27035,-27068,-27100,-27132
dw -27164,-27196,-27228,-27260,-27291,-27323,-27354,-27386,-27417,-27449
dw -27480,-27511,-27542,-27573,-27604,-27634,-27665,-27696,-27726,-27757
dw -27787,-27817,-27847,-27878,-27908,-27937,-27967,-27997,-28027,-28056
dw -28086,-28115,-28145,-28174,-28203,-28232,-28261,-28290,-28319,-28347
dw -28376,-28405,-28433,-28461,-28490,-28518,-28546,-28574,-28602,-28630
dw -28658,-28685,-28713,-28740,-28768,-28795,-28822,-28850,-28877,-28904
dw -28931,-28957,-28984,-29011,-29037,-29064,-29090,-29116,-29143,-29169
dw -29195,-29221,-29246,-29272,-29298,-29323,-29349,-29374,-29399,-29425
dw -29450,-29475,-29500,-29525,-29549,-29574,-29599,-29623,-29647,-29672
dw -29696,-29720,-29744,-29768,-29792,-29816,-29839,-29863,-29886,-29910
dw -29933,-29956,-29979,-30003,-30025,-30048,-30071,-30094,-30116,-30139
dw -30161,-30183,-30206,-30228,-30250,-30272,-30294,-30315,-30337,-30359
dw -30380,-30401,-30423,-30444,-30465,-30486,-30507,-30528,-30548,-30569
dw -30590,-30610,-30630,-30651,-30671,-30691,-30711,-30731,-30751,-30770
dw -30790,-30809,-30829,-30848,-30867,-30887,-30906,-30925,-30943,-30962
dw -30981,-30999,-31018,-31036,-31055,-31073,-31091,-31109,-31127,-31145
dw -31162,-31180,-31197,-31215,-31232,-31249,-31267,-31284,-31301,-31317
dw -31334,-31351,-31367,-31384,-31400,-31417,-31433,-31449,-31465,-31481
dw -31497,-31512,-31528,-31544,-31559,-31574,-31590,-31605,-31620,-31635
dw -31649,-31664,-31679,-31693,-31708,-31722,-31737,-31751,-31765,-31779
dw -31793,-31806,-31820,-31834,-31847,-31861,-31874,-31887,-31900,-31913
dw -31926,-31939,-31952,-31964,-31977,-31989,-32002,-32014,-32026,-32038
dw -32050,-32062,-32074,-32085,-32097,-32108,-32120,-32131,-32142,-32153
dw -32164,-32175,-32186,-32196,-32207,-32217,-32228,-32238,-32248,-32258
dw -32268,-32278,-32288,-32298,-32307,-32317,-32326,-32335,-32344,-32354
dw -32363,-32371,-32380,-32389,-32398,-32406,-32414,-32423,-32431,-32439
dw -32447,-32455,-32463,-32471,-32478,-32486,-32493,-32500,-32508,-32515
dw -32522,-32529,-32536,-32542,-32549,-32555,-32562,-32568,-32574,-32580
dw -32586,-32592,-32598,-32604,-32610,-32615,-32621,-32626,-32631,-32636
dw -32641,-32646,-32651,-32656,-32660,-32665,-32669,-32674,-32678,-32682
dw -32686,-32690,-32694,-32698,-32701,-32705,-32708,-32712,-32715,-32718
dw -32721,-32724,-32727,-32730,-32732,-32735,-32737,-32740,-32742,-32744
dw -32746,-32748,-32750,-32752,-32753,-32755,-32756,-32758,-32759,-32760
dw -32761,-32762,-32763,-32764,-32764,-32765,-32765,-32766,-32766,-32766
dw -32766,-32766,-32766,-32766,-32765,-32765,-32764,-32764,-32763,-32762
dw -32761,-32760,-32759,-32758,-32756,-32755,-32753,-32752,-32750,-32748
dw -32746,-32744,-32742,-32740,-32737,-32735,-32732,-32730,-32727,-32724
dw -32721,-32718,-32715,-32712,-32708,-32705,-32701,-32698,-32694,-32690
dw -32686,-32682,-32678,-32674,-32669,-32665,-32660,-32656,-32651,-32646
dw -32641,-32636,-32631,-32626,-32621,-32615,-32610,-32604,-32598,-32592
dw -32586,-32580,-32574,-32568,-32562,-32555,-32549,-32542,-32536,-32529
dw -32522,-32515,-32508,-32500,-32493,-32486,-32478,-32471,-32463,-32455
dw -32447,-32439,-32431,-32423,-32414,-32406,-32398,-32389,-32380,-32371
dw -32363,-32354,-32344,-32335,-32326,-32317,-32307,-32298,-32288,-32278
dw -32268,-32258,-32248,-32238,-32228,-32217,-32207,-32196,-32186,-32175
dw -32164,-32153,-32142,-32131,-32120,-32108,-32097,-32085,-32074,-32062
dw -32050,-32038,-32026,-32014,-32002,-31989,-31977,-31964,-31952,-31939
dw -31926,-31913,-31900,-31887,-31874,-31861,-31847,-31834,-31820,-31806
dw -31793,-31779,-31765,-31751,-31737,-31722,-31708,-31693,-31679,-31664
dw -31649,-31635,-31620,-31605,-31590,-31574,-31559,-31544,-31528,-31512
dw -31497,-31481,-31465,-31449,-31433,-31417,-31400,-31384,-31367,-31351
dw -31334,-31317,-31301,-31284,-31267,-31249,-31232,-31215,-31197,-31180
dw -31162,-31145,-31127,-31109,-31091,-31073,-31055,-31036,-31018,-30999
dw -30981,-30962,-30943,-30925,-30906,-30887,-30867,-30848,-30829,-30809
dw -30790,-30770,-30751,-30731,-30711,-30691,-30671,-30651,-30630,-30610
dw -30590,-30569,-30548,-30528,-30507,-30486,-30465,-30444,-30423,-30401
dw -30380,-30359,-30337,-30315,-30294,-30272,-30250,-30228,-30206,-30183
dw -30161,-30139,-30116,-30094,-30071,-30048,-30025,-30003,-29979,-29956
dw -29933,-29910,-29886,-29863,-29839,-29816,-29792,-29768,-29744,-29720
dw -29696,-29672,-29647,-29623,-29599,-29574,-29549,-29525,-29500,-29475
dw -29450,-29425,-29399,-29374,-29349,-29323,-29298,-29272,-29246,-29221
dw -29195,-29169,-29143,-29116,-29090,-29064,-29037,-29011,-28984,-28957
dw -28931,-28904,-28877,-28850,-28822,-28795,-28768,-28740,-28713,-28685
dw -28658,-28630,-28602,-28574,-28546,-28518,-28490,-28461,-28433,-28405
dw -28376,-28347,-28319,-28290,-28261,-28232,-28203,-28174,-28145,-28115
dw -28086,-28056,-28027,-27997,-27967,-27937,-27908,-27878,-27847,-27817
dw -27787,-27757,-27726,-27696,-27665,-27634,-27604,-27573,-27542,-27511
dw -27480,-27449,-27417,-27386,-27354,-27323,-27291,-27260,-27228,-27196
dw -27164,-27132,-27100,-27068,-27035,-27003,-26971,-26938,-26906,-26873
dw -26840,-26807,-26774,-26741,-26708,-26675,-26642,-26609,-26575,-26542
dw -26508,-26474,-26441,-26407,-26373,-26339,-26305,-26271,-26237,-26202
dw -26168,-26133,-26099,-26064,-26030,-25995,-25960,-25925,-25890,-25855
dw -25820,-25784,-25749,-25714,-25678,-25643,-25607,-25571,-25536,-25500
dw -25464,-25428,-25392,-25355,-25319,-25283,-25246,-25210,-25173,-25137
dw -25100,-25063,-25026,-24989,-24952,-24915,-24878,-24841,-24803,-24766
dw -24729,-24691,-24653,-24616,-24578,-24540,-24502,-24464,-24426,-24388
dw -24350,-24311,-24273,-24234,-24196,-24157,-24119,-24080,-24041,-24002
dw -23963,-23924,-23885,-23846,-23807,-23767,-23728,-23688,-23649,-23609
dw -23570,-23530,-23490,-23450,-23410,-23370,-23330,-23290,-23250,-23209
dw -23169,-23128,-23088,-23047,-23006,-22966,-22925,-22884,-22843,-22802
dw -22761,-22720,-22678,-22637,-22596,-22554,-22513,-22471,-22430,-22388
dw -22346,-22304,-22262,-22220,-22178,-22136,-22094,-22052,-22009,-21967
dw -21924,-21882,-21839,-21797,-21754,-21711,-21668,-21625,-21582,-21539
dw -21496,-21453,-21410,-21366,-21323,-21279,-21236,-21192,-21149,-21105
dw -21061,-21017,-20973,-20930,-20885,-20841,-20797,-20753,-20709,-20664
dw -20620,-20575,-20531,-20486,-20442,-20397,-20352,-20307,-20262,-20217
dw -20172,-20127,-20082,-20037,-19992,-19946,-19901,-19855,-19810,-19764
dw -19719,-19673,-19627,-19581,-19536,-19490,-19444,-19397,-19351,-19305
dw -19259,-19213,-19166,-19120,-19073,-19027,-18980,-18934,-18887,-18840
dw -18793,-18747,-18700,-18653,-18606,-18558,-18511,-18464,-18417,-18369
dw -18322,-18275,-18227,-18180,-18132,-18084,-18037,-17989,-17941,-17893
dw -17845,-17797,-17749,-17701,-17653,-17605,-17556,-17508,-17460,-17411
dw -17363,-17314,-17266,-17217,-17168,-17120,-17071,-17022,-16973,-16924
dw -16875,-16826,-16777,-16728,-16679,-16630,-16580,-16531,-16481,-16432
dw -16383,-16333,-16283,-16234,-16184,-16134,-16084,-16035,-15985,-15935
dw -15885,-15835,-15785,-15734,-15684,-15634,-15584,-15533,-15483,-15433
dw -15382,-15332,-15281,-15230,-15180,-15129,-15078,-15028,-14977,-14926
dw -14875,-14824,-14773,-14722,-14671,-14620,-14568,-14517,-14466,-14414
dw -14363,-14312,-14260,-14209,-14157,-14106,-14054,-14002,-13951,-13899
dw -13847,-13795,-13743,-13691,-13639,-13587,-13535,-13483,-13431,-13379
dw -13327,-13274,-13222,-13170,-13117,-13065,-13012,-12960,-12907,-12855
dw -12802,-12749,-12697,-12644,-12591,-12538,-12486,-12433,-12380,-12327
dw -12274,-12221,-12168,-12114,-12061,-12008,-11955,-11902,-11848,-11795
dw -11742,-11688,-11635,-11581,-11528,-11474,-11421,-11367,-11313,-11260
dw -11206,-11152,-11098,-11045,-10991,-10937,-10883,-10829,-10775,-10721
dw -10667,-10613,-10559,-10505,-10450,-10396,-10342,-10288,-10233,-10179
dw -10125,-10070,-10016, -9961, -9907, -9852, -9798, -9743, -9688, -9634
dw -9579, -9524, -9470, -9415, -9360, -9305, -9250, -9196, -9141, -9086
dw -9031, -8976, -8921, -8866, -8811, -8756, -8700, -8645, -8590, -8535
dw -8480, -8424, -8369, -8314, -8259, -8203, -8148, -8092, -8037, -7982
dw -7926, -7871, -7815, -7759, -7704, -7648, -7593, -7537, -7481, -7426
dw -7370, -7314, -7258, -7203, -7147, -7091, -7035, -6979, -6923, -6868
dw -6812, -6756, -6700, -6644, -6588, -6532, -6476, -6420, -6363, -6307
dw -6251, -6195, -6139, -6083, -6027, -5970, -5914, -5858, -5802, -5745
dw -5689, -5633, -5576, -5520, -5464, -5407, -5351, -5294, -5238, -5181
dw -5125, -5068, -5012, -4955, -4899, -4842, -4786, -4729, -4673, -4616
dw -4559, -4503, -4446, -4389, -4333, -4276, -4219, -4163, -4106, -4049
dw -3992, -3936, -3879, -3822, -3765, -3708, -3652, -3595, -3538, -3481
dw -3424, -3367, -3310, -3253, -3196, -3140, -3083, -3026, -2969, -2912
dw -2855, -2798, -2741, -2684, -2627, -2570, -2513, -2456, -2399, -2342
dw -2285, -2228, -2171, -2114, -2056, -1999, -1942, -1885, -1828, -1771
dw -1714, -1657, -1600, -1543, -1485, -1428, -1371, -1314, -1257, -1200
dw -1143, -1085, -1028, -971, -914, -857, -800, -742, -685, -628
dw -571, -514, -456, -399, -342, -285, -228, -171, -113, -56;(cosine continued)
dw 0, 57, 114, 172, 229, 286, 343, 400, 457, 515
dw 572, 629, 686, 743, 801, 858, 915, 972, 1029, 1086
dw 1144, 1201, 1258, 1315, 1372, 1429, 1486, 1544, 1601, 1658
dw 1715, 1772, 1829, 1886, 1943, 2000, 2057, 2115, 2172, 2229
dw 2286, 2343, 2400, 2457, 2514, 2571, 2628, 2685, 2742, 2799
dw 2856, 2913, 2970, 3027, 3084, 3141, 3197, 3254, 3311, 3368
dw 3425, 3482, 3539, 3596, 3653, 3709, 3766, 3823, 3880, 3937
dw 3993, 4050, 4107, 4164, 4220, 4277, 4334, 4390, 4447, 4504
dw 4560, 4617, 4674, 4730, 4787, 4843, 4900, 4956, 5013, 5069
dw 5126, 5182, 5239, 5295, 5352, 5408, 5465, 5521, 5577, 5634
dw 5690, 5746, 5803, 5859, 5915, 5971, 6028, 6084, 6140, 6196
dw 6252, 6308, 6364, 6421, 6477, 6533, 6589, 6645, 6701, 6757
dw 6813, 6869, 6924, 6980, 7036, 7092, 7148, 7204, 7259, 7315
dw 7371, 7427, 7482, 7538, 7594, 7649, 7705, 7760, 7816, 7872
dw 7927, 7983, 8038, 8093, 8149, 8204, 8260, 8315, 8370, 8425
dw 8481, 8536, 8591, 8646, 8701, 8757, 8812, 8867, 8922, 8977
dw 9032, 9087, 9142, 9197, 9251, 9306, 9361, 9416, 9471, 9525
dw 9580, 9635, 9689, 9744, 9799, 9853, 9908, 9962, 10017, 10071
dw 10126, 10180, 10234, 10289, 10343, 10397, 10451, 10506, 10560, 10614
dw 10668, 10722, 10776, 10830, 10884, 10938, 10992, 11046, 11099, 11153
dw 11207, 11261, 11314, 11368, 11422, 11475, 11529, 11582, 11636, 11689
dw 11743, 11796, 11849, 11903, 11956, 12009, 12062, 12115, 12169, 12222
dw 12275, 12328, 12381, 12434, 12487, 12539, 12592, 12645, 12698, 12750
dw 12803, 12856, 12908, 12961, 13013, 13066, 13118, 13171, 13223, 13275
dw 13328, 13380, 13432, 13484, 13536, 13588, 13640, 13692, 13744, 13796
dw 13848, 13900, 13952, 14003, 14055, 14107, 14158, 14210, 14261, 14313
dw 14364, 14415, 14467, 14518, 14569, 14621, 14672, 14723, 14774, 14825
dw 14876, 14927, 14978, 15029, 15079, 15130, 15181, 15231, 15282, 15333
dw 15383, 15434, 15484, 15534, 15585, 15635, 15685, 15735, 15786, 15836
dw 15886, 15936, 15986, 16036, 16085, 16135, 16185, 16235, 16284, 16334
dw 16383, 16433, 16482, 16532, 16581, 16631, 16680, 16729, 16778, 16827
dw 16876, 16925, 16974, 17023, 17072, 17121, 17169, 17218, 17267, 17315
dw 17364, 17412, 17461, 17509, 17557, 17606, 17654, 17702, 17750, 17798
dw 17846, 17894, 17942, 17990, 18038, 18085, 18133, 18181, 18228, 18276
dw 18323, 18370, 18418, 18465, 18512, 18559, 18607, 18654, 18701, 18748
dw 18794, 18841, 18888, 18935, 18981, 19028, 19074, 19121, 19167, 19214
dw 19260, 19306, 19352, 19398, 19445, 19491, 19537, 19582, 19628, 19674
dw 19720, 19765, 19811, 19856, 19902, 19947, 19993, 20038, 20083, 20128
dw 20173, 20218, 20263, 20308, 20353, 20398, 20443, 20487, 20532, 20576
dw 20621, 20665, 20710, 20754, 20798, 20842, 20886, 20931, 20974, 21018
dw 21062, 21106, 21150, 21193, 21237, 21280, 21324, 21367, 21411, 21454
dw 21497, 21540, 21583, 21626, 21669, 21712, 21755, 21798, 21840, 21883
dw 21925, 21968, 22010, 22053, 22095, 22137, 22179, 22221, 22263, 22305
dw 22347, 22389, 22431, 22472, 22514, 22555, 22597, 22638, 22679, 22721
dw 22762, 22803, 22844, 22885, 22926, 22967, 23007, 23048, 23089, 23129
dw 23170, 23210, 23251, 23291, 23331, 23371, 23411, 23451, 23491, 23531
dw 23571, 23610, 23650, 23689, 23729, 23768, 23808, 23847, 23886, 23925
dw 23964, 24003, 24042, 24081, 24120, 24158, 24197, 24235, 24274, 24312
dw 24351, 24389, 24427, 24465, 24503, 24541, 24579, 24617, 24654, 24692
dw 24730, 24767, 24804, 24842, 24879, 24916, 24953, 24990, 25027, 25064
dw 25101, 25138, 25174, 25211, 25247, 25284, 25320, 25356, 25393, 25429
dw 25465, 25501, 25537, 25572, 25608, 25644, 25679, 25715, 25750, 25785
dw 25821, 25856, 25891, 25926, 25961, 25996, 26031, 26065, 26100, 26134
dw 26169, 26203, 26238, 26272, 26306, 26340, 26374, 26408, 26442, 26475
dw 26509, 26543, 26576, 26610, 26643, 26676, 26709, 26742, 26775, 26808
dw 26841, 26874, 26907, 26939, 26972, 27004, 27036, 27069, 27101, 27133
dw 27165, 27197, 27229, 27261, 27292, 27324, 27355, 27387, 27418, 27450
dw 27481, 27512, 27543, 27574, 27605, 27635, 27666, 27697, 27727, 27758
dw 27788, 27818, 27848, 27879, 27909, 27938, 27968, 27998, 28028, 28057
dw 28087, 28116, 28146, 28175, 28204, 28233, 28262, 28291, 28320, 28348
dw 28377, 28406, 28434, 28462, 28491, 28519, 28547, 28575, 28603, 28631
dw 28659, 28686, 28714, 28741, 28769, 28796, 28823, 28851, 28878, 28905
dw 28932, 28958, 28985, 29012, 29038, 29065, 29091, 29117, 29144, 29170
dw 29196, 29222, 29247, 29273, 29299, 29324, 29350, 29375, 29400, 29426
dw 29451, 29476, 29501, 29526, 29550, 29575, 29600, 29624, 29648, 29673
dw 29697, 29721, 29745, 29769, 29793, 29817, 29840, 29864, 29887, 29911
dw 29934, 29957, 29980, 30004, 30026, 30049, 30072, 30095, 30117, 30140
dw 30162, 30184, 30207, 30229, 30251, 30273, 30295, 30316, 30338, 30360
dw 30381, 30402, 30424, 30445, 30466, 30487, 30508, 30529, 30549, 30570
dw 30591, 30611, 30631, 30652, 30672, 30692, 30712, 30732, 30752, 30771
dw 30791, 30810, 30830, 30849, 30868, 30888, 30907, 30926, 30944, 30963
dw 30982, 31000, 31019, 31037, 31056, 31074, 31092, 31110, 31128, 31146
dw 31163, 31181, 31198, 31216, 31233, 31250, 31268, 31285, 31302, 31318
dw 31335, 31352, 31368, 31385, 31401, 31418, 31434, 31450, 31466, 31482
dw 31498, 31513, 31529, 31545, 31560, 31575, 31591, 31606, 31621, 31636
dw 31650, 31665, 31680, 31694, 31709, 31723, 31738, 31752, 31766, 31780
dw 31794, 31807, 31821, 31835, 31848, 31862, 31875, 31888, 31901, 31914
dw 31927, 31940, 31953, 31965, 31978, 31990, 32003, 32015, 32027, 32039
dw 32051, 32063, 32075, 32086, 32098, 32109, 32121, 32132, 32143, 32154
dw 32165, 32176, 32187, 32197, 32208, 32218, 32229, 32239, 32249, 32259
dw 32269, 32279, 32289, 32299, 32308, 32318, 32327, 32336, 32345, 32355
dw 32364, 32372, 32381, 32390, 32399, 32407, 32415, 32424, 32432, 32440
dw 32448, 32456, 32464, 32472, 32479, 32487, 32494, 32501, 32509, 32516
dw 32523, 32530, 32537, 32543, 32550, 32556, 32563, 32569, 32575, 32581
dw 32587, 32593, 32599, 32605, 32611, 32616, 32622, 32627, 32632, 32637
dw 32642, 32647, 32652, 32657, 32661, 32666, 32670, 32675, 32679, 32683
dw 32687, 32691, 32695, 32699, 32702, 32706, 32709, 32713, 32716, 32719
dw 32722, 32725, 32728, 32731, 32733, 32736, 32738, 32741, 32743, 32745
dw 32747, 32749, 32751, 32753, 32754, 32756, 32757, 32759, 32760, 32761
dw 32762, 32763, 32764, 32765, 32765, 32766, 32766, 32767, 32767, 32767
ALIGN 4
dd -99999999
tantable32 LABEL DWORD
dd 0, 114, 229, 343, 458, 572, 686, 801, 915, 1030
dd 1144, 1258, 1373, 1487, 1602, 1716, 1831, 1945, 2060, 2174
dd 2289, 2403, 2518, 2632, 2747, 2861, 2976, 3091, 3205, 3320
dd 3435, 3549, 3664, 3779, 3894, 4008, 4123, 4238, 4353, 4468
dd 4583, 4698, 4813, 4928, 5043, 5158, 5273, 5388, 5503, 5618
dd 5734, 5849, 5964, 6080, 6195, 6310, 6426, 6541, 6657, 6772
dd 6888, 7004, 7119, 7235, 7351, 7467, 7583, 7699, 7815, 7931
dd 8047, 8163, 8279, 8395, 8512, 8628, 8744, 8861, 8977, 9094
dd 9210, 9327, 9444, 9561, 9678, 9794, 9911, 10028, 10146, 10263
dd 10380, 10497, 10615, 10732, 10849, 10967, 11085, 11202, 11320, 11438
dd 11556, 11674, 11792, 11910, 12028, 12146, 12265, 12383, 12502, 12620
dd 12739, 12858, 12976, 13095, 13214, 13333, 13453, 13572, 13691, 13811
dd 13930, 14050, 14169, 14289, 14409, 14529, 14649, 14769, 14889, 15010
dd 15130, 15251, 15371, 15492, 15613, 15734, 15855, 15976, 16097, 16219
dd 16340, 16462, 16583, 16705, 16827, 16949, 17071, 17193, 17315, 17438
dd 17560, 17683, 17806, 17929, 18052, 18175, 18298, 18421, 18545, 18668
dd 18792, 18916, 19040, 19164, 19288, 19413, 19537, 19662, 19786, 19911
dd 20036, 20162, 20287, 20412, 20538, 20663, 20789, 20915, 21041, 21168
dd 21294, 21420, 21547, 21674, 21801, 21928, 22055, 22183, 22310, 22438
dd 22566, 22694, 22822, 22950, 23079, 23208, 23336, 23465, 23594, 23724
dd 23853, 23983, 24113, 24243, 24373, 24503, 24633, 24764, 24895, 25026
dd 25157, 25288, 25420, 25551, 25683, 25815, 25948, 26080, 26213, 26345
dd 26478, 26611, 26745, 26878, 27012, 27146, 27280, 27414, 27549, 27683
dd 27818, 27953, 28089, 28224, 28360, 28496, 28632, 28768, 28905, 29042
dd 29179, 29316, 29453, 29591, 29728, 29866, 30005, 30143, 30282, 30421
dd 30560, 30699, 30839, 30979, 31119, 31259, 31400, 31540, 31681, 31823
dd 31964, 32106, 32248, 32390, 32532, 32675, 32818, 32961, 33105, 33248
dd 33392, 33536, 33681, 33826, 33971, 34116, 34261, 34407, 34553, 34700
dd 34846, 34993, 35140, 35288, 35435, 35583, 35731, 35880, 36029, 36178
dd 36327, 36477, 36627, 36777, 36928, 37078, 37230, 37381, 37533, 37685
dd 37837, 37990, 38143, 38296, 38450, 38604, 38758, 38912, 39067, 39222
dd 39378, 39534, 39690, 39847, 40003, 40161, 40318, 40476, 40634, 40793
dd 40951, 41111, 41270, 41430, 41590, 41751, 41912, 42073, 42235, 42397
dd 42560, 42722, 42886, 43049, 43213, 43377, 43542, 43707, 43873, 44038
dd 44205, 44371, 44538, 44706, 44873, 45042, 45210, 45379, 45549, 45719
dd 45889, 46059, 46231, 46402, 46574, 46746, 46919, 47092, 47266, 47440
dd 47615, 47790, 47965, 48141, 48317, 48494, 48671, 48849, 49027, 49206
dd 49385, 49564, 49745, 49925, 50106, 50288, 50470, 50652, 50835, 51018
dd 51202, 51387, 51572, 51757, 51943, 52130, 52317, 52504, 52692, 52881
dd 53070, 53260, 53450, 53641, 53832, 54024, 54216, 54409, 54603, 54797
dd 54991, 55186, 55382, 55579, 55776, 55973, 56171, 56370, 56569, 56769
dd 56970, 57171, 57372, 57575, 57778, 57981, 58186, 58390, 58596, 58802
dd 59009, 59216, 59424, 59633, 59843, 60053, 60263, 60475, 60687, 60900
dd 61113, 61328, 61542, 61758, 61974, 62191, 62409, 62628, 62847, 63067
dd 63287, 63509, 63731, 63954, 64178, 64402, 64627, 64853, 65080, 65308
dd 65536, 65765, 65995, 66226, 66458, 66690, 66923, 67157, 67392, 67628
dd 67865, 68102, 68340, 68580, 68820, 69061, 69302, 69545, 69789, 70033
dd 70279, 70525, 70772, 71021, 71270, 71520, 71771, 72023, 72276, 72530
dd 72785, 73041, 73298, 73556, 73815, 74075, 74336, 74598, 74861, 75125
dd 75391, 75657, 75924, 76193, 76462, 76733, 77005, 77277, 77551, 77827
dd 78103, 78380, 78659, 78938, 79219, 79502, 79785, 80069, 80355, 80642
dd 80930, 81220, 81510, 81802, 82096, 82390, 82686, 82983, 83281, 83581
dd 83882, 84185, 84489, 84794, 85100, 85408, 85718, 86028, 86340, 86654
dd 86969, 87286, 87604, 87923, 88244, 88567, 88891, 89216, 89544, 89872
dd 90203, 90534, 90868, 91203, 91540, 91878, 92218, 92560, 92903, 93248
dd 93595, 93944, 94294, 94646, 95000, 95355, 95713, 96072, 96433, 96796
dd 97161, 97528, 97897, 98267, 98640, 99014, 99391, 99769, 100150, 100532
dd 100917, 101303, 101692, 102083, 102476, 102871, 103268, 103668, 104069, 104473
dd 104880, 105288, 105699, 106112, 106527, 106945, 107365, 107788, 108213, 108640
dd 109070, 109503, 109938, 110375, 110815, 111258, 111703, 112151, 112602, 113056
dd 113512, 113971, 114432, 114897, 115364, 115834, 116308, 116784, 117263, 117745
dd 118230, 118718, 119210, 119704, 120202, 120702, 121206, 121714, 122224, 122738
dd 123255, 123776, 124300, 124828, 125359, 125893, 126432, 126974, 127519, 128069
dd 128622, 129179, 129739, 130304, 130872, 131445, 132021, 132602, 133187, 133776
dd 134369, 134966, 135568, 136174, 136784, 137399, 138018, 138642, 139271, 139904
dd 140542, 141185, 141833, 142485, 143143, 143806, 144473, 145146, 145824, 146508
dd 147196, 147890, 148590, 149295, 150006, 150722, 151445, 152173, 152907, 153647
dd 154393, 155145, 155904, 156669, 157440, 158218, 159002, 159793, 160591, 161396
dd 162207, 163026, 163852, 164685, 165525, 166373, 167228, 168091, 168962, 169841
dd 170727, 171622, 172525, 173436, 174356, 175284, 176221, 177167, 178122, 179086
dd 180059, 181041, 182033, 183035, 184046, 185068, 186100, 187141, 188194, 189257
dd 190330, 191415, 192511, 193618, 194736, 195866, 197008, 198163, 199329, 200508
dd 201699, 202903, 204121, 205351, 206596, 207854, 209126, 210412, 211713, 213028
dd 214359, 215704, 217066, 218443, 219836, 221246, 222672, 224116, 225576, 227055
dd 228551, 230066, 231599, 233152, 234724, 236315, 237927, 239559, 241213, 242887
dd 244584, 246302, 248044, 249808, 251597, 253409, 255246, 257108, 258996, 260910
dd 262851, 264819, 266815, 268839, 270893, 272977, 275091, 277237, 279414, 281624
dd 283868, 286145, 288458, 290806, 293191, 295614, 298075, 300575, 303116, 305698
dd 308323, 310991, 313703, 316461, 319266, 322120, 325022, 327976, 330981, 334040
dd 337153, 340324, 343552, 346839, 350189, 353601, 357078, 360621, 364234, 367917
dd 371673, 375504, 379413, 383401, 387472, 391628, 395871, 400204, 404631, 409155
dd 413778, 418504, 423337, 428280, 433337, 438512, 443809, 449233, 454788, 460480
dd 466313, 472292, 478424, 484715, 491169, 497795, 504599, 511589, 518771, 526154
dd 533748, 541560, 549601, 557881, 566411, 575202, 584267, 593618, 603269, 613236
dd 623533, 634179, 645190, 656586, 668388, 680617, 693298, 706457, 720119, 734316
dd 749080, 764444, 780447, 797130, 814536, 832714, 851716, 871601, 892431, 914274
dd 937208, 961317, 986692, 1013437, 1041665, 1071504, 1103096, 1136601, 1172197, 1210088
dd 1250501, 1293700, 1339981, 1389688, 1443215, 1501021, 1563642, 1631704, 1705950, 1787264
dd 1876705, 1975558, 2085389, 2208138, 2346225, 2502719, 2681563, 2887917, 3128656, 3413159
dd 3754555, 4171808, 4693365, 5363928, 6257998, 7509682, 9387188, 12516340, 18774605, 37549324
dd 1024-900 dup(99999999)

306
GLENZ/NEW.9 Normal file
View file

@ -0,0 +1,306 @@
;!!!!!! TRANSPARENT NEW COPPER !!!!!!
FREELINE equ 200
PUBLIC _newsinus,_newsinusx
_newsinus dw 512 dup(0)
_newsinusx dw -1
newgroup PROC NEAR
;hline list in gs:si
push ds
mov ax,SEG newdata
mov ds,ax
mov bx,gs:[si]
add si,2
@@1: mov ax,gs:[si]
add si,2
cmp ax,-32767
je @@2
mov dx,gs:[si]
add si,2
cmp bx,7eh
jne @@z
@@z: push bx
;hline ax..dx,bx with gs:color
cmp ax,dx
jle @@3
xchg ax,dx
@@3: ;
mov cx,cs:_newsinusx
cmp cx,-1
je @@nosin
push bx
add bx,cx
shl bx,1
add ax,cs:_newsinus[bx]
add dx,cs:_newsinus[bx]
pop bx
@@nosin:;
cmp ax,0
jge @@11
xor ax,ax
cmp dx,0
jl @@0
@@11: cmp dx,320
jle @@12
mov dx,320
cmp ax,320
jg @@0
@@12: push dx
shl bx,1
mov dx,ds:[bx]
mov bp,ds:[FREELINE*2]
mov ds:[bx],bp
mov ds:[FREELINE*2],dx
mov bx,dx
;modify list bx=>bp (edx/hi=last color)
;copy blocks < hline start
xor edx,edx
@@b: mov ecx,ds:[bx]
cmp cx,ax
jae @@a ;[bx] bigger..
add bx,4
mov ds:[bp],ecx
add bp,4
jmp @@b
@@a: ;add hline start
jne @@aa
mov ds:[bp],ax
mov ax,gs:color
ror ecx,16
xor ax,cx
mov ds:[bp+2],ax
add bp,4
add bx,4
mov ecx,ds:[bx]
pop ax
jmp @@d
@@aa: rol eax,16
mov ax,gs:color
rol eax,16
mov ds:[bp],eax
add bp,4
;copy blocks < hline end
pop ax
@@d: cmp cx,ax
jae @@c
add bx,4
mov ds:[bp],ecx
add bp,4
mov edx,ecx
mov ecx,ds:[bx]
jmp @@d
@@c: ;add hline end
jne @@ca
mov ds:[bp],ax
mov ax,gs:color
ror ecx,16
xor ax,cx
mov ds:[bp+2],ax
add bp,4
add bx,4
mov ecx,ds:[bx]
jmp @@f
@@ca: mov ds:[bp],ax
mov ax,gs:color
mov ds:[bp+2],ax
add bp,4
;copy rest of the list
@@f: cmp cx,32767
je @@e
add bx,4
mov ds:[bp],ecx
add bp,4
mov ecx,ds:[bx]
jmp @@f
@@e: ;last
mov ds:[bp],ecx
@@0: pop bx
inc bx
jmp @@1
@@2: pop ds
ret
newgroup ENDP
grouppage dw 1024
PUBLIC _initnewgroup
_initnewgroup PROC FAR
CBEG
mov ax,SEG newdata
mov ds,ax
mov dx,cs:grouppage
xor dx,32768
mov cs:grouppage,dx
mov cx,201
xor bx,bx
@@2: mov ax,ds:[bx]
mov ds:[bx],dx
mov ds:[bx+256*2],ax
add dx,128
add bx,2
loop @@2
mov cx,200
mov eax,32767
mov bx,cs:grouppage
@@1: mov ds:[bx],eax
add bx,128
loop @@1
CEND
_initnewgroup ENDP
ALIGN 2
dng_bgcolor dw 0
dng_rowbase dw 0
dng_random dw 0
PUBLIC _drawnewgroup
_drawnewgroup PROC FAR
CBEG
LOADDS
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov es,ds:vram
mov ax,SEG newdata
mov gs,ax
mov cx,200
xor bx,bx
xor di,di
@@3: push bx
push cx
push di
shl bx,1
mov si,gs:[bx]
mov di,gs:[bx+512] ;last time row (for sorting out differences)
mov bp,32768
;si=thistime
;di=lasttime
;dl=thiscolor
;dh=lastcolor
;cx=thisX
;bx=lastX
;ax=X
;bp=tmpdest
mov dx,cs:dng_bgcolor
mov dh,dl
xor ax,ax
mov cx,gs:[si]
mov bx,gs:[di]
@@1: cmp bx,cx
je @@10
jl @@2
;cx..bx
cmp dl,dh
je @@5
;ax..cx color dl
mov gs:[bp],ax
mov gs:[bp+2],cx
add bp,6
mov gs:[bp+4-6],dx
@@5: mov ax,cx
xor dl,gs:[si+2]
add si,4
mov cx,gs:[si]
jmp @@1
@@10: ;bx=cx
cmp bx,32767
je @@7
cmp dl,dh
je @@11
;ax..bx color dl
mov gs:[bp],ax
mov gs:[bp+2],bx
add bp,6
mov gs:[bp+4-6],dx
@@11: mov ax,bx
xor dh,gs:[di+2]
add di,4
mov bx,gs:[di]
xor dl,gs:[si+2]
add si,4
mov cx,gs:[si]
jmp @@1
@@2: ;bx..cx
cmp dl,dh
je @@4
;ax..bx color dl
mov gs:[bp],ax
mov gs:[bp+2],bx
mov gs:[bp+4],dx
add bp,6
@@4: mov ax,bx
xor dh,gs:[di+2]
add di,4
mov bx,gs:[di]
jmp @@1
@@7: pop di
;this line data in 8000h..bp
mov si,32768
cmp si,bp
je @@8
@@6: mov edx,gs:[si]
mov bx,dx
shr edx,16
mov ch,gs:[si+4]
;
mov cl,bl
and cl,3
mov al,00fh
rol al,cl
mov cl,dl
and cl,3
mov ah,0f0h
rol ah,cl
shr bx,2
shr dx,2
cmp bx,dx
jne @@h1
and al,ah
mov dx,3c5h
out dx,al
mov es:[di+bx],ch
jmp @@h0
@@h1: inc bx
cmp bx,dx
jne @@h2
mov dx,3c5h
out dx,al
mov es:[di+bx-1],ch
mov al,ah
out dx,al
mov es:[di+bx],ch
jmp @@h0
@@h2: push di
mov cl,dl
sub cl,bl
add di,bx
mov dx,3c5h
out dx,al
mov es:[di-1],ch
mov al,0fh
out dx,al
mov al,ch
xor ch,ch
rep stosb
xchg al,ah
out dx,al
mov es:[di],ah
pop di
@@h0: ;
add si,6
cmp si,bp
jb @@6
@@8: pop cx
pop bx
add di,80
inc bx
loop @@3
CEND
_drawnewgroup ENDP

270
GLENZ/NEW.ABK Normal file
View file

@ -0,0 +1,270 @@
;!!!!!! TRANSPARENT NEW COPPER !!!!!!
FREELINE equ 200
ALIGN 2
newrows LABEL WORD
cc=0
REPT 200
dw cc
cc=cc+320
ENDM
PUBLIC _newsinus,_newsinusx
_newsinus dw 512 dup(0)
_newsinusx dw -1
newgroup PROC NEAR
;hline list in gs:si
push ds
mov ax,SEG newdata1
mov ds,ax
mov ax,SEG newdata2
mov fs,ax
mov bx,gs:[si]
shl bx,1
mov bx,cs:newrows[bx]
add si,2
mov al,gs:color1
@@1: mov edx,gs:[si]
cmp dx,-32767
je @@2
mov di,dx
shr edx,16
add si,4
cmp di,dx
jl @@133
xchg di,dx
@@133: cmp di,1
jl @@11
@@111: cmp dx,319
jg @@12
@@122: add di,bx
xor ds:[di],al
shr di,2
mov byte ptr fs:[di],1
mov di,dx
add di,bx
xor ds:[di],al
shr di,2
mov byte ptr fs:[di],1
@@0: add bx,320
jmp @@1
@@2: pop ds
ret
@@11: mov di,1
cmp dx,1
jl @@0
jmp @@111
@@12: mov dx,319
cmp di,319
jg @@0
jmp @@122
newgroup ENDP
PUBLIC _initnewgroup
_initnewgroup PROC FAR
CBEG
mov ax,SEG newdata2
mov ds,ax
mov ax,-1
mov ds:[8000h],ax
mov ds:[8000h+4000h],ax
CEND
_initnewgroup ENDP
ALIGN 2
dng_bgcolor dw 0
dng_rowbase dw 0
dng_random dw 0
dng_page dw 8000h
checkdword PROC NEAR
mov edx,fs:[bx]
xor eax,eax
mov fs:[bx],eax ;=0
or dl,dl
jnz @@1
@@1b: or dh,dh
jnz @@2
@@2b: shr edx,16
or dl,dl
jnz @@3
@@3b: or dh,dh
jnz @@4
ret
@@4: mov al,dh
shl eax,16
lea ax,[bx+3]
mov ds:[si],eax
add si,4
ret
@@3: mov al,dl
shl eax,16
lea ax,[bx+2]
mov ds:[si],eax
add si,4
jmp @@3b
@@2: mov al,dh
shl eax,16
lea ax,[bx+1]
mov ds:[si],eax
add si,4
jmp @@2b
@@1: mov al,dl
shl eax,16
lea ax,[bx]
mov ds:[si],eax
add si,4
jmp @@1b
checkdword ENDP
PUBLIC _drawnewgroup
_drawnewgroup PROC FAR
CBEG
LOADDS
cld
mov dx,3c4h
mov ax,0f02h
out dx,ax
;mov ax,SEG newdata1
;mov ds,ax
;xor si,si
;mov ax,0a000h
;mov es,ax
;xor di,di
;mov cx,16000
;rep movsd
mov ax,SEG newdata2
mov es,ax
mov ax,SEG newdata1
mov fs,ax
xor di,di
mov ax,SEG newdata2
mov ds,ax
mov si,cs:dng_page
xor si,4000h
mov cs:dng_page,si
INT3
mov cx,4000
@@9: xor eax,eax
repz scasd
jcxz @@10
lea bx,[di-4]
mov edx,es:[bx]
mov es:[bx],eax ;=0
shl bx,2
or dl,dl
jz @@c1
xchg ebp,edx
call checkdword
xchg ebp,edx
@@c1: add bx,4
or dh,dh
jz @@c2
xchg ebp,edx
call checkdword
xchg ebp,edx
@@c2: add bx,4
shr edx,16
or dl,dl
jz @@c3
xchg ebp,edx
call checkdword
xchg ebp,edx
@@c3: add bx,4
or dh,dh
jz @@c4
xchg ebp,edx
call checkdword
xchg ebp,edx
@@c4: jmp @@9
;
@@10: mov eax,-1
mov ds:[si],eax
setborder 4
mov ax,0a000h
mov es,ax
xor di,di
mov si,cs:dng_page
mov bx,si
xor bx,4000h
xor ax,ax
;si=new bx=last
;cx=newpos dx=lastpos
;al=newcol ah=lastcol
mov edx,ds:[bx]
add bx,4
mov ecx,ds:[si]
add si,4
;
@@21: cmp dx,cx
jb @@23
je @@22
;cx<dx
cmp al,ah
je @@31
push cx
sub cx,di
cmp cx,4
jae @@r1
rep stosb
pop cx
@@31: mov di,cx
shr ecx,16
xor al,cl
mov ecx,ds:[si]
add si,4
jmp @@21
@@r1: push ax
mov ah,al
test di,1
jz @@r11
dec cx
stosb
@@r11: shr cx,1
rep stosw
adc cx,cx
rep stosb
pop ax
pop cx
jmp @@31
@@22: ;cx=dx
cmp cx,-1
je @@20
@@23: ;dx<cx
cmp al,ah
je @@32
push cx
mov cx,dx
sub cx,di
cmp cx,4
jae @@r2
rep stosb
pop cx
@@32: mov di,dx
shr edx,16
xor ah,dl
mov edx,ds:[bx]
add bx,4
jmp @@21
@@r2: push ax
mov ah,al
test di,1
jz @@r21
dec cx
stosb
@@r21: shr cx,1
rep stosw
adc cx,cx
rep stosb
pop ax
pop cx
jmp @@32
@@20: CEND
_drawnewgroup ENDP

418
GLENZ/NEW.ASM Normal file
View file

@ -0,0 +1,418 @@
;!!!!!! TRANSPARENT NEW COPPER !!!!!!
public __ndebug1
__ndebug1 dw 0
NROWS equ 256
MAXLINES equ 512
ndp0 dw 0 ;toggling pointer inside newdata1
ndp dw 0 ;pointer inside newdata1
nec dw 0 ;pointer to next free in ne
nlc dw 0 ;items in horizontal list
ALIGN 4
nep dw NROWS dup(0)
ALIGN 4
ne db MAXLINES dup(16 dup(0))
NE_X equ 0 ;dd
NE_Y1 equ 4 ;dw
NE_Y2 equ 6 ;dw
NE_COLOR equ 8 ;dw
NE_NEXT equ 10 ;dw
NE_DX equ 12 ;dd
ALIGN 4
nl db 256 dup(0)
ng_init PROC NEAR
mov cs:nec,OFFSET ne
mov ax,cs:ndp0
xor ax,8000h
mov cs:ndp0,ax
mov cs:ndp,ax
mov cx,NROWS/2
mov ax,cs
mov es,ax
xor eax,eax
mov di,OFFSET nep
rep stosd
mov ax,SEG newdata1
mov ds,ax
cmp word ptr ds:[0],0
jne @@1
mov word ptr ds:[0],-1
@@1: cmp word ptr ds:[8000h],0
jne @@2
mov word ptr ds:[8000h],-1
@@2: ret
ng_init ENDP
ALIGN 2
yrow dw 0
yrowad dw 0
siend dw 0
fillmacro MACRO
local l1,l2
jcxz l2
push ax
l1: mov ah,al
or ah,fs:[di]
mov es:[di],ah
inc di
loop l1
pop ax
l2: ENDM
ng_pass3 PROC NEAR
mov ax,SEG newdata1
mov ds,ax
mov ax,0a000h
mov es,ax
mov ax,SEG _bgpic
mov fs,ax
xor di,di
mov si,cs:ndp0
mov bx,si
xor bx,8000h
xor ax,ax
;si=new bx=last
;cx=newpos dx=lastpos
;al=newcol ah=lastcol
mov edx,ds:[bx]
add bx,4
mov ecx,ds:[si]
add si,4
;
@@21: cmp dx,cx
jb @@23
je @@22
;cx<dx
cmp al,ah
je @@31
push cx
sub cx,di
;cmp cx,4
;jae @@r1
;rep stosb
fillmacro
pop cx
@@31: mov di,cx
shr ecx,16
xor al,cl
mov ecx,ds:[si]
add si,4
jmp @@21
@@r1: push ax
mov ah,al
test di,1
jz @@r11
dec cx
stosb
@@r11: shr cx,1
rep stosw
adc cx,cx
rep stosb
pop ax
pop cx
jmp @@31
@@22: ;cx=dx
cmp cx,-1
je @@20
@@23: ;dx<cx
cmp al,ah
je @@32
push cx
mov cx,dx
sub cx,di
;cmp cx,4
;jae @@r2
;rep stosb
fillmacro
pop cx
@@32: mov di,dx
shr edx,16
xor ah,dl
mov edx,ds:[bx]
add bx,4
jmp @@21
@@r2: push ax
mov ah,al
test di,1
jz @@r21
dec cx
stosb
@@r21: shr cx,1
rep stosw
adc cx,cx
rep stosb
pop ax
pop cx
jmp @@32
@@20: ret
mov ax,0a000h
mov es,ax
mov ax,SEG newdata1
mov ds,ax
xor si,si
xor di,di
xor ax,ax
mov dx,cs:ndp
@@1: mov cx,ds:[si]
sub cx,di
rep stosb
xor al,ds:[si+2]
add si,4
cmp si,dx
jb @@1
ret
ng_pass3 ENDP
ng_pass2 PROC NEAR
mov bp,OFFSET nep
mov di,OFFSET nl
mov cx,200 ;NROWS
mov cs:yrow,0
mov cs:yrowad,0
@@1: push cx
;di=pointer to this row list end
;bp=pointer to nep
;add new items this row
mov bx,cs:[bp]
jmp @@3
@@2: mov cs:[di],bx
add di,2
mov bx,cs:[bx+NE_NEXT]
@@3: cmp bx,0
jne @@2
;sort this row (insertion sort)
push bp
push di
mov bp,di
mov si,OFFSET nl+2
jmp @@4
@@5: ;for(k=1;k<listc;k++) { // k=SI
mov bx,cs:[si] ;bx=list[k]
mov dx,bx ;dx=i
mov eax,cs:[bx+NE_X] ;eax=x
mov di,si
sub di,2 ;di=j
jmp @@6
;;;for(j=k-1;j>=0 && x<e[list[j]].x;j--) {
@@9: mov cs:[di+2],bx ;bx=cs:di
sub di,2
@@6: cmp di,OFFSET nl
jge @@8
jmp @@7
@@8: mov bx,cs:[di]
cmp eax,cs:[bx+NE_X]
jl @@9
@@7: ;;;}
mov cs:[di+2],dx
add si,2
@@4: cmp si,bp
jb @@5
;}
pop di
;bp=nl end
;process list & kill finished lines
mov cs:siend,bp
mov ax,SEG newdata1
mov fs,ax
mov bp,cs:ndp
mov dx,cs:yrow
mov cx,8000h
mov si,OFFSET nl
mov di,si
jmp @@10
@@11: mov bx,cs:[si]
cmp dx,cs:[bx+NE_Y2]
jge @@12
mov cs:[di],bx
add di,2
mov eax,cs:[bx+NE_X]
push eax
add eax,cs:[bx+NE_DX]
;sub dword ptr cs:[bx+NE_DX],500
mov cs:[bx+NE_X],eax
pop eax
shr eax,16
;clip X
cmp ax,319
jle @@15
mov ax,319
@@15: cmp ax,1
jge @@16
mov ax,1
@@16: ;
cmp cx,ax
jne @@14
;same x pos
mov ax,cs:[bx+NE_COLOR]
xor fs:[bp-2],ax
jmp @@12
@@14: ;new x pos
add ax,cs:yrowad
mov fs:[bp+0],ax
mov ax,cs:[bx+NE_COLOR]
mov fs:[bp+2],ax
add bp,4
mov cx,ax
@@12: add si,2
@@10: cmp si,cs:siend
jb @@11
mov cs:ndp,bp
pop bp
pop cx
inc cs:yrow
add cs:yrowad,320
add bp,2
loop @@1
mov bx,cs:ndp
mov word ptr fs:[bx+0],63999
mov word ptr fs:[bx+2],0
add bx,4
mov word ptr fs:[bx+0],-1
mov word ptr fs:[bx+2],0
add bx,4
mov cs:ndp,bx
ret
ng_pass2 ENDP
tmp_firstvx dw 0
tmp_color dw 0
public __newgroup
__newgroup PROC FAR
;es:di=polygroup
;sides,color,x,y,x,y,x,y,...
;sides=0=end
cmp ax,0
jne @@ng1
call ng_init
ret
@@ng1: cmp ax,1
je @@ng2
setborder 2
call ng_pass2
setborder 3
call ng_pass3
ret
@@ng2: setborder 1
;add polygons to list
mov bp,cs:nec
@@2: mov cx,es:[di] ;sides
cmp cx,0
je @@1
mov ax,es:[di+2] ;color
mov cs:tmp_color,ax
mov si,di
add di,4
mov cs:tmp_firstvx,di
@@3: add si,4
add di,4
cmp cx,1
jne @@4
mov di,cs:tmp_firstvx
@@4: push cx
;dx=color, si->start, di->end
mov ax,cs:tmp_color
mov cs:[bp+NE_COLOR],ax
mov bx,es:[si+2] ;y1
mov cx,es:[di+2] ;y2
cmp bx,cx
jg @@i1 ;y1>y2
mov ax,es:[si+0] ;x1
mov dx,es:[di+0] ;x2
jmp @@i0
@@i1: xchg bx,cx
mov ax,es:[di+0] ;x1
mov dx,es:[si+0] ;x2
@@i0: ;ax,bx=xy1 dx,cx=xy2
@@i9: mov cs:[bp+NE_Y1],bx
mov cs:[bp+NE_Y2],cx
mov word ptr cs:[bp+NE_X],0
mov cs:[bp+NE_X+2],ax
neg ax
add ax,dx
shl eax,16
cdq
sub cx,bx
;cx=y2-y1,edx:eax=(x2-x1)<<16
cmp cx,0
je @@n1 ;skip horizontal lines
movzx ecx,cx
idiv ecx
mov cs:[bp+NE_DX],eax
;!!!if y1<0, clip
cmp bx,0
jge @@nc
mov dx,cs:[bp+NE_Y2]
cmp dx,0
jle @@n1
neg bx
movzx ebx,bx
imul ebx
add cs:[bp+NE_X],eax
xor bx,bx
mov cs:[bp+NE_Y1],bx
@@nc: ;!!!
shl bx,1
mov ax,cs:nep[bx]
or ax,ax
jnz @@j1
;first on this row
mov cs:nep[bx],bp
mov word ptr cs:[bp+NE_NEXT],0
jmp @@j0
@@j1: ;add to this row
;scan if already exists
push ax
push si
mov si,ax
jmp @@h11
@@h1: mov si,cs:[si+NE_NEXT]
@@h11: mov ax,cs:[bp+NE_Y2]
cmp ax,cs:[si+NE_Y2]
jne @@h2
mov eax,cs:[bp+NE_X]
cmp eax,cs:[si+NE_X]
jne @@h2
mov eax,cs:[bp+NE_DX]
cmp eax,cs:[si+NE_DX]
jne @@h2
;duplicate line SI
mov al,cs:[bp+NE_COLOR]
xor cs:[si+NE_COLOR],al
pop si
pop ax
jmp @@n1
@@h2: cmp si,0
jne @@h1 ;end of list
@@h3: pop si
pop ax
mov cs:nep[bx],bp
mov word ptr cs:[bp+NE_NEXT],ax
@@j0: add bp,16
@@n1: ;next
pop cx
loop @@3
add si,4
mov di,si
jmp @@2
@@1: mov cs:nec,bp
sub bp,OFFSET ne
shr bp,4
mov cs:__ndebug1,bp
ret
__newgroup ENDP

20
GLENZ/NEW.CUT Normal file
View file

@ -0,0 +1,20 @@
mov ax,0a000h
mov es,ax
xor di,di
xor ax,ax
mov cx,32000
rep stosw
mov ax,SEG newdata1
mov ds,ax
xor si,si
xor di,di
xor ax,ax
mov dx,cs:ndp
@@b: mov bx,ds:[si]
mov al,ds:[si+2]
xor es:[bx],al
add si,4
cmp si,dx
jb @@b
ret

206
GLENZ/NEW1.ASM Normal file
View file

@ -0,0 +1,206 @@
FREELINE equ 200
ALIGN 2
bgcolor dw 101h
newgroup PROC NEAR
;hline list in gs:si
push ds
mov ax,SEG newdata
mov ds,ax
mov bx,gs:[si]
add si,2
@@1: mov ax,gs:[si]
add si,2
cmp ax,-32767
je @@2
mov dx,gs:[si]
add si,2
cmp bx,7eh
jne @@z
@@z: push bx
;hline ax..dx,bx with gs:color
cmp ax,dx
jle @@3
xchg ax,dx
@@3: push dx
shl bx,1
mov dx,ds:[bx]
mov bp,ds:[FREELINE*2]
mov ds:[bx],bp
mov ds:[FREELINE*2],dx
mov bx,dx
;modify list bx=>bp (edx/hi=last color)
;copy blocks < hline start
xor edx,edx
@@b: mov ecx,ds:[bx]
cmp cx,ax
jae @@a ;[bx] bigger..
add bx,4
mov ds:[bp],ecx
add bp,4
jmp @@b
@@a: ;add hline start
jne @@aa
mov edx,ecx
add bx,4
mov ecx,ds:[bx]
@@aa: mov ds:[bp],ax
mov ax,gs:color
mov ah,al
mov ds:[bp+2],ax
add bp,4
;copy blocks < hline end
pop ax
@@d: cmp cx,ax
jae @@c
add bx,4
mov edx,ecx
mov ecx,ds:[bx]
jmp @@d
@@c: ;add hline end
jne @@ca
mov edx,ecx
add bx,4
mov ecx,ds:[bx]
@@ca: mov dx,ax
mov ds:[bp],edx
add bp,4
;copy rest of the list
@@f: cmp cx,32767
je @@e
add bx,4
mov ds:[bp],ecx
add bp,4
mov ecx,ds:[bx]
jmp @@f
@@e: ;last
mov ds:[bp],ecx
pop bx
inc bx
jmp @@1
@@2: pop ds
ret
newgroup ENDP
grouppage dw 1024
PUBLIC _initnewgroup
_initnewgroup PROC FAR
CBEG
mov ax,SEG newdata
mov ds,ax
mov dx,cs:grouppage
xor dx,32768
mov cs:grouppage,dx
mov cx,201
xor bx,bx
@@2: mov ax,ds:[bx]
mov ds:[bx],dx
mov ds:[bx+256*2],ax
add dx,128
add bx,2
loop @@2
mov cx,200
mov eax,32767
mov bx,cs:grouppage
@@1: mov ds:[bx],eax
add bx,128
loop @@1
CEND
_initnewgroup ENDP
PUBLIC _drawnewgroup
_drawnewgroup PROC FAR
CBEG
LOADDS
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov es,ds:vram
mov ax,SEG newdata
mov gs,ax
mov cx,200
xor bx,bx
xor di,di
@@3: push cx
push di
push bx
shl bx,1
mov si,gs:[bx]
mov bx,di
mov bp,cs:bgcolor
mov dx,3c5h
mov al,0fh
@@1: mov cx,gs:[si]
cmp cx,32767
je @@2
mov ah,cl
shr cx,2
add cx,bx
sub cx,di
jcxz @@4
out dx,al
xchg ax,bp
dec cx
mov es:[di],ah
inc di
mov al,0fh
out dx,al
mov al,ah
shr cx,1
rep stosw
adc cx,cx
rep stosb
mov ch,al
mov ax,bp
mov al,0f0h
mov cl,ah
and cl,3
rol al,cl
out dx,al
mov es:[di],ch
xor al,0fh
mov bp,gs:[si+2]
add si,4
jmp @@1
@@4: mov ch,0f0h
mov cl,ah
and cl,3
rol ch,cl
mov ah,ch
and al,ch
out dx,al
mov cx,bp
mov es:[di],cl
mov al,ah
xor al,0fh
mov bp,gs:[si+2]
add si,4
jmp @@1
@@2: out dx,al
mov ax,cs:bgcolor
mov cx,bx
add cx,80
sub cx,di
jcxz @@5
dec cx
mov es:[di],ah
inc di
mov al,0fh
out dx,al
mov al,ah
shr cx,1
rep stosw
adc cx,cx
rep stosb
@@5: ;
pop bx
pop di
pop cx
add di,80
inc bx
loop @@3
CEND
_drawnewgroup ENDP

208
GLENZ/NEW2.ASM Normal file
View file

@ -0,0 +1,208 @@
FREELINE equ 200
newgroup PROC NEAR
;hline list in gs:si
push ds
mov ax,SEG newdata
mov ds,ax
mov bx,gs:[si]
add si,2
@@1: mov ax,gs:[si]
add si,2
cmp ax,-32767
je @@2
mov dx,gs:[si]
add si,2
cmp bx,7eh
jne @@z
@@z: push bx
;hline ax..dx,bx with gs:color
cmp ax,dx
jle @@3
xchg ax,dx
@@3: push dx
shl bx,1
mov dx,ds:[bx]
mov bp,ds:[FREELINE*2]
mov ds:[bx],bp
mov ds:[FREELINE*2],dx
mov bx,dx
;modify list bx=>bp (edx/hi=last color)
;copy blocks < hline start
xor edx,edx
@@b: mov ecx,ds:[bx]
cmp cx,ax
jae @@a ;[bx] bigger..
add bx,4
mov ds:[bp],ecx
add bp,4
jmp @@b
@@a: ;add hline start
jne @@aa
mov edx,ecx
add bx,4
mov ecx,ds:[bx]
@@aa: mov ds:[bp],ax
mov ax,gs:color
mov ah,al
mov ds:[bp+2],ax
add bp,4
;copy blocks < hline end
pop ax
@@d: cmp cx,ax
jae @@c
add bx,4
mov edx,ecx
mov ecx,ds:[bx]
jmp @@d
@@c: ;add hline end
jne @@ca
mov edx,ecx
add bx,4
mov ecx,ds:[bx]
@@ca: mov dx,ax
mov ds:[bp],edx
add bp,4
;copy rest of the list
@@f: cmp cx,32767
je @@e
add bx,4
mov ds:[bp],ecx
add bp,4
mov ecx,ds:[bx]
jmp @@f
@@e: ;last
mov ds:[bp],ecx
pop bx
inc bx
jmp @@1
@@2: pop ds
ret
newgroup ENDP
grouppage dw 1024
PUBLIC _initnewgroup
_initnewgroup PROC FAR
CBEG
mov ax,SEG newdata
mov ds,ax
mov dx,cs:grouppage
xor dx,32768
mov cs:grouppage,dx
mov cx,201
xor bx,bx
@@2: mov ax,ds:[bx]
mov ds:[bx],dx
mov ds:[bx+256*2],ax
add dx,128
add bx,2
loop @@2
mov cx,200
mov eax,32767
mov bx,cs:grouppage
@@1: mov ds:[bx],eax
add bx,128
loop @@1
CEND
_initnewgroup ENDP
ALIGN 2
dng_bgcolor dw 101h
dng_rowbase dw 0
PUBLIC _drawnewgroup
_drawnewgroup PROC FAR
CBEG
LOADDS
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov es,ds:vram
mov ax,SEG newdata
mov gs,ax
mov cx,200
xor bx,bx
xor di,di
@@3: push cx
push di
push bx
shl bx,1
mov si,gs:[bx]
mov bx,gs:[bx+512] ;last time row (for sorting out differences)
mov cs:dng_rowbase,di
mov bp,cs:dng_bgcolor
mov dx,3c5h
mov al,0fh
@@1: mov cx,gs:[si]
cmp cx,32767
je @@2
mov ah,cl
shr cx,2
add cx,cs:dng_rowbase
sub cx,di
jcxz @@4
out dx,al
xchg ax,bp
dec cx
mov es:[di],ah
inc di
mov al,0fh
out dx,al
mov al,ah
shr cx,1
rep stosw
adc cx,cx
rep stosb
mov ch,al
mov ax,bp
mov al,0f0h
mov cl,ah
and cl,3
rol al,cl
out dx,al
mov es:[di],ch
xor al,0fh
mov bp,gs:[si+2]
add si,4
jmp @@1
@@4: mov ch,0f0h
mov cl,ah
and cl,3
rol ch,cl
mov ah,ch
and al,ch
out dx,al
mov cx,bp
mov es:[di],cl
mov al,ah
xor al,0fh
mov bp,gs:[si+2]
add si,4
jmp @@1
@@2: out dx,al
mov ax,cs:dng_bgcolor
mov cx,cs:dng_rowbase
add cx,80
sub cx,di
jcxz @@5
dec cx
mov es:[di],ah
inc di
mov al,0fh
out dx,al
mov al,ah
shr cx,1
rep stosw
adc cx,cx
rep stosb
@@5: ;
pop bx
pop di
pop cx
add di,80
inc bx
loop @@3
CEND
_drawnewgroup ENDP

267
GLENZ/NEWNORM.ASM Normal file
View file

@ -0,0 +1,267 @@
FREELINE equ 200
newgroup PROC NEAR
;hline list in gs:si
push ds
mov ax,SEG newdata
mov ds,ax
mov bx,gs:[si]
add si,2
@@1: mov ax,gs:[si]
add si,2
cmp ax,-32767
je @@2
mov dx,gs:[si]
add si,2
cmp bx,7eh
jne @@z
@@z: push bx
;hline ax..dx,bx with gs:color
cmp ax,dx
jle @@3
xchg ax,dx
@@3: push dx
shl bx,1
mov dx,ds:[bx]
mov bp,ds:[FREELINE*2]
mov ds:[bx],bp
mov ds:[FREELINE*2],dx
mov bx,dx
;modify list bx=>bp (edx/hi=last color)
;copy blocks < hline start
xor edx,edx
@@b: mov ecx,ds:[bx]
cmp cx,ax
jae @@a ;[bx] bigger..
add bx,4
mov ds:[bp],ecx
add bp,4
jmp @@b
@@a: ;add hline start
jne @@aa
mov edx,ecx
add bx,4
mov ecx,ds:[bx]
@@aa: mov ds:[bp],ax
mov ax,gs:color
mov ah,al
mov ds:[bp+2],ax
add bp,4
;copy blocks < hline end
pop ax
@@d: cmp cx,ax
jae @@c
add bx,4
mov edx,ecx
mov ecx,ds:[bx]
jmp @@d
@@c: ;add hline end
jne @@ca
mov edx,ecx
add bx,4
mov ecx,ds:[bx]
@@ca: mov dx,ax
mov ds:[bp],edx
add bp,4
;copy rest of the list
@@f: cmp cx,32767
je @@e
add bx,4
mov ds:[bp],ecx
add bp,4
mov ecx,ds:[bx]
jmp @@f
@@e: ;last
mov ds:[bp],ecx
pop bx
inc bx
jmp @@1
@@2: pop ds
ret
newgroup ENDP
grouppage dw 1024
PUBLIC _initnewgroup
_initnewgroup PROC FAR
CBEG
mov ax,SEG newdata
mov ds,ax
mov dx,cs:grouppage
xor dx,32768
mov cs:grouppage,dx
mov cx,201
xor bx,bx
@@2: mov ax,ds:[bx]
mov ds:[bx],dx
mov ds:[bx+256*2],ax
add dx,128
add bx,2
loop @@2
mov cx,200
mov eax,32767
mov bx,cs:grouppage
@@1: mov ds:[bx],eax
add bx,128
loop @@1
CEND
_initnewgroup ENDP
ALIGN 2
dng_bgcolor dw 0
dng_rowbase dw 0
dng_random dw 0
PUBLIC _drawnewgroup
_drawnewgroup PROC FAR
CBEG
LOADDS
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov es,ds:vram
mov ax,SEG newdata
mov gs,ax
mov cx,200
xor bx,bx
xor di,di
@@3: push cx
push di
push bx
shl bx,1
mov si,gs:[bx]
mov di,gs:[bx+512] ;last time row (for sorting out differences)
mov bp,32768
;si=thistime
;di=lasttime
;dl=thiscolor
;dh=lastcolor
;cx=thisX
;bx=lastX
;ax=X
;bp=tmpdest
mov dx,cs:dng_bgcolor
mov dh,dl
xor ax,ax
mov cx,gs:[si]
mov bx,gs:[di]
@@1: cmp bx,cx
je @@10
jl @@2
;cx..bx
cmp dl,dh
je @@5
;ax..cx color dl
mov gs:[bp],ax
mov gs:[bp+2],cx
mov gs:[bp+4],dx
add bp,6
@@5: mov ax,cx
mov dl,gs:[si+2]
add si,4
mov cx,gs:[si]
jmp @@1
@@10: ;bx=cx
cmp bx,32767
je @@7
cmp dl,dh
je @@11
;ax..bx color dl
mov gs:[bp],ax
mov gs:[bp+2],bx
mov gs:[bp+4],dx
add bp,6
@@11: mov ax,bx
mov dh,gs:[di+2]
add di,4
mov bx,gs:[di]
mov dl,gs:[si+2]
add si,4
mov cx,gs:[si]
jmp @@1
@@2: ;bx..cx
cmp dl,dh
je @@4
;ax..bx color dl
mov gs:[bp],ax
mov gs:[bp+2],bx
mov gs:[bp+4],dx
add bp,6
@@4: mov ax,bx
mov dh,gs:[di+2]
add di,4
mov bx,gs:[di]
jmp @@1
@@7: pop bx
pop di
;this line data in 8000h..bp
mov si,32768
cmp si,bp
je @@8
@@6: push di
push bx
push bp
mov ch,gs:[si+4]
mov ds:color,ax
mov bx,gs:[si]
mov dx,gs:[si+2]
;
mov cl,bl
and cl,3
mov al,00fh
rol al,cl
mov cl,dl
and cl,3
mov ah,0f0h
rol ah,cl
shr bx,2
shr dx,2
cmp bx,dx
jne @@h1
and al,ah
mov dx,3c5h
out dx,al
mov es:[di+bx],ch
jmp @@h0
@@h1: inc bx
cmp bx,dx
jne @@h2
mov dx,3c5h
out dx,al
mov es:[di+bx-1],ch
mov al,ah
out dx,al
mov es:[di+bx],ch
jmp @@h0
@@h2: mov cl,dl
sub cl,bl
add di,bx
mov dx,3c5h
out dx,al
mov es:[di-1],ch
mov al,0fh
out dx,al
mov al,ch
xor ch,ch
rep stosb
xchg al,ah
out dx,al
mov es:[di],ah
@@h0: ;
pop bp
pop bx
pop di
add si,6
cmp si,bp
jb @@6
@@8: pop cx
add di,80
inc bx
loop @@3
CEND
_drawnewgroup ENDP

1
GLENZ/NOTS Normal file
View file

@ -0,0 +1 @@
martin, silents

BIN
GLENZ/PIC001.LBM Normal file

Binary file not shown.

BIN
GLENZ/PIC002.LBM Normal file

Binary file not shown.

33
GLENZ/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

1
GLENZ/TMP Normal file
View file

@ -0,0 +1 @@
-157,-464,1030 Z:7000 LS:8

BIN
GLENZ/V.EXE Normal file

Binary file not shown.

61
GLENZ/V.MAP Normal file
View file

@ -0,0 +1,61 @@
Start Stop Length Name Class
00000H 006C3H 006C4H ZOOMER_TEXT CODE
006C4H 017C8H 01105H MAIN_TEXT CODE
017D0H 06BDDH 0540EH text__vid CODE
06BE0H 06D57H 00178H text__asm CODE
06D60H 079E0H 00C81H text__vec CODE
079F0H 0B288H 03899H text__math CODE
0B290H 0B363H 000D4H text_disc CODE
0B370H 0D7FBH 0248CH glvtext CODE
0D7FCH 0E36BH 00B70H _TEXT CODE
0E370H 0E371H 00002H EMULATOR_TEXT CODE
0E372H 0E372H 00000H C_ETEXT ENDCODE
0E380H 10801H 02482H data_v DATA
10802H 10AB5H 002B4H MAIN_DATA FAR_DATA
10AB6H 10AB6H 00000H MAIN_CONST FAR_DATA
10AB6H 10AB6H 00000H MAIN_BSS FAR_DATA
10AC0H 10AC0H 00000H EMULATOR_DATA FAR_DATA
10AC0H 1F6CFH 0EC10H text__zoom CODE2
1F6D0H 2F6BFH 0FFF0H data_new1 FARDATA
2F6C0H 3F6AFH 0FFF0H data_new2 FARDATA
3F6B0H 4F3BFH 0FD10H DATA__fc FARDATA
4F3C0H 4FF95H 00BD6H FAR_BSS FAR_BSS
4FFA0H 5FF9EH 0FFFFH FAR_BSS FAR_BSS
5FFA0H 60D2FH 00D90H FAR_BSS FAR_BSS
60D30H 60D71H 00042H NULL BEGDATA
60D72H 61511H 007A0H _DATA DATA
61512H 61513H 00002H XIQC DATA
61514H 61521H 0000EH DBDATA DATA
61522H 6152FH 0000EH CDATA DATA
61530H 61530H 00000H XIFB DATA
61530H 61530H 00000H XIF DATA
61530H 61530H 00000H XIFE DATA
61530H 61530H 00000H XIB DATA
61530H 61530H 00000H XI DATA
61530H 61530H 00000H XIE DATA
61530H 61530H 00000H XPB DATA
61530H 61530H 00000H XP DATA
61530H 61530H 00000H XPE DATA
61530H 61530H 00000H XCB DATA
61530H 61530H 00000H XC DATA
61530H 61530H 00000H XCE DATA
61530H 61530H 00000H XCFB DATA
61530H 61530H 00000H XCF DATA
61530H 61530H 00000H XCFE DATA
61530H 6154FH 00020H CONST CONST
61550H 61557H 00008H HDR MSG
61558H 6162DH 000D6H MSG MSG
6162EH 6162FH 00002H PAD MSG
61630H 61630H 00001H EPAD MSG
61632H 61632H 00000H _BSS BSS
61632H 61632H 00000H XOB BSS
61632H 61632H 00000H XO BSS
61632H 61632H 00000H XOE BSS
61640H 61640H 00000H c_common BSS
61640H 61E3FH 00800H STACK STACK
Origin Group
60D3:0 DGROUP
Program entry point at 0D7F:001C

1601
GLENZ/VEC.A Normal file

File diff suppressed because it is too large Load diff

718
GLENZ/VEC.ASM Normal file
View file

@ -0,0 +1,718 @@
include asm.inc
extrn __newgroup:far
text__vec SEGMENT para public 'CODE'
ASSUME cs:text__vec
.386
PUBLIC _lightshift
_lightshift db 0
PUBLIC _csetmatrix
_csetmatrix PROC FAR
CBEG
LOADDS
mov eax,[bp+10]
mov ds:xadd,eax
mov eax,[bp+14]
mov ds:yadd,eax
mov eax,[bp+18]
mov ds:zadd,eax
mov si,[bp+6]
mov ds,word ptr [bp+8]
call setmatrix
CEND
_csetmatrix ENDP
PUBLIC _crotlist
_crotlist PROC FAR
CBEG
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov di,[bp+6]
mov es,word ptr [bp+8]
call rotlist
CEND
_crotlist ENDP
PUBLIC _cprojlist
_cprojlist PROC FAR
CBEG
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov di,[bp+6]
mov es,word ptr [bp+8]
call projlist
CEND
_cprojlist ENDP
PUBLIC _ccliplist
_ccliplist PROC FAR
CBEG
mov si,[bp+6]
mov ds,word ptr [bp+8]
call cliplist
CEND
_ccliplist ENDP
PUBLIC setmatrix
setmatrix PROC FAR
;ds:si=matrix
movsx eax,word ptr ds:[si+0]
mov dword ptr cs:[2+mtrm00],eax
movsx eax,word ptr ds:[si+2]
mov dword ptr cs:[2+mtrm02],eax
movsx eax,word ptr ds:[si+4]
mov dword ptr cs:[2+mtrm04],eax
movsx eax,word ptr ds:[si+6]
mov dword ptr cs:[2+mtrm06],eax
movsx eax,word ptr ds:[si+8]
mov dword ptr cs:[2+mtrm08],eax
movsx eax,word ptr ds:[si+10]
mov dword ptr cs:[2+mtrm10],eax
movsx eax,word ptr ds:[si+12]
mov dword ptr cs:[2+mtrm12],eax
movsx eax,word ptr ds:[si+14]
mov dword ptr cs:[2+mtrm14],eax
movsx eax,word ptr ds:[si+16]
mov dword ptr cs:[2+mtrm16],eax
ret
setmatrix ENDP
ALIGN 2
count dw 0
rotlist PROC FAR
;pointlist@DS:SI=>pointlist@ES:DI
push di
LOADGS
mov cx,ds:[si]
add si,4
mov cs:count,cx
mov ax,es:[di]
add es:[di],cx
mov bx,ax
shl ax,1
add ax,bx
shl ax,2
add di,ax
add di,4
nrup1: ;rotate with matrix
push si
push di
mov ebp,ds:[si+8]
mov edi,ds:[si+4]
mov esi,ds:[si+0]
mtrm00: mov eax,12345678h
imul esi
mov ebx,eax
mov ecx,edx
mtrm02: mov eax,12345678h
imul edi
add ebx,eax
adc ecx,edx
mtrm04: mov eax,12345678h
imul ebp
add ebx,eax
adc ecx,edx
shld ecx,ebx,17
push ecx
mtrm06: mov eax,12345678h
imul esi
mov ebx,eax
mov ecx,edx
mtrm08: mov eax,12345678h
imul edi
add ebx,eax
adc ecx,edx
mtrm10: mov eax,12345678h
imul ebp
add ebx,eax
adc ecx,edx
shld ecx,ebx,17
push ecx
mtrm12: mov eax,12345678h
imul esi
mov ebx,eax
mov ecx,edx
mtrm14: mov eax,12345678h
imul edi
add ebx,eax
adc ecx,edx
mtrm16: mov eax,12345678h
imul ebp
add ebx,eax
adc ecx,edx
shld ecx,ebx,17
pop edx
pop eax
pop di
pop si
;
add eax,gs:xadd
mov es:[di+0],eax
add ecx,gs:yadd
mov es:[di+4],ecx
add edx,gs:zadd
mov es:[di+8],edx
;next point
add si,12
add di,12
dec cs:count
jnz nrup1
pop di
ret
rotlist ENDP
projlist PROC FAR
;pointlist@DS:SI=>projectedpointlist@ES:DI
push di
LOADGS
mov cx,ds:[si]
add si,4
mov cs:count,cx
mov ax,es:[di]
add es:[di],cx
mov bx,ax
shl ax,1
add ax,bx
shl ax,2
add di,ax
add di,4
@@1: ;rotate with matrix
mov ebx,ds:[si+8]
mov eax,ds:[si+4]
mov ecx,ds:[si+0]
;project
xor bp,bp
mov dword ptr es:[di+8],ebx
cmp ebx,gs:projminz
jge @@2
mov ebx,gs:projminz
or bp,16
@@2: ;
imul gs:projymul
idiv ebx
add ax,gs:projyadd
cmp ax,gs:wmaxy
jng @@41
or bp,8
@@41: cmp ax,gs:wminy
jnl @@42
or bp,4
@@42: mov es:[di+2],ax ;store Y
;
mov eax,gs:projxmul
imul ecx
idiv ebx
add ax,gs:projxadd
cmp ax,gs:wmaxx
jng @@43
or bp,2
@@43: cmp ax,gs:wminx
jnl @@44
or bp,1
@@44: mov es:[di+0],ax ;store X
@@5: mov es:[di+4],bp ;store visiblity flags
;next point
add si,12
add di,12
dec cs:count
jnz @@1
pop di
ret
projlist ENDP
cliplist PROC FAR
;pointlist@DS:SI
push di
LOADGS
mov cx,ds:[si]
add si,4
@@1: ;rotate with matrix
mov eax,ds:[si+4]
cmp eax,1500
jl @@2
mov dword ptr ds:[si+4],1500
@@2:
;next point
add si,12
dec cx
jnz @@1
pop di
ret
cliplist ENDP
ALIGN 2
edgesoff dw 0
pointsoff dw 0
cntoff dw 0
adddot PROC NEAR
cmp ax,bp
je @@3
mov bp,ax
;add dot
push bx
mov bx,ax
shl bx,1
add bx,ax
shl bx,2
add bx,cs:pointsoff
mov eax,gs:[bx]
stosd
pop bx
@@3: ret
adddot ENDP
checkhiddenbx PROC NEAR
push si
mov ax,es:[bx]
mov si,es:[bx+2]
sub ax,es:[bx+4]
sub si,es:[bx+8+2]
imul si
push ax
push dx
mov ax,es:[bx+2]
mov si,es:[bx]
sub ax,es:[bx+4+2]
sub si,es:[bx+8]
imul si
pop cx
pop si
xchg si,ax
xchg dx,cx
sub ax,si
sbb dx,cx
pop si
cmp dx,0
jl @@1
clc
ret
@@1: stc
ret
checkhiddenbx ENDP
PUBLIC _cpolylist
_cpolylist PROC FAR ;polylist,polys,edges,points3
CBEG
mov di,[bp+6]
mov es,word ptr [bp+8]
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov ax,[bp+14]
add ax,4
mov cs:edgesoff,ax
mov fs,word ptr [bp+16]
mov ax,[bp+18]
add ax,4
mov cs:pointsoff,ax
mov gs,word ptr [bp+20]
mov bp,-1
@@2: lodsw
cmp ax,0
je @@1
add di,2
mov cx,ax
movsw
mov cs:cntoff,di
@@3: push cx
mov bx,ds:[si]
add si,2
shl bx,3
add bx,cs:edgesoff
test word ptr fs:[bx+4],8000h
jnz @@7
mov ax,fs:[bx+2]
cmp ax,bp
je @@5
mov ax,fs:[bx]
call adddot
mov ax,fs:[bx+2]
call adddot
@@7: pop cx
loop @@3
jmp @@6
@@5: mov ax,fs:[bx+2]
call adddot
mov ax,fs:[bx]
call adddot
pop cx
loop @@3
@@6: mov bx,cs:cntoff
mov eax,es:[bx]
cmp eax,es:[di-4]
jne @@4
sub di,4
@@4: mov ax,di
sub ax,cs:cntoff
shr ax,2
mov es:[bx-4],ax
call checkhiddenbx
jnc @@2
xor word ptr es:[bx-2],8000h
jmp @@2
@@1: mov word ptr es:[di],0
CEND
_cpolylist ENDP
setpalxxx MACRO
local l1,l2,l3
mov al,cl
cmp al,64
jb l1
mov al,63
l1: out dx,al
mov al,bl
cmp al,64
jb l2
mov al,63
l2: out dx,al
mov al,bh
cmp al,64
jb l3
mov al,63
l3: out dx,al
ENDM
public _backpal
_backpal db 16 dup(16,16,16)
back1 db 0,4,8
back2 db 4,0,0
back3 db 7,0,0
back4 db 13,0,0
rolcol db 256 dup(0)
rolused db 256 dup(0)
demo_norm PROC NEAR
ret
demo_norm ENDP
demo_glz2 PROC NEAR
jc @@1
mov al,es:[bx-2]
shr al,1
and al,1
mov es:[bx-2],al
@@1: ret
demo_glz2 ENDP
demo_glz PROC NEAR
jnc @@7 ;visible
mov ax,es:[bx-2]
push bx
push ax
mov bl,al
xor bh,bh
mov al,cs:rolcol[bx]
mov byte ptr cs:rolcol[bx],0
mov bl,al
mov cs:rolused[bx],0
pop ax
pop bx
shr al,1
and al,1
shl al,2
mov es:[bx-2],ax
ret
@@7: mov cl,cs:_lightshift
cmp cl,9
je @@x9
shrd ax,dx,8
push ax
shrd ax,dx,1
pop dx
add ax,dx
jmp @@x10
@@x9: mov cl,7
shrd ax,dx,cl
@@x10: cmp ax,0
jge @@s1
mov ax,0
@@s1: cmp ax,63
jle @@s2
mov ax,63
@@s2: mov ah,al
;
push bx
movzx bx,es:[bx-2]
mov al,cs:rolcol[bx]
cmp al,0
jne @@rc1
mov cx,15
mov bp,2
@@rc3: cmp cs:rolused[bp],0
je @@rc4
add bp,2
loop @@rc3
@@rc4: mov ax,bp
@@rc2: mov cs:rolcol[bx],al
mov cs:rolused[bp],1
@@rc1: pop bx
mov bp,es:[bx-2]
shl al,3
mov es:[bx-2],al
mov dx,3c8h
out dx,al
inc dx
test bp,2
jz @@b1
mov bh,ah ;B
shr ah,1
mov bl,ah ;G
jmp @@b2
@@b1: mov cl,ah ;R
mov bl,ah ;G
mov bh,ah ;B
@@b2: push si
push di
mov si,cx
mov di,bx
zzz=0
REPT 16
mov al,cs:_backpal[zzz*3+0]
shr al,2
add cl,al
mov al,cs:_backpal[zzz*3+1]
shr al,2
add bl,al
mov al,cs:_backpal[zzz*3+2]
shr al,2
add bh,al
setpalxxx
mov bx,di
mov cx,si
zzz=zzz+1
ENDM
pop di
pop si
@@xx: ret
demo_glz ENDP
ALIGN 2
PUBLIC _demomode
_demomode dw OFFSET demo_glz
dw OFFSET demo_glz
dw OFFSET demo_glz2
PUBLIC _ceasypolylist
_ceasypolylist PROC FAR ;polylist,polys,points3
CBEG
mov di,[bp+6]
mov es,word ptr [bp+8]
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov ax,[bp+14]
add ax,4
mov cs:pointsoff,ax
mov gs,word ptr [bp+16]
mov bp,-1
@@2: lodsw
cmp ax,0
je @@1
add di,2
mov cx,ax
movsw
mov cs:cntoff,di
@@3: push cx
mov ax,ds:[si]
add si,2
call adddot
pop cx
loop @@3
@@6: mov bx,cs:cntoff
mov eax,es:[bx]
cmp eax,es:[di-4]
jne @@4
sub di,4
@@4: mov ax,di
sub ax,cs:cntoff
shr ax,2
mov es:[bx-4],ax
call checkhiddenbx
call cs:_demomode ;sets colors etc / hidden faces flipped
jmp @@2
@@1: mov word ptr es:[di],0
CEND
_ceasypolylist ENDP
PUBLIC _cglenzinit
_cglenzinit PROC FAR
CBEG
LOADDS
mov ax,0
call __newgroup
CEND
_cglenzinit ENDP
PUBLIC _cglenzdone
_cglenzdone PROC FAR
CBEG
LOADDS
mov ax,2
call __newgroup
CEND
_cglenzdone ENDP
PUBLIC _cglenzpolylist
_cglenzpolylist PROC FAR
CBEG
LOADDS
movpar di,0
movpar es,1
mov ax,1
call __newgroup
CEND
_cglenzpolylist ENDP
PUBLIC _cdrawpolylist
_cdrawpolylist PROC FAR
CBEG
LOADDS
movpar di,0
mov es,word ptr [bp+8]
call VIDPOLYGROUP
CEND
_cdrawpolylist ENDP
ALIGN 4
clipz dd 2200
clipsidi PROC NEAR
;si=point1(hidden), di=point2
;adds new point to pointlist (fs:bp-4)
;returns number of new point (si)
push bx
mov ecx,fs:[di+8]
mov edx,ecx
sub ecx,fs:[si+8]
;cx=length of entire edge
sub edx,cs:clipz
;dx=length of clipped edge
xor eax,eax
div ecx
shr eax,16
mov ecx,eax
;ecx=multiplier (0..65535)
mov eax,fs:[si]
sub eax,fs:[di]
imul ecx
shld edx,eax,16
add edx,fs:[di]
push edx ;X
mov eax,fs:[si+4]
sub eax,fs:[di+4]
imul ecx
shld edx,eax,16
add edx,fs:[di+4] ;edx=Y
;
mov bx,fs:[bp-4]
inc bx
mov fs:[bp-4],bx
dec bx
mov si,bx
shl bx,1
add bx,si
shl bx,2
add bx,bp
mov fs:[bx+4],edx
pop edx
mov fs:[bx],edx
mov edx,cs:clipz
mov fs:[bx+8],edx
pop bx
ret
clipsidi ENDP
PUBLIC _cclipedges
_cclipedges PROC FAR ;(destedges,edges,points)
CBEG
movpar bx,0
movpar es,1
movpar si,2
movpar ds,3
movpar fs,5
movpar bp,4
mov cx,ds:[si]
add si,4
mov es:[bx],cx
add bx,4
add bp,4
;
@@1: push cx
push si
push di
push bx
mov ax,ds:[si+4]
mov es:[bx+4],ax
mov di,ds:[si+2]
mov es:[bx+2],di
mov ax,di
shl di,1
add di,ax
shl di,2
add di,bp
mov si,ds:[si]
mov es:[bx],si
mov ax,si
shl si,1
add si,ax
shl si,2
add si,bp
;
xor cx,cx
mov eax,fs:[si+8] ;Z
cmp eax,cs:clipz
jge @@2
or cx,1
@@2: mov edx,fs:[di+8] ;Z
cmp edx,cs:clipz
jge @@3
or cx,2
@@3: ;
cmp cx,0
je @@4
cmp cx,3
jne @@5
or word ptr es:[bx+4],8000h
jmp @@4
@@5: cmp cx,1
jne @@6
;si hidden
call clipsidi
mov es:[bx],si
jmp @@4
@@6: ;di hidden
xchg si,di
call clipsidi
mov es:[bx+2],si
@@4: pop bx
add bx,8
pop di
add di,8
pop si
add si,8
pop cx
loop @@1
CEND
_cclipedges ENDP
text__vec ENDS
END

635
GLENZ/VEC.BK1 Normal file
View file

@ -0,0 +1,635 @@
include asm.inc
extrn __newgroup:far
text__vec SEGMENT para public 'CODE'
ASSUME cs:text__vec
.386
PUBLIC _lightshift
_lightshift db 0
PUBLIC _csetmatrix
_csetmatrix PROC FAR
CBEG
LOADDS
mov eax,[bp+10]
mov ds:xadd,eax
mov eax,[bp+14]
mov ds:yadd,eax
mov eax,[bp+18]
mov ds:zadd,eax
mov si,[bp+6]
mov ds,word ptr [bp+8]
call setmatrix
CEND
_csetmatrix ENDP
PUBLIC _crotlist
_crotlist PROC FAR
CBEG
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov di,[bp+6]
mov es,word ptr [bp+8]
call rotlist
CEND
_crotlist ENDP
PUBLIC _cprojlist
_cprojlist PROC FAR
CBEG
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov di,[bp+6]
mov es,word ptr [bp+8]
call projlist
CEND
_cprojlist ENDP
PUBLIC setmatrix
setmatrix PROC FAR
;ds:si=matrix
movsx eax,word ptr ds:[si+0]
mov dword ptr cs:[2+mtrm00],eax
movsx eax,word ptr ds:[si+2]
mov dword ptr cs:[2+mtrm02],eax
movsx eax,word ptr ds:[si+4]
mov dword ptr cs:[2+mtrm04],eax
movsx eax,word ptr ds:[si+6]
mov dword ptr cs:[2+mtrm06],eax
movsx eax,word ptr ds:[si+8]
mov dword ptr cs:[2+mtrm08],eax
movsx eax,word ptr ds:[si+10]
mov dword ptr cs:[2+mtrm10],eax
movsx eax,word ptr ds:[si+12]
mov dword ptr cs:[2+mtrm12],eax
movsx eax,word ptr ds:[si+14]
mov dword ptr cs:[2+mtrm14],eax
movsx eax,word ptr ds:[si+16]
mov dword ptr cs:[2+mtrm16],eax
ret
setmatrix ENDP
ALIGN 2
count dw 0
rotlist PROC FAR
;pointlist@DS:SI=>pointlist@ES:DI
push di
LOADGS
mov cx,ds:[si]
add si,4
mov cs:count,cx
mov ax,es:[di]
add es:[di],cx
mov bx,ax
shl ax,1
add ax,bx
shl ax,2
add di,ax
add di,4
nrup1: ;rotate with matrix
push si
push di
mov ebp,ds:[si+8]
mov edi,ds:[si+4]
mov esi,ds:[si+0]
mtrm00: mov eax,12345678h
imul esi
mov ebx,eax
mov ecx,edx
mtrm02: mov eax,12345678h
imul edi
add ebx,eax
adc ecx,edx
mtrm04: mov eax,12345678h
imul ebp
add ebx,eax
adc ecx,edx
shld ecx,ebx,17
push ecx
mtrm06: mov eax,12345678h
imul esi
mov ebx,eax
mov ecx,edx
mtrm08: mov eax,12345678h
imul edi
add ebx,eax
adc ecx,edx
mtrm10: mov eax,12345678h
imul ebp
add ebx,eax
adc ecx,edx
shld ecx,ebx,17
push ecx
mtrm12: mov eax,12345678h
imul esi
mov ebx,eax
mov ecx,edx
mtrm14: mov eax,12345678h
imul edi
add ebx,eax
adc ecx,edx
mtrm16: mov eax,12345678h
imul ebp
add ebx,eax
adc ecx,edx
shld ecx,ebx,17
pop edx
pop eax
pop di
pop si
;
add ecx,gs:xadd
mov es:[di+0],ecx
add edx,gs:yadd
mov es:[di+4],edx
add eax,gs:zadd
mov es:[di+8],eax
;next point
add si,12
add di,12
dec cs:count
jnz nrup1
pop di
ret
rotlist ENDP
projlist PROC FAR
;pointlist@DS:SI=>projectedpointlist@ES:DI
push di
LOADGS
mov cx,ds:[si]
add si,4
mov cs:count,cx
mov ax,es:[di]
add es:[di],cx
mov bx,ax
shl ax,1
add ax,bx
shl ax,2
add di,ax
add di,4
@@1: ;rotate with matrix
mov ebx,ds:[si+8]
mov eax,ds:[si+4]
mov ecx,ds:[si+0]
;project
xor bp,bp
mov dword ptr es:[di+8],ebx
cmp ebx,gs:projminz
jge @@2
mov ebx,gs:projminz
or bp,16
@@2: ;
imul gs:projymul
idiv ebx
add ax,gs:projyadd
cmp ax,gs:wmaxy
jng @@41
or bp,8
@@41: cmp ax,gs:wminy
jnl @@42
or bp,4
@@42: mov es:[di+2],ax ;store Y
;
mov eax,gs:projxmul
imul ecx
idiv ebx
add ax,gs:projxadd
cmp ax,gs:wmaxx
jng @@43
or bp,2
@@43: cmp ax,gs:wminx
jnl @@44
or bp,1
@@44: mov es:[di+0],ax ;store X
@@5: mov es:[di+4],bp ;store visiblity flags
;next point
add si,12
add di,12
dec cs:count
jnz @@1
pop di
ret
projlist ENDP
ALIGN 2
edgesoff dw 0
pointsoff dw 0
cntoff dw 0
adddot PROC NEAR
cmp ax,bp
je @@3
mov bp,ax
;add dot
push bx
mov bx,ax
shl bx,1
add bx,ax
shl bx,2
add bx,cs:pointsoff
mov eax,gs:[bx]
stosd
pop bx
@@3: ret
adddot ENDP
checkhiddenbx PROC NEAR
push si
mov ax,es:[bx]
mov si,es:[bx+2]
sub ax,es:[bx+4]
sub si,es:[bx+8+2]
imul si
push ax
push dx
mov ax,es:[bx+2]
mov si,es:[bx]
sub ax,es:[bx+4+2]
sub si,es:[bx+8]
imul si
pop cx
pop si
sub ax,si
sbb dx,cx
pop si
cmp dx,0
jl @@1
clc
ret
@@1: stc
ret
checkhiddenbx ENDP
PUBLIC _cpolylist
_cpolylist PROC FAR ;polylist,polys,edges,points3
CBEG
mov di,[bp+6]
mov es,word ptr [bp+8]
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov ax,[bp+14]
add ax,4
mov cs:edgesoff,ax
mov fs,word ptr [bp+16]
mov ax,[bp+18]
add ax,4
mov cs:pointsoff,ax
mov gs,word ptr [bp+20]
mov bp,-1
@@2: lodsw
cmp ax,0
je @@1
add di,2
mov cx,ax
movsw
mov cs:cntoff,di
@@3: push cx
mov bx,ds:[si]
add si,2
shl bx,3
add bx,cs:edgesoff
test word ptr fs:[bx+4],8000h
jnz @@7
mov ax,fs:[bx+2]
cmp ax,bp
je @@5
mov ax,fs:[bx]
call adddot
mov ax,fs:[bx+2]
call adddot
@@7: pop cx
loop @@3
jmp @@6
@@5: mov ax,fs:[bx+2]
call adddot
mov ax,fs:[bx]
call adddot
pop cx
loop @@3
@@6: mov bx,cs:cntoff
mov eax,es:[bx]
cmp eax,es:[di-4]
jne @@4
sub di,4
@@4: mov ax,di
sub ax,cs:cntoff
shr ax,2
mov es:[bx-4],ax
call checkhiddenbx
jnc @@2
xor word ptr es:[bx-2],8000h
jmp @@2
@@1: mov word ptr es:[di],0
CEND
_cpolylist ENDP
setpalxxx MACRO
local l1,l2,l3
mov al,cl
cmp al,64
jb l1
mov al,63
l1: out dx,al
mov al,bl
cmp al,64
jb l2
mov al,63
l2: out dx,al
mov al,bh
cmp al,64
jb l3
mov al,63
l3: out dx,al
ENDM
demo_glz PROC NEAR
jnc @@7 ;visible
push ax
mov ax,es:[bx-2]
shr al,3
and al,1
mov es:[bx-2],ax
pop ax
ret
@@7: mov cl,cs:_lightshift
sub cl,2
shrd ax,dx,cl
cmp ax,0
jge @@s1
mov ax,0
@@s1: cmp ax,63
jle @@s2
mov ax,63
@@s2: mov ah,al
;
mov dx,3c8h
mov al,es:[bx-2]
test al,7
jnz @@xx
out dx,al
inc dx
mov cl,ah ;R
mov bl,ah ;G
mov bh,ah ;B
;Inner1 Inner2 Back
setpalxxx ;- - -
add cl,16
setpalxxx ;- - +
sub cl,16
add bl,16
add cl,16 ;
setpalxxx ;- + -
sub cl,16 ;
sub bl,16
add cl,16
add bl,16
setpalxxx ;- + +
sub bl,16
sub cl,16
add bh,16
setpalxxx ;+ - -
sub bh,16
add cl,16
add bh,16
setpalxxx ;+ - +
sub bh,16
sub cl,16
add bl,16
add bh,16
setpalxxx ;+ + -
sub bh,16
sub bl,16
add cl,16
add bl,16
add bh,16
setpalxxx ;+ + +
add bh,16
add bl,16
sub cl,16
@@xx: ret
demo_glz ENDP
PUBLIC _ceasypolylist
_ceasypolylist PROC FAR ;polylist,polys,points3
CBEG
mov di,[bp+6]
mov es,word ptr [bp+8]
mov si,[bp+10]
mov ds,word ptr [bp+12]
mov ax,[bp+14]
add ax,4
mov cs:pointsoff,ax
mov gs,word ptr [bp+16]
mov bp,-1
@@2: lodsw
cmp ax,0
je @@1
add di,2
mov cx,ax
movsw
mov cs:cntoff,di
@@3: push cx
mov ax,ds:[si]
add si,2
call adddot
pop cx
loop @@3
@@6: mov bx,cs:cntoff
mov eax,es:[bx]
cmp eax,es:[di-4]
jne @@4
sub di,4
@@4: mov ax,di
sub ax,cs:cntoff
shr ax,2
mov es:[bx-4],ax
call checkhiddenbx
call demo_glz ;sets colors etc / hidden faces flipped
jmp @@2
@@1: mov word ptr es:[di],0
CEND
_ceasypolylist ENDP
PUBLIC _cglenzinit
_cglenzinit PROC FAR
CBEG
LOADDS
mov ax,0
call __newgroup
CEND
_cglenzinit ENDP
PUBLIC _cglenzdone
_cglenzdone PROC FAR
CBEG
LOADDS
mov ax,2
call __newgroup
CEND
_cglenzdone ENDP
PUBLIC _cglenzpolylist
_cglenzpolylist PROC FAR
CBEG
LOADDS
movpar di,0
movpar es,1
mov ax,1
call __newgroup
CEND
_cglenzpolylist ENDP
PUBLIC _cdrawpolylist
_cdrawpolylist PROC FAR
CBEG
LOADDS
movpar di,0
mov es,word ptr [bp+8]
call VIDPOLYGROUP
CEND
_cdrawpolylist ENDP
ALIGN 4
clipz dd 2200
clipsidi PROC NEAR
;si=point1(hidden), di=point2
;adds new point to pointlist (fs:bp-4)
;returns number of new point (si)
push bx
mov ecx,fs:[di+8]
mov edx,ecx
sub ecx,fs:[si+8]
;cx=length of entire edge
sub edx,cs:clipz
;dx=length of clipped edge
xor eax,eax
div ecx
shr eax,16
mov ecx,eax
;ecx=multiplier (0..65535)
mov eax,fs:[si]
sub eax,fs:[di]
imul ecx
shld edx,eax,16
add edx,fs:[di]
push edx ;X
mov eax,fs:[si+4]
sub eax,fs:[di+4]
imul ecx
shld edx,eax,16
add edx,fs:[di+4] ;edx=Y
;
mov bx,fs:[bp-4]
inc bx
mov fs:[bp-4],bx
dec bx
mov si,bx
shl bx,1
add bx,si
shl bx,2
add bx,bp
mov fs:[bx+4],edx
pop edx
mov fs:[bx],edx
mov edx,cs:clipz
mov fs:[bx+8],edx
pop bx
ret
clipsidi ENDP
PUBLIC _cclipedges
_cclipedges PROC FAR ;(destedges,edges,points)
CBEG
movpar bx,0
movpar es,1
movpar si,2
movpar ds,3
movpar fs,5
movpar bp,4
mov cx,ds:[si]
add si,4
mov es:[bx],cx
add bx,4
add bp,4
;
@@1: push cx
push si
push di
push bx
mov ax,ds:[si+4]
mov es:[bx+4],ax
mov di,ds:[si+2]
mov es:[bx+2],di
mov ax,di
shl di,1
add di,ax
shl di,2
add di,bp
mov si,ds:[si]
mov es:[bx],si
mov ax,si
shl si,1
add si,ax
shl si,2
add si,bp
;
xor cx,cx
mov eax,fs:[si+8] ;Z
cmp eax,cs:clipz
jge @@2
or cx,1
@@2: mov edx,fs:[di+8] ;Z
cmp edx,cs:clipz
jge @@3
or cx,2
@@3: ;
cmp cx,0
je @@4
cmp cx,3
jne @@5
or word ptr es:[bx+4],8000h
jmp @@4
@@5: cmp cx,1
jne @@6
;si hidden
call clipsidi
mov es:[bx],si
jmp @@4
@@6: ;di hidden
xchg si,di
call clipsidi
mov es:[bx+2],si
@@4: pop bx
add bx,8
pop di
add di,8
pop si
add si,8
pop cx
loop @@1
CEND
_cclipedges ENDP
text__vec ENDS
END

164
GLENZ/VEC.CUT Normal file
View file

@ -0,0 +1,164 @@
push si
push di
mov si,cx
mov di,bx
setpalxxx
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
setpalxxx
mov bx,di
mov cx,si
add cl,cs:back4[0]
add bl,cs:back4[1]
add bh,cs:back4[2]
add cl,cs:back3[0]
add bl,cs:back3[1]
add bh,cs:back3[2]
add cl,cs:back2[0]
add bl,cs:back2[1]
add bh,cs:back2[2]
add cl,cs:back1[0]
add bl,cs:back1[1]
add bh,cs:back1[2]
setpalxxx
mov bx,di
mov cx,si
pop di
pop si

173
GLENZ/VEC.LST Normal file
View file

@ -0,0 +1,173 @@
Turbo Assembler Version 2.5 02/21/93 18:09:17 Page 1
vec.asm
1 0000 text__vec SEGMENT para public 'CODE'
2 ASSUME cs:text__vec
3
4 .386
5
6 PUBLIC setmatrix
7 0000 setmatrix PROC FAR
8 ;ds:si=matrix
9 0000 8B 04 mov ax,ds:[si+0]
10 0002 2E: A3 006Fr mov word ptr cs:[1+mtrm00],ax
11 0006 8B 44 02 mov ax,ds:[si+2]
12 0009 2E: A3 007Cr mov word ptr cs:[1+mtrm02],ax
13 000D 8B 44 04 mov ax,ds:[si+4]
14 0010 2E: A3 0089r mov word ptr cs:[1+mtrm04],ax
15 0014 8B 44 06 mov ax,ds:[si+6]
16 0017 2E: A3 009Dr mov word ptr cs:[1+mtrm06],ax
17 001B 8B 44 08 mov ax,ds:[si+8]
18 001E 2E: A3 00AAr mov word ptr cs:[1+mtrm08],ax
19 0022 8B 44 0A mov ax,ds:[si+10]
20 0025 2E: A3 00B7r mov word ptr cs:[1+mtrm10],ax
21 0029 8B 44 0C mov ax,ds:[si+12]
22 002C 2E: A3 00CBr mov word ptr cs:[1+mtrm12],ax
23 0030 8B 44 0E mov ax,ds:[si+14]
24 0033 2E: A3 00DAr mov word ptr cs:[1+mtrm14],ax
25 0037 8B 44 10 mov ax,ds:[si+16]
26 003A 2E: A3 00E7r mov word ptr cs:[1+mtrm16],ax
27 003E CB ret
28 003F setmatrix ENDP
29
30 003F 90 ALIGN 2
31 0040 0000 count dw 0
32
33 0042 dovertices PROC FAR
34 ;normals etc, only rotate
35 ;pointlist@DS:SI=>pointlist@ES:DI
36 0042 57 push di
37 LOADGS
**Error** vec.asm(37) Illegal instruction
38 0043 8B 0C mov cx,ds:[si]
39 0045 83 C6 04 add si,4
40 0048 2E: 89 0E 0040r mov cs:count,cx
41 004D 26: 8B 05 mov ax,es:[di]
42 0050 26: 01 0D add es:[di],cx
43 0053 8B D8 mov bx,ax
44 0055 D1 E0 shl ax,1
45 0057 03 C3 add ax,bx
46 0059 C1 E0 02 shl ax,2
47 005C 03 F8 add di,ax
48 005E 83 C7 04 add di,4
49
50 0061 nrup1: ;rotate with matrix
51 0061 56 push si
52 0062 57 push di
53 0063 66| 8B 6C 08 mov ebp,ds:[si+8]
54 0067 66| 8B 7C 04 mov edi,ds:[si+4]
55 006B 66| 8B 34 mov esi,ds:[si+0]
56
Turbo Assembler Version 2.5 02/21/93 18:09:17 Page 2
vec.asm
57 006E 66| 69 F6 12345678 mtrm00: imul esi,12345678h
58 0075 66| 8B D8 mov ebx,eax
59 0078 66| 8B CA mov ecx,edx
60 007B 66| 69 FF 12345678 mtrm02: imul edi,12345678h
61 0082 66| 03 D8 add ebx,eax
62 0085 66| 13 CA adc ecx,edx
63 0088 66| 69 ED 12345678 mtrm04: imul ebp,12345678h
64 008F 66| 03 D8 add ebx,eax
65 0092 66| 13 CA adc ecx,edx
66 0095 66| 0F A4 D9 11 shld ecx,ebx,17
67 009A 66| 51 push ecx
68 009C 66| 69 F6 12345678 mtrm06: imul esi,12345678h
69 00A3 66| 8B D8 mov ebx,eax
70 00A6 66| 8B CA mov ecx,edx
71 00A9 66| 69 FF 12345678 mtrm08: imul edi,12345678h
72 00B0 66| 03 D8 add ebx,eax
73 00B3 66| 13 CA adc ecx,edx
74 00B6 66| 69 ED 12345678 mtrm10: imul ebp,12345678h
75 00BD 66| 03 D8 add ebx,eax
76 00C0 66| 13 CA adc ecx,edx
77 00C3 66| 0F A4 D9 11 shld ecx,ebx,17
78 00C8 66| 51 push ecx
79 00CA 66| B8 12345678 mtrm12: mov eax,12345678h
80 00D0 66| F7 EE imul esi
81 00D3 66| 8B D8 mov ebx,eax
82 00D6 66| 8B CA mov ecx,edx
83 00D9 66| 69 FF 12345678 mtrm14: imul edi,12345678h
84 00E0 66| 03 D8 add ebx,eax
85 00E3 66| 13 CA adc ecx,edx
86 00E6 66| 69 ED 12345678 mtrm16: imul ebp,12345678h
87 00ED 66| 03 D8 add ebx,eax
88 00F0 66| 13 CA adc ecx,edx
89 00F3 66| 0F A4 D9 11 shld ecx,ebx,17
90 00F8 66| 5A pop edx
91 00FA 66| 58 pop eax
92 00FC 5F pop di
93 00FD 5E pop si
94 ;
95 00FE 66| 65: 03 0E 0000 add ecx,gs:xadd
**Error** vec.asm(95) Undefined symbol: XADD
96 0104 66| 26: 89 0D mov es:[di+0],ecx
97 0108 66| 65: 03 0E 0000 add ecx,gs:yadd
**Error** vec.asm(97) Undefined symbol: YADD
98 010E 66| 26: 89 55 04 mov es:[di+4],edx
99 0113 66| 65: 03 06 0000 add eax,gs:zadd
**Error** vec.asm(99) Undefined symbol: ZADD
100 0119 66| 26: 89 45 08 mov es:[di+8],eax
101 ;next point
102 011E 83 C6 0C add si,12
103 0121 83 C7 0C add di,12
104 0124 FF 0E 0040r dec ds:count
105 0128 0F 85 FF35 jnz nrup1
106 012C 5F pop di
107 012D CB ret
108 012E dovertices ENDP
109
110 012E text__vec ENDS
Turbo Assembler Version 2.5 02/21/93 18:09:17 Page 3
vec.asm
111 END
Turbo Assembler Version 2.5 02/21/93 18:09:17 Page 4
Symbol Table
Symbol Name Type Value
??DATE Text "02/21/93"
??FILENAME Text "vec "
??TIME Text "18:09:13"
??VERSION Number 0205
@CPU Text 0D0FH
@CURSEG Text TEXT__VEC
@FILENAME Text VEC
@WORDSIZE Text 4
COUNT Word TEXT__VEC:0040
DOVERTICES Far TEXT__VEC:0042
MTRM00 Near TEXT__VEC:006E
MTRM02 Near TEXT__VEC:007B
MTRM04 Near TEXT__VEC:0088
MTRM06 Near TEXT__VEC:009C
MTRM08 Near TEXT__VEC:00A9
MTRM10 Near TEXT__VEC:00B6
MTRM12 Near TEXT__VEC:00CA
MTRM14 Near TEXT__VEC:00D9
MTRM16 Near TEXT__VEC:00E6
NRUP1 Near TEXT__VEC:0061
SETMATRIX Far TEXT__VEC:0000
Groups & Segments Bit Size Align Combine Class
TEXT__VEC 16 012E Para Public CODE
Turbo Assembler Version 2.5 02/21/93 18:09:17 Page 5
Error Summary
**Error** vec.asm(37) Illegal instruction
**Error** vec.asm(95) Undefined symbol: XADD
**Error** vec.asm(97) Undefined symbol: YADD
**Error** vec.asm(99) Undefined symbol: ZADD

BIN
GLENZ/VEC.OBJ Normal file

Binary file not shown.

394
GLENZ/VECCMD.ASM Normal file
View file

@ -0,0 +1,394 @@
cmdo1max equ 15 ;##??
cmdo2 LABEL WORD ;commads 77##
dw OFFSET cmd700
dw OFFSET cmd701
dw OFFSET cmd702
dw OFFSET nrserr;cmd703
dw OFFSET nrserr;cmd704
dw OFFSET cmd705
dw OFFSET cmd706
dw OFFSET cmd707
dw OFFSET cmd708
dw OFFSET cmd709
dw OFFSET cmd70a
dw OFFSET cmd70b
dw OFFSET nrserr;cmd70c
dw OFFSET nrserr
dw OFFSET nrserr
dw OFFSET nrserr
dw OFFSET cmd710
dw OFFSET cmd711
dw OFFSET cmd712
dw OFFSET cmd713
dw OFFSET cmd714
dw OFFSET cmd715
dw OFFSET cmd716
dw OFFSET nrserr
dw OFFSET nrserr
dw OFFSET cmd719
dw OFFSET nrserr
dw OFFSET nrserr
dw OFFSET nrserr
dw OFFSET nrserr
dw OFFSET nrserr
dw OFFSET cmd71F
dw OFFSET cmd720
dw OFFSET cmd721
dw OFFSET cmd722
cmdo2max equ 22h
ALIGN 2
nrscount dw 0
nrsbase dw 0
docmd_dssi PROC NEAR
push cs:[nrscount]
inc ax
mov cs:nrscount,ax
nrsl: ;nodeloop, entered also by goto
dec cs:nrscount
jz nrsret
lodsw
cmp ah,77h
je nrs77
cmp ah,cmdo1max
ja nrserr
cmp ah,0
je cmd00
call nrs_poly
jmp nrsl
nrs77: cmp al,cmdo2max
ja nrserr
mov bl,al
xor bh,bh
shl bx,1
jmp cs:cmdo2[bx]
nrsret: pop cs:[nrscount]
ret
nrserr: ;error, unknown block etc!
sub si,2
mov ax,ds:[si]
int 3
mov cx,16
nrserr1: push cx
forcesetborder 1
forcesetborder 15
pop cx
loop nrserr1
cmd00: mov ax,1 ;add this object to OBJD list
jmp nrsret
cmd700: ;goto
mov si,ds:[si]
jmp nrsl
cmd701: ;call
push si
push ds
mov si,ds:[si]
call donrsnode
pop ds
pop si
add si,2
jmp nrsl
cmd702: ;call multiple
lodsw
cmp ax,-1
je nr7c1
push si
push ds
mov si,ax
call donrsnode
pop ds
pop si
jmp cmd702
nr7c1: jmp nrsl
cmd705: ;call just one command (no node push/pop/etc)
lodsw
push si
push ds
add ax,cs:nrsbase
mov si,ax
mov ax,1 ;do just one command
call docmd_dssi
pop ds
pop si
jmp nrsl
cmd70a: ;call multiple one command (no node push/pop/etc)
mov cx,ds:[si]
add si,2
cm70a2: push cx
lodsw
push si
push ds
add ax,cs:nrsbase
mov si,ax
mov ax,1 ;do just one command
call docmd_dssi
pop ds
pop si
pop cx
loop cm70a2
jmp nrsl
cmd706: ;set base offset
mov ax,si
sub ax,2
mov cs:nrsbase,ax
jmp nrsl
cmd707: ;goto/relative
mov si,ds:[si]
add si,cs:nrsbase
jmp nrsl
cmd708: lodsw
or cs:noflags,ax
jmp nrsl
cmd709: ;call NRS header equipped node
push si
push ds
mov si,ds:[si]
call donrswheader
pop ds
pop si
add si,2
jmp nrsl
cmd712: ;translate and move
cmd710: ;translate
push ax
mov di,OFFSET nmatrix
call rotateposition ;si=>rotatedx,y,z
mov eax,cs:rotatedx
add cs:nxpos,eax
mov eax,cs:rotatedy
add cs:nypos,eax
mov eax,cs:rotatedz
add cs:nzpos,eax
mov ebp,ds:[si+4]
mov dword ptr ds:[si+4],0
mov di,OFFSET nmatrix
call rotateposition ;si=>rotatedx,y,z
mov eax,cs:rotatedx
add cs:nxspos,eax
mov eax,cs:rotatedy
add cs:nyspos,eax
mov eax,cs:rotatedz
add cs:nzspos,eax
mov ds:[si+4],ebp
add si,12
pop ax
cmp al,12h
jne nr7d2
mov cx,cs:_framestaken
cm710b: mov eax,ds:[si]
add ds:[si-3*4],eax
mov eax,ds:[si+4]
add ds:[si-2*4],eax
mov eax,ds:[si+8]
add ds:[si-1*4],eax
loop cm710b
add si,12
nr7d2: jmp nrsl
cmd711: ;rotate ZR*YR*XR
push si
push ds
mov ax,ds:[si+0]
mov bx,ds:[si+2]
mov cx,ds:[si+4]
cmp ax,0
jne nr7e1
cmp bx,0
jne nr7e1
cmp cx,0
jne nr7e1
jmp nr7e2
nr7e1: cmp ax,ds:[si+6]
jne nr7e3
cmp bx,ds:[si+8]
jne nr7e3
cmp cx,ds:[si+10]
jne nr7e3
mov ax,ds
mov es,ax
mov di,si
add di,12
jmp nr7e4
nr7e3: mov ds:[si+6],ax
mov ds:[si+8],bx
mov ds:[si+10],cx
mov di,si
add di,12
call calcmatrix ;ds:si=src(rx,ry,rz) => ds:di=dest
mov ax,ds
mov es,ax
nr7e4: mov si,OFFSET nmatrix
mov ax,cs
mov ds,ax
call mulmatrices
nr7e2: pop ds
pop si
add si,6+6+9*2
jmp nrsl
cmd719: ;simplex precalced zsort jmp
mov cx,ds:[si]
add si,2
mov edx,32767
cm719b: mov ebx,ds:[si]
shl bx,pointshl
push edx
mov eax,dword ptr cs:point[PX+bx] ;X
imul eax
mov edi,eax
mov eax,dword ptr cs:point[PY+bx] ;Y
imul eax
add edi,eax
mov eax,dword ptr cs:point[PZ+bx] ;Z
imul eax
add edi,eax
sar edi,16
mov bx,di
pop edx
cmp bx,dx
jg cm719c
mov edx,ebx
cm719c: add si,4
loop cm719b
shr edx,16
add dx,cs:nrsbase
mov si,dx
jmp nrsl
cmd720: ;bounding box
add si,6
call initnrsobj
jmp nrsl
cmd721: ;points
push si
push ds
mov ax,cs
mov ds,ax
mov si,OFFSET nmatrix
call nwritematrix
pop ds
pop si
mov cx,ds:[si]
add si,2
;calc
push cx
push ds
push si
call ncalcpoints ;cx,ds:si
pop si
pop ds
pop cx
;add si
shl cx,1
mov dx,cx
shl cx,1
add cx,dx
add si,cx
jmp nrsl
cmd722: ;normals
push si
push ds
mov ax,cs
mov ds,ax
mov si,OFFSET nmatrix
call nwritematrix2
pop ds
pop si
mov cx,ds:[si]
add si,2
;calc
push cx
push ds
push si
call ncalcpoints2 ;cx,ds:si
pop si
pop ds
pop cx
;add si
shl cx,1
mov dx,cx
shl cx,1
add cx,dx
add si,cx
jmp nrsl
cmd70b: ;breakpoint
int 3
jmp nrsl
cmd713: ;killer counter
cmp word ptr ds:[si],0
jg nr7k1
mov ax,0 ;do NOT add this object to OBJD list
jmp nrsret
nr7k1: dec word ptr ds:[si]
add si,2
jmp nrsl
cmd714: ;rotate ZR*YR*XR
push si
push ds
mov ax,ds
mov es,ax
mov di,si
mov si,OFFSET nmatrix
mov ax,cs
mov ds,ax
call mulmatrices
pop ds
pop si
add si,9*2
jmp nrsl
cmd715: ;far goto
mov bx,ds:[si]
mov ax,ds:[si+2]
cmp bx,0
jne cm715a
cmp ax,0
jne cm715a
jmp cmd00
cm715a: mov ds,ax
mov si,bx
jmp nrsl
cmd716: ;lightsource position
push ds
push si
mov di,OFFSET nmatrix
call rotateposition
mov eax,cs:rotatedx
mov ebx,cs:rotatedy
mov ecx,cs:rotatedz
call unify32
shl ax,6
shl bx,6
shl cx,6
mov cs:newlight[0],ax
mov cs:newlight[2],bx
mov cs:newlight[4],cx
pop si
pop ds
add si,12
jmp nrsl
cmd71F: ;set shadow level
jmp nrsl
docmd_dssi ENDP

409
GLENZ/VID.ASM Normal file
View file

@ -0,0 +1,409 @@
include asm.inc
;publics:
;setvmode()
extrn _bgpic:far
text__vid SEGMENT para public 'CODE'
ASSUME cs:text__vid
.386
modes dw OFFSET v320x200x256
dw OFFSET v320x350x256
dw OFFSET v320x350x256
dw OFFSET v320x240x256
dw OFFSET vtseng640x400x256
PUBLIC setvmode
setvmode PROC FAR
;ax=mode => ds:si
mov bx,ax
shl bx,1
mov bx,cs:modes[bx]
mov cx,16
@@1: mov ax,cs:[bx]
mov ds:[si],ax
mov word ptr ds:[si+2],cs
add si,4
add bx,2
loop @@1
ret
setvmode ENDP
;video mode structure
v320x200x256 LABEL WORD
dw OFFSET init320x200 ;init routine
dw OFFSET switch320x200 ;page switcher
dw OFFSET clear64k ;clear all screens
dw OFFSET twpset
dw OFFSET twlineto
dw OFFSET twhline
dw OFFSET twhlinegroup
dw OFFSET twthlinegroup
dw OFFSET polygroup
dw OFFSET clearpage
dw OFFSET fwaitborder
v320x350x256 LABEL WORD
dw OFFSET init320x350 ;init routine
dw OFFSET switch320x350 ;page switcher
dw OFFSET clear64k ;clear all screens
dw OFFSET twpset
dw OFFSET twlineto
dw OFFSET twhline
dw OFFSET twhlinegroup
dw OFFSET twthlinegroup
dw OFFSET polygroup
dw OFFSET clearpage
dw OFFSET fwaitborder
v320x350x256unr LABEL WORD
dw OFFSET init320x350unr ;init routine
dw OFFSET switch320x350 ;page switcher
dw OFFSET clear64k ;clear all screens
dw OFFSET twpset
dw OFFSET twlineto
dw OFFSET twhline
dw OFFSET twhlinegroup
dw OFFSET twthlinegroup
dw OFFSET polygroup
dw OFFSET clearpage
dw OFFSET fwaitborder
v320x240x256 LABEL WORD
dw OFFSET init320x240 ;init routine
dw OFFSET switch320x240 ;page switcher
dw OFFSET clear64k ;clear all screens
dw OFFSET twpset
dw OFFSET twlineto
dw OFFSET twhline
dw OFFSET twhlinegroup
dw OFFSET twthlinegroup
dw OFFSET polygroup
dw OFFSET clearpage
dw OFFSET fwaitborder
vtseng640x400x256 LABEL WORD
dw OFFSET init640x400 ;init routine
dw OFFSET switch640x400 ;page switcher
dw OFFSET clear640x400 ;clear all screens
dw OFFSET twpset
dw OFFSET twlineto
dw OFFSET twhline
dw OFFSET twhlinegroup
dw OFFSET twthlinegroup
dw OFFSET polygroup
dw OFFSET clearpage
dw OFFSET fwaitborder
include vidmisc.asm
include vidinit.asm
include vidtwe.asm
include vidnrm.asm
include vidpoly.asm
;****************************************************************
setrows PROC NEAR
mov cs:rowsadd,dx
mov cs:truerowsadd,dx
xor ax,ax
mov bx,OFFSET rows
ain1: mov ds:[bx],ax
add ax,dx
add bx,2
loop ain1
ret
setrows ENDP
ALIGN 2
pagep dw 0
wpage dw 0,1,2
wpage2 dw 0,4,8
spage dw 2,0,1
init640x400 PROC FAR
LOADDS
mov ds:projxmul,256*2
mov ds:projymul,213*2
mov ds:projxadd,320
mov ds:projyadd,200
mov ds:projminz,128
mov ds:projminzshr,7
mov ds:wminx,0
mov ds:wminy,0
mov ds:wmaxx,639
mov ds:wmaxy,399
mov ds:framerate10,700 ;70 frames/sec
;
mov ax,11h ;640x480/mono
int 10h
call tweak640x400
mov cx,400
mov dx,160
call setrows
ret
init640x400 ENDP
switch640x400 PROC FAR
swipa2: mov ax,0a000h
mov cs:vram,ax
mov cs:truevram,ax
mov bx,cs:pagep
inc bx
cmp bx,3
jb sws1
xor bx,bx
sws1: mov cs:pagep,bx
shl bx,1
mov dx,3d4h
mov al,33h
mov ah,byte ptr cs:spage[bx]
out dx,ax ;spage
;set wpage
mov al,byte ptr cs:wpage[bx]
mov ah,al
rol ah,4
or al,ah
mov dx,3cdh
out dx,al
;page low offset
mov dx,3d4h
mov ax,000dh
out dx,ax
mov ax,000ch
out dx,ax
ret
switch640x400 ENDP
clear640x400 PROC FAR
call switch640x400
call clear64k
call switch640x400
call clear64k
call switch640x400
call clear64k
call switch640x400
call clear64k
ret
clear640x400 ENDP
;****************************************************************
ALIGN 2
t324v dw 0a5f0h
t324v1 dw 0aaa0h
t324v2 dw 0a140h
t324vout dw 01400h
t324vout1 dw 05f00h
t324vout2 dw 0aa00h
init320x200 PROC FAR
LOADDS
mov ds:projxmul,256
mov ds:projymul,213
mov ds:projxadd,160
mov ds:projyadd,130
mov ds:projminz,128
mov ds:projminzshr,7
mov ds:wminx,0
mov ds:wminy,0
mov ds:wmaxx,319
mov ds:wmaxy,199
mov ds:framerate10,700
;
; call tweak320x200
mov cx,200
mov dx,80
call setrows
ret
init320x200 ENDP
init320x240 PROC FAR
LOADDS
mov ds:projxmul,256
mov ds:projymul,256
mov ds:projxadd,160
mov ds:projyadd,120
mov ds:projminz,128
mov ds:projminzshr,7
mov ds:wminx,0
mov ds:wminy,0
mov ds:wmaxx,319
mov ds:wmaxy,239
mov ds:framerate10,610 ;60 frames/sec
;
call tweak320x200
LOADDS
mov si,OFFSET hseq1
call sethseq ;to 240 mode
mov cx,240
mov dx,80
call setrows
ret
init320x240 ENDP
switch320x240b PROC FAR
LOADDS
mov ax,cs:t324v
mov bx,cs:t324v1
mov cs:t324v,bx
mov cs:t324v1,ax
mov ds:vram,bx
mov ds:truevram,bx
mov bx,cs:t324vout1
mov cx,cs:t324vout2
mov cs:t324vout1,cx
mov cs:t324vout2,bx
mov dx,3d4h
mov al,0ch
mov ah,bh
out dx,ax
ret
switch320x240b ENDP
switch320x240 PROC FAR
switch320x200:
LOADDS
mov ax,cs:t324v
mov bx,cs:t324v1
mov cx,cs:t324v2
mov cs:t324v,bx
mov cs:t324v1,cx
mov cs:t324v2,ax
mov ds:vram,bx
mov ds:truevram,bx
mov ax,cs:t324vout
mov bx,cs:t324vout1
mov cx,cs:t324vout2
mov cs:t324vout,bx
mov cs:t324vout1,cx
mov cs:t324vout2,ax
mov dx,3d4h
mov al,0ch
mov ah,bh
out dx,ax
ret
switch320x240 ENDP
clear64k PROC FAR
cld
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov ax,0a000h
mov es,ax
mov cx,32768
xor ax,ax
xor di,di
rep stosw
ret
clear64k ENDP
;****************************************************************
init320x350unr PROC FAR
LOADDS
mov ds:projxmul,256
mov ds:projymul,420
mov ds:projxadd,180
mov ds:projyadd,175
mov ds:projminz,128
mov ds:projminzshr,7
mov ds:wminx,0
mov ds:wminy,32
mov ds:wmaxx,359
mov ds:wmaxy,349-32
mov ds:framerate10,700 ;70 frames/sec
;
call tweak320x350
mov cx,350
mov dx,92
call setrows
ret
init320x350unr ENDP
init320x350 PROC FAR
LOADDS
mov ds:projxmul,256
mov ds:projymul,420
mov ds:projxadd,180
mov ds:projyadd,175
mov ds:projminz,128
mov ds:projminzshr,7
mov ds:wminx,0
mov ds:wminy,0
mov ds:wmaxx,359
mov ds:wmaxy,349
mov ds:framerate10,700 ;70 frames/sec
;
call tweak360x350
mov cx,350
mov dx,92
call setrows
ret
init320x350 ENDP
ALIGN 2
t365v dw 0a000h
t365v1 dw 0a800h
t365vo dw 08000h
t365vo1 dw 00000h
switch320x350 PROC FAR
LOADDS
mov ax,cs:t365v
xchg ax,cs:t365v1
mov cs:t365v,ax
mov ds:vram,ax
mov ds:truevram,ax
mov bx,cs:t365vo
xchg bx,cs:t365vo1
mov cs:t365vo,bx
mov dx,3d4h
mov al,0ch
mov ah,bh
out dx,ax
call waitborder
ret
switch320x350 ENDP
justret PROC FAR
ret
justret ENDP
clearpage PROC FAR
push ax
mov dx,3c4h
mov ax,0f02h
out dx,ax
mov es,ds:vram
mov di,ds:wminy
shl di,1
mov di,ds:rows[di]
mov ax,ds:wminx
mov dx,ds:wmaxx
sub dx,ax
shr ax,2
add di,ax
add dx,7
shr dx,4
mov cx,ds:wmaxy
sub cx,ds:wminy
inc cx
pop ax
push ax
shl eax,16
pop ax
@@1: push cx
push di
mov cx,dx
rep stosd
pop di
pop cx
add di,ds:rowsadd
loop @@1
ret
clearpage ENDP
text__vid ENDS
END

BIN
GLENZ/VID.OBJ Normal file

Binary file not shown.

519
GLENZ/VIDINIT.ASM Normal file
View file

@ -0,0 +1,519 @@
SC_INDEX equ 3c4h ;Sequence Controller Index register
GC_INDEX equ 3ceh ;Graphics Controller Index register
CRTC_INDEX equ 3d4h ;CRT Controller Index register
MEMORY_MODE equ 4 ;Memory Mode register index in SC
UNDERLINE equ 14h ;Underline Location reg index in CRTC
MODE_CONTROL equ 17h ;Mode Control register index in CRTC
GRAPHICS_MODE equ 5 ;Graphics Mode register index in GC
MISCELLANEOUS equ 6 ;Miscellaneous register index in GC
hseq1 LABEL WORD ;0=start
dw 479 ;display enable end
dw 485 ;start vertical blank
dw 490 ;start vertical retrace
dw 500 ;end vertical retrace
dw 505 ;end vertical blank
dw 510 ;vertical total
dw 480+1 ;200/350/400/480=lines/monitor, +1=double scanning
hseq2 LABEL WORD ;0=start
dw 349 ;display enable end
dw 354 ;start vertical blank
dw 360+50 ;start vertical retrace
dw 375+100 ;end vertical retrace
dw 395+100 ;end vertical blank
dw 399+100 ;vertical total
tweak320x200 PROC NEAR
;
; First, go to normal 320x200 256-color mode, which is really a
; 320x400 256-color mode with each line scanned twice.
;
mov ax,0013h ;AH = 0 means mode set, AL = 13h selects
; 256-color graphics mode
int 10h ;BIOS video interrupt
mov dx,3c8h
mov al,0
out dx,al
inc dx
mov cx,768
reclr: out dx,al
loop reclr
;
; Change CPU addressing of video memory to linear (not odd/even,
; chain, or chain 4), to allow us to access all 256K of display
; memory. When this is done, VGA memory will look just like memory
; in modes 10h and 12h, except that each byte of display memory will
; control one 256-color pixel, with 4 adjacent pixels at any given
; address, one pixel per plane.
;
mov dx,SC_INDEX
mov al,MEMORY_MODE
out dx,al
inc dx
in al,dx
and al,not 08h ;turn off chain 4
or al,04h ;turn off odd/even
out dx,al
mov dx,GC_INDEX
mov al,GRAPHICS_MODE
out dx,al
inc dx
in al,dx
and al,not 10h ;turn off odd/even
out dx,al
dec dx
mov al,MISCELLANEOUS
out dx,al
inc dx
in al,dx
and al,not 02h ;turn off chain
out dx,al
;
; Tweak the mode to 320x200 256-color mode by scanning each
; line twice.
;
mov dx,CRTC_INDEX
mov al,9
; out dx,al
inc dx
; in al,dx
and al,not 5fh ;set maximum scan line = 0
OR AL,1
; out dx,al
dec dx
;
; Change CRTC scanning from doubleword mode to byte mode, allowing
; the CRTC to scan more than 64K of video data.
;
mov al,UNDERLINE
out dx,al
inc dx
in al,dx
and al,not 40h ;turn off doubleword
out dx,al
dec dx
mov al,MODE_CONTROL
out dx,al
inc dx
in al,dx
or al,40h ;turn on the byte mode bit, so memory is
; scanned for video data in a purely
; linear way, just as in modes 10h and 12h
out dx,al
ret
;
; First, go to normal 320x200 256-color mode, which is really a
; 320x400 256-color mode with each line scanned twice.
;
mov ax,0013h ;AH = 0 means mode set, AL = 13h selects
; 256-color graphics mode
int 10h ;BIOS video interrupt
;
; Change CPU addressing of video memory to linear (not odd/even,
; chain, or chain 4), to allow us to access all 256K of display
; memory. When this is done, VGA memory will look just like memory
; in modes 10h and 12h, except that each byte of display memory will
; control one 256-color pixel, with 4 adjacent pixels at any given
; address, one pixel per plane.
;
mov dx,SC_INDEX
mov al,MEMORY_MODE
out dx,al
inc dx
in al,dx
and al,not 08h ;turn off chain 4
or al,04h ;turn off odd/even
out dx,al
mov dx,GC_INDEX
mov al,GRAPHICS_MODE
out dx,al
inc dx
in al,dx
and al,not 10h ;turn off odd/even
out dx,al
dec dx
mov al,MISCELLANEOUS
out dx,al
inc dx
in al,dx
and al,not 02h ;turn off chain
out dx,al
mov dx,SC_INDEX
mov ax,00f02h ;CLEAR ALL PLANES
out dx,ax
;mov ax,cs:vram
;mov es,ax
;mov cx,32768
;xor ax,ax
;rep stosw
;
; Tweak the mode to 320x200 256-color mode by scanning each
; line twice.
;
mov dx,CRTC_INDEX
mov al,9
out dx,al
inc dx
in al,dx
and al,not 5fh ;set maximum scan line = 0
OR AL,1
out dx,al
dec dx
;
; Change CRTC scanning from doubleword mode to byte mode, allowing
; the CRTC to scan more than 64K of video data.
;
mov al,UNDERLINE
out dx,al
inc dx
in al,dx
and al,not 40h ;turn off doubleword
out dx,al
dec dx
mov al,MODE_CONTROL
out dx,al
inc dx
in al,dx
or al,40h ;turn on the byte mode bit, so memory is
; scanned for video data in a purely
; linear way, just as in modes 10h and 12h
out dx,al
mov dx,CRTC_INDEX
mov ax,2813h
out dx,ax ;width>=320
ret
tweak320x200 ENDP
sethseq PROC NEAR ;ds:si=hseq
mov bl,1fh ;overflow
mov bh,40h ;maximum scan line
test word ptr ds:[si+12],1
jz sss9
or bh,80h
sss9:
mov ax,ds:[si+0]
test ax,256
jz sss3
or bl,2
sss3: test ax,512
jz sss4
or bl,64
sss4: mov ah,al
mov dx,3d4h
mov al,12h
out dx,ax
mov ax,ds:[si+2]
test ax,256
jz sss1
or bl,8
sss1: test ax,512
jz sss2
or bh,32
sss2: mov ah,al
mov dx,3d4h
mov al,15h
out dx,ax
mov ax,ds:[si+4]
test ax,256
jz sss7
or bl,4
sss7: test ax,512
jz sss8
or bl,128
sss8: mov ah,al
mov dx,3d4h
mov al,10h
out dx,ax
mov ax,ds:[si+6]
mov ah,al
and ah,15
or ah,20h ;disable vertical int
mov dx,3d4h
mov al,11h
out dx,ax
mov ax,ds:[si+8]
mov ah,al
mov dx,3d4h
mov al,16h
out dx,ax
mov ax,ds:[si+10]
test ax,256
jz sss5
or bl,1
sss5: test ax,512
jz sss6
or bl,32
sss6: mov ah,al
mov dx,3d4h
mov al,6h
out dx,ax
mov dx,3d4h
mov al,7h
mov ah,bl
out dx,ax
mov dx,3d4h
mov al,9h
mov ah,bh
out dx,ax
mov ax,ds:[si+12]
and ax,not 1
mov bh,0
cmp ax,350
jne sss10
mov bh,1*64
sss10: cmp ax,400
jne sss11
mov bh,2*64
sss11: cmp ax,480
jne sss12
mov bh,3*64
sss12: mov dx,3cch
in al,dx
and al,3fh
or al,bh
mov dx,3c2h
out dx,al
ret
sethseq ENDP
vptbl dw 06a00h ; horz total
dw 05901h ; horz displayed
dw 05a02h ; start horz blanking
dw 08d03h ; end horz blanking
dw 05e04h ; start h sync
dw 08a05h ; end h sync
dw 08b06h ;0d06h ; vertical total
dw 01f07h ;03e07h ; overflow
dw 04009h ; cell height
dw 06810h ; v sync start
dw 02a11h ; v sync end and protect cr0-cr7
dw 05d12h ; vertical displayed
dw 02e13h ; offset 92
dw 00014h ; turn off dword mode
dw 05d15h ; v blank start
dw 00016h ; v blank end
dw 0e317h ; turn on byte mode
vpend label word
mode13x proc
push ds
mov ax,cs
mov ds,ax
mov ax,13h ; start with standard mode 13h
int 10h ; let the bios set the mode
mov dx,3c4h ; alter sequencer registers
mov ax,0604h ; disable chain 4
out dx,ax
mov ax,0f02h ; set write plane mask to all bit planes
out dx,ax
push di
xor di,di
mov ax,0a000h ; screen starts at segment A000
mov es,ax
mov cx,21600 ; ((XSIZE*YSIZE)/(4 planes))/(2 bytes per word)
xor ax,ax
cld
rep stosw ; clear the whole of the screen
pop di
mov ax,0100h ; synchronous reset
out dx,ax ; asserted
mov dx,3c2h ; misc output
mov al,0a7h ; use 28 mHz dot clock ;a7
out dx,al ; select it
mov dx,3c4h ; sequencer again
mov ax,0300h ; restart sequencer
out dx,ax ; running again
mov dx,3d4h ; alter crtc registers
mov al,11h ; cr11
out dx,al ; current value
inc dx ; point to data
in al,dx ; get cr11 value
and al,7fh ; remove cr0 -> cr7
out dx,al ; write protect
dec dx ; point to index
cld
mov si,offset vptbl
mov cx,((offset vpend)-(offset vptbl)) shr 1
outlp: lodsw
out dx,ax
loop outlp
mov ax,cs
mov ds,ax
mov si,OFFSET hseq2
call sethseq
; mov dx,3dah
; in al,dx
; mov dx,3c0h
; mov al,11h+32
; out dx,al
; mov al,8
; out dx,al
pop ds
ret
mode13x endp
tweak640x400 PROC NEAR
;
; First, go to normal 320x200 256-color mode, which is really a
; 320x400 256-color mode with each line scanned twice.
;
mov ax,002fh
int 10h ;BIOS video interrupt
;
; Change CPU addressing of video memory to linear (not odd/even,
; chain, or chain 4), to allow us to access all 256K of display
; memory. When this is done, VGA memory will look just like memory
; in modes 10h and 12h, except that each byte of display memory will
; control one 256-color pixel, with 4 adjacent pixels at any given
; address, one pixel per plane.
;
mov dx,SC_INDEX
mov al,MEMORY_MODE
out dx,al
inc dx
in al,dx
and al,not 08h ;turn off chain 4
or al,04h ;turn off odd/even
out dx,al
mov dx,GC_INDEX
mov al,GRAPHICS_MODE
out dx,al
inc dx
in al,dx
and al,not 10h ;turn off odd/even
out dx,al
dec dx
mov al,MISCELLANEOUS
out dx,al
inc dx
in al,dx
and al,not 02h ;turn off chain
out dx,al
ret
;
; Change CRTC scanning from doubleword mode to byte mode, allowing
; the CRTC to scan more than 64K of video data.
;
mov al,UNDERLINE
out dx,al
inc dx
in al,dx
and al,not 40h ;turn off doubleword
out dx,al
dec dx
mov al,MODE_CONTROL
out dx,al
inc dx
in al,dx
or al,40h ;turn on the byte mode bit, so memory is
; scanned for video data in a purely
; linear way, just as in modes 10h and 12h
out dx,al
ret
tweak640x400 ENDP
hseq3 LABEL WORD ;0=start
dw 349 ;display enable end
dw 355 ;start vertical blank
dw 395 ;start vertical retrace
dw 405 ;end vertical retrace
dw 445 ;end vertical blank
dw 455 ;vertical total
dw 350 ;200/350/400/480=lines/monitor, +1=double scanning
tweak360x350 proc
push ds
mov ax,cs
mov ds,ax
mov ax,13h ; start with standard mode 13h
int 10h ; let the bios set the mode
mov dx,3c4h ; alter sequencer registers
mov ax,0604h ; disable chain 4
out dx,ax
mov ax,0f02h ; set write plane mask to all bit planes
out dx,ax
push di
xor di,di
mov ax,0a000h ; screen starts at segment A000
mov es,ax
mov cx,21600 ; ((XSIZE*YSIZE)/(4 planes))/(2 bytes per word)
xor ax,ax
cld
rep stosw ; clear the whole of the screen
pop di
mov ax,0100h ; synchronous reset
out dx,ax ; asserted
mov dx,3c2h ; misc output
mov al,0a7h ; use 28 mHz dot clock
out dx,al ; select it
mov dx,3c4h ; sequencer again
mov ax,0300h ; restart sequencer
out dx,ax ; running again
mov dx,3d4h ; alter crtc registers
mov al,11h ; cr11
out dx,al ; current value
inc dx ; point to data
in al,dx ; get cr11 value
and al,7fh ; remove cr0 -> cr7
out dx,al ; write protect
dec dx ; point to index
cld
mov si,offset vptbl
mov cx,((offset vpend)-(offset vptbl)) shr 1
outlpn: lodsw
out dx,ax
loop outlpn
mov ax,cs
mov ds,ax
mov si,OFFSET hseq3
call sethseq
pop ds
ret
tweak360x350 endp
hseq4 LABEL WORD ;0=start
dw 349 ;display enable end
dw 355 ;start vertical blank
dw 395 ;start vertical retrace
dw 405 ;end vertical retrace
dw 450 ;end vertical blank
dw 455 ;vertical total
dw 350 ;200/350/400/480=lines/monitor, +1=double scanning
tweak320x350 proc
call tweak360x350
ret
tweak320x350 endp

56
GLENZ/VIDMISC.ASM Normal file
View file

@ -0,0 +1,56 @@
forcesetborder MACRO color
local l1
push ax
push dx
mov dx,3dah
in al,dx
mov dx,3c0h
mov al,11h+32
out dx,al
mov al,color
out dx,al
pop dx
pop ax
ENDM
PUBLIC _setborder
_setborder PROC FAR
CBEG
push cx
mov cx,[bp+6]
forcesetborder cl
pop cx
CEND
_setborder ENDP
fwaitborder PROC FAR
call waitborder
ret
fwaitborder ENDP
waitborder PROC NEAR
mov dx,3dah
wbr1: in al,dx
test al,8
jnz wbr1
wbr2: in al,dx
test al,8
jz wbr2
ret
waitborder ENDP
clearpal PROC NEAR
cli
call waitborder
mov dx,3c8h
mov al,0
out dx,al
mov cx,768
inc dx
clp1: out dx,al
loop clp1
call waitborder
sti
ret
clearpal ENDP

485
GLENZ/VIDNRM.ASM Normal file
View file

@ -0,0 +1,485 @@
;256 color normal routines
;routines ending in "1" are vector drawers:
; DS:SI preserved
; OUT 3C4,02h required
; DS=CS & ES=vram required
ALIGN 4
nrpset PROC FAR
;requires: OUT 3C4,2
;DS:SI preserved, CX preserved!
shl bx,1
mov di,ds:rows[bx]
mov bx,3
and bx,dx
sar dx,2
add di,dx
mov al,ds:middledot[bx]
mov dx,3c5h
out dx,al
mov al,ds:color1
mov es:[di],al
ret
nrpset ENDP
nrhline PROC FAR
;requires: OUT 3C4,2
;DS:SI must be preserved!
;(ax,bx)-(dx,bx)
cmp ax,dx
jl nrhi1
xchg ax,dx
nrhi1:
cmp ax,0
jnl nrhi2
cmp dx,0
jl nrhi0
xor ax,ax
nrhi2: cmp dx,ds:wmaxx
jng nrhi21
cmp ax,ds:wmaxx
jg nrhi0
mov dx,ds:wmaxx
nrhi21: mov di,ax
sar di,2
mov cx,dx
sar cx,2
sub cx,di
shl bx,1
add di,ds:rows[bx]
mov bp,3
and bp,ax
mov bh,ds:leftside[bp]
mov bp,3
and bp,dx
mov bl,ds:rightside[bp]
mov dx,3c5h
;(di..si,bx)
cmp cx,0
je nrhi30
;left side
mov al,bh
out dx,al
mov al,ds:color1
stosb
dec cx
mov ah,al
;middle
jcxz nrhi33
mov al,0fh
out dx,al
mov al,ah
test di,1
jz nrhi32
stosb
dec cx
nrhi32: shr cx,1
rep stosw
adc cx,cx
rep stosb
nrhi33: ;right side
mov al,bl
out dx,al
mov al,ah
mov es:[di],al
nrhi0: ret
nrhi30: ;end and beg in same byte
mov al,bl
and al,bh
out dx,al
mov al,ds:color1
mov es:[di],al
ret
nrhline ENDP
;line variables - shared - also in vidtwe.asm
;xdif dw 0
;ydif dw 0
;xabs dw 0
;yabs dw 0
;xsgn dw 0
;ysgn dw 0
;xtmp dw 0
;ytmp dw 0
;tmplnx dw 0
;tmplny dw 0
nrpsetc PROC NEAR
;(dx,bx)=(color), es must be 0a000h
;uses nothing
push ax
push bx
push cx
push dx
mov ch,al
mov cl,dl
shl bx,1
mov bx,cs:rows[bx]
sar dx,1
sar dx,1
add bx,dx
and cl,3
mov ax,102h
mov dx,03c4h
shl ah,cl
out dx,ax
mov al,cs:color1
mov es:[bx],al
pop dx
pop cx
pop bx
pop ax
ret
nrpsetc ENDP
nrlineto PROC FAR
;draw line from (cx,ax) to (dx,bx) with color (color)
;requires ds=cs, es=vram, changes: ax
push cx
push si
push di
push bp
push dx
push bx
mov ds:tmplnx,cx
mov ds:tmplny,ax
;set insider point as begin of line
cmp dx,ds:wmaxx
ja nrlt4
cmp bx,wmaxy
ja nrlt4
jmp nrlt5 ;dx,bx is inside, no changes
nrlt4: ;dx,bx outside, swap
xchg bx,ds:tmplny
xchg dx,ds:tmplnx
;check with new bx,dx
cmp dx,ds:wmaxx
ja nrlt6
cmp bx,wmaxy
ja nrlt6
jmp nrlt5 ;dx,bx is inside
nrlt6: ;both ends outside! Cut 'em here, not ready yet
nrlt5: mov ds:xtmp,dx
mov ds:ytmp,bx
;calc differencies xdif,ydif (+-) & abs difs, xabs,yabs (+)
;and signs xsgn,ysgn (-1/0/1)
xor cx,cx
mov ax,ds:tmplnx
sub ax,dx
mov ds:xdif,ax
or ax,ax
je nrlt1
inc cx
test ax,32768
jz nrlt1
neg ax
dec cx
dec cx
nrlt1: mov ds:xabs,ax
mov ds:xsgn,cx
xor cx,cx
mov ax,ds:tmplny
sub ax,bx
mov ds:ydif,ax
or ax,ax
je nrlt2
inc cx
test ax,32768
jz nrlt2
neg ax
dec cx
dec cx
nrlt2: mov ds:yabs,ax
mov ds:ysgn,cx
;which is bigger?
cmp ax,ds:xabs
ja nrlt3
;xbigger
;calc addl/h (si,di)
jne nrlt9
;1/1 addition, 45 degree curve
cmp ax,0
jne nrlt15
mov dx,cs:tmplnx
mov bx,ds:tmplny
call nrpsetc
jmp nrlt10
nrlt15: mov di,ds:ysgn
mov si,65535
jmp nrlt10
nrlt9: mov dx,ax ;dx=yabs
xor ax,ax
div ds:xabs ;ax=lowadd
mov si,ax
mov di,ds:ysgn
nrlt10: mov ax,32767
mov bp,ds:xsgn
mov cx,ds:xabs
inc cx
mov dx,ds:xtmp
mov bx,ds:ytmp
nrlt7: call nrpsetc
add dx,bp ;xsgn
add ax,si ;yaddl
jnc nrlt8
add bx,di ;ysgn
nrlt8: loop nrlt7
jmp nrlt0
nrlt3: ;ybigger
mov dx,ds:xabs
xor ax,ax
div ds:yabs ;ax=lowadd
mov si,ax
mov di,ds:xsgn
nrlt12: mov ax,32767
mov bp,ds:ysgn
mov cx,ds:yabs
inc cx
mov dx,ds:xtmp
mov bx,ds:ytmp
nrlt13: call nrpsetc
add bx,bp ;ysgn
add ax,si ;xaddl
jnc nrlt14
add dx,di ;xsgn
nrlt14: loop nrlt13
nrlt0: pop bx
pop dx
mov ds:tmplnx,dx
mov ds:tmplny,bx
pop bp
pop di
pop si
pop cx
ret
nrlineto ENDP
nrhlinegroup PROC FAR
;requires: OUT 3C4,2
mov dx,3c4h
mov al,2
out dx,al
mov bx,gs:[si]
add si,2
dec bx
push bx
nrhg92: pop bx
inc bx
push bx
mov ax,gs:[si]
add si,2
cmp ax,-32767
jne nrhg91
pop bx
ret
nrhg91: mov dx,ax
mov ax,gs:[si]
add si,2
cmp ax,dx
jl nrhg1
xchg ax,dx
nrhg1:
cmp ax,ds:wminx
jnl nrhg2
cmp dx,ds:wminx
jl nrhg92
mov ax,ds:wminx
nrhg2: cmp dx,ds:wmaxx
jng nrhg21
cmp ax,ds:wmaxx
jg nrhg92
mov dx,ds:wmaxx
nrhg21: mov di,ax
mov cx,dx
sub cx,ax
shl bx,1
add di,ds:rows[bx]
mov al,cs:color1
mov ah,al
cmp cx,8
jl nrhg22
mov dx,ax
shl eax,16
mov ax,dx
mov dx,cx
mov cx,4
sub cx,di
and cx,3
sub dx,cx
rep stosb
mov cx,dx
shr cx,2
rep stosd
mov cx,dx
and cx,3
rep stosb
jmp nrhg92
nrhg22: shr cx,1
rep stosw
adc cx,cx
rep stosb
jmp nrhg92
nrhlinegroup ENDP
ALIGN 2
bpmultable LABEL WORD
dw 0
cc=1
REPT 255
dw (16383)/cc
cc=cc+1
ENDM
public _dimtable
_dimtable db 256 dup(1)
ALIGN 2
tmpax dw 0
nrthlinegroup PROC NEAR
;requires: OUT 3C4,2
mov dx,3c4h
mov al,2
out dx,al
mov bx,gs:[si]
add si,2
dec bx
jmp tnrg93
tnrg92: pop bx
add si,8
tnrg93: inc bx
push bx
mov dx,gs:[si] ;left
cmp dx,-32767
jne tnrg91
pop bx
ret
tnrg91: mov ax,gs:[si+2] ;right
cmp ax,dx
jl tnrg1
xchg ax,dx
mov cx,gs:[si+4]
xchg cx,gs:[si+6]
mov gs:[si+4],cx
tnrg1:
cmp ax,ds:wminx
jnl tnrg2
cmp dx,ds:wminx
jl tnrg92
mov ax,ds:wminx
tnrg2: cmp dx,ds:wmaxx
jng tnrg21
cmp ax,ds:wmaxx
jg tnrg92
mov dx,ds:wmaxx
tnrg21: mov ds:tmpax,ax
mov cx,dx
sub cx,ax
jcxz tnrg92
shl bx,1
mov di,ds:rows[bx]
mov bp,cx ;count
shl bp,1
mov bx,word ptr cs:bpmultable[bp]
shr bp,1
mov ah,gs:[si+4] ;endx
sub ah,gs:[si+6] ;startx
xor al,al
imul bx
shld dx,ax,2
;dx=y, eaxh=x
mov cl,dh
mov ah,dl
xor al,al
rol eax,16 ;xadd
mov ah,gs:[si+5] ;endy
sub ah,gs:[si+7] ;starty
xor al,al
imul bx
shld dx,ax,2
mov ch,dh
mov dh,dl ;yadd
xor dl,dl
rol edx,16
mov dx,cx
cmp dl,80h
adc dh,-1 ;x/yaddhi
push si
push ds
mov ax,fs
mov ds,ax
shl bp,4
mov bx,cs:tmpax
shl bx,4
add bx,OFFSET bas256
add bp,bx
mov ax,bx
mov byte ptr cs:[bp],0c3h ;ret
push bp
movzx ebx,word ptr gs:[si+6] ;startxy/zero ylow
xor ecx,ecx ;zero xlow
call ax
pop bx
mov byte ptr cs:[bx],066h ;start of add ecx,eax
pop ds
pop si
jmp tnrg92
;....Exx..H....L....
;ax xadd - tmp
;bx ylow y x
;cx xlow - -
;dx yadd yah xah
;si - - -
;di - distbase
;bp - - -
ALIGN 16
bas256: cc=0
REPT 256
add ecx,eax ;@0
mov al,ds:[bx] ;@3
adc ebx,edx ;@5
adc bh,0 ;@8
db 26h,88h,85h ;@B ;mov es:[di+XXX],al
dw cc ;@E ;XXX
cc=cc+1 ;@10
ENDM
add ecx,eax
nrthlinegroup ENDP

1009
GLENZ/VIDPOLY.ASM Normal file

File diff suppressed because it is too large Load diff

493
GLENZ/VIDTWE.ASM Normal file
View file

@ -0,0 +1,493 @@
;256 color tweaked routines
;routines ending in "1" are vector drawers:
; DS:SI preserved
; OUT 3C4,02h required
; DS=CS & ES=vram required
ALIGN 4
leftside db 1111b,1110b,1100b,1000b
rightside db 0001b,0011b,0111b,1111b
middledot db 0001b,0010b,0100b,1000b
ALIGN 4
twpset PROC FAR
;requires: OUT 3C4,2
;DS:SI preserved, CX preserved!
shl bx,1
mov di,ds:rows[bx]
mov bx,3
and bx,dx
sar dx,2
add di,dx
mov al,cs:middledot[bx]
mov dx,3c5h
out dx,al
mov al,ds:color1
mov es:[di],al
ret
twpset ENDP
twhline PROC FAR
;requires: OUT 3C4,2
;DS:SI must be preserved!
;(ax,bx)-(dx,bx)
cmp ax,dx
jl hli1
xchg ax,dx
hli1:
cmp ax,0
jnl hli2
cmp dx,0
jl hli0
xor ax,ax
hli2: cmp dx,ds:wmaxx
jng hli21
cmp ax,ds:wmaxx
jg hli0
mov dx,ds:wmaxx
hli21: mov di,ax
sar di,2
mov cx,dx
sar cx,2
sub cx,di
shl bx,1
add di,ds:rows[bx]
mov bp,3
and bp,ax
mov bh,cs:leftside[bp]
mov bp,3
and bp,dx
mov bl,cs:rightside[bp]
mov dx,3c5h
;(di..si,bx)
cmp cx,0
je hli30
;left side
mov al,bh
out dx,al
mov al,ds:color1
stosb
dec cx
mov ah,al
;middle
jcxz hli33
mov al,0fh
out dx,al
mov al,ah
test di,1
jz hli32
stosb
dec cx
hli32: shr cx,1
rep stosw
adc cx,cx
rep stosb
hli33: ;right side
mov al,bl
out dx,al
mov al,ah
mov es:[di],al
hli0: ret
hli30: ;end and beg in same byte
mov al,bl
and al,bh
out dx,al
mov al,ds:color1
mov es:[di],al
ret
twhline ENDP
ALIGN 2
;line variables
xdif dw 0
ydif dw 0
xabs dw 0
yabs dw 0
xsgn dw 0
ysgn dw 0
xtmp dw 0
ytmp dw 0
tmplnx dw 0
tmplny dw 0
twpsetc PROC NEAR
;(dx,bx)=(color), es must be 0a000h
;uses nothing
push ax
push bx
push cx
push dx
mov ch,al
mov cl,dl
shl bx,1
mov bx,ds:rows[bx]
sar dx,1
sar dx,1
add bx,dx
and cl,3
mov ax,102h
mov dx,03c4h
shl ah,cl
out dx,ax
mov al,ds:color1
mov es:[bx],al
psc0: pop dx
pop cx
pop bx
pop ax
ret
twpsetc ENDP
twlineto PROC FAR
;draw line from (cx,ax) to (dx,bx) with color (color)
;requires es=vram, changes: ax
push cx
push si
push di
push bp
push dx
push bx
mov cs:tmplnx,cx
mov cs:tmplny,ax
;set insider point as begin of line
cmp dx,cs:wmaxx
ja lt4
cmp bx,cs:wmaxy
ja lt4
jmp lt5 ;dx,bx is inside, no changes
lt4: ;dx,bx outside, swap
xchg bx,cs:tmplny
xchg dx,cs:tmplnx
;check with new bx,dx
cmp dx,wmaxx
ja lt6
cmp bx,wmaxy
ja lt6
jmp lt5 ;dx,bx is inside
lt6: ;both ends outside! Cut 'em here, not ready yet
lt5: mov cs:xtmp,dx
mov cs:ytmp,bx
;calc differencies xdif,ydif (+-) & abs difs, xabs,yabs (+)
;and signs xsgn,ysgn (-1/0/1)
xor cx,cx
mov ax,cs:tmplnx
sub ax,dx
mov cs:xdif,ax
or ax,ax
je lt1
inc cx
test ax,32768
jz lt1
neg ax
dec cx
dec cx
lt1: mov cs:xabs,ax
mov cs:xsgn,cx
xor cx,cx
mov ax,cs:tmplny
sub ax,bx
mov cs:ydif,ax
or ax,ax
je lt2
inc cx
test ax,32768
jz lt2
neg ax
dec cx
dec cx
lt2: mov cs:yabs,ax
mov cs:ysgn,cx
;which is bigger?
cmp ax,cs:xabs
ja lt3
;xbigger
;calc addl/h (si,di)
jne lt9
;1/1 addition, 45 degree curve
cmp ax,0
jne lt15
mov dx,cs:tmplnx
mov bx,cs:tmplny
call twpsetc
jmp lt10
lt15: mov di,cs:ysgn
mov si,65535
jmp lt10
lt9: mov dx,ax ;dx=yabs
xor ax,ax
div cs:xabs ;ax=lowadd
mov si,ax
mov di,cs:ysgn
lt10: mov ax,32767
mov bp,cs:xsgn
mov cx,cs:xabs
inc cx
mov dx,cs:xtmp
mov bx,cs:ytmp
lt7: call twpsetc
add dx,bp ;xsgn
add ax,si ;yaddl
jnc lt8
add bx,di ;ysgn
lt8: loop lt7
jmp lt0
lt3: ;ybigger
mov dx,cs:xabs
xor ax,ax
div cs:yabs ;ax=lowadd
mov si,ax
mov di,cs:xsgn
lt12: mov ax,32767
mov bp,cs:ysgn
mov cx,cs:yabs
inc cx
mov dx,cs:xtmp
mov bx,cs:ytmp
lt13: call twpsetc
add bx,bp ;ysgn
add ax,si ;xaddl
jnc lt14
add dx,di ;xsgn
lt14: loop lt13
lt0: pop bx
pop dx
mov cs:tmplnx,dx
mov cs:tmplny,bx
pop bp
pop di
pop si
pop cx
ret
twlineto ENDP
twhlinegroup PROC FAR
;requires: OUT 3C4,2
mov dx,3c4h
mov al,2
out dx,al
mov bx,gs:[si]
add si,2
dec bx
push bx
hlg92: pop bx
inc bx
push bx
mov ax,gs:[si]
add si,2
cmp ax,-32767
jne hlg91
pop bx
ret
hlg91: mov dx,ax
mov ax,gs:[si]
add si,2
cmp ax,dx
jl hlg1
xchg ax,dx
hlg1:
cmp ax,ds:wminx
jnl hlg2
cmp dx,ds:wminx
jl hlg0
mov ax,ds:wminx
hlg2: cmp dx,ds:wmaxx
jng hlg21
cmp ax,ds:wmaxx
jg hlg0
mov dx,ds:wmaxx
hlg21: mov di,ax
sar di,2
mov cx,dx
sar cx,2
sub cx,di
shl bx,1
add di,ds:rows[bx]
mov bp,3
and bp,ax
mov bh,cs:leftside[bp]
mov bp,3
and bp,dx
mov bl,cs:rightside[bp]
mov dx,3c5h
;(di..si,bx)
cmp cx,0
je hlg30
;left side
mov al,bh
out dx,al
mov al,ds:color1
stosb
dec cx
mov ah,al
;middle
jcxz hlg33
mov al,0fh
out dx,al
mov al,ah
test di,1
jz hlg32
stosb
dec cx
hlg32: shr cx,1
rep stosw
adc cx,cx
rep stosb
hlg33: ;right side
mov al,bl
out dx,al
mov al,ah
mov es:[di],al
hlg0: jmp hlg92
hlg30: ;end and beg in same byte
mov al,bl
and al,bh
out dx,al
mov al,ds:color1
mov es:[di],al
jmp hlg92
twhlinegroup ENDP
ALIGN 4
tmiddle LABEL BYTE
db 00010001b
db 00100010b
db 01000100b
db 10001000b
tmpttt db 0
twthlinegroup PROC NEAR
;requires: OUT 3C4,2
mov dx,3c4h
mov al,2
out dx,al
mov bx,gs:[si]
add si,2
dec bx
jmp thlg93
thlg92: pop bx
add si,8
thlg93: inc bx
push bx
mov dx,gs:[si] ;left
cmp dx,-32767
jne thlg91
pop bx
ret
thlg91: mov ax,gs:[si+2] ;right
cmp ax,dx
jl thlg1
xchg ax,dx
mov cx,gs:[si+4]
xchg cx,gs:[si+6]
mov gs:[si+4],cx
thlg1:
cmp ax,ds:wminx
jnl thlg2
cmp dx,ds:wminx
jl thlg92
mov ax,ds:wminx
thlg2: cmp dx,ds:wmaxx
jng thlg21
cmp ax,ds:wmaxx
jg thlg92
mov dx,ds:wmaxx
thlg21: mov cx,dx
sub cx,ax
jcxz thlg92
mov di,ax
shr di,2
shl bx,1
add di,ds:rows[bx]
mov bx,ax
and bx,3
mov bp,cx ;count
mov al,ds:tmiddle[bx]
mov cs:tmpttt,al
mov ah,gs:[si+4] ;endx
xor al,al
sub ah,gs:[si+6] ;startx
cwd
idiv bp
rol edi,16
mov cl,ah
mov ah,al
xor al,al
mov di,ax ;xadd
rol edi,16
mov ah,gs:[si+5] ;endy
xor al,al
sub ah,gs:[si+7] ;starty
cwd
idiv bp
mov dh,al ;yadd
xor dl,dl
shl edx,16
mov dh,ah
mov dl,cl
cmp dl,0
jge thlg31
dec dh
thlg31:
movzx ebx,word ptr gs:[si+6] ;startxy/zero ylow
xor ecx,ecx ;zero xlow
;....Exx..H....L....
;ax - - <R>
;bx ylow y x
;cx xlow - tmp
;dx yadd yah xah
;si - - -
;di xadd distbase
;bp - - - <=tmp reserved for count
mov al,cs:tmpttt
thlg82: ;
add ecx,edi
mov cl,fs:[bx]
adc ebx,edx
adc bh,0
;
push dx
mov dx,3c5h
out dx,al
mov es:[di],cl
rol al,1
adc di,0
pop dx
;
dec bp
jnz thlg82
thlg0: jmp thlg92
twthlinegroup ENDP

33
GLENZ/ZOOM.ASM Normal file
View file

@ -0,0 +1,33 @@
text__zoom SEGMENT para public 'CODE2'
ASSUME cs:text__zoom
LOCALS
.386
PUBLIC _zoom
_zoom PROC FAR
push bp
mov bp,sp
push si
push di
push ds
les di,[bp+6]
lds si,[bp+10]
mov ax,[bp+14]
call zoom
pop ds
pop di
pop si
pop bp
ret
_zoom ENDP
include zoomloop.inc
PUBLIC _sin1024
include sin1024.inc
text__zoom ENDS
END

BIN
GLENZ/ZOOM.OBJ Normal file

Binary file not shown.

141
GLENZ/ZOOMER.C Normal file
View file

@ -0,0 +1,141 @@
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include "..\dis\dis.h"
static char *vram=(char *)0xa0000000L;
static char *bg;
extern void zoom(char *to,char *from,int factor);
extern int sin1024[];
static char pal1[768];
static char pal2[768];
void zoomer2(char *pic)
{
int a,b,c,y;
char *v;
int frame=0;
int zly,zy,zya;
int zly2,zy2;
_asm
{
mov dx,3c4h
mov ax,0f02h
out dx,ax
}
outp(0x3c7,0);
for(a=0;a<768;a++) pal1[a]=inp(0x3c9);
zy=0; zya=0; zly=0;
zy2=0; zly2=0;
frame=0;
while(!kbhit())
{
if(zy==260) break;
zly=zy;
zya++;
zy+=zya/4;
if(zy>260) zy=260;
v=vram+zly*80;
for(y=zly;y<=zy;y++)
{
memset(v,255,80);
v+=80;
}
zly2=zy2;
zy2=125*zy/260;
v=vram+(399-zy2)*80;
for(y=zly2;y<=zy2;y++)
{
memset(v,255,80);
v+=80;
}
c=frame;
if(c>32) c=32;
b=32-c;
for(a=0;a<128*3;a++)
{
pal2[a]=(pal1[a]*b+30*c)>>5;
}
frame++;
dis_waitb();
setpalarea(pal2,0,128);
}
v=vram+(194)*80;
outp(0x3c8,0);
outp(0x3c9,0);
outp(0x3c9,0);
outp(0x3c9,0);
v=vram+(0)*80;
for(y=0;y<=399;y++)
{
if(y<=274 || y>=260) memset(v,0,80);
v+=80;
}
}
void zoomer1(char *pic)
{
int dist=320,q;
int y1,y2,z1,z2,yd;
int y,z,f=0,frame=0;
int rot;
bg=pic;
for(y=199;y>=0;y--)
{
memmove(bg+326*y,bg+320*y,320);
memset(bg+326*y+320,0,4);
}
for(q=0;q<70;q++) dis_waitb();
for(q=0;q<320;q++)
{
bg[200*326+q]=7;
}
while(!kbhit() && frame<=128)
{
q=(int)((long)frame*(long)frame/128L)*2;
dist=320-(320-245)*frame/128;
rot=768-q;
y1=102+sin1024[rot&1023]*25/64;
z1=400+sin1024[(rot+256)&1023]*25/64;
y2=102+sin1024[(rot+512)&1023]*25/64;
z2=400+sin1024[(rot+768)&1023]*25/64;
// convert z to scale
z1=(int)((long)dist*400L/(long)z1);
z2=(int)((long)dist*400L/(long)z2);
if(y1<y2)
{
yd=y2-y1;
q=frame/20;
y1-=q;
for(y=y1-5;y<y1;y++) if(y>=0 && y<=199)
{
memset(vram+y*320,0,320);
}
for(y=0;y<q;y++)
{
if(y1>=0) zoom(vram+(y1)*320,bg+200*326,z1);
y1++;
}
for(y=0;y<yd;y++)
{
z=((long)y*(long)z2+((long)yd-(long)y)*(long)z1)/(long)yd;
q=(200L*(long)y/(long)yd);
zoom(vram+(y+y1)*320,bg+q*326,z);
}
for(y=y2;y<y2+5;y++)
{
if(y>=0 && y<=199) memset(vram+y*320,0,320);
}
}
if(f<35) f++;
frame+=dis_waitb();
}
}

BIN
GLENZ/ZOOMER.EXE Normal file

Binary file not shown.

BIN
GLENZ/ZOOMER.OBJ Normal file

Binary file not shown.

14455
GLENZ/ZOOMLOOP.INC Normal file

File diff suppressed because it is too large Load diff

BIN
GLENZ/_BGPIC.OBK Normal file

Binary file not shown.

BIN
GLENZ/_FC.OBK Normal file

Binary file not shown.