kolibrios-fun/programs/develop/examples/circle/trunk/circle.asm
maxcodehack 31a0fa2971 Revision in '/programs/develop/examples': replace 'FASM for Menuet' with 'FASM', meos_app_start -> KOS_APP_START
git-svn-id: svn://kolibrios.org@8163 a494cfbc-eb01-0410-851d-a64ba20cac60
2020-11-08 13:07:53 +00:00

156 lines
5.3 KiB
NASM

;
; SHAPED WINDOW - BASIC EXAMPLE
;
; Compile with FASM
;
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 1 ; required os
dd START ; program start
dd I_END ; program image size
dd E_END ; required amount of memory
dd E_END ; esp
dd 0, 0 ; no params, no path
include '..\..\..\..\macros.inc'
START: ; start of execution
call shape_window ; function for shaping
red:
call draw_window ; at first, draw the window
still:
mov eax,10 ; wait here for event
mcall
dec eax ; redraw request ?
jz red
dec eax ; key in buffer ?
jz key
button:
mov al,17 ; get id
mcall
cmp ah,1 ; button id=1 ?
jne noclose
or eax,-1 ; close this program
mcall
key: ; key
mov al,2 ; just read it and ignore
mcall
jmp still
noclose:
jmp still
shape_window:
pusha
mov eax,50 ; give the shape reference area
mov ebx,0
mov ecx,shape_reference
mcall
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
mcall
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,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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,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
mcall
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
mov ebx,100*65536+127 ; [x start] *65536 + [x size]
mov ecx,100*65536+127 ; [y start] *65536 + [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
mcall
; 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
mcall
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
ret
; DATA AREA
I_END:
rb 0x100 ; stack
E_END: