forked from KolibriOS/kolibrios
53829299a9
git-svn-id: svn://kolibrios.org@4327 a494cfbc-eb01-0410-851d-a64ba20cac60
350 lines
6.4 KiB
NASM
350 lines
6.4 KiB
NASM
;Ž£à®¬ ï ¡« £®¤ à®áâì Maxxxx32, Diamond, Heavyiron
|
||
;¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬, â ª¦¥
|
||
;’¥¯«®¢ã €«¥ªá¥î (<Lrz> www.lrz.land.ru)
|
||
use32
|
||
org 0x0
|
||
db 'MENUET01' ;¨¤¥â¨ä. ¨á¯®«ï¥¬®£® ä ©« ¢á¥£¤ 8 ¡ ©â
|
||
dd 0x1
|
||
dd start
|
||
dd i_end ; à §¬¥à ¯à¨«®¦¥¨ï
|
||
dd mem
|
||
dd stacktop
|
||
dd 0x0 ;library_path
|
||
dd cur_dir_path
|
||
|
||
include 'macros.inc'
|
||
include 'load_lib.mac'
|
||
|
||
@use_library
|
||
|
||
align 4
|
||
start:
|
||
|
||
mov eax,40
|
||
mov ebx,0x25 ;¬ ᪠®¦¨¤ ¥¬ëå ᮡë⨩
|
||
mcall
|
||
|
||
sys_load_library msgbox_name, cur_dir_path, library_path, system_path, \
|
||
err_message_found_lib, head_f_l, msgbox_lib_import, err_message_import, head_f_i
|
||
|
||
|
||
red_win:
|
||
mcall 12,1
|
||
|
||
xor eax,eax
|
||
mov ebx,50*65536+200
|
||
mov ecx,30*65536+170
|
||
mov edx,0xffffd0
|
||
or edx,0x33000000
|
||
mov edi,hed
|
||
mcall
|
||
|
||
mov eax,8 ;ª®¯ª
|
||
mov ebx,10*65536+30
|
||
mov ecx,110*65536+20
|
||
mov edx,7
|
||
mov esi,0xffd040
|
||
mcall
|
||
|
||
mov ebx,10*65536+30
|
||
mov ecx,85*65536+20
|
||
mov edx,6
|
||
mcall
|
||
|
||
mov ebx,10*65536+30
|
||
mov ecx,60*65536+20
|
||
mov edx,5
|
||
mcall
|
||
|
||
mov ebx,10*65536+30
|
||
mov ecx,35*65536+20
|
||
mov edx,4
|
||
mcall
|
||
|
||
mov ebx,10*65536+30
|
||
mov ecx,10*65536+20
|
||
mov edx,3
|
||
mcall
|
||
|
||
mov eax,4 ;à¨á®¢ ¨¥ ⥪áâ
|
||
mov ebx,50*65536+115
|
||
mov ecx,0x4000d0
|
||
or ecx,0x80000000
|
||
mov edx,txt140
|
||
mcall
|
||
|
||
mov ebx,50*65536+90
|
||
mov edx,txt139
|
||
mcall
|
||
|
||
mov ebx,50*65536+65
|
||
mov edx,txt138
|
||
mcall
|
||
|
||
mov ebx,50*65536+40
|
||
mov edx,txt137
|
||
mcall
|
||
|
||
mov ebx,50*65536+15
|
||
mov edx,txt136
|
||
mcall
|
||
|
||
push eax ebx ecx edx esi
|
||
;line numbers
|
||
mov eax,47
|
||
mov esi,0xd00000
|
||
mov ebx,0x10000 ;format
|
||
|
||
; --- draw codes ---
|
||
xor ecx,ecx
|
||
mov cl,byte[msgbox_1]
|
||
mov dx,25
|
||
shl edx,16
|
||
mov dx,15
|
||
int 0x40
|
||
|
||
mov cl,byte[msgbox_2]
|
||
add dx,25
|
||
int 0x40
|
||
|
||
mov cl,byte[msgbox_3]
|
||
add dx,25
|
||
int 0x40
|
||
|
||
mov cl,byte[msgbox_4]
|
||
add dx,25
|
||
int 0x40
|
||
|
||
mov cl,byte[msgbox_5]
|
||
add dx,25
|
||
int 0x40
|
||
|
||
pop esi edx ecx ebx eax
|
||
call draw_square
|
||
mcall 12,2
|
||
|
||
still:
|
||
mov eax,10
|
||
mcall
|
||
|
||
cmp al,1 ;¨§¬. ¯®«®¦¥¨¥ ®ª
|
||
jz red_win
|
||
cmp al,3
|
||
jz button
|
||
jmp still
|
||
|
||
button:
|
||
mcall 17 ;¯®«ãç¨âì ª®¤ ¦ ⮩ ª®¯ª¨
|
||
|
||
cmp ah,3
|
||
jz but_1
|
||
cmp ah,4
|
||
jz but_2
|
||
cmp ah,5
|
||
jz but_3
|
||
cmp ah,6
|
||
jz but_4
|
||
cmp ah,7
|
||
jz but_5
|
||
|
||
cmp ah,1
|
||
jne still
|
||
.exit:
|
||
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
|
||
|
||
but_1:
|
||
push thread
|
||
push msgbox_1
|
||
call [mb_create]
|
||
jmp still
|
||
|
||
but_2:
|
||
push thread
|
||
push msgbox_2
|
||
call [mb_create]
|
||
;mov eax,5
|
||
;mov ebx,50
|
||
;int 0x40
|
||
push msgbox_2_funct
|
||
call [mb_setfunctions]
|
||
jmp still
|
||
|
||
but_3:
|
||
push thread
|
||
push msgbox_3
|
||
call [mb_create]
|
||
jmp still
|
||
|
||
but_4:
|
||
push thread
|
||
push msgbox_4
|
||
call [mb_create]
|
||
jmp still
|
||
|
||
but_5:
|
||
push thread
|
||
push msgbox_5
|
||
call [mb_create]
|
||
|
||
mcall 5,100 ;stop program
|
||
|
||
push msgbox_5_2
|
||
call [mb_reinit]
|
||
|
||
jmp still
|
||
|
||
|
||
txt136 db '¯à®á⮥',0
|
||
txt137 db '3 ª®¯ª¨',0
|
||
txt138 db '3 áâப¨',0
|
||
txt139 db '¡®«ì讥',0
|
||
txt140 db 'mb_reinit',0
|
||
|
||
hed db '<27>ਬ¥à ¨á¯®«ì§®¢ ¨ï MsgBox',0
|
||
;sc system_colors
|
||
|
||
|
||
;---------------------------------------------------------------------
|
||
msgbox_1:
|
||
dw 0
|
||
db 'MBox',0 ;+2 = +MB_TEXT_OFFSET
|
||
db '<27>ਬ¥à',0
|
||
db '‚¨¦ã',0 ;button1
|
||
db 0
|
||
msgbox_2:
|
||
dw 0
|
||
db 'MBox 3 but',0 ;+2 = +MB_TEXT_OFFSET
|
||
db '<27>ਬ¥à á 3-¬ï ª®¯ª ¬¨',0
|
||
db '„ ',0 ;button1
|
||
db 'Žâ¬¥ ',0 ;button2
|
||
db '<27>®¬®éì',0 ;button3
|
||
db 0
|
||
msgbox_2_funct:
|
||
dd 0
|
||
dd 0
|
||
dd fun_show_help
|
||
|
||
msgbox_3:
|
||
dw 0
|
||
db 'MBox 3 lines',0 ;+2 = +MB_TEXT_OFFSET
|
||
db '‘âப 1',13,'‘âப 2',13,'‘âப 3',0
|
||
db '2009 £.',0 ;button1
|
||
db 0
|
||
msgbox_4:
|
||
dw 0
|
||
db '‚¢¥¤¨â¥ ¤¥ì',0 ;+2 = +MB_TEXT_OFFSET
|
||
db ' @@@@@@@@@@@@ @@@@@@@@',13
|
||
db ' @............@ @........@',13
|
||
db '@..............@ @..........@',13
|
||
db '@.......@@@.....@ @......@.....@',13
|
||
db '@.......@ @.....@@@@@@......@@......@',13
|
||
db '@......@ @.................@@.......@',13
|
||
db ' @....@ @.....@@......@@....@.......@',13
|
||
db ' @..@ @.........@.........@......@',13
|
||
db ' @@ @...................@@....@',13
|
||
db ' @.......@@@.......@ @..@',13
|
||
db ' @...............@ @@',13
|
||
db ' @...............@',13
|
||
db ' @.................@',13
|
||
db ' @...................@',13
|
||
db ' @.....................@',13
|
||
db ' @.......@@......@@......@ @@',13
|
||
db ' @......@....@..@....@.....@@..@',13
|
||
db ' @......@....@..@....@.........@',13
|
||
db ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@',0
|
||
db '<27>',0
|
||
db '‚â',0
|
||
db '‘à',0
|
||
db '—â',0
|
||
db '<27>â',0
|
||
db '‘¡',0
|
||
db '‚®áªà¥á¥¨¥',0
|
||
db 0
|
||
msgbox_5:
|
||
dw 0
|
||
db '‘®®¡é¥¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||
db '‚믮«ïî ¯à®æ¥áá ...',0
|
||
db 'Žáâ ®¢¨âì',0
|
||
db '<27>à¥à¢ âì',0
|
||
db 0
|
||
msgbox_5_2:
|
||
dw 0
|
||
db '‘®®¡é¥¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||
db '‚ᥠ§ ª®ç¥®',0
|
||
db '‡ ªàëâì ®ª®',0
|
||
db 0
|
||
|
||
;--------------------------------------------------
|
||
align 4
|
||
msgbox_lib_import:
|
||
mb_create dd amb_create
|
||
mb_reinit dd amb_reinit
|
||
mb_setfunctions dd amb_setfunctions
|
||
dd 0,0
|
||
amb_create db 'mb_create',0
|
||
amb_reinit db 'mb_reinit',0
|
||
amb_setfunctions db 'mb_setfunctions',0
|
||
;--------------------------------------------------
|
||
system_path db '/sys/lib/'
|
||
msgbox_name db 'msgbox.obj',0
|
||
err_message_found_lib db 'Sorry I cannot load library msgbox.obj',0
|
||
head_f_i:
|
||
head_f_l db 'System error',0
|
||
err_message_import db 'Error on load import library msgbox.obj',0
|
||
;--------------------------------------------------
|
||
|
||
draw_square:
|
||
cmp byte[sh_help],0
|
||
je @f
|
||
push eax ebx ecx edx
|
||
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà
|
||
mov ebx,105*65536+70
|
||
mov ecx,15*65536+50
|
||
mov edx,0x8080ff
|
||
int 0x40
|
||
|
||
mov eax,4 ;à¨á®¢ ¨¥ ⥪áâ
|
||
mov ebx,110*65536+25
|
||
mov ecx,0xffffff
|
||
mov edx,txt_help
|
||
mov esi,9
|
||
mcall
|
||
|
||
mov eax,47
|
||
mov esi,0xffff
|
||
mov ebx,0x10000 ;format
|
||
xor ecx,ecx
|
||
mov cl,byte[sh_help]
|
||
mov dx,150
|
||
shl edx,16
|
||
mov dx,40
|
||
int 0x40
|
||
|
||
pop edx ecx ebx eax
|
||
@@:
|
||
ret
|
||
fun_show_help:
|
||
inc byte[sh_help]
|
||
cmp byte[sh_help],10
|
||
jne @f
|
||
mov byte[sh_help],0
|
||
@@:
|
||
call draw_square
|
||
ret
|
||
sh_help db 0
|
||
txt_help db '<27>®¬®éì...'
|
||
|
||
|
||
i_end: ;ª®¥æ ª®¤
|
||
rb 1024
|
||
thread:
|
||
rb 1024
|
||
stacktop:
|
||
cur_dir_path:
|
||
rb 4096
|
||
library_path:
|
||
rb 4096
|
||
file_info:
|
||
rb 40
|
||
mem:
|