📄 spr16x16_8.s
字号:
#include "asmdefs.inc"CODE_SEG/******************************************************************************//* *//* RAINE 16x16 TILE DRAWING *//* *//******************************************************************************//*MappedTransparent MappedDirect-MappedTransparent Direct-Mapped*/FUNC(Draw16x16_Mapped) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $16*16,%edx // tile end pushl %ebp pushl %edi pushl %esi pushl %ebx movl %edx,endc_00-4 movl 20(%esp),%esi // source movl 32(%esp),%ebp // cmap movl 0xDEADBEEF(%eax),%ediblin_00: addl 24(%esp),%edi // x jmp 9f //xorl %eax,%eax // No! It's not the good way to do fast things. //xorl %ebx,%ebx // I know that it could appears strange, but the //xorl %ecx,%ecx // best thing to do is to zeroing registers just //xorl %edx,%edx // 1 cycle before to use them as 8bits registers..align 89: xorl %eax,%eax xorl %ebx,%ebx movb (%esi),%al movb 4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 1(%esi),%cl movb 5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,(%edi) movb %bl,4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,1(%edi) movb %dl,5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 2(%esi),%al movb 6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 3(%esi),%cl movb 7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,2(%edi) movb %bl,6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,3(%edi) movb %dl,7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 8(%esi),%al movb 12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 9(%esi),%cl movb 13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,8(%edi) movb %bl,12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,9(%edi) movb %dl,13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 10(%esi),%al movb 14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 11(%esi),%cl movb 15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,10(%edi) movb %bl,14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,11(%edi) movb %dl,15(%edi) addl $16,%esi // Next Tile Line addl $0xDEADBEEF,%edi // Next Screen Linebitw_00: cmp $0xDEADBEEF,%esiendc_00: jne 9b popl %ebx popl %esi popl %edi popl %ebp ret // Arg ! I have nothing rest to pair with the ret // instruction : Here is a waste of 1/2 cycle ... :-)FUNC(Draw16x16_Mapped_FlipY) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $16*16,%edx // tile end pushl %ebp pushl %edi pushl %esi pushl %ebx movl %edx,endc_01-4 movl 20(%esp),%esi // source movl 32(%esp),%ebp // cmap movl 0xDEADBEEF(%eax),%ediblin_01: addl 24(%esp),%edi // x jmp 9f //xorl %eax,%eax // No! It's not the good way to do fast things. //xorl %ebx,%ebx // I know that it could appears strange, but the //xorl %ecx,%ecx // best thing to do is to zeroing registers just //xorl %edx,%edx // 1 cycle before to use them as 8bits registers..align 89: xorl %eax,%eax xorl %ebx,%ebx movb (%esi),%al movb 4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 1(%esi),%cl movb 5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-0(%edi) movb %bl,15-4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-1(%edi) movb %dl,15-5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 2(%esi),%al movb 6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 3(%esi),%cl movb 7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-2(%edi) movb %bl,15-6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-3(%edi) movb %dl,15-7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 8(%esi),%al movb 12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 9(%esi),%cl movb 13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-8(%edi) movb %bl,15-12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-9(%edi) movb %dl,15-13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 10(%esi),%al movb 14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 11(%esi),%cl movb 15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-10(%edi) movb %bl,15-14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-11(%edi) movb %dl,15-15(%edi) addl $16,%esi // Next Tile Line addl $0xDEADBEEF,%edi // Next Screen Linebitw_01: cmp $0xDEADBEEF,%esiendc_01: jne 9b popl %ebx popl %esi popl %edi popl %ebp ret // Arg ! I have nothing rest to pair with the ret // instruction : Here is a waste of 1/2 cycle ... :-)FUNC(Draw16x16_Mapped_FlipX) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $16*16,%edx // tile end pushl %ebp pushl %edi pushl %esi pushl %ebx movl %edx,endc_02-4 movl 20(%esp),%esi // source movl 32(%esp),%ebp // cmap movl 0xDEADBEEF(%eax),%ediblin_02: addl 24(%esp),%edi // x jmp 9f //xorl %eax,%eax // No! It's not the good way to do fast things. //xorl %ebx,%ebx // I know that it could appears strange, but the //xorl %ecx,%ecx // best thing to do is to zeroing registers just //xorl %edx,%edx // 1 cycle before to use them as 8bits registers..align 89: xorl %eax,%eax xorl %ebx,%ebx movb (%esi),%al movb 4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 1(%esi),%cl movb 5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,(%edi) movb %bl,4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,1(%edi) movb %dl,5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 2(%esi),%al movb 6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 3(%esi),%cl movb 7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,2(%edi) movb %bl,6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,3(%edi) movb %dl,7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 8(%esi),%al movb 12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 9(%esi),%cl movb 13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,8(%edi) movb %bl,12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,9(%edi) movb %dl,13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 10(%esi),%al movb 14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 11(%esi),%cl movb 15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,10(%edi) movb %bl,14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,11(%edi) movb %dl,15(%edi) addl $16,%esi // Next Tile Line subl $0xDEADBEEF,%edi // Next Screen Linebitw_02: cmp $0xDEADBEEF,%esiendc_02: jne 9b popl %ebx popl %esi popl %edi popl %ebp ret // Arg ! I have nothing rest to pair with the ret // instruction : Here is a waste of 1/2 cycle ... :-)FUNC(Draw16x16_Mapped_FlipXY) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $16*16,%edx // tile end pushl %ebp pushl %edi pushl %esi pushl %ebx movl %edx,endc_03-4 movl 20(%esp),%esi // source movl 32(%esp),%ebp // cmap movl 0xDEADBEEF(%eax),%ediblin_03: addl 24(%esp),%edi // x jmp 9f //xorl %eax,%eax // No! It's not the good way to do fast things. //xorl %ebx,%ebx // I know that it could appears strange, but the //xorl %ecx,%ecx // best thing to do is to zeroing registers just //xorl %edx,%edx // 1 cycle before to use them as 8bits registers..align 89: xorl %eax,%eax xorl %ebx,%ebx movb (%esi),%al movb 4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 1(%esi),%cl movb 5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-0(%edi) movb %bl,15-4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-1(%edi) movb %dl,15-5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 2(%esi),%al movb 6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 3(%esi),%cl movb 7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-2(%edi) movb %bl,15-6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-3(%edi) movb %dl,15-7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 8(%esi),%al movb 12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 9(%esi),%cl movb 13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-8(%edi) movb %bl,15-12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-9(%edi) movb %dl,15-13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 10(%esi),%al movb 14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 11(%esi),%cl movb 15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,15-10(%edi) movb %bl,15-14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,15-11(%edi) movb %dl,15-15(%edi) addl $16,%esi // Next Tile Line subl $0xDEADBEEF,%edi // Next Screen Linebitw_03: cmp $0xDEADBEEF,%esiendc_03: jne 9b popl %ebx popl %esi popl %edi popl %ebp ret // Arg ! I have nothing rest to pair with the ret // instruction : Here is a waste of 1/2 cycle ... :-)FUNC(Draw16x16_Trans_Mapped) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $16*16,%edx // tile end pushl %ebp pushl %edi pushl %esi pushl %ebx movl %edx,endc_04-4 movl 20(%esp),%esi // source movl 32(%esp),%ebp // cmap movl 0xDEADBEEF(%eax),%ediblin_04: addl 24(%esp),%edi // x xorl %eax,%eax // pixels 0, 1, 4 and 5 of the line xorl %ebx,%ebx xorl %ecx,%ecx xorl %edx,%edx jmp 9f.align 89: movb (%esi),%al movb 4(%esi),%bl movb 1(%esi),%cl movb 5(%esi),%dl testb %al,%al jz 7f movb (%ebp,%eax),%al movb %al,(%edi)7: testb %bl,%bl jz 7f movb (%ebp,%ebx),%bl movb %bl,4(%edi)7: testb %cl,%cl jz 7f movb (%ebp,%ecx),%cl movb %cl,1(%edi)7: testb %dl,%dl jz 7f movb (%ebp,%edx),%dl movb %dl,5(%edi)7: movb 2(%esi),%al movb 6(%esi),%bl movb 3(%esi),%cl movb 7(%esi),%dl testb %al,%al jz 7f movb (%ebp,%eax),%al movb %al,2(%edi)7: testb %bl,%bl jz 7f movb (%ebp,%ebx),%bl movb %bl,6(%edi)7: testb %cl,%cl jz 7f movb (%ebp,%ecx),%cl movb %cl,3(%edi)7: testb %dl,%dl jz 7f movb (%ebp,%edx),%dl movb %dl,7(%edi)7: movb 8(%esi),%al movb 12(%esi),%bl movb 9(%esi),%cl movb 13(%esi),%dl testb %al,%al jz 7f movb (%ebp,%eax),%al movb %al,8(%edi)7: testb %bl,%bl jz 7f movb (%ebp,%ebx),%bl movb %bl,12(%edi)7: testb %cl,%cl jz 7f movb (%ebp,%ecx),%cl movb %cl,9(%edi)7: testb %dl,%dl jz 7f movb (%ebp,%edx),%dl movb %dl,13(%edi)7: movb 10(%esi),%al movb 14(%esi),%bl movb 11(%esi),%cl movb 15(%esi),%dl testb %al,%al jz 7f movb (%ebp,%eax),%al movb %al,10(%edi)7: testb %bl,%bl jz 7f movb (%ebp,%ebx),%bl movb %bl,14(%edi)7: testb %cl,%cl jz 7f movb (%ebp,%ecx),%cl movb %cl,11(%edi)7: testb %dl,%dl jz 7f movb (%ebp,%edx),%dl movb %dl,15(%edi)7: addl $16,%esi // Next Tile Line addl $0xDEADBEEF,%edi // Next Screen Linebitw_04: cmp $0xDEADBEEF,%esiendc_04: jne 9b popl %ebx popl %esi popl %edi popl %ebp retFUNC(Draw16x16_Trans_Mapped_FlipY) pushl %ebp pushl %edi pushl %esi pushl %ebx movl 28(%esp),%eax // y xorl %edx,%edx sall $2,%eax movl 20(%esp),%esi // source movl 0xDEADBEEF(%eax),%ediblin_05: movl 32(%esp),%ecx // cmap movl $16,%ebp // Tile Height addl 24(%esp),%edi // x9: movl (%esi),%eax movl 4(%esi),%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,15(%edi)7: testb %bl,%bl jz 7f movb %bl,%dl movb (%ecx,%edx),%al movb %al,15-4(%edi)7: testb %ah,%ah jz 7f movb %ah,%dl movb (%ecx,%edx),%al movb %al,15-1(%edi)7: testb %bh,%bh jz 7f movb %bh,%dl movb (%ecx,%edx),%al movb %al,15-5(%edi)7: shr $16,%eax shr $16,%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,15-2(%edi)7: testb %bl,%bl jz 7f movb %bl,%dl movb (%ecx,%edx),%al movb %al,15-6(%edi)7: testb %ah,%ah jz 7f movb %ah,%dl movb (%ecx,%edx),%al movb %al,15-3(%edi)7: testb %bh,%bh jz 7f movb %bh,%dl movb (%ecx,%edx),%al movb %al,15-7(%edi)7: movl 8(%esi),%eax movl 12(%esi),%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,15-8(%edi)7: testb %bl,%bl jz 7f movb %bl,%dl movb (%ecx,%edx),%al movb %al,15-12(%edi)7: testb %ah,%ah jz 7f movb %ah,%dl movb (%ecx,%edx),%al movb %al,15-9(%edi)7: testb %bh,%bh jz 7f movb %bh,%dl movb (%ecx,%edx),%al movb %al,15-13(%edi)7: shr $16,%eax shr $16,%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,15-10(%edi)7: testb %bl,%bl jz 7f movb %bl,%dl movb (%ecx,%edx),%al movb %al,15-14(%edi)7: testb %ah,%ah jz 7f movb %ah,%dl movb (%ecx,%edx),%al movb %al,15-11(%edi)7: testb %bh,%bh jz 7f movb %bh,%dl movb (%ecx,%edx),%al movb %al,(%edi)7: addl $16,%esi // Next Tile Line addl $0xDEADBEEF,%edi // Next Screen Linebitw_05: decl %ebp jne 9b popl %ebx popl %esi popl %edi popl %ebp retFUNC(Draw16x16_Trans_Mapped_FlipX) pushl %ebp pushl %edi pushl %esi pushl %ebx movl 28(%esp),%eax // y xorl %edx,%edx sall $2,%eax movl 20(%esp),%esi // source movl 0xDEADBEEF(%eax),%ediblin_06: movl 32(%esp),%ecx // cmap movl $16,%ebp // Tile Height addl 24(%esp),%edi // x9: movl (%esi),%eax movl 4(%esi),%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,(%edi)7: testb %bl,%bl jz 7f movb %bl,%dl movb (%ecx,%edx),%al movb %al,4(%edi)7: testb %ah,%ah jz 7f movb %ah,%dl movb (%ecx,%edx),%al movb %al,1(%edi)7: testb %bh,%bh jz 7f movb %bh,%dl movb (%ecx,%edx),%al movb %al,5(%edi)7: shr $16,%eax shr $16,%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,2(%edi)7: testb %bl,%bl jz 7f movb %bl,%dl movb (%ecx,%edx),%al movb %al,6(%edi)7: testb %ah,%ah jz 7f movb %ah,%dl movb (%ecx,%edx),%al movb %al,3(%edi)7: testb %bh,%bh jz 7f movb %bh,%dl movb (%ecx,%edx),%al movb %al,7(%edi)7: movl 8(%esi),%eax movl 12(%esi),%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,8(%edi)7: testb %bl,%bl jz 7f movb %bl,%dl movb (%ecx,%edx),%al movb %al,12(%edi)7: testb %ah,%ah jz 7f movb %ah,%dl movb (%ecx,%edx),%al movb %al,9(%edi)7: testb %bh,%bh jz 7f movb %bh,%dl movb (%ecx,%edx),%al movb %al,13(%edi)7: shr $16,%eax shr $16,%ebx testb %al,%al jz 7f movb %al,%dl movb (%ecx,%edx),%al movb %al,10(%edi)7: testb %bl,%bl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -