Rev 205 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; flat assembler source ;; |
||
109 | heavyiron | 4 | ;; Copyright (c) 1999-2006, Tomasz Grysztar ;; |
31 | halyavin | 5 | ;; All rights reserved. ;; |
6 | ;; ;; |
||
7 | ;; Menuet port by VT ;; |
||
8 | ;; ;; |
||
9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
10 | |||
11 | NORMAL_MODE = 8 |
||
12 | CONSOLE_MODE = 32 |
||
13 | |||
174 | heavyiron | 14 | MAGIC1 = 6*(text.line_size-1)+14 |
15 | MAGIC2 = 14 |
||
16 | MAGIC3 = 1 |
||
17 | MAGIC4 = 7 |
||
18 | OUTPUTXY = 7 shl 16 + 53 |
||
19 | MAX_PATH = 100 |
||
31 | halyavin | 20 | |
174 | heavyiron | 21 | APP_MEMORY = 0x00800000 |
31 | halyavin | 22 | |
23 | ;; Menuet header |
||
24 | |||
205 | heavyiron | 25 | appname equ "flat assembler " |
174 | heavyiron | 26 | |
31 | halyavin | 27 | use32 |
28 | |||
29 | org 0x0 |
||
30 | db 'MENUET01' ; 8 byte id |
||
174 | heavyiron | 31 | dd 0x01 ; header version |
32 | dd START ; program start |
||
31 | halyavin | 33 | dd program_end ; program image size |
34 | dd APP_MEMORY ; required amount of memory |
||
174 | heavyiron | 35 | dd 0xDFFF0 ; stack |
31 | halyavin | 36 | dd params,0x0 ; parameters,icon |
37 | |||
38 | include 'lang.inc' |
||
39 | include 'fasm.inc' |
||
40 | |||
41 | center fix true |
||
42 | |||
109 | heavyiron | 43 | START: ; Start of execution |
31 | halyavin | 44 | |
174 | heavyiron | 45 | cmp [params],0 |
46 | jz red |
||
31 | halyavin | 47 | |
174 | heavyiron | 48 | mov ecx,10 |
49 | mov al,' ' |
||
50 | mov edi,infile |
||
51 | push ecx |
||
31 | halyavin | 52 | cld |
174 | heavyiron | 53 | rep stosd |
54 | mov ecx,[esp] |
||
55 | mov edi,outfile |
||
56 | rep stosd |
||
57 | pop ecx |
||
58 | mov edi,path |
||
59 | rep stosd |
||
31 | halyavin | 60 | |
174 | heavyiron | 61 | mov esi,params |
31 | halyavin | 62 | ; DEBUGF "params: %s\n",esi |
174 | heavyiron | 63 | mov edi,infile |
31 | halyavin | 64 | call mov_param_str |
65 | ; mov edi,infile |
||
66 | ; DEBUGF " input: %s\n",edi |
||
174 | heavyiron | 67 | inc esi |
68 | mov edi,outfile |
||
31 | halyavin | 69 | call mov_param_str |
70 | ; mov edi,outfile |
||
71 | ; DEBUGF "output: %s\n",edi |
||
174 | heavyiron | 72 | inc esi |
73 | mov edi,path |
||
31 | halyavin | 74 | call mov_param_str |
75 | ; mov edi,path |
||
76 | ; DEBUGF " path: %s\n",edi |
||
77 | |||
174 | heavyiron | 78 | cmp [esi], dword ',run' |
79 | jne @f |
||
80 | mov [_run_outfile],1 |
||
31 | halyavin | 81 | @@: |
82 | |||
174 | heavyiron | 83 | mov [_mode],CONSOLE_MODE |
84 | jmp start |
||
31 | halyavin | 85 | |
86 | |||
174 | heavyiron | 87 | red: ; Redraw |
31 | halyavin | 88 | call draw_window |
89 | |||
174 | heavyiron | 90 | still: |
91 | push 10 ; Wait here for event |
||
92 | pop eax |
||
93 | int 40h |
||
94 | dec eax |
||
95 | je red ; Redraw request |
||
96 | dec eax |
||
97 | jne button ; Button in buffer |
||
31 | halyavin | 98 | |
174 | heavyiron | 99 | key: ; Key |
100 | mov al,2 ; Read it and ignore |
||
101 | int 0x40 |
||
31 | halyavin | 102 | jmp still |
103 | |||
174 | heavyiron | 104 | button: ; Button in Window |
31 | halyavin | 105 | |
174 | heavyiron | 106 | mov al,17 |
107 | int 0x40 |
||
31 | halyavin | 108 | |
174 | heavyiron | 109 | cmp ah,1 |
110 | jne noclose |
||
111 | or eax,-1 |
||
112 | int 0x40 |
||
31 | halyavin | 113 | |
174 | heavyiron | 114 | noclose: |
115 | cmp ah,2 ; Start compiling |
||
116 | je start |
||
117 | cmp ah,3 ; Start compiled file |
||
31 | halyavin | 118 | jnz norunout |
119 | |||
120 | mov edx,outfile |
||
121 | call make_fullpaths |
||
174 | heavyiron | 122 | mcall 70,file_info_start |
31 | halyavin | 123 | ; xor ecx,ecx |
124 | jmp still |
||
125 | norunout: |
||
126 | |||
174 | heavyiron | 127 | mov ecx,5 |
31 | halyavin | 128 | mov [ya],ecx |
129 | |||
109 | heavyiron | 130 | cmp ah,11 ; Infile |
174 | heavyiron | 131 | je f1 |
109 | heavyiron | 132 | cmp ah,12 ; Outfile |
174 | heavyiron | 133 | je f2 |
109 | heavyiron | 134 | cmp ah,13 ; Path |
174 | heavyiron | 135 | je f3 |
31 | halyavin | 136 | |
174 | heavyiron | 137 | jmp still |
31 | halyavin | 138 | |
139 | |||
140 | draw_window: |
||
141 | |||
142 | pusha |
||
143 | |||
144 | mcall 12,1 ; Start of draw |
||
145 | |||
146 | get_sys_colors 1,0 |
||
147 | |||
220 | heavyiron | 148 | xor eax,eax |
174 | heavyiron | 149 | mov ebx,50*65536+280 |
150 | mov ecx,50*65536+250 |
||
151 | mov edx,[sc.work] |
||
152 | or edx,0x33000000 |
||
153 | mov edi,header ; Draw Window Label Text |
||
154 | int 0x40 |
||
31 | halyavin | 155 | |
174 | heavyiron | 156 | mcall 9,PROCESSINFO,-1 |
31 | halyavin | 157 | |
174 | heavyiron | 158 | mpack ecx,1,1 |
31 | halyavin | 159 | mov ebx,[pinfo.x_size] |
174 | heavyiron | 160 | sub ebx,10 |
31 | halyavin | 161 | |
162 | push ecx |
||
163 | madd ecx,MAGIC2*3+2,MAGIC2*3+2 |
||
164 | mcall 38,,,[sc.work_graph] |
||
165 | pop ecx |
||
166 | |||
167 | sub ebx,MAGIC1+3 |
||
168 | mcall |
||
169 | madd ecx,MAGIC2,MAGIC2 |
||
170 | mcall |
||
171 | madd ecx,MAGIC2,MAGIC2 |
||
172 | mcall |
||
173 | madd ecx,MAGIC2,MAGIC2 |
||
174 | mcall |
||
175 | push ebx |
||
174 | heavyiron | 176 | mpack ebx,MAGIC1,MAGIC1 |
177 | sub ecx,MAGIC2*3 |
||
31 | halyavin | 178 | mcall |
179 | mov ebx,[esp-2] |
||
180 | pop bx |
||
181 | mcall |
||
182 | add esp,2 |
||
183 | |||
174 | heavyiron | 184 | mpack ebx,0,MAGIC1-1 |
185 | mpack ecx,MAGIC3+1,MAGIC2-2 |
||
31 | halyavin | 186 | mcall 8,,,0x4000000B ; Button: Enter Infile |
187 | madd ecx,MAGIC2,0 |
||
188 | mcall ,,,0x4000000C ; Button: Enter Outfile |
||
189 | madd ecx,MAGIC2,0 |
||
190 | mcall ,,,0x4000000D ; Button: Enter Path |
||
191 | |||
192 | mpack ebx,[pinfo.x_size],MAGIC1 |
||
174 | heavyiron | 193 | msub ebx,MAGIC1+10+1,0 |
194 | mpack ecx,0,MAGIC2*3/2-1 |
||
31 | halyavin | 195 | madd ecx,MAGIC3,0 |
196 | mcall ,,,0x00000002,[sc.work_button] |
||
197 | madd ecx,MAGIC2*3/2+1,0 |
||
198 | mcall ,,,0x00000003 |
||
199 | |||
174 | heavyiron | 200 | mpack ebx,6,0 ; Draw Window Text |
201 | add ebx,MAGIC3+MAGIC2/2-3 |
||
31 | halyavin | 202 | mov ecx,[sc.work_text] |
203 | mov edx,text |
||
204 | mov esi,text.line_size |
||
205 | mov eax,4 |
||
206 | newline: |
||
174 | heavyiron | 207 | int 0x40 |
31 | halyavin | 208 | add ebx,MAGIC2 |
209 | add edx,text.line_size |
||
210 | cmp byte[edx],'x' |
||
211 | jne newline |
||
212 |