mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-24 23:56:49 +03:00
882f26ac9d
git-svn-id: svn://kolibrios.org@2185 a494cfbc-eb01-0410-851d-a64ba20cac60
183 lines
5.0 KiB
NASM
183 lines
5.0 KiB
NASM
use32
|
||
org 0x0
|
||
db 'MENUET01' ;¨¤¥â¨ä. ¨á¯®«ï¥¬®£® ä ©« ¢á¥£¤ 8 ¡ ©â
|
||
dd 0x1
|
||
dd start
|
||
dd i_end ;à §¬¥à ¯à¨«®¦¥¨ï
|
||
dd mem,stacktop
|
||
dd 0,cur_dir_path
|
||
|
||
include '../../../../../macros.inc'
|
||
include '../../../../../proc32.inc'
|
||
include '../../../../../develop/libraries/box_lib/load_lib.mac'
|
||
include 'mem.inc'
|
||
|
||
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, 0 ;dll.Load
|
||
|
||
align 4
|
||
start:
|
||
load_library vectors_name, cur_dir_path, library_path, system_path, \
|
||
err_message_found_lib, head_f_l, import_buf2d_lib, err_message_import, head_f_i
|
||
cmp eax,-1
|
||
jz button.exit
|
||
|
||
mcall 40,0x27
|
||
stdcall [buf2d_create], buf_0 ;ᮧ¤ ¥¬ ¡ãä¥à
|
||
stdcall [buf2d_line], buf_0, 110, 20, 125, 90, 0xffff00 ;à¨á㥬 «¨¨î
|
||
stdcall [buf2d_line], buf_0, 60, 120, 110, 20, 0xd000 ;à¨á㥬 «¨¨î
|
||
stdcall [buf2d_curve_bezier], buf_0, (10 shl 16)+20,(110 shl 16)+10,(50 shl 16)+90, dword 0xff
|
||
stdcall [buf2d_circle], buf_0, 125, 90, 30, 0xffffff ;à¨á㥬 ®ªà㦮áâì
|
||
stdcall [buf2d_circle], buf_0, 25, 70, 15, 0xff0000 ;à¨á㥬 ®ªà㦮áâì
|
||
|
||
stdcall [buf2d_img_hdiv2], buf_0 ;ᦨ¬ ¥¬ ¨§®¡à ¦¥¨¥ ¢ ¡ãä¥à¥ ¯® ¢ëá®â¥ ¢ 2 à §
|
||
stdcall [buf2d_img_wdiv2], buf_0 ;ᦨ¬ ¥¬ ¨§®¡à ¦¥¨¥ ¢ ¡ãä¥à¥ ¯® è¨à¨¥ ¢ 2 à §
|
||
stdcall [buf2d_create_f_img], buf_1,[buf_0] ;ᮧ¤ ¥¬ ¬ «¥ìª¨© ¡ãä¥à buf_1, ®á®¢¥ ᦠ⮣® ¨§®¡à ¦¥¨ï ¨§ buf_0
|
||
|
||
;¥á«¨ ¡ë ¨á¯®«ì§®¢ « áì äãªæ¨ï buf2d_create, ⮣¤ ¡¨âë ¨§®¡à ¦¥¨ï
|
||
;¯à¨è«®áì ¡ë ª®¯¨à®¢ âì á«¥¤ã騬¨ áâப ¬¨:
|
||
;xor ecx,ecx
|
||
;xor eax,eax
|
||
;mov cx,word[buf_1.size_x]
|
||
;mov ax,word[buf_1.size_y]
|
||
;imul ecx,eax
|
||
;imul ecx,3 ;ecx - ª®««¨ç¥á⢮ ¡ ©â ¢ ¬ «¥ìª®¬ ¡ãä¥à¥
|
||
;stdcall mem_copy, dword[buf_0],dword[buf_1],ecx
|
||
|
||
stdcall [buf2d_clear], buf_0,0xffffff
|
||
stdcall [buf2d_bit_blt], buf_0, 15,10, buf_1
|
||
stdcall [buf2d_bit_blt], buf_0, 110,65, buf_1
|
||
|
||
stdcall [buf2d_conv_24_to_8], buf_1
|
||
;stdcall [buf2d_bit_blt_alpha], buf_0, 1,1, buf_1,0xff8080 ;à¨á㥬 ª®âãàë ¨§®¡à ¦¥¨ï ä®â®£à 䨨
|
||
|
||
align 4
|
||
red_win:
|
||
call draw_window
|
||
|
||
align 4
|
||
still:
|
||
mcall 10
|
||
cmp al,1 ;¨§¬. ¯®«®¦¥¨¥ ®ª
|
||
jz red_win
|
||
cmp al,2
|
||
jz key
|
||
cmp al,3
|
||
jz button
|
||
jmp still
|
||
|
||
align 4
|
||
draw_window:
|
||
pushad
|
||
mcall 12,1
|
||
|
||
;mov edx,0x32000000
|
||
mov edx,0x33000000
|
||
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
|
||
|
||
stdcall [buf2d_draw], buf_0
|
||
|
||
mcall 12,2
|
||
popad
|
||
ret
|
||
|
||
align 4
|
||
key:
|
||
mcall 2
|
||
|
||
cmp ah,27 ;Esc
|
||
je button.exit
|
||
|
||
jmp still
|
||
|
||
align 4
|
||
button:
|
||
mcall 17 ;¯®«ãç¨âì ª®¤ ¦ ⮩ ª®¯ª¨
|
||
cmp ah,1
|
||
jne still
|
||
.exit:
|
||
stdcall [buf2d_delete],buf_0 ;㤠«ï¥¬ ¡ãä¥à
|
||
stdcall [buf2d_delete],buf_1 ;㤠«ï¥¬ ¡ãä¥à
|
||
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
|
||
|
||
caption db 'Test buf2d library, [Esc] - exit',0
|
||
|
||
;--------------------------------------------------
|
||
align 4
|
||
import_buf2d_lib:
|
||
dd sz_lib_init
|
||
buf2d_create dd sz_buf2d_create
|
||
buf2d_create_f_img dd sz_buf2d_create_f_img
|
||
buf2d_clear dd sz_buf2d_clear
|
||
buf2d_draw dd sz_buf2d_draw
|
||
buf2d_delete dd sz_buf2d_delete
|
||
buf2d_line dd sz_buf2d_line
|
||
buf2d_circle dd sz_buf2d_circle
|
||
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
|
||
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
|
||
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
|
||
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
|
||
buf2d_bit_blt dd sz_buf2d_bit_blt
|
||
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
|
||
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
|
||
buf2d_curve_bezier dd sz_buf2d_curve_bezier
|
||
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
|
||
buf2d_draw_text dd sz_buf2d_draw_text
|
||
dd 0,0
|
||
sz_lib_init db 'lib_init',0
|
||
sz_buf2d_create db 'buf2d_create',0
|
||
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
|
||
sz_buf2d_clear db 'buf2d_clear',0
|
||
sz_buf2d_draw db 'buf2d_draw',0
|
||
sz_buf2d_delete db 'buf2d_delete',0
|
||
sz_buf2d_line db 'buf2d_line',0
|
||
sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ¨¥ ®ªà㦮áâ¨
|
||
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
|
||
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
|
||
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
|
||
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
|
||
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
|
||
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
|
||
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
|
||
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
|
||
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
|
||
sz_buf2d_draw_text db 'buf2d_draw_text',0
|
||
|
||
align 4
|
||
buf_0:
|
||
dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 20 ;+4 left
|
||
dw 10 ;+6 top
|
||
dd 160 ;+8 w
|
||
dd 128 ;+12 h
|
||
dd 0x80 ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
align 4
|
||
buf_1:
|
||
dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 10 ;+4 left
|
||
dw 10 ;+6 top
|
||
.size_x: dd 80 ;+8 w
|
||
.size_y: dd 64 ;+12 h
|
||
dd 0x80 ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
;--------------------------------------------------
|
||
system_path db '/sys/lib/'
|
||
vectors_name db 'buf2d.obj',0
|
||
err_message_found_lib db 'Sorry I cannot load library buf2d.obj',0
|
||
head_f_i:
|
||
head_f_l db 'System error',0
|
||
err_message_import db 'Error on load import library buf2d.obj',0
|
||
;--------------------------------------------------
|
||
|
||
i_end: ;ª®¥æ ª®¤
|
||
rb 1024
|
||
stacktop:
|
||
cur_dir_path:
|
||
rb 4096
|
||
library_path:
|
||
rb 4096
|
||
mem:
|
||
|