📄 spr32x32_8.s
字号:
#include "asmdefs.inc"CODE_SEG/******************************************************************************//* *//* RAINE 32x32 TILE DRAWING *//* We'd better find a way to merge the 8x8, 16x16, and 32x32 files... Later. *//******************************************************************************//*MappedTransparent MappedDirect-MappedTransparent Direct-Mapped*/FUNC(Draw32x32_Mapped) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $32*32,%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)// Ok, I need to double all this code.// I am not going to make a macro with plenty of "\ " because it s ugly.// So I am just going to copy/paste the whole thing... cleverly xorl %eax,%eax xorl %ebx,%ebx movb 16(%esi),%al movb 16+4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+1(%esi),%cl movb 16+5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16(%edi) movb %bl,16+4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+1(%edi) movb %dl,16+5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+2(%esi),%al movb 16+6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+3(%esi),%cl movb 16+7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16+2(%edi) movb %bl,16+6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+3(%edi) movb %dl,16+7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+8(%esi),%al movb 16+12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+9(%esi),%cl movb 16+13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16+8(%edi) movb %bl,16+12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+9(%edi) movb %dl,16+13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+10(%esi),%al movb 16+14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+11(%esi),%cl movb 16+15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16+10(%edi) movb %bl,16+14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+11(%edi) movb %dl,16+15(%edi) addl $32,%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(Draw32x32_Mapped_FlipY) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $32*32,%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,31-0(%edi) movb %bl,31-4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-1(%edi) movb %dl,31-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,31-2(%edi) movb %bl,31-6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-3(%edi) movb %dl,31-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,31-8(%edi) movb %bl,31-12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-9(%edi) movb %dl,31-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,31-10(%edi) movb %bl,31-14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-11(%edi) movb %dl,31-15(%edi)// Again all this copy/paste thing. xorl %eax,%eax xorl %ebx,%ebx movb 16(%esi),%al movb 16+4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+1(%esi),%cl movb 16+5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-16-0(%edi) movb %bl,31-16-4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-16-1(%edi) movb %dl,31-16-5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+2(%esi),%al movb 16+6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+3(%esi),%cl movb 16+7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-16-2(%edi) movb %bl,31-16-6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-16-3(%edi) movb %dl,31-16-7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+8(%esi),%al movb 16+12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+9(%esi),%cl movb 16+13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-16-8(%edi) movb %bl,31-16-12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-16-9(%edi) movb %dl,31-16-13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+10(%esi),%al movb 16+14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+11(%esi),%cl movb 16+15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-16-10(%edi) movb %bl,31-16-14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-16-11(%edi) movb %dl,31-16-15(%edi) addl $32,%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(Draw32x32_Mapped_FlipX) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $32*32,%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)// Copy/paste always... xorl %eax,%eax xorl %ebx,%ebx movb 16(%esi),%al movb 16+4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+1(%esi),%cl movb 16+5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16(%edi) movb %bl,16+4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+1(%edi) movb %dl,16+5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+2(%esi),%al movb 16+6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+3(%esi),%cl movb 16+7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16+2(%edi) movb %bl,16+6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+3(%edi) movb %dl,16+7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+8(%esi),%al movb 16+12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+9(%esi),%cl movb 16+13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16+8(%edi) movb %bl,16+12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+9(%edi) movb %dl,16+13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+10(%esi),%al movb 16+14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+11(%esi),%cl movb 16+15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,16+10(%edi) movb %bl,16+14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,16+11(%edi) movb %dl,16+15(%edi) addl $32,%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(Draw32x32_Mapped_FlipXY) movl 12(%esp),%eax // y movl 4(%esp),%edx // source shll $2,%eax addl $32*32,%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,31-0(%edi) movb %bl,31-4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-1(%edi) movb %dl,31-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,31-2(%edi) movb %bl,31-6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-3(%edi) movb %dl,31-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,31-8(%edi) movb %bl,31-12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-9(%edi) movb %dl,31-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,31-10(%edi) movb %bl,31-14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-11(%edi) movb %dl,31-15(%edi)// Same treatement... xorl %eax,%eax xorl %ebx,%ebx movb 16(%esi),%al movb 16+4(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+1(%esi),%cl movb 16+5(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-0(%edi) movb %bl,31-4(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-1(%edi) movb %dl,31-5(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+2(%esi),%al movb 16+6(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+3(%esi),%cl movb 16+7(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-2(%edi) movb %bl,31-6(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-3(%edi) movb %dl,31-7(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+8(%esi),%al movb 16+12(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+9(%esi),%cl movb 16+13(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-8(%edi) movb %bl,31-12(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-9(%edi) movb %dl,31-13(%edi) xorl %eax,%eax xorl %ebx,%ebx movb 16+10(%esi),%al movb 16+14(%esi),%bl xorl %ecx,%ecx xorl %edx,%edx movb 16+11(%esi),%cl movb 16+15(%esi),%dl movb (%ebp,%eax),%al movb (%ebp,%ebx),%bl movb %al,31-10(%edi) movb %bl,31-14(%edi) movb (%ebp,%ecx),%cl movb (%ebp,%edx),%dl movb %cl,31-11(%edi) movb %dl,31-15(%edi) addl $32,%esi // Next Tile Line subl $0xDEADBEEF,%edi // Next Screen Linebitw_03:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -