Rev 4589 | 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 |
||
9044 | leency | 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 |
9044 | leency | 66 | mcall 12,1 |
31 | halyavin | 67 | |
68 | ; DRAW WINDOW |
||
9044 | leency | 69 | mov eax,0 ; function 0 : define and draw window |
70 | mov ebx,200*65536+250 ; [x start] *65536 + [x size] |
||
71 | mov ecx,200*65536+106 ; [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 |
9044 | leency | 77 | mcall 4,<55,8>,0x10000000,text1,5 |
78 | mcall ,<130,8>,,text2,9 |
||
79 | mcall ,<8,30>,,tdec,4 |
||
80 | add ebx,23 |
||
81 | mcall ,,,thex |
||
31 | halyavin | 82 | |
9044 | leency | 83 | movzx ecx,byte [keyid] |
84 | mcall 47,0x30000,,<55,30>,0x10224466 |
||
85 | add edx,23 |
||
86 | mov bh,1 |
||
87 | mcall |
||
31 | halyavin | 88 | |
9044 | leency | 89 | mov bh,0 |
90 | movzx ecx,byte [scan_keyid] |
||
91 | mcall ,,,<130,30> |
||
92 | add edx,23 |
||
93 | mov bh,1 |
||
94 | mcall |
||
31 | halyavin | 95 | |
4589 | mario79 | 96 | ; function 12:tell os about windowdraw ; 2, end of draw |
9044 | leency | 97 | mcall 12,2 |
98 | ret |
||
31 | halyavin | 99 | |
100 | |||
101 | ; DATA AREA |
||
9044 | leency | 102 | text1: db 'ASCII' |
103 | text2: db 'SCANCODE' |
||
4589 | mario79 | 104 | tdec: db 'DEC:' |
105 | thex: db 'HEX:' |
||
9044 | leency | 106 | title: db 'Keyboard ASCII codes',0 |
31 | halyavin | 107 | I_END: |
4589 | mario79 | 108 | keyid: rb 1 |
109 | scan_keyid: rb 1130,30>55,30>8,30>130,8>55,8> |
||
31 | halyavin | 110 |