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