End program: visual style refactoring, code cleanup and optimization

git-svn-id: svn://kolibrios.org@4044 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2013-10-17 14:31:03 +00:00
parent 26bbe58915
commit 51ae21e2b3
3 changed files with 82 additions and 128 deletions

View File

@ -0,0 +1,6 @@
@erase lang.inc
@echo lang fix it >lang.inc
@fasm end.asm end
@kpack end
@erase lang.inc
@pause

View File

@ -0,0 +1,42 @@
if lang eq ru
label2:
db '‚몫îç¨âì Ÿ¤à®',0
label3:
db '<27>¥à¥§ ¯ã᪠Žâ¬¥­ ',0
label4:
db '‘®åà ­¨âì ­ áâனª¨ (Ctrl-S)',0
else if lang eq ge
label2:
db ' Beenden Kernel',0
label3:
db ' Neustart Abbrechen',0
label4:
db 'Save your settings (Ctrl-S)',0
else if lang eq it
label2:
db ' Spegni Kernel',0
label3:
db ' Riavvio Annulla',0
label4:
db 'Salva impostazioni (Ctrl-S)',0
else
label2:
db 'Power off Kernel',0
label3:
db ' Restart Cancel',0
label4:
db 'Save your settings (Ctrl-S)',0
end if
label5:
db '(End) (Home)',0
label6:
db '(Enter) (Esc)',0
rdsave:
dd 7,0,0,0,0
db '/sys/rdsave',0

View File

@ -2,93 +2,52 @@
; END
; KolibriOS Team 2005-2013
;
; <diamond> note that 'mov al,xx' is shorter than 'mov eax,xx'
; and if we know that high 24 bits of eax are zero, we can use 1st form
; the same about ebx,ecx,edx
include "lang.inc"
include "..\..\..\macros.inc"
meos_app_start
code
do_draw:
draw_window:
mcall 12,1
mov al,14 ; eax=14 - get screen max x & max y
mcall
mcall 14 ;eax=14 - get screen max x & max y
movzx ecx,ax
shr eax,17
shl eax,16
lea ebx,[eax-110*10000h+222]
lea ebx,[eax-110 shl 16+222]
shr ecx,1
shl ecx,16
sub ecx,50*10000h - 115
lea ecx,[ecx-70 shl 16+137]
xor eax,eax ; define and draw window
mov edx,0x01cccccc
mov esi,edx
mov edi,edx
mcall
mcall 0, , ,0x01ffffff ;define and draw window
mcall 13,0 shl 16+222,0 shl 16+230, 0xcccccc
mcall ,19 shl 16+87,21 shl 16+24, 0x555555
push ebx
mcall ,122 shl 16+87
xchg ebx,[esp]
mcall ,,55 shl 16+24
pop ebx
mcall
mcall 13, 223 , 138 ,0x9098b0
mcall ,<1,221>,<1,136>,0xffffff
mcall ,<2,220>,<2,135>,0xe4dfe1
mcall ,<16,189>,<97,23>,0x9098b0
mov al,8
mcall ,15 shl 16+87,17 shl 16+24,4,0xaa0044
mcall ,118 shl 16+87,,2,0xbb7700
mcall ,15 shl 16+87,51 shl 16+24,3,0x8800
mcall ,118 shl 16+87,,1,0x999999
mcall ,10 shl 16+200,88 shl 16+15,0x40000005
mcall 38,27 shl 16 +193,102 shl 16 +102,0x000000dd
mcall 8,<16,90> ,<20,27>,4,0x990022 ;eax=8 - draw buttons
mcall ,<113,90>, ,2,0xaa7700
mcall , ,<54,27>,1,0x777777
mcall ,<16,90> , ,3,0x007700
mcall ,<17,186>,<98,20>,5,0xe4dfe1
mov al,4 ; 0x00000004 = write text
mov ebx,28*65536+93
mov ecx,0x800000dd
mov edx,label4
mcall
mov ecx,0x90eeeeee ; 8b window nro - RR GG BB color
mov ebx,24*65536+20
mov edx,label2 ; pointer to text beginning
mcall
mov ebx,19*65536+54
mov edx,label3
mcall
mov ebx,44*65536+31
mov edx,label5
mcall
mov ebx,39*65536+65
mov edx,label6
mcall
mcall 4,<28,105>,0x80000000,label4 ;eax=4 - write text
mcall ,<35,24> ,0x80ffffff,label2
mcall ,<34,58> , ,label3
mcall ,<47,37> , ,label5
mcall ,<43,71> , ,label6
mcall 12,2
still:
mov eax,10 ; wait here for event
mcall
mcall 10 ;wait here for event
dec eax
jz do_draw
jz draw_window
dec eax
jnz button
key:
mov al,2 ; now eax=2 - get key code
mcall
mcall 2 ;eax=2 - get key code
mov al,ah
cmp al,13
jz restart
@ -103,8 +62,7 @@ still:
jmp still
button:
mov al,17 ; now eax=17 - get pressed button id
mcall
mcall 17 ;eax=17 - get pressed button id
xchg al,ah
dec eax
jz close_1
@ -114,81 +72,29 @@ still:
jz restart
dec eax
jnz run_rdsave
; we have only one button left, this is close button
; dec eax
; jnz still
power_off:
push 2
jmp mcall_and_close
close_1:
or eax,-1
mcall
restart:
push 3
jmp mcall_and_close
restart_kernel:
push 4
mcall_and_close:
pop ecx
mcall 18,9
jmp close_1
close_1:
mcall -1
run_rdsave:
mov eax,70
mov ebx,rdsave
mcall
mcall 70,rdsave
jmp still
data
include 'data.inc'
if lang eq ru
label2:
db '‚몫îç¨âì Ÿ¤à®',0
label3:
db '<27>¥à¥§ ¯ã᪠Žâ¬¥­ ',0
label4:
db '‘®åà ­¨âì ­ áâனª¨ (Ctrl-S)',0
else if lang eq ge
label2:
db ' Beenden Kernel',0
label3:
db ' Neustart Abbrechen',0
label4:
db 'Save your settings (Ctrl-S)',0
else if lang eq it
label2:
db ' Spegni Kernel',0
label3:
db ' Riavvio Annulla',0
label4:
db 'Salva impostazioni (Ctrl-S)',0
else
label2:
db 'Power off Kernel',0
label3:
db ' Restart Cancel',0
label4:
db 'Save your settings (Ctrl-S)',0
end if
label5:
db '(End) (Home)',0
label6:
db '(Enter) (Esc)',0
rdsave:
dd 7
dd 0
dd 0
dd 0
dd 0
db '/sys/rdsave',0
udata
meos_app_end