*fixed info for 4th function in documentation

*added animage and kfar
*renamed docpak (to docpack)
*chess fixed by Yellow to use 70th function
*docpack, tetris, jpegview, trantest, desktop uses system colors, new functions of window drawing now
*removed old rd2hd and rd2fd

git-svn-id: svn://kolibrios.org@180 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2006-10-11 23:19:10 +00:00
parent f9f3d06971
commit 7c8ba5ff40
54 changed files with 16501 additions and 1917 deletions

View File

@ -192,8 +192,8 @@
* ecx = 0xX0RRGGBB, ЃЄЅ
* RR, GG, BB Ї Є ют цЂЅт тЅЊст 
* X=ABnn (ЁЈты):
* nn § ¤ ¥â ¨á¯®«ì§ã¥¬ë© èà¨äâ: 0=á¨á⥬­ë© ¬®­®è¨à¨­­ë©,
1=á¨á⥬­ë© èà¨äâ ¯¥à¥¬¥­­®© è¨à¨­ë
* nn § ¤ ¥â ¨á¯®«ì§ã¥¬ë© èà¨äâ: 1=á¨á⥬­ë© ¬®­®è¨à¨­­ë©,
0=á¨á⥬­ë© èà¨äâ ¯¥à¥¬¥­­®© è¨à¨­ë
* A=0 - ЂыЂЎЄЈть esi сЈЌЂЎЋЎЂ, A=1 - ЂыЂЎЄЈть ASCIIZ-стрЎЊу
* B=1 - Ї Њр шЈЂ ть фЎ­ цЂЅтЎЌ edi
* edx = уЊ Ї тЅЋь ­  ­ ч ЋЎ стрЎЊЈ

View File

@ -189,8 +189,8 @@ Parameters:
* ecx = 0xX0RRGGBB, where
* RR, GG, BB specify text color
* X=ABnn (bits):
* nn specifies the used font: 0=system monospaced,
1=system font of variable width
* nn specifies the used font: 1=system monospaced,
0=system font of variable width
* A=0 - output esi characters, A=1 - output ASCIIZ-string
* B=1 - fill background with the color edi
* edx = pointer to the beginning of the string

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm trantest.asm trantest
@erase lang.inc
@pause

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm trantest.asm trantest
@erase lang.inc
@pause

View File

@ -12,8 +12,8 @@ use32
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x2000000 ; memory for app
dd 0x2000000 ; esp
dd 0x100000 ; memory for app
dd 0x100000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
SCREEN_X equ 320 ;800
@ -24,11 +24,12 @@ include 'ascl.inc'
include 'ascgl.inc'
START:
red:
call draw_window
still:
scevent red,key,button
fps 280,8,cl_White,cl_Black
fps 290,8,cl_White,cl_Black
main_loop:
random SCREEN_X,eax
@ -63,9 +64,6 @@ xxx:
count dd 100
red:
call draw_window
jmp still
key:
mov eax,2
int 0x40
@ -81,21 +79,16 @@ exit:
;Draw window
draw_window:
mov eax,12 ;Start
mov ebx,1
int 0x40
mov eax,0 ;Draw window
mov ebx,100*65536+(SCREEN_X+9) ;x start*65536+x size
mov ecx,100*65536+(SCREEN_Y+26) ;y start*65536+y size
mov edx,0x03000000 ;0x03 use skinned window
int 0x40
mov eax,4 ;Out Text
mov ebx,8*65536+8 ;x start*65536+y start
mov ecx,0x00ffffff ;color White
mov edx,head_label
mov esi,hl_end-head_label
xor eax,eax ;Draw window
mov ebx,100*65536+(SCREEN_X+19) ;x start*65536+x size
mov ecx,100*65536+(SCREEN_Y+51) ;y start*65536+y size
mov edx,0x33000000 ;0x33 use skinned window
mov edi,header
int 0x40
mov eax,12 ;End
@ -103,8 +96,7 @@ draw_window:
int 0x40
ret
head_label: db "3D TEST SAMPLE FOR MENUETOS"
hl_end:
header db '3D TEST SAMPLE',0
outscr:

View File

@ -0,0 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm kfar.asm kfar
@erase lang.inc
@pause

View File

@ -0,0 +1,5 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm kfar.asm kfar
@erase lang.inc
@pause

View File

@ -0,0 +1,934 @@
; int __stdcall DialogBox(DLGTEMPLATE* dlg, void* DlgProc);
; int __stdcall DlgProc(int msg, int param1, int param2);
virtual at 0
dlgtemplate:
.flags dd ?
.x dd ?
.y dd ?
.width dd ?
.height dd ?
.border_size_x dd ?
.border_size_y dd ?
.title dd ?
.main_color db ?
.border_color db ?
.header_color db ?
db ? ; align
end virtual
DialogBox:
pushad
; some checks
mov ebx, [esp+20h+4]
mov eax, [ebx+dlgtemplate.x]
cmp eax, 1
jl .sizeerr
add eax, [ebx+dlgtemplate.width]
cmp eax, [cur_width]
jge .sizeerr
mov eax, [ebx+dlgtemplate.y]
cmp eax, 1
jl .sizeerr
add eax, [ebx+dlgtemplate.height]
cmp eax, [cur_height]
jge .sizeerr
cmp [ebx+dlgtemplate.border_size_x], 1
jl .sizeerr
cmp [ebx+dlgtemplate.border_size_y], 1
jge .sizeok
.sizeerr:
popad
or eax, -1
ret 8
.sizeok:
; allocate memory for data under dialog
mov eax, [ebx+dlgtemplate.width]
add eax, [ebx+dlgtemplate.border_size_x]
add eax, [ebx+dlgtemplate.border_size_x]
inc eax
inc eax
mov edx, [ebx+dlgtemplate.height]
add edx, [ebx+dlgtemplate.border_size_y]
add edx, [ebx+dlgtemplate.border_size_y]
inc edx
mul edx
add eax, eax
call mf_alloc
test eax, eax
jnz @f
; TODO: add error message
popad
or eax, -1
ret 8
@@:
mov ebp, eax
; save data
mov eax, [ebx+dlgtemplate.y]
add eax, [ebx+dlgtemplate.height]
add eax, [ebx+dlgtemplate.border_size_y]
inc eax
push eax
mov eax, [ebx+dlgtemplate.x]
add eax, [ebx+dlgtemplate.width]
add eax, [ebx+dlgtemplate.border_size_x]
inc eax
inc eax
push eax
mov eax, [ebx+dlgtemplate.y]
sub eax, [ebx+dlgtemplate.border_size_y]
push eax
mov eax, [ebx+dlgtemplate.x]
sub eax, [ebx+dlgtemplate.border_size_x]
push eax
call save_console_data
; draw shadow
mov eax, [ebx+dlgtemplate.x]
sub eax, [ebx+dlgtemplate.border_size_x]
ja @f
xor eax, eax
@@:
push eax ; save real window left
inc eax
inc eax
mov edx, [ebx+dlgtemplate.y]
sub edx, [ebx+dlgtemplate.border_size_y]
ja @f
xor edx, edx
@@:
push edx ; save real window top
inc edx
call get_console_ptr
mov ecx, [ebx+dlgtemplate.y]
add ecx, [ebx+dlgtemplate.height]
add ecx, [ebx+dlgtemplate.border_size_y]
inc ecx
cmp ecx, [cur_height]
jb @f
mov ecx, [cur_height]
@@:
sub ecx, edx
mov edx, ecx
mov ecx, [ebx+dlgtemplate.x]
add ecx, [ebx+dlgtemplate.width]
add ecx, [ebx+dlgtemplate.border_size_x]
inc ecx
inc ecx
cmp ecx, [cur_width]
jb @f
mov ecx, [cur_width]
@@:
sub ecx, eax
mov eax, ecx
.shadow_loop:
mov ecx, eax
push edi
.sl1:
inc edi
test byte [edi], 0x0F
jnz @f
or byte [edi], 8
@@:
and byte [edi], 0x0F
inc edi
loop .sl1
pop edi
add edi, [cur_width]
add edi, [cur_width]
dec edx
jnz .shadow_loop
; draw area background
pop edx
pop eax
call get_console_ptr
mov ecx, [ebx+dlgtemplate.x]
add ecx, [ebx+dlgtemplate.width]
add ecx, [ebx+dlgtemplate.border_size_x]
cmp ecx, [cur_width]
jb @f
mov ecx, [cur_width]
@@:
sub ecx, eax
mov esi, ecx
mov ecx, [ebx+dlgtemplate.y]
add ecx, [ebx+dlgtemplate.height]
add ecx, [ebx+dlgtemplate.border_size_y]
cmp ecx, [cur_height]
jb @f
mov ecx, [cur_height]
@@:
sub ecx, edx
mov edx, ecx
mov al, ' '
mov ah, [ebx+dlgtemplate.border_color]
.1:
mov ecx, esi
push edi
rep stosw
pop edi
add edi, [cur_width]
add edi, [cur_width]
dec edx
jnz .1
; draw border
mov eax, [ebx+dlgtemplate.x]
dec eax
mov edx, [ebx+dlgtemplate.y]
dec edx
call get_console_ptr
mov edx, [ebx+dlgtemplate.height]
inc edx
inc edx
mov ah, [ebx+dlgtemplate.border_color]
push ebx
mov ebx, [ebx+dlgtemplate.width]
inc ebx
inc ebx
call draw_border
pop ebx
; draw header
mov esi, [ebx+dlgtemplate.title]
test esi, esi
jz .noheader
cmp byte [esi], 0
jz .noheader
push esi
@@: lodsb
test al, al
jnz @b
mov eax, esi
pop esi
sub eax, esi
inc eax ; eax = äëèíà çàãîëîâêà + 2
mov ecx, [ebx+dlgtemplate.width]
cmp eax, ecx
jbe .fullhea
sub ecx, 5
jb .noheader
xor edx, edx
jmp .drawhea
.fullhea:
mov edx, ecx
sub edx, eax
shr edx, 1
.drawhea:
mov eax, [ebx+dlgtemplate.x]
add eax, edx
mov edx, [ebx+dlgtemplate.y]
dec edx
call get_console_ptr
mov ah, [ebx+dlgtemplate.header_color]
mov al, ' '
stosw
dec ecx
.2:
jecxz .3
lodsb
test al, al
jz .4
stosw
jmp .2
.3:
mov al, '.'
stosw
stosw
stosw
.4:
mov al, ' '
stosw
.noheader:
; draw window background
mov eax, [ebx+dlgtemplate.x]
mov edx, [ebx+dlgtemplate.y]
call get_console_ptr
mov ah, [ebx+dlgtemplate.main_color]
mov al, ' '
mov edx, [ebx+dlgtemplate.height]
@@:
mov ecx, [ebx+dlgtemplate.width]
push edi
rep stosw
pop edi
add edi, [cur_width]
add edi, [cur_width]
dec edx
jnz @b
; send redraw message
mov eax, [esp+20h+8]
push ebx ebp
push 0
push 0
push 1
call eax
call draw_image
pop ebp ebx
; message loop
.event:
push 10
pop eax
int 40h
dec eax
jz .redraw
dec eax
jz .key
or eax, -1
int 40h
.redraw:
push ebx ebp
call draw_window
pop ebp ebx
jmp .event
.key:
mov al, 2
int 40h
shr eax, 8
cmp al, 0xE0
jnz @f
mov [bWasE0], 1
jmp .event
@@:
xchg ah, [bWasE0]
cmp al, 0x1D
jz .ctrl_down
cmp al, 0x9D
jz .ctrl_up
cmp al, 0x2A
jz .lshift_down
cmp al, 0xAA
jz .lshift_up
cmp al, 0x36
jz .rshift_down
cmp al, 0xB6
jz .rshift_up
cmp al, 0x38
jz .alt_down
cmp al, 0xB8
jz .alt_up
mov ecx, [esp+20h+8]
push ebx ebp
push 0
push eax
push 2
call ecx
pop ebp ebx
test eax, eax
jz .event
mov [esp+28], eax
jmp .exit
.ctrl_down:
test ah, ah
jnz .rctrl_down
or [ctrlstate], 4
jmp .event
.rctrl_down:
or [ctrlstate], 8
jmp .event
.ctrl_up:
test ah, ah
jnz .rctrl_up
and [ctrlstate], not 4
jmp .event
.rctrl_up:
and [ctrlstate], not 8
jmp .event
.lshift_down:
test ah, ah
jnz @f
or [ctrlstate], 1
@@: jmp .event
.lshift_up:
test ah, ah
jnz @b
and [ctrlstate], not 1
jmp @b
.rshift_down:
or [ctrlstate], 2
jmp .event
.rshift_up:
and [ctrlstate], not 2
jmp .event
.alt_down:
test ah, ah
jnz .ralt_down
or [ctrlstate], 0x10
jmp .event
.ralt_down:
or [ctrlstate], 0x20
jmp .event
.alt_up:
test ah, ah
jnz .ralt_up
and [ctrlstate], not 0x10
jmp .event
.ralt_up:
and [ctrlstate], not 0x20
jmp .event
.exit:
; restore data
mov eax, [ebx+dlgtemplate.y]
add eax, [ebx+dlgtemplate.height]
add eax, [ebx+dlgtemplate.border_size_y]
inc eax
push eax
mov eax, [ebx+dlgtemplate.x]
add eax, [ebx+dlgtemplate.width]
add eax, [ebx+dlgtemplate.border_size_x]
inc eax
inc eax
push eax
mov eax, [ebx+dlgtemplate.y]
sub eax, [ebx+dlgtemplate.border_size_y]
push eax
mov eax, [ebx+dlgtemplate.x]
sub eax, [ebx+dlgtemplate.border_size_x]
push eax
call restore_console_data
call draw_keybar
mov eax, ebp
call mf_free
call draw_image
popad
ret 8
save_console_data:
cmp dword [esp+4], 0
jge @f
and dword [esp+4], 0
@@:
cmp dword [esp+8], 0
jge @f
and dword [esp+8], 0
@@:
mov eax, [esp+12]
cmp eax, [cur_width]
jbe @f
mov eax, [cur_width]
@@:
sub eax, [esp+4]
ja @f
ret 16
@@:
mov [esp+12], eax
mov eax, [esp+16]
cmp eax, [cur_height]
jbe @f
mov eax, [cur_height]
@@:
sub eax, [esp+8]
ja @f
ret 16
@@:
mov [esp+16], eax
mov eax, [esp+4]
mov edx, [esp+8]
call get_console_ptr
mov esi, edi
mov edi, ebp
.l:
mov ecx, [esp+12]
push esi
shr ecx, 1
rep movsd
adc ecx, ecx
rep movsw
pop esi
add esi, [cur_width]
add esi, [cur_width]
dec dword [esp+16]
jnz .l
ret 16
restore_console_data:
cmp dword [esp+4], 0
jge @f
and dword [esp+4], 0
@@:
cmp dword [esp+8], 0
jge @f
and dword [esp+8], 0
@@:
mov eax, [esp+12]
cmp eax, [cur_width]
jbe @f
mov eax, [cur_width]
@@:
sub eax, [esp+4]
ja @f
ret 16
@@:
mov [esp+12], eax
mov eax, [esp+16]
cmp eax, [cur_height]
jbe @f
mov eax, [cur_height]
@@:
sub eax, [esp+8]
ja @f
ret 16
@@:
mov [esp+16], eax
mov eax, [esp+4]
mov edx, [esp+8]
call get_console_ptr
mov esi, ebp
.l:
mov ecx, [esp+12]
push edi
shr ecx, 1
rep movsd
adc ecx, ecx
rep movsw
pop edi
add edi, [cur_width]
add edi, [cur_width]
dec dword [esp+16]
jnz .l
ret 16
; int __stdcall menu(void* variants, const char* title, unsigned flags);
; variants 㪠§ë¢ ¥â ­  ⥪ã騩 í«¥¬¥­â ¢ ¤¢ãá¢ï§­®¬ «¨­¥©­®¬ ᯨ᪥
menu:
pop eax
push [cur_height]
push [cur_width]
push 0
push 0
push eax
; int __stdcall menu_centered_in(unsigned left, unsigned top, unsigned width, unsigned height,
; void* variants, const char* title, unsigned flags);
menu_centered_in:
pushad
mov eax, 56
; 36 bytes for dlgtemplate + additional:
; +36: dd cur_variant
; +40: dd num_variants
; +44: dd begin_variant
; +48: dd end_variant
; +52: dd cur_variant_idx
call mf_alloc
test eax, eax
jnz @f
.ret_bad:
popad
or eax, -1
ret 28
@@:
mov ebx, eax
mov eax, 1
test byte [esp+20h+28], 1
jz @f
mov al, 3
@@:
mov [ebx+dlgtemplate.border_size_x], eax
inc eax
shr eax, 1
mov [ebx+dlgtemplate.border_size_y], eax
; <EFBFBD> å®¤¨¬ è¨à¨­ã ¨ ¢ëá®âã ®ª­ 
xor eax, eax
xor ecx, ecx
mov esi, [esp+20h+20]
mov [ebx+36], esi
and dword [ebx+52], 0
@@:
cmp dword [esi+4], 0
jz .find_width
mov esi, [esi+4]
inc dword [ebx+52]
jmp @b
.find_width:
mov [ebx+44], esi
add esi, 8
push esi
xor edx, edx
.fw1:
cmp byte [esi], '&'
jnz @f
mov dl, 1
@@:
inc esi
cmp byte [esi-1], 0
jnz .fw1
sub esi, [esp]
sub esi, edx
dec esi
cmp eax, esi
ja @f
mov eax, esi
@@:
inc ecx
pop esi
mov esi, [esi-8]
test esi, esi
jnz .find_width
add eax, 3
add eax, [ebx+dlgtemplate.border_size_x]
add eax, [ebx+dlgtemplate.border_size_x]
cmp eax, [cur_width]
jb @f
mov eax, [cur_width]
@@:
sub eax, [ebx+dlgtemplate.border_size_x]
sub eax, [ebx+dlgtemplate.border_size_x]
mov [ebx+dlgtemplate.width], eax
mov [ebx+dlgtemplate.height], ecx
mov [ebx+40], ecx
sub eax, [esp+20h+12]
neg eax
sar eax, 1
add eax, [esp+20h+4]
cmp eax, [ebx+dlgtemplate.border_size_x]
jge @f
mov eax, [ebx+dlgtemplate.border_size_x]
@@:
push eax
add eax, [ebx+dlgtemplate.width]
add eax, [ebx+dlgtemplate.border_size_x]
cmp eax, [cur_width]
jbe @f
pop eax
mov eax, [cur_width]
sub eax, [ebx+dlgtemplate.width]
sub eax, [ebx+dlgtemplate.border_size_x]
push eax
@@:
pop [ebx+dlgtemplate.x]
sub ecx, [esp+20h+16]
neg ecx
sar ecx, 1
add ecx, [esp+20h+8]
cmp ecx, [ebx+dlgtemplate.border_size_y]
jge @f
mov ecx, [ebx+dlgtemplate.border_size_y]
@@:
push ecx
add ecx, [ebx+dlgtemplate.height]
add ecx, [ebx+dlgtemplate.border_size_y]
cmp ecx, [cur_height]
jbe @f
pop ecx
mov ecx, [cur_height]
sub ecx, [ebx+dlgtemplate.height]
sub ecx, [ebx+dlgtemplate.border_size_y]
push ecx
@@:
pop [ebx+dlgtemplate.y]
mov eax, [cur_height]
sub eax, 6
cmp [ebx+dlgtemplate.height], eax
jbe .small_height
mov [ebx+dlgtemplate.height], eax
mov [ebx+dlgtemplate.y], 3
.small_height:
mov ecx, [ebx+dlgtemplate.height]
mov eax, [ebx+36]
mov [ebx+44], eax
dec ecx
jz .skip
push ecx
@@:
cmp dword [eax+4], 0
jz @f
mov eax, [eax+4]
loop @b
@@:
mov [ebx+44], eax
pop ecx
.loop:
mov eax, [eax]
loop .loop
.skip:
mov [ebx+48], eax
mov eax, [esp+20h+24]
mov [ebx+dlgtemplate.title], eax
mov al, [menu_normal_color]
mov [ebx+dlgtemplate.main_color], al
mov al, [menu_border_color]
mov [ebx+dlgtemplate.border_color], al
mov al, [menu_header_color]
mov [ebx+dlgtemplate.header_color], al
push MenuDlgProc
push ebx
call DialogBox
mov [esp+28], eax
mov eax, ebx
call mf_free
popad
ret 28
MenuDlgProc:
mov eax, [esp+4]
cmp al, 1
jz .draw
cmp al, 2
jz .key
ret 12
.draw:
call .dodraw
ret 12
.key:
mov al, [esp+8]
cmp al, 0x48
jz .prev
cmp al, 0x4B
jz .prev
cmp al, 0x4D
jz .next
cmp al, 0x50
jz .next
cmp al, 0x1C
jz .enter
cmp al, 1
jz .esc
cmp al, 0x47
jz .home
cmp al, 0x4F
jz .end
cmp al, 0x51
jz .pgdn
cmp al, 0x49
jz .pgup
mov edx, [ebx+36]
@@:
cmp dword [edx+4], 0
jz @f
mov edx, [edx+4]
jmp @b
@@:
.l:
lea esi, [edx+7]
@@:
inc esi
cmp byte [esi], 0
jz .n
cmp byte [esi], '&'
jnz @b
movzx ecx, byte [esi+1]
cmp [ascii2scan+ecx], al
jnz .n
mov eax, edx
ret 12
.n:
mov edx, [edx]
test edx, edx
jnz .l
.ret:
xor eax, eax
ret 12
.pgup:
mov eax, [ebx+36]
mov ecx, [ebx+dlgtemplate.height]
.pgupl:
cmp dword [eax+4], 0
jz .posret
call .line_prev
loop .pgupl
jmp .posret
.prev:
mov eax, [ebx+36]
cmp dword [eax+4], 0
jz .end
call .line_prev
.posret:
mov [ebx+36], eax
.redraw:
call .dodraw
call draw_image
xor eax, eax
ret 12
.next:
mov eax, [ebx+36]
cmp dword [eax], 0
jz .home
call .line_next
jmp .posret
.pgdn:
mov eax, [ebx+36]
mov ecx, [ebx+dlgtemplate.height]
.pgdnl:
cmp dword [eax], 0
jz .posret
call .line_next
loop .pgdnl
jmp .posret
.home:
mov eax, [ebx+36]
@@:
cmp dword [eax+4], 0
jz @f
mov eax, [eax+4]
jmp @b
@@:
mov [ebx+44], eax
push eax
mov ecx, [ebx+dlgtemplate.height]
dec ecx
jz .h1
.h2:
mov eax, [eax]
loop .h2
.h1:
mov [ebx+48], eax
pop eax
and dword [ebx+52], 0
jmp .posret
.end:
mov eax, [ebx+36]
@@:
cmp dword [eax], 0
jz @f
mov eax, [eax]
jmp @b
@@:
mov [ebx+48], eax
push eax
mov ecx, [ebx+dlgtemplate.height]
dec ecx
jz .e1
.e2:
mov eax, [eax+4]
loop .e2
.e1:
mov [ebx+44], eax
mov eax, [ebx+40]
dec eax
mov [ebx+52], eax
pop eax
jmp .posret
.esc:
or eax, -1
ret 12
.enter:
mov eax, [ebx+36]
ret 12
.line_prev:
cmp eax, [ebx+44]
jnz @f
mov edx, [ebx+44]
mov edx, [edx+4]
mov [ebx+44], edx
mov edx, [ebx+48]
mov edx, [edx+4]
mov [ebx+48], edx
@@:
mov eax, [eax+4]
dec dword [ebx+52]
ret
.line_next:
cmp eax, [ebx+48]
jnz @f
mov edx, [ebx+44]
mov edx, [edx]
mov [ebx+44], edx
mov edx, [ebx+48]
mov edx, [edx]
mov [ebx+48], edx
@@:
mov eax, [eax]
inc dword [ebx+52]
ret
.dodraw:
mov eax, [ebx+dlgtemplate.x]
mov edx, [ebx+dlgtemplate.y]
call get_console_ptr
mov esi, [ebx+44]
.0:
xor edx, edx
mov ah, [menu_selected_color]
cmp esi, [ebx+36]
jz @f
mov ah, [menu_normal_color]
@@:
push edi
mov ecx, [ebx+dlgtemplate.width]
mov al, ' '
stosw
dec ecx
stosw
dec ecx
dec ecx
push esi
add esi, 8
@@:
lodsb
test al, al
jz @f
cmp al, '&'
jnz .noamp
test dl, dl
jnz .noamp
mov dl, 1
lodsb
push eax
mov ah, [menu_selected_highlight_color]
push ecx
mov ecx, [esp+8]
cmp ecx, [ebx+36]
pop ecx
jz .amp1
mov ah, [menu_highlight_color]
.amp1:
stosw
pop eax
jmp .amp2
.noamp:
stosw
.amp2:
loop @b
mov al, ' '
cmp byte [esi], 0
jnz .1
lodsb
jmp .1
@@:
mov al, ' '
.1:
stosw
mov al, ' '
rep stosw
pop esi edi
add edi, [cur_width]
add edi, [cur_width]
cmp esi, [ebx+48]
jz @f
mov esi, [esi]
test esi, esi
jnz .0
@@:
; ‹¨­¥©ª  ¯à®ªàã⪨
mov ecx, [ebx+dlgtemplate.height]
cmp ecx, [ebx+40]
jz .noscrollbar
sub ecx, 2
jbe .noscrollbar
mov eax, [ebx+52]
mul ecx
div dword [ebx+40]
push eax
mov eax, [ebx+dlgtemplate.x]
add eax, [ebx+dlgtemplate.width]
mov edx, [ebx+dlgtemplate.y]
call get_console_ptr
pop edx
inc edx
mov al, 0x1E
mov ah, [menu_scrollbar_color]
mov [edi], ax
add edi, [cur_width]
add edi, [cur_width]
.2:
mov al, 0xB2
dec edx
jz @f
mov al, 0xB0
@@:
mov [edi], ax
add edi, [cur_width]
add edi, [cur_width]
loop .2
mov al, 0x1F
stosw
.noscrollbar:
ret

View File

@ -0,0 +1,48 @@
fontname equ 'font8x16.bmp'
virtual at 0
file fontname, 3Eh
; sanity check
load a1 word from 0
load a2 dword from 0xE
if (a1 <> 'BM') | (a2 <> 0x28)
error 'not BMP file!'
end if
load a1 dword from 0x12
load a2 dword from 0x16
if (a1 and 0xF) | (a2 and 0xF) | (a1 > 16*16)
error 'font: invalid width or height'
end if
font_width = a1 shr 4
font_bmp_scanline = (font_width*2 + 3) and not 3
font_height = a2 shr 4
load a1 dword from 0x1A
if a1 <> 0x10001
error 'font: not monochrome bitmap'
end if
end virtual
font:
repeat font_height
cur_scan = %
repeat 256
virtual at 0
a2 = (font_width+14) shr 3
if cur_scan=1 & %=0x10
a2 = (font_width+7) shr 3
end if
file fontname:3Eh + font_bmp_scanline*(font_height*(16-((%-1) shr 4))-cur_scan) + ((((%-1) and 0xF)*font_width) shr 3), a2
dd 0
load a1 dword from 0
a1 = ((a1 and 0x55555555) shl 1) or ((a1 and 0xAAAAAAAA) shr 1)
a1 = ((a1 and 0x33333333) shl 2) or ((a1 and 0xCCCCCCCC) shr 2)
a1 = ((a1 and 0x0F0F0F0F) shl 4) or ((a1 and 0xF0F0F0F0) shr 4)
end virtual
a1 = (a1 shr (((%-1)*font_width) and 7)) and ((1 shl font_width) - 1)
a1 = a1 xor ((1 shl font_width) - 1)
if font_width > 8
dw a1
else
db a1
end if
end repeat
end repeat

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
;------------------------------------------------------------------
; use "iglobal" for inserting initialized global data definitions.
;------------------------------------------------------------------
macro iglobal {
IGlobals equ IGlobals,
macro __IGlobalBlock { }
;-------------------------------------------------------------
; use 'uglobal' for inserting uninitialized global definitions.
; even when you define some data values, these variables
; will be stored as uninitialized data.
;-------------------------------------------------------------
macro uglobal {
UGlobals equ UGlobals,
macro __UGlobalBlock { }
endg fix } ; Use endg for ending iglobal and uglobal blocks.
macro IncludeIGlobals{
macro IGlobals dummy,[n] \{ __IGlobalBlock
purge __IGlobalBlock \}
match I, IGlobals \{ I \} }
macro IncludeUGlobals{
macro UGlobals dummy,[n] \{
\common
\local begin, size
begin = $
virtual at $
\forward
__UGlobalBlock
purge __UGlobalBlock
\common
size = $ - begin
end virtual
rb size
\}
match U, UGlobals \{ U \} }
macro IncludeAllGlobals {
IncludeIGlobals
IncludeUGlobals
}
iglobal
endg
uglobal
endg

View File

@ -0,0 +1,517 @@
if ~ used memalloc_inc
memalloc_inc_fix:
memalloc_inc fix memalloc_inc_fix
;kglobals.inc required.
;multithread: ;uncomment this for thread-safe version
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Memory allocator for MenuetOS ;;
;; Halyavin Andrey halyavin@land.ru, 2006 ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; allocated mem block structure ;;
;; +0: bit 0 - used flag ;;
;; bits 31..1 - block size ;;
;; +4: address of prev block ;;
;; +8 .. +(blocksize) - allocated memory ;;
;; +(blocksize) - next block ;;
;; ;;
;; free mem block structure ;;
;; +0: bit 0 - used flag ;;
;; bits 31..1 - block size ;;
;; +4: address of prev block ;;
;; +8: prev free block ;;
;; +12: next free block ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
memblock.size=0
memblock.prevblock=4
memblock.prevfreeblock=8
memblock.nextfreeblock=12
uglobal
heapsmallblocks rd 1
heapstart rd 1
heapend rd 1
heapfreelist rd 1
heapmutex rd 1
heaplastblock rd 1
endg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mf_init ;;
;; Initialize memory map for dynamic use ;;
;; input: eax: starting address or 0 ;;
;; output: none ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mf_init:
push ebx
push ecx
test eax,eax
jnz .noautodet
sub esp,1024
mov ebx,esp
mov ecx,-1
mov eax,9
int 0x40
mov eax,[esp+26]
add esp,1024
.noautodet:
add eax,15
and eax,not 15
mov [heapsmallblocks],eax
add eax,2048
mov [heapstart],eax
mov [heapfreelist],eax
mov [heaplastblock],eax
mov ecx,eax
if defined heapstartsize
add ecx,heapstartsize
else
add ecx,4096
end if
add ecx,4095
and ecx,not 4095
push eax
mov eax,64
mov ebx,1
int 0x40
pop eax
mov [eax+memblock.prevblock],dword 0
mov [heapend],ecx
mov [eax+memblock.size],ecx
sub [eax+memblock.size],eax
xor ebx,ebx
mov dword [eax+memblock.prevfreeblock],heapfreelist-memblock.nextfreeblock
mov [eax+memblock.nextfreeblock],ebx
mov [heapmutex],ebx
push edi
mov edi,[heapsmallblocks]
mov ecx,512
xor eax,eax
rep stosd
pop edi
pop ecx
pop ebx
ret
if defined multithread
heaplock:
push eax
push ebx
mov eax,68
mov ebx,1
.loop:
xchg eax,[heapmutex]
test eax,eax
jz .endloop
int 0x40 ;change task
jmp .loop
.endloop:
pop ebx
pop eax
ret
heapunlock:
mov [heapmutex],dword 0
ret
end if
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; heap_split_block ;;
;; Split free block to allocated block and free one. ;;
;; input: ;;
;; eax - size of allocated block ;;
;; ebx - block ;;
;; output: ;;
;; eax - real size of allocated block ;;
;; ebx - pointer to new block ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
heap_split_block:
push ecx
mov ecx,[ebx+memblock.size]
sub ecx,16
cmp ecx,eax
jge .norm
inc dword [ebx+memblock.size]
mov eax,ecx
xor ebx,ebx
pop ecx
ret
.norm:
add ecx,16
mov [ebx+memblock.size],eax
inc dword [ebx+memblock.size]
mov [ebx+eax+memblock.prevblock],ebx
add ebx,eax
sub ecx,eax
mov [ebx+memblock.size],ecx
mov ecx,eax
mov eax,ebx
call heap_fix_right
mov eax,ecx
pop ecx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; heap_add_free_block ;;
;; Add free block to one of free block lists. ;;
;; input: ;;
;; eax - address of free block ;;
;; output: ;;
;; none ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
heap_add_free_block:
cmp dword [eax+memblock.size],4096
push ebx
jge .bigblock
mov ebx,[eax+memblock.size]
shr ebx,1
add ebx,[heapsmallblocks]
push dword [ebx]
pop dword [eax+memblock.nextfreeblock]
mov [ebx],eax
mov dword [eax+memblock.prevfreeblock],ebx
sub dword [eax+memblock.prevfreeblock],memblock.nextfreeblock
mov ebx,[eax+memblock.nextfreeblock]
test ebx,ebx
jz .no_next_block
mov [ebx+memblock.prevfreeblock],eax
.no_next_block:
pop ebx
ret
.bigblock:
mov ebx,[heapfreelist]
mov [eax+memblock.nextfreeblock],ebx
mov [heapfreelist],eax
mov dword [eax+memblock.prevfreeblock],heapfreelist-memblock.nextfreeblock
; mov ebx,[eax+memblock.nextfreeblock]
test ebx,ebx
jz .no_next_big_block
mov [ebx+memblock.prevfreeblock],eax
.no_next_big_block:
pop ebx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; heap_remove_block ;;
;; Remove free block from the list of free blocks. ;;
;; input: ;;
;; eax - free block ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
heap_remove_block:
push ebx
push ecx
mov ecx,[eax+memblock.prevfreeblock]
mov ebx,[eax+memblock.nextfreeblock]
mov [ecx+memblock.nextfreeblock],ebx
test ebx,ebx
jz .no_next_block
mov [ebx+memblock.prevfreeblock],ecx
.no_next_block:
pop ecx
pop ebx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mf_alloc
;; allocates a block of memory in heap
;; intput: eax: size of block
;; output: eax: address of allocated memory block or 0 if there's no mem.
;; allocator will not create new nodes that contain less that 8b of space,
;; and minimal allocation is actually 16 bytes - 8 for node and 8 for user.
;; allocator will never create non-aligned memory blocks.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mf_alloc:
test eax,eax
jg .not_null ; test that we are not allocating null size block
xor eax,eax
ret
.not_null:
if defined multithread
call heaplock
end if
push edi
; push edx
push ecx
push ebx
add eax,7
and eax,not 7 ; make sure that block size is aligned
lea edi,[eax+8] ; desired block size
cmp edi,4096
jge .general_cycle
mov ebx,[heapsmallblocks]
xor ecx,ecx
shr edi,1
.smallloop:
cmp [ebx+edi],ecx
jnz .smallblockfound
add edi,4
cmp edi,2048
jl .smallloop
lea edi,[eax+8]
jmp .general_cycle
.smallblockfound:
lea ecx,[eax+8]
mov eax,[ebx+edi]
call heap_remove_block
mov ebx,eax
xchg eax,ecx
call heap_split_block
test ebx,ebx
jz .perfect_small_block
mov eax,ebx
call heap_add_free_block
.perfect_small_block:
lea eax,[ecx+8]
jmp .ret
.general_cycle:
;edi - size needed
mov eax,[heapfreelist]
.loop:
test eax,eax
jz .new_mem
cmp [eax+memblock.size],edi
jge .blockfound
mov eax,[eax+memblock.nextfreeblock]
jmp .loop
.blockfound:
call heap_remove_block
mov ebx,eax
mov ecx,eax
mov eax,edi
call heap_split_block
test ebx,ebx
jz .perfect_block
mov eax,ebx
call heap_add_free_block
.perfect_block:
lea eax,[ecx+8]
.ret:
if defined multithread
call heapunlock
end if
pop ebx
pop ecx
; pop edx
pop edi
ret
.new_mem:
mov eax,edi
add eax,4095
and eax,not 4095
mov ecx,[heapend]
add [heapend],eax
push eax
mov eax,64
push ebx
push ecx
mov ecx,[heapend]
mov ebx,1
int 0x40
pop ecx
pop ebx
pop eax
mov [ecx+memblock.size],eax
mov eax,[heaplastblock]
mov [ecx+memblock.prevblock],eax
mov [heaplastblock],ecx
mov eax,ecx
call heap_add_free_block
jmp .general_cycle
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; heap_fix_right ;;
;; input: ;;
;; eax - pointer to free block ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
heap_fix_right:
push ebx
mov ebx,eax
add ebx,[eax+memblock.size]
cmp ebx,[heapend]
jz .endblock
mov [ebx+memblock.prevblock],eax
pop ebx
ret
.endblock:
mov [heaplastblock],eax
pop ebx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; heap_merge_left ;;
;; input: ;;
;; eax - pointer to free block ;;
;; output: ;;
;; eax - pointer to merged block ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
heap_merge_left:
push ebx
mov ebx,[eax+memblock.prevblock]
test ebx,ebx
jz .ret
test byte [ebx+memblock.size],1
jnz .ret
xchg eax,ebx
call heap_remove_block
mov ebx,[ebx+memblock.size]
add [eax+memblock.size],ebx
call heap_fix_right
.ret:
pop ebx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; heap_merge_right ;;
;; input: ;;
;; eax - pointer to free block ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
heap_merge_right:
push ebx
mov ebx,eax
add ebx,[eax+memblock.size]
cmp ebx,[heapend]
jz .ret
test byte [ebx+memblock.size],1
jnz .ret
xchg eax,ebx
call heap_remove_block
xchg eax,ebx
mov ebx,[ebx+memblock.size]
add [eax+memblock.size],ebx
call heap_fix_right
.ret:
pop ebx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mf_free ;;
;; input: ;;
;; eax - pointer ;;
;; output: ;;
;; eax=1 - ok ;;
;; eax=0 - failed ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mf_free:
test eax,eax
jnz .no_null
inc eax
ret
.no_null:
if defined multithread
call heaplock
end if
sub eax,8
dec dword [eax+memblock.size]
call heap_merge_left
call heap_merge_right
call heap_add_free_block
.ret:
if defined multithread
call heapunlock
end if
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; heap_try_reloc
;; input:
;; eax - address
;; ebx - new size
;; output:
;; ebx=1 - ok
;; ebx=0 - failed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
heap_try_reloc:
push eax
sub eax,8
add ebx,15
dec dword [eax+memblock.size]
and ebx,not 7
cmp [eax+memblock.size],ebx
jge .truncate
push ebx
mov ebx,eax
add ebx,[eax+memblock.size]
cmp ebx,[heapend]
jz .fail ;todo: we can allocate new mem here
test [ebx+memblock.size],byte 1
jnz .fail
xchg eax,ebx
call heap_remove_block
mov eax,[eax+memblock.size]
add [ebx+memblock.size],eax
mov eax,ebx
call heap_fix_right
pop ebx
.truncate:
xchg eax,ebx
call heap_split_block
test ebx,ebx
jz .no_last_block
mov eax,ebx
call heap_add_free_block
call heap_merge_right
.no_last_block:
xor ebx,ebx
pop eax
inc ebx
ret
.fail:
pop ebx
xor ebx,ebx
pop eax
inc dword [eax-8+memblock.size]
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mf_realloc
;; input:
;; eax - pointer
;; ebx - new size
;; output:
;; eax - new pointer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mf_realloc:
push ebx
if defined multithread
call heaplock
end if
call heap_try_reloc
test ebx,ebx
jnz .ret
;allocate new memory
push eax
mov eax,[esp+4]
call mf_alloc
test eax,eax
jz .fail
push esi
push edi
push ecx
mov edi,eax
mov esi,[esp+12]
mov ecx,[esi-8+memblock.size]
shr ecx,2
rep movsd
pop ecx
pop edi
pop esi
xchg eax,[esp]
call mf_free
.fail:
pop eax
.ret:
if defined multithread
call heapunlock
end if
pop ebx
ret
end if

View File

@ -0,0 +1,67 @@
; ‘®àâ¨à®¢ª  dword'®¢ ¢ ª®«¨ç¥á⢥ ecx ¯®  ¤à¥áã edx, äã­ªæ¨ï áà ¢­¥­¨ï ¢ ebx
; <EFBFBD> §àãè ¥â eax, ecx, esi, edi
sort:
jecxz .done
mov eax, ecx
@@:
push eax
call .restore
pop eax
dec eax
jnz @b
@@:
cmp ecx, 1
jz .done
mov esi, 1
mov edi, ecx
call .exchange
dec ecx
mov eax, 1
call .restore
jmp @b
.done:
ret
.exchange:
push eax ecx
mov eax, [edx+esi*4-4]
mov ecx, [edx+edi*4-4]
mov [edx+esi*4-4], ecx
mov [edx+edi*4-4], eax
pop ecx eax
ret
.restore:
lea esi, [eax+eax]
cmp esi, ecx
ja .doner
push esi
mov esi, [edx+esi*4-4]
mov edi, [edx+eax*4-4]
call ebx
pop esi
ja .need_xchg
cmp esi, ecx
jae .doner
push esi
mov esi, [edx+esi*4]
mov edi, [edx+eax*4-4]
call ebx
pop esi
jbe .doner
.need_xchg:
cmp esi, ecx
jz .do_xchg
push esi
mov edi, [edx+esi*4-4]
mov esi, [edx+esi*4]
call ebx
pop esi
sbb esi, -1
.do_xchg:
mov edi, eax
call .exchange
mov eax, esi
jmp .restore
.doner:
ret

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm chess.asm chess
@erase lang.inc
@pause

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm chess.asm chess
@erase lang.inc
@pause

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tetris.asm tetris
@erase lang.inc
@pause

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tetris.asm tetris
@erase lang.inc
@pause

View File

@ -123,8 +123,10 @@ macro mpack dest, hsrc, lsrc
end if
}
macro __mov reg,a { ; mike.dld
if ~a eq
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
@ -144,7 +146,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>

View File

@ -42,7 +42,7 @@ UP_KEY equ 130+48
DOWN_KEY equ 129+48
LEFT_KEY equ 128+48
RIGHT_KEY equ 131+48
BACKGROUND equ 03000080h
;BACKGROUND equ 03000080h
_MAXBLOCKS_ = 7*4
@ -220,7 +220,7 @@ button: ; button
jmp still
end_program:
mov eax,0xffffffff ; close this program
mov eax,-1 ; close this program
int 0x40
go_new_game:
@ -241,64 +241,51 @@ jmp still
draw_window:
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
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
xor eax,eax ; function 0 : define and draw window
mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2
mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30
mov edx,BACKGROUND ; color of work area RRGGBB
mov esi,0x006688ee;99bbff ; color of grab bar RRGGBB,8->col
mov edi,0x007799ff;99bbee ; color of frames RRGGBB
mov edx,[sc.work] ; color of work area RRGGBB
or edx,0x13000000
mov edi,header ; WINDOW LABEL
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x10ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
; CLOSE BUTTON
; mov eax,8 ; function 8 : define and draw button
; mov ebx,243*65536+12 ; [x start] *65536 + [x size]
; mov ecx,5*65536+12 ; [y start] *65536 + [y size]
; mov edx,1 ; button id
; mov esi,0x5580cc;22aacc ; button color RRGGBB
; int 0x40
mov eax,8
mov ebx,30*65536+102
mov ebx,30*65536+100
mov ecx,378*65536+18
mov edx,2
mov esi,0xA24466;5580cc;22aacc
mov esi,[sc.work_button]
int 0x40
;/////////////////////////////////////////////// Wildwest's 'Pause' button
mov eax,8
;mov eax,8
mov ebx,132*65536+102
mov ecx,378*65536+18
mov edx,3
mov esi,0x0FA0F0;
mov esi,[sc.work_button];
int 0x40
mov eax,4 ; function 4 : write text to window
mov ebx,164*65536+384 ; [x start] *65536 + [y start]
mov ecx,0x10ffffff ; color of text RRGGBB
mov edx,labe ; pointer to text beginning
mov esi,labelen-labe ; text length
mov ebx,164*65536+384 ; [x start] *65536 + [y start]
mov ecx,[sc.work_button_text] ; color of text RRGGBB
or ecx,0x90000000
mov edx,labe ; pointer to text
int 0x40
;///////////////////////////////////////////////
mov eax,4
;mov eax,4
mov ebx,49*65536+384
xor ecx,ecx
mov ecx,0x10ffffff
mov edx,game_finished
mov esi,size_of_game_finished-game_finished
int 0x40
call draw_table
movzx edx,byte [current_block_color]
@ -306,9 +293,9 @@ draw_window:
cld
mov ebx,38*65536+35 ; draw info text with function 4
mov ecx,0x10ffffff ; color
mov ecx,[sc.work_text] ; color
or ecx,0x90000000
mov edx,text
mov esi,7
mov eax,4
int 0x40
@ -454,7 +441,7 @@ x_draw: push edi
; mov ebx,10
; int 0x40
; popa
mov ax,13
mov eax,13
movzx edx,byte [esi]
mov edx,[color_table+edx*4]
int 0x40
@ -655,16 +642,12 @@ write_score:
mov eax,[score]
call number_to_str
mov ebx,100*65536+100 ;clear box to write new score
mov ecx,35*65536+15
mov edx,BACKGROUND
mov eax,13
int 40h
mov ebx,100*65536+35 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov ebx,90*65536+35 ; draw info text with function 4
mov ecx,[sc.work_text] ; color
or ecx,0x50000000
mov edx,number_str
mov esi,[size_of_number_str]
mov edi,[sc.work]
mov eax,4
int 0x40
ret
@ -842,27 +825,17 @@ block_table:
if lang eq ru
labelt:
db '<E280A6>ˆ 1.6 - <E28098>Šˆ ˆ <20><>Ž<EFBFBD>'
labellen:
labe:
db '<27>€“‡€'
labelen:
text: db 'Žçª¨: '
game_finished: db ' <20>€—€œ'
size_of_game_finished:
header db '<E280A6>ˆ 1.61 - <E28098>Šˆ ˆ <20><>Ž<EFBFBD>',0
labe db '<27>€“‡€',0
text db 'Žçª¨:',0
game_finished: db '<27>Ž€Ÿ',0
else
labelt:
db 'TETRIS 1.6 - ARROWS & SPACE'
labellen:
labe:
db 'PAUSE'
labelen:
text: db 'Score: '
game_finished: db 'NEW GAME'
size_of_game_finished:
header db 'TETRIS 1.61 - ARROWS & SPACE',0
labe db 'PAUSE',0
text db 'Score:',0
game_finished: db 'NEW GAME',0
end if
@ -880,6 +853,8 @@ number_str: db 0,0,0,0,0,0,0,0,0
end_number_str:
size_of_number_str dd 9
delay: db 40
sc system_colors
table_tetris:
I_END:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,715 @@
;**************************************************************************
;**********************DECODING BMP FILE(1,4,8,24 bits)*********************
;***************************************************************************
; BMPTOIMG -Convert BMP format TO IMG format
;***************************************************************************
bmptoimg:
mov [bmp_load_area],esi
mov [img_dest_area],edi
xor eax,eax
mov ax,word[esi+28]
mov ebx,[esi+14]
mov ecx,[esi+18]
mov edx,[esi+22]
mov [bmp_bits_per_pixel],ax
mov [bmp_first_structure_size],ebx
mov [Bmp_SizeY],edx
mov [Bmp_SizeX],ecx
xor eax,eax
mov ax,[esi+28]
mul dword [esi+18]
add eax,31
shr eax,5
mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string
cmp dword [esi+34],0
jne yespicsize ;if picture size is defined
mul dword [esi+22]
mov dword [esi+34],eax
yespicsize:
mov eax,[bmp_load_area]
add eax, [esi+10] ;how mach bytes to begin bitmap
add eax, [esi+34] ;size of bitmap in BMP file
mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file
;calculate bytes per string
mov eax, [esi+18]
lea eax,[eax+2*eax] ;3x pixels in eax
mov [bmp_bytes_per_string],eax
mov esi,dword [bmptoimg_data_area_eop]
sub esi,dword [bmptoimg_data_area_bps]
mov ebp,[img_dest_area]
mov edi,[img_dest_area]
mov ebx,[bmp_load_area]
add ebx, [bmp_first_structure_size]
add ebx,14 ;in ebx start of color table
cmp [bmp_bits_per_pixel],24
je convert_to_24bpp
cmp [bmp_bits_per_pixel],8
je convert_to_8bpp
cmp [bmp_bits_per_pixel],4
je convert_to_4bpp
cmp [bmp_bits_per_pixel],1
je convert_to_1bpp
jmp end_bmp
;--------------------------------------------------
;-----------Decoding 24 bit BMP file---------------
;--------------------------------------------------
convert_to_24bpp:
mov ebx,[Bmp_SizeY]
loop_convert_to_24bpp_y:
mov edi,ebp
mov ecx,[bmptoimg_data_area_dwps]
loop_convert_to_24bpp_x:
mov edx,[esi]
mov [edi],edx
add esi,4
add edi,4
dec ecx
jnz loop_convert_to_24bpp_x
sub esi,[bmptoimg_data_area_bps]
sub esi,[bmptoimg_data_area_bps]
add ebp,eax
dec ebx
jnz loop_convert_to_24bpp_y
jmp end_bmp
;-----------------------------------------------------
;--------------Decoding 8 bits BMP file---------------
;-----------------------------------------------------
convert_to_8bpp:
mov ebp,[Bmp_SizeY]
loop_convert_8bpp_y:
mov ecx,[bmptoimg_data_area_bps]
push edi
loop_convert_8bpp_x:
xor eax,eax
mov al,byte [esi]
call converttable
inc esi
add edi,3
dec ecx
jnz loop_convert_8bpp_x
pop edi
add edi,[bmp_bytes_per_string]
sub esi,[bmptoimg_data_area_bps]
sub esi,[bmptoimg_data_area_bps]
dec ebp
jnz loop_convert_8bpp_y
jmp end_bmp
;-----------------------------------------------------
;--------------Decoding 4 bits BMP file---------------
;-----------------------------------------------------
convert_to_4bpp:
mov ebp,[Bmp_SizeY]
loop_convert_4bpp_y:
mov ecx,[bmptoimg_data_area_bps]
push edi
loop_convert_4bpp_x:
mov [Bmp_save1],ecx
xor eax,eax
mov al,byte [esi]
xor ecx,ecx
mov cl,al
shr al,4 ;first pixel in byte
and cl,0xf ;second pixel in byte
call converttable ;draw first pixel of byte
mov eax,ecx ;move second pixel to register al and draw
add edi,3
call converttable ;draw second pixel of byte
add edi,3
mov ecx,[Bmp_save1]
inc esi
dec ecx
jnz loop_convert_4bpp_x
pop edi
add edi,[bmp_bytes_per_string]
sub esi,[bmptoimg_data_area_bps]
sub esi,[bmptoimg_data_area_bps]
dec ebp
jnz loop_convert_4bpp_y
jmp end_bmp
;-----------------------------------------------------
;---------------Decoding 1 bit BMP file---------------
;-----------------------------------------------------
convert_to_1bpp:
mov ebp,[Bmp_SizeY]
loop_convert_1bpp_y:
mov ecx,[bmptoimg_data_area_bps]
push edi
loop_convert_1bpp_x:
xor eax,eax
mov al,byte [esi]
mov [Bmp_save1],ecx
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
add edi,3
dec edx
jns nextbit
mov ecx,[Bmp_save1]
inc esi
dec ecx
jnz loop_convert_1bpp_x
pop edi
add edi,[bmp_bytes_per_string]
sub esi,[bmptoimg_data_area_bps]
sub esi,[bmptoimg_data_area_bps]
dec ebp
jnz loop_convert_1bpp_y
jmp end_bmp
;-----------------------------------------------------
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
mov [edi],edx
ret
;-----------------------------------------------------
; DATA AREA
bmptoimg_data_area_bps dd 0
bmptoimg_data_area_dwps dd 0
bmptoimg_data_area_eop dd 0
bmp_load_area dd 0
img_dest_area dd 0
bmp_bits_per_pixel dw 0
bmp_first_structure_size dd 0
bmp_bytes_per_string dd 0
end_bmp:
ret
;***************************************************************************
;*******************CODING BMP FILE(1,4,8,24 bits)**************************
;***************************************************************************
;-------------------------autor andrew_programmer---------------------------
coding_bmp:
mov [PointerToImage],ebx
mov [WhereCodingBMP],ecx
mov [BmpPalette],edx
mov [Bmp_SizeX],esi
mov [Bmp_SizeY],edi
;**********************************************
;******************1 bit BMP*******************
;**********************************************
cmp eax,2
ja no_monohrom_colors
mov esi,[BmpPalette]
mov edi,[WhereCodingBMP]
add edi,54
mov eax,[esi] ;first color
mov ebx,[esi+4] ;second color
mov [edi],eax
mov [edi+4],ebx
;coding image to bmp 1 bit format
mov esi,[PointerToImage]
mov edx,[WhereCodingBMP]
mov ebx,[Bmp_SizeX]
add ebx,31 ;picture_size_x+31
shr ebx,5 ;((picture_size_x)+31)/32
mov [Bmp_doublewords],ebx ;double words in string
shl ebx,2
mov [Bmp_bytes_per_string],ebx ;bytes per string
mov ecx,[Bmp_SizeY]
dec ecx
imul ebx,ecx
add edx,54+8
add edx,ebx ;in edx pointer to area for coding
mov ebp,[Bmp_bytes_per_string]
mov ebx,[Bmp_SizeY]
mov esi,[PointerToImage]
mov edi,edx
mov edx,[Bmp_SizeX]
lea edx,[edx+edx*2]
mov [Bmp_Counter],7
and [Bmp_Counter2],0
copy_lines_1:
push esi
mov ecx,[Bmp_bytes_per_string]
shl ecx,3 ;(Bmp_bytes_per_string)*8
rep_movsb_1:
mov eax,[esi]
and eax,0xffffff
push esi
push ecx
push ebx
mov esi,[BmpPalette]
xor ecx,ecx
find_color_in_palette_1:
mov ebx,[esi]
and ebx,0xffffff
cmp eax,ebx ;color fined ?
je color_fined_1
add esi,4
inc ecx
cmp ecx,256
jl find_color_in_palette_1
color_fined_1:
mov [Bmp_Counter3],ecx ;number color in palette
pop ebx
pop ecx
pop esi
mov eax,[Bmp_Counter3]
test eax,eax
jz no_change_bit_in_byte
push ecx
mov ecx,[Bmp_Counter]
bts [Bmp_Counter2],ecx
pop ecx
no_change_bit_in_byte:
dec [Bmp_Counter]
jns no_minus_in_counter
push eax
mov eax,[Bmp_Counter2]
mov [edi],al
inc edi
mov [Bmp_Counter],7
and [Bmp_Counter2],0 ;obnulyaem byte
pop eax
no_minus_in_counter:
add esi,3
dec ecx
jnz rep_movsb_1
pop esi
add esi,edx
sub edi,ebp
sub edi,ebp
dec ebx
jnz copy_lines_1
mov edi,[WhereCodingBMP]
mov ebx,[Bmp_bytes_per_string]
imul ebx,[Bmp_SizeY]
add ebx,(54+8)
;crate list of bmp description
mov [edi],word 'BM'
mov [edi+2],ebx
mov [edi+10],dword 54+8 ;where bigin bmp imige
mov [edi+14],dword 40
mov edx,[Bmp_SizeX]
mov ecx,[Bmp_SizeY]
mov [edi+18],edx ;picture size x
mov [edi+22],ecx ;picture size y
mov [edi+26],word 1
mov [edi+28],word 1 ;bits per pixel
mov [edi+30],dword 0
mov edx,[Bmp_bytes_per_string]
imul edx,ecx
mov [edi+34],edx
mov [edi+38],dword 0
mov [edi+42],dword 0
mov [edi+46],dword 0
ret
no_monohrom_colors:
;**********************************************
;*****************4 bits BMP*******************
;**********************************************
cmp eax,16
ja no_16_colors
;copy 16 colors palette
mov esi,[BmpPalette]
mov edi,[WhereCodingBMP]
add edi,54
mov ecx,16
rep movsd
;coding image to bmp 4 bits format
mov esi,[PointerToImage]
mov edx,[WhereCodingBMP]
mov ebx,[Bmp_SizeX]
shl ebx,2 ;4*(picture_size_x)
add ebx,31 ;4*(picture_size_x)+31
shr ebx,5 ;(4*(picture_size_x)+31)/32
mov [Bmp_doublewords],ebx ;double words in string
shl ebx,2
mov [Bmp_bytes_per_string],ebx ;bytes per string
mov ecx,[Bmp_SizeY]
dec ecx
imul ebx,ecx
add edx,54+64
add edx,ebx
mov ebp,[Bmp_bytes_per_string]
mov ebx,[Bmp_SizeY]
mov [Bmp_Counter2],ebx
mov edi,edx
xor ebx,ebx
copy_lines_4:
mov ecx,[Bmp_bytes_per_string]
shl ecx,1
and [Bmp_Counter3],0
push esi
rep_movsb_4:
mov eax,[esi]
and eax,0xffffff
mov [Bmp_save1],esi
mov [Bmp_save2],ecx
mov [Bmp_save3],ebx
mov esi,[BmpPalette]
xor ecx,ecx
find_color_in_palette_:
mov ebx,[esi]
and ebx,0xffffff
cmp eax,ebx ;color fined ?
je color_fined_
add esi,4
inc ecx
cmp ecx,16
jl find_color_in_palette_
color_fined_:
mov [Bmp_Counter],ecx ;number color in palette
mov esi,[Bmp_save1]
mov ecx,[Bmp_save2]
mov ebx,[Bmp_save3]
xor eax,eax
mov eax,[Bmp_Counter]
shl bl,4
add bl,al
mov eax,[Bmp_Counter3]
and eax,1b
test eax,eax ;next block ready ?
jz no_ready
mov [edi],bl ;4 bit color
inc edi
no_ready:
add esi,3
inc [Bmp_Counter3]
dec ecx
jnz rep_movsb_4
pop esi
add esi,[Bmp_SizeX]
add esi,[Bmp_SizeX]
add esi,[Bmp_SizeX]
sub edi,ebp
sub edi,ebp
dec [Bmp_Counter2]
jnz copy_lines_4
;total size of bmp file
mov edi,[WhereCodingBMP]
mov ebx,[Bmp_bytes_per_string]
imul ebx,[Bmp_SizeY]
add ebx,(54+64)
;crate list of bmp description
mov [edi],word 'BM'
mov [edi+2],ebx
mov [edi+10],dword 54+64
mov [edi+14],dword 40
mov edx,[Bmp_SizeX]
mov ecx,[Bmp_SizeY]
mov [edi+18],edx
mov [edi+22],ecx
mov [edi+26],word 1
mov [edi+28],word 4
mov [edi+30],dword 0
mov edx,[Bmp_bytes_per_string]
imul edx,ecx
mov [edi+34],edx
mov [edi+38],dword 0
mov [edi+42],dword 0
mov [edi+46],dword 0
ret
no_16_colors:
;**********************************************
;******************8 bits BMP******************
;**********************************************
cmp eax,256
ja no_8_bits_per_pixel
;copy palette
mov esi,[BmpPalette]
mov edi,[WhereCodingBMP]
add edi,54
mov ecx,256
rep movsd
;coding image to bmp 8 bits format
mov esi,[PointerToImage]
mov edx,[WhereCodingBMP]
mov ebx,[Bmp_SizeX]
shl ebx,3 ;8*(picture_size_x)
add ebx,31 ;8*(picture_size_x)+31
shr ebx,5 ;(8*(picture_size_x)+31)/32
mov [Bmp_doublewords],ebx ;double words in string
shl ebx,2
mov [Bmp_bytes_per_string],ebx ;bytes per string
mov ecx,[Bmp_SizeY]
dec ecx
imul ebx,ecx
add edx,(1024+54)
add edx,ebx ;in edx pointer to copy bitmap arrea
mov ebp,[Bmp_bytes_per_string]
shl ebp,1
mov ebx,[Bmp_SizeY]
mov edi,edx
copy_lines_8:
mov ecx,[Bmp_bytes_per_string]
mov [Bmp_save1],esi
rep_movsb_8:
mov eax,[esi]
and eax,0xffffff
push esi
push ecx
push ebx
mov esi,[BmpPalette]
xor ecx,ecx
find_color_in_palette:
mov ebx,[esi]
and ebx,0xffffff
cmp eax,ebx ;color fined ?
je color_fined
add esi,4
inc ecx
cmp ecx,256
jl find_color_in_palette
color_fined:
mov [Bmp_Counter],ecx ;number color in palette
pop ebx
pop ecx
pop esi
mov eax,[Bmp_Counter]
mov [edi],al ;8 bit color
add esi,3
inc edi
dec ecx
jnz rep_movsb_8
mov esi,[Bmp_save1]
add esi,[Bmp_SizeX]
add esi,[Bmp_SizeX]
add esi,[Bmp_SizeX]
sub edi,ebp
dec ebx
jnz copy_lines_8
;total size of bmp file
mov edi,[WhereCodingBMP]
mov ebx,[Bmp_bytes_per_string]
imul ebx,[Bmp_SizeY]
add ebx,54+1024
;crate list of bmp description
mov [edi],word 'BM'
mov [edi+2],ebx
mov [edi+10],dword 54+1024
mov [edi+14],dword 40
mov edx,[Bmp_SizeX]
mov ecx,[Bmp_SizeY]
mov [edi+18],edx
mov [edi+22],ecx
mov [edi+26],word 1
mov [edi+28],word 8
mov [edi+30],dword 0
mov edx,[Bmp_bytes_per_string]
imul edx,ecx
mov [edi+34],edx
mov [edi+38],dword 0
mov [edi+42],dword 0
mov [edi+46],dword 0
ret
no_8_bits_per_pixel:
;**********************************************
;*******************24 bit BMP*****************
;**********************************************
cmp eax,256
jle no_32_bits_per_pixel
;copy picture
mov esi,[PointerToImage]
mov edx,[WhereCodingBMP]
mov ebx,[Bmp_SizeX]
shl ebx,3 ;8*(picture_size_x)
lea ebx,[ebx+ebx*2] ;3*8*(picture_size_x)
add ebx,31 ;3*8*(picture_size_x)+31
shr ebx,5 ;(3*8*(picture_size_x)+31)/32
mov [Bmp_doublewords],ebx ;double words in string
shl ebx,2
mov [Bmp_bytes_per_string],ebx ;bytes per string
mov ecx,[Bmp_SizeY]
dec ecx
imul ebx,ecx
add edx,54
add edx,ebx ;in edx pointer to start of copy bit map
mov ebp,[Bmp_bytes_per_string]
shl ebp,1
mov ebx,[Bmp_SizeY]
mov esi,[PointerToImage]
mov edi,edx
mov edx,[Bmp_SizeX]
lea edx,[edx+edx*2]
copy_lines_24:
push esi
mov ecx,[Bmp_doublewords]
rep_movsb_24:
mov eax,[esi]
mov [edi],eax
add esi,4
add edi,4
dec ecx
jnz rep_movsb_24
pop esi
add esi,edx
sub edi,ebp
dec ebx
jnz copy_lines_24
;total size of bmp fille
mov edi,[WhereCodingBMP]
mov ebx,[Bmp_bytes_per_string]
imul ebx,[Bmp_SizeY]
add ebx,54
;write info to structure of bmp file
mov [edi],word 'BM'
mov [edi+2],ebx
mov [edi+10],dword 54 ;where begin bmp imige
mov [edi+14],dword 40 ;total size of structure number two
mov edx,[Bmp_SizeX]
mov ecx,[Bmp_SizeY]
mov [edi+18],edx
mov [edi+22],ecx
mov [edi+26],word 1
mov [edi+28],word 24 ;bytes per pixel
mov [edi+30],dword 0
mov edx,[Bmp_bytes_per_string]
imul edx,ecx
mov [edi+34],edx ;size of bmp image
mov [edi+38],dword 0
mov [edi+42],dword 0
mov [edi+46],dword 0
ret
no_32_bits_per_pixel:
ret
PointerToImage dd 0
WhereCodingBMP dd 0
BmpPalette dd 0
Bmp_SizeX dd 0
Bmp_SizeY dd 0
Bmp_Counter dd 0
Bmp_Counter2 dd 0
Bmp_Counter3 dd 0
Bmp_save1 dd 0
Bmp_save2 dd 0
Bmp_save3 dd 0
Bmp_bytes_per_string dd 0
Bmp_doublewords dd 0

View File

@ -0,0 +1,3 @@
@fasm animage.asm animage
@mtappack animage
@pause

View File

@ -0,0 +1,333 @@
;-----------------------------------------------------
draw_volume_rectangle:
mov [line_x],eax
mov [line_y],ebx
mov [line_size_x],ecx
mov [line_size_y],edx
cmp esi,1
jne no_volume_light_rectangle
mov [color_rectangle],9350878
mov [color_line1],5669590
mov [color_line2],12508927
mov [color_line3],9350878
jmp exit_colors
no_volume_light_rectangle:
cmp esi,2
jne no_pressed_rectangle
mov [color_rectangle],9089258
mov [color_line1],5669590
mov [color_line2],9089258
mov [color_line3],9089258
jmp exit_colors
no_pressed_rectangle:
cmp esi,3
jne no_pressed_panel
mov [color_rectangle],9350878
mov [color_line1],5669590
mov [color_line2],7000
mov [color_line3],12508927
jmp exit_colors
no_pressed_panel:
cmp esi,4
jne no_pressed_light_panel
mov [color_rectangle],0xffffff
mov [color_line1],5669590
mov [color_line2],7000
mov [color_line3],12508927
jmp exit_colors
no_pressed_light_panel:
cmp esi,5
jne no_light_pressed_rectangle
mov [color_rectangle],9089258
mov [color_line1],5669590
mov [color_line2],9089258
mov [color_line3],9089258
jmp exit_colors
no_light_pressed_rectangle:
cmp esi,6
jne no_work_rectangle
mov [color_rectangle],9350878
mov [color_line1],5669590
mov [color_line2],9350878
mov [color_line3],9350878
jmp exit_colors
no_work_rectangle:
cmp esi,7
jne no_work_rectangle_2
mov [color_rectangle],9350878
mov [color_line1],9350878
mov [color_line2],9350878
mov [color_line3],9350878
jmp exit_colors
no_work_rectangle_2:
exit_colors:
;draw rectangle
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
shl ecx,16
add ebx,[line_size_x]
add ecx,[line_size_y]
mov edx,[color_rectangle]
call draw_rectangle
;line 1
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
call draw_line
;line 2
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ecx,[line_size_y]
call draw_line
;line 3
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
add ecx,[line_size_y]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
;line 4
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
add ebx,[line_size_x]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
;light line 1
mov edx,[color_line2]
mov ebx,[line_x]
mov ecx,[line_y]
inc ebx
inc ecx
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
dec ebx
inc ecx
call draw_line
;light line 2
mov edx,[color_line2]
mov ebx,[line_x]
mov ecx,[line_y]
inc ebx
inc ecx
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ecx,[line_size_y]
dec ecx
inc ebx
call draw_line
;light line 3
mov edx,[color_line3]
mov ebx,[line_x]
mov ecx,[line_y]
add ebx,[line_size_x]
dec ebx
inc ecx
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
add ecx,[line_size_y]
dec ebx
dec ecx
call draw_line
;light line 4
mov edx,[color_line3]
mov ebx,[line_x]
mov ecx,[line_y]
add ecx,[line_size_y]
inc ebx
dec ecx
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ecx,[line_size_y]
add ebx,[line_size_x]
dec ecx
dec ebx
call draw_line
ret
;----------------------------------------------------------
rectangle:
no_light_rectangle:
mov [line_x],eax
mov [line_y],ebx
mov [line_size_x],ecx
mov [line_size_y],edx
mov edx,esi
mov eax,13
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
shl ecx,16
add ebx,[line_size_x]
add ecx,[line_size_y]
int 0x40
ret
;----------------------------------------------------------
draw_conture:
mov [line_x],eax
mov [line_y],ebx
mov [line_size_x],ecx
mov [line_size_y],edx
mov [color_line1],5669590
;line 1
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
call draw_line
;line 2
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ecx,[line_size_y]
call draw_line
;line 3
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
add ecx,[line_size_y]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
;line 4
mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
add ebx,[line_size_x]
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
ret
;----------------------------------------------------------
columnus:
sub eax,ecx
jns no_columnus
neg eax
cmp eax,esi
ja no_columnus
sub ebx,edx
jns no_columnus
neg ebx
cmp ebx,edi
ja no_columnus
mov eax,1
jmp columnus_true
no_columnus:
xor eax,eax
columnus_true:
ret
;----------------------------------------------------------
print_text:
mov [text_x],eax
mov [text_y],ebx
mov eax,4
mov ebx,[text_x]
shl ebx,16
add ebx,[text_y]
int 0x40
ret
;----------------------------------------------------------
draw_rectangle:
mov eax,13
int 0x40
ret
;------------------------
draw_line:
mov eax,38
int 0x40
ret
;----------------------------------------------------------
;lightlin 12508927
;lines 5669590
;workpan 9350878
;btnpress 9089258
line_x dd 0
line_y dd 0
line_size_x dd 0
line_size_y dd 0
color_line1 dd 0
color_line2 dd 0
color_line3 dd 0
color_rectangle dd 0
;--------------------
text_x dd 0
text_y dd 0
;--------------------

View File

@ -0,0 +1,423 @@
macro opendialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
;mov [get_loops],0
mov [dlg_pid_get],0
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog)
;
; STEP2 prepare IPC area for get messages
;
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
int 0x40
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
;
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov ebx,run_fileinfo
int 0x40
call redproc
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
jmp erroff
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
; First message is number of PID SYSXTREE dialog
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
jmp openoff
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
param:
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo ; 0x10000
;run_filepath
db '/RD/1/SYSXTREE',0
procinfo:
times 1024 db 0
}
macro savedialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, run_filepath, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
;mov [get_loops],0
mov [dlg_pid_get],0
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog)
;
; STEP2 prepare IPC area for get messages
;
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
int 0x40
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
;
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov ebx,run_fileinfo
int 0x40
call redproc
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
jmp erroff
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
; First message is number of PID SYSXTREE dialog
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
jmp openoff
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
param:
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo
;run_filepath:
db '/RD/1/SYSXTREE',0
procinfo:
times 1024 db 0
}
;-----------------------------------------------------------

View File

@ -0,0 +1,241 @@
dialog_line:
mov [string_x],eax
mov [string_y],ebx
mov [MaxSizeString],ecx
and [position],0
mov eax,string_
mov ebx,64/4
next_byte_cleare:
mov [eax],dword 0
add eax,4
dec ebx
jnz next_byte_cleare
call print_line
call print_cursor
opros:
mov eax,10
int 0x40
cmp eax,1
je exit_cycle
cmp eax,2
jne opros
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je exit_cycle
cmp eax,8
je backspace
cmp eax,176
je left
cmp eax,179
je right
cmp eax,32
je probel
inc [position]
inc [MaxSizeString]
call MinMaxCorrect
dec [MaxSizeString]
test ecx,ecx
jz no_maximum_position
jmp opros
no_maximum_position:
mov ebx,[position]
dec ebx
mov [string_+ebx],al
call print_line
call print_cursor
jmp opros
backspace:
dec [position]
call MinMaxCorrect
mov ebx,[position]
mov [string_+ebx],byte ' '
call print_line
call print_cursor
jmp opros
left:
dec [position]
call MinMaxCorrect
call print_line
call print_cursor
jmp opros
right:
inc [position]
call MinMaxCorrect
call print_line
call print_cursor
jmp opros
probel:
mov ebx,[position]
mov [string_+ebx],byte ' '
inc [position]
call MinMaxCorrect
call print_line
call print_cursor
jmp opros
exit_cycle:
inc [position]
mov ebx,[position]
mov [string_+ebx],byte 13
exit_opros:
call print_line
ret
;---------------------------------------------------------------
print_line:
mov eax,13
mov ebx,[string_x]
mov ecx,[string_y]
mov edx,[MaxSizeString]
shl ebx,16
shl ecx,16
imul edx,6
add ebx,edx
add ebx,2
add ecx,10
mov edx,0xffffff
int 0x40
mov eax,4
mov ebx,[string_x]
shl ebx,16
add ebx,[string_y]
mov ecx,0
mov edx,string_
mov esi,[MaxSizeString]
int 0x40
ret
print_cursor:
mov eax,13
mov ebx,[position]
mov ecx,[string_y]
imul ebx,6
add ebx,[string_x]
shl ebx,16
shl ecx,16
add ebx,2
add ecx,8
mov edx,0xff6c58
int 0x40
ret
;----------------------------------------------------------
MinMaxCorrect:
mov ebx,[MaxSizeString]
xor ecx,ecx
cmp [position],ebx
jl no_maximum_length_string
mov [position],ebx
mov ecx,1 ;maximul position
no_maximum_length_string:
cmp [position],0
jns no_minimum_length_string
and [position],0
no_minimum_length_string:
ret
;----------------------------------------------------------
string_ rb 65
position dd 0
MaxSizeString dd 0
string_x dd 0
string_y dd 0
;**********************************************************
;----------------------------------------------------------
value:
xor edx,edx
cycle_value_:
xor ebx,ebx
mov bl,byte[eax]
cmp bl,'0'
jne no_0
mov ebx,0
jmp exit_v
no_0:
cmp bl,'1'
jne no_1
mov ebx,1
jmp exit_v
no_1:
cmp bl,'2'
jne no_2
mov ebx,2
jmp exit_v
no_2:
cmp bl,'3'
jne no_3
mov ebx,3
jmp exit_v
no_3:
cmp bl,'4'
jne no_4
mov ebx,4
jmp exit_v
no_4:
cmp bl,'5'
jne no_5
mov ebx,5
jmp exit_v
no_5:
cmp bl,'6'
jne no_6
mov ebx,6
jmp exit_v
no_6:
cmp bl,'7'
jne no_7
mov ebx,7
jmp exit_v
no_7:
cmp bl,'8'
jne no_8
mov ebx,8
jmp exit_v
no_8:
cmp bl,'9'
jne no_9
mov ebx,9
jmp exit_v
no_9:
xor edx,edx
jmp error
exit_v:
mov ecx,[length_number]
dec ecx
test ecx,ecx
jz no_stepen
next_mul:
imul ebx,10
dec ecx
jne next_mul
no_stepen:
add edx,ebx
inc eax
dec [length_number]
jnz cycle_value_
error:
mov eax,edx
ret
;----------------------------------------------------------
length_number dd 0

View File

@ -0,0 +1,331 @@
; GIF LITE v2.0 by Willow
; Written in pure assembler by Ivushkin Andrey aka Willow
;
; This include file will contain functions to handle GIF image format
;
; Created: August 15, 2004
; Last changed: September 9, 2004
; Change COLOR_ORDER in your program
; if colors are displayed improperly
COLOR_ORDER equ MENUETOS
if ~ (COLOR_ORDER in <MENUETOS,OTHER>)
; This message may not appear under MenuetOS, so watch...
display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10
end if
; virtual structure, used internally
struc GIF_list
{
.NextImg rd 1
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
struc GIF_info
{
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
_null fix 0x1000
; ****************************************
; FUNCTION GetGIFinfo - retrieve Nth image info
; ****************************************
; in:
; esi - pointer to image list header
; ecx - image_index (0...img_count-1)
; edi - pointer to GIF_info structure to be filled
; out:
; eax - pointer to RAW data, or 0, if error
GetGIFinfo:
push esi ecx edi
xor eax,eax
jecxz .eloop
.lp:
mov esi,[esi]
test esi,esi
jz .error
loop .lp
.eloop:
add esi,4
movsd
movsd
mov eax,esi
.error:
pop edi ecx esi
ret
; ****************************************
; FUNCTION ReadGIF - unpacks GIF image
; ****************************************
; in:
; esi - pointer to GIF file in memory
; edi - pointer to output image list
; eax - pointer to work area (MIN 16 KB!)
; out:
; eax - 0, all OK;
; eax - 1, invalid signature;
; eax >=8, unsupported image attributes
;
; ecx - number of images
ReadGIF:
push esi edi
mov [.table_ptr],eax
mov [.cur_info],edi
xor eax,eax
mov [.globalColor],eax
mov [.img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne .er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc .nextblock
mov [.globalColor],esi
call .Gif_skipmap
.nextblock:
cmp byte[edi],0x21
jne .noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne .no_gc
add edi,7
jmp .nextblock
.no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne .no_comm
inc edi
.block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz .block_skip
inc edi
jmp .nextblock
.no_comm:
cmp byte[edi],0xff ; Application Ext
jne .nextblock
add edi,13
jmp .block_skip
.noextblock:
cmp byte[edi],0x2c ; image beginning
jne .er
inc [.img_count]
inc edi
mov esi,[.cur_info]
add esi,4
xchg esi,edi
movsd
movsd
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc .uselocal
push [.globalColor]
mov edi,esi
jmp .setPal
.uselocal:
call .Gif_skipmap
push esi
.setPal:
movzx ecx,byte[edi]
inc ecx
mov [.codesize],ecx
dec ecx
pop [.Palette]
lea esi,[edi+1]
mov edi,[.table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [.block_ofs],eax
mov [.bit_count],8
mov eax,1
shl eax,cl
mov [.CC],eax
inc eax
mov [.EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
.filltable:
stosd
inc eax
loop .filltable
pop edi
mov [.img_start],edi
.reinit:
mov edx,[.EOI]
inc edx
push [.codesize]
pop [.compsize]
call .Gif_get_sym
cmp eax,[.CC]
je .reinit
call .Gif_output
.cycle:
movzx ebx,ax
call .Gif_get_sym
cmp eax,edx
jae .notintable
cmp eax,[.CC]
je .reinit
cmp eax,[.EOI]
je .end
call .Gif_output
.add:
push eax
mov eax,[.table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae .cycle
inc edx
bsr ebx,edx
cmp ebx,[.compsize]
jne .noinc
inc [.compsize]
.noinc:
jmp .cycle
.notintable:
push eax
mov eax,ebx
call .Gif_output
push ebx
movzx eax,bx
call .Gif_output
pop ebx eax
jmp .add
.er:
pop edi
jmp .ex
.end:
mov eax,[.cur_info]
mov [eax],edi
mov [.cur_info],edi
add esi,2
xchg esi,edi
.nxt:
cmp byte[edi],0
jnz .continue
inc edi
jmp .nxt
.continue:
cmp byte[edi],0x3b
jne .nextblock
xor eax,eax
stosd
mov ecx,[.img_count]
.ex:
pop edi esi
ret
.Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
.Gif_get_sym:
mov ecx,[.compsize]
push ecx
xor eax,eax
.shift:
ror byte[esi],1
rcr eax,1
dec [.bit_count]
jnz .loop1
inc esi
cmp esi,[.block_ofs]
jb .noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz .nextbl
mov eax,[.EOI]
sub esi,2
add esp,8
jmp .exx
.nextbl:
add eax,esi
mov [.block_ofs],eax
pop eax
.noblock:
mov [.bit_count],8
.loop1:
loop .shift
pop ecx
rol eax,cl
.exx:
xor ecx,ecx
ret
.Gif_output:
push esi eax edx
mov edx,[.table_ptr]
.next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz .next
shl ebx,16
mov bx,[esp]
.loop2:
pop ax
lea esi,[eax+eax*2]
add esi,[.Palette]
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
loop .loop2
pop edx eax esi
ret
.globalColor rd 1
.img_count rd 1
.cur_info rd 1 ; image table pointer
.img_start rd 1
.codesize rd 1
.compsize rd 1
.bit_count rd 1
.CC rd 1
.EOI rd 1
.Palette rd 1
.block_ofs rd 1
.table_ptr rd 1

View File

@ -0,0 +1,956 @@
; mov [pointer_to_screen],eax
; mov [output_array],ebx
; mov [screen_size_x],ecx
;setpixel (pixel_x,pixel_y)
setpixel:
mov ecx,[output_array]
mov eax,[pixel_y]
mov ebx,[screen_size_x]
imul eax,ebx
add eax,[pixel_x]
lea eax,[eax+eax*2]
add eax,[pointer_to_screen]
mov [ecx],eax
add [output_array],4
ret
; procedure <<<<<<PutPixel>>>>>>
; IN
; eax - pointer to picture
; ebx - picture size x
; ecx - color of pixel
; esi - x coordinat of pixel
; edi - y coordinat of pixel
; OUT
; not returned value
PutPixel:
imul ebx,edi
add ebx,esi
lea ebx,[ebx+ebx*2]
add eax,ebx
mov ebx,ecx
shr ebx,16
mov [eax],cx
mov [eax+2],bl
ret
; function <<<<<<GetColorOfPixel>>>>>>
; IN
; eax - pointer to picture
; ebx - picture size x
; esi - x coordinat of pixel
; edi - y coordinat of pixel
; OUT
; eax - color of pixel in coordinats (x,y)
GetColorOfPixel:
imul ebx,edi
add ebx,esi
lea ebx,[ebx+ebx*2]
add eax,ebx
mov ebx,[eax]
and ebx,0xffffff
mov eax,ebx
ret
;procedure <<<<calculate line>>>>
; IN
;eax - pointer to screen
;ebx - output array
;ecx - (screen size x)*bytes per pixel
;edx - x1*65536+y1
;esi x2
;edi - y2
; OUT
;eax - number of pixels
calculate_line:
mov [pointer_to_screen],eax
mov [output_array],ebx
mov [screen_size_x],ecx
mov eax,edx
and eax,0xffff
shr edx,16
mov [x_l],edx ;x=x1
mov [y_l],eax ;y=y1
mov [sx],1
mov [sy],1
mov edx,[output_array]
sub esi,[x_l] ;esi=x2-x1
jnz no_0_x
and esi,0
jmp x_no_minus
no_0_x:
jns x_no_minus
neg esi
mov [sx],-1 ;sx=-sx
x_no_minus:
sub edi,[y_l] ;edi=y2-y1
jnz no_0_y
and edi,0
jmp y_no_minus
no_0_y:
jns y_no_minus
neg edi
mov [sy],-1 ;sy=-sy
y_no_minus:
mov [_dx],esi
mov [_dy],edi
cmp [_dx],0 ;if (dx=0 & dy=0) { }
jnz no_null_d
cmp [_dy],0
jnz no_null_d
mov eax,[x_l]
mov ebx,[y_l]
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel ;setpixel(x1,y1)
mov eax,1
ret
no_null_d:
cmp edi,esi ;if (dy>dx) { }
jle no_bigger
mov eax,[_dx]
mov [z],eax ;z=dx
mov eax,[_dy]
mov [_dx],eax ;dx=dy
mov eax,[z]
mov [_dy],eax ;dy=z
mov [_ch],dword 1 ;ch=true
jmp exit_if2
no_bigger: ;else {}
and [_ch],0
exit_if2:
mov eax,[_dy]
shl eax,1
sub eax,[_dx]
mov [e],eax ;e=2*dy-dx
mov esi,1 ;counter
mov edi,[sx]
mov ebp,[sy]
do:
mov eax,[x_l]
mov ebx,[y_l]
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
cmp [e],0
js while_e
mov eax,[_ch]
test eax,eax
jz ch_else
add [x_l],edi
jmp exit_if3
ch_else:
add [y_l],ebp
exit_if3:
mov eax,[_dx]
shl eax,1
sub [e],eax ;e=e-2*dx
while_e:
mov eax,[_ch]
test eax,eax
jz ch_else2
add [y_l],ebp
jmp exit_if4
ch_else2:
add [x_l],edi
exit_if4:
mov eax,[_dy]
shl eax,1
add [e],eax ;e=e+2*dy
inc esi
mov ecx,[_dx]
cmp esi,ecx
jle do ;while (i<=dx)
mov eax,[x_l]
mov ebx,[y_l]
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[output_array]
sub eax,edx
shr eax,2
ret
;---------------------------
;procedure calculate <<<<<rectangle>>>>>>>
; IN
;eax - pointer to screen
;ebx - output array
;ecx - (screen size x)
;edx - x1*65536+y1
;esi x2
;edi - y2
; OUT
;eax - number of pixels
calculate_rectangle:
mov [pointer_to_screen],eax
mov [output_array],ebx
mov [screen_size_x],ecx
mov eax,edx
and eax,0xffff
shr edx,16
mov [x_l],edx ;x=x1
mov [y_l],eax ;y=y1
mov [x2],esi ;x2
mov [y2],edi ;y2
mov [sx],1
mov [sy],1
mov edx,[output_array]
sub esi,[x_l] ;esi=x2-x1
jnz no_0_x_r
and esi,0
jmp x_no_minus_r
no_0_x_r:
jns x_no_minus_r
neg esi
mov [sx],-1 ;sx=-sx
x_no_minus_r:
sub edi,[y_l] ;edi=y2-y1
jnz no_0_y_r
and edi,0
jmp y_no_minus_r
no_0_y_r:
jns y_no_minus_r
neg edi
mov [sy],-1 ;sy=-sy
y_no_minus_r:
mov [_dx],esi
mov [_dy],edi
cmp [_dx],0 ;if (dx=0 & dy=0) { }
jnz no_null_r
cmp [_dy],0
jnz no_null_r
mov eax,[x_l]
mov ebx,[y_l]
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel ;setpixel(x1,y1)
mov eax,1
ret
no_null_r:
mov edi,[_dx]
mov esi,[x_l] ;x1
horizontal_lines:
mov eax,esi ;x
mov ebx,[y_l] ;y1
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,esi ;x
mov ebx,[y2] ;y2
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
add esi,[sx]
dec edi
jns horizontal_lines
mov edi,[_dy]
mov esi,[y_l] ;y1
vertical_lines:
mov eax,[x_l] ;x1
mov ebx,esi ;y
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x2] ;x2
mov ebx,esi ;y
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
add esi,[sy]
dec edi
jns vertical_lines
mov eax,[output_array]
sub eax,edx
shr eax,2
ret
;procedure <<<<<<calculate_circle>>>>>>
; IN
;eax - pointer to screen
;ebx - output array
;ecx - (screen size x)*bytes per pixel
;edx - x_c*65536+y_c
;esi r
; OUT
;eax - number of pixels
calculate_circle:
mov [pointer_to_screen],eax
mov [output_array],ebx
mov [screen_size_x],ecx
mov eax,edx
and eax,0xffff
shr edx,16
mov [x2],edx ;circle centr x
mov [y2],eax ;circle centr y
mov [r],esi ;radius of cicrle
mov edx,[output_array]
mov [x_l],0 ;x=0
mov [y_l],esi ;y=r
mov [d],3
mov eax,[r]
shl eax,1
sub [d],eax ;d=3-2*r
while_circle:
mov esi,[y_l]
mov edi,[x_l]
sub esi,edi ;while y>=x
js exit_while_circle
mov eax,[x_l] ;x
mov ebx,[y_l] ;y
add eax,[x2] ;x+xc
add ebx,[y2] ;y+yc
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x_l] ;x
mov ebx,[y2] ;yc
add eax,[x2] ;x+xc
sub ebx,[y_l] ;yc-y
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x2] ;xc
mov ebx,[y2] ;yc
sub eax,[x_l] ;xc-x
add ebx,[y_l] ;yc+y
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x2] ;xc
mov ebx,[y2] ;yc
sub eax,[x_l] ;xc-x
sub ebx,[y_l] ;yc-y
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x2] ;xc
mov ebx,[y2] ;yc
add eax,[y_l] ;xc+y
add ebx,[x_l] ;yc+x
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x2] ;xc
mov ebx,[y2] ;yc
add eax,[y_l] ;xc+y
sub ebx,[x_l] ;yc-x
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x2] ;xc
mov ebx,[y2] ;yc
sub eax,[y_l] ;xc-y
add ebx,[x_l] ;x+yc
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[x2] ;xc
mov ebx,[y2] ;yc
sub eax,[y_l] ;xc-y
sub ebx,[x_l] ;yc-x
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
cmp [d],0
jns if1_d
mov eax,[x_l]
shl eax,2
add eax,6
add [d],eax ;d=d+4*x+6
jmp exit_if1_d
if1_d:
mov eax,[x_l]
sub eax,[y_l]
shl eax,2
add eax,10
add [d],eax ;d=d+4*(x-y)+10
dec [y_l]
exit_if1_d:
inc [x_l]
jmp while_circle
exit_while_circle:
mov eax,[output_array]
sub eax,edx
shr eax,2
ret
;procedure <<<<<<flood fill>>>>>
;IN
;eax - pointer to screen
;ebx - pointer to output array
;ecx - picture size x
;edx - x0*65536+y0
;esi - x_max*65536+y_max
;edi - color of flood fill arrea
flood_fill:
mov [pointer_to_screen],eax
mov [output_array],ebx
mov [screen_size_x],ecx
mov eax,edx
and edx,0xffff
shr eax,16
mov [sx],eax ;x0
mov [sy],edx ;y0
mov eax,esi
and esi,0xffff
shr eax,16
mov [m_x],eax ;maximum x size of picture
mov [m_y],esi ;maximum y size of picture
mov [c_f],edi ;color of feel
mov eax,[output_array] ; stek
mov [eax],dword 1 ; number of pointes in stek
mov esi,[sx]
mov edi,[sy]
mov [eax+4],si ;x0
mov [eax+4+2],di ;y0
mov eax,[pointer_to_screen]
mov ebx,[screen_size_x]
call GetColorOfPixel
mov [c],eax
cmp eax,[c_f]
jne can_flood_fill
mov eax,[output_array]
mov [eax],dword 0
ret
can_flood_fill:
while_no_null:
;¨§¢«¥ª ¥¬ ª®®à¤¨­ âë ¨§ á⥪ 
mov eax,[output_array]
mov ebx,[eax]
dec ebx
shl ebx,2 ;ebx=ebx*8
add ebx,4 ;ebx=ebx*8+4
xor esi,esi
xor edi,edi
mov si,[eax+ebx] ;x
mov di,[eax+ebx+2] ;y
mov [x2],esi
mov [y2],edi
mov [sy],edi
mov eax,[output_array]
mov ebx,[eax]
dec ebx
mov [eax],ebx ;
; go to right until color=c or until x<MaxXPicture
mov edx,[x2]
go_to_right:
mov eax,[pointer_to_screen]
mov ebx,[screen_size_x]
mov esi,edx;
mov edi,[sy]
call GetColorOfPixel
cmp eax,[c]
jne not_color_of_feeling_arrea_right
mov eax,[pointer_to_screen]
mov ebx,[screen_size_x]
mov ecx,[c_f] ;color of filinf flood
mov esi,edx
mov edi,[sy]
call PutPixel
inc edx
mov eax,edx
cmp eax,[m_x]
jle go_to_right
not_color_of_feeling_arrea_right:
mov eax,edx
dec eax ;----------------------------------
mov [x_r],eax ; save right absciss
; go to left until color=c or until x>0
mov esi,[x2]
mov edi,[y2]
dec esi
mov edx,esi
mov [sy],edi
go_to_left:
mov eax,[pointer_to_screen]
mov ebx,[screen_size_x]
mov esi,edx
mov edi,[sy]
call GetColorOfPixel
cmp eax,[c]
jne not_color_of_feeling_arrea_left
mov eax,[pointer_to_screen]
mov ebx,[screen_size_x]
mov ecx,[c_f] ;color of filing flood
mov esi,edx
mov edi,[sy]
call PutPixel
dec edx
jns go_to_left
not_color_of_feeling_arrea_left:
mov eax,edx
inc eax ;----------------------------------------
mov [x_l],eax ; save left absciss
mov edi,[y2]
dec edi
jns no_null_1_floodfill
mov edi,1
no_null_1_floodfill:
mov [sy],edi
mov eax,[output_array]
mov ebx,[eax]
mov [l_s],ebx ; save total number of points in stek
mov [l_c],-1 ; last color = -1
mov edx,[x_l]
analizing_from_left_to_right_upper:
; ­ «¨§¨à㥬 ¯¨ªá¥«¨ ­ ¤ «¨­¨¥© á «¥¢®£® ªà ï
mov eax,[pointer_to_screen]
mov ebx,[screen_size_x]
mov esi,edx
mov edi,[sy]
call GetColorOfPixel
push eax
cmp eax,[c] ;¥á«¨ 梥⠯஢¥àאַ£® ¯¨ªá¥«ï ­¥ à ¢¥­ á,â® ­¥ § ­®á¨¬ ¥£® ¢ á⥪
jne no_fill_1
mov ebx,[l_c]
cmp ebx,[c]
jne no_fill_1
mov edi,[sy]
mov eax,[output_array]
mov ebx,[eax]
inc ebx
mov [eax],ebx
dec ebx
shl ebx,2
add ebx,4
mov esi,edx
dec esi
mov [eax+ebx],si
mov [eax+ebx+2],di
no_fill_1:
pop [l_c]
inc edx
cmp edx,[x_r]
jle analizing_from_left_to_right_upper
mov ebx,[l_c]
cmp ebx,[c] ;last color is c(color of filing arrea) ?
jne have_changes_in_stek_1
;save last color in stek
mov edi,[sy]
mov eax,[output_array]
mov ebx,[eax]
inc ebx
mov [eax],ebx
dec ebx
shl ebx,2
add ebx,4
mov esi,edx
dec esi
mov [eax+ebx],si
mov [eax+ebx+2],di
have_changes_in_stek_1:
mov edi,[y2]
inc edi
cmp edi,[m_y]
jle no_max_1_floodfill
mov edi,[m_y]
no_max_1_floodfill:
mov [sy],edi
mov eax,[output_array]
mov ebx,[eax]
mov [l_s],ebx ; save total number of points in stek
mov [l_c],-1 ; last color = -1
mov edx,[x_l]
analizing_from_left_to_right_down:
; ­ «¨§¨à㥬 ¯¨ªá¥«¨ ¯®¤ «¨­¨¥© á «¥¢®£® ªà ï
mov eax,[pointer_to_screen]
mov ebx,[screen_size_x]
mov esi,edx
mov edi,[sy]
call GetColorOfPixel
push eax
cmp eax,[c] ;¥á«¨ 梥⠯஢¥àאַ£® ¯¨ªá¥«ï ­¥ à ¢¥­ á,â® ­¥ § ­®á¨¬ ¥£® ¢ á⥪
je no_fill_3
mov ebx,[l_c]
cmp ebx,[c]
jne no_fill_3
mov edi,[sy]
mov eax,[output_array]
mov ebx,[eax]
inc ebx
mov [eax],ebx
dec ebx
shl ebx,2
add ebx,4
mov esi,edx
dec esi
mov [eax+ebx],si
mov [eax+ebx+2],di
no_fill_3:
pop [l_c]
inc edx
cmp edx,[x_r]
jle analizing_from_left_to_right_down
mov ebx,[l_c]
cmp ebx,[c] ;last color is c(color of filing arrea) ?
jne have_changes_in_stek_2
;save last color in stek
mov edi,[sy]
mov eax,[output_array]
mov ebx,[eax]
inc ebx
mov [eax],ebx
dec ebx
shl ebx,2
add ebx,4
mov esi,edx
dec esi
mov [eax+ebx],si
mov [eax+ebx+2],di
have_changes_in_stek_2:
mov ebx,[output_array] ;while stek have points ¯®ª  ¢ á⥪¥ ¥áâì â®çª¨(ª®®à¤¨­ âë)
mov ecx,[ebx]
test ecx,ecx
jnz while_no_null
ret
; procedure <<<<<<calculate ellips>>>>>>
; IN
; eax - pointer to picture
; ebx - output array
; ecx - picture size x
; edx - x0*65536+y0
; esi - a*65536+b
; edi - color
; OUT
; procedure not return value
calculate_ellips:
mov [pointer_to_screen],eax
mov [output_array],ebx
mov [screen_size_x],ecx
mov [e],ebx
mov eax,edx
and eax,0xffff
shr edx,16
mov [x2],edx ; centr x
mov [y2],eax ; centr y
mov eax,esi
and eax,0xffff ;eax=b
shr esi,16 ;esi=a
mov [a],esi
mov [b],eax
mov [c],edi ;color
mov [row],eax ;b
imul esi,esi ;a*a
imul eax,eax ;b*b
mov [a_square],esi
mov [b_square],eax
and [col],0
shl esi,1
shl eax,1
mov [two_a_square],esi
mov [two_b_square],eax
shl esi,1
shl eax,1
mov [four_a_square],esi
mov [four_b_square],eax
mov eax,[row] ;eax=row
mov ebx,eax
dec ebx ;ebx=(row-1)
imul ebx,eax ;ebx=(row-1)*row
imul ebx,[two_a_square] ;ebx=two_a_square*((row-1)*row)
mov ecx,[a_square] ;ecx=a_square
mov eax,1
sub eax,ecx ;eax=(1-a_square)
imul eax,[two_b_square] ;eax=two_b_square*(1-a_square)
add ebx,[a_square] ;ebx=two_a_square*((row-1)*row)+a_square
add eax,ebx ;eax=two_a_square*((row-1)*row)+a_square+two_b_square*(1-a_square)
mov [d],eax
mov edx,[x2] ;x
mov ebp,[y2] ;y
while_ellips_1:
mov esi,[a_square]
mov edi,[b_square]
imul esi,[row]
imul edi,[col]
cmp esi,edi
jle no_while_ellips_1
mov eax,edx ;x
mov ebx,ebp ;y
add eax,[col] ;x+col
add ebx,[row] ;y+row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,edx ;x
mov ebx,ebp ;y
add eax,[col] ;x+col
sub ebx,[row] ;y-row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,edx ;x
mov ebx,ebp ;y
sub eax,[col] ;x-col
add ebx,[row] ;y+row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,edx ;x
mov ebx,ebp ;y
sub eax,[col] ;x-col
sub ebx,[row] ;y-row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[d]
cmp eax,0
js lab33 ;>=0
dec [row]
mov ebx,[four_a_square]
mov ecx,[row]
imul ebx,ecx ;ebx=four_a_square*(row)
sub [d],ebx ;d=d-four_a_square*(row)
lab33:
mov eax,[col]
shl eax,1
add eax,3
imul eax,[two_b_square]
add [d],eax ;d=d+two_b_square*(3+(col*2))
inc [col]
jmp while_ellips_1
no_while_ellips_1:
mov eax,[col]
inc eax
imul eax,[col]
imul eax,[two_b_square] ;eax=two_b_square*((col+1)*col)
mov ebx,[row]
sub ebx,2
imul ebx,[row]
inc ebx
imul ebx,[two_a_square] ;ebx=two_a_square*((row-2)*row+1)
mov ecx,1
sub ecx,[two_a_square]
imul ecx,[b_square] ;ecx=(1-two_a_square)*b_square
add eax,ebx
add eax,ecx
mov [d],eax ;two_b_square*(col+1)*col+two_a_square*(row*(row-2)+1)+(1-two_a_square)*b_square
mov edx,[x2] ;x
mov ebp,[y2] ;y
while_ellips_2:
mov esi,[row]
inc esi
test esi,esi
jz no_while_ellips_2
mov eax,edx ;x
mov ebx,ebp ;y
add eax,[col] ;x+col
add ebx,[row] ;y+row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,edx ;x
mov ebx,ebp ;y
add eax,[col] ;x+col
sub ebx,[row] ;y-row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,edx ;x
mov ebx,ebp ;y
sub eax,[col] ;x-col
add ebx,[row] ;y+row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,edx ;x
mov ebx,ebp ;y
sub eax,[col] ;x-col
sub ebx,[row] ;y-row
mov [pixel_x],eax
mov [pixel_y],ebx
call setpixel
mov eax,[d]
cmp eax,0
jns lab34
inc [col]
mov ebx,[col]
imul ebx,[four_b_square]
add [d],ebx ;d=d+four_b_square*col
lab34:
dec [row]
mov ebx,[row]
shl ebx,1
mov eax,3
sub eax,ebx
imul eax,[two_a_square]
add [d],eax ;d=d+two_b_square*(3-(row*2))
jmp while_ellips_2
no_while_ellips_2:
mov eax,[output_array]
sub eax,[e]
shr eax,2
ret
;---------------------------
x_l dd ?
y_l dd ?
x_r dd ?
y_r dd ?
_dx dd ?
_dy dd ?
sx dd ?
sy dd ?
z dd ?
e dd ?
i dd ?
_ch dd ?
x2 dd ?
y2 dd ?
d dd ?
r dd ?
m_x dd ?
m_y dd ?
c dd ?
c_f dd ?
l_c dd ?
l_s dd ?
;---------------------------
pointer_to_screen dd 0
screen_size_x dd 0
output_array dd 0
pixel_x dd 0
pixel_y dd 0
;---------------------------
a dd 0
b dd 0
col dd 0
row dd 0
bnew dd 0
a_square dd 0
b_square dd 0
two_a_square dd 0
two_b_square dd 0
four_a_square dd 0
four_b_square dd 0
;-----------------------------

View File

@ -0,0 +1,172 @@
*******************************English version*********************************
Hi! (:-) )
1) My name is Andrey(or an english Andrew) Ignatyev( nik andrew_programmer).
2) ANIMAGE(Animation and Image or animation of image) is graphics editor written
in pure assembler for Kolibri operation system.
3) My email polynki@mail.ru You can send my some quation or help my :) with deve-
lopment(for example write decoder or coder some graphics formats).
Offten I'm be a forum meos.sysbin.com
Sorry,but documantation only an rassian,because i'm can a litl speake an
english.
But i'm done interface of program anderstandly.
********************************Russian version********************************
*******************************************************************************
*********************************…„…<EFBFBD>ˆ**************************************
*******************************************************************************
‡¤à ¢áâ¢ã©â¥.
1) Œ¥­ï §®¢ãâ €­¤à¥© ˆ£­ â쥢(­¨ª andrew_programmer).
2) ANIMAGE íâ® £à ä¨ç¥áª¨© । ªâ®à ­ ¯¨á ­­ë© ­  ç¨á⮬  áᥬ¡«¥à¥ ¤«ï ®¯¥à -
樮­­®© á¨áâ¥¬ë Š®«¨¡à¨(«ãçè ï ®¯¥à æ¨®­­ ï á¨á⥬  ¢ ¬¨à¥).
3) ‚ë ¬®¦¥â¥ ¯®áë« âì ¬­¥ ¢®¯à®áë ¨«¨ ¯®¬®çì ¬­¥ ¢ ࠧࠡ®âª¥-­ ¯à¨¬¥à ­ ¯¨á âì
¤¥ª®¤¥à ¨«¨ ª®¤¥à ª ª®£®-­¨¡ã¤ì £à ä¨ç¥áª®£® ä®à¬ â .„«ï ⮣® çâ®¡ë ­ ¯¨á âì
¤¥ª®¤¥à ¢ ¬ ¢®®¡é¥ ­¥ ­ ¤® §­ âì ª ª à ¡®â ¥â £à ä¨ç¥áª¨© । ªâ®à.…¤¨­á⢥­­®¥
çâ® ¢ ¬ ­¥®¡å®¤¨¬® §­ âì - íâ® â®,çâ® ¢ esi ­ å®¤¨âìáï 㪠§ â¥«ì ­  à á¯ ª®¢ë¢ -
¥¬ë© ä ©«,  ¢ edi 㪠§ â¥«ì ­  ®¡« áâì ªã¤  ­ã¦­® à á¯ ª®¢ë¢ âì ä ©«.„«ï à ¡®âë
¤¥ª®¤¥à /ª®¤¥à  ç¥à¥§ eax ¯¥à¥¤ ¥âáï 㪠§ â¥«ì ­  ®¡« áâì ¢ 64 ª¨«®¡ ©â .
‚ë ¬®¦¥â¥ á¢ï§ âìáï á® ¬­®© ¯® í«¥ªâà®­­®© ¯®ç⥠polynki@mail.ru .ˆ ¥é¥ ï ç áâ®
¡ë¢ î ­  ä®à㬥 meos.sysbin.com
******************************************************************************
****************—⮠㬥¥â ¤¥« âì £à ä¨ç¥áª¨© । ªâ®à*************************
******************************************************************************
ˆ§ ¨ª®­®ª ­  ¯ ­¥«¨ £à ä¨ç¥áª®£® । ªâ®à  ­¥à ¡®â îâ ⮫쪮: ¢ë¤¥«¥­¨¥ ®¡« áâ¨
¯à®¨§¢®«ì­®© ä®à¬ë(¯®ª ç⮠ॠ«¨§®¢ ­  à ¡®â  ⮫쪮 á ¯àאַ㣮«ì­®© ®¡« áâìî),
¢ë¢®¤ ⥪áâ (­¥®¡å®¤¨¬® ¯à®¤ã¬ âì à ¡®âã èà¨ä⮢),£à ¤¨¥­â­ ï § «¨¢ª (­ã¦­® ¯à®
¤ã¬ âì à §«¨ç­ë¥ ¢ à¨ ­âë § «¨¢®ª),¨­áâà㬥­â ïમáâì(¢®§¬®¦­® ¥£® ­ã¦­® ¢ª«îç¨â
¢ ¯®¤¬¥­î 䨫ìâàë),¯®¢®à®â ª à⨭ª¨ ­  ¯à®¨§¢®«ì­ë© 㣮«(§­ ç®ª ¯®«ãªà㣠 á®
áâ५ª®©).‚áñ ®áâ «ì­®¥ à ¡®â ¥â.
⥪á⮢®¬ ¬¥­î ¯®«­®áâìî à ¡®â ¥â ¬¥­î FILE ¨ EDIT. ¬¥­î EDIT ᥩç á 5 ¯ã­ªâ®¢,
­® á® ¢à¥¬¥­¥¬ ¯®ï¢ïâìáï ¤à㣨¥ ¯®¤¯ã­ªâë.Žáâ «ì­ë¥ ¬¥­î ­¥ ॠ«¨§®¢ ­ë.
************************************************************************
<<<<<<<<<<<<<<<<<<„®ªã¬¥­â æ¨ï ª £à ä¨ç¥áª®¬ã । ªâ®àã>>>>>>>>>>>>>>>>>
************************************************************************
***********************⥪á⮢ ï ¯ ­¥«ì ¬¥­î****************************
Œ¥­î FILE:
NEW - ᮧ¤ ­¨¥ à ¡®ç¥© ®¡« á⨠¤«ï à¨á®¢ ­¨ï.‚ë ¢¢®¤¨â¥ ¢ ¯®«¥ X à §¬¥à ª à⨭-
ª¨ ¯® X,  ¢ ¯®«¥ Y à §¬¥à ª à⨭ª¨ ¯® Y.<EFBFBD>¥§ ¡ë¢ ©â¥ ¯®á«¥ ­ ¡®à  ª ¦¤®© æ¨äàë ¢
ᮮ⢥âáâ¢ãî饬 ¯®«¥,­ ¦¨¬ âì ª« ¢¨èã ‚‚Ž„.<EFBFBD>®á«¥ § ¤ ­¨ï à §¬¥à  ª à⨪¨ ­ ¦¬¨â¥
¬ë誮© ª­®¯ªã OK. ¢ á ¯®ï¢¨âìáï à ¡®ç ï ®¡« áâì § ¤ ­­ë¬ à §¬¥à®¬.
OPEN - ®âªàë⨥ ä ©«  á ¤¨áª .<EFBFBD>®á«¥ ­ ¦ â¨ï ­  íâã ª­®¯ªã ¢ë 㢨¤¥ ®ª­® ¬¨­¨
¡à ã§¥à  ¢ ª®â®à®¬ ¡ã¤ã⠮⮡ࠦ¥­ë ¨¬¥î騥áï ã ¢ á ¢ á¨á⥬¥ ¤¨áª®¢ë¥ ãáâன-
á⢠(¥á«¨ Š®«¨¡à¨ ¨å ®¡­ à㦨â). ¯®¬®éìî í⮣® ¡à ã§¥à  § å®¤¨â¥ ­  ¤¨áª ¨
¢ë¡¨à ¥â¥ ­ã¦­ë© ¢ ¬ £à ä¨ç¥áª¨© ¢ ©«.<EFBFBD>  ¤ ­­ë© ¬®¬¥­â £à ä¨ç¥áª¨© । ªâ®à
¬®¦¥â ç¨â âì ä ©«ë £à ä¨ç¥áª¨å ä®à¬ â®¢ BMP ¨ GIF.…᫨ ®¡ê¥¬ ä ©«  ¤®áâ â®ç­®
¡®«ì让(­¥áª®«ìª® ¬¥£ ¡ ©â ¨ ¡®«¥¥),â® ä ©« ®âªà뢠¥âáï ­¥áà §ã   ç¥à¥§ ­¥á-
ª®«ìª® ᥪ㭤.
SAVE AS- á®åà ­¥­¨¥ ä ©«  ­  ¤¨áª®¢®¬ ãáâனá⢥.<EFBFBD>®á«¥ ­ ¦ â¨ï ­  íâã ª­®¯ªã
¯®ï¢«ï¥âáï ®ª­® ¬¨­¨¡à ã§¥à ,®¯¨á ­­®£® ¢ëè¥.‚ë â ª¦¥ ¢ë¡¨à ¥â¥ á ¯®¬®éî
¡à ã§¥à  ­ã¦­ë© ¢ ¬ ª â «®£ ¨ 饫ª ¥â¥ ­  ¯®«®áªã á ¤¥à¨ªâ®à¨¥ ª ä ©«ã,ª®â®-
à ï ®â®¡à ¦ ¥âáï á­¨§ã ¡à ã§¥à .<EFBFBD>¥à¥¤¢¨­ã¢ ªãàá®à ¢ ª®­¥æ áâ®à®ª¨ á ª â «®£®¬,
¢ë ¢¢®¤¨â¥ ¨¬ï ä ©«  á à áè¨à¥­¨¥¬.
;-----------------------------------------------------------------------------
<EFBFBD>  ¤ ­­ë© ¬®¬¥­â ॠ«¨§®¢ ­® ¯®«­®æ¥­­®¥
á®åà ­¥­¨¥ ¨ ç⥭¨¥ ä®à¬ â  BMP(24,8,4,1 ¡¨â ­  ¯¨ªá¥«ì).
;-----------------------------------------------------------------------------
SAVE - íâ  ®¯æ¨ï ¨á¯®«ì§ã¥âáï ¢ ⮬ á«ãç ¥,ª®£¤  ä ©« ¡ë« á®åà ­¥­ á ¯®¬®-
éêî SAVE AS.‚ è ä ©« á®åà ­ï¥âáï á ⥬ ¦¥ ¨¬¥­¥¬ ¨ ¢â®¬ ¦¥ ª â «®£¥,ª®â®àë© ¢ë
¢¢¥«¨ à ­¥¥,¨á¯®«ì§ãï SAVE AS.
EXIT - íâ® ª­®¯ª  ¢ë室  ¨§ ¯à®£à ¬¬ë.Ž­  ¯à®¤ã¡«¨à®¢ ­  ª« ¢¨è¥© ESC ­  ª« ¢¨-
 âãà¥.
Œ¥­î EDIT:
UNDO - ®â¬¥­  ¤¥©á⢨ï.<EFBFBD>â  ®¯æ¨ï ¯®§¢®«ï¥â ¤¥« âì ®â¬¥­ã ¯®á«¥¤­¨å ¤¥©á⢨©.<EFBFBD>  ¤ ­
­ë© ¬®¬¥­â ç¨á«® ®âª â®¢ á®áâ ¢«ï¥â ¤¢ .
COPY - ª®¯¨àã¥â ¢ë¤¥«¥­­ãî á ¯®¬®éìî ¨­áâà㬥­â  „…<EFBFBD>ˆ(®­ ­ å®¤¨âìáï ­  ¯ ­¥«¨
¢¢¨¤¥ ¨ª®­ª¨ ¯àאַ㣮«ì­¨ª ,­ à¨á®¢ ­­®£® ¯ã­ªâ¨à­®© «¨­¨¥©) ®¡« áâì ¢ ¡ãä¥à.
PASTE - ¢áâ ¢«ï¥â ᪮¯¨à®¢ ­­ãî ᯮ¬®éìî ¨­áâà㬥­â  COPY ®¡« áâì.
CUT - ¢ë१ ¥â ¢ë¤¥«¥­­ãî ®¡« áâì(®­  áâ ­®¢¨âìáï ¡¥«®©).
CLEARE SCREEN - ®ç¨é ¥â à ¡®çãî ®¡« áâì(®­  áâ ­®¢¨âìáï ¡¥«®©).
******************************ˆŠŽ<EFBFBD>Šˆ ˆ<EFBFBD><EFBFBD>“Œ…<EFBFBD>Ž*******************************
********Š¨áâ¨***************
<EFBFBD>¥à¢ë¥ 5 ¨ª®­®ª ¨§®¡à ¦ îâ 5 ⨯®¢ ª¨á⥩.<EFBFBD>à¨ç¥¬ à §¬¥à ª¨á⨠¢ â®ç­®á⨠ᮮâ-
¢¥âáâ¢ã¥â ⮬ã,ª®â®àë© ¨§®¡à ¦¥­ ­  ¨ª®­ª¥.„«ï à¨á®¢ ­¨ï ª¨áâìî ¢ ¬ ­ã¦­® «¨¡®
­ ¦ âì ­  ¨§®¡à ¦¥­¨¥ ⨯  ª¨áâ¨,«¨¡® ­  á ¬ ¨­áâà㬥­â Šˆ‘’œ,ª®â®àë© ¨§®¡à ¦¥­
¢¢¨¤¥ ஧®¢®£® 㪠§ â¥«ï ¬ëè¨.
******Š à ­¤ è**************
„«ï à¨á®¢ ­¨ï ¨­áâà㬥­â®¬ Š à ­¤ è,¢ ¬ ­ã¦­® 饫ª­ãâì ­  ¨ª®­ª¥ á ¥£® ¨§®¡à ¦¥-
­¨¥¬ ¨ ®­ áࠧ㠦¥ ¡ã¤¥â  ªâ¨¢¨à®¢ ­.ˆ­áâà㬥­â ª à ­¤ è à¨áã¥â ¯® ®â¤¥«ì­ë¬
¯¨ªá¥«ï¬(®­ ­¥§ ¬¥­¨¬ ¯à¨ ᮧ¤ ­¨¨ ¯¨ªá¥«ì­®© £à ä¨ª¨).
******<EFBFBD> «¨âà ***************
<EFBFBD> «¨âà  ¨§®¡à ¦¥­  ­  ¯ ­¥«¨ ¢¢¨¤¥ ¨ª®­ª¨ ¨§ 梥â­ëå ª¢ ¤à â¨ª®¢.„«ï ¢ë¡à 
æ¢¥â  à¨á®¢ ­¨ï ¢ ¬ ­¥®¡å®¤¨¬® 饫ª­ãâì ­  ¨ª®­ª¥, ¨ ¢ ¯®ï¢¨¢è¥©áï ¯ «¨âà¥
¢ë¡à âì ­ã¦­ë© æ¢¥â à¨á®¢ ­¨ï.<EFBFBD> «¨âà  á®¤¥à¦¨â 256 梥⮢.
******<EFBFBD>¨¯¥âª ***************
ˆ­áâà㬥­â <EFBFBD>¨¯¥âª  ¯®§¢®«ï¥â ãáâ ­®¢¨âì 梥⮬ à¨á®¢ ­¨ï 梥â ⮣® ¯¨ªá¥«ï ­ 
ª®â®àë© ¢ë ­ ¢¥«¨ ¯¨¯¥âªã(¯ à¨ í⮬ ­ã¦­® ­ ¦ âì «¥¢ãî ª­®¯ªã ¬ëè¨).
******“¢¥«¨ç¥­¨¥************
ˆ­áâà㬥­â “¢¥«¨ç¥­¨¥ ­¥®¡å®¤¨¬ ¤«ï 㢥«¨ç¥­¨ï ¬ áèâ ¡  ª à⨭ª¨(íâ® ®ç¥­ì
­ã¦­® ¯à¨ ᮧ¤ ­¨¨ ¯¨ªá¥«ì­®© £à ä¨ª¨).<EFBFBD>â®â ¨­áâà㬥­â ¨§®¡à ¦¥­ ¢¢¨¤¥ ç¥âëà¥å
¨ª®­®ª: "x1","x2","x4","x8","x16".—⮠ᮮ⢥âáâ¢ã¥â 㢥«¨ç¥­¨î ¢:
1x1,2x2,4x4,8x8,16x16 à §.
„¥©á⢨¥ íâ¨å ¨ª®­®ª ¯à®¤ã¡«¨à®¢ ­® á ª« ¢¨ âãàë ª« ¢¨è ¬¨:"1","2","4","8","0".
********‹ á⨪**************
ˆ­áâà㬥­â ‹ á⨪ áâ¨à ¥â ç áâì ª à⨪¨,§ ªà è¨¢ ï ¥ñ 梥⮬ ä®­ .<EFBFBD>  á ¬®¬ ¤¥«¥
¨­áâà㬥­ « á⨪ - íâ® ª¨áâì à¨áãîé ï ¡¥«ë¬ 梥⮬.<EFBFBD>®í⮬㠬¥­ïâì ä®à¬ã « á⨪ 
¬®¦­® 饫ª ï ¯® ¨§®¡à ¦¥­¨ï¬ ⨯®¢ ª¨á⥩.
<EFBFBD>  ¯ ­¥«¨ ­ å®¤¨âìáï ¥é¥ ¬­®£® ¤àã£¨å ¨­áâà㬥­â®¢,­® ¯¨á âì ¤®ªã¬¥­â æ¨î ¤ «ìè¥ -
¬­¥ ­¥å®ç¥âìáï,⥬ ¡®«¥¥,çâ® ¥ñ ¬ «® ªâ® ç¨â ¥â(­ à®¤ ¯à¥¤¯®ç¨â ¥â ¨áá«¥¤®¢ âì
¢áñ ¬¥â®¤®¬ â몠).

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm jpegview.asm jpegview
@erase lang.inc
@pause

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm jpegview.asm jpegview
@erase lang.inc
@pause

View File

@ -26,6 +26,9 @@
org 0
PARAMS = memsize - 1024
appname equ 'Jpegview '
version equ '0.15'
use32
db 'MENUET01' ; 8 byte id
@ -271,30 +274,10 @@ dw_002:
xor eax,eax ; DRAW WINDOW
mov edx,[wcolor]
add edx,0x02000000
mov esi,0x80557799
mov edi,0x00557799
add edx,0x13000000
mov edi,header ; WINDOW LABEL
int 0x40
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x00ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
mov eax,8 ; CLOSE BUTTON
mov bx, [winxs]
sub bx, 19
shl ebx, 16
add ebx, 12
mov ecx,5*65536+12
mov edx,1
mov esi,0x557799
int 0x40
; draw status bar
mov eax, 13
@ -528,8 +511,7 @@ include 'jpeglib.asm'
; DATA AREA
wcolor dd 0x000000
labelt db 'Jpegview v0.15'
labellen:
header db appname,version,0
setname db 'SLIDESHOW'
setnamelen:

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm desktop.asm desktop
@erase lang.inc
@pause

View File

@ -1,4 +1,5 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm desktop.asm desktop
@erase lang.inc
@pause

View File

@ -799,37 +799,13 @@ draw_window:
mov eax,14
int 0x40
sub eax,60*65536
mov ebx,eax
mov bx,40
; DRAW WINDOW
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,110*65536+555 ; [x start] *65536 + [x size]
mov ecx,50*65536+255 ; [y start] *65536 + [y size]
mov edx,[w_work] ; color of work area RRGGBB,8->color
or edx,0x02000000
mov esi,[w_grab] ; color of grab bar RRGGBB,8->color gl
or esi,0x80000000
mov edi,[w_frame] ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+7 ;8 ; [x start] *65536 + [y start]
mov ecx,[w_grab_text] ; color of text RRGGBB
if lang eq ru
or ecx,0x10000000
end if
mov edx,labelt ; pointer to text beginning
mov esi,labelt.size ; text length
int 0x40
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(555-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,4*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,[w_grab_button] ; button color RRGGBB
or edx,0x13000000
mov edi,header ; WINDOW LABEL
int 0x40
if lang eq ru
@ -844,10 +820,11 @@ else
apply_w = (5*2+6*7)
end if
; mov eax,8 ; FILENAME BUTTON
mov eax,8 ; FILENAME BUTTON
mov ebx,5*65536+545
mov ecx,212*65536+10
mov edx,0x4000000B
mov esi,[w_grab_button] ; button color RRGGBB
int 0x40
; mov eax,8 ; LOAD BUTTON
@ -1034,12 +1011,15 @@ lsz button_text,\
ru, '’¥ªáâ ­  ª­®¯ª¥',\
en, 'Button text'
lsz labelt,\
ru, '<27><E28098>Ž‰Š€ –‚…’Ž‚',\
en, 'DESKTOP COLOURS - DEFINE COLOR AND CLICK ON TARGET'
sz default_skn, '/RD/1/DEFAULT.SKN',0
if lang eq ru
header db '<27><E28098>Ž‰Š€ ŽŠŽ<C5A0>',0
else
header db 'WINDOWS SETTINGS - DEFINE COLOR AND CLICK ON TARGET',0
end if
color dd 0
I_END:

View File

@ -0,0 +1,3 @@
fasm docpack.asm docpack
mtappack docpack
pause

View File

@ -21,7 +21,7 @@ macro embed_file fn
label2:
FILE_COUNT=FILE_COUNT+1
}
appname equ 'Doc Pack'
use32
org 0x0
db 'MENUET01' ; 8 byte id
@ -85,13 +85,27 @@ start:
red:
mov [my_param],'a'
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
mcall 12,1
mcall 0,<220,120>,<30,FILECOUNT*16+35>,0x3b0b0b0
mcall 4,<8,8>,0x10ffffff,title,titlen-title
xor eax,eax
mov ebx,220*65536+120
mov ecx,30*65536+FILECOUNT*16+35
mov edx,[sc.work]
or edx,0x33000000
mov edi,header
int 0x40
mov ecx,FILECOUNT
mov ebx,10 shl 16+100
mov esi,0xb0b0b0
mov edi,27 shl 16+14
mov ebx,5 shl 16+100
mov esi,[sc.work_button]
mov edi,5 shl 16+14
mov edx,10
mov eax,8
.btnlp:
@ -104,18 +118,18 @@ red:
mov ecx,FILECOUNT
mov edx,embedded
xor edi,edi
mov ebx,30 shl 16+30
mov ebx,25 shl 16+8
mov eax,4
.list:
lea edx,[edx+edi+8]
mov edi,[edx-8]
pusha
sub ebx,15 shl 16
mcall ,,0xff,my_param,1
mcall ,,0xff0000,my_param,1
inc [my_param]
popa
push ecx
mcall ,,0xffffff,,[edx-4]
mcall ,,[sc.work_button_text],,[edx-4]
pop ecx
add edx,esi
add ebx,16
@ -145,14 +159,13 @@ still:
movzx ecx,ah
jmp start.open
title db 'Doc Pack'
titlen:
header db appname,0
fileinfo:
dd 7
dd 0
dd param
dd 0, 0
dd 0 ,0
db '/RD/1/TINYPAD',0
param db '*'
@ -174,7 +187,7 @@ embedded:
embed_file 'SYSFUNCR.TXT' ;g
embed_file 'PPP_RUS.TXT' ;h
embed_file 'STACK_RU.TXT' ;i
embed_file 'GROBFAR.TXT' ;j
embed_file 'GROBFAR.TXT' ;j
; -- End of embedding area -------
dd 0
@ -187,3 +200,5 @@ FILECOUNT = FILE_COUNT
my_param db 0
rb 256
I_END:
sc system_colors

View File

@ -1,267 +1,268 @@
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
; language for programs
lang fix ru ; ru en fr ge fi
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b

View File

@ -1,4 +0,0 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rd2fd.asm rd2fd
@pause

View File

@ -1,4 +0,0 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rd2fd.asm rd2fd
@pause

View File

@ -1,266 +0,0 @@
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b

View File

@ -1,228 +0,0 @@
;WARNING! Spaghetti code, size optimized
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x1000 ; memory for app
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
include "lang.inc"
include "macros.inc" ; - 30 bytes !!!
START:
red: ; redraw
call draw_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
key: ; key
; just read it and ignore
int 0x40
jmp still
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
je close
cmp ah,2
je ramdiskcopy
cmp ah,3
je ramdiskupdate
jmp togglewrite
close:
or eax,-1 ; close this program
jmp callsys
ramdiskcopy:
mov eax,16
xor ebx,ebx
inc ebx
jmp callsys
ramdiskupdate:
mov eax,16
xor ebx,ebx
inc ebx
inc ebx
jmp callsys
togglewrite:
call togglefdcwrite
callsys:
int 0x40
jmp still
; get fdc settings for writing & invert them.
togglefdcwrite:
mov eax,16
mov ebx,4
int 0x40
xchg ecx,eax
xor ecx,1
mov eax,16
dec ebx
int 0x40
mov [esp], dword still ; change return address !
;run trough drawwindow :]
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
mov eax,12 ; function 12:tell os about windowdraw
xor ebx,ebx ; 1, start of draw
inc ebx
int 0x40
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw win
mov ebx,100*65536+250 ; [x start] *65536 + [x size]
mov ecx,100*65536+120 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
int 0x40
;The important part, the buttons & text.
mov ebx,9*65536+36
mov ecx,41*65536+14
xor edx,edx
inc edx
inc edx
;mov edx,2
call clickbox
mov ebx,67*65536+49
inc edx
call clickbox
mov ebx,12*65536+12
mov ecx,81*65536+12
inc edx
call clickbox
mov ecx,96*65536+12
xor edx,edx
call clickbox
mov edi,0x10000000
mov edx,titlebar
mov ebx,9*65536+9
mov ecx,0x10ffffff
call print
; mov edx,h1
mov ebx,11*65536+28
mov ecx,0x10808080
call print
; mov edx,comtext
add ebx,15
xchg ecx,edi
call print
; mov edx,h2
add ebx,25
xchg ecx,edi
call print
; mov edx,setwrite
add ebx,15
xchg ecx,edi
call print
; mov edx,setread
add ebx,15
xchg ecx,edi
call print
mov eax,16
mov ebx,4
int 0x40
test al,1
je nowritex
; mov edx,xsign
mov ebx,14*65536+83
xchg ecx,edi
call print
nowritex:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
clickbox:
pusha
mov edi,edx
cmp edx, 0
je .disabledbox
mov eax,8 ; function 8 : define and draw button
int 0x40
.disabledbox:
inc ecx
inc ebx
mov eax,13
mov edx, 0x808080
int 0x40
cmp edi,0
je .grayed
mov edx,0x80
.grayed:
sub ebx,65536
sub ecx,65536
int 0x40
add ebx,65534
add ecx,65534
mov edx,0xffffff
int 0x40
popa
ret
print:
mov eax,edx
xor esi,esi
addchar:
inc eax
inc esi
cmp [eax],byte 0
jne addchar
mov eax,4
int 0x40
add edx,esi
inc edx
ret
; DATA AREA
titlebar: db 'RD2FD',0
h1: db 'Commands',0
comtext: db 'Copy or Update ramdisk to floppy',0
h2: db 'Settings',0
setwrite: db ' Write directly to floppy',0
setread: db ' Read directly from floppy',0
xsign: db 'X',0
I_END:

View File

@ -1,4 +0,0 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rd2hd.asm rd2hd
@pause

View File

@ -1,4 +0,0 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rd2hd.asm rd2hd
@pause

View File

@ -1,161 +0,0 @@
;
; Save Ramdisk to HD
;
; Compile with FASM for Menuet
;
include 'lang.inc'
include 'macros.inc'
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x1000 ; memory for app
dd 0x1000 ; esp
dd 0x0 ; , 0x0 ; I_Param , I_Icon
;******************************************************************************
START: ; start of execution
xor eax,eax
mov edi,bootpath
mov ecx,128
rep stosd
mcall 6,filename,0,-1,bootpath
mov esi,bootpath+1
mov cx,512
start_search:
lodsb
cmp al,"'"
jz set_end_path
dec cx
cmp cx,0
ja start_search
set_end_path:
mov [esi-1],byte 0
mov eax,40
mov ebx,101b
int 0x40
red:
call draw_window
still:
mov eax, 10 ; wait here for event
int 0x40
dec eax ; redraw request ?
je red
; dec eax
; dec eax ; button in buffer ?
; je button
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,2
jne ah_3
mcall 18,6,1
jmp red
ah_3:
cmp ah,3
jne ah_4
mcall 18,6,2
jmp red
ah_4:
cmp ah,4
jne ah_1
mcall 18,6,3,bootpath+1
jmp red
ah_1:
cmp ah,1
je exit
jmp still
exit:
or eax,-1 ; close this program
int 0x40
; *********************************************
; ******* 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, 200*65536+220 ; [x start] *65536 + [x size]
mov ecx, 200*65536+150 ; [y start] *65536 + [y size]
mov edx, 0x03ccddee ; color of work area RRGGBB,8->color gl
int 0x40
; WINDOW LABEL
mov eax, 4 ; function 4 : write text to window
mov ebx, 8*65536+8 ; [x start] *65536 + [y start]
mov ecx, 0x10ffffff ; font 1 & color ( 0xF0RRGGBB )
mov edx, header ; pointer to text beginning
mov esi, header.size ; text length
int 0x40
xor edx,edx
mcall 13,<15,20>,<30,20>
mcall 13, ,<60,20>
mcall 13, ,<90,20>
mcall 8,<16,17>,<31,17>,2,0xdd7700
inc edx
mcall 8, ,<61,17>, ,0xbb00
inc edx
mcall 8, ,<91,17>, ,0xcc5555
mcall 4,<22,36>,0x10ffffff,text_123,1
add bx,30
add edx,1
mcall 4
add bx,30
add edx,1
mcall 4
mcall 4,<45,36>,0,text_1,text_1.size
add bx,30
mcall 4, ,0,text_2,text_2.size
add bx,30
mcall 4, ,0,text_3,text_3.size
mcall 4,<20,120>,0,text_4,text_4.size
mcall 4,<40,130>,0,text_5,text_5.size
mcall 4,<40,46>,0,text_6,text_6.size
mcall 4,<40,106>,0,text_6,text_6.size
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
sz header, "RD2HD á®åà ­¨âì IMG>HD"
text_123 db '123'
sz text_1, ' ¯ ¯ªã /KOLIBRI'
sz text_2, ' ª®à¥­ì ¤¨áª '
sz text_3, '<27>ãâì ¢ ä ©«¥ RD2HD.TXT'
sz text_4, '¯.3 ¤«ï १¥à¢­®£® á®åà ­¥­¨ï,'
sz text_5, 'â.ª. ¢ ï¤à¥ ¥£® ­¥â.'
sz text_6, '(¯ ¯ª  ¤®«¦­  ¯à¨áãâá⢮¢ âì)'
filename db 'RD2HD TXT'
I_END:
bootpath:

View File

@ -1,266 +1,266 @@
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b

View File

@ -11,13 +11,13 @@ use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x5000 ; memory for app
dd 0x5000 ; memory for app
dd 0x4ff0 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
dd 0x0 , 0x0 ; I_Param , I_Icon
include 'macros.inc'
START: ; start of execution
@ -48,6 +48,7 @@ vrr_00:
mov eax,[currvm]
mov [oldvm],eax
call get_pid
red:
call draw_window ; at first, draw the window
still:
@ -63,13 +64,9 @@ still:
je button
call get_pid
jmp still
red: ; redraw
call draw_window
jmp still
key: ; key
mov eax,2 ; just read it
mov al,2 ; just read it
int 0x40
cmp ah,'1'
jne key_loc_00
@ -143,7 +140,7 @@ key_loc_07:
jmp red
button: ; button
mov eax,17 ; get id
mov al,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
@ -203,29 +200,17 @@ dw_continue:
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+400 ; [x start] *65536 + [x size]
mov ecx,100*65536+200 ; [y start] *65536 + [y size]
mov edx,0x020020C0;0x00000040 ; color of work area RRGGBB,8->color glide
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color glide
mov edi,0x00ffffff ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
call print_my_title
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(400-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x5599cc ; button color RRGGBB
mov edx,0x130020C0;0x00000040 ; color of work area RRGGBB,8->color glide
mov edi,header
int 0x40
; BUTTONS
xor eax,eax
mov edx,eax
mov al,8
mov eax,8
mov edx,0
mov ebx,330*65536+20
mov ecx,84*65536+48
mov dl,2
mov esi,0x5599cc ; button color RRGGBB
int 40h ; Button '+'Width
add ebx,30*65536
mov dl,3
@ -849,31 +834,6 @@ rs_loc_01:
rs_loc_00:
retn
print_my_title:
pusha
xor eax,eax
mov ecx,eax
mov cl,labellen-labelt
mov al,4
mov edx,labelt
mov ebx,8*65536+8
mov edi,00ff0000h
xor esi,esi
inc esi
pmt_loc_00:
push ecx
mov ecx,edi
int 40h
inc edx
sub edi,4*65536
add edi,4*256
add ebx,6*65536
pop ecx
loop pmt_loc_00
popa
retn
draw_face:
call draw_table
;
@ -968,8 +928,7 @@ warning_window:
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WARNING WINDOW
mov eax,0 ; function 0 : define and draw window
; mov ebx,100*65536+400 ; [x start] *65536 + [x size]
xor eax,eax ; function 0 : define and draw window
mov ebx,[oldX]
shr ebx,1
sub ebx,200
@ -981,22 +940,13 @@ warning_window:
sub ecx,100
shl ecx,16
mov cx,200
mov edx,0x02808080 ; color of work area RRGGBB,8->color glide
mov esi,0x40300010 ; color of grab bar RRGGBB,8->color glide
mov edi,0x00ff0000 ; color of frames RRGGBB
int 0x40
; WARNING WINDOW LABEL
call print_my_title
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(200-36)*65536+72 ; [x start] *65536 + [x size]
mov ecx,(160-9)*65536+18 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x00800010 ; button color RRGGBB
mov edx,0x13808080 ; color of work area RRGGBB,8->color glide
mov edi,header
int 0x40
; WARNING TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,(200-(len_warn00/2)*6)*65536+60 ; [x start] *65536 + [y
mov ebx,(200-(len_warn00/2)*6)*65536+60 ; [x start] *65536 + [y
;]
mov ecx,0xf0ff0000 ; color of text RRGGBB
mov edx,warn00 ; pointer to text beginning
@ -1095,9 +1045,7 @@ blinkcol dd 0ffh
;_m3 dw 0,0,0,0,0
;_m4 dw 0,0,0,0,0
labelt:
db 'Vertical Refresh Rate, ver.2.0, Copileft 2003 ;) TRANS'
labellen:
header db 'Vertical Refresh Rate v2.0 (C) 2003 TRANS',0
_m1280x1024 db '1280x1024'
_m1024x768 db '1024x768 '