Subversion Repositories Kolibri OS

Rev

Rev 205 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 205 Rev 485
Line 3... Line 3...
3
;
3
;
4
;   Compile with FASM for Menuet
4
;   Compile with FASM for Menuet
5
;
5
;
Line 6... Line 6...
6
 
6
 
7
include "lang.inc"
7
include "lang.inc"
Line 8... Line 8...
8
include "macros.inc"
8
include "..\..\..\..\macros.inc"
9
 
9
 
Line 10... Line 10...
10
  use32
10
  use32
Line 23... Line 23...
23
 
23
 
24
 
24
 
25
    mov  eax,45                 ; reserve irq 4
25
    mov  eax,45                 ; reserve irq 4
26
    mov  ebx,0
26
    mov  ebx,0
Line 27... Line 27...
27
    mov  ecx,4
27
    mov  ecx,4
28
    int  0x40
28
    mcall
29
 
29
 
30
    mov  eax,46                 ; reserve ports 0x3f8-0x3ff
30
    mov  eax,46                 ; reserve ports 0x3f8-0x3ff
31
    mov  ebx,0
31
    mov  ebx,0
Line 32... Line 32...
32
    mov  ecx,0x3f8
32
    mov  ecx,0x3f8
33
    mov  edx,0x3ff
33
    mov  edx,0x3ff
34
    int  0x40
34
    mcall
35
 
35
 
Line 36... Line 36...
36
    mov  eax,44                 ; read these ports at interrupt/irq 4
36
    mov  eax,44                 ; read these ports at interrupt/irq 4
37
    mov  ebx,irqtable
37
    mov  ebx,irqtable
38
    mov  ecx,4
38
    mov  ecx,4
Line 39... Line 39...
39
    int  0x40
39
    mcall
Line -... Line 40...
-
 
40
 
-
 
41
    mov  eax,40                 ; enable event for interrupt/irq 4
-
 
42
    mov  ebx,10000b shl 16 + 111b
-
 
43
    mcall
-
 
44
 
-
 
45
    call program_com1
-
 
46
 
40
 
47
    mov  eax, 48
Line 41... Line 48...
41
    mov  eax,40                 ; enable event for interrupt/irq 4
48
    mov  ebx, 3
Line 42... Line 49...
42
    mov  ebx,10000b shl 16 + 111b
49
    mov  ecx, sc
43
    int  0x40
50
    mov  edx, sizeof.system_colors
Line 44... Line 51...
44
 
51
    mcall
45
    call program_com1
52
 
46
 
53
  red: 
47
    call draw_window
54
    call draw_window
Line 60... Line 67...
60
    cmp  eax,16+4               ; data read by interrupt ?
67
    cmp  eax,16+4               ; data read by interrupt ?
61
    je   irq4
68
    je   irq4
Line 62... Line 69...
62
 
69
 
Line 63... Line -...
63
    jmp  still
-
 
64
 
-
 
65
  red:                          ; redraw
-
 
66
    call draw_window
-
 
67
    jmp  still
70
    jmp  still
68
 
71
 
69
  key:                          ; key
72
  key:                          ; key
Line 70... Line 73...
70
    mov  eax,2                  ; just read it and ignore
73
    mov  eax,2                  ; just read it and ignore
71
    int  0x40
74
    mcall
72
 
75
 
Line 73... Line 76...
73
    mov  al,ah
76
    mov  al,ah
Line 74... Line 77...
74
    mov  dx,0x3f8
77
    mov  dx,0x3f8
75
    out  dx,al
78
    out  dx,al
76
 
79
 
Line 77... Line 80...
77
    jmp  still
80
    jmp  still
Line 78... Line 81...
78
 
81
 
79
  button:                       ; button
82
  button:                       ; button
80
    or   eax,-1                 ; close this program
83
    or   eax,-1                 ; close this program
Line 81... Line 84...
81
    int  0x40
84
    mcall
82
 
85
 
83
 
86
 
Line 139... Line 142...
139
;   *********************************************
142
;   *********************************************
Line 140... Line 143...
140
 
143
 
Line 141... Line -...
141
 
-
 
142
draw_window:
-
 
143
 
-
 
144
    mov  eax, 48
-
 
145
    mov  ebx, 3
-
 
146
    mov  ecx, sc
-
 
147
    mov  edx, sizeof.system_colors
144
 
148
    int  0x40
145
draw_window:
149
 
146
 
Line 150... Line 147...
150
    mov  eax, 12                   ; function 12:tell os about windowdraw
147
    mov  eax, 12                   ; function 12:tell os about windowdraw
151
    mov  ebx, 1                    ; 1, start of draw
148
    mov  ebx, 1                    ; 1, start of draw
152
    int  0x40
149
    mcall
153
 
150
 
154
                                   ; DRAW WINDOW
151
                                   ; DRAW WINDOW
155
    mov  eax, 0                    ; function 0 : define and draw window
152
    mov  eax, 0                    ; function 0 : define and draw window
156
    mov  ebx, 100*65536+250        ; [x start] *65536 + [x size]
153
    mov  ebx, 100*65536+250        ; [x start] *65536 + [x size]
Line 157... Line 154...
157
    mov  ecx, 100*65536+85         ; [y start] *65536 + [y size]
154
    mov  ecx, 100*65536+85         ; [y start] *65536 + [y size]
158
    mov  edx, [sc.work]
155
    mov  edx, [sc.work]
159
    or   edx, 0x03000000           ; color of work area RRGGBB,8->color gl
156
    or   edx, 0x03000000           ; color of work area RRGGBB,8->color gl
160
    int  0x40
157
    mcall
161
 
158
 
162
                                   ; WINDOW LABEL
159
                                   ; WINDOW LABEL
163
    mov  eax, 4                    ; function 4 : write text to window
160
    mov  eax, 4                    ; function 4 : write text to window
164
    mov  ebx, 8*65536+8            ; [x start] *65536 + [y start]
161
    mov  ebx, 8*65536+8            ; [x start] *65536 + [y start]
Line 165... Line 162...
165
    mov  ecx, [sc.grab_text]
162
    mov  ecx, [sc.grab_text]
166
    or   ecx, 0x10000000           ; font 1 & color ( 0xF0RRGGBB )
163
    or   ecx, 0x10000000           ; font 1 & color ( 0xF0RRGGBB )
167
    mov  edx, header               ; pointer to text beginning
164
    mov  edx, title               ; pointer to text beginning
168
    mov  esi, header.len           ; text length
165
    mov  esi, title.len           ; text length
169
    int  0x40
166
    mcall
170
 
167
 
171
    mov  eax, 4                    ; draw text
168
    mov  eax, 4                    ; draw text
172
    mov  ebx, 20*65536+33
169
    mov  ebx, 20*65536+33
173
    mov  ecx, [sc.work_text]
170
    mov  ecx, [sc.work_text]
174
    mov  edx, text+4
171
    mov  edx, text+4
175
  .nextstr:
172
  .nextstr:
176
    mov  esi, [edx-4]
173
    mov  esi, [edx-4]
177
    test esi, 0xFF000000
174
    test esi, 0xFF000000
178
    jnz  .finstr
175
    jnz  .finstr
Line 179... Line 176...
179
    int  0x40
176
    mcall
Line 180... Line 177...
180
    add  edx, esi
177
    add  edx, esi
181
    add  edx, 4
178
    add  edx, 4
182
    add  ebx, 10
179
    add  ebx, 10
Line 183... Line 180...
183
    jmp  .nextstr
180
    jmp  .nextstr
Line 184... Line 181...
184
  .finstr:
181
  .finstr:
185
 
182
 
186
    call draw_string
183
    call draw_string
187
 
184
 
188
    mov  eax,12                    ; function 12:tell os about windowdraw
185
    mov  eax,12                    ; function 12:tell os about windowdraw
189
    mov  ebx,2                     ; 2, end of draw
186
    mov  ebx,2                     ; 2, end of draw
190
    int  0x40
187
    mcall
191
 
188
 
Line 192... Line 189...
192
    ret
189
    ret
Line 193... Line 190...
193
 
190
 
194
 
191
 
195
draw_string:
192
draw_string:
196
    mov  eax, 4
193
    mov  eax, 4
197
    mov  ebx, 20*65536+65
194
    mov  ebx, 20*65536+65
198
    mov  ecx, [sc.work_text]
195
    mov  ecx, [sc.work_text]
199
    mov  edx, string
196
    mov  edx, string
200
    mov  esi, 32
197
    mov  esi, 32
201
    int  0x40
198
    mcall
202
ret
199
ret
203
 
200
 
204
 
201
 
205
; DATA AREA
202
; DATA AREA
206
 
203
 
207
 
204
 
Line 208... Line 205...
208
if lang eq ru
205
if lang eq ru
Line 209... Line 206...
209
   text mstr "‚‚Ž„ˆŒ›… ‘ˆŒ‚Ž‹› ……„€ž’‘Ÿ ŒŽ„…Œ“.",\
206
   text mstr "‚‚Ž„ˆŒ›… ‘ˆŒ‚Ž‹› ……„€ž’‘Ÿ ŒŽ„…Œ“.",\