--- uae/src/X86.S 2018/04/24 16:38:39 1.1.1.1 +++ uae/src/X86.S 2018/04/24 16:39:04 1.1.1.2 @@ -2,171 +2,168 @@ * Feel free to send me Sparc/PPC/Alpha versions of this... :) */ -#ifdef __DOS__ -#define SYM(NAME) _##NAME -#define _color_regs _bpl_info +#ifdef X86_PPRO_OPT +#define BYTE_REG(a,b) a +#define BYTE_MOVE movzbl #else -#define SYM(NAME) NAME +#define BYTE_REG(a,b) b +#define BYTE_MOVE movb #endif +#ifndef USE_UNDERSCORE +#define SYM(NAME) NAME +#define FUNCTION_ALIGN .align 16 +/* Urgl... */ +#else +#define SYM(NAME) _##NAME /* Urgl... */ -#define color_regs bpl_info +#define FUNCTION_ALIGN .align 4 +#endif -#ifndef __DOS__ +#ifndef USE_UNDERSCORE .local lastcolor .comm lastcolor,2 - .align 16 #else .comm lastcolor,2 - .align 8 #endif -.globl pfield_linetoscr_full8 -pfield_linetoscr_full8: + .globl pfield_linetoscr_asm8 + .type pfield_linetoscr_asm8,@function + FUNCTION_ALIGN +pfield_linetoscr_asm8: pushl %ebp pushl %edi pushl %esi pushl %ebx - movl 20(%esp),%esi - movl 24(%esp),%edi + movl 24(%esp),%esi /* start */ + movl 28(%esp),%edi /* lframe_end */ - xorl %edx,%edx - movl SYM(diwfirstword),%eax - cmpl $4,%eax - jc .Loops1 - movl %edx,SYM(pixdata)-4(%eax) - movl %edx,SYM(spixstate)-4(%eax) -.Loops1: - movl SYM(diwlastword),%eax - movl %edx,SYM(pixdata)(%eax) - movl %edx,SYM(spixstate)(%eax) - - movl SYM(acolors),%edx + movl SYM(colors_for_drawing),%edx movb %dl,%dh movw %dx,%ax - bswapl %eax + sall $16,%eax movw %dx,%ax + movl 20(%esp),%ebx movl SYM(xlinebuffer),%ecx - leal 4(%esi),%edx - cmpl %edx,SYM(diwfirstword) - jle .La_start_ok + jmp .La_do_start_line .La_start_line: - cmpl %edi,%esi - jge .La_start_ok - movl %eax,(%ecx) - addl $4,%ecx - movl %edx,%esi - - leal 4(%esi),%edx - cmpl %edx,SYM(diwfirstword) - jg .La_start_line -.La_start_ok: - movl %ecx,SYM(xlinebuffer) - - cmpl $0,SYM(bplham) - je .La_noham - cmpl $6,SYM(bplplanecnt) - jne .La_noham - - /* HAM 6 */ - movl SYM(xlinebuffer),%ebp - xorl %edx,%edx -.La_hamloop: - cmpl %esi,SYM(diwlastword) - jle .La_hamend - cmpl %edi,%esi - jge .La_hamend - + movl %eax,(%ecx,%esi) + addl $4,%esi +.La_do_start_line: + cmpl %esi,%edi + jnbe .La_start_line + + call %ebx + + /* Finish off the line */ + + movl SYM(xlinebuffer),%ecx + movl 36(%esp),%edi /* stoppos */ + movl SYM(colors_for_drawing),%edx + movb %dl,%dh + movw %dx,%ax + sall $16,%eax + movw %dx,%ax + jmp .La_do_end_line +.La_end_line: + movl %eax,(%ecx,%esi) + addl $4,%esi +.La_do_end_line: + cmpl %esi,%edi + jnbe .La_end_line + + popl %ebx + popl %esi + popl %edi + popl %ebp + ret + + .globl pfield_linetoscr_ham6_asm8 + .type pfield_linetoscr_ham6_asm8,@function + FUNCTION_ALIGN +pfield_linetoscr_ham6_asm8: + movl 36(%esp),%edi /* diw_end */ +.Laa_hamloop: + cmpl %esi,%edi + jbe .Laa_hamend + movl SYM(ham_linebuf)+12(,%esi,4),%eax - movb SYM(xcolors)(,%eax,4),%bl - movl SYM(ham_linebuf)+8(,%esi,4),%eax movb SYM(xcolors)(,%eax,4),%bh - bswapl %ebx + movl SYM(ham_linebuf)+8(,%esi,4),%eax + movb SYM(xcolors)(,%eax,4),%bl + sall $16,%ebx movl SYM(ham_linebuf)+4(,%esi,4),%eax movb SYM(xcolors)(,%eax,4),%bh movl SYM(ham_linebuf)(,%esi,4),%eax movb SYM(xcolors)(,%eax,4),%bl - movl %ebx,(%ebp) - addl $4,%ebp + movl %ebx,(%ecx,%esi) addl $4,%esi - jmp .La_hamloop + jmp .Laa_hamloop -.La_hamend: - movl %ebp,SYM(xlinebuffer) - jmp .La_finish_line - -.La_noham: - cmpl $0,SYM(bpldualpf) - je .La_normal - - /* Dual Playfield */ - - xorl %edx,%edx - - movl $SYM(dblpf_ind1),%ebp - cmpl $0,SYM(bpldualpfpri) - je .La_dp_loop - movl $SYM(dblpf_ind2),%ebp -.La_dp_loop: - cmpl %esi,SYM(diwlastword) - jle .La_finish_line - - cmpl %edi,%esi - jge .La_finish_line +.Laa_hamend: + ret + .globl pfield_linetoscr_dualpf_asm8 + .type pfield_linetoscr_dualpf_asm8,@function + FUNCTION_ALIGN +pfield_linetoscr_dualpf_asm8: + xorl %edx,%edx + movl 44(%esp),%ebp /* lookup_no */ +.Lab_dp_loop: + movl 36(%esp),%eax /* diw_end */ xorl %edx,%edx + cmpl %esi,%eax + jbe .La_dp_done + movl SYM(pixdata)(%esi),%eax movl SYM(spixstate)(%esi),%ebx testl %ebx,%ebx - jne .La_dp_sprites + jne .Lab_dp_sprites /* no sprites */ - - movb %al,%dl - movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%cl - movb %ah,%dl - movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%ch + + BYTE_MOVE %al,BYTE_REG(%edx,%dl) + BYTE_MOVE (%ebp,%edx,4),BYTE_REG(%edx,%dl) + movb SYM(colors_for_drawing)(,%edx,4),%cl + BYTE_MOVE %ah,BYTE_REG(%edx,%dl) + BYTE_MOVE (%ebp,%edx,4),BYTE_REG(%edx,%dl) + movb SYM(colors_for_drawing)(,%edx,4),%ch bswapl %eax bswapl %ecx - movb %al,%dl - movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%cl - movb %ah,%dl - movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%ch + BYTE_MOVE %al,BYTE_REG(%edx,%dl) + BYTE_MOVE (%ebp,%edx,4),BYTE_REG(%edx,%dl) + movb SYM(colors_for_drawing)(,%edx,4),%cl + BYTE_MOVE %ah,BYTE_REG(%edx,%dl) + BYTE_MOVE (%ebp,%edx,4),BYTE_REG(%edx,%dl) + movb SYM(colors_for_drawing)(,%edx,4),%ch bswapl %ecx movl SYM(xlinebuffer),%eax - movl %ecx,(%eax) - addl $4,SYM(xlinebuffer) + movl %ecx,(%eax,%esi) addl $4,%esi - jmp .La_dp_loop + jmp .Lab_dp_loop -.La_dp_sprites: - +.Lab_dp_sprites: /* dual playfield with sprites */ movb %al,%dl testb %bl,%bl je .La3 - movb SYM(acolors)(,%edx,4),%cl + movb SYM(colors_for_drawing)(,%edx,4),%cl jmp .La1 .La3: movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%cl + movb SYM(colors_for_drawing)(,%edx,4),%cl .La1: - movb %ah,%dl testb %bh,%bh je .La6 - movb SYM(acolors)(,%edx,4),%ch + movb SYM(colors_for_drawing)(,%edx,4),%ch jmp .La4 .La6: movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%ch + movb SYM(colors_for_drawing)(,%edx,4),%ch .La4: bswapl %ecx bswapl %eax @@ -175,358 +172,518 @@ pfield_linetoscr_full8: movb %al,%dl testb %bl,%bl je .La9 - movb SYM(acolors)(,%edx,4),%cl + movb SYM(colors_for_drawing)(,%edx,4),%cl jmp .La7 .La9: movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%cl + movb SYM(colors_for_drawing)(,%edx,4),%cl .La7: movb %ah,%dl testb %bh,%bh je .La12 - movb SYM(acolors)(,%edx,4),%ch + movb SYM(colors_for_drawing)(,%edx,4),%ch jmp .La10 .La12: movb (%ebp,%edx,4),%dl - movb SYM(acolors)(,%edx,4),%ch + movb SYM(colors_for_drawing)(,%edx,4),%ch .La10: - addl $4,%esi - bswapl %ecx movl SYM(xlinebuffer),%eax - movl %ecx,(%eax) - addl $4,SYM(xlinebuffer) - - jmp .La_dp_loop - - /* normal case */ -.La_normal: + movl %ecx,(%eax,%esi) + addl $4,%esi + jmp .Lab_dp_loop + +.La_dp_done: + ret + + .globl pfield_linetoscr_ehb_asm8 + .type pfield_linetoscr_ehb_asm8,@function + FUNCTION_ALIGN +pfield_linetoscr_ehb_asm8: xorl %edx,%edx movl SYM(xlinebuffer),%ebx -.La_normal_loop: - cmpl %esi,SYM(diwlastword) - jle .La_normal_end - cmpl %edi,%esi - jge .La_normal_end +.La_ehb_loop: + movl 36(%esp),%edi /* diw_end */ + cmpl %esi,%edi + jbe .La_ehb_end movl SYM(pixdata)(%esi),%eax - - movb %al,%dl - movb SYM(acolors)(,%edx,4),%cl - movb %ah,%dl - movb SYM(acolors)(,%edx,4),%ch - bswapl %eax - bswapl %ecx - movb %al,%dl - movb SYM(acolors)(,%edx,4),%cl - movb %ah,%dl - movb SYM(acolors)(,%edx,4),%ch - bswapl %ecx - - movl %ecx,(%ebx) - addl $4,%ebx + BYTE_MOVE %al,BYTE_REG(%edx,%dl) + cmpb $32,%al + movb SYM(colors_for_drawing)(,%edx,4),%cl + jc .La_ehb1 + movw SYM(colors_for_drawing)+32*4-32*2(,%edx,2),%di + shrl $1,%edi + andl $0x777,%edi + movb SYM(xcolors)(,%edi,4),%cl +.La_ehb1: + BYTE_MOVE %ah,BYTE_REG(%edx,%dl) + cmpb $32,%ah + movb SYM(colors_for_drawing)(,%edx,4),%ch + jc .La_ehb2 + movw SYM(colors_for_drawing)+32*4-32*2(,%edx,2),%di + shrl $1,%edi + andl $0x777,%edi + movb SYM(xcolors)(,%edi,4),%ch +.La_ehb2: + sarl $16,%eax + sall $16,%ecx + BYTE_MOVE %al,BYTE_REG(%edx,%dl) + cmpb $32,%al + movb SYM(colors_for_drawing)(,%edx,4),%cl + jc .La_ehb3 + movw SYM(colors_for_drawing)+32*4-32*2(,%edx,2),%di + shrl $1,%edi + andl $0x777,%edi + movb SYM(xcolors)(,%edi,4),%cl +.La_ehb3: + BYTE_MOVE %ah,BYTE_REG(%edx,%dl) + cmpb $32,%ah + movb SYM(colors_for_drawing)(,%edx,4),%ch + jc .La_ehb4 + movw SYM(colors_for_drawing)+32*4-32*2(,%edx,2),%di + shrl $1,%edi + andl $0x777,%edi + movb SYM(xcolors)(,%edi,4),%ch +.La_ehb4: + roll $16,%ecx + + movl %ecx,(%ebx,%esi) addl $4,%esi - jmp .La_normal_loop + jmp .La_ehb_loop -.La_normal_end: - movl %ebx,SYM(xlinebuffer) +.La_ehb_end: + ret -.La_finish_line: - /* Finish off the line */ - - movl SYM(acolors),%edx - movb %dl,%dh - movw %dx,%ax - bswapl %eax - movw %dx,%ax - - movl SYM(xlinebuffer),%ecx -.La_fin_loop: - cmpl %edi,%esi - jge .La_fin_end - - movl %eax,(%ecx) - addl $4,%ecx + .globl pfield_linetoscr_normal_asm8 + .type pfield_linetoscr_normal_asm8,@function + FUNCTION_ALIGN +pfield_linetoscr_normal_asm8: + xorl %edx,%edx + xorl %ebx,%ebx + movl 36(%esp),%edi /* diw_end */ + movl SYM(xlinebuffer),%ebp + jmp .La_normal_doloop + FUNCTION_ALIGN +.La_normal_loop: + BYTE_MOVE SYM(pixdata)(%esi),BYTE_REG(%edx,%dl) + BYTE_MOVE SYM(pixdata)+4(%esi),BYTE_REG(%ebx,%bl) + movb SYM(colors_for_drawing)(,%edx,4),%cl + movb SYM(colors_for_drawing)(,%ebx,4),%al + BYTE_MOVE SYM(pixdata)+1(%esi),BYTE_REG(%edx,%dl) + BYTE_MOVE SYM(pixdata)+5(%esi),BYTE_REG(%ebx,%bl) + movb SYM(colors_for_drawing)(,%edx,4),%ch + movb SYM(colors_for_drawing)(,%ebx,4),%ah + + sall $16,%ecx + BYTE_MOVE SYM(pixdata)+2(%esi),BYTE_REG(%edx,%dl) + sall $16,%eax + + BYTE_MOVE SYM(pixdata)+6(%esi),BYTE_REG(%ebx,%bl) + movb SYM(colors_for_drawing)(,%edx,4),%cl + movb SYM(colors_for_drawing)(,%ebx,4),%al + BYTE_MOVE SYM(pixdata)+3(%esi),BYTE_REG(%edx,%dl) + BYTE_MOVE SYM(pixdata)+7(%esi),BYTE_REG(%ebx,%bl) + movb SYM(colors_for_drawing)(,%edx,4),%ch addl $4,%esi - jmp .La_fin_loop + roll $16,%ecx + movb SYM(colors_for_drawing)(,%ebx,4),%ah + roll $16,%eax + + movl %ecx,-4(%ebp,%esi) + cmpl %esi,%edi + jbe .La_normal_end + movl %eax,(%ebp,%esi) + addl $4,%esi +.La_normal_doloop: + cmpl %esi,%edi + jnbe .La_normal_loop -.La_fin_end: - movl %ecx,SYM(xlinebuffer) - - popl %ebx - popl %esi - popl %edi - popl %ebp - ret +.La_normal_end: + ret -#ifndef __DOS__ - .align 16 -#else - .align 8 -#endif -.globl pfield_linetoscr_full16 -pfield_linetoscr_full16: + .globl pfield_linetoscr_hdouble_asm8 + .type pfield_linetoscr_hdouble_asm8,@function + FUNCTION_ALIGN +pfield_linetoscr_hdouble_asm8: + shrl $1,%esi + xorl %edx,%edx + xorl %ebx,%ebx + movl 36(%esp),%edi /* diw_end */ + shrl $1,%edi + movl SYM(xlinebuffer),%ebp + jmp .La_hdouble_doloop + FUNCTION_ALIGN +.La_hdouble_loop: + BYTE_MOVE SYM(pixdata)+1(%esi),BYTE_REG(%edx,%dl) + BYTE_MOVE SYM(pixdata)+3(%esi),BYTE_REG(%ebx,%bl) + movb SYM(colors_for_drawing)(,%edx,4),%cl + movb SYM(colors_for_drawing)(,%ebx,4),%al + BYTE_MOVE SYM(pixdata)+0(%esi),BYTE_REG(%edx,%dl) + movb %cl,%ch + BYTE_MOVE SYM(pixdata)+2(%esi),BYTE_REG(%ebx,%bl) + movb %al,%ah + sall $16,%ecx + movb SYM(colors_for_drawing)(,%edx,4),%cl + sall $16,%eax + movb SYM(colors_for_drawing)(,%ebx,4),%al + addl $2,%esi + movb %cl,%ch + movb %al,%ah + + movl %ecx,-4(%ebp,%esi,2) + cmpl %esi,%edi + jbe .La_hdouble_end + movl %eax,(%ebp,%esi,2) + addl $2,%esi +.La_hdouble_doloop: + cmpl %esi,%edi + jnbe .La_hdouble_loop + +.La_hdouble_end: + addl %esi,%esi + ret + +/* 16 bit functions */ + + .globl pfield_linetoscr_asm16 + .type pfield_linetoscr_asm16,@function + FUNCTION_ALIGN +pfield_linetoscr_asm16: pushl %ebp pushl %edi pushl %esi pushl %ebx + movl 24(%esp),%esi /* start */ + movl 28(%esp),%edi /* lframe_end */ - movl 20(%esp),%esi - movl 24(%esp),%edi - - xorl %edx,%edx - movl SYM(diwfirstword),%eax - cmpl $4,%eax - jc .Lboops1 - movl %edx,SYM(pixdata)-4(%eax) - movl %edx,SYM(spixstate)-4(%eax) -.Lboops1: - movl SYM(diwlastword),%eax - movl %edx,SYM(pixdata)(%eax) - movl %edx,SYM(spixstate)(%eax) - - movl SYM(acolors),%edx - movw %dx,%ax + movl SYM(colors_for_drawing),%eax + movl %eax,%edx sall $16,%eax movw %dx,%ax + movl 20(%esp),%ebx movl SYM(xlinebuffer),%ecx - leal 4(%esi),%edx - cmpl %edx,SYM(diwfirstword) - jle .Lb_start_ok + jmp .Lb_do_start_line .Lb_start_line: - cmpl %edi,%esi - jge .Lb_start_ok - movl %eax,(%ecx) - movl %eax,4(%ecx) - addl $8,%ecx - movl %edx,%esi - - leal 4(%esi),%edx - cmpl %edx,SYM(diwfirstword) - jg .Lb_start_line -.Lb_start_ok: - movl %ecx,SYM(xlinebuffer) - - cmpl $0,SYM(bplham) - je .Lb_noham - cmpl $6,SYM(bplplanecnt) - jne .Lb_noham - - /* HAM 6 */ - movl SYM(xlinebuffer),%ebp - xorl %edx,%edx + movl %eax,(%ecx,%esi,2) + movl %eax,4(%ecx,%esi,2) + addl $4,%esi +.Lb_do_start_line: + cmpl %esi,%edi + jnbe .Lb_start_line + + call %ebx + + /* Finish off the line */ + + movl SYM(xlinebuffer),%ecx + movl 36(%esp),%edi /* stoppos */ + movl SYM(colors_for_drawing),%eax + movl %eax,%edx + sall $16,%eax + movw %dx,%ax + jmp .Lb_do_end_line +.Lb_end_line: + movl %eax,(%ecx,%esi,2) + movl %eax,4(%ecx,%esi,2) + addl $4,%esi +.Lb_do_end_line: + cmpl %esi,%edi + jnbe .Lb_end_line + + popl %ebx + popl %esi + popl %edi + popl %ebp + ret + + .globl pfield_linetoscr_ham6_asm16 + .type pfield_linetoscr_ham6_asm16,@function + FUNCTION_ALIGN +pfield_linetoscr_ham6_asm16: + movl 36(%esp),%edi /* diw_end */ .Lb_hamloop: - cmpl %esi,SYM(diwlastword) - jle .Lb_hamend - cmpl %edi,%esi - jge .Lb_hamend + cmpl %esi,%edi + jbe .Lb_hamend movl SYM(ham_linebuf)+4(,%esi,4),%eax - movw SYM(xcolors)(,%eax,4),%bx + movl SYM(xcolors)(,%eax,4),%ebx sall $16,%ebx movl SYM(ham_linebuf)(,%esi,4),%eax movw SYM(xcolors)(,%eax,4),%bx - movl %ebx,(%ebp) + movl %ebx,(%ecx,%esi,2) movl SYM(ham_linebuf)+12(,%esi,4),%eax - movw SYM(xcolors)(,%eax,4),%bx + movl SYM(xcolors)(,%eax,4),%ebx sall $16,%ebx movl SYM(ham_linebuf)+8(,%esi,4),%eax movw SYM(xcolors)(,%eax,4),%bx - movl %ebx,4(%ebp) - addl $8,%ebp + movl %ebx,4(%ecx,%esi,2) + addl $4,%esi jmp .Lb_hamloop - .Lb_hamend: - movl %ebp,SYM(xlinebuffer) - jmp .Lb_finish_line - -.Lb_noham: - cmpl $0,SYM(bpldualpf) - je .Lb_normal - - /* Dual Playfield */ - - xorl %edx,%edx - movl $SYM(dblpf_ind1),%ebp - cmpl $0,SYM(bpldualpfpri) - je .Lb_dp_loop - movl $SYM(dblpf_ind2),%ebp -.Lb_dp_loop: - cmpl %esi,SYM(diwlastword) - jle .Lb_finish_line - - cmpl %edi,%esi - jge .Lb_finish_line + ret + .globl pfield_linetoscr_dualpf_asm16 + .type pfield_linetoscr_dualpf_asm16,@function + FUNCTION_ALIGN +pfield_linetoscr_dualpf_asm16: + movl 44(%esp),%ebp /* lookup_no */ +.Lb_dp_loop: + movl 36(%esp),%eax /* diw_end */ xorl %edx,%edx + cmpl %esi,%eax + jbe .Lb_dp_done + movl SYM(pixdata)(%esi),%eax movl SYM(spixstate)(%esi),%ebx testl %ebx,%ebx jne .Lb_dp_sprites /* no sprites */ - - movl SYM(xlinebuffer),%ebx + + movl SYM(xlinebuffer),%ebx movb %ah,%dl movb (%ebp,%edx,4),%dl - movw SYM(acolors)(,%edx,4),%cx + movl SYM(colors_for_drawing)(,%edx,4),%ecx sall $16,%ecx movb %al,%dl movb (%ebp,%edx,4),%dl - movw SYM(acolors)(,%edx,4),%cx - - movl %ecx,(%ebx) - - bswapl %eax - - movb %al,%dl + movw SYM(colors_for_drawing)(,%edx,4),%cx + sarl $16,%eax + movl %ecx,(%ebx,%esi,2) + movb %ah,%dl movb (%ebp,%edx,4),%dl - movw SYM(acolors)(,%edx,4),%cx + movl SYM(colors_for_drawing)(,%edx,4),%ecx + movb %al,%dl sall $16,%ecx - movb %ah,%dl movb (%ebp,%edx,4),%dl - movw SYM(acolors)(,%edx,4),%cx - - movl %ecx,4(%ebx) - addl $8,SYM(xlinebuffer) + movw SYM(colors_for_drawing)(,%edx,4),%cx + movl %ecx,4(%ebx,%esi,2) + addl $4,%esi jmp .Lb_dp_loop .Lb_dp_sprites: - /* dual playfield with sprites */ movb %ah,%dl testb %bh,%bh je .Lb3 - movw SYM(acolors)(,%edx,4),%cx + movl SYM(colors_for_drawing)(,%edx,4),%ecx jmp .Lb1 .Lb3: movb (%ebp,%edx,4),%dl - movw SYM(acolors)(,%edx,4),%cx + movl SYM(colors_for_drawing)(,%edx,4),%ecx .Lb1: sall $16,%ecx - movb %al,%dl + sarl $16,%eax testb %bl,%bl je .Lb6 - movw SYM(acolors)(,%edx,4),%cx + movw SYM(colors_for_drawing)(,%edx,4),%cx jmp .Lb4 .Lb6: movb (%ebp,%edx,4),%dl - mov SYM(acolors)(,%edx,4),%cx + movw SYM(colors_for_drawing)(,%edx,4),%cx .Lb4: - movl SYM(xlinebuffer),%edx - movl %ecx,(%edx) - xorl %edx,%edx - - bswapl %eax - bswapl %ebx + movl SYM(xlinebuffer),%edi + sarl $16,%ebx + movl %ecx,(%edi,%esi,2) - movb %al,%dl - testb %bl,%bl + movb %ah,%dl + testb %bh,%bh je .Lb9 - movw SYM(acolors)(,%edx,4),%cx + movl SYM(colors_for_drawing)(,%edx,4),%ecx jmp .Lb7 .Lb9: movb (%ebp,%edx,4),%dl - movw SYM(acolors)(,%edx,4),%cx + movl SYM(colors_for_drawing)(,%edx,4),%ecx .Lb7: sall $16,%ecx - - movb %ah,%dl - testb %bh,%bh + movb %al,%dl + testb %bl,%bl je .Lb12 - movw SYM(acolors)(,%edx,4),%cx + movw SYM(colors_for_drawing)(,%edx,4),%cx jmp .Lb10 .Lb12: movb (%ebp,%edx,4),%dl - movw SYM(acolors)(,%edx,4),%cx + movw SYM(colors_for_drawing)(,%edx,4),%cx .Lb10: - addl $4,%esi - movl SYM(xlinebuffer),%eax - movl %ecx,4(%eax) - addl $8,SYM(xlinebuffer) - + movl %ecx,4(%eax,%esi,2) + addl $4,%esi jmp .Lb_dp_loop - - /* normal case */ -.Lb_normal: + +.Lb_dp_done: + ret + + .globl pfield_linetoscr_ehb_asm16 + .type pfield_linetoscr_ehb_asm16,@function + FUNCTION_ALIGN +pfield_linetoscr_ehb_asm16: xorl %edx,%edx - movl SYM(xlinebuffer),%ebx -.Lb_normal_loop: - cmpl %esi,SYM(diwlastword) - jle .Lb_normal_end - cmpl %edi,%esi - jge .Lb_normal_end + xorl %ebx,%ebx +.Lb_ehb_loop: + movl 36(%esp),%edi /* diw_end */ + cmpl %esi,%edi + jbe .Lb_ehb_end movl SYM(pixdata)(%esi),%eax - - movb %ah,%dl - movw SYM(acolors)(,%edx,4),%cx + movb %ah,%bl + cmpb $32,%ah + movl SYM(colors_for_drawing)(,%ebx,4),%ecx + jc .Lb_ehb2 + movw SYM(colors_for_drawing)+32*4-32*2(,%ebx,2),%di + shrl $1,%edi + andl $0x777,%edi + movl SYM(xcolors)(,%edi,4),%ecx +.Lb_ehb2: sall $16,%ecx movb %al,%dl - movw SYM(acolors)(,%edx,4),%cx - movl %ecx,(%ebx) - bswapl %eax - movb %al,%dl - movw SYM(acolors)(,%edx,4),%cx + movw SYM(colors_for_drawing)(,%edx,4),%cx + cmpb $32,%al + jc .Lb_ehb1 + + movw SYM(colors_for_drawing)+32*4-32*2(,%edx,2),%di + shrl $1,%edi + andl $0x777,%edi + movw SYM(xcolors)(,%edi,4),%cx +.Lb_ehb1: + movl SYM(xlinebuffer),%edi + sarl $16,%eax + movl %ecx,(%edi,%esi,2) + movb %ah,%bl + movl SYM(colors_for_drawing)(,%ebx,4),%ecx + cmpb $32,%ah + jc .Lb_ehb4 + + movw SYM(colors_for_drawing)+32*4-32*2(,%ebx,2),%di + shrl $1,%edi + andl $0x777,%edi + movl SYM(xcolors)(,%edi,4),%ecx +.Lb_ehb4: sall $16,%ecx - movb %ah,%dl - movw SYM(acolors)(,%edx,4),%cx - movl %ecx,4(%ebx) - - addl $8,%ebx + movb %al,%dl + movw SYM(colors_for_drawing)(,%edx,4),%cx + cmpb $32,%al + jc .Lb_ehb3 + + movw SYM(colors_for_drawing)+32*4-32*2(,%edx,2),%di + shrl $1,%edi + andl $0x777,%edi + movw SYM(xcolors)(,%edi,4),%cx +.Lb_ehb3: + + movl SYM(xlinebuffer),%edi + movl %ecx,4(%edi,%esi,2) addl $4,%esi - jmp .Lb_normal_loop + jmp .Lb_ehb_loop -.Lb_normal_end: - movl %ebx,SYM(xlinebuffer) +.Lb_ehb_end: + ret -.Lb_finish_line: - /* Finish off the line */ - - movw SYM(acolors),%edx - movw %dx,%ax + .globl pfield_linetoscr_normal_asm16 + .type pfield_linetoscr_normal_asm16,@function + FUNCTION_ALIGN +pfield_linetoscr_normal_asm16: + movl 36(%esp),%edi /* diw_end */ + jmp .Lb_normal_doloop + + FUNCTION_ALIGN +.Lb_normal_loop: + xorl %edx,%edx + BYTE_MOVE SYM(pixdata)+1(%esi),BYTE_REG(%edx,%dl) + xorl %ebx,%ebx + BYTE_MOVE SYM(pixdata)+5(%esi),BYTE_REG(%ebx,%bl) + + movl SYM(colors_for_drawing)(,%edx,4),%edi + movl SYM(colors_for_drawing)(,%ebx,4),%ecx + sall $16,%edi + BYTE_MOVE SYM(pixdata)+0(%esi),BYTE_REG(%edx,%dl) + sall $16,%ecx + BYTE_MOVE SYM(pixdata)+4(%esi),BYTE_REG(%ebx,%bl) + movw SYM(colors_for_drawing)(,%edx,4),%di + movw SYM(colors_for_drawing)(,%ebx,4),%cx + BYTE_MOVE SYM(pixdata)+3(%esi),BYTE_REG(%edx,%dl) + BYTE_MOVE SYM(pixdata)+7(%esi),BYTE_REG(%ebx,%bl) + movl SYM(colors_for_drawing)(,%edx,4),%eax + movl SYM(colors_for_drawing)(,%ebx,4),%ebp sall $16,%eax - movw %dx,%ax - - movl SYM(xlinebuffer),%ecx -.Lb_fin_loop: - cmpl %edi,%esi - jge .Lb_fin_end - - movl %eax,(%ecx) - movl %eax,4(%ecx) - addl $8,%ecx + BYTE_MOVE SYM(pixdata)+2(%esi),BYTE_REG(%edx,%dl) + sall $16,%ebp + BYTE_MOVE SYM(pixdata)+6(%esi),BYTE_REG(%ebx,%bl) + movw SYM(colors_for_drawing)(,%edx,4),%ax addl $4,%esi - jmp .Lb_fin_loop + movw SYM(colors_for_drawing)(,%ebx,4),%bp -.Lb_fin_end: - movl %ecx,SYM(xlinebuffer) - - popl %ebx - popl %esi - popl %edi - popl %ebp - ret + movl SYM(xlinebuffer),%ebx + movl %edi,-8(%ebx,%esi,2) + movl 36(%esp),%edi + movl %eax,-4(%ebx,%esi,2) + + cmpl %esi,%edi + jbe .Lb_normal_done + + movl %ecx,(%ebx,%esi,2) + movl %ebp,4(%ebx,%esi,2) + + addl $4,%esi +.Lb_normal_doloop: + cmpl %esi,%edi + jnbe .Lb_normal_loop + +.Lb_normal_done: + ret + + .globl pfield_linetoscr_hdouble_asm16 + .type pfield_linetoscr_hdouble_asm16,@function + FUNCTION_ALIGN +pfield_linetoscr_hdouble_asm16: + shrl $1,%esi + movl 36(%esp),%eax /* diw_end */ + shrl $1,%eax + movl SYM(xlinebuffer),%ebp + jmp .Lb_hdouble_doloop + + FUNCTION_ALIGN +.Lb_hdouble_loop: + xorl %edx,%edx + BYTE_MOVE SYM(pixdata)(%esi),BYTE_REG(%edx,%dl) + xorl %ebx,%ebx + BYTE_MOVE SYM(pixdata)+1(%esi),BYTE_REG(%ebx,%bl) - .ident "Crux CC 3.14.15" + movl SYM(colors_for_drawing)(,%edx,4),%edi + movl SYM(colors_for_drawing)(,%ebx,4),%ecx + movl %edi,%edx + movl %ecx,%ebx + sall $16,%edi + andl $0xFFFF,%edx + sall $16,%ecx + andl $0xFFFF,%ebx + addl $2,%esi + orl %edx,%edi + orl %ebx,%ecx + movl %edi,-8(%ebp,%esi,4) + movl %ecx,-4(%ebp,%esi,4) + +.Lb_hdouble_doloop: + cmpl %esi,%eax + jnbe .Lb_hdouble_loop + +.Lb_hdouble_done: + addl %esi,%esi + ret -#ifndef __DOS__ - .align 16 -.globl DitherLine + .globl DitherLine +#ifndef USE_UNDERSCORE .type DitherLine,@function -#else - .align 8 -.globl DitherLine #endif + FUNCTION_ALIGN DitherLine: pushl %ebp pushl %edi @@ -608,25 +765,22 @@ DitherLine: .Li_fast: movl 24(%esp),%esi xorl %edx,%edx + xorl %ecx,%ecx + FUNCTION_ALIGN .Li_fast_loop: - movl (%esi),%ecx - movw %cx,%dx - movb (%edx,%ebp),%al - - sarl $16,%ecx - movw %cx,%dx - movb 4096(%ebp,%edx),%ah - bswapl %eax + movw (%esi),%edx + movw 2(%esi),%cx + movb (%edx,%ebp),%al + movw 4(%esi),%dx + movb 4096(%ebp,%ecx),%ah + + movw 6(%esi),%cx + sall $16,%eax + movb 8192(%ebp,%edx),%al - movl 4(%esi),%ecx - movw %cx,%dx - movb 8192(%ebp,%edx),%ah - - sarl $16,%ecx - movw %cx,%dx - movb 12288(%ebp,%edx),%al + movb 12288(%ebp,%ecx),%ah - bswapl %eax + roll $16,%eax movl %eax,(%edi) addl $4,%edi addl $8,%esi @@ -640,3 +794,98 @@ DitherLine: popl %edi popl %ebp ret +#if 0 +.globl compiler_do_rts + /* Entry: EDX == regs.regs + 15 */ +compiler_do_rts: + movl (%edx),%esi + addl address_space,%esi + movl jsr_num,%ecx + movl (%esi),%esi + orl %ecx,%ecx + bswapl %esi + jz cdrts_noway + decl %ecx + cmpl jsr_rets(,%ecx,4),%esi + jne cdrts_noway + movl jsr_hash(,%ecx,4),%ebx + movl (%ebx),%ebx + orl %ebx,%ebx + jz cdrts_noway + addl $4,(%edx) + movl %ecx,jsr_num + jmp %ebx +cdrts_noway: + ret +#endif +#if 0 +.globl longget_stub +longget_stub: + pushl %ecx + pushl %eax + pushl %edx + call SYM(longget) + popl %ecx + movl %eax,%ecx + popl %eax + ret + +.globl wordget_stub +wordget_stub: + pushl %ecx + pushl %eax + pushl %edx + call SYM(wordget) + popl %ecx + movl %eax,%ecx + popl %eax + ret + +.globl byteget_stub +byteget_stub: + pushl %ecx + pushl %eax + pushl %edx + call SYM(byteget) + popl %ecx + movl %eax,%ecx + popl %eax + ret + +.globl longput_stub +longput_stub: + pushl %ecx + pushl %eax + pushl %ebx + pushl %edx + call SYM(longput) + movl %eax,%ecx + addl $8,%esp + popl %eax + ret + +.globl wordput_stub +wordput_stub: + pushl %ecx + pushl %eax + pushl %ebx + pushl %edx + call SYM(wordput) + movl %eax,%ecx + addl $8,%esp + popl %eax + ret + +.globl byteput_stub +byteput_stub: + pushl %ecx + pushl %eax + pushl %ebx + pushl %edx + call SYM(byteput) + movl %eax,%ecx + addl $8,%esp + popl %eax + ret +#endif + .ident "Crux CC 3.14.15"