Rev 317 | Rev 551 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 317 | Rev 485 | ||
---|---|---|---|
1 | ; Author: M. Lisovin |
1 | ; Author: M. Lisovin |
2 | ; Compile with FASM for Menuet |
2 | ; Compile with FASM for Menuet |
3 | ; |
3 | ; |
4 | 4 | ||
5 | use32 |
5 | use32 |
6 | 6 | ||
7 | org 0x0 |
7 | org 0x0 |
8 | 8 | ||
9 | db 'MENUET01' ; 8 byte id |
9 | db 'MENUET01' ; 8 byte id |
10 | dd 0x01 ; header version |
10 | dd 0x01 ; header version |
11 | dd START ; start of code |
11 | dd START ; start of code |
12 | dd I_END ; size of image |
12 | dd I_END ; size of image |
13 | dd 0x1000 ; memory for app |
13 | dd 0x1000 ; memory for app |
14 | dd 0x1000 ; esp |
14 | dd 0x1000 ; esp |
15 | dd 0x0 , 0x0 ; I_Param , I_Icon |
15 | dd 0x0 , 0x0 ; I_Param , I_Icon |
16 | 16 | ||
17 | include 'lang.inc' |
17 | include 'lang.inc' |
18 | include 'macros.inc' |
18 | include '..\..\..\macros.inc' |
19 | 19 | ||
20 | START: ; start of execution |
20 | START: ; start of execution |
21 | red: |
21 | red: |
22 | call draw_window |
22 | call draw_window |
23 | 23 | ||
24 | still: |
24 | still: |
25 | 25 | ||
26 | mov eax,10 ; wait here for event |
26 | mov eax,10 ; wait here for event |
27 | int 0x40 |
27 | mcall |
28 | 28 | ||
29 | cmp eax,1 ; redraw request ? |
29 | cmp eax,1 ; redraw request ? |
30 | je red |
30 | je red |
31 | cmp eax,2 ; key in buffer ? |
31 | cmp eax,2 ; key in buffer ? |
32 | je key |
32 | je key |
33 | cmp eax,3 ; button in buffer ? |
33 | cmp eax,3 ; button in buffer ? |
34 | je button |
34 | je button |
35 | 35 | ||
36 | jmp still |
36 | jmp still |
37 | 37 | ||
38 | key: ; key |
38 | key: ; key |
39 | mov eax,2 ; just read it and ignore |
39 | mov eax,2 ; just read it and ignore |
40 | int 0x40 |
40 | mcall |
41 | mov [keyid],ah |
41 | mov [keyid],ah |
42 | call draw_window |
42 | call draw_window |
43 | jmp still |
43 | jmp still |
44 | 44 | ||
45 | button: ; button |
45 | button: ; button |
46 | mov eax,17 ; get id |
46 | mov eax,17 ; get id |
47 | int 0x40 |
47 | mcall |
48 | 48 | ||
49 | cmp ah,1 ; button id=1 ? |
49 | cmp ah,1 ; button id=1 ? |
50 | jne noclose |
50 | jne noclose |
51 | 51 | ||
52 | or eax,-1 ; close this program |
52 | or eax,-1 ; close this program |
53 | int 0x40 |
53 | mcall |
54 | noclose: |
54 | noclose: |
55 | 55 | ||
56 | jmp still |
56 | jmp still |
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | 60 | ||
61 | ; ********************************************* |
61 | ; ********************************************* |
62 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
62 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
63 | ; ********************************************* |
63 | ; ********************************************* |
64 | 64 | ||
65 | 65 | ||
66 | draw_window: |
66 | draw_window: |
67 | 67 | ||
68 | 68 | ||
69 | mov eax,12 ; function 12:tell os about windowdraw |
69 | mov eax,12 ; function 12:tell os about windowdraw |
70 | mov ebx,1 ; 1, start of draw |
70 | mov ebx,1 ; 1, start of draw |
71 | int 0x40 |
71 | mcall |
72 | 72 | ||
73 | ; DRAW WINDOW |
73 | ; DRAW WINDOW |
74 | mov eax,0 ; function 0 : define and draw window |
74 | mov eax,0 ; function 0 : define and draw window |
75 | mov ebx,100*65536+270 ; [x start] *65536 + [x size] |
75 | mov ebx,100*65536+270 ; [x start] *65536 + [x size] |
76 | mov ecx,100*65536+80 ; [y start] *65536 + [y size] |
76 | mov ecx,100*65536+80 ; [y start] *65536 + [y size] |
77 | mov edx,0x33ffffff ; color of work area RRGGBB,8->color gl |
77 | mov edx,0x33ffffff ; color of work area RRGGBB,8->color gl |
78 | mov edi,header |
78 | mov edi,title |
79 | int 0x40 |
79 | mcall |
80 | 80 | ||
81 | mov eax,4 ; function 4 : write text to window |
81 | mov eax,4 ; function 4 : write text to window |
82 | xor ecx,ecx |
82 | xor ecx,ecx |
83 | mov esi,4 |
83 | mov esi,4 |
84 | mov ebx,8*65536+8 |
84 | mov ebx,8*65536+8 |
85 | mov edx,tdec |
85 | mov edx,tdec |
86 | int 0x40 |
86 | mcall |
87 | add ebx,23 |
87 | add ebx,23 |
88 | mov edx,thex |
88 | mov edx,thex |
89 | int 0x40 |
89 | mcall |
90 | 90 | ||
91 | mov ecx,[keyid] |
91 | mov ecx,[keyid] |
92 | mov eax,47 |
92 | mov eax,47 |
93 | mov ebx,3*65536 |
93 | mov ebx,3*65536 |
94 | mov edx,40*65536+8 |
94 | mov edx,40*65536+8 |
95 | mov esi,0x224466 |
95 | mov esi,0x224466 |
96 | int 0x40 |
96 | mcall |
97 | add edx,23 |
97 | add edx,23 |
98 | mov bh,1 |
98 | mov bh,1 |
99 | int 0x40 |
99 | mcall |
100 | 100 | ||
101 | mov eax,12 ; function 12:tell os about windowdraw |
101 | mov eax,12 ; function 12:tell os about windowdraw |
102 | mov ebx,2 ; 2, end of draw |
102 | mov ebx,2 ; 2, end of draw |
103 | int 0x40 |
103 | mcall |
104 | 104 | ||
105 | ret |
105 | ret |
106 | 106 | ||
107 | 107 | ||
108 | ; DATA AREA |
108 | ; DATA AREA |
109 | 109 | ||
110 | tdec: db 'DEC:' |
110 | tdec: db 'DEC:' |
111 | thex: db 'HEX:' |
111 | thex: db 'HEX:' |
112 | header db 'KEYBOARD ASCIICODES-PRESS ANY KEY',0 |
112 | title db 'KEYBOARD ASCIICODES-PRESS ANY KEY',0 |
113 | keyid: db 0 |
113 | keyid: db 0 |
114 | I_END: |
114 | I_END: |