Upload
This commit is contained in:
commit
43352ff262
1291 changed files with 220976 additions and 0 deletions
275
GRID/ASM.ASM
Normal file
275
GRID/ASM.ASM
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
include clink.inc
|
||||
|
||||
xbufseg SEGMENT para public 'DATA'
|
||||
PUBLIC _bufdata
|
||||
_bufdata dw 32768 dup(0)
|
||||
xbufseg ENDS
|
||||
|
||||
xmulseg SEGMENT para public 'DATA'
|
||||
;high=X, low=Y => result=X*Y/256
|
||||
PUBLIC _muldata
|
||||
_muldata dw 32768 dup(0)
|
||||
xmulseg ENDS
|
||||
|
||||
xlineseg SEGMENT para public 'DATA'
|
||||
;high=X, low=Y, shl=1 => result=offset to blit routine
|
||||
PUBLIC _linedata
|
||||
_linedata dw 32768 dup(0)
|
||||
xlineseg ENDS
|
||||
|
||||
code SEGMENT para public 'CODE'
|
||||
ASSUME cs:code
|
||||
LOCALS
|
||||
.386
|
||||
EXTRN lblt_table:word
|
||||
|
||||
MINX equ -10
|
||||
MAXX equ 10
|
||||
MINY equ -8
|
||||
MAXY equ 8
|
||||
|
||||
rows dw 200 dup(0)
|
||||
vram dw 0a000h
|
||||
mulseg dw SEG _muldata
|
||||
lineseg dw SEG _linedata
|
||||
bufseg dw SEG _bufdata
|
||||
|
||||
PUBLIC _xyzdata
|
||||
;x,y,-,-, e1a,e1b,e1c,e1d, e2a,e2b,e2c,e2d, e3a,e3b,e3c,e3d
|
||||
_xyzdata dw 32*32 dup(4*4 dup(0))
|
||||
RECLEN equ (4*4*2)
|
||||
PUBLIC _plane
|
||||
_plane dw 0
|
||||
drawplane dw 0101h,0202h,0404h
|
||||
drawstore dw 8,16,24
|
||||
|
||||
PUBLIC _asminit
|
||||
_asminit PROC FAR
|
||||
CBEG
|
||||
call lineblit_init
|
||||
call xyzdata_init
|
||||
call rows_init
|
||||
CEND
|
||||
_asminit ENDP
|
||||
|
||||
PUBLIC _setborder
|
||||
_setborder PROC FAR
|
||||
CBEG
|
||||
mov dx,3dah
|
||||
in al,dx
|
||||
mov dx,3c0h
|
||||
mov al,11h+32
|
||||
out dx,al
|
||||
mov al,[bp+6]
|
||||
out dx,al
|
||||
CEND
|
||||
_setborder ENDP
|
||||
|
||||
xyzdata_init PROC NEAR
|
||||
mov cx,32*32
|
||||
mov bx,OFFSET _xyzdata
|
||||
mov ax,OFFSET @@ret
|
||||
@@1: mov cs:[bx+8+2],ax
|
||||
mov cs:[bx+8+6],ax
|
||||
mov cs:[bx+16+2],ax
|
||||
mov cs:[bx+16+6],ax
|
||||
mov cs:[bx+24+2],ax
|
||||
mov cs:[bx+24+6],ax
|
||||
add bx,RECLEN
|
||||
loop @@1
|
||||
@@ret: ret
|
||||
xyzdata_init ENDP
|
||||
|
||||
rows_init PROC NEAR
|
||||
mov cx,200
|
||||
mov bx,OFFSET rows
|
||||
mov dx,320
|
||||
xor ax,ax
|
||||
@@1: mov cs:[bx],ax
|
||||
add ax,dx
|
||||
add bx,2
|
||||
loop @@1
|
||||
ret
|
||||
rows_init ENDP
|
||||
|
||||
PUBLIC _setpalette
|
||||
_setpalette PROC FAR
|
||||
CBEG
|
||||
mov dx,3c8h
|
||||
xor al,al
|
||||
out dx,al
|
||||
inc dx
|
||||
movpar si,0
|
||||
movpar ds,1
|
||||
mov cx,768
|
||||
rep outsb
|
||||
CEND
|
||||
_setpalette ENDP
|
||||
|
||||
ALIGN 2
|
||||
tmpcolor dw 0
|
||||
tmpcount dw 0
|
||||
|
||||
PUBLIC _asmloop2
|
||||
_asmloop2 PROC FAR
|
||||
CBEG
|
||||
mov ax,cs
|
||||
mov ds,ax
|
||||
mov si,OFFSET _xyzdata
|
||||
mov cx,32*32
|
||||
@@1: mov ax,ds:[si+4]
|
||||
mov bx,ds:[si+6]
|
||||
add bx,ax
|
||||
cmp bx,16*199
|
||||
jb @@2
|
||||
sub bx,ax
|
||||
neg ax
|
||||
@@2: mov ds:[si+4],ax
|
||||
mov ds:[si+6],bx
|
||||
shr bx,4
|
||||
mov ds:[si+2],bx
|
||||
add si,RECLEN
|
||||
loop @@1
|
||||
CEND
|
||||
_asmloop2 ENDP
|
||||
|
||||
PUBLIC _asmloop1
|
||||
_asmloop1 PROC FAR
|
||||
CBEG
|
||||
mov ax,cs
|
||||
mov ds,ax
|
||||
mov bx,ds:_plane
|
||||
inc bx
|
||||
cmp bx,3
|
||||
jb @@i1
|
||||
xor bx,bx
|
||||
@@i1: mov ds:_plane,bx
|
||||
shl bx,1
|
||||
mov ax,ds:drawplane[bx]
|
||||
mov ds:tmpcolor,ax
|
||||
mov bp,ds:drawstore[bx]
|
||||
mov es,ds:vram
|
||||
mov fs,ds:lineseg
|
||||
mov gs,ds:bufseg
|
||||
xor ebx,ebx
|
||||
;===erase===
|
||||
mov ds:tmpcount,25
|
||||
mov si,OFFSET _xyzdata
|
||||
mov dx,ds:tmpcolor
|
||||
@@3: zzz=0
|
||||
REPT 40
|
||||
local l1
|
||||
mov di,ds:[si+zzz+bp+0]
|
||||
call ds:[si+zzz+bp+2]
|
||||
zzz=zzz+RECLEN
|
||||
l1: ENDM
|
||||
add si,40*RECLEN
|
||||
dec ds:tmpcount
|
||||
jz @@2
|
||||
jmp @@3
|
||||
@@2: ;===draw===
|
||||
mov ds:tmpcount,25
|
||||
mov si,OFFSET _xyzdata
|
||||
mov dx,ds:tmpcolor
|
||||
@@1: zzz=0
|
||||
REPT 40
|
||||
local l1
|
||||
mov cx,ds:[si+zzz+2+RECLEN] ;Y2
|
||||
mov bx,ds:[si+zzz+2] ;Y1
|
||||
sub cl,bl
|
||||
add bx,bx
|
||||
mov di,ds:rows[bx]
|
||||
|
||||
mov bx,ds:[si+zzz+0+RECLEN] ;X2
|
||||
mov ax,ds:[si+zzz+0] ;X1
|
||||
sub bl,al
|
||||
add di,ax
|
||||
|
||||
mov ds:[si+zzz+bp+0],di
|
||||
mov bh,cl
|
||||
add bx,bx
|
||||
mov cx,fs:[bx]
|
||||
mov ds:[si+zzz+bp+2],cx
|
||||
call cx
|
||||
|
||||
zzz=zzz+RECLEN
|
||||
l1: ENDM
|
||||
add si,40*RECLEN
|
||||
dec ds:tmpcount
|
||||
jz @@0
|
||||
jmp @@1
|
||||
@@0: CEND
|
||||
_asmloop1 ENDP
|
||||
|
||||
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
;include lineblit.inc ;linked
|
||||
|
||||
lineblit_init PROC NEAR
|
||||
mov es,cs:lineseg
|
||||
mov ax,cs
|
||||
mov ds,ax
|
||||
mov si,OFFSET lblt_table
|
||||
;fill with offset/rets
|
||||
mov ax,cs:[si]
|
||||
xor di,di
|
||||
mov cx,32768
|
||||
rep stosw
|
||||
;add the actual line offsets
|
||||
mov si,OFFSET lblt_table
|
||||
mov cx,MAXY-MINY+1 ;Y
|
||||
xor ebx,ebx
|
||||
mov bh,MINY
|
||||
@@2: push cx
|
||||
mov cx,MAXX-MINX+1 ;X
|
||||
mov bl,MINX
|
||||
@@1: mov ax,ds:[si]
|
||||
add si,2
|
||||
mov dx,bx
|
||||
shl bx,1
|
||||
mov es:[bx],ax
|
||||
mov bx,dx
|
||||
inc bl
|
||||
loop @@1
|
||||
pop cx
|
||||
inc bh
|
||||
loop @@2
|
||||
ret
|
||||
lineblit_init ENDP
|
||||
|
||||
lineblit PROC NEAR
|
||||
;di=x+y*320 (base)
|
||||
;bh=Y dist
|
||||
;bl=X dist
|
||||
ret
|
||||
lineblit ENDP
|
||||
|
||||
PUBLIC _line
|
||||
_line PROC FAR
|
||||
CBEG
|
||||
mov dx,[bp+8]
|
||||
mov bx,dx
|
||||
shl bx,1
|
||||
mov di,cs:rows[bx]
|
||||
mov ax,[bp+6]
|
||||
add di,ax
|
||||
neg ax
|
||||
add ax,[bp+10]
|
||||
mov bl,al
|
||||
neg dx
|
||||
add dx,[bp+12]
|
||||
mov bh,dl
|
||||
shl bx,1
|
||||
mov al,[bp+14]
|
||||
mov ah,al
|
||||
mov es,cs:vram
|
||||
mov ds,cs:lineseg
|
||||
call word ptr ds:[bx]
|
||||
CEND
|
||||
_line ENDP
|
||||
|
||||
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
code ENDS
|
||||
END
|
||||
|
||||
BIN
GRID/ASM.OBJ
Normal file
BIN
GRID/ASM.OBJ
Normal file
Binary file not shown.
254
GRID/ASM.OK
Normal file
254
GRID/ASM.OK
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
include clink.inc
|
||||
|
||||
xbufseg SEGMENT para public 'DATA'
|
||||
;high=X, low=Y => result=X*Y/256
|
||||
PUBLIC _bufdata
|
||||
_bufdata dw 32768 dup(0)
|
||||
xbufseg ENDS
|
||||
|
||||
xmulseg SEGMENT para public 'DATA'
|
||||
;high=X, low=Y => result=X*Y/256
|
||||
PUBLIC _muldata
|
||||
_muldata dw 32768 dup(0)
|
||||
xmulseg ENDS
|
||||
|
||||
xlineseg SEGMENT para public 'DATA'
|
||||
;high=X, low=Y, shl=1 => result=offset to blit routine
|
||||
PUBLIC _linedata
|
||||
_linedata dw 32768 dup(0)
|
||||
xlineseg ENDS
|
||||
|
||||
|
||||
code SEGMENT para public 'CODE'
|
||||
ASSUME cs:code
|
||||
LOCALS
|
||||
.386
|
||||
EXTRN lblt_table:word
|
||||
|
||||
rows dw 200 dup(0)
|
||||
vram dw 0a000h
|
||||
mulseg dw SEG _muldata
|
||||
lineseg dw SEG _linedata
|
||||
bufseg dw SEG _bufdata
|
||||
|
||||
PUBLIC _xyzdata
|
||||
;x,y,-,-, e1a,e1b,e1c,e1d, e2a,e2b,e2c,e2d, e3a,e3b,e3c,e3d
|
||||
_xyzdata dw 32*32 dup(4*4 dup(0))
|
||||
RECLEN equ (4*4*2)
|
||||
_plane dw 0
|
||||
drawplane dw 0101h,0202h,0404h
|
||||
drawstore dw 8,16,24
|
||||
|
||||
PUBLIC _asminit
|
||||
_asminit PROC FAR
|
||||
CBEG
|
||||
call lineblit_init
|
||||
call xyzdata_init
|
||||
call rows_init
|
||||
CEND
|
||||
_asminit ENDP
|
||||
|
||||
PUBLIC _setborder
|
||||
_setborder PROC FAR
|
||||
CBEG
|
||||
mov dx,3dah
|
||||
in al,dx
|
||||
mov dx,3c0h
|
||||
mov al,11h+32
|
||||
out dx,al
|
||||
mov al,[bp+6]
|
||||
out dx,al
|
||||
CEND
|
||||
_setborder ENDP
|
||||
|
||||
xyzdata_init PROC NEAR
|
||||
mov cx,32*32
|
||||
mov bx,OFFSET _xyzdata
|
||||
mov ax,cs:lblt_table[0]
|
||||
@@1: mov cs:[bx+8+2],ax
|
||||
mov cs:[bx+8+6],ax
|
||||
mov cs:[bx+16+2],ax
|
||||
mov cs:[bx+16+6],ax
|
||||
mov cs:[bx+24+2],ax
|
||||
mov cs:[bx+24+6],ax
|
||||
add bx,RECLEN
|
||||
loop @@1
|
||||
ret
|
||||
xyzdata_init ENDP
|
||||
|
||||
rows_init PROC NEAR
|
||||
mov cx,200
|
||||
mov bx,OFFSET rows
|
||||
mov dx,320
|
||||
xor ax,ax
|
||||
@@1: mov cs:[bx],ax
|
||||
add ax,dx
|
||||
add bx,2
|
||||
loop @@1
|
||||
ret
|
||||
rows_init ENDP
|
||||
|
||||
ALIGN 2
|
||||
tmpcolor dw 0
|
||||
tmpcount dw 0
|
||||
|
||||
PUBLIC _asmloop1
|
||||
_asmloop1 PROC FAR
|
||||
CBEG
|
||||
mov ax,cs
|
||||
mov ds,ax
|
||||
int 3
|
||||
mov bx,ds:_plane
|
||||
inc bx
|
||||
cmp bx,3
|
||||
jb @@i1
|
||||
xor bx,bx
|
||||
@@i1: mov ds:_plane,bx
|
||||
shl bx,1
|
||||
mov ax,ds:drawplane[bx]
|
||||
mov ds:tmpcolor,ax
|
||||
mov bp,ds:drawstore[bx]
|
||||
mov es,ds:vram
|
||||
mov fs,ds:lineseg
|
||||
mov gs,ds:bufseg
|
||||
xor ebx,ebx
|
||||
;===erase===
|
||||
mov ds:tmpcount,31
|
||||
mov si,OFFSET _xyzdata
|
||||
mov dx,ds:tmpcolor
|
||||
@@3: zzz=0
|
||||
REPT 31
|
||||
local l1
|
||||
mov di,ds:[si+zzz+bp+0]
|
||||
call ds:[si+zzz+bp+2]
|
||||
mov di,ds:[si+zzz+bp+4]
|
||||
call ds:[si+zzz+bp+6]
|
||||
zzz=zzz+RECLEN
|
||||
l1: ENDM
|
||||
add si,32*RECLEN
|
||||
dec ds:tmpcount
|
||||
jz @@2
|
||||
jmp @@3
|
||||
@@2: ;===draw===
|
||||
mov ds:tmpcount,31
|
||||
mov si,OFFSET _xyzdata
|
||||
mov dx,ds:tmpcolor
|
||||
@@1: zzz=0
|
||||
REPT 31
|
||||
local l1
|
||||
mov cx,ds:[si+zzz+2+RECLEN] ;Y2
|
||||
mov bx,ds:[si+zzz+2] ;Y1
|
||||
sub cx,bx
|
||||
jc l1
|
||||
shl bx,1
|
||||
mov di,ds:rows[bx]
|
||||
|
||||
mov bx,ds:[si+zzz+0+RECLEN] ;X2
|
||||
mov ax,ds:[si+zzz+0] ;X1
|
||||
sub bx,ax
|
||||
jc l1
|
||||
add di,ax
|
||||
|
||||
mov bh,cl
|
||||
mov ds:[si+zzz+bp+0],di
|
||||
shl bx,1
|
||||
mov cx,fs:[bx]
|
||||
mov ds:[si+zzz+bp+2],cx
|
||||
call dx
|
||||
|
||||
mov cx,ds:[si+zzz+2+32*RECLEN] ;Y2
|
||||
mov bx,ds:[si+zzz+2] ;Y1
|
||||
sub cx,bx
|
||||
jc l1
|
||||
shl bx,1
|
||||
mov di,ds:rows[bx]
|
||||
|
||||
mov bx,ds:[si+zzz+0+32*RECLEN] ;X2
|
||||
mov ax,ds:[si+zzz+0] ;X1
|
||||
sub bx,ax
|
||||
jc l1
|
||||
add di,ax
|
||||
|
||||
mov bh,cl
|
||||
mov ds:[si+zzz+bp+4],di
|
||||
shl bx,1
|
||||
mov cx,fs:[bx]
|
||||
mov ds:[si+zzz+bp+6],cx
|
||||
call dx
|
||||
|
||||
zzz=zzz+RECLEN
|
||||
l1: ENDM
|
||||
add si,32*RECLEN
|
||||
dec ds:tmpcount
|
||||
jz @@0
|
||||
jmp @@1
|
||||
@@0: CEND
|
||||
_asmloop1 ENDP
|
||||
|
||||
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
;include lineblit.inc ;linked
|
||||
|
||||
lineblit_init PROC NEAR
|
||||
mov es,cs:lineseg
|
||||
mov ax,cs
|
||||
mov ds,ax
|
||||
;fill with offset/rets
|
||||
mov si,OFFSET lblt_table
|
||||
mov ax,cs:[si]
|
||||
xor di,di
|
||||
mov cx,32768
|
||||
rep stosw
|
||||
;add the actual line offsets
|
||||
mov cx,12 ;Y
|
||||
xor ebx,ebx
|
||||
@@2: push cx
|
||||
mov cx,12 ;X
|
||||
xor bl,bl
|
||||
@@1: mov ax,ds:[si]
|
||||
add si,2
|
||||
mov es:[ebx*2],ax
|
||||
inc bl
|
||||
loop @@1
|
||||
pop cx
|
||||
inc bh
|
||||
loop @@2
|
||||
ret
|
||||
lineblit_init ENDP
|
||||
|
||||
lineblit PROC NEAR
|
||||
;di=x+y*320 (base)
|
||||
;bh=Y dist
|
||||
;bl=X dist
|
||||
ret
|
||||
lineblit ENDP
|
||||
|
||||
PUBLIC _line
|
||||
_line PROC FAR
|
||||
CBEG
|
||||
mov dx,[bp+8]
|
||||
mov bx,dx
|
||||
shl bx,1
|
||||
mov di,cs:rows[bx]
|
||||
mov ax,[bp+6]
|
||||
add di,ax
|
||||
neg ax
|
||||
add ax,[bp+10]
|
||||
mov bl,al
|
||||
neg dx
|
||||
add dx,[bp+12]
|
||||
mov bh,dl
|
||||
shl bx,1
|
||||
mov al,[bp+14]
|
||||
mov ah,al
|
||||
mov es,cs:vram
|
||||
mov ds,cs:lineseg
|
||||
call word ptr ds:[bx]
|
||||
CEND
|
||||
_line ENDP
|
||||
|
||||
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
code ENDS
|
||||
END
|
||||
|
||||
41
GRID/CLINK.INC
Normal file
41
GRID/CLINK.INC
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
FIXWORD MACRO ;go to word boundary
|
||||
if ($-start) mod 1
|
||||
db 0
|
||||
endif
|
||||
ENDM
|
||||
|
||||
CDS MACRO
|
||||
mov ax,cs
|
||||
mov ds,ax
|
||||
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
|
||||
|
||||
CBEG0 MACRO ;C/Assembler procedure begin, minimal
|
||||
push bp
|
||||
mov bp,sp
|
||||
ENDM
|
||||
|
||||
CEND0 MACRO ;C/Assembler procedure end, minimal
|
||||
pop bp
|
||||
ret
|
||||
ENDM
|
||||
|
||||
movpar MACRO reg,par ;loads parameter [par(0..)] to register [reg]
|
||||
mov reg,[bp+par*2+6]
|
||||
ENDM
|
||||
|
||||
119
GRID/DOLINE.BBK
Normal file
119
GRID/DOLINE.BBK
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
// create code for line blitter
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *vram=(char *)0xa0000000L;
|
||||
|
||||
FILE *out;
|
||||
|
||||
int isor;
|
||||
|
||||
void line(int x1,int y1,int x2,int y2)
|
||||
{
|
||||
int xd=x2-x1;
|
||||
int yd=y2-y1;
|
||||
int a,d,c,x,y;
|
||||
memset(vram,0,16*320);
|
||||
if(xd>yd)
|
||||
{
|
||||
d=-xd/2;
|
||||
while(x1<x2 || y1<y2)
|
||||
{
|
||||
vram[x1+y1*320]=2;
|
||||
x1++;
|
||||
d+=yd;
|
||||
if(d>0)
|
||||
{
|
||||
d-=xd;
|
||||
y1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d=-yd/2;
|
||||
while(x1<x2 || y1<y2)
|
||||
{
|
||||
vram[x1+y1*320]=2;
|
||||
y1++;
|
||||
d+=xd;
|
||||
if(d>0)
|
||||
{
|
||||
d-=yd;
|
||||
x1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//vram[x2+y2*320]=1;
|
||||
fprintf(out,"lblt_%ia%i:\n",x2,y2);
|
||||
c=0;
|
||||
for(y=0;y<16;y++) for(x=0;x<16;x++) if(vram[x+y*320])
|
||||
{
|
||||
if(c==1) fprintf(out,"lblt_%ib%i:\n",x2,y2);
|
||||
if(vram[x+y*320+1])
|
||||
{
|
||||
fprintf(out,"mov ax,gs:[di+%i]\n",x+y*320);
|
||||
if(isor) fprintf(out,"or ax,dx\n");
|
||||
else fprintf(out,"xor ax,dx\n");
|
||||
fprintf(out,"mov gs:[di+%i],ax\n",x+y*320);
|
||||
fprintf(out,"mov es:[di+%i],ax\n",x+y*320);
|
||||
vram[x+y*320]=vram[x+y*320+1]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(out,"mov al,gs:[di+%i]\n",x+y*320);
|
||||
if(isor) fprintf(out,"or al,dl\n");
|
||||
else fprintf(out,"xor al,dl\n");
|
||||
fprintf(out,"mov gs:[di+%i],al\n",x+y*320);
|
||||
fprintf(out,"mov es:[di+%i],al\n",x+y*320);
|
||||
vram[x+y*320]=0;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
if(c<=1) fprintf(out,"lblt_%ib%i:\n",x2,y2);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int x,y;
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
out=fopen("lineblit.inc","wt");
|
||||
fprintf(out,";LineBlitter core - created by doline.c\n");
|
||||
fprintf(out,"lblt_table LABEL WORD\n");
|
||||
for(isor=0;isor>=0;isor--)
|
||||
{
|
||||
for(y=0;y<12;y++)
|
||||
{
|
||||
for(x=0;x<12;x++)
|
||||
{
|
||||
fprintf(out,"dw OFFSET lblt_%i%a%i\n",x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(isor=0;isor>=0;isor--)
|
||||
{
|
||||
for(y=0;y<12;y++)
|
||||
{
|
||||
for(x=0;x<12;x++)
|
||||
{
|
||||
fprintf(out,"dw OFFSET lblt_%i%b%i\n",x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(isor=0;isor>=0;isor--)
|
||||
{
|
||||
for(y=0;y<12;y++)
|
||||
{
|
||||
for(x=0;x<12;x++)
|
||||
{
|
||||
line(0,0,x,y);
|
||||
fprintf(out,"ret\n",x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(out);
|
||||
_asm mov ax,3h
|
||||
_asm int 10h
|
||||
}
|
||||
126
GRID/DOLINE.C
Normal file
126
GRID/DOLINE.C
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
// create code for line blitter
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *vram=(char *)0xa0000000L+320*16+16;
|
||||
char *vram0=(char *)0xa0000000L;
|
||||
|
||||
FILE *out;
|
||||
|
||||
int isor;
|
||||
|
||||
void line(int x1,int y1,int x2,int y2)
|
||||
{
|
||||
int xd,xds;
|
||||
int yd,yds;
|
||||
int a,d,c,x,y;
|
||||
xd=x2-x1;
|
||||
if(xd<0)
|
||||
{
|
||||
xd=-xd;
|
||||
xds=-1;
|
||||
}
|
||||
else xds=1;
|
||||
yd=y2-y1;
|
||||
if(yd<0)
|
||||
{
|
||||
yd=-yd;
|
||||
yds=-1;
|
||||
}
|
||||
else yds=1;
|
||||
if(xd>yd)
|
||||
{
|
||||
d=-xd/2;
|
||||
while(x1!=x2 || y1!=y2)
|
||||
{
|
||||
kbhit();
|
||||
vram[x1+y1*320]=2;
|
||||
x1+=xds;
|
||||
d+=yd;
|
||||
if(d>0)
|
||||
{
|
||||
d-=xd;
|
||||
y1+=yds;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d=-yd/2;
|
||||
while(x1!=x2 || y1!=y2)
|
||||
{
|
||||
kbhit();
|
||||
vram[x1+y1*320]=2;
|
||||
y1+=yds;
|
||||
d+=xd;
|
||||
if(d>0)
|
||||
{
|
||||
d-=yd;
|
||||
x1+=xds;
|
||||
}
|
||||
}
|
||||
}
|
||||
vram[x2+y2*320]=1;
|
||||
fprintf(out,"lblt_%ib%i:\n",x2&63,y2&63);
|
||||
for(y=-16;y<16;y++) for(x=-16;x<16;x++) if(vram[x+y*320]==2)
|
||||
{
|
||||
if(vram[x+y*320+1]==2)
|
||||
{
|
||||
fprintf(out,"mov ax,gs:[di+%i]\n",x+y*320);
|
||||
fprintf(out,"xor ax,dx\n");
|
||||
fprintf(out,"mov gs:[di+%i],ax\n",x+y*320);
|
||||
fprintf(out,"mov es:[di+%i],ax\n",x+y*320);
|
||||
vram[x+y*320]=vram[x+y*320+1]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(out,"mov al,gs:[di+%i]\n",x+y*320);
|
||||
fprintf(out,"xor al,dl\n");
|
||||
fprintf(out,"mov gs:[di+%i],al\n",x+y*320);
|
||||
fprintf(out,"mov es:[di+%i],al\n",x+y*320);
|
||||
vram[x+y*320]=0;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
#define MINX 10
|
||||
#define MAXX 10
|
||||
#define MINY 8
|
||||
#define MAXY 8
|
||||
|
||||
main()
|
||||
{
|
||||
int x,y;
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
out=fopen("lineblit.inc","wt");
|
||||
fprintf(out,";LineBlitter core - created by doline.c\n");
|
||||
fprintf(out,"dw OFFSET lblt_1b0 ;only dot\n",x&63,y&63);
|
||||
fprintf(out,"lblt_table LABEL WORD\n");
|
||||
for(isor=0;isor>=0;isor--)
|
||||
{
|
||||
for(y=-MINY;y<=MAXY;y++)
|
||||
{
|
||||
for(x=-MINX;x<=MAXX;x++)
|
||||
{
|
||||
fprintf(out,"dw OFFSET lblt_%i%b%i\n",x&63,y&63);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(isor=0;isor>=0;isor--)
|
||||
{
|
||||
for(y=-MINY;y<=MAXY;y++)
|
||||
{
|
||||
for(x=-MINX;x<=MAXX;x++)
|
||||
{
|
||||
line(0,0,x,y);
|
||||
fprintf(out,"ret\n",x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(out);
|
||||
_asm mov ax,3h
|
||||
_asm int 10h
|
||||
}
|
||||
BIN
GRID/DOLINE.EXE
Normal file
BIN
GRID/DOLINE.EXE
Normal file
Binary file not shown.
BIN
GRID/DOLINE.OBJ
Normal file
BIN
GRID/DOLINE.OBJ
Normal file
Binary file not shown.
105
GRID/DOLINE.OK
Normal file
105
GRID/DOLINE.OK
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
// create code for line blitter
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *vram=(char *)0xa0000000L;
|
||||
|
||||
FILE *out;
|
||||
|
||||
int isor;
|
||||
|
||||
void line(int x1,int y1,int x2,int y2)
|
||||
{
|
||||
int xd=x2-x1;
|
||||
int yd=y2-y1;
|
||||
int a,d,x,y;
|
||||
memset(vram,0,16*320);
|
||||
if(xd>yd)
|
||||
{
|
||||
d=-xd/2;
|
||||
while(x1<x2 || y1<y2)
|
||||
{
|
||||
vram[x1+y1*320]=2;
|
||||
x1++;
|
||||
d+=yd;
|
||||
if(d>0)
|
||||
{
|
||||
d-=xd;
|
||||
y1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d=-yd/2;
|
||||
while(x1<x2 || y1<y2)
|
||||
{
|
||||
vram[x1+y1*320]=2;
|
||||
y1++;
|
||||
d+=xd;
|
||||
if(d>0)
|
||||
{
|
||||
d-=yd;
|
||||
x1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//vram[x2+y2*320]=1;
|
||||
for(y=0;y<16;y++) for(x=0;x<16;x++) if(vram[x+y*320])
|
||||
{
|
||||
if(vram[x+y*320+1])
|
||||
{
|
||||
fprintf(out,"mov ax,gs:[di+%i]\n",x+y*320);
|
||||
if(isor) fprintf(out,"or ax,dx\n");
|
||||
else fprintf(out,"xor ax,dx\n");
|
||||
fprintf(out,"mov gs:[di+%i],ax\n",x+y*320);
|
||||
fprintf(out,"mov es:[di+%i],ax\n",x+y*320);
|
||||
vram[x+y*320]=vram[x+y*320+1]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(out,"mov al,gs:[di+%i]\n",x+y*320);
|
||||
if(isor) fprintf(out,"or al,dl\n");
|
||||
else fprintf(out,"xor al,dl\n");
|
||||
fprintf(out,"mov gs:[di+%i],al\n",x+y*320);
|
||||
fprintf(out,"mov es:[di+%i],al\n",x+y*320);
|
||||
vram[x+y*320]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int x,y;
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
out=fopen("lineblit.inc","wt");
|
||||
fprintf(out,";LineBlitter core - created by doline.c\n");
|
||||
fprintf(out,"lblt_table LABEL WORD\n");
|
||||
for(isor=0;isor>=0;isor--)
|
||||
{
|
||||
for(y=0;y<12;y++)
|
||||
{
|
||||
for(x=0;x<12;x++)
|
||||
{
|
||||
fprintf(out,"dw OFFSET lblt_%i%c%i\n",x,isor?'o':'a',y);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(isor=0;isor>=0;isor--)
|
||||
{
|
||||
for(y=0;y<12;y++)
|
||||
{
|
||||
for(x=0;x<12;x++)
|
||||
{
|
||||
fprintf(out,"lblt_%i%c%i:\n",x,isor?'o':'a',y);
|
||||
line(0,0,x,y);
|
||||
fprintf(out,"ret\n",x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(out);
|
||||
_asm mov ax,3h
|
||||
_asm int 10h
|
||||
}
|
||||
BIN
GRID/EYE4.UH
Normal file
BIN
GRID/EYE4.UH
Normal file
Binary file not shown.
11
GRID/LINEBLIT.ASM
Normal file
11
GRID/LINEBLIT.ASM
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
code SEGMENT para public 'CODE'
|
||||
ASSUME cs:code
|
||||
LOCALS
|
||||
.386
|
||||
|
||||
PUBLIC lblt_table
|
||||
include lineblit.inc
|
||||
|
||||
code ENDS
|
||||
END
|
||||
|
||||
8146
GRID/LINEBLIT.INC
Normal file
8146
GRID/LINEBLIT.INC
Normal file
File diff suppressed because it is too large
Load diff
BIN
GRID/LINEBLIT.OBJ
Normal file
BIN
GRID/LINEBLIT.OBJ
Normal file
Binary file not shown.
2
GRID/LINK.TMP
Normal file
2
GRID/LINK.TMP
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
main.obj asm.obj lineblit.obj +
|
||||
_eye.obk ..\dis\disc.obj,p.exe,nul;
|
||||
184
GRID/MAIN.C
Normal file
184
GRID/MAIN.C
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "..\dis\dis.h"
|
||||
|
||||
char pal[3][768];
|
||||
|
||||
#define RECLEN (4*4)
|
||||
extern int plane;
|
||||
extern char muldata[];
|
||||
extern int xyzdata[];
|
||||
/**/
|
||||
extern void setpalette(char *);
|
||||
extern void asminit(void);
|
||||
extern void asmloop1(void);
|
||||
extern void setborder(int);
|
||||
extern char bufdata[];
|
||||
|
||||
unsigned char far *vram0=(char far *)0xa0000000L;
|
||||
|
||||
extern char eye[];
|
||||
|
||||
int sin256[256];
|
||||
int sin1[1024];
|
||||
int sinus1[1024];
|
||||
int sinus2[1024];
|
||||
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
FILE *f1;
|
||||
char *cp;
|
||||
int a,b,c,d,cx,cy,sip=0,j,k;
|
||||
int x,y,x1,y1,x2,y2;
|
||||
int scale=50,scalea=-1;
|
||||
unsigned u;
|
||||
double f;
|
||||
for(a=0;a<256;a++)
|
||||
{
|
||||
f=(double)a*3.141592653589*2.0/256.0;
|
||||
f=sin(f)*64;
|
||||
sin256[a]=(int)f;
|
||||
}
|
||||
for(a=0;a<1024;a++)
|
||||
{
|
||||
f=(double)a*3.141592653589*2.0/1024.0;
|
||||
f=sin(f)*256;
|
||||
sin1[a]=(int)f;
|
||||
}
|
||||
|
||||
b=c=0;
|
||||
for(a=0;a<1024;a++)
|
||||
{
|
||||
b+=97;
|
||||
c+=87;
|
||||
d+=67;
|
||||
sinus1[a]=(sin1[(b>>3)&1023]+sin1[(c>>3)&1023]*2+sin1[(d>>3)&1023])/8;
|
||||
}
|
||||
for(a=0;a<1024;a++)
|
||||
{
|
||||
sinus2[a]=sinus1[(a+277)&1023]*7/10;
|
||||
}
|
||||
|
||||
dis_partstart();
|
||||
{
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
}
|
||||
|
||||
#if 0
|
||||
memset(vram0,8,64000);
|
||||
while(dis_muscode(2)!=2 && !dis_exit());
|
||||
for(x=319;x>=0;x--)
|
||||
{
|
||||
vram0[x+100*320]=0;
|
||||
if(!(x&15)) dis_waitb();
|
||||
}
|
||||
y1=100; a=100*64; b=0;
|
||||
while(y1<200)
|
||||
{
|
||||
b+=8;
|
||||
a+=b;
|
||||
y2=a/64;
|
||||
if(y2>200) y2=200;
|
||||
for(y=y1;y<y2;y++)
|
||||
{
|
||||
memset(vram0+y*320,0,320);
|
||||
}
|
||||
y1=y2;
|
||||
dis_waitb();
|
||||
}
|
||||
for(a=0;a<35 && !dis_exit();a++) dis_waitb();
|
||||
#endif
|
||||
|
||||
outp(0x3c8,0);
|
||||
for(y=0;y<3;y++)
|
||||
{
|
||||
for(x=0;x<256;x++)
|
||||
{
|
||||
c=eye[16+(x>>3)*3+0]/4;
|
||||
b=eye[16+(x>>3)*3+1]/4;
|
||||
a=eye[16+(x>>3)*3+2]/4;
|
||||
if(y==0)
|
||||
{
|
||||
if(x&1) c+=40;
|
||||
if(x&4) c+=20;
|
||||
if(x&2) c+=10;
|
||||
}
|
||||
else if(y==1)
|
||||
{
|
||||
if(x&2) c+=40;
|
||||
if(x&1) c+=20;
|
||||
if(x&4) c+=10;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(x&4) c+=40;
|
||||
if(x&2) c+=20;
|
||||
if(x&1) c+=10;
|
||||
}
|
||||
if(c>63) c=63;
|
||||
pal[y][x*3+0]=c;
|
||||
pal[y][x*3+1]=b;
|
||||
pal[y][x*3+2]=a;
|
||||
}
|
||||
}
|
||||
//for(x=0;x<256;x++) vram0[x]=x;
|
||||
|
||||
asminit();
|
||||
cp=muldata;
|
||||
for(x=0;x<256;x++) for(y=0;y<256;y++)
|
||||
{
|
||||
_asm mov al,x
|
||||
_asm mul byte ptr y
|
||||
_asm mov al,ah
|
||||
_asm xor ah,ah
|
||||
_asm mov a,ax
|
||||
*(cp++)=a;
|
||||
}
|
||||
|
||||
for(u=784;u<64684;u++) eye[u]<<=3;
|
||||
memcpy(bufdata,eye+784,64000);
|
||||
|
||||
for(x=0;x<1024;x++)
|
||||
{
|
||||
u=x*RECLEN;
|
||||
xyzdata[u+0]=sinus1[x]+160;
|
||||
xyzdata[u+1]=sinus2[x]+100;
|
||||
vram0[xyzdata[u+0]+xyzdata[u+1]*320]=15;
|
||||
xyzdata[u+2]=0;
|
||||
xyzdata[u+3]=0;
|
||||
}
|
||||
getch();
|
||||
|
||||
//while(dis_muscode(2)!=2 && !dis_exit());
|
||||
memcpy(vram0,eye+768+16,64000);
|
||||
j=k=0;
|
||||
while(!dis_exit())
|
||||
{
|
||||
if(dis_muscode(3)==3) break;
|
||||
c=j;
|
||||
d=sin1[k&1023]/4+256;
|
||||
d=0;
|
||||
j++;
|
||||
k++;
|
||||
for(u=0;u<1001*RECLEN;u+=RECLEN)
|
||||
{
|
||||
xyzdata[u+0]=sinus1[(c)&1023]+160;
|
||||
xyzdata[u+1]=sinus2[(d)&1023]+100;
|
||||
c++; d++;
|
||||
}
|
||||
asmloop1();
|
||||
setborder(0);
|
||||
dis_waitb();
|
||||
setborder(1);
|
||||
setpalette(pal[plane]);
|
||||
}
|
||||
|
||||
if(!dis_indemo())
|
||||
{
|
||||
_asm mov ax,3h
|
||||
_asm int 10h
|
||||
}
|
||||
}
|
||||
18
GRID/MAIN.CUT
Normal file
18
GRID/MAIN.CUT
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
if(y==0)
|
||||
{
|
||||
if(x&1) c=63;
|
||||
else if(x&4) c=31;
|
||||
else if(x&2) c=15;
|
||||
}
|
||||
else if(y==1)
|
||||
{
|
||||
if(x&2) c=63;
|
||||
else if(x&1) c=31;
|
||||
else if(x&4) c=15;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(x&4) c=63;
|
||||
else if(x&2) c=31;
|
||||
else if(x&1) c=15;
|
||||
}
|
||||
BIN
GRID/MAIN.OBJ
Normal file
BIN
GRID/MAIN.OBJ
Normal file
Binary file not shown.
110
GRID/MAIN.OK
Normal file
110
GRID/MAIN.OK
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "..\dis\dis.h"
|
||||
|
||||
#define RECLEN (4*4)
|
||||
extern char muldata[];
|
||||
extern int xyzdata[];
|
||||
/**/
|
||||
extern void asminit(void);
|
||||
extern void asmloop1(void);
|
||||
extern void setborder(int);
|
||||
|
||||
unsigned char far *vram0=(char far *)0xa0000000L;
|
||||
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
FILE *f1;
|
||||
char *cp;
|
||||
int a,b,c;
|
||||
int x,y,x1,y1,x2,y2;
|
||||
int scale=50,scalea=-1;
|
||||
int plane=1;
|
||||
unsigned u;
|
||||
|
||||
dis_partstart();
|
||||
if(!dis_indemo())
|
||||
{
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
}
|
||||
|
||||
#if 0
|
||||
memset(vram0,8,64000);
|
||||
while(dis_muscode(1)!=1 && !dis_exit());
|
||||
for(x=319;x>=0;x--)
|
||||
{
|
||||
vram0[x+100*320]=0;
|
||||
if(!(x&15)) dis_waitb();
|
||||
}
|
||||
y1=100; a=100*64; b=0;
|
||||
while(y1<200)
|
||||
{
|
||||
b+=8;
|
||||
a+=b;
|
||||
y2=a/64;
|
||||
if(y2>200) y2=200;
|
||||
for(y=y1;y<y2;y++)
|
||||
{
|
||||
memset(vram0+y*320,0,320);
|
||||
}
|
||||
y1=y2;
|
||||
dis_waitb();
|
||||
}
|
||||
for(a=0;a<35 && !dis_exit();a++) dis_waitb();
|
||||
#endif
|
||||
|
||||
outp(0x3c8,0);
|
||||
for(x=0;x<256;x++)
|
||||
{
|
||||
a=b=c=0;
|
||||
if(x&4) c=63;
|
||||
if(x&2) c=32;
|
||||
if(x&1) c=16;
|
||||
outp(0x3c9,a);
|
||||
outp(0x3c9,b);
|
||||
outp(0x3c9,c);
|
||||
vram0[x]=x;
|
||||
}
|
||||
|
||||
asminit();
|
||||
cp=muldata;
|
||||
for(x=0;x<256;x++) for(y=0;y<256;y++)
|
||||
{
|
||||
_asm mov al,x
|
||||
_asm mul byte ptr y
|
||||
_asm mov al,ah
|
||||
_asm xor ah,ah
|
||||
_asm mov a,ax
|
||||
*(cp++)=a;
|
||||
}
|
||||
|
||||
while(!dis_exit())
|
||||
{
|
||||
for(y=0;y<32;y++)
|
||||
{
|
||||
for(x=0;x<32;x++)
|
||||
{
|
||||
u=(x+y*32)*RECLEN;
|
||||
xyzdata[u+0]=((x-16)*8)*scale/50+160;
|
||||
xyzdata[u+1]=((y-16)*6)*scale/50+100;
|
||||
}
|
||||
}
|
||||
scale+=scalea;
|
||||
if(scale>50) scalea=-scalea;
|
||||
if(scale<30) scalea=-scalea;
|
||||
setborder(3);
|
||||
asmloop1(plane);
|
||||
plane<<=1; if(plane>15) plane=1;
|
||||
setborder(0);
|
||||
if(getch()==27) break;
|
||||
dis_waitb();
|
||||
setborder(1);
|
||||
}
|
||||
|
||||
if(!dis_indemo())
|
||||
{
|
||||
_asm mov ax,3h
|
||||
_asm int 10h
|
||||
}
|
||||
}
|
||||
23
GRID/MAKEFILE
Normal file
23
GRID/MAKEFILE
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
all : p.exe
|
||||
|
||||
objs=main.obj asm.obj lineblit.obj
|
||||
|
||||
odata=_eye.obk
|
||||
|
||||
lineblit.asm : lineblit.inc
|
||||
|
||||
################################################################
|
||||
|
||||
asm_f = /ML /m2 /s /JJUMPS
|
||||
c_f = /AL /c /G2
|
||||
|
||||
.asm.obj :
|
||||
tasm $(asm_f) $<
|
||||
|
||||
.c.obj :
|
||||
cl /qc $(c_f) $<
|
||||
|
||||
p.exe : $(objs)
|
||||
@echo $(objs) + > link.tmp
|
||||
@echo $(odata) ..\dis\disc.obj,p.exe,nul; >> link.tmp
|
||||
link /E @link.tmp
|
||||
BIN
GRID/OUT.3D
Normal file
BIN
GRID/OUT.3D
Normal file
Binary file not shown.
BIN
GRID/P.EXE
Normal file
BIN
GRID/P.EXE
Normal file
Binary file not shown.
BIN
GRID/P.OLD
Normal file
BIN
GRID/P.OLD
Normal file
Binary file not shown.
6
GRID/TMP
Normal file
6
GRID/TMP
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
xbufseg SEGMENT para public 'DATA'
|
||||
;high=X, low=Y => result=X*Y/256
|
||||
PUBLIC _bufdata
|
||||
_bufdata dw 32768 dup(0)
|
||||
xbufseg ENDS
|
||||
|
||||
BIN
GRID/_EYE.OBK
Normal file
BIN
GRID/_EYE.OBK
Normal file
Binary file not shown.
Loading…
Reference in a new issue