Subversion Repositories Kolibri OS

Rev

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

Rev 109 Rev 174
Line 9... Line 9...
9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 10... Line 10...
10
 
10
 
11
NORMAL_MODE    = 8
11
NORMAL_MODE    = 8
Line 12... Line 12...
12
CONSOLE_MODE   = 32
12
CONSOLE_MODE   = 32
13
 
13
 
14
MAGIC1	   = 6*(text.line_size-1)+6*2+2
14
MAGIC1         = 6*(text.line_size-1)+14
15
MAGIC2	   = 14
15
MAGIC2         = 14
16
MAGIC3	   = 1
16
MAGIC3         = 1
17
MAGIC4	   = 7
17
MAGIC4         = 7
Line 18... Line 18...
18
OUTPUTXY = (5+MAGIC4) shl 16 + MAGIC2*3+MAGIC3+MAGIC4+1+2
18
OUTPUTXY       = 7 shl 16 + 53
Line 19... Line 19...
19
MAX_PATH = 100
19
MAX_PATH       = 100
Line -... Line 20...
-
 
20
 
-
 
21
APP_MEMORY     = 0x00800000
-
 
22
 
20
 
23
;; Menuet header
Line 21... Line 24...
21
APP_MEMORY = 0x00800000
24
 
22
 
25
appname equ "FASM "
23
;; Menuet header
26
version equ "1.67.11"
Line 39... Line 42...
39
center fix true
42
center fix true
Line 40... Line 43...
40
 
43
 
Line 41... Line 44...
41
START:	    ; Start of execution
44
START:	    ; Start of execution
42
 
45
 
Line 43... Line 46...
43
   cmp	     [params],0
46
   cmp    [params],0
44
   jz	    noparams
47
   jz	    red
45
 
48
 
46
   mov	     ecx,10
49
   mov    ecx,10
Line 79... Line 82...
79
  @@:
82
  @@:
Line 80... Line 83...
80
 
83
 
81
   mov	     [_mode],CONSOLE_MODE
84
   mov     [_mode],CONSOLE_MODE
Line 82... Line -...
82
   jmp	     start
-
 
Line -... Line 85...
-
 
85
   jmp     start
83
 
86
 
Line 84... Line 87...
84
  noparams:
87
 
85
 
-
 
86
    call draw_window
88
red:	; Redraw
87
 
-
 
88
still:
89
    call draw_window
89
 
90
 
90
    mcall  10	  ; Wait here for event
-
 
91
 
91
still:  
92
    dec    eax	   ; Redraw request
92
    push 10          ; Wait here for event
93
    jz	     red
-
 
94
    dec    eax	   ; Key in buffer
-
 
95
    jz	     key
93
    pop eax 
96
    dec    eax	   ; Button in buffer
-
 
97
    jz	     button
-
 
98
 
94
    int 40h 
99
    jmp  still
-
 
Line 100... Line 95...
100
 
95
    dec eax 
101
red:	; Redraw
96
    je  red          ; Redraw request
-
 
97
    dec eax 
102
    call draw_window
98
    jne button       ; Button in buffer
Line 103... Line 99...
103
    jmp  still
99
 
Line 104... Line 100...
104
 
100
key:                 ; Key
-
 
101
    mov  al,2        ; Read it and ignore
-
 
102
    int  0x40
-
 
103
    jmp  still
-
 
104
 
-
 
105
button:    ; Button in Window
-
 
106
 
Line -... Line 107...
-
 
107
    mov  al,17
105
key:	; Key
108
    int  0x40
106
    mcall  2	 ; Read it and ignore
109
 
107
    jmp  still
110
    cmp     ah,1
108
 
111
    jne     noclose
Line 109... Line 112...
109
button:    ; Button in Window
112
    or      eax,-1
110
 
113
    int     0x40
111
    mcall  17
114
 
112
 
115
noclose:    
113
    cmp  ah,2	 ; Start compiling
116
    cmp  ah,2         ; Start compiling
114
    je	   start
117
    je   start
Line 115... Line 118...
115
    cmp  ah,3	 ; Start compiled file
118
    cmp  ah,3         ; Start compiled file
116
    jnz  norunout
-
 
117
 
119
    jnz  norunout
Line 118... Line 120...
118
    mov  edx,outfile
120
 
119
    call make_fullpaths
121
    mov  edx,outfile
120
    mcall  58,file_info_start
122
    call make_fullpaths
121
;   xor   ecx,ecx
123
    mcall  70,file_info_start
122
    jmp  still
124
;   xor   ecx,ecx
123
   norunout:
125
    jmp  still
Line 124... Line -...
124
 
-
 
125
    mov  ecx,[skinh]
126
   norunout:
126
    add  ecx,MAGIC3+MAGIC2/2-3
-
 
127
    mov  [ya],ecx
-
 
Line 128... Line -...
128
 
-
 
Line 129... Line 127...
129
    cmp  ah,11	   ; Infile
127
 
Line 130... Line 128...
130
    je	  f1
128
    mov  ecx,5
Line 131... Line 129...
131
    cmp  ah,12	   ; Outfile
129
    mov  [ya],ecx
Line 132... Line 130...
132
    je	  f2
130
 
Line -... Line 131...
-
 
131
    cmp  ah,11	   ; Infile
-
 
132
    je   f1
-
 
133
    cmp  ah,12	   ; Outfile
-
 
134
    je   f2
-
 
135
    cmp  ah,13	   ; Path
133
    cmp  ah,13	   ; Path
136
    je   f3
-
 
137
 
Line 134... Line 138...
134
    je	  f3
138
    jmp  still
Line 135... Line 139...
135
 
139
 
136
    dec  ah   ; Close application
-
 
137
    jnz  still
-
 
138
 
140
 
139
    mcall -1
141
draw_window:
Line 140... Line 142...
140
 
142
 
141
skinh dd ?
143
    pusha
142
 
144
 
143
draw_window:
145
    mcall  12,1 ; Start of draw
Line 144... Line 146...
144
 
146
 
145
    pusha
-
 
146
 
147
    get_sys_colors 1,0
147
    mcall  12,1 ; Start of draw
148
 
148
 
149
    mov  eax,0                     
149
    get_sys_colors 1,0
150
    mov  ebx,50*65536+280        
150
 
151
    mov  ecx,50*65536+250
151
    mcall 0,<50,280>,<50,250>,[sc.work]      ; Draw Window
152
    mov  edx,[sc.work]
152
 
153
    or   edx,0x33000000
153
    draw_caption header,header.size	    ; Draw Window Label Text
154
    mov  edi,header             ; Draw Window Label Text
154
 
155
    int  0x40
155
    mov   ecx,[skinh-2]
156
 
156
    mov   cx,word[skinh]
157
    mcall 9,PROCESSINFO,-1	    
157
    madd  ecx,MAGIC3,MAGIC3
158
 
158
    mov   ebx,[pinfo.x_size]
159
    mpack ecx,1,1
159
    madd  ebx,5,-5
160
    mov   ebx,[pinfo.x_size]
160
 
161
    sub   ebx,10
Line 161... Line 162...
161
    push  ecx
162
 
162
    madd  ecx,MAGIC2*3+2,MAGIC2*3+2
163
    push  ecx
163
    mcall 38,,,[sc.work_graph]
-
 
164
    pop   ecx
164
    madd  ecx,MAGIC2*3+2,MAGIC2*3+2
165
 
165
    mcall 38,,,[sc.work_graph]
166
    sub   ebx,MAGIC1+3
166
    pop   ecx
167
 
167
 
168
    mcall
168
    sub   ebx,MAGIC1+3
Line 169... Line 169...
169
    madd  ecx,MAGIC2,MAGIC2
169
    mcall
170
    mcall
170
    madd  ecx,MAGIC2,MAGIC2
171
    madd  ecx,MAGIC2,MAGIC2
171
    mcall
172
    mcall
172
    madd  ecx,MAGIC2,MAGIC2
173
    madd  ecx,MAGIC2,MAGIC2
173
    mcall
174
    mcall
174
    madd  ecx,MAGIC2,MAGIC2
175
    push  ebx
175
    mcall
Line 176... Line 176...
176
    mpack ebx,MAGIC1+5,MAGIC1+5
176
    push  ebx
177
    sub   cx,MAGIC2*3
177
    mpack ebx,MAGIC1,MAGIC1
178
    mcall
178
    sub   ecx,MAGIC2*3
179
    mov   ebx,[esp-2]
179
    mcall
180
    pop   bx
180
    mov   ebx,[esp-2]
181
    mcall
181
    pop   bx
182
    add   esp,2
182
    mcall
183
 
183
    add   esp,2
184
    mpack ebx,5,MAGIC1-1
184
 
185
    mpack ecx,[skinh],MAGIC2-2
185
    mpack ebx,0,MAGIC1-1
186
    madd  ecx,MAGIC3+1,0
186
    mpack ecx,MAGIC3+1,MAGIC2-2
187
    mcall 8,,,0x4000000B       ; Button: Enter Infile
187
    mcall 8,,,0x4000000B       ; Button: Enter Infile
Line 188... Line 188...
188
    madd  ecx,MAGIC2,0
188
    madd  ecx,MAGIC2,0
189
    mcall  ,,,0x4000000C       ; Button: Enter Outfile
189
    mcall  ,,,0x4000000C       ; Button: Enter Outfile
190
    madd  ecx,MAGIC2,0
190
    madd  ecx,MAGIC2,0
191
    mcall  ,,,0x4000000D       ; Button: Enter Path
-
 
192
 
191
    mcall  ,,,0x4000000D       ; Button: Enter Path
193
    mpack ebx,[pinfo.x_size],MAGIC1
192
 
194
    msub  ebx,MAGIC1+5+1,0
193
    mpack ebx,[pinfo.x_size],MAGIC1
195
    mpack ecx,[skinh],MAGIC2*3/2-1
194
    msub  ebx,MAGIC1+10+1,0
Line 196... Line 195...
196
    madd  ecx,MAGIC3,0
195
    mpack ecx,0,MAGIC2*3/2-1
197
    mcall  ,,,0x00000002,[sc.work_button]
196
    madd  ecx,MAGIC3,0
198
    madd  ecx,MAGIC2*3/2+1,0
197
    mcall  ,,,0x00000002,[sc.work_button]
199
    mcall  ,,,0x00000003
198
    madd  ecx,MAGIC2*3/2+1,0
200
 
199
    mcall  ,,,0x00000003
201
    mpack ebx,5+6,[skinh]    ; Draw Window Text
200
 
Line 246... Line 245...
246
 
245
 
Line 247... Line 246...
247
bottom_right dd ?
246
bottom_right dd ?
248
 
247
 
249
draw_messages:
248
draw_messages:
250
    mov    eax,13      ; clear work area
249
    mov    eax,13      ; clear work area
251
    mpack  ebx,5+MAGIC4-2,[pinfo.x_size]
250
    mpack  ebx,MAGIC4-2,[pinfo.x_size]
252
    sub    ebx,5*2+MAGIC4*2-1-2*2
251
    sub    ebx,5*2+MAGIC4*2-1-2*2
253
    mpack  ecx,[skinh],[pinfo.y_size]
252
    mpack  ecx,0,[pinfo.y_size]
254
    madd   ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*2+5)+2
253
    madd   ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*2+25)
255
    mov    word[bottom_right+2],bx
254
    mov    word[bottom_right+2],bx
256
    mov    word[bottom_right],cx
255
    mov    word[bottom_right],cx
257
    msub   [bottom_right],7,11
-
 
258
    add    [bottom_right],OUTPUTXY
256
    msub   [bottom_right],7,11
259
    sub    ecx,[skinh]
257
    add    [bottom_right],OUTPUTXY
260
    mov    edx,[sc.work]
258
    mov    edx,[sc.work]
261
    int    0x40
259
    int    0x40
262
_cy = 0
260
_cy = 0
263
_sy = 2
261
_sy = 2
264
_cx = 4
262
_cx = 4
265
_sx = 6
263
_sx = 6
266
    push   ebx ecx
264
    push   ebx ecx
267
    mpack  ebx,5+MAGIC4-3,5+MAGIC4-2
265
    mpack  ebx,MAGIC4-3,MAGIC4-2
268
    add    bx,[esp+_cx]
266
    add    bx,[esp+_cx]
269
    mov    ecx,[esp+_sy-2]
267
    mov    ecx,[esp+_sy-2]
270
    mov    cx,[esp+_sy]
268
    mov    cx,[esp+_sy]
Line 274... Line 272...
274
    add    cx,si
272
    add    cx,si
275
    shl    esi,16
273
    shl    esi,16
276
    add    ecx,esi
274
    add    ecx,esi
277
    madd   ecx,1,1
275
    madd   ecx,1,1
278
    mcall
276
    mcall
279
    mpack  ebx,5+MAGIC4-3,5+MAGIC4-3
277
    mpack  ebx,MAGIC4-3,MAGIC4-3
280
    mov    esi,[esp+_sy-2]
278
    mov    esi,[esp+_sy-2]
281
    mov    si,cx
279
    mov    si,cx
282
    mov    ecx,esi
280
    mov    ecx,esi
283
    mcall
281
    mcall
284
    mov    si,[esp+_cx]
282
    mov    si,[esp+_cx]
Line 361... Line 359...
361
 
359
 
Line 362... Line 360...
362
    jmp    still
360
    jmp    still
Line 363... Line 361...
363
 
361
 
364
print_text:
362
print_text:
365
 
363
 
366
    mpack ebx,MAGIC1+5+6,[pinfo.x_size]
364
    mpack ebx,MAGIC1+6,[pinfo.x_size]
367
    sub   ebx,MAGIC1*2+5*2+6+3
365
    sub   ebx,MAGIC1*2+5*2+6+3
368
    movzx esi,bx
366
    movzx esi,bx
Line 369... Line 367...
369
    mov   ecx,[ya-2]
367
    mov   ecx,[ya-2]
370
    mov   cx,8
368
    mov   cx,8
371
    mcall 13,,,[sc.work]
369
    mcall 13,,,[sc.work]
372
 
370
 
373
    mpack ebx,MAGIC1+5+6,[ya]
371
    mpack ebx,MAGIC1+6,[ya]
374
    mov   eax,esi
372
    mov   eax,esi
Line 383... Line 381...
383
    ret
381
    ret
Line 384... Line 382...
384
 
382
 
Line 385... Line 383...
385
 
383
 
Line 386... Line 384...
386
; DATA
384
; DATA
387
 
385
 
388
sz header,'FASM FOR MENUET'
386
header db appname,version,0
389
 
387
 
Line 428... Line 426...
428
 
426
 
429
start:
427
start:
430
    cmp    [_mode],NORMAL_MODE
428
    cmp    [_mode],NORMAL_MODE
431
    jne    @f
429
    jne    @f
432
    call   draw_messages
430
    call   draw_messages
433
    push   [skinh]
431
    push   0
434
    pop    [textxy]
432
    pop    [textxy]
435
    add    [textxy],OUTPUTXY
433
    add    [textxy],OUTPUTXY
436
@@:
434
@@:
437
    mov    esi,_logo
435
    mov    esi,_logo
Line 487... Line 485...
487
 
485
 
488
    cmp    [_run_outfile],0
486
    cmp    [_run_outfile],0
489
    je	     @f
487
    je	     @f
490
    mov    edx,outfile
488
    mov    edx,outfile
491
    call   make_fullpaths
489
    call   make_fullpaths
492
    mov    eax,58
490
    mov    eax,70
493
    mov    ebx,file_info_start
491
    mov    ebx,file_info_start
494
    xor    ecx,ecx
492
    xor    ecx,ecx
495
    int    0x40
493
    int    0x40
496
@@:
494
@@: