2011-01-18 17:29:19 +03:00
|
|
|
;
|
|
|
|
; END
|
2013-04-03 17:24:07 +04:00
|
|
|
; KolibriOS Team 2005-2013
|
2011-01-18 17:29:19 +03:00
|
|
|
;
|
|
|
|
include "lang.inc"
|
|
|
|
include "..\..\..\macros.inc"
|
2013-10-19 14:24:30 +04:00
|
|
|
; <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
|
2011-01-18 17:29:19 +03:00
|
|
|
|
|
|
|
meos_app_start
|
|
|
|
code
|
2013-10-17 18:31:03 +04:00
|
|
|
draw_window:
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,12
|
|
|
|
mcall ,1
|
2011-01-18 17:29:19 +03:00
|
|
|
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,14
|
|
|
|
mcall ;eax=14 - get screen max x & max y
|
2011-01-18 17:29:19 +03:00
|
|
|
movzx ecx,ax
|
|
|
|
shr eax,17
|
|
|
|
shl eax,16
|
2013-10-17 18:31:03 +04:00
|
|
|
lea ebx,[eax-110 shl 16+222]
|
2011-01-18 17:29:19 +03:00
|
|
|
shr ecx,1
|
|
|
|
shl ecx,16
|
2013-10-19 14:24:30 +04:00
|
|
|
lea ecx,[ecx-65 shl 16+137]
|
2011-01-18 17:29:19 +03:00
|
|
|
|
2013-10-19 14:24:30 +04:00
|
|
|
xor eax,eax
|
|
|
|
mcall , , ,0x019098b0,0x01000000 ;define and draw window
|
2011-01-18 17:29:19 +03:00
|
|
|
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,13
|
|
|
|
mcall ,<0,223> ,<0,275>
|
2013-10-17 18:31:03 +04:00
|
|
|
mcall ,<1,221>,<1,136>,0xffffff
|
|
|
|
mcall ,<2,220>,<2,135>,0xe4dfe1
|
|
|
|
mcall ,<16,189>,<97,23>,0x9098b0
|
|
|
|
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,8
|
|
|
|
mcall ,<16,90> ,<20,27>,4,0x990022 ;eax=8 - draw buttons
|
2013-10-17 18:31:03 +04:00
|
|
|
mcall ,<113,90>, ,2,0xaa7700
|
|
|
|
mcall , ,<54,27>,1,0x777777
|
|
|
|
mcall ,<16,90> , ,3,0x007700
|
|
|
|
mcall ,<17,186>,<98,20>,5,0xe4dfe1
|
2011-01-18 17:29:19 +03:00
|
|
|
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,4
|
|
|
|
mcall ,<28,105>,0x80000000,label4 ;eax=4 - write text
|
2013-10-17 18:31:03 +04:00
|
|
|
mcall ,<35,24> ,0x80ffffff,label2
|
|
|
|
mcall ,<34,58> , ,label3
|
|
|
|
mcall ,<47,37> , ,label5
|
|
|
|
mcall ,<43,71> , ,label6
|
|
|
|
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,12
|
|
|
|
mcall ,2
|
2011-01-18 17:29:19 +03:00
|
|
|
|
2013-10-17 18:31:03 +04:00
|
|
|
still:
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,10
|
|
|
|
mcall ;wait here for event
|
2011-01-18 17:29:19 +03:00
|
|
|
dec eax
|
2013-10-17 18:31:03 +04:00
|
|
|
jz draw_window
|
2011-01-18 17:29:19 +03:00
|
|
|
dec eax
|
|
|
|
jnz button
|
2013-10-17 18:31:03 +04:00
|
|
|
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,2
|
|
|
|
mcall ;eax=2 - get key code
|
2011-01-18 17:29:19 +03:00
|
|
|
mov al,ah
|
|
|
|
cmp al,13
|
|
|
|
jz restart
|
|
|
|
cmp al,19
|
|
|
|
jz run_rdsave
|
|
|
|
cmp al,27
|
|
|
|
jz close_1
|
|
|
|
cmp al,180
|
|
|
|
jz restart_kernel
|
|
|
|
cmp al,181
|
|
|
|
jz power_off
|
|
|
|
jmp still
|
|
|
|
|
2013-10-17 18:31:03 +04:00
|
|
|
button:
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,17
|
|
|
|
mcall ;eax=17 - get pressed button id
|
2011-01-18 17:29:19 +03:00
|
|
|
xchg al,ah
|
|
|
|
dec eax
|
2012-05-25 13:21:47 +04:00
|
|
|
jz close_1
|
2011-01-18 17:29:19 +03:00
|
|
|
dec eax
|
|
|
|
jz restart_kernel
|
|
|
|
dec eax
|
|
|
|
jz restart
|
|
|
|
dec eax
|
|
|
|
jnz run_rdsave
|
2013-10-19 14:24:30 +04:00
|
|
|
; dec eax ; we have only one button left, this is close button
|
|
|
|
; jnz still
|
2013-10-17 18:31:03 +04:00
|
|
|
|
2012-05-25 13:21:47 +04:00
|
|
|
power_off:
|
|
|
|
push 2
|
|
|
|
jmp mcall_and_close
|
|
|
|
restart:
|
2011-01-18 17:29:19 +03:00
|
|
|
push 3
|
|
|
|
jmp mcall_and_close
|
2013-10-17 18:31:03 +04:00
|
|
|
restart_kernel:
|
2011-01-18 17:29:19 +03:00
|
|
|
push 4
|
|
|
|
mcall_and_close:
|
|
|
|
pop ecx
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,18
|
|
|
|
mcall ,9
|
2013-10-17 18:31:03 +04:00
|
|
|
|
|
|
|
close_1:
|
2013-10-19 14:24:30 +04:00
|
|
|
or eax,-1
|
|
|
|
mcall
|
2011-01-18 17:29:19 +03:00
|
|
|
|
|
|
|
run_rdsave:
|
2013-10-19 14:24:30 +04:00
|
|
|
mov al,70
|
|
|
|
mcall ,rdsave
|
2011-01-18 17:29:19 +03:00
|
|
|
jmp still
|
|
|
|
|
|
|
|
data
|
2013-10-17 18:31:03 +04:00
|
|
|
include 'data.inc'
|
2011-01-18 17:29:19 +03:00
|
|
|
|
|
|
|
udata
|
2013-10-17 18:31:03 +04:00
|
|
|
|
|
|
|
meos_app_end
|