Rev 2014 | Rev 2320 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2014 | Rev 2318 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | .;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 2014 $ |
8 | $Revision: 2318 $ |
9 | 9 | ||
10 | ; // Alver 22.06.2008 // { |
10 | ; // Alver 22.06.2008 // { |
11 | align 4 |
11 | align 4 |
Line 128... | Line 128... | ||
128 | jmp .loop |
128 | jmp .loop |
129 | .end: |
129 | .end: |
130 | popad |
130 | popad |
131 | pop eax ; << // Alver 22.06.2008 // << |
131 | pop eax ; << // Alver 22.06.2008 // << |
132 | ret |
132 | ret |
- | 133 | ||
- | 134 | ;===================================================== |
|
- | 135 | ; NEW FONTS |
|
- | 136 | ;_____________________________________________________ |
|
- | 137 | ; |
|
- | 138 | ||
- | 139 | align 8 |
|
- | 140 | sdsh_data: |
|
- | 141 | ||
- | 142 | include 'sdsh.inc' |
|
- | 143 | ||
- | 144 | sdsh_code: |
|
- | 145 | ||
- | 146 | ; eax = if (bit[31]) |
|
- | 147 | ; then lower 31 bits points to the user-selected font |
|
- | 148 | ; else ax = number of preloaded system font |
|
- | 149 | ; ebx = x<<16 + y |
|
- | 150 | ; ecx = 0x00RRGGBB |
|
- | 151 | ; edx = if (bits[31:8] == 0) |
|
- | 152 | ; then dl = single char to write |
|
- | 153 | ; else edx= pointer to asciiz-string |
|
- | 154 | ||
- | 155 | ||
- | 156 | sdsh_draw_char: |
|
- | 157 | ; eax = left side X |
|
- | 158 | ; ebx = bottom Y |
|
- | 159 | ; edi = color 0x0RRGGBB |
|
- | 160 | ; ebp = font@ |
|
- | 161 | ; ecx = ascii, zero-extended to 32bits |
|
- | 162 | push ecx, edx, ebp |
|
- | 163 | shl ebp, 4 |
|
- | 164 | add ebp, sdsh_data.info |
|
- | 165 | call ch_checkscreen |
|
- | 166 | jb .exit |
|
- | 167 | call ch_checkwin |
|
- | 168 | jc .exit |
|
- | 169 | xor ch, ch |
|
- | 170 | mov edx, [ebp + 4] ; chartable addr |
|
- | 171 | mov cx, word[edx + ecx*2] ; tick info |
|
- | 172 | mov edx, ecx |
|
- | 173 | and ecx, 15 ; cl = number of ticks |
|
- | 174 | jz .blank |
|
- | 175 | shr edx, 4 ; offset in the chartable |
|
- | 176 | add edx, [sdsh_data.chars] ; edx -> the char's ticklist |
|
- | 177 | .next_tick: |
|
- | 178 | call parse_tick |
|
- | 179 | add edx, 4 |
|
- | 180 | dec cl |
|
- | 181 | jnz .next_tick |
|
- | 182 | .blank: |
|
- | 183 | .exit: |
|
- | 184 | pop ebp, edx, ecx |
|
- | 185 | ret |
|
- | 186 | ||
- | 187 | ||
- | 188 | parse_tick: |
|
- | 189 | ; eax = left side X |
|
- | 190 | ; ebx = bottom Y |
|
- | 191 | ; edx ->tickinfo |
|
- | 192 | ; edi = color 0x0RRGGBB |
|
- | 193 | ; ebp = font's header |
|
- | 194 | popad |
|
- | 195 | xor ecx, ecx |
|
- | 196 | mov dx, word[edx] |
|
- | 197 | mov cl, dl |
|
- | 198 | test dl, 0xE0 ; ticks #32..255 |
|
- | 199 | jz .lntick.short |
|
- | 200 | cmp dl, 0xE0 |
|
- | 201 | jae .lntick.long |
|
- | 202 | cmp dl, 0xC0 |
|
- | 203 | jae .cstick |
|
- | 204 | .gptick: |
|
- | 205 | mov cl, dh ; three rotation bits |
|
- | 206 | and cl, 7 |
|
- | 207 | mov dh, ... - origin |
|
- | 208 | mov dl, .... - num_vertices!! |
|
- | 209 | mov esi, ... - tickfield?? |
|
- | 210 | jmp .draw |
|
- | 211 | ||
- | 212 | .cstick: |
|
- | 213 | and cl, 4 |
|
- | 214 | shr cl, 2 ; only one rotational bit |
|
- | 215 | and dl, 3 |
|
- | 216 | dec dl |
|
- | 217 | jb .cstick.0 |
|
- | 218 | mov esi, sdsh_data.cs2 ; the square |
|
- | 219 | dec dl |
|
- | 220 | jb .cstick.1 |
|
- | 221 | dec dl |
|
- | 222 | jb .cstick.2 |
|
- | 223 | .cstick.3: |
|
- | 224 | mov esi, sdsh_data.cs3 ; 12pix-ring |
|
- | 225 | mov dl, 10 |
|
- | 226 | jmp .draw |
|
- | 227 | .cstick.2: |
|
- | 228 | mov dl, 7 |
|
- | 229 | jmp .draw |
|
- | 230 | .cstick.1: |
|
- | 231 | mov dl, 6 |
|
- | 232 | jmp .draw |
|
- | 233 | .cstick.3: |
|
- | 234 | mov esi, sdsh_data.cs0 ; 4pix-square |
|
- | 235 | mov dl, 3 |
|
- | 236 | jmp .draw |
|
- | 237 | ||
- | 238 | .ritick: |
|
- | 239 | test dl, 1 |
|
- | 240 | jnz .ritick.1 |
|
- | 241 | .ritick.0: |
|
- | 242 | mov cl, dh ; y |
|
- | 243 | and cl, 0x0F |
|
- | 244 | and ebx, ecx |
|
- | 245 | mov cl, dh |
|
- | 246 | shr cl, 4 ; x |
|
- | 247 | and eax, ecx |
|
- | 248 | call ch_putpixel |
|
- | 249 | jmp .exit |
|
- | 250 | .ritick.1: |
|
- | 251 | mov esi, sdsh_data.ri1 ; 8pix-ring |
|
- | 252 | mov dl, 4 |
|
- | 253 | jmp .draw |
|
- | 254 | ||
- | 255 | .lntick.short: |
|
- | 256 | test dl, 0x06 ; ticks #0, 1 are reserved for |
|
- | 257 | jz .ritick ; rotational invariants |
|
- | 258 | and dl, 0x07 ; dl = line length |
|
- | 259 | jmp .lntick.both |
|
- | 260 | .lntick.long: |
|
- | 261 | and dl, 0x07 |
|
- | 262 | add dl, 8 |
|
- | 263 | .lntick.both: |
|
- | 264 | sub dl, 2 ; num_vertice = num_points - 2 |
|
- | 265 | and cl, 0x18 ; two rotation bits |
|
- | 266 | shr cl, 3 |
|
- | 267 | mov esi, sdsh_data.blank |
|
- | 268 | .draw: |
|
- | 269 | push ecx |
|
- | 270 | mov cl, dh ; y |
|
- | 271 | and cl, 0x0F |
|
- | 272 | and ebx, ecx |
|
- | 273 | mov cl, dh |
|
- | 274 | shr cl, 4 ; x |
|
- | 275 | and eax, ecx |
|
- | 276 | pop ecx |
|
- | 277 | call draw_tick |
|
- | 278 | .exit: |
|
- | 279 | popad |
|
- | 280 | ret |
|
- | 281 | ||
- | 282 | ||
- | 283 | ||
- | 284 | ||
- | 285 | ||
- | 286 | ||
- | 287 | draw_tick: |
|
- | 288 | ; eax = x-origin |
|
- | 289 | ; ebx = y-origin |
|
- | 290 | ; edi = 0x0RRGGBB |
|
- | 291 | ; cl = direction (0..7) |
|
- | 292 | ; ch = number of vertices |
|
- | 293 | ; edx -> tick bitfield |
|
- | 294 | ||
- | 295 | pushad |
|
- | 296 | call putchpixel ; point 0 |
|
- | 297 | xor ecx, ecx |
|
- | 298 | mov edx, ecx |
|
- | 299 | mov dl, byte[esi] |
|
- | 300 | and dl, 7 |
|
- | 301 | mov cl, 3 |
|
- | 302 | .move_and_draw: |
|
- | 303 | xor dh, dh |
|
- | 304 | call [.moves + edx*4] |
|
- | 305 | call putchpixel |
|
- | 306 | ||
- | 307 | shl edx, 5 ; prepare to move the old value to dh |
|
- | 308 | bt [esi], ecx |
|
- | 309 | ||
- | 310 | rol edx, 1 |
|
- | 311 | inc ecx |
|
- | 312 | bt [esi], ecx |
|
- | 313 | rol edx, 1 |
|
- | 314 | inc ecx |
|
- | 315 | bt [esi], ecx |
|
- | 316 | rol edx, 1 |
|
- | 317 | inc ecx |
|
- | 318 | xor dh, dl |
|
- | 319 | jnz .move_and_draw ; any step-back means the end |
|
- | 320 | .done: |
|
- | 321 | popad |
|
- | 322 | ret |
|
- | 323 | ||
- | 324 | .move000: |
|
- | 325 | inc eax |
|
- | 326 | ret |
|
- | 327 | .move001: |
|
- | 328 | inc eax |
|
- | 329 | inc ebx |
|
- | 330 | ret |
|
- | 331 | .move010: |
|
- | 332 | inc ebx |
|
- | 333 | ret |
|
- | 334 | .move011: |
|
- | 335 | dec eax |
|
- | 336 | inc ebx |
|
- | 337 | ret |
|
- | 338 | .move111: |
|
- | 339 | dec eax |
|
- | 340 | ret |
|
- | 341 | .move110: |
|
- | 342 | dec eax |
|
- | 343 | dec ebx |
|
- | 344 | ret |
|
- | 345 | .move101: |
|
- | 346 | dec ebx |
|
- | 347 | ret |
|
- | 348 | .move100: |
|
- | 349 | dec ebx |
|
- | 350 | inc eax |
|
- | 351 | ret |
|
- | 352 | ||
- | 353 | align 4 |
|
- | 354 | .moves dd .move000, .move001, .move010, .move011, .move100, .move101, .move110, .move111 |
|
- | 355 | ||
- | 356 | ;) |
|
- | 357 | ||
- | 358 | align 4 |
|
- | 359 | ch_checkscreen: |
|
- | 360 | cmp [Screen_Max_X], eax |
|
- | 361 | jb .getout |
|
- | 362 | cmp [Screen_Max_Y], ebx |
|
- | 363 | .getout: |
|
- | 364 | ret |
|
- | 365 | ||
- | 366 | align 4 |
|
- | 367 | ch_checkwin: |
|
- | 368 | ; eax = x coordinate |
|
- | 369 | ; ebx = y coordinate |
|
- | 370 | ; ebp -> font info |
|
- | 371 | ;!destroys ch, edx! |
|
- | 372 | push eax, ebx |
|
- | 373 | mov ch, byte[CURRENT_TASK] |
|
- | 374 | mov al, byte [ebp] ; char X-width |
|
- | 375 | mov edx, [_display.width] ; screen X-size |
|
- | 376 | imul edx, ebx |
|
- | 377 | add edx, [_WinMapAddress] |
|
- | 378 | add edx, eax |
|
- | 379 | cmp ch, byte [edx] |
|
- | 380 | jne .fail |
|
- | 381 | moxzx eax, byte [ebp] |
|
- | 382 | cmp ch, byte [edx+eax] |
|
- | 383 | jne .fail |
|
- | 384 | moxzx ebx, byte [ebp+1] |
|
- | 385 | imul ebx, [_display.width] |
|
- | 386 | cmp ch, byte [edx+ebx] |
|
- | 387 | jne .fail |
|
- | 388 | add edx, eax |
|
- | 389 | cmp ch, byte [edx+ebx] |
|
- | 390 | clc |
|
- | 391 | je .done |
|
- | 392 | .fail: |
|
- | 393 | stc ; CF means the charbox is invisible |
|
- | 394 | .done: |
|
- | 395 | pop ebx, eax |
|
- | 396 | ret |
|
- | 397 | ||
- | 398 | align 4 |
|
- | 399 | ch_putpixel: |
|
- | 400 | ; eax = x coordinate |
|
- | 401 | ; ebx = y coordinate |
|
- | 402 | ; edi = 0x0RRGGBB |
|
- | 403 | push edx |
|
- | 404 | mov edx, ebx |
|
- | 405 | imul edx, [BytesPerScanLine] |
|
- | 406 | lea edx, [edx+eax*4] |
|
- | 407 | mov [LFB_BASE+edx], edi |
|
- | 408 | pop edx |
|
- | 409 | ret |
|
- | 410 | ||
- | 411 | ;) |
|
- | 412 | ||
- | 413 | ||
- | 414 | ||
- | 415 | ||
133 | ;diff16 "font code end ",0,$ |
416 | ;diff16 "font code end ",0,$ |
134 | diff10 "font code size",dtext,$ |
417 | diff10 "font code size",dtext,$16><16> |