First release of ZSNES sources

This commit is contained in:
teuf
2001-04-02 22:30:58 +00:00
commit 1fe183be02
138 changed files with 186213 additions and 0 deletions

289
zsnes/src/video/2xsai.cpp Normal file
View File

@@ -0,0 +1,289 @@
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later
//version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//#define MMX
#define uint32 unsigned long
#define uint16 unsigned short
#define uint8 unsigned char
static uint32 colorMask = 0xF7DEF7DE;
static uint32 lowPixelMask = 0x08210821;
static uint32 qcolorMask = 0xE79CE79C;
static uint32 qlowpixelMask = 0x18631863;
static uint32 redblueMask = 0xF81F;
static uint32 greenMask = 0x7E0;
extern "C" void Init_2xSaI(uint32 BitFormat)
{
if (BitFormat == 565)
{
colorMask = 0xF7DEF7DE;
lowPixelMask = 0x08210821;
qcolorMask = 0xE79CE79C;
qlowpixelMask = 0x18631863;
redblueMask = 0xF81F;
greenMask = 0x7E0;
}
else
if (BitFormat == 555)
{
colorMask = 0x7BDE7BDE;
lowPixelMask = 0x04210421;
qcolorMask = 0x739C739C;
qlowpixelMask = 0x0C630C63;
redblueMask = 0x7C1F;
greenMask = 0x3E0;
}
else
{
return;
}
#ifdef MMX
Init_2xSaIMMX(BitFormat);
#endif
return;
}
static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r+=1;
if (y <= 1) r-=1;
return r;
}
static inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r-=1;
if (y <= 1) r+=1;
return r;
}
static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r+=1;
if (y <= 1) r-=1;
return r;
}
static inline uint32 INTERPOLATE(uint32 A, uint32 B)
{
if (A !=B)
{
return ( ((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask) );
}
else return A;
}
static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
{
register uint32 x = ((A & qcolorMask) >> 2) +
((B & qcolorMask) >> 2) +
((C & qcolorMask) >> 2) +
((D & qcolorMask) >> 2);
register uint32 y = (A & qlowpixelMask) +
(B & qlowpixelMask) +
(C & qlowpixelMask) +
(D & qlowpixelMask);
y = (y>>2) & qlowpixelMask;
return x+y;
}
#define BLUE_MASK565 0x001F001F
#define RED_MASK565 0xF800F800
#define GREEN_MASK565 0x07E007E0
#define BLUE_MASK555 0x001F001F
#define RED_MASK555 0x7C007C00
#define GREEN_MASK555 0x03E003E0
//srcPtr equ 8
//deltaPtr equ 12
//srcPitch equ 16
//width equ 20
//dstOffset equ 24
//dstPitch equ 28
//dstSegment equ 32
extern "C" void Super2xSaI(uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch,
int width, uint8 *dstPtr , uint32 dstPitch)
{
uint16 *dP;
uint16 *bP;
uint32 inc_bP;
int height = 1;
uint32 dPitch = dstPitch >> 1;
uint32 Nextline = srcPitch >> 1;
{
inc_bP = 1;
// for (height; height; height-=1)
{
bP = (uint16 *) srcPtr;
dP = (uint16 *) dstPtr;
for (uint32 finish = width; finish; finish -= inc_bP )
{
uint32 color4, color5, color6;
uint32 color1, color2, color3;
uint32 colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3,
colorS1, colorS2;
uint32 product1a, product1b,
product2a, product2b;
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
colorB0 = *(bP- Nextline - 1);
colorB1 = *(bP- Nextline);
colorB2 = *(bP- Nextline + 1);
colorB3 = *(bP- Nextline + 2);
color4 = *(bP - 1);
color5 = *(bP);
color6 = *(bP + 1);
colorS2 = *(bP + 2);
color1 = *(bP + Nextline - 1);
color2 = *(bP + Nextline);
color3 = *(bP + Nextline + 1);
colorS1 = *(bP + Nextline + 2);
colorA0 = *(bP + Nextline + Nextline - 1);
colorA1 = *(bP + Nextline + Nextline);
colorA2 = *(bP + Nextline + Nextline + 1);
colorA3 = *(bP + Nextline + Nextline + 2);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else
if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else
if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GetResult (color6, color5, color1, colorA1);
r += GetResult (color6, color5, color4, colorB1);
r += GetResult (color6, color5, colorA2, colorS1);
r += GetResult (color6, color5, colorB2, colorS2);
if (r > 0)
product2b = product1b = color6;
else
if (r < 0)
product2b = product1b = color5;
else
{
product2b = product1b = INTERPOLATE (color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
product2b = Q_INTERPOLATE (color3, color3, color3, color2);
else
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
product2b = Q_INTERPOLATE (color2, color2, color2, color3);
else
product2b = INTERPOLATE (color2, color3);
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
product1b = Q_INTERPOLATE (color6, color6, color6, color5);
else
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
product1b = Q_INTERPOLATE (color6, color5, color5, color5);
else
product1b = INTERPOLATE (color5, color6);
}
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
product2a = INTERPOLATE (color2, color5);
else
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
product2a = INTERPOLATE(color2, color5);
else
product2a = color2;
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
product1a = INTERPOLATE (color2, color5);
else
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
product1a = INTERPOLATE(color2, color5);
else
product1a = color5;
product1a = product1a | (product1b << 16);
product2a = product2a | (product2b << 16);
*dP = product1a;
*(dP + 1) = product1b;
*(dP + dPitch) = product2a;
*(dP + dPitch + 1) = product2b;
bP ++;
dP += 2;
}//end of for ( finish= width etc..)
srcPtr += srcPitch;
deltaPtr += srcPitch << 1;
}; //endof: for (height; height; height--)
}
}


1358
zsnes/src/video/2xsaimmx.inc Normal file

File diff suppressed because it is too large Load Diff

1345
zsnes/src/video/2xsaiw.asm Normal file

File diff suppressed because it is too large Load Diff

1375
zsnes/src/video/2xsaiw.inc Normal file

File diff suppressed because it is too large Load Diff

5698
zsnes/src/video/copyvid.inc Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,994 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
EXTSYM coladdr,curmosaicsz,curvidoffset,domosaic16b,mode7A,drawmode7dcolor
EXTSYM mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,mode7tab
EXTSYM pal16b,pal16bcl,pal16bxcl,scaddtype,scrnon,transpbuf
EXTSYM vesa2_clbit,vram,vrama,winon,xtravbuf,winptrref,scaddset
EXTSYM fulladdtab
EXTSYM cwinptr
;*******************************************************
; Processes & Draws Mode 7
;*******************************************************
%macro mode7halfadd 0
mov [esi+288*2],dl
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
mov ecx,[ebp]
mov ebx,[pal16bcl+edx*4]
cmp cx,0
je %%noadd
and ebx,[vesa2_clbit]
and ecx,[vesa2_clbit]
add ebx,ecx
shr ebx,1
%%noadd
mov [esi],bx
xor ecx,ecx
%%nodraw
%endmacro
%macro mode7fulladd 0
mov [esi+288*2],dl
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
mov ecx,[ebp]
mov ebx,[pal16bcl+edx*4]
and ecx,[vesa2_clbit]
add ebx,ecx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
mov [esi],bx
%%nodraw
%endmacro
%macro mode7fullsub 0
mov [esi+288*2],dl
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
mov ecx,[ebp]
mov ebx,[pal16bxcl+edx*4]
and ecx,[vesa2_clbit]
add ebx,ecx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
xor ebx,0FFFFh
mov [esi],bx
%%nodraw
%endmacro
%macro mode7mainsub 0
mov [esi+288*2],dl
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
mov ecx,[pal16b+edx*4]
mov [esi],cx
mov [ebp],cx
%%nodraw
%endmacro
%macro mode7halfaddwinon 0
mov [esi+288*2],dl
mov eax,[cwinptr]
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
test byte[eax],0FFh
jnz %%nodraw
mov ecx,[ebp]
mov ebx,[pal16bcl+edx*4]
cmp cx,0
je %%noadd
and ebx,[vesa2_clbit]
and ecx,[vesa2_clbit]
add ebx,ecx
shr ebx,1
%%noadd
mov [esi],bx
xor ecx,ecx
%%nodraw
inc dword[cwinptr]
%endmacro
%macro mode7fulladdwinon 0
mov [esi+288*2],dl
mov eax,[cwinptr]
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
test byte[eax],0FFh
jnz %%nodraw
mov ecx,[ebp]
mov ebx,[pal16bcl+edx*4]
and ecx,[vesa2_clbit]
add ebx,ecx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
mov [esi],bx
%%nodraw
inc dword[cwinptr]
%endmacro
%macro mode7fullsubwinon 0
mov [esi+288*2],dl
mov eax,[cwinptr]
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
test byte[eax],0FFh
jnz %%nodraw
mov ecx,[ebp]
mov ebx,[pal16bxcl+edx*4]
and ecx,[vesa2_clbit]
add ebx,ecx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
xor ebx,0FFFFh
mov [esi],bx
%%nodraw
inc dword[cwinptr]
%endmacro
%macro mode7mainsubwinon 0
mov [esi+288*2],dl
mov eax,[cwinptr]
test dl,80h
jnz %%nodraw
or dl,dl
jz %%nodraw
test byte[eax],0FFh
jnz %%nodraw
mov ecx,[pal16b+edx*4]
mov [esi],cx
mov [ebp],cx
%%nodraw
inc dword[cwinptr]
%endmacro
%macro mode716tmacro 1
; mode 7, ax = curyposition, dx = curxposition (left side)
; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen
; center map coordinates = (X0,Y0)
; 1.) cx=X0-bg1scrolx, cy =Y0-ax
mov bx,[mode7X0]
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonega
or bx,1110000000000000b
.nonega
mov [.cxloc],bx
mov bx,dx
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonegb
or bx,1110000000000000b
.nonegb
sub [.cxloc],bx
mov bx,ax
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonegc
or bx,1110000000000000b
.nonegc
mov [.cyloc],bx
mov bx,[mode7Y0]
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonegd
or bx,1110000000000000b
.nonegd
sub word[.cyloc],bx
; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D)
movsx ebx,word[.cyloc]
movsx eax,word[mode7C]
imul eax,ebx
neg eax
mov [.mode7xpos],eax
mov bx,word[mode7X0]
add [.mode7xpos+1],bx
movsx ebx,word[.cyloc]
movsx eax,word[mode7D]
imul eax,ebx
; neg ax
mov [.mode7ypos],eax
mov bx,word[mode7Y0]
add [.mode7ypos+1],bx
; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B)
movsx ebx,word[.cxloc]
movsx eax,word[mode7A]
mov [.mode7xadder],eax
imul eax,ebx
neg eax
add [.mode7xpos],eax
movsx ebx,word[.cxloc]
movsx eax,word[mode7B]
mov [.mode7yadder],eax
imul eax,ebx
add [.mode7ypos],eax
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov edi,[vram]
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+32
mov ecx,128
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+32
.nomosaic
mov ebp,transpbuf+32
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
mov byte[.temp],0
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
test byte[mode7set],80h
jnz near .norep2
mov eax,[.mode7xpos]
and eax,7FFh
mov [.mode7xrpos],eax
mov eax,[.mode7ypos]
and eax,7FFh
mov [.mode7yrpos],eax
; get tile data offset into edi
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
shl ebx,5
shr eax,3
and ebx,07FF8h
shl al,1
mov bl,al
mov edi,[vram]
xor ch,ch
mov [.mode7ptr],ebx
mov cl,[edi+ebx]
shl ecx,7
add edi,ecx
.nextval
test byte[.mode7xrpos+1],08h
jnz near .rposoffx
.nextposx
test byte[.mode7yrpos+1],08h
jnz near .rposoffy
.nextposy
mov cl,[.mode7yrpos+1]
mov eax,[.mode7xadder]
mov ch,[.mode7xrpos+1]
add [.mode7xrpos],eax
mov dl,[mode7tab+ecx]
mov eax,[.mode7yadder]
mov dl,[edi+edx]
sub [.mode7yrpos],eax
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .nextval
jmp .finishmode7
.rposoffx
mov al,[.mode7xinc]
mov edi,[vram]
add [.mode7ptr],al
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7xadd2]
shl ecx,7
sub [.mode7xrpos],eax
add edi,ecx
jmp .nextposx
.rposoffy
mov al,[.mode7yinc]
mov edi,[vram]
sub [.mode7ptr+1],al
and byte[.mode7ptr+1],7Fh
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7yadd2]
shl ecx,7
add [.mode7yrpos],eax
add edi,ecx
jmp .nextposy
.finishmode7
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
;**********************************************************
; Mode 7, no repetition mode
;**********************************************************
.norep2
test byte[mode7set],40h
jnz .tilerep2
.nextvalb2
cmp byte[.mode7ypos+2],3
ja .offscr2
cmp byte[.mode7xpos+2],3
jbe near .offscr3
.offscr2
mov eax,[.mode7xadder]
mov ebx,[.mode7yadder]
add [.mode7xpos],eax
sub [.mode7ypos],ebx
add esi,2
add ebp,2
dec byte[.temp]
jnz near .nextvalb2
jmp .finishmode7
.tilerep2
.nextvalb3
cmp byte[.mode7ypos+2],3
ja .offscr2b
cmp byte[.mode7xpos+2],3
jbe near .offscr3
.offscr2b
mov ch,[.mode7xpos+1]
mov eax,[.mode7xadder]
mov cl,[.mode7ypos+1]
mov ebx,[.mode7yadder]
mov dl,[mode7tab+ecx]
add [.mode7xpos],eax
mov dl,[vrama+edx]
sub [.mode7ypos],ebx
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .nextvalb3
jmp .finishmode7
.offscr3
mov eax,[.mode7xpos]
and eax,7FFh
mov [.mode7xrpos],eax
mov eax,[.mode7ypos]
and eax,7FFh
mov [.mode7yrpos],eax
; get tile data offset into edi
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
shl ebx,5
shr eax,3
and ebx,07FF8h
shl al,1
mov bl,al
mov edi,[vram]
xor ch,ch
mov [.mode7ptr],ebx
mov cl,[edi+ebx]
shl ecx,7
add edi,ecx
.nextvalr
test byte[.mode7xrpos+1],08h
jnz near .rposoffxr
.nextposxr
test byte[.mode7yrpos+1],08h
jnz near .rposoffyr
.nextposyr
mov cl,[.mode7yrpos+1]
mov eax,[.mode7xadder]
mov ch,[.mode7xrpos+1]
add [.mode7xrpos],eax
mov dl,[mode7tab+ecx]
mov eax,[.mode7yadder]
mov dl,[edi+edx]
sub [.mode7yrpos],eax
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .nextvalr
jmp .finishmode7
.rposoffxr
mov al,[.mode7xinc]
mov edi,[vram]
add [.mode7ptr],al
jz .roff
cmp byte[.mode7ptr],0FEh
je .roff
.roffxretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7xadd2]
shl ecx,7
sub [.mode7xrpos],eax
add edi,ecx
jmp .nextposxr
.rposoffyr
mov al,[.mode7yinc]
mov edi,[vram]
sub [.mode7ptr+1],al
js .roff
.roffyretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7yadd2]
shl ecx,7
add [.mode7yrpos],eax
add edi,ecx
jmp .nextposyr
.roff
test byte[mode7set],40h
jnz .tilerep3
jmp .finishmode7
.tilerep3
and byte[.mode7yrpos+1],07h
and byte[.mode7xrpos+1],07h
mov cl,[.mode7yrpos+1]
mov eax,[.mode7xadder]
mov ch,[.mode7xrpos+1]
add [.mode7xrpos],eax
mov dl,[mode7tab+ecx]
mov eax,[.mode7yadder]
mov dl,[vrama+edx]
sub [.mode7yrpos],eax
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .tilerep3
jmp .finishmode7
;**********************************************************
; Mode 7, old routines
;**********************************************************
.nextval3
test byte[mode7set],80h
jnz near .norep
.nextval2
; get tile # @ ([.mode7xpos],[.mode7ypos])
; get tile location in vram (tileloc=x*2+y*256)
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
mov cl,bl
mov ch,al
shl ebx,5
shr eax,3
mov dl,[mode7tab+ecx]
and ebx,07FF8h
shl al,1
mov bl,al
xor ch,ch
mov cl,[edi+ebx]
mov eax,[.mode7xadder]
shl ecx,7
add [.mode7xpos],eax
add ecx,edx
mov eax,[.mode7yadder]
mov dl,[edi+ecx]
sub [.mode7ypos],eax
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .nextval2
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
; Color repetition
.norep
test byte[mode7set],40h
jnz near .tilerep
.nextvalb
; get tile # @ ([.mode7xpos],[.mode7ypos])
; get tile location in vram (tileloc=x*2+y*256)
cmp byte[.mode7ypos+2],3
ja near .offscr
cmp byte[.mode7xpos+2],3
ja near .offscr
.offscrb
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
mov cl,bl
mov ch,al
shl ebx,5
shr eax,3
mov dl,[mode7tab+ecx]
and ebx,07FF8h
shl al,1
mov bl,al
xor ch,ch
mov cl,[edi+ebx]
mov eax,[.mode7xadder]
shl ecx,7
add [.mode7xpos],eax
add ecx,edx
mov eax,[.mode7yadder]
mov dl,[edi+ecx]
sub [.mode7ypos],eax
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .nextvalb
jmp .goon
.offscrc
cmp byte[.mode7ypos+2],3
ja .offscr
cmp byte[.mode7xpos+2],3
jbe near .offscrb
.offscr
mov eax,[.mode7xadder]
mov ebx,[.mode7yadder]
add [.mode7xpos],eax
sub [.mode7ypos],ebx
add esi,2
add ebp,2
dec byte[.temp]
jnz .offscrc
.goon
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
.tilerep
.nextvalbtr
; get tile # @ ([.mode7xpos],[.mode7ypos])
; get tile location in vram (tileloc=x*2+y*256)
cmp byte[.mode7ypos+2],3
ja near .offscrtr
cmp byte[.mode7xpos+2],3
ja near .offscrtr
.offscrtrb
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
mov cl,bl
mov ch,al
shl ebx,5
shr eax,3
mov dl,[mode7tab+ecx]
and ebx,07FF8h
shl al,1
mov bl,al
xor ch,ch
mov cl,[edi+ebx]
mov eax,[.mode7xadder]
shl ecx,7
add [.mode7xpos],eax
add ecx,edx
mov eax,[.mode7yadder]
mov dl,[edi+ecx]
sub [.mode7ypos],eax
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .nextvalbtr
jmp .goon
.offscrtrc
cmp byte[.mode7ypos+2],3
ja .offscrtr
cmp byte[.mode7xpos+2],3
jbe near .offscrtrb
.offscrtr
mov ch,[.mode7xpos+1]
mov eax,[.mode7xadder]
mov cl,[.mode7ypos+1]
mov ebx,[.mode7yadder]
mov dl,[mode7tab+ecx]
add [.mode7xpos],eax
mov dl,[vrama+edx]
sub [.mode7ypos],ebx
%1
add esi,2
add ebp,2
dec byte[.temp]
jnz near .offscrtrc
jmp .goon
ALIGN32
.temp dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dd 0 ; cx location
.cyloc dd 0 ; cy location
%endmacro
;*******************************************************
; Processes & Draws Mode 7 half Addition
;*******************************************************
NEWSYM drawmode716textbg
; test byte[scaddset],1
; jnz near drawmode7dcolor
mov esi,[cwinptr]
mov [winptrref],esi
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near drawmode716twinonextbg
.domosaic
test byte[scaddtype],80h
jnz near drawmode716tsubextbg
test byte[scaddtype],40h
jz near drawmode716tfulladdextbg
cmp byte[scrnon+1],0
je near drawmode716tfulladdextbg
cmp dword[coladdr],0
jnz near drawmode716tfulladdextbg
mode716tmacro mode7halfadd
;*******************************************************
; Processes & Draws Mode 7 Full Addition
;*******************************************************
NEWSYM drawmode716tfulladdextbg
mode716tmacro mode7fulladd
;**********************************************************
; Processes and draws Mode 7 subtract
;**********************************************************
drawmode716tsubextbg:
mode716tmacro mode7fullsub
;**********************************************************
; Mode 7, main & sub mode
;**********************************************************
NEWSYM drawmode716tbextbg
mode716tmacro mode7mainsub
;*******************************************************
; Processes & Draws Mode 7 half Addition, Window on
;*******************************************************
NEWSYM drawmode716twinonextbg
test byte[scaddtype],80h
jnz near drawmode716tsubwinonextbg
test byte[scaddtype],40h
jz near drawmode716tfulladdwinonextbg
cmp byte[scrnon+1],0
je near drawmode716tfulladdwinonextbg
cmp dword[coladdr],0
jnz near drawmode716tfulladdwinonextbg
mode716tmacro mode7halfaddwinon
;*******************************************************
; Processes & Draws Mode 7 Full Addition, Window on
;*******************************************************
NEWSYM drawmode716tfulladdwinonextbg
mode716tmacro mode7fulladdwinon
;**********************************************************
; Processes and draws Mode 7 subtract, Window on
;**********************************************************
NEWSYM drawmode716tsubwinonextbg
mode716tmacro mode7fullsubwinon
;**********************************************************
; Mode 7, main & sub mode, Window on
;**********************************************************
NEWSYM drawmode716tbwinonextbg
mode716tmacro mode7mainsubwinon
NEWSYM drawmode716textbg2
mov esi,[cwinptr]
mov [winptrref],esi
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov edi,[vram]
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+32
mov ecx,128
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+32
.nomosaic
mov edi,transpbuf+32
test byte[scaddtype],80h
jnz near extbg2sub
test byte[scaddtype],40h
jz near extbg2add
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near .drawwin
.domosaic
mov ecx,256
xor eax,eax
.loop
mov al,[esi+288*2]
test al,80h
jz .nopr2
and al,7Fh
mov edx,[edi]
mov ebx,[pal16bcl+eax*4]
cmp dx,0
je .noadd
and ebx,[vesa2_clbit]
and edx,[vesa2_clbit]
add ebx,edx
shr ebx,1
.noadd
mov [esi],bx
.nopr2
add esi,2
add edi,2
loop .loop
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
.drawwin
mov ebp,[cwinptr]
mov byte[esi],cl
.nodrawbw
mov ecx,256
xor eax,eax
.loop2
mov al,[esi+288*2]
test byte[ebp],0FFh
jnz .nopr2b
test al,80h
jz .nopr2b
and al,7Fh
mov edx,[edi]
mov ebx,[pal16bcl+eax*4]
cmp dx,0
je .noadd2
and ebx,[vesa2_clbit]
and edx,[vesa2_clbit]
add ebx,edx
shr ebx,1
.noadd2
mov [esi],bx
.nopr2b
add esi,2
add edi,2
inc ebp
loop .loop2
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
extbg2add:
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near .drawwin
.domosaic
mov ecx,256
xor eax,eax
.loop
mov al,[esi+288*2]
test al,80h
jz .nopr2
and al,7Fh
mov edx,[edi]
mov ebx,[pal16bcl+eax*4]
and edx,[vesa2_clbit]
add ebx,edx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
mov [esi],bx
.nopr2
add esi,2
add edi,2
loop .loop
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
.drawwin
mov ebp,[cwinptr]
mov byte[esi],cl
.nodrawbw
mov ecx,256
xor eax,eax
.loop2
mov al,[esi+288*2]
test byte[ebp],0FFh
jnz .nopr2b
test al,80h
jz .nopr2b
and al,7Fh
mov edx,[edi]
mov ebx,[pal16bcl+eax*4]
and edx,[vesa2_clbit]
add ebx,edx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
mov [esi],bx
.nopr2b
add esi,2
add edi,2
inc ebp
loop .loop2
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
extbg2sub:
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near .drawwin
.domosaic
mov ecx,256
xor eax,eax
.loop
mov al,[esi+288*2]
test al,80h
jz .nopr2
and al,7Fh
mov edx,[edi]
mov ebx,[pal16bxcl+eax*4]
and edx,[vesa2_clbit]
add ebx,edx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
xor ebx,0FFFFh
mov [esi],bx
.nopr2
add esi,2
add edi,2
loop .loop
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret
.drawwin
mov ebp,[cwinptr]
mov byte[esi],cl
.nodrawbw
mov ecx,256
xor eax,eax
.loop2
mov al,[esi+288*2]
test byte[ebp],0FFh
jnz .nopr2b
test al,80h
jz .nopr2b
and al,7Fh
mov edx,[edi]
mov ebx,[pal16bxcl+eax*4]
and edx,[vesa2_clbit]
add ebx,edx
shr ebx,1
mov ebx,[fulladdtab+ebx*2]
xor ebx,0FFFFh
mov [esi],bx
.nopr2b
add esi,2
add edi,2
inc ebp
loop .loop2
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near domosaic16b
ret


3085
zsnes/src/video/makev16b.asm Normal file

File diff suppressed because it is too large Load Diff

5313
zsnes/src/video/makev16t.asm Normal file

File diff suppressed because it is too large Load Diff

4386
zsnes/src/video/makevid.asm Normal file

File diff suppressed because it is too large Load Diff

818
zsnes/src/video/mode7.asm Normal file
View File

@@ -0,0 +1,818 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
EXTSYM mode7tab,winptrref,nglogicval,winlogicaval
EXTSYM curmosaicsz,curvidoffset,cwinptr,domosaic,mode7A,mode7B
EXTSYM mode7C,mode7D,mode7X0,mode7Y0,mode7set,vram,vrama,winon,xtravbuf
EXTSYM ngwinen, winbg1enval, BuildWindow, ngwintable, ngcwinptr, domosaicng
EXTSYM pesimpng
EXTSYM mode7hr
EXTSYM BGMA, mode7ab, mode7cd, BG1SYl, BG1SXl, mosenng, mosszng
%include "video/mode7.mac"
;*******************************************************
; Processes & Draws Mode 7
;*******************************************************
%macro Mode7Normal 0
or dl,dl
jz %%nodrawb
mov byte[esi],dl
%%nodrawb
inc esi
%endmacro
%macro Mode7Window 0
or dl,dl
jz %%nodrawbw
test byte[ebp],0FFh
jnz %%nodrawbw
mov byte[esi],dl
%%nodrawbw
inc esi
inc ebp
%endmacro
NEWSYM Makemode7Table
xor eax,eax
.nextentry
mov cl,al
mov dl,ah
and cl,07h
and dl,07h
shl cl,4
shl dl,1
inc dl
add dl,cl
mov [mode7tab+eax],dl
dec ax
jnz .nextentry
ret
;mode7tab times 65536 db 0
; backup mode7X0, mode7Y0, Mode7A, and Mode7B
NEWSYM drawmode7
mov esi,[cwinptr]
mov [winptrref],esi
Mode7Calculate
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+16
mov ecx,64
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+16
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near .drawmode7win
.domosaic
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Process Mode7Normal, domosaic, 1
.nextval3
Mode7ProcessB Mode7Normal, domosaic, 1
ALIGN32
.temp dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
.drawmode7win
.domosaicw
mov ebp,[cwinptr]
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3w
cmp dword[.mode7xadder],-7F0h
jl near .nextval3w
cmp dword[.mode7yadder],7F0h
jg near .nextval3w
cmp dword[.mode7yadder],-7F0h
jl near .nextval3w
Mode7Process Mode7Window, domosaic, 1
.nextval3w
Mode7ProcessB Mode7Window, domosaic, 1
NEWSYM drawmode7win
cmp byte[mode7hr+ebx],1
je near drawmode7winhr
ProcessBuildWindow 0
.nohr
mov esi,[cwinptr]
mov [winptrref],esi
Mode7Calculate
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov [pesimpng],esi
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+16
mov ecx,64
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+16
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
cmp byte[ngwinen],1
je near .drawmode7win
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Process Mode7Normal, domosaicng, 1
.nextval3
Mode7ProcessB Mode7Normal, domosaicng, 1
ALIGN32
.temp dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
.drawmode7win
.domosaicw
mov ebx,[.mode7xrpos]
mov [mode7xrpos],ebx
mov ebx,[.mode7yrpos]
mov [mode7yrpos],ebx
mov ebx,[.mode7xadder]
mov [mode7xadder],ebx
mov ebx,[.mode7yadder]
mov [mode7yadder],ebx
mov ebx,[.mode7xpos]
mov [mode7xpos],ebx
mov ebx,[.mode7ypos]
mov [mode7ypos],ebx
mov edi,[vram]
Mode7Processngw Mode7Normal, domosaicng, 1
NEWSYM drawmode7winB
cmp byte[mode7hr+ebx],1
je near drawmode7winBhr
ProcessBuildWindow 0
.nohr
mov esi,[cwinptr]
mov [winptrref],esi
Mode7CalculateB
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+16
mov ecx,64
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+16
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
cmp byte[ngwinen],1
je near .drawmode7win
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Process Mode7Normal, domosaic, 1
.nextval3
Mode7ProcessB Mode7Normal, domosaic, 1
ALIGN32
.temp dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
.drawmode7win
.domosaicw
mov ebx,[.mode7xrpos]
mov [mode7xrpos],ebx
mov ebx,[.mode7yrpos]
mov [mode7yrpos],ebx
mov ebx,[.mode7xpos]
mov [mode7xpos],ebx
mov ebx,[.mode7ypos]
mov [mode7ypos],ebx
mov ebx,[.mode7xadder]
mov [mode7xadder],ebx
mov ebx,[.mode7yadder]
mov [mode7yadder],ebx
mov edi,[vram]
Mode7Processngw Mode7Normal, domosaic, 1
NEWSYM drawmode7winhr
ProcessBuildWindow 0
cmp byte[ngwinen],1
jne .notwinen
mov byte[mode7hr+ebx],0
jmp drawmode7win.nohr
.notwinen
mov esi,[cwinptr]
mov [winptrref],esi
Mode7Calculate
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov [pesimpng],esi
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+16
mov ecx,64
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+16
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
sar dword[.mode7xadder],1
sar dword[.mode7yadder],1
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Processhr Mode7Normal, domosaicng, 1
.nextval3
Mode7ProcessBhr Mode7Normal, domosaicng, 1
ALIGN32
.temp dd 0 ; for byte move left
.temp2 dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
NEWSYM drawmode7winBhr
ProcessBuildWindow 0
cmp byte[ngwinen],1
jne .notwinen
mov byte[mode7hr+ebx],0
jmp drawmode7winB.nohr
.notwinen
mov esi,[cwinptr]
mov [winptrref],esi
Mode7CalculateB
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+16
mov ecx,64
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+16
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
sar dword[.mode7xadder],1
sar dword[.mode7yadder],1
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Processhr Mode7Normal, domosaic, 1
.nextval3
Mode7ProcessBhr Mode7Normal, domosaic, 1
ALIGN32
.temp dd 0 ; for byte move left
.temp2 dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
ALIGN32
NEWSYM ngwleft, dd 0 ; for byte move left
NEWSYM ngwleftb, dd 0 ; for byte move left
NEWSYM mode7xpos, dd 0,0 ; x position
NEWSYM mode7ypos, dd 0,0 ; x position
NEWSYM mode7xrpos, dd 0,0 ; x position, relative
NEWSYM mode7yrpos, dd 0,0 ; y position, relative
NEWSYM mode7xadder, dd 0,0 ; number to add for x
NEWSYM mode7yadder, dd 0,0 ; number to add for y
NEWSYM ProcessMode7ngwin
mov ecx,[ngcwinptr]
mov ecx,[ecx]
or ecx,ecx
jz near .winb
cmp ecx,[ngwleft]
jae .alldisplay
sub [ngwleft],ecx
mov dword[ngwleftb],ecx
xor ecx,ecx
mov eax,[mode7xrpos]
ret
.alldisplay
mov ecx,[ngwleft]
mov dword[ngwleftb],ecx
mov dword[ngwleft],0
xor ecx,ecx
mov eax,[mode7xrpos]
ret
.winb
NEWSYM ProcessMode7ngwinB
add dword[ngcwinptr],4
mov ecx,[ngcwinptr]
mov ecx,[ecx]
cmp ecx,[ngwleft]
jae near .finishmode7
sub [ngwleft],ecx
or ecx,ecx
jz .noclip
.nextvalngw
mov eax,[mode7xadder]
add [mode7xrpos],eax
mov eax,[mode7yadder]
sub [mode7yrpos],eax
inc esi
dec ecx
jnz near .nextvalngw
.noclip
add dword[ngcwinptr],4
jmp ProcessMode7ngwin
.finishmode7
mov dword[ngwleft],0
mov dword[ngwleftb],0
ret
NEWSYM ProcessMode7ngwinC
mov ecx,[ngcwinptr]
mov ecx,[ecx]
or ecx,ecx
jz near .winb
cmp ecx,[ngwleft]
jae .alldisplay
sub [ngwleft],ecx
mov dword[ngwleftb],ecx
xor ecx,ecx
mov eax,[mode7xpos]
ret
.alldisplay
mov ecx,[ngwleft]
mov dword[ngwleftb],ecx
mov dword[ngwleft],0
xor ecx,ecx
mov eax,[mode7xpos]
ret
.winb
NEWSYM ProcessMode7ngwinD
add dword[ngcwinptr],4
mov ecx,[ngcwinptr]
mov ecx,[ecx]
cmp ecx,[ngwleft]
jae near .finishmode7
sub [ngwleft],ecx
or ecx,ecx
jz .noclip
.nextvalngw
mov eax,[mode7xadder]
add [mode7xpos],eax
mov eax,[mode7yadder]
sub [mode7ypos],eax
inc esi
dec ecx
jnz near .nextvalngw
.noclip
add dword[ngcwinptr],4
jmp ProcessMode7ngwin
.finishmode7
mov dword[ngwleft],0
mov dword[ngwleftb],0
ret
%macro newvaluepred 2
mov dx,word[%1+ebx*4+8]
cmp dx,word[%1+ebx*4]
je %%nodivide
cmp byte[BGMA+ebx+2],7
je %%mode7scaleb
%%nodivide
movsx edx,word[%1+ebx*4+4]
movsx ecx,word[%1+ebx*4]
add ecx,edx
sar ecx,1
mov [%2],cx
jmp %%mode7scalend
%%mode7scaleb
mov esi,ebx
movsx ebx,word[%1+esi*4+8]
movsx edx,word[%1+esi*4]
sub ebx,edx
movsx ecx,word[%1+esi*4+4]
sub ecx,edx
mov eax,ecx
imul ecx
idiv ebx
add ax,word[%1+esi*4]
mov ebx,esi
mov [%2],ax
%%mode7scalend
%endmacro
NEWSYM processmode7hires
cmp byte[BGMA+ebx+1],7
jne near .nogo
push esi
push ebx
; predict new values
push eax
push edx
push ebx
push esi
newvaluepred mode7ab,mode7A
newvaluepred mode7ab+2,mode7B
newvaluepred mode7cd,mode7C
newvaluepred mode7cd+2,mode7D
pop esi
pop ebx
pop edx
pop eax
mov ecx,edx
xor edx,edx
mov dx,[BG1SXl+ebx*2+2]
add edx,ecx
shr edx,1
mov ecx,eax
mov eax,ebx
inc eax
test byte[mode7set],02h
jz .noflip
mov eax,261
sub eax,ebx
.noflip
add ax,[BG1SYl+ebx*2+2]
add eax,ecx
add esi,75036
mov [curvidoffset],esi
call drawmode7winB
pop ebx
pop esi
.nogo
ret


1563
zsnes/src/video/mode7.mac Normal file

File diff suppressed because it is too large Load Diff

687
zsnes/src/video/mode716.asm Normal file
View File

@@ -0,0 +1,687 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
EXTSYM mode7tab,winptrref,nglogicval,winlogicaval
EXTSYM curmosaicsz,curvidoffset,cwinptr,domosaic,mode7A,mode7B
EXTSYM mode7C,mode7D,mode7X0,mode7Y0,mode7set,vram,vrama,winon,xtravbuf
EXTSYM ngwleft,ngwleftb,mode7xpos,mode7ypos,mode7xrpos,mode7yrpos
EXTSYM mode7xadder,mode7yadder,mode7hr,drawmode7winhr,dcolortab
EXTSYM UnusedBitXor,UnusedBit
EXTSYM scrndis
EXTSYM vidbright,prevbrightdc,Gendcolortable
EXTSYM mode7ab,mode7cd,BGMA
EXTSYM BG1SXl,BG1SYl
EXTSYM processmode7hires
%include "video/mode716.mac"
;*******************************************************
; Processes & Draws Mode 7
;*******************************************************
%macro Mode7Normal 0
or dl,dl
jz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Normalnt 0
or dl,dl
jz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Normalt 0
or dl,dl
jz %%nodrawb
mov dx,[ebp+edx*2+512]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Normalmsnt 0
or dl,dl
jz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi],dx
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Normalmst 0
or dl,dl
jz %%nodrawb
mov dx,[ebp+edx*2+512]
mov [esi],dx
and dx,[UnusedBitXor]
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Normalsnt 0
or dl,dl
jz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Normalst 0
or dl,dl
jz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Direct 0
or dl,dl
jz %%nodrawb
mov dx,[dcolortab+edx*4]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Directnt 0
or dl,dl
jz %%nodrawb
mov dx,[dcolortab+edx*4]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Directt 0
or dl,dl
jz %%nodrawb
mov dx,[dcolortab+edx*4]
or dx,[UnusedBit]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Directmsnt 0
or dl,dl
jz %%nodrawb
mov dx,[dcolortab+edx*4]
mov [esi],dx
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Directmst 0
or dl,dl
jz %%nodrawb
mov dx,[dcolortab+edx*4]
mov [esi+75036*2],dx
or dx,[UnusedBit]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Directsnt 0
or dl,dl
jz %%nodrawb
mov dx,[dcolortab+edx*4]
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Directst 0
or dl,dl
jz %%nodrawb
mov dx,[dcolortab+edx*4]
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7ExtBG 0
mov [esi+75036*8],dl
or dl,dl
jz %%nodrawb
test dl,80h
jnz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7ExtBGnt 0
mov [esi+75036*8],dl
or dl,dl
jz %%nodrawb
test dl,80h
jnz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7ExtBGt 0
mov [esi+75036*8],dl
or dl,dl
jz %%nodrawb
test dl,80h
jnz %%nodrawb
mov dx,[ebp+edx*2+512]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7ExtBGmsnt 0
mov [esi+75036*8],dl
or dl,dl
jz %%nodrawb
test dl,80h
jnz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi],dx
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7ExtBGmst 0
mov [esi+75036*8],dl
or dl,dl
jz %%nodrawb
test dl,80h
jnz %%nodrawb
mov dx,[ebp+edx*2+512]
mov [esi+75036*2],dx
or dx,[UnusedBit]
mov [esi],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7ExtBGsnt 0
mov [esi+75036*8],dl
or dl,dl
jz %%nodrawb
test dl,80h
jnz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
%macro Mode7ExtBGst 0
mov [esi+75036*8],dl
or dl,dl
jz %%nodrawb
test dl,80h
jnz %%nodrawb
mov dx,[ebp+edx*2]
mov [esi+75036*2],dx
xor edx,edx
%%nodrawb
add esi,2
%endmacro
NEWSYM drawmode7win16b
test byte[scrndis],1
jz .notdisabled
ret
.notdisabled
CheckTransparency 01h,drawmode7win16bt
normal
Mode7NonMainSub Mode7Normal
drawmode7win16bt
test byte[scadtng+ebx],1h
jz near drawmode7win16bnt
test byte[BGMS1+ebx*2+1],1h
jnz near drawmode716bmst
Mode7NonMainSub Mode7Normalt
drawmode716bmst:
mov edi,[CMainWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmt
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bst
drawmode7w16bmst
Mode7NonMainSub Mode7Normalmst
drawmode7w16bmt
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmst
Mode7MainSub Mode7Normalmst,Mode7Normalst
drawmode7w16bst
Mode7MainSub Mode7Normalmst,Mode7Normalt
drawmode7win16bnt:
test byte[BGMS1+ebx*2+1],1h
jnz near drawsprngm716bmsnt
Mode7NonMainSub Mode7Normalnt
drawsprngm716bmsnt:
cmp dword[ngwinen],0
je drawmode7w16bmsnt
mov edi,[CMainWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmnt
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bsnt
drawmode7w16bmsnt
Mode7NonMainSub Mode7Normalmsnt
drawmode7w16bmnt
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmsnt
Mode7MainSub Mode7Normalmsnt,Mode7Normalsnt
drawmode7w16bsnt
Mode7MainSub Mode7Normalmsnt,Mode7Normalnt
NEWSYM drawmode7win16bd
test byte[scrndis],1
jz .notdisabled
ret
.notdisabled
mov bl,[vidbright]
cmp bl,[prevbrightdc]
je .nodcchange
mov [prevbrightdc],bl
call Gendcolortable
.nodcchange
CheckTransparency 01h,drawmode7win16btd
Mode7NonMainSub Mode7Direct
drawmode7win16btd
test byte[scadtng+ebx],1h
jz near drawmode7win16bntd
test byte[BGMS1+ebx*2+1],1h
jnz near drawmode716bmstd
Mode7NonMainSub Mode7Directt
drawmode716bmstd:
mov edi,[CMainWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmtd
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bstd
drawmode7w16bmstd
Mode7NonMainSub Mode7Directmst
drawmode7w16bmtd
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmstd
Mode7MainSub Mode7Directmst,Mode7Directst
drawmode7w16bstd
Mode7MainSub Mode7Directmst,Mode7Directt
drawmode7win16bntd:
test byte[BGMS1+ebx*2+1],1h
jnz near drawsprngm716bmsntd
Mode7NonMainSub Mode7Directnt
drawsprngm716bmsntd:
cmp dword[ngwinen],0
je drawmode7w16bmsntd
mov edi,[CMainWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmntd
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bsntd
drawmode7w16bmsntd
Mode7NonMainSub Mode7Directmsnt
drawmode7w16bmntd
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmsntd
Mode7MainSub Mode7Directmsnt,Mode7Directsnt
drawmode7w16bsntd
Mode7MainSub Mode7Directmsnt,Mode7Directnt
NEWSYM drawmode7ngextbg16b
test byte[scrndis],1
jz .notdisabled
ret
.notdisabled
mov byte[curmosaicsz],1
push ecx
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov ecx,256
.loop
mov byte[esi+75036*8],0
add esi,2
loop .loop
pop ecx
cmp byte[mode7hr+ebx],1
; je near drawmode7winextbghr16e
CheckTransparency 02h,drawmode7win16bte
mov esi,[cwinptr]
mov [winptrref],esi
mov esi,[curvidoffset]
Mode7NonMainSube Mode7ExtBG
drawmode7win16bte
test byte[scadtng+ebx],1h
jz near drawmode7win16bnte
test byte[BGMS1+ebx*2+1],1h
jnz near drawmode716bmste
Mode7NonMainSube Mode7ExtBGt
drawmode716bmste:
mov edi,[CMainWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmte
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bste
drawmode7w16bmste
Mode7NonMainSube Mode7ExtBGmst
drawmode7w16bmte
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmste
Mode7MainSube Mode7ExtBGmst,Mode7ExtBGst
drawmode7w16bste
Mode7MainSube Mode7ExtBGmst,Mode7ExtBGt
drawmode7win16bnte:
test byte[BGMS1+ebx*2+1],1h
jnz near drawsprngm716bmsnte
Mode7NonMainSube Mode7ExtBGnt
drawsprngm716bmsnte:
cmp dword[ngwinen],0
je drawmode7w16bmsnte
mov edi,[CMainWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmnte
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bsnte
drawmode7w16bmsnte
Mode7NonMainSube Mode7ExtBGmsnt
drawmode7w16bmnte
mov edi,[CSubWinScr]
cmp byte[edi+ebx],0
jne near drawmode7w16bmsnte
Mode7MainSube Mode7ExtBGmsnt,Mode7ExtBGsnt
drawmode7w16bsnte
Mode7MainSube Mode7ExtBGmsnt,Mode7ExtBGnt
%macro ExtBG2 1
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov ecx,256
xor eax,eax
.loop
mov al,[esi+75036*8]
test al,80h
jz .nopr2
and al,7Fh
%1
.nopr2
add esi,2
loop .loop
xor eax,eax
ret
%endmacro
%macro ExtBGNormal 0
mov dx,[ebp+eax*2]
mov [esi],dx
%endmacro
%macro ExtBGNormalt 0
mov dx,[ebp+eax*2+512]
mov [esi],dx
%endmacro
%macro ExtBGNormalnt 0
mov dx,[ebp+eax*2]
mov [esi],dx
%endmacro
%macro ExtBGNormalst 0
mov dx,[ebp+eax*2]
mov [esi+75036*2],dx
%endmacro
%macro ExtBGNormalsnt 0
mov dx,[ebp+eax*2]
mov [esi+75036*2],dx
%endmacro
%macro ExtBGNormalmst 0
mov dx,[ebp+eax*2+512]
mov [esi],dx
and dx,[UnusedBitXor]
mov [esi+75036*2],dx
%endmacro
%macro ExtBGNormalmsnt 0
mov dx,[ebp+eax*2]
mov [esi],dx
mov [esi+75036*2],dx
%endmacro
NEWSYM drawmode7ngextbg216b
test byte[scrndis],1
jz .notdisabled
ret
.notdisabled
cmp byte[mode7hr+ebx],1
; je near drawmode7winextbg2hr16b
; esi = pointer to video buffer
CheckTransparency 01h,drawmode7ngextbg216bt
test byte[FillSubScr+ebx],1
jz .main
test byte[BGMS1+ebx*2],01h
jnz .main
add esi,75036*2
.main
ExtBG2 ExtBGNormal
drawmode7ngextbg216bt:
test byte[scadtng+ebx],1h
jz near drawmode7ngextbg216bnt
test byte[BGMS1+ebx*2+1],1h
jnz near drawmode7ngextbg216bmst
ExtBG2 ExtBGNormalt
drawmode7ngextbg216bmst
test byte[BGMS1+ebx*2],1h
jz near drawmode7ngextbg216bst
ExtBG2 ExtBGNormalmst
drawmode7ngextbg216bst:
ExtBG2 ExtBGNormalst
drawmode7ngextbg216bnt:
test byte[BGMS1+ebx*2+1],1h
jnz near drawmode7ngextbg216bmsnt
ExtBG2 ExtBGNormalnt
drawmode7ngextbg216bmsnt
test byte[BGMS1+ebx*2],1h
jz near drawmode7ngextbg216bsnt
ExtBG2 ExtBGNormalmsnt
drawmode7ngextbg216bsnt:
ExtBG2 ExtBGNormalsnt
ALIGN32
mtemp dd 0 ; for byte move left
mmode7xpos dd 0 ; x position
mtempa2 dd 0 ; keep this blank!
mmode7xrpos dd 0 ; x position
mtempa dd 0 ; keep this blank!
mmode7ypos dd 0 ; y position
mtempb2 dd 0 ; keep this blank!
mmode7yrpos dd 0 ; y position
mtempb dd 0 ; keep this blank!
mmode7xadder dd 0 ; number to add for x
mtempc2 dd 0 ; keep this blank!
mmode7xadd2 dd 0 ; number to add for x
mtempc dd 0 ; keep this blank!
mmode7yadder dd 0 ; number to add for y
mtempd2 dd 0 ; keep this blank!
mmode7yadd2 dd 0 ; number to add for y
mtempd dd 0 ; keep this blank!
mmode7ptr dd 0 ; pointer value
mmode7xinc dd 0 ; number to add for x
mmode7xincc dd 0 ; range check for x
mmode7yinc dd 0 ; number to add for y
mmode7xsloc dd 0 ; which screen x
mmode7ysloc dd 0 ; which screen y
mmode7xsrl dd 0 ; which relative screen x
mmode7ysrl dd 0 ; which relative screen y
mcxloc dw 0 ; cx location
mcyloc dw 0 ; cy location
M7HROn dd 0 ; High Resolution On
switchtorep3 dd 0
m7xaddof dd 0
m7xaddof2 dd 0
m7yaddof dd 0
m7yaddof2 dd 0
pixelsleft dd 0
mm7xaddof dd 0
mm7xaddof2 dd 0
mm7yaddof dd 0
mm7yaddof2 dd 0
%macro newvaluepred 2
mov dx,word[%1+ebx*4+8]
cmp dx,word[%1+ebx*4]
je %%nodivide
cmp byte[BGMA+ebx+2],7
je %%mode7scaleb
%%nodivide
movsx edx,word[%1+ebx*4+4]
movsx ecx,word[%1+ebx*4]
add ecx,edx
sar ecx,1
mov [%2],cx
jmp %%mode7scalend
%%mode7scaleb
mov esi,ebx
movsx ebx,word[%1+esi*4+8]
movsx edx,word[%1+esi*4]
sub ebx,edx
movsx ecx,word[%1+esi*4+4]
sub ecx,edx
mov eax,ecx
imul ecx
idiv ebx
add ax,word[%1+esi*4]
mov ebx,esi
mov [%2],ax
%%mode7scalend
%endmacro
CalculateNewValues:
; predict new values
push eax
push edx
push ebx
push esi
newvaluepred mode7ab,mode7A
newvaluepred mode7ab+2,mode7B
newvaluepred mode7cd,mode7C
newvaluepred mode7cd+2,mode7D
pop esi
pop ebx
pop edx
pop eax
mov ecx,edx
xor edx,edx
mov dx,[BG1SXl+ebx*2+2]
add edx,ecx
shr edx,1
mov ecx,eax
mov eax,ebx
inc eax
test byte[mode7set],02h
jz .noflip
mov eax,261
sub eax,ebx
.noflip
add ax,[BG1SYl+ebx*2+2]
add eax,ecx
ret
NEWSYM processmode7hires16b
cmp byte[BGMA+ebx+1],7
jne near .nogo
push esi
push ebx
call CalculateNewValues
add esi,75036*4
mov [curvidoffset],esi
mov dword[M7HROn],1
call drawmode7win16b
mov dword[M7HROn],0
pop ebx
pop esi
.nogo
ret
NEWSYM processmode7hires16bd
cmp byte[BGMA+ebx+1],7
jne near .nogo
push esi
push ebx
call CalculateNewValues
add esi,75036*4
mov [curvidoffset],esi
mov dword[M7HROn],1
call drawmode7win16bd
mov dword[M7HROn],0
pop ebx
pop esi
.nogo
ret


1904
zsnes/src/video/mode716.mac Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,189 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,scaddset
EXTSYM mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set
EXTSYM pal16b,vram,vrama,winon,mode7tab,xtravbuf,drawmode7dcolor
EXTSYM cwinptr
%include "video/mode7.mac"
;*******************************************************
; Processes & Draws Mode 7
;*******************************************************
ALIGN16
%macro Mode7Normal 0
or dl,dl
jz %%nodrawb
mov ecx,[pal16b+edx*4]
mov [esi],cx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Window 0
or dl,dl
jz %%nodrawbw
test byte[ebp],0FFh
jnz %%nodrawbw
mov ecx,[pal16b+edx*4]
mov [esi],cx
%%nodrawbw
add esi,2
inc ebp
%endmacro
NEWSYM drawmode716b
test byte[scaddset],1
jnz near drawmode7dcolor
mov esi,[cwinptr]
mov [winptrref],esi
Mode7Calculate
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov edi,[vram]
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+32
mov ecx,128
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+32
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near .drawmode7win
.domosaic
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Process Mode7Normal, domosaic16b, 2
.nextval3
Mode7ProcessB Mode7Normal, domosaic16b, 2
ALIGN32
.temp dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
.drawmode7win
.domosaicw
mov ebp,[cwinptr]
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3w
cmp dword[.mode7xadder],-7F0h
jl near .nextval3w
cmp dword[.mode7yadder],7F0h
jg near .nextval3w
cmp dword[.mode7yadder],-7F0h
jl near .nextval3w
Mode7Process Mode7Window, domosaic16b, 2
.nextval3w
Mode7ProcessB Mode7Window, domosaic16b, 2


View File

@@ -0,0 +1,233 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,scaddset
EXTSYM mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,cwinptr
EXTSYM pal16b,vram,vrama,winon,mode7tab,xtravbuf,dcolortab,vidbright
%include "video/mode7.mac"
NEWSYM Gendcolortable
; generate Direct Color Table
push eax
push edx
xor ecx,ecx
.loopdct
mov al,cl
and eax,00000111b
mov bl,[vidbright]
mul bl
mov bl,15
div bl
xor ah,ah
shl eax,13
mov edx,eax
mov al,cl
and eax,00111000b
shr eax,3
mov bl,[vidbright]
mul bl
mov bl,15
div bl
xor ah,ah
shl eax,8
or edx,eax
mov al,cl
and eax,11000000b
shr eax,6
mov bl,[vidbright]
mul bl
mov bl,15
div bl
xor ah,ah
shl eax,3
or edx,eax
and edx,0FFFFh
mov [dcolortab+ecx*4],edx
inc cl
jnz .loopdct
pop edx
pop eax
ret
%macro Mode7Normal 0
or dl,dl
jz %%nodrawb
mov ecx,[dcolortab+edx*4]
mov [esi],cx
%%nodrawb
add esi,2
%endmacro
%macro Mode7Window 0
or dl,dl
jz %%nodrawbw
test byte[ebp],0FFh
jnz %%nodrawbw
mov ecx,[dcolortab+edx*4]
mov [esi],cx
%%nodrawbw
add esi,2
inc ebp
%endmacro
;*******************************************************
; Processes & Draws Mode 7
;*******************************************************
NEWSYM prevbrightdc, db 0
NEWSYM drawmode7dcolor
mov bl,[vidbright]
cmp bl,[prevbrightdc]
je .nodcchange
mov [prevbrightdc],bl
call Gendcolortable
.nodcchange
mov esi,[cwinptr]
mov [winptrref],esi
Mode7Calculate
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov edi,[vram]
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+32
mov ecx,128
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+32
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near .drawmode7win
.domosaic
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Process Mode7Normal, domosaic16b, 2
.nextval3
Mode7ProcessB Mode7Normal, domosaic16b, 2
ALIGN32
.temp dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
.drawmode7win
.domosaicw
mov ebp,[cwinptr]
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3w
cmp dword[.mode7xadder],-7F0h
jl near .nextval3w
cmp dword[.mode7yadder],7F0h
jg near .nextval3w
cmp dword[.mode7yadder],-7F0h
jl near .nextval3w
Mode7Process Mode7Window, domosaic16b, 2
.nextval3w
Mode7ProcessB Mode7Window, domosaic16b, 2


1261
zsnes/src/video/mode716e.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,364 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
EXTSYM cwinptr
EXTSYM coladdr,curmosaicsz,curvidoffset,domosaic16b,mode7A,drawmode7dcolor
EXTSYM mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,mode7tab,DoTransp
EXTSYM pal16b,pal16bcl,pal16bxcl,scaddtype,scrnon,transpbuf,drawmode716b
EXTSYM vesa2_clbit,vram,vrama,winon,xtravbuf,winptrref,scaddset
EXTSYM fulladdtab
%include "video/mode7.mac"
;*******************************************************
; Processes & Draws Mode 7
;*******************************************************
%macro mode7halfadd 0
or dl,dl
jz %%nodraw
mov ecx,[ebp]
mov edx,[pal16bcl+edx*4]
or cx,cx
jz %%noadd
and edx,[vesa2_clbit]
and ecx,[vesa2_clbit]
add edx,ecx
shr edx,1
%%noadd
mov [esi],dx
xor ecx,ecx
xor edx,edx
%%nodraw
add esi,2
add ebp,2
%endmacro
%macro mode7fulladd 0
or dl,dl
jz %%nodraw
mov ecx,[ebp]
mov edx,[pal16bcl+edx*4]
and ecx,[vesa2_clbit]
add edx,ecx
shr edx,1
mov edx,[fulladdtab+edx*2]
mov [esi],dx
xor edx,edx
%%nodraw
add esi,2
add ebp,2
%endmacro
%macro mode7fullsub 0
or dl,dl
jz %%nodraw
mov ecx,[ebp]
mov edx,[pal16bxcl+edx*4]
and ecx,[vesa2_clbit]
add edx,ecx
shr edx,1
mov edx,[fulladdtab+edx*2]
xor edx,0FFFFh
mov [esi],dx
xor edx,edx
%%nodraw
add esi,2
add ebp,2
%endmacro
%macro mode7mainsub 0
or dl,dl
jz %%nodraw
mov ecx,[pal16b+edx*4]
mov [esi],cx
mov [ebp],cx
%%nodraw
add esi,2
add ebp,2
%endmacro
%macro mode7halfaddwinon 0
mov ecx,[cwinptr2]
or dl,dl
jz %%nodraw
test byte[ecx],0FFh
jnz %%nodraw
mov ecx,[ebp]
mov edx,[pal16bcl+edx*4]
or cx,cx
je %%noadd
and edx,[vesa2_clbit]
and ecx,[vesa2_clbit]
add edx,ecx
shr edx,1
%%noadd
mov [esi],dx
xor edx,edx
%%nodraw
xor ecx,ecx
inc dword[cwinptr2]
add esi,2
add ebp,2
%endmacro
%macro mode7fulladdwinon 0
mov ecx,[cwinptr2]
or dl,dl
jz %%nodraw
test byte[ecx],0FFh
jnz %%nodraw
mov ecx,[ebp]
mov edx,[pal16bcl+edx*4]
and ecx,[vesa2_clbit]
add edx,ecx
shr edx,1
mov edx,[fulladdtab+edx*2]
mov [esi],dx
xor edx,edx
%%nodraw
inc dword[cwinptr2]
xor ecx,ecx
add esi,2
add ebp,2
%endmacro
%macro mode7fullsubwinon 0
mov ecx,[cwinptr2]
or dl,dl
jz %%nodraw
test byte[ecx],0FFh
jnz %%nodraw
mov ecx,[ebp]
mov edx,[pal16bxcl+edx*4]
and ecx,[vesa2_clbit]
add edx,ecx
shr edx,1
mov edx,[fulladdtab+edx*2]
xor edx,0FFFFh
mov [esi],dx
xor edx,edx
%%nodraw
xor ecx,ecx
inc dword[cwinptr2]
add esi,2
add ebp,2
%endmacro
%macro mode7mainsubwinon 0
mov ecx,[cwinptr2]
or dl,dl
jz %%nodraw
test byte[ecx],0FFh
jnz %%nodraw
mov ecx,[pal16b+edx*4]
mov [esi],cx
mov [ebp],cx
%%nodraw
inc dword[cwinptr2]
xor ecx,ecx
add esi,2
add ebp,2
%endmacro
%macro mode716tmacro 2
Mode7Calculate
mov ebp,transpbuf+32
; esi = pointer to video buffer
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
mov edi,[vram]
cmp byte[curmosaicsz],1
je .nomosaic
mov esi,xtravbuf+32
mov ecx,128
.clearnext
mov dword[esi],0
add esi,4
dec ecx
jnz .clearnext
mov esi,xtravbuf+32
.nomosaic
; esi = pointer to video buffer
; edi = pointer to vram
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
; [.mode7xpos+1] = word value of x position
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
; [.mode7ypos+1] = word value of y position
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword[.mode7xadd2],800h
mov byte[.mode7xinc],2
mov byte[.mode7xincc],0
test dword[.mode7xadder],80000000h
jz .noneg
mov dword[.mode7xadd2],-800h
mov byte[.mode7xinc],-2
mov byte[.mode7xincc],0FEh
.noneg
mov dword[.mode7yadd2],800h
mov byte[.mode7yinc],1
test dword[.mode7yadder],80000000h
jz .noneg2
mov dword[.mode7yadd2],-800h
mov byte[.mode7yinc],-1
.noneg2
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
cmp byte[curmosaicsz],1
jne .domosaic
cmp byte[winon],0
jne near .drawmode7win
.domosaic
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3
cmp dword[.mode7xadder],-7F0h
jl near .nextval3
cmp dword[.mode7yadder],7F0h
jg near .nextval3
cmp dword[.mode7yadder],-7F0h
jl near .nextval3
Mode7Process %1, domosaic16b, 2
.nextval3
Mode7ProcessB %1, domosaic16b, 2
ALIGN32
.temp dd 0 ; for byte move left
.mode7xpos dd 0 ; x position
.tempa2 dd 0 ; keep this blank!
.mode7xrpos dd 0 ; x position
.tempa dd 0 ; keep this blank!
.mode7ypos dd 0 ; y position
.tempb2 dd 0 ; keep this blank!
.mode7yrpos dd 0 ; y position
.tempb dd 0 ; keep this blank!
.mode7xadder dd 0 ; number to add for x
.tempc2 dd 0 ; keep this blank!
.mode7xadd2 dd 0 ; number to add for x
.tempc dd 0 ; keep this blank!
.mode7yadder dd 0 ; number to add for y
.tempd2 dd 0 ; keep this blank!
.mode7yadd2 dd 0 ; number to add for y
.tempd dd 0 ; keep this blank!
.mode7ptr dd 0 ; pointer value
.mode7xinc dd 0 ; number to add for x
.mode7xincc dd 0 ; range check for x
.mode7yinc dd 0 ; number to add for y
.mode7xsloc dd 0 ; which screen x
.mode7ysloc dd 0 ; which screen y
.mode7xsrl dd 0 ; which relative screen x
.mode7ysrl dd 0 ; which relative screen y
.cxloc dw 0 ; cx location
.cyloc dw 0 ; cy location
.m7xaddofa dd 0
.m7xaddof2a dd 0
.m7yaddofa dd 0
.m7yaddof2a dd 0
.drawmode7win
.domosaicw
mov edi,[vram]
cmp dword[.mode7xadder],7F0h
jg near .nextval3w
cmp dword[.mode7xadder],-7F0h
jl near .nextval3w
cmp dword[.mode7yadder],7F0h
jg near .nextval3w
cmp dword[.mode7yadder],-7F0h
jl near .nextval3w
Mode7Process %2, domosaic16b, 2
.nextval3w
Mode7ProcessB %2, domosaic16b, 2
%endmacro
;*******************************************************
; Processes & Draws Mode 7 half Addition
;*******************************************************
NEWSYM drawmode716t
test byte[scaddset],1
jnz near drawmode7dcolor
cmp byte[DoTransp],1
jne .transpfull
jmp drawmode716b
.transpfull
mov esi,[cwinptr]
mov [winptrref],esi
mov [cwinptr2],esi
test byte[scaddtype],80h
jnz near drawmode716tsub
test byte[scaddtype],40h
jz near drawmode716tfulladd
cmp byte[scrnon+1],0
je near drawmode716tfulladd
cmp dword[coladdr],0
jnz near drawmode716tfulladd
; cmp byte[scrnon+1],10h
; je near drawmode716tfulladd
;.n
mode716tmacro mode7halfadd,mode7halfaddwinon
;*******************************************************
; Processes & Draws Mode 7 Full Addition
;*******************************************************
NEWSYM drawmode716tfulladd
mode716tmacro mode7fulladd,mode7fulladdwinon
;**********************************************************
; Processes and draws Mode 7 subtract
;**********************************************************
drawmode716tsub:
mode716tmacro mode7fullsub,mode7fullsubwinon
;**********************************************************
; Mode 7, main & sub mode
;**********************************************************
NEWSYM drawmode716tb
mov esi,[cwinptr]
mov [winptrref],esi
mov [cwinptr2],esi
mode716tmacro mode7mainsub,mode7mainsubwinon
cwinptr2 dd 0


View File

@@ -0,0 +1,326 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%macro Mode7Calculate 0
; mode 7, ax = curyposition, dx = curxposition (left side)
; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen
; center map coordinates = (X0,Y0)
; 1.) cx=X0-bg1scrolx, cy =Y0-ax
mov bx,[mode7X0]
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonega
or bx,1110000000000000b
.nonega
mov [.cxloc],bx
mov bx,dx
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonegb
or bx,1110000000000000b
.nonegb
sub [.cxloc],bx
mov bx,ax
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonegc
or bx,1110000000000000b
.nonegc
mov [.cyloc],bx
mov bx,[mode7Y0]
and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b
jz .nonegd
or bx,1110000000000000b
.nonegd
sub word[.cyloc],bx
; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D)
movsx eax,word[mode7B]
movsx ebx,word[.cyloc]
imul eax,ebx
mov [.mode7xpos],eax
mov bx,word[mode7X0]
add [.mode7xpos+1],bx
movsx ebx,word[.cyloc]
movsx eax,word[mode7D]
imul eax,ebx
mov [.mode7ypos],eax
mov bx,word[mode7Y0]
add [.mode7ypos+1],bx
; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B)
movsx ebx,word[.cxloc]
movsx eax,word[mode7A]
mov [.mode7xadder],eax
imul eax,ebx
neg eax
add [.mode7xpos],eax
movsx eax,word[mode7C]
movsx ebx,word[.cxloc]
neg eax
mov [.mode7yadder],eax
imul eax,ebx
add [.mode7ypos],eax
test byte[mode7set],1
jz .nohflip
mov eax,[.mode7xadder]
shl eax,8
add [.mode7xpos],eax
neg dword[.mode7xadder]
mov eax,[.mode7yadder]
shl eax,8
sub [.mode7ypos],eax
neg dword[.mode7yadder]
.nohflip
%endmacro
%macro Mode7Process 3
mov dword[.temp],256
test byte[mode7set],80h
jnz near %%norep2
mov eax,[.mode7xpos]
and eax,7FFh
mov [.mode7xrpos],eax
mov eax,[.mode7ypos]
and eax,7FFh
mov [.mode7yrpos],eax
; get tile data offset into edi
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
shl ebx,5
shr eax,3
and ebx,07FF8h
shl al,1
mov bl,al
mov edi,[vram]
xor ecx,ecx
mov [.mode7ptr],ebx
mov cl,[edi+ebx]
shl ecx,7
add edi,ecx
mov eax,[.mode7xrpos]
mov ebx,[.mode7ptr]
jmp %%nextval
ALIGN16
%%nextval
test ah,08h
jnz near %%rposoffx
%%nextposx
test byte[.mode7yrpos+1],08h
jnz near %%rposoffy
%%nextposy
mov ch,ah
mov edx,[.mode7yadder]
mov cl,byte[.mode7yrpos+1]
sub dword[.mode7yrpos],edx
xor edx,edx
add eax,[.mode7xadder]
mov dl,[mode7tab+ecx]
mov dl,[edi+edx]
%1
dec dword[.temp]
jnz near %%nextval
jmp %%finishmode7
%%rposoffx
add bl,[.mode7xinc]
xor ecx,ecx
mov cl,[vrama+ebx]
shl ecx,7
sub eax,[.mode7xadd2]
lea edi,[ecx+vrama]
jmp %%nextposx
%%rposoffy
sub bh,[.mode7yinc]
and ebx,07FFFh
xor ecx,ecx
mov cl,[vrama+ebx]
mov edx,[.mode7yadd2]
shl ecx,7
add dword[.mode7yrpos],edx
lea edi,[ecx+vrama]
jmp %%nextposy
%%finishmode7
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near %2
ret
;**********************************************************
; Mode 7, no repetition mode
;**********************************************************
%%norep2
test byte[mode7set],40h
jnz %%tilerep2
jmp %%nextvalb2
ALIGN16
%%nextvalb2
cmp byte[.mode7ypos+2],3
ja %%offscr2
cmp byte[.mode7xpos+2],3
jbe near %%offscr3
%%offscr2
mov eax,[.mode7xadder]
mov ebx,[.mode7yadder]
add [.mode7xpos],eax
sub [.mode7ypos],ebx
add esi,%3
dec dword[.temp]
jnz near %%nextvalb2
jmp %%finishmode7
%%tilerep2
%%nextvalb3
cmp byte[.mode7ypos+2],3
ja %%offscr2b
cmp byte[.mode7xpos+2],3
jbe near %%offscr3
%%offscr2b
mov ch,[.mode7xpos+1]
mov eax,[.mode7xadder]
mov cl,[.mode7ypos+1]
mov ebx,[.mode7yadder]
mov dl,[mode7tab+ecx]
add [.mode7xpos],eax
mov dl,[vrama+edx]
sub [.mode7ypos],ebx
%1
dec dword[.temp]
jnz near %%nextvalb3
jmp %%finishmode7
%%offscr3
mov eax,[.mode7xpos]
and eax,7FFh
mov [.mode7xrpos],eax
mov eax,[.mode7ypos]
and eax,7FFh
mov [.mode7yrpos],eax
; get tile data offset into edi
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
shl ebx,5
shr eax,3
and ebx,07FF8h
shl al,1
mov bl,al
mov edi,[vram]
xor ch,ch
mov [.mode7ptr],ebx
mov cl,[edi+ebx]
shl ecx,7
add edi,ecx
jmp %%nextvalr
ALIGN16
%%nodr2
add esi,%3
dec dword[.temp]
jz near %%fin2
%%nextvalr
test byte[.mode7xrpos+1],08h
jnz near %%rposoffxr
%%nextposxr
test byte[.mode7yrpos+1],08h
jnz near %%rposoffyr
%%nextposyr
mov cl,[.mode7yrpos+1]
mov ch,[.mode7xrpos+1]
mov edx,[.mode7xadder]
add dword[.mode7xrpos],edx
mov edx,[.mode7xadder]
sub dword[.mode7yrpos],edx
xor edx,edx
mov dl,[mode7tab+ecx]
mov dl,[edi+edx]
%1
dec dword[.temp]
jnz near %%nextvalr
%%fin2
jmp %%finishmode7
%%rposoffxr
mov al,[.mode7xinc]
mov edi,[vram]
add [.mode7ptr],al
mov cl,byte[.mode7xincc]
cmp byte[.mode7ptr],cl
je %%roff
%%roffxretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7xadd2]
shl ecx,7
sub [.mode7xrpos],eax
add edi,ecx
jmp %%nextposxr
%%rposoffyr
mov al,[.mode7yinc]
mov edi,[vram]
sub [.mode7ptr+1],al
js %%roff
%%roffyretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7yadd2]
shl ecx,7
add [.mode7yrpos],eax
add edi,ecx
jmp %%nextposyr
%%roff
test byte[mode7set],40h
jnz %%tilerep3
jmp %%finishmode7
%%tilerep3
and byte[.mode7yrpos+1],07h
and byte[.mode7xrpos+1],07h
mov cl,[.mode7yrpos+1]
mov eax,[.mode7xadder]
mov ch,[.mode7xrpos+1]
add [.mode7xrpos],eax
mov dl,[mode7tab+ecx]
mov eax,[.mode7yadder]
mov dl,[vrama+edx]
sub [.mode7yrpos],eax
%1
dec dword[.temp]
jnz near %%tilerep3
jmp %%finishmode7
%endmacro


1318
zsnes/src/video/mode7ext.asm Normal file

File diff suppressed because it is too large Load Diff

1502
zsnes/src/video/mv16tms.asm Normal file

File diff suppressed because it is too large Load Diff

1402
zsnes/src/video/newg162.asm Normal file

File diff suppressed because it is too large Load Diff

872
zsnes/src/video/newg162.mac Normal file
View File

@@ -0,0 +1,872 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; Finish up parttile
%macro procpixels16x8 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2]
mov [edi+%3+75036*4],bx
mov bx,[eax+ecx*2]
mov [edi+%3],bx
xor ebx,ebx
%endmacro
%macro procpixelst16x8 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2]
mov [edi+%2],cx
%%nodraw
%endmacro
%macro procpixelstr16x8 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2+512]
mov [edi+%3+75036*4],bx
mov bx,[eax+ecx*2+512]
mov [edi+%3],bx
xor ebx,ebx
%endmacro
%macro procpixelstt16x8 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2+512]
mov [edi+%2],cx
%%nodraw
%endmacro
%macro procpixelsmst16x8 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2+512]
mov [edi+%3+75036*4],bx
and ebx,[UnusedBitXor]
mov [edi+%3+75036*6],bx
mov bx,[eax+ecx*2+512]
mov [edi+%3],bx
and ebx,[UnusedBitXor]
mov [edi+%3+75036*2],bx
xor ebx,ebx
%endmacro
%macro procpixelstmst16x8 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2+512]
mov [edi+%2],cx
and cx,[UnusedBitXor]
mov [edi+%2+75036*2],cx
%%nodraw
%endmacro
%macro procpixelsmsnt16x8 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2]
mov [edi+%3+75036*4],bx
mov [edi+%3+75036*6],bx
mov bx,[eax+ecx*2]
mov [edi+%3],bx
mov [edi+%3+75036*2],bx
xor ebx,ebx
%endmacro
%macro procpixelstmsnt16x8 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2]
mov [edi+%2],cx
mov [edi+%2+75036*2],cx
%%nodraw
%endmacro
%macro procpixels16x8b 3
mov bl,[esi+%2]
add bl,dl
mov cx,[eax+ebx*2]
mov [edi+%3],cx
%endmacro
%macro procpixelst16x8b 3
%if %2<8
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2]
mov [edi+%2],cx
%%nodraw
%endif
%endmacro
%macro procpixelstr16x8b 3
mov bl,[esi+%2]
add bl,dl
mov cx,[eax+ebx*2+512]
mov [edi+%3],cx
%endmacro
%macro procpixelstt16x8b 3
%if %2<8
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2+512]
mov [edi+%2],cx
%%nodraw
%endif
%endmacro
%macro procpixelsmst16x8b 3
mov bl,[esi+%2]
add bl,dl
mov cx,[eax+ebx*2+512]
mov [edi+%3],cx
and ecx,[UnusedBitXor]
mov [edi+%3+75036*2],cx
%endmacro
%macro procpixelstmst16x8b 3
%if %2<8
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2+512]
mov [edi+%2],cx
and cx,[UnusedBitXor]
mov [edi+%2+75036*2],cx
%%nodraw
%endif
%endmacro
%macro procpixelsmsnt16x8b 3
mov bl,[esi+%2]
add bl,dl
mov cx,[eax+ebx*2]
mov [edi+%3],cx
mov [edi+%3+75036*2],cx
%endmacro
%macro procpixelstmsnt16x8b 3
%if %2<8
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2]
mov [edi+%2],cx
mov [edi+%2+75036*2],cx
%%nodraw
%endif
%endmacro
%macro drawlineng16x816b 10
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
; bit 10-12 = palette, 0-9=tile#
mov ebx,[cbgval]
mov dl,ch
inc dword[bg1drwng+ebx*4]
and ecx,3FFh
and edx,1Fh
add ecx,[ngptrdat2]
add cx,[taddnfy16x16]
test dword[vrama+eax],8000h
jz %%noflipy
add cx,[taddfy16x16]
%%noflipy
test dword[vrama+eax],4000h
jz %%noflipx
inc cx
%%noflipx
%%nexttile
push ecx
push edx
mov edx,[%6+edx*4]
%7
jnz near %%docache
%%returnfromcache
cmp byte[%1+ecx],2
je near %%done
cmp byte[%1+ecx],0
je near %%parttile
%2
; start drawing from ecx
test dword[vrama+eax],8000h
jz %%notflipyfull
add ecx,[flipyposng]
jmp %%yesflipyfull
%%notflipyfull
add ecx,[yposng]
%%yesflipyfull
test dword[vrama+eax],4000h
jnz near %%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 0,1,0
%9 2,3,2
%9 4,5,4
%9 6,7,6
pop eax
jmp %%done
%%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 7,6,0
%9 5,4,2
%9 3,2,4
%9 1,0,6
pop eax
jmp %%done
%%parttile
%2
; start drawing from ecx to edi
test dword[vrama+eax],8000h
jz %%notflipypart
add ecx,[flipyposng]
jmp %%yesflipypart
%%notflipypart
add ecx,[yposng]
%%yesflipypart
test word[vrama+eax],4000h
jnz near %%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 0,0,%8
%10 1,0+75036*4,%8
%10 2,2,%8
%10 3,2+75036*4,%8
%10 4,4,%8
%10 5,4+75036*4,%8
%10 6,6,%8
%10 7,6+75036*4,%8
pop eax
jmp %%done
%%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 7,0,%8
%10 6,0+75036*4,%8
%10 5,2,%8
%10 4,2+75036*4,%8
%10 3,4,%8
%10 2,4+75036*4,%8
%10 1,6,%8
%10 0,6+75036*4,%8
pop eax
%%done
pop edx
pop ecx
inc cx
test dword[vrama+eax],4000h
jz %%noflipxb
sub cx,2
%%noflipxb
add edi,8
xor dword[switch16x16],1
jnz near %%nexttile
%%ntile
mov ebx,[cbgval]
add ax,2
inc dword[bg1totng+ebx*4]
test eax,03Fh
jz %%tileadd
%%next
dec byte[tleftn]
jnz near %4
pop ebx
cmp byte[curmosaicsz],1
jne near domosaicng16b
ret
%5
add edi,16
jmp %%ntile
%%docache
call %3
jmp %%returnfromcache
%%tileadd
add ax,[bgtxadd]
jmp %%next
%endmacro
%macro drawlinengom216b 9
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
; bit 10-12 = palette, 0-9=tile#
mov dl,ch
inc dword[bg1drwng+%9*4]
and ecx,3FFh
and edx,1Fh
add ecx,[ngptrdat2]
mov edx,[%6+edx*4]
%7
jnz near %%docache
%%returnfromcache
cmp byte[%1+ecx],2
je near %5
cmp byte[%1+ecx],0
je near %%parttile
%2
; start drawing from ecx
test dword[vrama+eax],8000h
jz %%notflipyfull
add ecx,[flipyposng]
jmp %%yesflipyfull
%%notflipyfull
add ecx,[yposng]
%%yesflipyfull
test dword[vrama+eax],4000h
jnz near %%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
procpixels 0,1,0
procpixels 2,3,4
procpixels 4,5,8
procpixels 6,7,12
pop eax
jmp %5
%%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
procpixels 7,6,0
procpixels 5,4,4
procpixels 3,2,8
procpixels 1,0,12
pop eax
jmp %5
%%parttile
%2
; start drawing from ecx to edi
test dword[vrama+eax],8000h
jz %%notflipypart
add ecx,[flipyposng]
jmp %%yesflipypart
%%notflipypart
add ecx,[yposng]
%%yesflipypart
add ecx,[yposng]
test word[vrama+eax],4000h
jnz near %%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
procpixelst 0,0,%8
procpixelst 1,2,%8
procpixelst 2,4,%8
procpixelst 3,6,%8
procpixelst 4,8,%8
procpixelst 5,10,%8
procpixelst 6,12,%8
procpixelst 7,14,%8
pop eax
jmp %5
%%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
procpixelst 7,0,%8
procpixelst 6,2,%8
procpixelst 5,4,%8
procpixelst 4,6,%8
procpixelst 3,8,%8
procpixelst 2,10,%8
procpixelst 1,12,%8
procpixelst 0,14,%8
pop eax
%5
inc dword[bg1totng+%9*4]
add word[ofsmmptr],2
add word[ofsmtptr],2
mov ax,[ofsmmptr]
mov ebx,[yposngom]
mov edx,[flipyposngom]
mov [yposng],ebx
mov [flipyposng],edx
add edi,16
test eax,03Fh
jz near %%tileadd
%%next
mov ebx,[ofsmcptr]
add ebx,[ofsmcptr2]
add dword[ofshvaladd],8
test dword[ebx-40h],8000h
jz near %%noofsm
test dword[ebx-40h],2000h << %9
jz %%noofsm
mov ebx,[ebx-40h]
mov ax,[ofsmtptr]
and ebx,3FFh
add ebx,[ofsmcyps]
test ebx,100h
jz %%noupper
add ax,[ofsmady]
%%noupper
and ebx,0FFh
mov edx,ebx
shr ebx,3
and edx,07h
shl ebx,6
shl edx,3
add ax,bx
mov [yposng],edx
xor edx,38h
mov [flipyposng],edx
%%noofsm
mov ebx,[ofsmcptr]
add ebx,[ofsmcptr2]
add dword[ofsmcptr2],2
and dword[ofsmcptr2],3Fh
test dword[ebx-40h],8000h
jnz near %%noofsmh
test dword[ebx-40h],2000h << %9
jz %%noofsmh
mov ebx,[ebx-40h]
sub ax,[ofsmtptr]
add ax,[ofsmtptrs]
add ebx,[ofshvaladd]
test ebx,100h
jz %%noleft
add ax,[ofsmadx]
%%noleft
and ebx,0F8h
shr ebx,2
add ax,bx
%%noofsmh
dec byte[tleftn]
jnz near %4
%%fin
pop ebx
cmp byte[curmosaicsz],1
jne near domosaicng16b
ret
%%docache
call %3
jmp %%returnfromcache
%%tileadd
mov bx,[bgtxadd]
add ax,bx
add [ofsmmptr],bx
add word[ofsmtptr],bx
jmp %%next
%endmacro
%macro drawlinengom16b 10
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
; bit 10-12 = palette, 0-9=tile#
mov ebx,[cbgval]
mov dl,ch
inc dword[bg1drwng+ebx*4]
and ecx,3FFh
and edx,1Fh
add ecx,[ngptrdat2]
mov edx,[%6+edx*4]
%7
jnz near %%docache
%%returnfromcache
cmp byte[%1+ecx],2
je near %5
cmp byte[%1+ecx],0
je near %%parttile
%2
; start drawing from ecx
test dword[vrama+eax],8000h
jz %%notflipyfull
add ecx,[flipyposng]
jmp %%yesflipyfull
%%notflipyfull
add ecx,[yposng]
%%yesflipyfull
test dword[vrama+eax],4000h
jnz near %%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 0,1,0
%9 2,3,4
%9 4,5,8
%9 6,7,12
pop eax
jmp %5
%%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 7,6,0
%9 5,4,4
%9 3,2,8
%9 1,0,12
pop eax
jmp %5
%%parttile
%2
; start drawing from ecx to edi
test dword[vrama+eax],8000h
jz %%notflipypart
add ecx,[flipyposng]
jmp %%yesflipypart
%%notflipypart
add ecx,[yposng]
%%yesflipypart
test word[vrama+eax],4000h
jnz near %%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 0,0,%8
%10 1,2,%8
%10 2,4,%8
%10 3,6,%8
%10 4,8,%8
%10 5,10,%8
%10 6,12,%8
%10 7,14,%8
pop eax
jmp %5
%%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 7,0,%8
%10 6,2,%8
%10 5,4,%8
%10 4,6,%8
%10 3,8,%8
%10 2,10,%8
%10 1,12,%8
%10 0,14,%8
pop eax
%5
mov ebx,[cbgval]
add word[ofsmmptr],2
inc dword[bg1totng+ebx*4]
add word[ofsmtptr],2
mov ax,[ofsmmptr]
mov ebx,[yposngom]
mov edx,[flipyposngom]
mov [yposng],ebx
mov [flipyposng],edx
add edi,16
test eax,03Fh
jz near %%tileadd
%%next
mov ebx,[ofsmcptr]
add ebx,[ofsmcptr2]
mov ecx,[ofsmval]
add dword[ofshvaladd],8
test dword[ebx],ecx
jz %%noofsm
mov ebx,[ebx]
mov ax,[ofsmtptr]
and ebx,3FFh
add ebx,[ofsmcyps]
test ebx,100h
jz %%noupper
add ax,[ofsmady]
%%noupper
and ebx,0FFh
mov edx,ebx
shr ebx,3
and edx,07h
shl ebx,6
shl edx,3
add ax,bx
mov [yposng],edx
xor edx,38h
mov [flipyposng],edx
%%noofsm
mov ebx,[ofsmcptr]
add ebx,[ofsmcptr2]
add dword[ofsmcptr2],2
mov ecx,[ofsmvalh]
and dword[ofsmcptr2],3Fh
test dword[ebx-40h],ecx
jz %%noofsmh
mov ebx,[ebx-40h]
sub ax,[ofsmtptr]
add ax,[ofsmtptrs]
add ebx,[ofshvaladd]
test ebx,100h
jz %%noleft
add ax,[ofsmadx]
%%noleft
and ebx,0F8h
shr ebx,2
add ax,bx
%%noofsmh
dec byte[tleftn]
jnz near %4
%%fin
pop ebx
cmp byte[curmosaicsz],1
jne near domosaicng16b
ret
%%docache
call %3
jmp %%returnfromcache
%%tileadd
mov bx,[bgtxadd]
add ax,bx
add [ofsmmptr],bx
add word[ofsmtptr],bx
jmp %%next
%endmacro
%macro drawlinengom16b16x16 10
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
; bit 10-12 = palette, 0-9=tile#
mov ebx,[ng16bbgval]
mov dl,ch
inc dword[bg1drwng+ebx*4]
and ecx,3FFh
and edx,1Fh
add ecx,[ngptrdat2]
add cx,[taddnfy16x16]
test dword[vrama+eax],8000h
jz %%noflipy
add cx,[taddfy16x16]
%%noflipy
test dword[vrama+eax],4000h
jz %%noflipx
inc cx
%%noflipx
test byte[switch16x16],1
jz %%noflipxb
inc cx
test dword[vrama+eax],4000h
jz %%noflipxb
sub cx,2
%%noflipxb
%%nexttile
push ecx
push edx
mov edx,[%6+edx*4]
%7
jnz near %%docache
%%returnfromcache
cmp byte[%1+ecx],2
je near %%done
cmp byte[%1+ecx],0
je near %%parttile
%2
; start drawing from ecx
test word[vrama+eax],8000h
jz %%noflipyfull
add ecx,[flipyposng]
jmp %%yesflipyfull
%%noflipyfull
add ecx,[yposng]
%%yesflipyfull
test dword[vrama+eax],4000h
jnz near %%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 0,1,0
%9 2,3,4
%9 4,5,8
%9 6,7,12
pop eax
jmp %%done
%%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 7,6,0
%9 5,4,4
%9 3,2,8
%9 1,0,12
pop eax
jmp %%done
%%parttile
%2
; start drawing from ecx to edi
test word[vrama+eax],8000h
jz %%noflipypart
add ecx,[flipyposng]
jmp %%yesflipypart
%%noflipypart
add ecx,[yposng]
%%yesflipypart
test word[vrama+eax],4000h
jnz near %%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 0,0,%8
%10 1,2,%8
%10 2,4,%8
%10 3,6,%8
%10 4,8,%8
%10 5,10,%8
%10 6,12,%8
%10 7,14,%8
pop eax
jmp %%done
%%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 7,0,%8
%10 6,2,%8
%10 5,4,%8
%10 4,6,%8
%10 3,8,%8
%10 2,10,%8
%10 1,12,%8
%10 0,14,%8
pop eax
%%done
pop edx
pop ecx
test byte[switch16x16],1
jz %%nextb
add word[ofsmmptr],2
add word[ofsmtptr],2
mov ax,[ofsmmptr]
test eax,03Fh
jz near %%tileaddb
%%nextb
mov ebx,[cbgval]
inc dword[bg1totng+ebx*4]
mov ebx,[yposngom]
mov edx,[flipyposngom]
mov [yposng],ebx
mov [flipyposng],edx
mov ebx,[ofsmcptr]
add ebx,[ofsmcptr2]
mov ecx,[ofsmval]
add dword[ofshvaladd],8
test dword[ebx],ecx
jz %%noofsm
mov ebx,[ebx]
mov ax,[ofsmtptr]
and ebx,3FFh
add ebx,[ofsmcyps]
test ebx,200h
jz %%noupper
add ax,[ofsmady]
%%noupper
and ebx,01FFh
mov dword[taddnfy16x16],0
mov dword[taddfy16x16],16
test ebx,8
jz %%noflipy16x16
mov dword[taddnfy16x16],16
mov dword[taddfy16x16],-16
%%noflipy16x16
mov edx,ebx
shr ebx,4
and edx,07h
shl ebx,6
shl edx,3
add ax,bx
mov [yposng],edx
xor edx,38h
mov [flipyposng],edx
%%noofsm
add dword[ofsmcptr2],2
and dword[ofsmcptr2],3Fh
add edi,16
xor dword[switch16x16],1
jnz near %4
%%ntile
mov ebx,[ng16bbgval]
; add ax,2
inc dword[bg1totng+ebx*4]
; test eax,03Fh
; jz %%tileadd
%%next
dec byte[tleftn]
jnz near %4
pop ebx
cmp byte[curmosaicsz],1
jne near domosaicng16b
ret
%5
add edi,32
jmp %%ntile
%%docache
call %3
jmp %%returnfromcache
%%tileadd
add ax,[bgtxadd]
jmp %%next
%%tileaddb
mov bx,[bgtxadd]
add ax,bx
add [ofsmmptr],bx
add word[ofsmtptr],bx
jmp %%nextb
%endmacro


1191
zsnes/src/video/newg16wn.mac Normal file

File diff suppressed because it is too large Load Diff

2337
zsnes/src/video/newgfx.asm Normal file

File diff suppressed because it is too large Load Diff

3320
zsnes/src/video/newgfx.mac Normal file

File diff suppressed because it is too large Load Diff

3410
zsnes/src/video/newgfx16.asm Normal file

File diff suppressed because it is too large Load Diff

3762
zsnes/src/video/newgfx16.mac Normal file

File diff suppressed because it is too large Load Diff

674
zsnes/src/video/newgfx2.asm Normal file
View File

@@ -0,0 +1,674 @@
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
EXTSYM ngwintable,ngwinen,ngcwinptr,ngcpixleft,ngcwinmode
EXTSYM tleftn, ng16bprval, vrama, bg1drwng, ng16bbgval, bg1totng
EXTSYM bgtxadd, taddnfy16x16, taddfy16x16, switch16x16, curmosaicsz, domosaicng
EXTSYM vidmemch4,vidmemch2,vidmemch8,mode0add,vcache4b,vcache2b,vcache8b
EXTSYM cachesingle2bng,cachesingle8bng,ngpalcon4b,ngpalcon8b
EXTSYM ngpalcon2b,tleftnb,tltype2b,tltype4b,tltype8b,yposng,flipyposng
EXTSYM ofsmcptr,ofsmtptr,ofsmmptr,ofsmcyps,ofsmady,ofsmadx
EXTSYM yposngom,flipyposngom,cbgval,ofsmval,ofsmvalh,vram
%include "video/vidmacro.mac"
%include "video/newgfx2.mac"
%include "video/newgfx.mac"
%include "video/newgfxwn.mac"
;******************************************
; 8x8 tiles - tile engine
;******************************************
%macro WinClipMacro 1
mov byte[tleftn],33
mov dword[ngcwinptr],ngwintable
mov dword[ngcwinmode],0
cmp dword[ngwintable],0
jne .loop
add dword[ngcwinptr],4
mov dword[ngcwinmode],1
.winclipped
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
cmp dword[ebx],8
jbe near %1
sub dword[ebx],8
add ax,2
mov ebx,[ng16bbgval]
add edi,8
inc dword[bg1totng+ebx*4]
test eax,03Fh
jnz .notileadd
add ax,[bgtxadd]
.notileadd
dec byte[tleftn]
jnz .winclipped
pop ebx
cmp byte[curmosaicsz],1
jne near domosaicng
ret
.loop
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
cmp dword[ebx],8
jbe near %1
sub dword[ebx],8
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
%endmacro
NEWSYM drawtileng2b
cmp byte[ngwinen],1
je near drawtileng2bwin
mov byte[tleftn],33
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawtileng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
ret
drawtileng2bwin:
WinClipMacro Processwinclip2bt
drawtileng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
Processwinclip2bt:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawtilengwin tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawtileng2bwin.winclipped
jmp drawtileng2bwin.loop
NEWSYM drawtileng4b
cmp byte[ngwinen],1
je near drawtileng4bwin
mov byte[tleftn],33
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawtileng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
ret
drawtileng4bwin:
WinClipMacro Processwinclip4bt
drawtileng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
Processwinclip4bt:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawtilengwin tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawtileng4bwin.winclipped
jmp drawtileng4bwin.loop
NEWSYM drawtileng8b
cmp byte[ngwinen],1
je near drawtileng8bwin
mov byte[tleftn],33
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawtileng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
ret
drawtileng8bwin:
WinClipMacro Processwinclip8bt
drawtileng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
Processwinclip8bt:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawtilengwin tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawtileng8bwin.winclipped
jmp drawtileng8bwin.loop
;******************************************
; 16x16 tiles - tile engine
;******************************************
%macro WinClipMacro16x16 1
mov byte[tleftn],17
mov dword[ngcwinptr],ngwintable
mov dword[ngcwinmode],0
cmp dword[ngwintable],0
jne .loop
add dword[ngcwinptr],4
mov dword[ngcwinmode],1
.winclipped
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
cmp dword[ebx],16
jbe near %1
sub dword[ebx],16
add ax,2
mov ebx,[ng16bbgval]
add edi,16
inc dword[bg1totng+ebx*4]
test eax,03Fh
jnz .notileadd
add ax,[bgtxadd]
.notileadd
dec byte[tleftn]
jnz .winclipped
pop ebx
cmp byte[curmosaicsz],1
jne near domosaicng
ret
.loop
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
cmp dword[ebx],16
jbe near %1
sub dword[ebx],16
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
%endmacro
NEWSYM drawtileng16x162b
cmp byte[ngwinen],1
je near drawtileng16x162bwin
mov byte[tleftn],17
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawtileng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
ret
drawtileng16x162bwin:
WinClipMacro16x16 Processwinclip16x162bt
drawtileng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
Processwinclip16x162bt:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawtileng16x16win tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawtileng16x162bwin.winclipped
jmp drawtileng16x162bwin.loop
NEWSYM drawtileng16x164b
cmp byte[ngwinen],1
je near drawtileng16x164bwin
mov byte[tleftn],17
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawtileng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
ret
drawtileng16x164bwin:
WinClipMacro16x16 Processwinclip16x164bt
drawtileng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
Processwinclip16x164bt:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawtileng16x16win tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawtileng16x164bwin.winclipped
jmp drawtileng16x164bwin.loop
NEWSYM drawtileng16x168b
mov byte[tleftn],17
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawtileng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
ret
drawtileng16x168bwin:
WinClipMacro16x16 Processwinclip16x168bt
drawtileng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
Processwinclip16x168bt:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawtileng16x16win tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawtileng16x168bwin.winclipped
jmp drawtileng16x168bwin.loop
;******************************************
; 8x8 tiles - line by line engine
;******************************************
NEWSYM drawlineng2b
cmp byte[ngwinen],1
je near drawlineng2bwin
mov byte[tleftn],33
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawlineng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
ret
drawlineng2bwin:
WinClipMacro Processwinclip2b
drawlineng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
Processwinclip2b:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawlinengwin tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawlineng2bwin.winclipped
jmp drawlineng2bwin.loop
NEWSYM drawlineng4b
cmp byte[ngwinen],1
je near drawlineng4bwin
mov byte[tleftn],33
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawlineng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
ret
drawlineng4bwin:
WinClipMacro Processwinclip4b
drawlineng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
Processwinclip4b:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawlinengwin tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawlineng4bwin.winclipped
jmp drawlineng4bwin.loop
NEWSYM drawlineng8b
cmp byte[ngwinen],1
je near drawlineng8bwin
mov byte[tleftn],33
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawlineng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
ret
drawlineng8bwin:
WinClipMacro Processwinclip8b
drawlineng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
Processwinclip8b:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawlinengwin tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawlineng8bwin.winclipped
jmp drawlineng8bwin.loop
;******************************************
; 16x16 tiles - line by line engine
;******************************************
NEWSYM drawlineng16x162b
cmp byte[ngwinen],1
je near drawlineng16x162bwin
mov byte[tleftn],17
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawlineng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
ret
drawlineng16x162bwin:
WinClipMacro16x16 Processwinclip16x162b
drawlineng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
Processwinclip16x162b:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawlineng16x16win tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawlineng16x162bwin.winclipped
jmp drawlineng16x162bwin.loop
NEWSYM drawlineng16x164b
cmp byte[ngwinen],1
je near drawlineng16x164bwin
mov byte[tleftn],17
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawlineng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
ret
drawlineng16x164bwin:
WinClipMacro16x16 Processwinclip16x164b
drawlineng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
Processwinclip16x164b:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawlineng16x16win tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawlineng16x164bwin.winclipped
jmp drawlineng16x164bwin.loop
NEWSYM drawlineng16x168b
cmp byte[ngwinen],1
je near drawlineng16x168bwin
mov byte[tleftn],17
.loop
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
drawlineng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
ret
drawlineng16x168bwin:
WinClipMacro16x16 Processwinclip16x168b
drawlineng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
Processwinclip16x168b:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .finline
drawlineng16x16win tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawlineng16x168bwin.winclipped
jmp drawlineng16x168bwin.loop
NEWSYM drawlineng16x84b
mov byte[tleftn],33
.loop2b
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .fintile2b
drawlineng16x8 tltype4b, preparet4ba, cachesingle4bng,.loop2b,.fintile2b,ngpalcon4b,test4ba,0Fh
NEWSYM drawlineng16x82b
mov byte[tleftn],33
.loopb2b
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .fintileb2b
drawlineng16x8 tltype2b, preparet2ba, cachesingle2bng,.loopb2b,.fintileb2b,ngpalcon2b,test2ba,03h
%macro WinClipMacroom 1
mov byte[tleftn],33
mov dword[ngcwinptr],ngwintable
mov dword[ngcwinmode],0
cmp dword[ngwintable],0
jne near .loop
add dword[ngcwinptr],4
mov dword[ngcwinmode],1
.winclipped
mov ebx,[ngcwinptr]
cmp dword[ebx],8
jbe near %1
sub dword[ebx],8
mov ebx,[cbgval]
add word[ofsmmptr],2
inc dword[bg1totng+ebx*4]
add word[ofsmtptr],2
mov ax,[ofsmmptr]
mov ebx,[yposngom]
mov edx,[flipyposngom]
mov [yposng],ebx
mov [flipyposng],edx
add edi,8
test eax,03Fh
jnz .next
mov bx,[bgtxadd]
add ax,bx
add [ofsmmptr],bx
add word[ofsmtptr],bx
.next
mov ebx,[ofsmcptr]
add ebx,[ofsmcptr2]
mov ecx,[ofsmval]
add dword[ofshvaladd],8
test dword[ebx],ecx
jz .noofsm2
mov ebx,[ebx]
mov ax,[ofsmtptr]
and ebx,3FFh
add ebx,[ofsmcyps]
test ebx,100h
jz .noupper2
add ax,[ofsmady]
.noupper2
and ebx,0FFh
mov edx,ebx
shr ebx,3
and edx,07h
shl ebx,6
shl edx,3
add ax,bx
mov [yposng],edx
xor edx,38h
mov [flipyposng],edx
.noofsm2
mov ebx,[ofsmcptr]
add ebx,[ofsmcptr2]
add dword[ofsmcptr2],2
mov ecx,[ofsmvalh]
and dword[ofsmcptr2],3Fh
test dword[ebx-40h],ecx
jz .noofsmh
mov ebx,[ebx-40h]
sub ax,[ofsmtptr]
add ax,[ofsmtptrs]
add ebx,[ofshvaladd]
test ebx,100h
jz .noleft
add ax,[ofsmadx]
.noleft
and ebx,0F8h
shr ebx,2
add ax,bx
.noofsmh
dec byte[tleftn]
jnz near .winclipped
pop ebx
cmp byte[curmosaicsz],1
jne near domosaicng
ret
.loop
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
cmp dword[ebx],8
jbe near %1
sub dword[ebx],8
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .finline
%endmacro
NEWSYM drawlinengom4b
cmp byte[ngwinen],1
je near drawlinengom4bwin
mov byte[tleftn],33
.loopd
mov cx,[vrama+eax]
xor ecx,[ng16bprval]
test ecx,2000h
jnz near .fintiled
drawlinengom tltype4b, preparet4ba, cachesingle4bng,.loopd,.fintiled,ngpalcon4b,test4ba,0Fh
drawlinengom4bwin:
WinClipMacroom Processwinclipom4b
drawlinengom tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
Processwinclipom4b:
mov ebx,[ngcwinptr]
mov cx,[vrama+eax]
mov ebx,[ebx]
xor ecx,[ng16bprval]
mov [ngcpixleft],ebx
test ecx,2000h
jnz near .fintiled
drawlinengomwin tltype4b, preparet4ba, cachesingle4bng,.loop,.fintiled,ngpalcon4b,test4ba,0Fh
.loop
push eax
mov ebx,[ngcwinptr]
mov eax,[ngcpixleft]
mov [ebx],eax
pop eax
cmp dword[ngcwinmode],1
je near drawlinengom4bwin.winclipped
jmp drawlinengom4bwin.loop


1009
zsnes/src/video/newgfx2.mac Normal file

File diff suppressed because it is too large Load Diff

3298
zsnes/src/video/newgfxb.mac Normal file

File diff suppressed because it is too large Load Diff

1048
zsnes/src/video/newgfxwn.mac Normal file

File diff suppressed because it is too large Load Diff

3605
zsnes/src/video/procvid.asm Normal file

File diff suppressed because it is too large Load Diff

1759
zsnes/src/video/vidmacrb.mac Normal file

File diff suppressed because it is too large Load Diff

1791
zsnes/src/video/vidmacro.mac Normal file

File diff suppressed because it is too large Load Diff