0,0 → 1,167 |
; |
; SHAPED WINDOW - BASIC EXAMPLE |
; |
; Compile with FASM for Menuet |
; |
|
use32 |
|
org 0x0 |
|
db 'MENUET00' ; 8 byte id |
dd 38 ; required os |
dd START ; program start |
dd I_END ; program image size |
dd 0x1000 ; required amount of memory |
dd 0x1000 ; esp |
dd 0x00000000 ; reserved=no extended header |
|
include 'lang.inc' |
include 'macros.inc' |
|
|
|
START: ; start of execution |
|
call shape_window ; function for shaping |
|
call draw_window ; at first, draw the window |
|
still: |
|
mov eax,10 ; wait here for event |
int 0x40 |
|
cmp eax,1 ; redraw request ? |
je red |
cmp eax,2 ; key in buffer ? |
je key |
cmp eax,3 ; button in buffer ? |
je button |
|
jmp still |
|
red: ; redraw |
call draw_window |
jmp still |
|
key: ; key |
mov eax,2 ; just read it and ignore |
int 0x40 |
jmp still |
|
button: ; button |
mov eax,17 ; get id |
int 0x40 |
|
cmp ah,1 ; button id=1 ? |
jne noclose |
mov eax,-1 ; close this program |
int 0x40 |
noclose: |
|
jmp still |
|
|
shape_window: |
|
pusha |
|
mov eax,50 ; give the shape reference area |
mov ebx,0 |
mov ecx,shape_reference |
int 0x40 |
|
mov eax,50 ; give the shape scale 32 x 32 -> 128 x 128 |
mov ebx,1 ; you dont have to give this, scale is 1:1 by default |
mov ecx,2 |
int 0x40 |
|
popa |
|
ret |
|
|
shape_reference: ; 32 x 32 ( window_size_X + 1 ) * ( window_size_Y + 1 ) |
|
db 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 |
db 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 |
db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0 |
db 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 |
db 0,0,0,0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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 |
db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 |
db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 |
db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 |
db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 |
db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 |
db 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 |
db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 |
db 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 |
db 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 |
db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0 |
db 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 |
db 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 |
|
|
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
|
|
draw_window: |
|
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
int 0x40 |
|
; DRAW WINDOW |
mov eax,0 ; function 0 : define and draw window |
mov ebx,100*65536 ; [x start] *65536 + [x size] |
mov ecx,100*65536 ; [y start] *65536 + [y size] |
mov bx,word [x_size] |
mov cx,word [y_size] |
mov edx,0x00cccc00 ; color of work area RRGGBB,8->color glide |
mov esi,0x00cccc00 ; color of grab bar RRGGBB,8->color glide |
mov edi,0x00cccc00 ; color of frames RRGGBB |
int 0x40 |
|
|
; CLOSE BUTTON |
mov eax,8 ; function 8 : define and draw button |
mov ebx,78*65536+12 ; [x start] *65536 + [x size] |
mov ecx,20*65536+12 ; [y start] *65536 + [y size] |
mov edx,1 ; button id |
mov esi,0x5599cc ; button color RRGGBB |
int 0x40 |
|
|
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
|
ret |
|
|
; DATA AREA |
|
|
x_size dd 127 |
y_size dd 127 |
|
|
I_END: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |