diff --git a/zsnes/src/video/newg162.asm b/zsnes/src/video/newg162.asm index 198afafc..a8c8fd86 100644 --- a/zsnes/src/video/newg162.asm +++ b/zsnes/src/video/newg162.asm @@ -28,7 +28,7 @@ EXTSYM yposngom,flipyposngom,cbgval,ofsmval,ofsmvalh,vram,CPalPtrng,BGMS1,scadtn EXTSYM CMainWinScr,CSubWinScr,UnusedBit,res640,mosclineval,mostranspval EXTSYM vcache2bs,vcache4bs,vcache8bs EXTSYM vidmemch2s,vidmemch4s,vidmemch8s -EXTSYM cpalval +EXTSYM cpalval,bgtxadd2 EXTSYM SpecialLine NEWSYM NewG162AsmStart diff --git a/zsnes/src/video/newg162.mac b/zsnes/src/video/newg162.mac index 95b89efb..8ad168e0 100644 --- a/zsnes/src/video/newg162.mac +++ b/zsnes/src/video/newg162.mac @@ -431,6 +431,7 @@ inc dword[bg1totng+%9*4] add word[ofsmmptr],2 add word[ofsmtptr],2 + mov ax,[ofsmmptr] mov ebx,[yposngom] mov edx,[flipyposngom] @@ -470,6 +471,11 @@ add ebx,[ofsmcptr2] add dword[ofsmcptr2],2 and dword[ofsmcptr2],3Fh + test dword[ofsmcptr2],3Fh + jnz %%notzeroed + mov bx,[bgtxadd2] + add word[ofsmcptr],bx +%%notzeroed test dword[ebx-40h],8000h jnz near %%noofsmh test dword[ebx-40h],2000h << %9 @@ -639,6 +645,11 @@ add dword[ofsmcptr2],2 mov ecx,[ofsmvalh] and dword[ofsmcptr2],3Fh + test dword[ofsmcptr2],3Fh + jnz %%notzeroed + mov bx,[bgtxadd2] + add word[ofsmcptr],bx +%%notzeroed test dword[ebx-40h],ecx jz %%noofsmh mov ebx,[ebx-40h] @@ -835,6 +846,11 @@ %%noofsm add dword[ofsmcptr2],2 and dword[ofsmcptr2],3Fh + test dword[ofsmcptr2],3Fh + jnz %%notzeroed + mov bx,[bgtxadd2] + add word[ofsmcptr],bx +%%notzeroed add edi,16 xor dword[switch16x16],1 diff --git a/zsnes/src/video/newgfx.asm b/zsnes/src/video/newgfx.asm index ab756253..3c1cb906 100644 --- a/zsnes/src/video/newgfx.asm +++ b/zsnes/src/video/newgfx.asm @@ -941,6 +941,7 @@ NEWSYM pnglogicval, dd 0 NEWSYM mosjmptab, times 15 dd 0 NEWSYM Mode7HiRes, dd 0 NEWSYM pesimpng, dd 0 +NEWSYM bgtxadd2, dd 0 NEWSYM StartDrawNewGfx mov byte[WindowRedraw],1 diff --git a/zsnes/src/video/newgfx.mac b/zsnes/src/video/newgfx.mac index 4ace5852..c4cf5a74 100644 --- a/zsnes/src/video/newgfx.mac +++ b/zsnes/src/video/newgfx.mac @@ -2952,6 +2952,21 @@ EXTSYM drawmode7ngextbg,drawmode7ngextbg2 add eax,ecx add [ofsmtptr],ecx mov [ofsmmptr],eax + + mov word[bgtxadd2],0 + cmp word[BGPT3X+ebx*2],0 + je .yesoverfl + mov cx,word[BG3SXl+ebx*2] + add cx,16 + test cx,100h + jz .notoverfl + add dword[ofsmcptr],800h + sub word[bgtxadd2],800h + jmp .yesoverfl +.notoverfl + add word[bgtxadd2],800h +.yesoverfl + mov dword[ofshvaladd],0 mov ecx,[BGOPT1+ebx*2+%1*512] mov edx,[BGMA+ebx] @@ -3269,6 +3284,21 @@ EXTSYM drawmode7ngextbg,drawmode7ngextbg2 mov eax,[BGPT1+ebx*2+%1*512] mov [ofsmtptr],eax mov [ofsmtptrs],eax + + mov word[bgtxadd2],0 + cmp word[BGPT3X+ebx*2],0 + je .yesoverfl + mov cx,word[BG3SXl+ebx*2] + add cx,16 + test cx,100h + jz .notoverfl + add dword[ofsmcptr],800h + sub word[bgtxadd2],800h + jmp .yesoverfl +.notoverfl + add word[bgtxadd2],800h +.yesoverfl + mov ecx,[BG1SXl+ebx*2+%1*512] mov edx,[BGPT1X+ebx*2+%1*512] test ecx,100h diff --git a/zsnes/src/video/newgfx16.asm b/zsnes/src/video/newgfx16.asm index 22007e5d..a8a6e133 100644 --- a/zsnes/src/video/newgfx16.asm +++ b/zsnes/src/video/newgfx16.asm @@ -63,7 +63,7 @@ EXTSYM ngwinptr,objwlrpos,objwen,objclineptr,CSprWinPtr EXTSYM BuildWindow2 EXTSYM NGNumSpr EXTSYM fulladdtab -EXTSYM FPUCopy +EXTSYM FPUCopy,bgtxadd2 NEWSYM NewGfx16AsmStart diff --git a/zsnes/src/video/newgfx16.mac b/zsnes/src/video/newgfx16.mac index 486d68e8..0271f983 100644 --- a/zsnes/src/video/newgfx16.mac +++ b/zsnes/src/video/newgfx16.mac @@ -3201,6 +3201,7 @@ EXTSYM osm2dis mov eax,[BGPT1+ebx*2+%1*512] mov [ofsmtptr],eax mov [ofsmtptrs],eax + mov dword[taddnfy16x16],0 mov dword[taddfy16x16],16 test ecx,08h @@ -3240,6 +3241,21 @@ EXTSYM osm2dis add eax,ecx add [ofsmtptr],ecx mov [ofsmmptr],eax + + mov word[bgtxadd2],0 + cmp word[BGPT3X+ebx*2],0 + je .yesoverfl + mov cx,word[BG3SXl+ebx*2] + add cx,16 + test cx,100h + jz .notoverfl + add dword[ofsmcptr],800h + sub word[bgtxadd2],800h + jmp .yesoverfl +.notoverfl + add word[bgtxadd2],800h +.yesoverfl + mov ecx,[BGOPT1+ebx*2+%1*512] mov edx,[BGMA+ebx] and edi,0Fh @@ -3316,6 +3332,7 @@ EXTSYM osm2dis mov eax,[BGPT1+ebx*2+%1*512] mov [ofsmtptr],eax mov [ofsmtptrs],eax + test ecx,100h jz .noyincd add eax,[BGPT1Y+ebx*2+%1*512] @@ -3348,6 +3365,21 @@ EXTSYM osm2dis add eax,ecx add [ofsmtptr],ecx mov [ofsmmptr],eax + + mov word[bgtxadd2],0 + cmp word[BGPT3X+ebx*2],0 + je .yesoverfl3 + mov cx,word[BG3SXl+ebx*2] + add cx,16 + test cx,100h + jz .notoverfl3 + add dword[ofsmcptr],800h + sub word[bgtxadd2],800h + jmp .yesoverfl3 +.notoverfl3 + add word[bgtxadd2],800h +.yesoverfl3 + mov dword[ofshvaladd],0 mov ecx,[BGOPT1+ebx*2+%1*512] mov edx,[BGMA+ebx] @@ -3703,6 +3735,21 @@ EXTSYM osm2dis mov eax,[BGPT1+ebx*2+%1*512] mov [ofsmtptr],eax mov [ofsmtptrs],eax + + mov word[bgtxadd2],0 + cmp word[BGPT3X+ebx*2],0 + je .yesoverfl + mov cx,word[BG3SXl+ebx*2] + add cx,16 + test cx,100h + jz .notoverfl + add dword[ofsmcptr],800h + sub word[bgtxadd2],800h + jmp .yesoverfl +.notoverfl + add word[bgtxadd2],800h +.yesoverfl + mov ecx,[BG1SXl+ebx*2+%1*512] mov edx,[BGPT1X+ebx*2+%1*512] test ecx,100h diff --git a/zsnes/src/video/newgfx2.asm b/zsnes/src/video/newgfx2.asm index 860843d4..6f9ca8b8 100644 --- a/zsnes/src/video/newgfx2.asm +++ b/zsnes/src/video/newgfx2.asm @@ -24,7 +24,7 @@ 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 +EXTSYM yposngom,flipyposngom,cbgval,ofsmval,ofsmvalh,vram,bgtxadd2 NEWSYM NewGfx2AsmStart diff --git a/zsnes/src/video/newgfx2.mac b/zsnes/src/video/newgfx2.mac index 6a8aa037..9a31be37 100644 --- a/zsnes/src/video/newgfx2.mac +++ b/zsnes/src/video/newgfx2.mac @@ -974,6 +974,11 @@ add dword[ofsmcptr2],2 mov ecx,[ofsmvalh] and dword[ofsmcptr2],3Fh + test dword[ofsmcptr2],3Fh + jnz %%notzeroed + mov bx,[bgtxadd2] + add word[ofsmcptr],bx +%%notzeroed test dword[ebx-40h],ecx jz %%noofsmh mov ebx,[ebx-40h]