| 1 | .global _DBFillScreen\r |
| 2 | _DBFillScreen:\r |
| 3 | push %edi\r |
| 4 | mov $64000, %ecx\r |
| 5 | mov 8(%esp), %eax\r |
| 6 | mov _DblBuffer, %edi\r |
| 7 | cld\r |
| 8 | rep stosl\r |
| 9 | pop %edi\r |
| 10 | ret\r |
| 11 | \r |
| 12 | .global _DBPSet\r |
| 13 | _DBPSet:\r |
| 14 | mov 4(%esp), %ecx\r |
| 15 | mov 8(%esp), %edx\r |
| 16 | mov %edx, %eax\r |
| 17 | shl $8, %edx\r |
| 18 | shl $10, %eax\r |
| 19 | add %edx, %eax\r |
| 20 | lea _DblBuffer(%eax, %ecx, 4), %eax\r |
| 21 | mov 12(%esp), %edx\r |
| 22 | mov %edx, (%eax)\r |
| 23 | ret\r |
| 24 | \r |
| 25 | .global _DBPSetCAsm\r |
| 26 | _DBPSetCAsm:\r |
| 27 | push %ebp\r |
| 28 | mov %esp, %ebp\r |
| 29 | mov 8(%ebp), %ecx\r |
| 30 | mov 12(%ebp), %edx\r |
| 31 | cmp (_clip_x1), %ecx\r |
| 32 | jl _DBPSetCAsmEnd\r |
| 33 | cmp (_clip_x2), %ecx\r |
| 34 | jg _DBPSetCAsmEnd\r |
| 35 | cmp (_clip_y1), %edx\r |
| 36 | jl _DBPSetCAsmEnd\r |
| 37 | cmp (_clip_y2), %edx\r |
| 38 | jg _DBPSetCAsmEnd\r |
| 39 | mov %edx, %eax\r |
| 40 | shl $8, %edx\r |
| 41 | shl $10, %eax\r |
| 42 | add %edx, %eax\r |
| 43 | lea _DblBuffer(%eax, %ecx, 4), %eax\r |
| 44 | mov 16(%ebp), %edx\r |
| 45 | mov %edx, (%eax)\r |
| 46 | _DBPSetCAsmEnd:\r |
| 47 | pop %ebp\r |
| 48 | ret\r |
| 49 | \r |
| 50 | .global _DBCopyBufferAsm\r |
| 51 | _DBCopyBufferAsm:\r |
| 52 | push %ebp\r |
| 53 | mov %esp, %ebp\r |
| 54 | mov 12(%ebp), %eax\r |
| 55 | mov $320, %ebx\r |
| 56 | mul %ebx\r |
| 57 | add 8(%ebp), %eax\r |
| 58 | shl $2, %eax\r |
| 59 | add _DblBuffer, %eax\r |
| 60 | mov %eax, %edi\r |
| 61 | mov 16(%ebp), %esi\r |
| 62 | mov 20(%ebp), %eax\r |
| 63 | mov $320, %ecx\r |
| 64 | sub %eax, %ecx\r |
| 65 | inc %eax\r |
| 66 | shl $2, %ecx\r |
| 67 | mov 28(%ebp), %ebx\r |
| 68 | _DBCopyBufferLoop:\r |
| 69 | dec %eax\r |
| 70 | jz _DBCopyBufferRowEnd\r |
| 71 | mov (%esi), %edx\r |
| 72 | cmp %edx, %ebx\r |
| 73 | jz _DBCopyBufferAddOffsets\r |
| 74 | mov %edx, (%edi)\r |
| 75 | _DBCopyBufferAddOffsets:\r |
| 76 | add $4, %esi\r |
| 77 | add $4, %edi\r |
| 78 | jmp _DBCopyBufferLoop\r |
| 79 | _DBCopyBufferRowEnd:\r |
| 80 | decw 24(%ebp)\r |
| 81 | jz _DBCopyBufferEnd\r |
| 82 | mov 20(%ebp), %eax\r |
| 83 | inc %eax\r |
| 84 | add %ecx, %edi\r |
| 85 | jmp _DBCopyBufferLoop\r |
| 86 | _DBCopyBufferEnd:\r |
| 87 | pop %ebp\r |
| 88 | ret\r |
| 89 | \r |
| 90 | .global _DisplayDBAsm\r |
| 91 | _DisplayDBAsm:\r |
| 92 | push %ecx\r |
| 93 | push %esi\r |
| 94 | push %edi\r |
| 95 | mov $64000, %ecx\r |
| 96 | mov _DblBuffer, %esi\r |
| 97 | mov _VBuffer, %edi\r |
| 98 | cld\r |
| 99 | rep movsl\r |
| 100 | pop %edi\r |
| 101 | pop %esi\r |
| 102 | pop %ecx\r |
| 103 | /*dec %ecx\r |
| 104 | _DisplayDBAsmLoop:\r |
| 105 | mov (%esi,%ecx,4), %eax\r |
| 106 | mov %eax, (%edi,%ecx,4)\r |
| 107 | dec %ecx\r |
| 108 | jnz _DisplayDBAsmLoop*/\r |
| 109 | ret\r |
| 110 | \r |
| 111 | .global _MakeFarCall\r |
| 112 | _MakeFarCall:\r |
| 113 | movl 12(%esp), %ebx\r |
| 114 | movw 4(%ebx), %fs\r |
| 115 | movl (%ebx), %esi\r |
| 116 | movl %fs:(%esi), %eax\r |
| 117 | .byte 38 /*CALL FAR HWORD PTR ES:[EBX]*/\r |
| 118 | .byte 255\r |
| 119 | .byte 27\r |
| 120 | ret\r |
| 121 | \r |
| 122 | .global _ColorAdd\r |
| 123 | _ColorAdd:\r |
| 124 | push %esi\r |
| 125 | movd 12(%esp), %mm0\r |
| 126 | movl 8(%esp), %esi\r |
| 127 | movd (%esi), %mm1\r |
| 128 | paddusb %mm1, %mm0\r |
| 129 | movd %mm0, (%esi)\r |
| 130 | pop %esi\r |
| 131 | emms\r |
| 132 | ret\r |
| 133 | \r |
| 134 | .global _ColorSub\r |
| 135 | _ColorSub:\r |
| 136 | push %esi\r |
| 137 | movd 12(%esp), %mm0\r |
| 138 | movl 8(%esp), %esi\r |
| 139 | movd (%esi), %mm1\r |
| 140 | psubusb %mm0, %mm1\r |
| 141 | movd %mm1, (%esi)\r |
| 142 | pop %esi\r |
| 143 | emms\r |
| 144 | ret\r |
| 145 | \r |
| 146 | .global _DBCopyBufferTransAsm\r |
| 147 | _DBCopyBufferTrans:\r |
| 148 | push %ebp\r |
| 149 | movl %esp, %ebp\r |
| 150 | push %edi\r |
| 151 | push %esi\r |
| 152 | push %ecx\r |
| 153 | movl 12(%ebp), %edi\r |
| 154 | movl %edi, %eax\r |
| 155 | shll $10, %eax\r |
| 156 | shll $8, %edi\r |
| 157 | addl %eax, %edi\r |
| 158 | movl 8(%ebp), %eax\r |
| 159 | addl (_DblBuffer), %edi\r |
| 160 | leal (%edi, %eax, 4), %edi\r |
| 161 | movl 16(%ebp), %esi\r |
| 162 | movl $1280, %eax\r |
| 163 | movl 20(%ebp), %ebx\r |
| 164 | shll $2, %ebx\r |
| 165 | subl %ebx, %eax\r |
| 166 | push %eax\r |
| 167 | movl 32(%ebp), %eax\r |
| 168 | movl _TransOps(, %eax, 4), %eax\r |
| 169 | push %eax\r |
| 170 | DBCopyBufferTransYLoop:\r |
| 171 | movl 20(%ebp), %ecx\r |
| 172 | DBCopyBufferTransXLoop:\r |
| 173 | movl (%esi), %eax\r |
| 174 | cmpl 28(%ebp), %eax\r |
| 175 | je DBCopyBufferTransAddOffsets\r |
| 176 | push %ecx\r |
| 177 | push %edx\r |
| 178 | push %eax\r |
| 179 | push %edi\r |
| 180 | call *-20(%ebp)\r |
| 181 | add $8, %esp\r |
| 182 | pop %edx\r |
| 183 | pop %ecx\r |
| 184 | DBCopyBufferTransAddOffsets:\r |
| 185 | add $4, %edi\r |
| 186 | add $4, %esi\r |
| 187 | loop DBCopyBufferTransXLoop\r |
| 188 | addl -16(%ebp), %edi\r |
| 189 | decl 24(%ebp)\r |
| 190 | jnz DBCopyBufferTransYLoop\r |
| 191 | add $8, %esp\r |
| 192 | pop %ecx\r |
| 193 | pop %esi\r |
| 194 | pop %edi\r |
| 195 | pop %ebp\r |
| 196 | ret\r |
| 197 | \r |