Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
; <--- description --->
2
; compiler:     FASM 1.50
3
; name:         Basic window example for MenuetOS
4
; version:      1.01
5
; last update:  25/08/2004
6
; written by:   Ivan Poddubny
7
; e-mail:       ivan-yar@bk.ru
8
 
9
 
10
; <--- include all MeOS stuff --->
11
include "lang.inc"
12
include "macros.inc"
13
 
14
 
15
; <--- start of MenuetOS application --->
16
MEOS_APP_START
17
 
18
 
19
; <--- start of code --->
20
CODE
21
    call    draw_window            ; at first create and draw the window
22
 
23
  wait_event:                      ; main cycle
24
    mov     eax, 10
25
    int     0x40
26
 
27
    cmp     eax, 1                 ;   if event == 1
28
    je      redraw                 ;     jump to redraw handler
29
    cmp     eax, 2                 ;   else if event == 2
30
    je      key                    ;     jump to key handler
31
    cmp     eax, 3                 ;   else if event == 3
32
    je      button                 ;     jump to button handler
33
 
34
    jmp     wait_event             ;   else return to the start of main cycle
35
 
36
 
37
  redraw:                          ; redraw event handler
38
    call    draw_window
39
    jmp     wait_event
40
 
41
 
42
  key:                             ; key event handler
43
    mov     eax, 2                 ;   get key code
44
    int     0x40
45
 
46
    jmp     wait_event
47
 
48
 
49
  button:                          ; button event handler
50
    mov     eax, 17                ;   get button identifier
51
    int     0x40
52
 
53
    cmp     ah, 1
54
    jne     wait_event             ;   return if button id != 1
55
 
56
    or      eax, -1                ;   exit application
57
    int     0x40
58
 
59
 
60
  draw_window:
61
    mov     eax, 12                ; start drawing
62
    mov     ebx, 1
63
    int     0x40
64
 
65
    mov     eax, 0                 ; create and draw the window
66
    mov     ebx, 100*65536+300     ;   (window_cx)*65536+(window_sx)
67
    mov     ecx, 100*65536+200     ;   (window_cy)*65536+(window_sy)
68
    mov     edx, 0x03ffffff        ;   work area color & window type 3
69
;   mov     esi, 0                 ;   grab color (not used)
70
;   mov     edi, 0                 ;   frame color (not used)
71
    int     0x40
72
 
73
    mov     eax, 4                 ; window header
74
    mov     ebx, 8*65536+8         ;   coordinates
75
    mov     ecx, 0x10ffffff        ;   color & font N1
76
    mov     edx, header            ;   address of text
77
    mov     esi, header.size       ;   length of text
78
    int     0x40
79
 
80
    mov     eax, 12                ; finish drawing
81
    mov     ebx, 2
82
    int     0x40
83
 
84
  ret
85
 
86
 
87
 
88
; <--- initialised data --->
89
DATA
90
  lsz header,\
91
    ru, "Шаблон программы",\
92
    en, "Template program",\
93
    fr, "La programme poncive"
94
 
95
 
96
 
97
; <--- uninitialised data --->
98
UDATA
99
 
100
 
101
MEOS_APP_END
102
; <--- end of MenuetOS application --->