        .386
        .MODEL FLAT
        LOCALS @@
        JUMPS

        .DATA

EXTRN _FB_Texture: DWORD
count DD 0

        .CODE

;extern void FB_Draw320x200(byte *dest, int n, sint32 x, sint32 y, sint32 dx, sint32 dy);
;#pragma aux FB_Draw320x200 parm [EDI] [ESI] [EAX] [EBX] [ECX] [EDX]

REPTBITS = 2

PUBLIC FB_Draw320x200_
FB_Draw320x200_:
        PUSH    EBP
        SHR     ESI,REPTBITS
        MOV     [count],ESI
        MOV     ESI,[_FB_Texture]
        MOV     EBP,ECX
        MOV     ECX,EAX

   @@l:
        i = 0
        REPT (1 SHL REPTBITS)
                LOCAL @@c1
                MOV     EAX,EBX
                ADD     EBX,EDX
                SHR     EAX,24
                SHLD    EAX,ECX,8
                ADD     ECX,EBP
                MOV     AL,[ESI+EAX]
                ADD     AL,[EDI+i]
                RCR     AL,1
                MOV     [EDI+i],AL
            @@c1:
                i = i + 1
        ENDM
        ADD     EDI,(1 SHL REPTBITS)
        DEC     [count]
        JNZ     @@l

        POP     EBP
        RET


END
