2011-11-29 10:40:16 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2010-06-25 18:47:51 +02:00
|
|
|
;; ;;
|
2012-03-29 01:12:25 +02:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
|
|
|
|
;; Distributed FOR KOLIBRIOS AND ITS DIRECT BRANCHES ONLY ;;
|
|
|
|
;; under conditions of the GNU General Public License ;;
|
2010-06-25 18:47:51 +02:00
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
align 4
|
2011-07-23 17:27:18 +02:00
|
|
|
dtext_asciiz_esi: ; for skins title out
|
2010-06-25 18:47:51 +02:00
|
|
|
push eax
|
|
|
|
xor eax, eax
|
|
|
|
inc eax
|
|
|
|
jmp dtext.1
|
|
|
|
|
|
|
|
align 4
|
2011-07-23 17:27:18 +02:00
|
|
|
dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
|
|
|
|
; ebx x & y
|
|
|
|
; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB )
|
|
|
|
; X = ABnnb:
|
|
|
|
; nn = font
|
|
|
|
; A = 0 <=> output esi characters; otherwise output ASCIIZ string
|
|
|
|
; B = 1 <=> fill background with color eax
|
|
|
|
; edx start of text
|
|
|
|
; edi 1 force
|
2010-06-25 18:47:51 +02:00
|
|
|
|
2012-03-29 01:12:25 +02:00
|
|
|
test ecx, 0x20000000
|
|
|
|
jnz .font3
|
|
|
|
|
2010-06-25 18:47:51 +02:00
|
|
|
push eax
|
2011-07-23 17:27:18 +02:00
|
|
|
xor eax, eax
|
2010-06-25 18:47:51 +02:00
|
|
|
.1:
|
2011-07-23 17:27:18 +02:00
|
|
|
pushad
|
|
|
|
call [_display.disable_mouse]
|
2010-06-25 18:47:51 +02:00
|
|
|
|
2011-07-23 17:27:18 +02:00
|
|
|
movsx eax, bx ; eax=y
|
|
|
|
sar ebx, 16 ; ebx=x
|
|
|
|
xchg eax, ebx ; eax=x, ebx=y
|
|
|
|
cmp esi, 255
|
|
|
|
jb .loop
|
|
|
|
mov esi, 255
|
2010-06-25 18:47:51 +02:00
|
|
|
.loop:
|
2011-07-23 17:27:18 +02:00
|
|
|
test ecx, ecx
|
|
|
|
js .test_asciiz
|
|
|
|
dec esi
|
|
|
|
js .end
|
|
|
|
jmp @f
|
2010-06-25 18:47:51 +02:00
|
|
|
.test_asciiz:
|
2011-07-23 17:27:18 +02:00
|
|
|
cmp byte [edx], 0
|
|
|
|
jz .end
|
|
|
|
cmp byte [esp+28], 1 ; was the entry point = dtext.1 ?
|
|
|
|
jne @f
|
|
|
|
dec esi
|
|
|
|
js .end
|
2010-06-25 18:47:51 +02:00
|
|
|
@@:
|
2011-07-23 17:27:18 +02:00
|
|
|
inc edx
|
|
|
|
pushad ; esp -= 64 !
|
|
|
|
movzx edx, byte [edx-1]
|
|
|
|
test ecx, 0x10000000
|
|
|
|
jnz .font2
|
|
|
|
mov esi, 9
|
|
|
|
lea ebp, [FONT_I+8*edx+edx]
|
2010-06-25 18:47:51 +02:00
|
|
|
.symloop1:
|
2011-07-23 17:27:18 +02:00
|
|
|
mov dl, byte [ebp]
|
|
|
|
or dl, 1 shl 6
|
2010-06-25 18:47:51 +02:00
|
|
|
.pixloop1:
|
2011-07-23 17:27:18 +02:00
|
|
|
shr dl, 1
|
|
|
|
jz .pixloop1end
|
|
|
|
jnc .nopix
|
|
|
|
call [putpixel]
|
|
|
|
jmp .pixloop1cont
|
2010-06-25 18:47:51 +02:00
|
|
|
.nopix:
|
2011-07-23 17:27:18 +02:00
|
|
|
test ecx, 0x40000000
|
|
|
|
jz .pixloop1cont
|
|
|
|
push ecx
|
|
|
|
mov ecx, [esp+4+20h+20h] ; original eax?
|
|
|
|
call [putpixel]
|
|
|
|
pop ecx
|
2010-06-25 18:47:51 +02:00
|
|
|
.pixloop1cont:
|
2011-07-23 17:27:18 +02:00
|
|
|
inc eax
|
|
|
|
jmp .pixloop1
|
2010-06-25 18:47:51 +02:00
|
|
|
.pixloop1end:
|
2011-07-23 17:27:18 +02:00
|
|
|
sub eax, 6
|
|
|
|
inc ebx
|
|
|
|
inc ebp
|
|
|
|
dec esi
|
|
|
|
jnz .symloop1
|
|
|
|
popad
|
|
|
|
add eax, 6
|
|
|
|
jmp .loop
|
2012-03-29 01:12:25 +02:00
|
|
|
|
2010-06-25 18:47:51 +02:00
|
|
|
.font2:
|
2011-07-23 17:27:18 +02:00
|
|
|
add edx, edx
|
|
|
|
lea ebp, [FONT_II+4*edx+edx+1]
|
|
|
|
push 9
|
|
|
|
movzx esi, byte [ebp-1]
|
2010-06-25 18:47:51 +02:00
|
|
|
.symloop2:
|
2011-07-23 17:27:18 +02:00
|
|
|
mov dl, byte [ebp]
|
|
|
|
push esi
|
2010-06-25 18:47:51 +02:00
|
|
|
.pixloop2:
|
2011-07-23 17:27:18 +02:00
|
|
|
shr dl, 1
|
|
|
|
jnc .nopix2
|
|
|
|
call [putpixel]
|
|
|
|
jmp .pixloop2cont
|
2010-06-25 18:47:51 +02:00
|
|
|
.nopix2:
|
2011-07-23 17:27:18 +02:00
|
|
|
test ecx, 0x40000000
|
|
|
|
jz .pixloop2cont
|
|
|
|
push ecx
|
|
|
|
mov ecx, [esp+12+20h+20h]
|
|
|
|
call [putpixel]
|
|
|
|
pop ecx
|
2010-06-25 18:47:51 +02:00
|
|
|
.pixloop2cont:
|
2011-07-23 17:27:18 +02:00
|
|
|
inc eax
|
|
|
|
dec esi
|
|
|
|
jnz .pixloop2
|
|
|
|
pop esi
|
|
|
|
sub eax, esi
|
|
|
|
inc ebx
|
|
|
|
inc ebp
|
|
|
|
dec dword [esp]
|
|
|
|
jnz .symloop2
|
|
|
|
pop eax
|
|
|
|
add dword [esp+28], esi
|
|
|
|
popad
|
|
|
|
jmp .loop
|
2010-06-25 18:47:51 +02:00
|
|
|
.end:
|
2011-07-23 17:27:18 +02:00
|
|
|
popad
|
2012-03-29 01:12:25 +02:00
|
|
|
pop eax
|
2011-07-23 17:27:18 +02:00
|
|
|
ret
|
2011-11-26 02:25:06 +01:00
|
|
|
|
2011-11-29 10:40:16 +01:00
|
|
|
diff10 "old font code size",dtext,$
|
|
|
|
|
2011-11-26 02:25:06 +01:00
|
|
|
;=====================================================
|
|
|
|
; NEW FONTS
|
|
|
|
;_____________________________________________________
|
|
|
|
;
|
2012-03-29 01:12:25 +02:00
|
|
|
align 4
|
|
|
|
.font3:
|
|
|
|
pushad
|
|
|
|
call [_display.disable_mouse]
|
|
|
|
movsx eax, bx ; eax=y
|
|
|
|
sar ebx, 16 ; ebx=x
|
|
|
|
xchg eax, ebx ; eax=x, ebx=y
|
|
|
|
|
|
|
|
xor ebp, ebp ; font#
|
|
|
|
mov [font_check_routine], ebp
|
2012-09-07 01:20:44 +02:00
|
|
|
test ecx, 0x10000000
|
|
|
|
jz @f
|
|
|
|
inc ebp
|
|
|
|
@@:
|
2012-03-29 01:12:25 +02:00
|
|
|
test ecx, ecx
|
|
|
|
js .checked
|
|
|
|
inc [font_check_routine]; .check_esi
|
|
|
|
.checked:
|
|
|
|
mov edi, ecx ; colour
|
|
|
|
and edi, 0x0FFFFFF ; RGB
|
|
|
|
align 4
|
|
|
|
.draw_char:
|
|
|
|
mov cl, byte[edx] ; char#
|
|
|
|
movzx ecx, cl
|
|
|
|
call nsvf_draw_char
|
|
|
|
add eax, 6
|
|
|
|
test [font_check_routine], 1
|
|
|
|
jz .check_asciz
|
|
|
|
|
|
|
|
.check_esi:
|
|
|
|
inc edx
|
|
|
|
dec esi
|
|
|
|
jz .exit
|
|
|
|
jmp .draw_char
|
|
|
|
|
|
|
|
align 4
|
|
|
|
.check_asciz:
|
|
|
|
or byte[edx], 0
|
|
|
|
jz .exit
|
|
|
|
inc edx
|
|
|
|
jmp .draw_char
|
|
|
|
|
|
|
|
align 4
|
|
|
|
.exit:
|
|
|
|
popad
|
|
|
|
ret
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
font_check_routine dd ?
|
|
|
|
|
|
|
|
|
2011-11-26 02:25:06 +01:00
|
|
|
|
|
|
|
align 8
|
2012-08-29 02:20:57 +02:00
|
|
|
nsvf_data:
|
2011-11-26 02:25:06 +01:00
|
|
|
|
2012-03-15 02:02:08 +01:00
|
|
|
diff16 "sdsh_data : ",0,$
|
|
|
|
|
2011-11-29 10:40:16 +01:00
|
|
|
include 'fonts/sd_data.asm'
|
2011-11-26 02:25:06 +01:00
|
|
|
|
2012-08-29 02:20:57 +02:00
|
|
|
nsvf_code:
|
2011-11-26 02:25:06 +01:00
|
|
|
|
2012-03-15 02:02:08 +01:00
|
|
|
; eax = if (bit[31])
|
|
|
|
; then lower 31 bits points to the user-selected font
|
|
|
|
; else ax = number of preloaded system font
|
|
|
|
; ebx = x<<16 + y
|
|
|
|
; ecx = 0x00RRGGBB
|
|
|
|
; edx = if (bits[31:8] == 0)
|
|
|
|
; then dl = single char to write
|
|
|
|
; else edx= pointer to asciiz-string
|
|
|
|
|
|
|
|
diff16 "draw_char : ",0,$
|
2011-11-26 02:25:06 +01:00
|
|
|
|
2011-11-29 10:40:16 +01:00
|
|
|
draw_char:
|
|
|
|
; font test
|
|
|
|
; bl=y; bh=x
|
|
|
|
; dl=ascii
|
2012-03-15 02:02:08 +01:00
|
|
|
movzx eax, bh
|
|
|
|
movzx ebx, bl
|
|
|
|
movzx ecx, dl
|
|
|
|
xor edi, edi
|
|
|
|
mov ebp, edi
|
|
|
|
|
|
|
|
|
2012-03-29 01:12:25 +02:00
|
|
|
nsvf_draw_char:
|
2011-11-26 02:25:06 +01:00
|
|
|
; eax = left side X
|
|
|
|
; ebx = bottom Y
|
2012-03-29 01:12:25 +02:00
|
|
|
; edi = colour 0x0RRGGBB
|
2012-08-29 02:20:57 +02:00
|
|
|
; ebp = font#
|
2011-11-26 02:25:06 +01:00
|
|
|
; ecx = ascii, zero-extended to 32bits
|
2012-03-15 02:02:08 +01:00
|
|
|
push ecx
|
|
|
|
push edx
|
|
|
|
push ebp
|
2012-09-07 01:20:44 +02:00
|
|
|
shl ebp, 4 ; font header = 16 bytes
|
2012-08-29 02:20:57 +02:00
|
|
|
add ebp, nsvf_info
|
2012-03-29 01:12:25 +02:00
|
|
|
call ch_checkscreen
|
|
|
|
jb .exit
|
|
|
|
call ch_checkwin
|
|
|
|
jc .exit
|
2012-03-15 02:02:08 +01:00
|
|
|
mov edx, [ebp + 4] ; chartable addr
|
|
|
|
mov cx, word[edx + ecx*2] ; tick info
|
2012-08-29 02:20:57 +02:00
|
|
|
and cx, 0xFFE7 ; bits 3,4 used for width control
|
2012-03-15 02:02:08 +01:00
|
|
|
mov edx, ecx
|
|
|
|
and ecx, 7 ; cl = number of ticks
|
|
|
|
jz .blank
|
|
|
|
shr edx, 4 ; offset in the chartable
|
2012-08-29 02:20:57 +02:00
|
|
|
add edx, [ebp + 12] ; edx -> the char's ticklist
|
2011-11-26 02:25:06 +01:00
|
|
|
.next_tick:
|
2012-03-15 02:02:08 +01:00
|
|
|
call parse_tick
|
|
|
|
add edx, 2
|
|
|
|
dec cl
|
|
|
|
jnz .next_tick
|
2011-11-26 02:25:06 +01:00
|
|
|
.blank:
|
|
|
|
.exit:
|
2012-03-15 02:02:08 +01:00
|
|
|
pop ebp
|
|
|
|
pop edx
|
|
|
|
pop ecx
|
|
|
|
ret
|
2011-11-26 02:25:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
parse_tick:
|
2012-03-15 02:02:08 +01:00
|
|
|
diff16 "parse_tick : ",0,$
|
2011-11-26 02:25:06 +01:00
|
|
|
; eax = left side X
|
|
|
|
; ebx = bottom Y
|
|
|
|
; edx ->tickinfo
|
|
|
|
; edi = color 0x0RRGGBB
|
2012-03-15 02:02:08 +01:00
|
|
|
; ebp = font's header
|
|
|
|
pushad
|
|
|
|
mov dx, word[edx]
|
2012-03-16 00:11:54 +01:00
|
|
|
movzx ecx, dl
|
2012-03-29 01:12:25 +02:00
|
|
|
test dl, 0xE0
|
|
|
|
jz .lntick.short ; ticks #0..31
|
2012-03-15 02:02:08 +01:00
|
|
|
cmp dl, 0xE0
|
2012-03-29 01:12:25 +02:00
|
|
|
jae .lntick.long ; ticks #224..255
|
2012-03-23 02:10:27 +01:00
|
|
|
cmp dl, 0xD8
|
2012-03-29 01:12:25 +02:00
|
|
|
jae .cstick ; ticks #216..223
|
2011-11-26 02:25:06 +01:00
|
|
|
.gptick:
|
2012-03-15 02:02:08 +01:00
|
|
|
push edx
|
2012-03-23 02:10:27 +01:00
|
|
|
cmp dl, 38
|
2012-03-29 01:12:25 +02:00
|
|
|
jb .sptick ; special ticks #32-37
|
|
|
|
; general ticks #38..215
|
2012-03-15 02:02:08 +01:00
|
|
|
mov cl, dh
|
2012-03-23 02:10:27 +01:00
|
|
|
shr cl, 3 ; number of origin
|
2012-03-15 02:02:08 +01:00
|
|
|
mov edx, [ebp+8] ; orig. table
|
|
|
|
mov ch, byte[edx+ecx] ; orig. coords
|
|
|
|
pop edx
|
|
|
|
mov cl, dh
|
2012-03-16 00:11:54 +01:00
|
|
|
and cl, 7 ; three rotation bits
|
2012-03-23 02:10:27 +01:00
|
|
|
movzx edx, dl ; dl = gptick#
|
|
|
|
cmp dl, 80
|
2012-03-15 02:02:08 +01:00
|
|
|
jae .gptick.2
|
2012-03-23 02:10:27 +01:00
|
|
|
sub dl, 38
|
2012-03-16 00:11:54 +01:00
|
|
|
|
2011-11-28 02:09:32 +01:00
|
|
|
.gptick.1:
|
2012-03-16 00:11:54 +01:00
|
|
|
; 1-byte tickgroups .v1-v4:
|
2012-08-29 02:20:57 +02:00
|
|
|
lea esi, [nsvf.v1+edx]
|
2012-03-29 01:12:25 +02:00
|
|
|
inc dh ; dh = 1 vertex
|
2012-03-23 02:10:27 +01:00
|
|
|
sub dl, 2 ; .v1 : 2 ticks only (#38, 39)
|
2012-03-16 00:11:54 +01:00
|
|
|
jae .gptick.1v2v4
|
2012-03-15 02:02:08 +01:00
|
|
|
mov dl, dh
|
2012-03-16 00:11:54 +01:00
|
|
|
mov dh, ch
|
|
|
|
jmp .draw
|
|
|
|
|
|
|
|
.gptick.1v2v4:
|
2012-03-23 02:10:27 +01:00
|
|
|
; 1-byte tickgroups .v2-v4 : 8, 16 and 16 ticks
|
2012-03-29 01:12:25 +02:00
|
|
|
inc dh ; dh = 2 vertice
|
|
|
|
add dl, 8
|
2012-03-23 02:10:27 +01:00
|
|
|
shr dl, 4
|
2012-03-15 02:02:08 +01:00
|
|
|
jmp .gptick.done
|
2012-03-16 00:11:54 +01:00
|
|
|
|
2011-11-28 02:09:32 +01:00
|
|
|
.gptick.2:
|
2012-03-16 00:11:54 +01:00
|
|
|
; 2-byte tickgroups .v5-v8: 8 ticks each
|
2012-03-23 02:10:27 +01:00
|
|
|
cmp dl, 112
|
2012-03-15 02:02:08 +01:00
|
|
|
jae .gptick.3
|
2012-03-23 02:10:27 +01:00
|
|
|
sub dl, 80
|
2012-08-29 02:20:57 +02:00
|
|
|
lea esi, [nsvf.v5 + edx*2]
|
2012-03-15 02:02:08 +01:00
|
|
|
mov dh, 5
|
|
|
|
shr dl, 3
|
|
|
|
jmp .gptick.done
|
2012-03-16 00:11:54 +01:00
|
|
|
|
2011-11-28 02:09:32 +01:00
|
|
|
.gptick.3:
|
2012-03-16 00:11:54 +01:00
|
|
|
; 3-byte tickgroups .v9-12: 4 ticks each
|
2012-03-23 02:10:27 +01:00
|
|
|
cmp dl, 128
|
2012-03-15 02:02:08 +01:00
|
|
|
jae .gptick.4
|
2012-03-23 02:10:27 +01:00
|
|
|
sub dl, 112
|
2012-08-29 02:20:57 +02:00
|
|
|
lea esi, [nsvf.v9 + edx*2 + edx]
|
2012-03-15 02:02:08 +01:00
|
|
|
mov dh, 9
|
|
|
|
shr dl, 2
|
|
|
|
jmp .gptick.done
|
2012-03-16 00:11:54 +01:00
|
|
|
|
2011-11-28 02:09:32 +01:00
|
|
|
.gptick.4:
|
2012-03-16 00:11:54 +01:00
|
|
|
; 4-byte tickgroups .v13-16: 4 ticks each
|
2012-03-29 01:12:25 +02:00
|
|
|
cmp dl, 128 ; fix this when needed
|
|
|
|
jae .exit ; not implemented yet!
|
2012-03-23 02:10:27 +01:00
|
|
|
sub dl, 128
|
2012-08-29 02:20:57 +02:00
|
|
|
lea esi, [nsvf.v13 + edx*4]
|
2012-03-15 02:02:08 +01:00
|
|
|
mov dh, 13
|
|
|
|
shr dl, 2
|
2012-03-16 00:11:54 +01:00
|
|
|
|
2011-11-28 02:09:32 +01:00
|
|
|
.gptick.done:
|
2012-03-16 00:11:54 +01:00
|
|
|
add dl, dh
|
2012-03-15 02:02:08 +01:00
|
|
|
mov dh, ch ; dh = orig.XY; dl = numvert
|
2012-03-16 00:11:54 +01:00
|
|
|
jmp .draw ; cl = rotation; esi-> tickfield
|
2012-03-15 02:02:08 +01:00
|
|
|
|
2011-11-26 02:25:06 +01:00
|
|
|
.cstick:
|
2012-03-15 02:02:08 +01:00
|
|
|
and cl, 4
|
|
|
|
shr cl, 2 ; only one rotational bit
|
|
|
|
and dl, 3
|
|
|
|
jz .cstick.0
|
|
|
|
dec dl
|
|
|
|
jnz @f
|
|
|
|
mov dl, 6
|
2012-03-16 00:11:54 +01:00
|
|
|
jz .cstick.1 ; 8-pix square outline
|
2012-03-15 02:02:08 +01:00
|
|
|
@@: dec dl
|
|
|
|
jz .cstick.2
|
2011-11-26 02:25:06 +01:00
|
|
|
.cstick.3:
|
2012-08-29 02:20:57 +02:00
|
|
|
mov esi, nsvf_data.cs3 ; 12pix-ring
|
2012-03-15 02:02:08 +01:00
|
|
|
mov dl, 10
|
|
|
|
jmp .draw
|
2011-11-26 02:25:06 +01:00
|
|
|
.cstick.2:
|
2012-03-16 00:11:54 +01:00
|
|
|
mov dl, 7 ; 9-pix filled square
|
2011-11-26 02:25:06 +01:00
|
|
|
.cstick.1:
|
2012-08-29 02:20:57 +02:00
|
|
|
mov esi, nsvf_data.cs2 ; the square tickfield
|
2012-03-15 02:02:08 +01:00
|
|
|
jmp .draw
|
2011-11-28 22:26:53 +01:00
|
|
|
.cstick.0:
|
2012-08-29 02:20:57 +02:00
|
|
|
mov esi, nsvf_data.cs0 ; 4pix-square
|
2012-03-16 00:11:54 +01:00
|
|
|
mov dl, 2
|
2012-03-15 02:02:08 +01:00
|
|
|
jmp .draw
|
2011-11-26 02:25:06 +01:00
|
|
|
|
|
|
|
.ritick:
|
2012-03-15 02:02:08 +01:00
|
|
|
test dl, 1
|
|
|
|
jnz .ritick.1
|
2012-09-07 01:20:44 +02:00
|
|
|
test dl, 8
|
|
|
|
jnz .ritick.2
|
2011-11-26 02:25:06 +01:00
|
|
|
.ritick.0:
|
2012-03-23 02:10:27 +01:00
|
|
|
movzx ecx, dh ; y
|
2012-03-15 02:02:08 +01:00
|
|
|
and cl, 0x0F
|
|
|
|
sub ebx, ecx
|
|
|
|
mov cl, dh
|
|
|
|
shr cl, 4 ; x
|
|
|
|
add eax, ecx
|
|
|
|
call ch_putpixel
|
|
|
|
jmp .exit
|
2011-11-26 02:25:06 +01:00
|
|
|
.ritick.1:
|
2012-08-29 02:20:57 +02:00
|
|
|
mov esi, nsvf_data.ri1 ; 8pix-ring
|
2012-03-16 00:11:54 +01:00
|
|
|
mov dl, 6
|
2012-03-15 02:02:08 +01:00
|
|
|
jmp .draw
|
2012-09-07 01:20:44 +02:00
|
|
|
.ritick.2:
|
|
|
|
mov esi, nsvf_data.ri2 ; 16pix-ring
|
|
|
|
mov dl, 14
|
|
|
|
jmp .draw
|
2012-03-15 02:02:08 +01:00
|
|
|
|
2011-11-26 02:25:06 +01:00
|
|
|
.lntick.short:
|
2012-03-15 02:02:08 +01:00
|
|
|
test dl, 0x06 ; ticks #0, 1 are reserved for
|
|
|
|
jz .ritick ; rotational invariants
|
|
|
|
and dl, 0x07 ; dl = line length
|
|
|
|
jmp .lntick.both
|
2011-11-26 02:25:06 +01:00
|
|
|
.lntick.long:
|
2012-03-15 02:02:08 +01:00
|
|
|
and dl, 0x07
|
|
|
|
add dl, 8
|
2011-11-26 02:25:06 +01:00
|
|
|
.lntick.both:
|
2012-03-15 02:02:08 +01:00
|
|
|
sub dl, 2 ; num_vertice = num_points - 2
|
|
|
|
and cl, 0x18 ; two (lower) rotation bits
|
|
|
|
shr cl, 3
|
2012-08-29 02:20:57 +02:00
|
|
|
mov esi, nsvf_data.blank
|
2012-03-16 00:11:54 +01:00
|
|
|
|
2011-11-26 02:25:06 +01:00
|
|
|
.draw:
|
2012-03-15 02:02:08 +01:00
|
|
|
; cl = rot; dl = numvert; dh = orig.xy
|
|
|
|
push ecx
|
2012-03-23 02:10:27 +01:00
|
|
|
movzx ecx, dh ; y
|
2012-03-15 02:02:08 +01:00
|
|
|
and cl, 0x0F
|
|
|
|
sub ebx, ecx
|
|
|
|
mov cl, dh
|
|
|
|
shr cl, 4 ; x
|
|
|
|
add eax, ecx
|
|
|
|
pop ecx
|
|
|
|
call draw_tick
|
2011-11-28 02:09:32 +01:00
|
|
|
.gptick.5:
|
2012-03-23 02:10:27 +01:00
|
|
|
.sptick:
|
2011-11-26 02:25:06 +01:00
|
|
|
.exit:
|
2012-03-15 02:02:08 +01:00
|
|
|
popad
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
diff16 "draw_tick : ",0,$
|
2011-11-26 02:25:06 +01:00
|
|
|
|
|
|
|
draw_tick:
|
|
|
|
; eax = x-origin
|
|
|
|
; ebx = y-origin
|
2012-03-15 02:02:08 +01:00
|
|
|
; edi = 0x0RRGGBB
|
|
|
|
; cl = direction (0..7)
|
|
|
|
; dl = number of vertice (dl)
|
|
|
|
; esi -> tick bitfield
|
2011-11-26 02:25:06 +01:00
|
|
|
|
|
|
|
pushad
|
2012-03-15 02:02:08 +01:00
|
|
|
call ch_putpixel ; the point of origin
|
|
|
|
and ecx, 7
|
|
|
|
lea ebp, [.move000+ ecx*4]
|
|
|
|
call ebp ; basic vector
|
|
|
|
call ch_putpixel
|
2012-03-23 02:10:27 +01:00
|
|
|
and edx, 15
|
|
|
|
jz .done ; no vertex (2pix line)
|
|
|
|
mov esi, dword [esi] ; 15 vertice will easily fit to 1dw
|
|
|
|
xchg esi, edx
|
2011-11-26 02:25:06 +01:00
|
|
|
.move_and_draw:
|
2012-03-23 02:10:27 +01:00
|
|
|
mov ch, dl
|
|
|
|
and ch, 3
|
|
|
|
jz .moved
|
|
|
|
dec ch
|
|
|
|
jz .1
|
|
|
|
dec ch
|
|
|
|
jz .2
|
|
|
|
.3:
|
|
|
|
dec cl
|
2011-11-28 02:09:32 +01:00
|
|
|
.1:
|
2012-03-23 02:10:27 +01:00
|
|
|
dec cl
|
|
|
|
jmp .wipe_it
|
2011-11-28 02:09:32 +01:00
|
|
|
.2:
|
2012-03-23 02:10:27 +01:00
|
|
|
inc cl
|
2012-03-15 02:02:08 +01:00
|
|
|
.wipe_it:
|
2012-03-23 02:10:27 +01:00
|
|
|
and ecx, 7
|
2011-11-28 02:09:32 +01:00
|
|
|
.moved:
|
2012-03-15 02:02:08 +01:00
|
|
|
diff16 "moved : ",0,$
|
|
|
|
lea ebp, [.move000+ ecx*4]
|
|
|
|
call ebp ; go new way
|
|
|
|
call ch_putpixel
|
2012-03-23 02:10:27 +01:00
|
|
|
shr edx, 2
|
|
|
|
dec esi
|
|
|
|
jnz .move_and_draw
|
2012-03-15 02:02:08 +01:00
|
|
|
diff16 "done : ",0,$
|
2011-11-26 02:25:06 +01:00
|
|
|
.done:
|
|
|
|
popad
|
|
|
|
ret
|
|
|
|
|
2012-03-15 02:02:08 +01:00
|
|
|
; WARNING! The order matters! ------
|
|
|
|
align 4
|
|
|
|
diff16 "move000 : ",0,$
|
2011-11-26 02:25:06 +01:00
|
|
|
.move000:
|
|
|
|
inc eax
|
|
|
|
ret
|
2012-03-15 02:02:08 +01:00
|
|
|
align 4
|
2011-11-26 02:25:06 +01:00
|
|
|
.move001:
|
|
|
|
inc eax
|
2011-11-28 02:09:32 +01:00
|
|
|
dec ebx
|
2011-11-26 02:25:06 +01:00
|
|
|
ret
|
2012-03-15 02:02:08 +01:00
|
|
|
align 4
|
2011-11-26 02:25:06 +01:00
|
|
|
.move010:
|
2011-11-28 02:09:32 +01:00
|
|
|
dec ebx
|
2011-11-26 02:25:06 +01:00
|
|
|
ret
|
2012-03-15 02:02:08 +01:00
|
|
|
align 4
|
2011-11-26 02:25:06 +01:00
|
|
|
.move011:
|
|
|
|
dec eax
|
2011-11-28 02:09:32 +01:00
|
|
|
dec ebx
|
2011-11-26 02:25:06 +01:00
|
|
|
ret
|
2012-03-15 02:02:08 +01:00
|
|
|
align 4
|
2011-11-28 02:09:32 +01:00
|
|
|
.move100:
|
2011-11-26 02:25:06 +01:00
|
|
|
dec eax
|
|
|
|
ret
|
2012-03-15 02:02:08 +01:00
|
|
|
align 4
|
2011-11-28 02:09:32 +01:00
|
|
|
.move101:
|
2011-11-26 02:25:06 +01:00
|
|
|
dec eax
|
2011-11-28 02:09:32 +01:00
|
|
|
inc ebx
|
2011-11-26 02:25:06 +01:00
|
|
|
ret
|
2012-03-15 02:02:08 +01:00
|
|
|
align 4
|
2011-11-28 02:09:32 +01:00
|
|
|
.move110:
|
|
|
|
inc ebx
|
2011-11-26 02:25:06 +01:00
|
|
|
ret
|
2012-03-15 02:02:08 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
diff10 "move111-move000 (must be 28!) : ",.move000,$
|
2011-11-28 02:09:32 +01:00
|
|
|
.move111:
|
2011-11-26 02:25:06 +01:00
|
|
|
inc eax
|
2011-11-28 02:09:32 +01:00
|
|
|
inc ebx
|
2011-11-26 02:25:06 +01:00
|
|
|
ret
|
|
|
|
|
2012-03-15 02:02:08 +01:00
|
|
|
;) ---------------
|
2011-11-26 02:25:06 +01:00
|
|
|
|
|
|
|
align 4
|
2012-03-15 02:02:08 +01:00
|
|
|
diff16 "checkscreen : ",0,$
|
2011-11-26 02:25:06 +01:00
|
|
|
ch_checkscreen:
|
|
|
|
cmp [Screen_Max_X], eax
|
2012-03-15 02:02:08 +01:00
|
|
|
jb .getout
|
2011-11-26 02:25:06 +01:00
|
|
|
cmp [Screen_Max_Y], ebx
|
|
|
|
.getout:
|
|
|
|
ret
|
|
|
|
|
|
|
|
align 4
|
2012-03-15 02:02:08 +01:00
|
|
|
diff16 "checkwin : ",0,$
|
2011-11-26 02:25:06 +01:00
|
|
|
ch_checkwin:
|
|
|
|
; eax = x coordinate
|
|
|
|
; ebx = y coordinate
|
|
|
|
; ebp -> font info
|
2012-03-29 01:12:25 +02:00
|
|
|
|
2012-03-15 02:02:08 +01:00
|
|
|
push eax
|
|
|
|
push ebx
|
2012-03-29 01:12:25 +02:00
|
|
|
push ecx
|
|
|
|
push edx
|
2012-03-15 02:02:08 +01:00
|
|
|
mov ch, byte[CURRENT_TASK]
|
|
|
|
mov edx, [_display.width] ; screen X-size
|
|
|
|
imul edx, ebx
|
|
|
|
add edx, [_WinMapAddress]
|
|
|
|
add edx, eax
|
|
|
|
cmp ch, byte [edx]
|
|
|
|
jne .fail
|
2012-03-29 01:12:25 +02:00
|
|
|
movzx eax, byte [ebp] ; char X-width
|
2012-03-15 02:02:08 +01:00
|
|
|
cmp ch, byte [edx+eax]
|
|
|
|
jne .fail
|
|
|
|
movzx ebx, byte [ebp+1]
|
|
|
|
imul ebx, [_display.width]
|
|
|
|
cmp ch, byte [edx+ebx]
|
|
|
|
jne .fail
|
|
|
|
add edx, eax
|
|
|
|
cmp ch, byte [edx+ebx]
|
|
|
|
clc
|
|
|
|
je .done
|
|
|
|
.fail:
|
|
|
|
stc ; CF means the charbox is invisible
|
2011-11-26 02:25:06 +01:00
|
|
|
.done:
|
2012-03-29 01:12:25 +02:00
|
|
|
pop edx
|
|
|
|
pop ecx
|
2012-03-15 02:02:08 +01:00
|
|
|
pop ebx
|
|
|
|
pop eax
|
|
|
|
ret
|
2011-11-26 02:25:06 +01:00
|
|
|
|
|
|
|
align 4
|
2012-03-15 02:02:08 +01:00
|
|
|
diff16 "ch_putpix : ",0,$
|
2012-03-29 01:12:25 +02:00
|
|
|
ch_putpixel:
|
2011-11-26 02:25:06 +01:00
|
|
|
; eax = x coordinate
|
|
|
|
; ebx = y coordinate
|
2012-03-15 02:02:08 +01:00
|
|
|
; edi = 0x0RRGGBB
|
2011-11-26 02:25:06 +01:00
|
|
|
push edx
|
|
|
|
mov edx, ebx
|
|
|
|
imul edx, [BytesPerScanLine]
|
|
|
|
lea edx, [edx+eax*4]
|
|
|
|
mov [LFB_BASE+edx], edi
|
2011-11-29 10:40:16 +01:00
|
|
|
pop edx
|
2011-11-26 02:25:06 +01:00
|
|
|
ret
|
|
|
|
;)
|
2012-03-29 01:12:25 +02:00
|
|
|
;ch_putpixel2:
|
2012-03-23 02:10:27 +01:00
|
|
|
; test version!!! ===== to be removed!!
|
|
|
|
; eax = x coordinate
|
|
|
|
; ebx = y coordinate
|
|
|
|
; edi = 0x0RRGGBB
|
|
|
|
push edx
|
|
|
|
mov edx, ebx
|
|
|
|
shl edx, 1
|
|
|
|
imul edx, [BytesPerScanLine]
|
|
|
|
lea edx, [edx+eax*8]
|
|
|
|
add edx, LFB_BASE
|
|
|
|
mov [edx], edi
|
|
|
|
mov [edx+4], edi
|
|
|
|
sub edx, [BytesPerScanLine]
|
|
|
|
mov [edx], edi
|
|
|
|
mov [edx+4], edi
|
|
|
|
pop edx
|
|
|
|
ret
|
2011-11-26 02:25:06 +01:00
|
|
|
|
2011-11-29 10:40:16 +01:00
|
|
|
|
2012-08-29 02:20:57 +02:00
|
|
|
diff10 "new font code size",nsvf_code,$
|