Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

blit_transparent_clip_tasm.cpp

Go to the documentation of this file.
00001 #ifdef USE_TASM
00002 
00003 extern "C" {
00004 
00005 void blit_transparent_clip_asm_16bpp(unsigned char *src, unsigned short *dest, unsigned int width)
00006 {
00007 asm
00008 {
00009 ALIGN 8
00010 blit_transparent_clip_asm_16bpp:
00011         push            esi                     ;; save used registers (5)
00012         push            edi
00013         push            eax
00014         push            ecx
00015         push            edx
00016 
00017         mov             esi, [esp+20+4] ;; load registers
00018         mov             edi, [esp+20+8]
00019         mov             edx, [esp+20+12]
00020 
00021         and             edx, edx
00022         jle             .rle_done               ;; just in case
00023 
00024         xor             ecx, ecx                ;; should produce smaller opcode than mov ecx, 0
00025 ALIGN 4
00026 .cmd_copy:
00027         mov             cx, [esi]
00028         sub             edx, ecx                ;; width -= rep
00029         jns             .do_copy                ;; if (rep >= width)
00030         add             ecx, edx                ;; rep = width
00031 
00032 .do_copy:
00033         add             esi, 2
00034 
00035         shr             ecx, 1
00036         rep             movsd                   ;; copy all dwords
00037 
00038         jnc             .end_copy               ;; carry == ecx & 1 before the shift
00039 
00040         mov             ax, [esi]
00041         mov             [edi], ax
00042   add           esi,  2
00043         add             edi,  2
00044 
00045 .end_copy:
00046         and             edx, edx                ;; if (width <= 0) jmp done
00047         jle             .rle_done   
00048 
00049 .cmd_skip:
00050         mov             cx, [esi]               ;; read rep
00051 
00052         add             edi, ecx                ;; do the skip
00053         add             esi,  2
00054         add             edi, ecx                ;; (x2 because dest is word)
00055 
00056         sub             edx, ecx                ;; width -= rep
00057         jns             .cmd_copy    
00058 
00059 .rle_done:
00060         pop             edx                     ;; restore used registers
00061         pop             ecx
00062         pop             eax
00063         pop             edi
00064         pop             esi
00065 
00066         ret
00067 } //end asm
00068 } //end blit_transparent_clip_asm_16bpp
00069 
00070 
00071 void blit_transparent_clip_asm_32bpp(unsigned char *src, unsigned int *dest, unsigned int width)
00072 {
00073 asm
00074 {
00075 ALIGN 8
00076         push            esi                     ;; save used registers (4)
00077         push            edi
00078         push            ecx
00079         push            edx
00080 
00081         mov             esi, [esp+16+4] ;; load registers
00082         mov             edi, [esp+16+8]
00083         mov             edx, [esp+16+12]
00084 
00085         and             edx, edx
00086         jle             .rle_done32             ;; just in case
00087 
00088         xor             ecx, ecx                ;; should produce smaller opcode than mov ecx, 0
00089 ALIGN 4
00090 .cmd_copy32:
00091         mov             cx, [esi]
00092         sub             edx, ecx                ;; width -= rep
00093         jns             .do_copy32              ;; if (rep >= width)
00094         add             ecx, edx                ;; rep = width
00095 
00096 .do_copy32:
00097   add           esi, 2
00098         rep             movsd                   ;; copy all dwords
00099 
00100         and             edx, edx                ;; if (width <= 0) jmp done
00101         jle             .rle_done32
00102 
00103 .cmd_skip32:
00104         mov             cx, [esi]               ;; read rep
00105         lea             edi, [edi + 4*ecx]      ;; do the skip (x4 because dest is word)
00106         add             esi, 2
00107 
00108         sub             edx, ecx                ;; width -= rep
00109         jns             .cmd_copy32
00110 
00111 .rle_done32:
00112 
00113         pop             edx                     ;; restore used registers
00114         pop             ecx
00115         pop             edi
00116         pop             esi
00117 
00118         ret
00119 } //end asm
00120 } // end blit_transparent_clip_asm_32bpp
00121 
00122 
00123 } //end extern C
00124 
00125 
00126 #endif
00127 
00128 

Generated at Wed Apr 4 19:53:59 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001