diff --git a/zsnes/src/video/newgfx.mac b/zsnes/src/video/newgfx.mac index 673c58dd..67518af3 100644 --- a/zsnes/src/video/newgfx.mac +++ b/zsnes/src/video/newgfx.mac @@ -2625,6 +2625,8 @@ EXTSYM drawmode7ngextbg,drawmode7ngextbg2 mov eax,[BGPT1+ebx*2+%1*512] test ecx,100h jz .noyinc + cmp byte[BGMA+ebx],4 + je near .offsetm add eax,[BGPT1Y+ebx*2+%1*512] .noyinc lea ecx,[ecx*8] @@ -2888,10 +2890,7 @@ EXTSYM drawmode7ngextbg,drawmode7ngextbg2 shl edx,6 xor eax,eax mov ax,[BGPT3+ebx*2] - cmp dx,0 - jl .isneg add ax,dx -.isneg xor edx,edx mov dx,[BG3SXl+ebx*2] and dx,0F8h @@ -2955,6 +2954,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] @@ -3240,10 +3254,7 @@ EXTSYM drawmode7ngextbg,drawmode7ngextbg2 shl edx,6 xor eax,eax mov ax,[BGPT3+ebx*2] - cmp dx,0 - jl .isneg add ax,dx -.isneg xor edx,edx mov dx,[BG3SXl+ebx*2] and dx,0F8h @@ -3275,6 +3286,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.mac b/zsnes/src/video/newgfx16.mac index a6c62527..3a620ac0 100644 --- a/zsnes/src/video/newgfx16.mac +++ b/zsnes/src/video/newgfx16.mac @@ -2832,12 +2832,15 @@ EXTSYM osm2dis je near .offsetm cmp byte[t16x161+ebx+%1*256],1 je near .tiles16x16 - cmp byte[BGMA+ebx],4 - je near .offsetm .nooffsetm mov eax,[BGPT1+ebx*2+%1*512] test ecx,100h jz .noyinc + cmp byte[osm2dis],1 + je .nooffsetm2 + cmp byte[BGMA+ebx],4 + je near .offsetm +.nooffsetm2 add eax,[BGPT1Y+ebx*2+%1*512] .noyinc lea ecx,[ecx*8] @@ -3131,10 +3134,7 @@ EXTSYM osm2dis shl edx,6 xor eax,eax mov ax,[BGPT3+ebx*2] - cmp dx,0 - jl .isneg1 add ax,dx -.isneg1 xor edx,edx mov dx,[BG3SXl+ebx*2] and dx,0F8h @@ -3303,10 +3303,7 @@ EXTSYM osm2dis shl edx,6 xor eax,eax mov ax,[BGPT3+ebx*2] - cmp dx,0 - jl .isneg2 add ax,dx -.isneg2 xor edx,edx mov dx,[BG3SXl+ebx*2] and dx,0F8h @@ -3709,10 +3706,7 @@ EXTSYM osm2dis shl edx,6 xor eax,eax mov ax,[BGPT3+ebx*2] - cmp dx,0 - jl .isneg3 add ax,dx -.isneg3 xor edx,edx mov dx,[BG3SXl+ebx*2] and dx,0F8h