kolibrios/programs/games/klavisha/trunk/klavisha.asm

663 lines
17 KiB
NASM
Raw Normal View History

; --------------------------------------------------------
; KJ|ABuIIIA - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A5AD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6A8AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
;---------------------------------------------------------------------
; version: 0.95
; last update: 19/08/2011
; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: 1) Checking for "rolled up" window
; 2) Code optimization
; 3) Clearing source
;---------------------------------------------------------------------
; version: 0.90
; last update: 24/07/2010
; changed by: <20><><EFBFBD><20><><EFBFBD><E5A0A9><EFBFBD><EFBFBD><EFBFBD> (Dron2004)
;
; <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><EFBFBD>: 24.07.2010 21:15 GMT+6
;---------------------------------------------------------------------
use32
org 0x0
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd I_END
dd stacktop
dd params
dd 0x0
;---------------------------------------------------------------------
include 'lang.inc'
include '../../../macros.inc'
;---------------------------------------------------------------------
;<3B><><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
START:
;<3B><><EFBFBD><EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD>
mcall 68,11
; call get_screen_params
; mov eax,0x0000001C
; cmp eax,0x0
; je start_with_internal_text ; <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; <20><><EFBFBD><E0A0AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>! <20><><EFBFBD><E2A0A5><EFBFBD> <20><20><><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><><E0A0A7><EFBFBD><><E4A0A9>... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!!!
mov eax,5
mov [arg1],eax
xor eax,eax
mov [arg2],eax
mov [arg3],eax
mov [arg4],eax
mov eax,filedatastruct
mov [arg5],eax
mov eax,[0x0000001C]
mov [arg7],eax
mcall 70,filestruct
test eax,eax
jne start_with_internal_text ;<3B><EFBFBD><E8A8A1>
mov eax, dword [size]
mov [filesize], eax ;⥯<><E2A5AF><EFBFBD><><E0A0A7><EFBFBD><><E4A0A9> <20> <20><><EFBFBD> <20> filesize
;<3B><EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><>
mov ecx, [filesize]
inc ecx ;<3B><EFBFBD><EBA4A5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥫쭮 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><>, <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0xFF
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> "<22><><EFBFBD><EFBFBD><EFBFBD>" KLA-䠩<><E4A0A9><EFBFBD>
mcall 68,12
mov [datastart], eax ;<3B> <20><><EFBFBD><E0A5AC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E2A091><EFBFBD><EFBFBD><><E2A5AF><EFBFBD> <20><><EFBFBD><E5AEA4><EFBFBD><EFBFBD><><E3AAA0><EFBFBD>
add eax, [filesize]
mov bh, 0xFF
mov [eax], bh
;<3B><><EFBFBD><EFBFBD><EFBFBD><E2A2A5><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EBA2A0><> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
xor eax,eax
mov [arg1],eax ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>㭪樨
mov [arg2],eax ;<3B><><EFBFBD><EFBFBD><E9A5AD> <20><><E4A0A9>
mov [arg3],eax ;<3B><><EFBFBD><EFBFBD>訩 dword ᬥ饭<E1ACA5><E9A5AD>
mov eax,[filesize]
mov [arg4],eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>
mov eax,[datastart]
mov [arg5],eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax,par
mov [arg7],eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> ASCIIZ-<2D><><EFBFBD>
mcall 70,filestruct
test eax,eax
je initialize_variables
start_with_internal_text:
mov edx, string
mov [datastart], edx
; mov edx, string ; <20><EFBFBD><E1AFAE><EFBFBD><20><><EFBFBD><EFBFBD><E0AEA5><EFBFBD><EFBFBD><><E2A5AA>
initialize_variables:
mov edx,[datastart]
mov [currentsymb],edx ; <20><>砫쭠<E7A0AB> <20><><EFBFBD><EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5AC><EFBFBD><EFBFBD><EFBFBD>
mov [startline],edx
mov [lastsymb],edx
mov [lessonstart],edx
xor eax,eax
inc eax
mov [currentline], eax
call count_lines
;---------------------------------------------------------------------
redraw:
call draw_window
;---------------------------------------------------------------------
;<3B><EFBFBD><E1ADAE><EFBFBD><EFBFBD><>
event_wait:
mcall 10
cmp eax, 1 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD> <20><EFBFBD>
je redraw
cmp eax, 2 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
je key
cmp eax, 3 ;<3B><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
je button
jmp event_wait
;---------------------------------------------------------------------
key:
mcall 2 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ah
push eax
;<3B><><EFBFBD><EFBFBD><EFBFBD><E1AAA0> <20><><EFBFBD><EFBFBD><20><EFBFBD><E0A5AC><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD>
; <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1AAAE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax, [currentsymb]
cmp eax, [lessonstart]
jne not_first_symbol
mov eax,[mistakes]
test eax,eax
jne not_first_symbol
mcall 26,9
mov [typestarttime], eax
not_first_symbol:
pop eax
;<3B><EFBFBD><E0AEA2>塞, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A8AB> <20><><><E2A5AA>
mov esi, [currentsymb]
mov al, byte [esi]
cmp al, 0xFF
je text_end
cmp al, 0xFE
je text_end
push ebx
mov ebx, [currentsymb]
mov al, byte [ebx]
pop ebx
test al,al
jne not_new_line
cmp ah, 0x0D
je correct_key_nl
cmp ah, 0x20
je correct_key_nl
jmp not_this_key
;---------------------------------------------------------------------
correct_key_nl:
mov eax, [currentsymb]
inc eax
mov [startline], eax
mov eax, [currentsymb]
inc eax
mov [currentsymb], eax
mov [lastsymb], eax
mov eax, [currentline]
inc eax
mov [currentline], eax
mov eax, [symbtyped] ;<3B><><EFBFBD><EFBFBD><EFBFBD><20><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20><> 1
inc eax
mov [symbtyped], eax
call count_speed
; call draw_speed
jmp redraw
;---------------------------------------------------------------------
not_new_line:
cmp ah, al
jne not_this_key
correct_key:
mov eax, [currentsymb]
inc eax
mov [currentsymb], eax
mov [lastsymb], eax
mov eax, [symbtyped] ;<3B><><EFBFBD><EFBFBD><EFBFBD><20><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20><> 1
inc eax
mov [symbtyped], eax
call count_speed
; call draw_speed
call redraw_2_symbols
jmp event_wait
;---------------------------------------------------------------------
not_this_key:
mov esi, [mistakes]
inc esi
mov [mistakes], esi
call redraw_mistakes
jmp event_wait
;---------------------------------------------------------------------
text_end:
; /// <20><EFBFBD><E0A5AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><E7A0AD> <20><EFBFBD>
; <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov esi, [startline]
cmp esi, lessoncomplete
je text_end_already_shown
; ///////////////////////////
call speed_to_string
mov esi, lessoncomplete
mov [startline], esi
mov esi, lessoncompleteend
dec esi
mov [currentsymb], esi
call draw_window
text_end_already_shown:
jmp event_wait
;---------------------------------------------------------------------
button:
mcall 17 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ah
cmp ah, 1 ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jne no_close
mcall -1
no_close:
;<3B><EFBFBD><E0AEA2><20><><EFBFBD><E2A0AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cmp ah, 0x02
jne no_button_2
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2
;---------------------------------------------------------------------
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
;---------------------------------------------------------------------
xor eax, eax
mov [mistakes], 0x0
mov esi, [lastsymb]
mov al, [esi]
;<3B><EFBFBD> <20><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><><E1A8AC><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD>. <20>᫨ 0xFF -
;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E7A8AB>, <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᭠砫<E1ADA0>
cmp al, 0xFF
je start_1st_lesson
cmp al, 0xFE ; <20><> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ப?
jne not_completed_previous
init_level_after_fe:
;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><>, <20><> <20><EFBFBD>ਬ, <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><E7A0A9><><E1ABA5><EFBFBD>騬 ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD> 0xFF
inc esi
mov al, [esi]
cmp al, 0xFF
;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> - <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><><E1ABA5><EFBFBD><20>
jne set_lesson_start_from_esi
start_1st_lesson:
mov esi, [datastart]
set_lesson_start_from_esi:
mov [startline], esi
mov [currentsymb], esi
mov [lastsymb], esi
mov [lessonstart], esi
xor eax,eax
jmp no_button_3.2
; inc eax
; mov [currentline], eax
; call count_lines
; call reset_speed_counters
; jmp redraw
;---------------------------------------------------------------------
not_completed_previous:
inc esi
mov al, [esi]
cmp al, 0xFF
je start_1st_lesson
cmp al, 0xFE
je init_level_after_fe
jmp not_completed_previous
;---------------------------------------------------------------------
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
;---------------------------------------------------------------------
no_button_2:
cmp ah,0x03
jne no_button_3
;<3B><><EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2>
mov edx,[lessonstart]
jmp no_button_3.1
; mov [currentsymb],edx
; mov [startline],edx
; mov [lastsymb],edx
; xor eax,eax
; mov [mistakes],eax
; inc eax
; mov [currentline],eax
; call reset_speed_counters
; call count_lines
; jmp redraw
;---------------------------------------------------------------------
no_button_3:
cmp ah,0x04
jne event_wait
;<3B><><EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0A6><EFBFBD><EFBFBD><EFBFBD>
mov edx,[datastart]
mov [lessonstart],edx
.1:
mov [currentsymb],edx
mov [startline],edx
mov [lastsymb],edx
xor eax,eax
mov [mistakes],eax
.2:
inc eax
mov [currentline],eax
call reset_speed_counters
call count_lines
jmp redraw
;---------------------------------------------------------------------
;<3B><><EFBFBD><EFBFBD>稬 ⥪<><20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
get_window_param:
mcall 9,procinfo,-1
ret
;---------------------------------------------------------------------
;"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <20>ணࠬ<E0AEA3><E0A0AC> - <20><EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD><E1AEA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><>⠫쭮<E2A0AB> - <20><EFBFBD><E3ABAE><EFBFBD><EFBFBD> <20>-)) )
draw_window:
mcall 12,1
mov ax,[areawidth] ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> draw_window?
test ax,ax
jne .dw_not_first_call
call get_screen_params ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD> <20><><EFBFBD> - <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.dw_not_first_call:
;<3B> ebx - X <20> <20><><EFBFBD>
mov bx,[windowx]
shl ebx,16
mov bx,780
; mov ebx,10*65536+780
;<3B> ecx - Y <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov cx, [windowy]
shl ecx,16
mov cx,580
; mov ecx,10*65536+580
xor esi,esi
;<3B><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><EBA2A5><EFBFBD> <20><><EFBFBD><EFBFBD>
mcall 0,,,0x33CCCCCC,,text
call get_window_param
mov eax,[procinfo+70] ;status of window
test eax,100b
jne .end
;<3B><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><E2A5AA> <20><> <20><><EFBFBD>
mcall 8,<295,145>,<8,18>,2,0x0099CC99
;<3B><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mcall ,<450,145>,,3,0x00CC9999
;<3B><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mcall ,<605,145>,,4,0x00DD7777
;<3B><EFBFBD><EBA2AE><EFBFBD><><E2A5AA> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mcall 4,<310,14>,0x80000000,buttontext
mcall ,<465,14>,,retrybuttontext
mcall ,<626,14>,,restartbuttontext
; <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD>
xor ebp,ebp
mcall 65,logo,<32,12>,<12,12>,1,green_text
;<3B><><EFBFBD><EFBFBD>稬 ⥪<><20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
call get_window_param
add ebx,0x2A
mov eax,[ebx]
mov [windowwidth], eax
mov ebx,procinfo
add ebx,0x2E
mov eax,[ebx]
mov [windowheight], eax
;draw_error_count:
; <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
mcall 4,<60,15>,0x80AA0000,mistakestext
; <20><EFBFBD><EBA2A5><EFBFBD> <20><><20><EFBFBD><E8A8A1>
mcall 47,0x80040000,[mistakes],<105,15>,0x00AA0000
;draw_line_number:
; <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD> <20><>"
mcall 4,<140,15>,0x8000AA00,lineistext
;<3B><EFBFBD><EBA2A5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><><20><><EFBFBD>
mcall 47,80040000,[currentline],<195,15>,0x0000AA00
;<3B><EFBFBD><EBA2A5><EFBFBD><><E2A5AA><EFBFBD><EFBFBD> <20><><EFBFBD>
mcall ,,[linecount],<252,15>,
;<3B><EFBFBD><EBA2A5><EFBFBD><>稩 ⥪<><E2A5AA>
call draw_text
.end:
mcall 12,2
ret
;---------------------------------------------------------------------
draw_text:
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2AEA2> <20> <20><EFBFBD><EBA2AE><><E2A5AA><EFBFBD>
mov edx,40 ;<3B><>砫쭮<E7A0AB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EBA2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A5AA><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><E2A8AA><EFBFBD>
mov esi,[startline]
dec esi ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><>. *1 <20><><EFBFBD><EFBFBD>)!
mov ebx,esi ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> edx - <20><><EFBFBD> <20><EFBFBD><EBA2AE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
.start:
;<3B><><EFBFBD><EFBFBD><EFBFBD><E9A8A2><EFBFBD><><E3AAA0><EFBFBD> <20><><>騩 ᨬ<><E1A8AC><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
inc ebx ;(*1)
.draw_text_without_inc:
;<3B><><EFBFBD>ਬ,<2C><> <20><><EFBFBD><E5AEA4> <20><><><E2A5AA> <20><> <20><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD>
mov esi,[windowheight] ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> esi ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD>
mov eax,edx
and eax,0x0000FFFF
add eax,64
cmp eax,esi
ja end_draw_text ;<3B><> <20><><EFBFBD><E5AEA4> <20><> <20><EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E1AEA2><EFBFBD>.
;<3B><><EFBFBD><E2A0AD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E0A8A7><EFBFBD> (+18 <20><><20><><EFBFBD><EFBFBD>樨)
mov esi,18*65536
add edx,esi
; <20><><EFBFBD>ਬ, <20><> <20><><20><><><E2A5AA> <20><> <20><EFBFBD><E0A0AD><EFBFBD> <20><> <20><><EFBFBD><E0A8A7><EFBFBD>
; <20><20><>襫 - <20><> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><>
mov esi,[windowwidth] ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> esi ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD>
shl esi,16
mov eax,edx
and eax,0xFFFF0000
add eax,40*65536
cmp eax,esi
jna .horizontal_check_ok ;<3B>᫨ eax>est, <20><> <20><> <20><><EFBFBD><E5AEA4> <20><> <20><EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><EFBFBD>.
.skip_line_end_step:
mov ah,byte [ebx]
cmp ah,0x00
je .end_line_to_next_line
cmp ah,0xFE
je end_draw_text
cmp ah,0xFF
je end_draw_text
inc ebx
jmp .skip_line_end_step
;-------------------------------------------
.end_line_to_next_line:
and edx,0x0000FFFF
jmp .draw_text_without_inc
;-------------------------------------------
.horizontal_check_ok:
;<3B><EFBFBD>ਬ, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A8AB> <20><> <20>
mov esi, [startline]
cmp esi, lessoncomplete
jne .in_process
;<3B><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A8AB>, ⥪<><E2A5AA> <20><EFBFBD><EBA2AE><EFBFBD><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov edi, green_text
jmp .color_set_sucessful
;--------------------------------------------
.in_process:
cmp ebx, [currentsymb] ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><20><><EFBFBD><EFBFBD><EFBFBD><E0A0A5><EFBFBD><><E1A8AC><EFBFBD>?
je .red ; <20><><EFBFBD> <20><>筮!
ja .black ; <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>, <20><><EFBFBD> <20><> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
mov edi, gray_text ; <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>, <20><><EFBFBD> <20><><20><><EFBFBD><EFBFBD>
jmp .color_set_sucessful
;--------------------------------------------
.red:
mov edi, red_text
jmp .color_set_sucessful
;---------------------------------------------
.black:
mov edi, black_text ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><>
.color_set_sucessful:
xor esi,esi
movzx si, byte [ebx]
cmp si, 0x0000
jne .continue_drawing
; call increase_y;
; <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><E2A8AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><EFBFBD><EBA2AE> <20>㪢,
; <20><20><><EFBFBD><EFBFBD><E7A8AB><EFBFBD> <20><><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A8AB> <20><><EFBFBD><EFBFBD> 0x00)
and edx,0x0000FFFF
add edx, 33
jmp .continue_text_proc
;----------------------------------------------
.continue_drawing:
cmp si, 0x00FF
je end_draw_text
cmp si, 0x00FE
je end_draw_text
;<3B><><EFBFBD><20><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
push ebx
push edx
movzx eax, byte [ebx]
shl eax,6
add eax, big_font
mov ebx, eax
pop edx
mov ecx, 16*65536+32
; <20> edx <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD>
mov esi, 1
; <20> edi <20><><EFBFBD><EFBFBD><EFBFBD><><E3AAA0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (梥<> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
xor ebp,ebp
mcall 65
pop ebx
;<3B><> <20><20><><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.continue_text_proc:
; inc edi
jmp .start
end_draw_text:
ret
;---------------------------------------------------------------------
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
redraw_2_symbols:
;<3B><EFBFBD>ਬ, <20><> <20><EFBFBD><EBA9A4> <20><> <20><> <20><><EFBFBD> <20><><EFBFBD><E1AEA2><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A8AC>
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><20><EFBFBD><EBA9A4> - <20><><EFBFBD><E0AEAB><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><E0A8A7><EFBFBD>
mov esi, [windowwidth] ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> esi ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD>
mov eax, [currentsymb]
sub eax, [startline]
mov ecx, 18
mul ecx
add eax, 20
add eax, 20
add eax, 40
cmp eax, esi
jna r2s_horizontal_check_ok ;<3B>᫨ eax>est, <20><> <20><> <20><><EFBFBD><E5AEA4> <20><> <20><EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><EFBFBD>.
;<3B>⠪, <20><> <20><><EFBFBD><E5AEA4> <20><> <20><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD>... <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>...
;<3B><><EFBFBD> <20><EFBFBD><E0A8A4><EFBFBD><EFBFBD> <20><><EFBFBD><E0AEAB><EFBFBD><EFBFBD>...
mov eax, [currentsymb]
dec eax
mov [startline], eax
call draw_window
jmp return_from_redraw_2_symbols
;---------------------------------------------------------------------
r2s_horizontal_check_ok:
;<3B><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebx, [currentsymb]
dec ebx
movzx eax, byte [ebx]
shl eax,6
add eax, big_font
mov ebx, eax
mov ecx, 16*65536+32
mov eax, [currentsymb]
sub eax, [startline]
dec eax
imul eax,18
add eax, 18
shl eax,16
add eax, 40
mov edx, eax
xor ebp,ebp
mcall 65,,,,1,gray_text
;<3B><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
mov ebx, [currentsymb]
movzx eax, byte [ebx]
shl eax,6
add eax, big_font
mov ebx, eax
mov ecx, 16*65536+32
mov eax, [currentsymb]
sub eax, [startline]
imul eax,18
add eax, 18
shl eax,16
add eax, 40
mov edx, eax
mcall 65,,,,1,red_text
return_from_redraw_2_symbols:
ret
;---------------------------------------------------------------------
redraw_mistakes:
;<3B><><EFBFBD><EFBFBD><EFBFBD><20><>אַ㣮<EFACAE><EFBFBD>
mcall 13,<59,75>,<14,10>,0x00CCCCCC
; <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
mcall 4,<60,15>,0x80AA0000,mistakestext
; <20><EFBFBD><EBA2A5><EFBFBD> <20><><20><EFBFBD><E8A8A1>
mcall 47,0x80040000,[mistakes],<105,15>,0x00AA0000
ret
;---------------------------------------------------------------------
count_lines:
xor ecx, ecx ; <20> ecx - <20><><EFBFBD><EFBFBD><20><>
inc ecx ; <20> <20><><EFBFBD> 1 <20><><EFBFBD>
; <20><><EFBFBD><E7A8AD><EFBFBD><><E0A0A7><EFBFBD>...
mov eax, [startline]
dec eax
cl_next_step:
inc eax
mov bh, [eax]
cmp bh, 0x00
jne cl_not_new_line
inc ecx
jmp cl_next_step
;---------------------------------------------------------------------
cl_not_new_line:
cmp bh, 0xFE
je cl_end
cmp bh, 0xFF
je cl_end
jmp cl_next_step
;---------------------------------------------------------------------
cl_end:
mov [linecount],ecx
ret
;---------------------------------------------------------------------
reset_speed_counters:
xor eax,eax
mov [symbtyped],eax
mov [typestarttime],eax
mov [currenttime],eax
mov [typingspeed],eax
ret
;---------------------------------------------------------------------
count_speed:
mcall 26,9
mov [currenttime], eax
mov ebx, [typestarttime]
sub eax, ebx ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> eax - <20><><20><><EFBFBD><EFBFBD><E8A5A4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> ᥪ㭤
mov ecx, [symbtyped]
cmp ecx, 0x00
jne cs_all_ok
inc ecx
cs_all_ok:
xor edx, edx;
div ecx ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> eax - <20><EFBFBD><E0A5A4><EFBFBD> <20><><20><><EFBFBD><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ecx, eax
cmp ecx, 0x00
jne cs_all_ok_2
inc ecx
cs_all_ok_2:
xor edx, edx
mov eax, 6000
div ecx
mov [typingspeed], eax ;<3B><><EFBFBD> <20> <20><><EFBFBD>. <20> [typingspeed] - <20><EFBFBD><E0A5A4><EFBFBD><><E1AAAE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ret
;---------------------------------------------------------------------
speed_to_string:
; <20><EFBFBD><EFBFBD><E0A0A7><EFBFBD> <20><><20> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><> <20><><EFBFBD> <20><><EFBFBD><E0A5AC><EFBFBD><EFBFBD><EFBFBD> speedbytes <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
xor edx, edx
mov eax, [typingspeed]
mov ecx, 10
div ecx
add dl, 30h
mov [speedbytes + 3], dl
xor edx, edx
div ecx
add dl, 30h
mov [speedbytes + 2], dl
xor edx, edx
div ecx
add dl, 30h
mov [speedbytes + 1], dl
xor edx, edx
div ecx
cmp dl, 0x00
je sts_move_space
add dl, 30h
mov [speedbytes], dl
jmp sts_end
;---------------------------------------------------------------------
sts_move_space:
mov [speedbytes], 0x20
sts_end:
ret
;---------------------------------------------------------------------
get_screen_params:
mcall 14
mov [areaheight], ax
push ax
shr eax, 16
mov [areawidth],ax
;<3B> ax <20><> <20><EFBFBD><E0A5A6><EFBFBD><EFBFBD> <20><><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><E1AFAE><EFBFBD><EFBFBD><E3A5AC> <20>
sub ax, 780 ;<3B><><EFBFBD><20><><EFBFBD><E7A0AB><EFBFBD><EFBFBD><><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD>
shr ax, 1
mov [windowx], ax
; <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
xor ax, ax
pop ax ; <20><><EFBFBD><E2AEAB><EFBFBD><EFBFBD> <20><> <20><EFBFBD> <20><><EFBFBD><EFBFBD><E7A5AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sub ax, 580
shr ax, 1
mov [windowy], ax
ret
;---------------------------------------------------------------------
;draw_speed:
;<3B><><EFBFBD><EFBFBD><EFBFBD><20><>אַ㣮<EFACAE><EFBFBD>
; mcall 13,<59,340>,<29,10>,0x00CCCCCC
; <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>):"
; mcall 4,<60,30>,0x80008800,speedtext
; <20><EFBFBD><EBA2A5><EFBFBD> <20><>
; mcall 47,0x80040000,[typingspeed],<305,30>,0x00008800
; ret
;---------------------------------------------------------------------
include 'data.inc'
;---------------------------------------------------------------------
IM_END:
;---------------------------------------------------------------------
par:
params:
rb 1024
;---------------------------------------------------------------------
procinfo:
rb 1024
;---------------------------------------------------------------------
rb 1024
stacktop:
;---------------------------------------------------------------------
I_END: