Rev 4589 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4589 | Rev 9044 | ||
---|---|---|---|
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 | mcall |
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 | mcall |
40 | mcall |
41 | mov [keyid],ah |
41 | mov [keyid],ah |
42 | shr eax,16 |
42 | shr eax,16 |
43 | mov [scan_keyid],al |
43 | mov [scan_keyid],al |
44 | call draw_window |
44 | call draw_window |
45 | jmp still |
45 | jmp still |
46 | 46 | ||
47 | button: ; button |
47 | button: ; button |
48 | mov eax,17 ; get id |
48 | mov eax,17 ; get id |
49 | mcall |
49 | mcall |
50 | 50 | ||
51 | cmp ah,1 ; button id=1 ? |
51 | cmp ah,1 ; button id=1 ? |
52 | jne noclose |
52 | jne noclose |
53 | 53 | ||
54 | or eax,-1 ; close this program |
54 | or eax,-1 ; close this program |
55 | mcall |
55 | mcall |
56 | noclose: |
56 | noclose: |
57 | 57 | ||
58 | jmp still |
58 | jmp still |
59 | 59 | ||
60 | ; ********************************************* |
60 | ; ********************************************* |
61 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
61 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
62 | ; ********************************************* |
62 | ; ********************************************* |
63 | 63 | ||
64 | draw_window: |
64 | draw_window: |
65 | ; function 12:tell os about windowdraw ; 1, start of draw |
65 | ; function 12:tell os about windowdraw ; 1, start of draw |
66 | mcall 12,1 |
66 | mcall 12,1 |
67 | 67 | ||
68 | ; DRAW WINDOW |
68 | ; DRAW WINDOW |
69 | mov eax,0 ; function 0 : define and draw window |
69 | mov eax,0 ; function 0 : define and draw window |
70 | mov ebx,100*65536+270 ; [x start] *65536 + [x size] |
70 | mov ebx,200*65536+250 ; [x start] *65536 + [x size] |
71 | mov ecx,100*65536+100 ; [y start] *65536 + [y size] |
71 | mov ecx,200*65536+106 ; [y start] *65536 + [y size] |
72 | mov edx,0x34ffffff ; color of work area RRGGBB,8->color gl |
72 | mov edx,0x34ffffff ; color of work area RRGGBB,8->color gl |
73 | mov edi,title |
73 | mov edi,title |
74 | mcall |
74 | mcall |
75 | 75 | ||
76 | ; function 4 : write text to window |
76 | ; function 4 : write text to window |
77 | xor ecx,ecx |
- | |
78 | mcall 4,<33,8>,,text1,6 |
77 | mcall 4,<55,8>,0x10000000,text1,5 |
79 | mcall ,<85,8>,,text2,9 |
78 | mcall ,<130,8>,,text2,9 |
80 | mcall ,<8,28>,,tdec,4 |
79 | mcall ,<8,30>,,tdec,4 |
81 | add ebx,23 |
80 | add ebx,23 |
82 | mcall ,,,thex |
81 | mcall ,,,thex |
83 | 82 | ||
84 | movzx ecx,byte [keyid] |
83 | movzx ecx,byte [keyid] |
85 | mcall 47,0x30000,,<40,28>,0x224466 |
84 | mcall 47,0x30000,,<55,30>,0x10224466 |
86 | add edx,23 |
85 | add edx,23 |
87 | mov bh,1 |
86 | mov bh,1 |
88 | mcall |
87 | mcall |
89 | 88 | ||
90 | mov bh,0 |
89 | mov bh,0 |
91 | movzx ecx,byte [scan_keyid] |
90 | movzx ecx,byte [scan_keyid] |
92 | mcall ,,,<100,28> |
91 | mcall ,,,<130,30> |
93 | add edx,23 |
92 | add edx,23 |
94 | mov bh,1 |
93 | mov bh,1 |
95 | mcall |
94 | mcall |
96 | 95 | ||
97 | ; function 12:tell os about windowdraw ; 2, end of draw |
96 | ; function 12:tell os about windowdraw ; 2, end of draw |
98 | mcall 12,2 |
97 | mcall 12,2 |
99 | ret |
98 | ret |
100 | 99 | ||
101 | 100 | ||
102 | ; DATA AREA |
101 | ; DATA AREA |
103 | text1: db 'ASCII:' |
102 | text1: db 'ASCII' |
104 | text2: db 'SCANCODE:' |
103 | text2: db 'SCANCODE' |
105 | tdec: db 'DEC:' |
104 | tdec: db 'DEC:' |
106 | thex: db 'HEX:' |
105 | thex: db 'HEX:' |
107 | title: db 'KEYBOARD ASCIICODES-PRESS ANY KEY',0 |
106 | title: db 'Keyboard ASCII codes',0 |
108 | I_END: |
107 | I_END: |
109 | keyid: rb 1 |
108 | keyid: rb 1 |
110 | scan_keyid: rb 1100,28>40,28>8,28>85,8>33,8> |
109 | scan_keyid: rb 1130,30>55,30>8,30>130,8>55,8> |