From a0d8e5bca9976089e79874f78ece578111926dce Mon Sep 17 00:00:00 2001 From: stainless <> Date: Wed, 14 Nov 2001 12:17:36 +0000 Subject: [PATCH] Rewrote unified Mode-X blitter in DOS port. [TRAC] --- zsnes/src/ui.asm | 33 +++++--- zsnes/src/video/copyvid.inc | 162 +++++++++++++++--------------------- 2 files changed, 88 insertions(+), 107 deletions(-) diff --git a/zsnes/src/ui.asm b/zsnes/src/ui.asm index e662e235..013c7977 100644 --- a/zsnes/src/ui.asm +++ b/zsnes/src/ui.asm @@ -159,7 +159,7 @@ NEWSYM outofmemory SECTION .data NEWSYM mydebug, db '',13,10,0 NEWSYM outofmem, db 'You don',39,'t have enough memory to run this program!',13,10,0 -%define ZVERSION '337 ' +%define ZVERSION '337' ;%define ZBETA 0 ; Line added by Peter Santing @@ -176,27 +176,34 @@ NEWSYM welcome ; db 'PRIVATE BETA VERSION!!! PLEASE DO NOT DISTRIBUTE!!! Thank you!',13,10 ; db 'Private Beta is Registered to : ',USERNAMEN,13,10 ;%else + db 'ZSNES v1.',ZVERSION,' beta (c) 1997-2001, ZSNES Team (zsKnight & _Demo_)',13,10 %ifdef __LINUX__ - db 'ZSNES v1.',ZVERSION,' beta (c)1997-2001 ZSNES Team (zsKnight - _Demo_)',13,10 - db 'Linux version, please report crashes to zsnes-devel@lists.sourceforge.net.',13,10 - db 'Compiled under NASM, GCC',13,10,13,10 + db 'Compiled under NASM and GCC. (Linux/FreeBSD)',13,10,13,10 %else - db 'ZSNES v1.',ZVERSION,' beta (c)1997-2001 ZSNES Team (zsKnight - _Demo_)',13,10 - ; ZSNES DOS doesn't use WDOSX anymore - db 'Compiled under NASM, GCC (DOS+DPMI)',13,10,13,10 +%ifdef __WIN32__ + db 'Compiled under NASM and MSVC++. (Windows)',13,10,13,10 +%else + db 'Compiled under NASM and DJGPP. (DOS w/ DPMI)',13,10,13,10 +%endif %endif ;%endif - db ' Programmers : zsKnight, _Demo_',13,10 - db ' Assistant Coder : Pharos',13,10,13,10 - db 'ZSNES comes with ABSOLUTELY NO WARRANTY. This is free software,',10,13 + db 'Be sure to check http://www.zsnes.com/ for the latest version.',13,10 + db 'Please report crashes to zsnes-devel@lists.sourceforge.net.',13,10,13,10 + db ' Main Coders : zsKnight, _Demo_, and pagefault',13,10 + db ' Assistant Coders : Pharos, teuf, theoddone33, and stainless',13,10,13,10 + db 'ZSNES comes with ABSOLUTELY NO WARRANTY. This is free software,',10,13 db 'and you are welcome to redistribute it under certain conditions;',10,13 - db 'check license.txt.',10,13,10,13 - db 'Use ZSNES -? for command line definitions',13,10,13,10,0 +%ifdef __LINUX__ + db 'please read ',39,'LICENSE',39,' thoroughly before using it.',10,13,10,13 +%else + db 'please read ',39,'LICENSE.TXT',39,' thoroughly before using it.',10,13,10,13 +%endif + db 'Use ZSNES -? for command line definitions.',13,10,13,10,0 ;cpuidfname db 'nocpuzid.dat',0 ;cpuidtext db 'NOTE: If ZSNES crashes here, then please re-run. ',0 ;cpuidtext2 db 13,' ',13,0 -YesMMX db 'MMX support enabled.',13,10,13,10,0 +YesMMX db 'MMX support found and enabled.',13,10,13,10,0 ; global variables diff --git a/zsnes/src/video/copyvid.inc b/zsnes/src/video/copyvid.inc index e0874066..b7528c43 100644 --- a/zsnes/src/video/copyvid.inc +++ b/zsnes/src/video/copyvid.inc @@ -396,7 +396,7 @@ NEWSYM copymodex224 mov eax,(320*225)/4 .pageb - mov dl,222 + mov bl,222 jmp copymodexloop ;******************************************************* @@ -438,8 +438,8 @@ NEWSYM copymodex240 mov eax,(320*240)/4 .pageb - mov dl,[resolutn] - sub dl,2 + mov bl,[resolutn] + sub bl,2 jmp copymodexloop ;******************************************************* @@ -481,110 +481,84 @@ NEWSYM copymodex256 mov eax,(320*256)/4 .pageb - mov dl,[resolutn] - sub dl,2 + mov bl,[resolutn] + sub bl,2 jmp copymodexloop ;eax = VGA address of output page ;edi = offset in current page of first line ;esi = address of first line to be copied -;dl = number of lines to copy +;bl = number of lines to copy NEWSYM copymodexloop add edi,eax mov [.pageaddress],eax - mov [.linecount],dl + mov [.linecount],bl mov [.startesi],esi mov [.startedi],edi -.loopa1 - mov ecx,16 -.loopb1 - mov ah,[esi+12] - mov al,[esi+8] - shl eax,16 - mov ah,[esi+4] - mov al,[esi+0] - mov [es:edi],eax - add esi,16 - add edi,4 - dec ecx - jnz .loopb1 - add esi,32 - add edi,16 - dec dl - jnz .loopa1 +; register allocation +; bl = line counter (0-total lines) +; bh = other line counter (descriptive, eh?) (0-8) +; ebp = plane counter +; ch = plane enable bit +; cl = 4-pixel copy counter +; edx= pixel processing & I/O address +; eax = pixel processing & I/O data + mov dx,03C4h - mov ax,0202h + +.loopa + mov ebp,4 + mov ch,1 + cmp bl,8 + mov bh,bl + jb .loopb + mov bh,8 + +.loopb + ; set write plane + mov ah,ch + add ch,ch + mov al,02h out dx,ax - mov esi,[.startesi] + + push ebx + push edi + push esi + +.loopc + ; loop count + mov cl,16 +.loopd + mov al,[esi+8] + mov ah,[esi+12] + shl eax,16 + mov al,[esi+0] + mov ah,[esi+4] + add esi,16 + mov [es:edi],eax + add edi,4 + dec cl + jnz .loopd + + add esi,16+16 + add edi,(320-256)/4 + dec bh + jnz .loopc + + pop esi + pop edi + pop ebx + inc esi - mov edi,[.startedi] - mov dl,[.linecount] -.loopa2 - mov ecx,16 -.loopb2 - mov ah,[esi+12] - mov al,[esi+8] - shl eax,16 - mov ah,[esi+4] - mov al,[esi+0] - mov [es:edi],eax - add esi,16 - add edi,4 - dec ecx - jnz .loopb2 - add esi,32 - add edi,16 - dec dl - jnz .loopa2 - mov dx,03C4h - mov ax,0402h - out dx,ax - mov esi,[.startesi] - add esi,2 - mov edi,[.startedi] - mov dl,[.linecount] -.loopa3 - mov ecx,16 -.loopb3 - mov ah,[esi+12] - mov al,[esi+8] - shl eax,16 - mov ah,[esi+4] - mov al,[esi+0] - mov [es:edi],eax - add esi,16 - add edi,4 - dec ecx - jnz .loopb3 - add esi,32 - add edi,16 - dec dl - jnz .loopa3 - mov dx,03C4h - mov ax,0802h - out dx,ax - mov esi,[.startesi] - add esi,3 - mov edi,[.startedi] - mov dl,[.linecount] -.loopa4 - mov ecx,16 -.loopb4 - mov ah,[esi+12] - mov al,[esi+8] - shl eax,16 - mov ah,[esi+4] - mov al,[esi+0] - mov [es:edi],eax - add esi,16 - add edi,4 - dec ecx - jnz .loopb4 - add esi,32 - add edi,16 - dec dl - jnz .loopa4 + dec ebp + jnz .loopb + + ; next line + add esi,(16+256+16)*8-4 + add edi,320*8/4 + sub bl,bh + jnz .loopa pop es @@ -610,6 +584,7 @@ NEWSYM copymodexloop .setpageb mov [whichpage],al ret + SECTION .bss .startesi resd 1 .startedi resd 1 @@ -619,7 +594,6 @@ SECTION .bss NEWSYM whichpage, resb 1 ; active page and visual page locations SECTION .text - ;******************************************************* ; CopyModeQ 224 Copies buffer into chained 256x224 ;*******************************************************