forked from KolibriOS/kolibrios
*kernel - fixes in 15.2 by Mario79 and 67 by mike.dld
updated sysfunc.txt
*programs
new icons and logo for CPUID and ICON
added new version of @ICON and ICONMNGR
fixes in iconedit and calendar from DedOK
new algoritm of fill background in pic4
all apps (fasm-writen only) rewriten to use common macros.inc for easy recompile in fastcall mode (there is a bug in https; run need rewrite to use common macros.inc)
small fixes in build_all.bat script
git-svn-id: svn://kolibrios.org@485 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -48,12 +48,12 @@ check_box:
|
||||
shl ecx,16
|
||||
add ecx,ch_size
|
||||
mov edx,ch_border_color
|
||||
int 0x40 ;à¨á㥬 à ¬ªã
|
||||
mcall ;à¨á㥬 à ¬ªã
|
||||
|
||||
mov edx,ch_color
|
||||
add ebx,1 shl 16 - 2
|
||||
add ecx,1 shl 16 - 2
|
||||
int 0x40 ;§ ªà 訢 ¥¬ ¢ãâ८á⨠祪¡®ªá
|
||||
mcall ;§ ªà 訢 ¥¬ ¢ãâ८á⨠祪¡®ªá
|
||||
|
||||
test word ch_flags,2 ;¤®áâ âì § 票¥ ¡¨â ¨§ ¯¥à¥¬¥®© ¨ ¯®¬¥áâ¨âì ¢ ä« £ CF
|
||||
jz @f ;¢ ¥á«¨ CF=1, â® ¢ë¯®«¨¬ á«¥¤ãîéãî ¯à®æ¥¤ãàã ¨ ç¥ ¯¥à¥©â¨ ¨¦îî @@
|
||||
@@ -73,7 +73,7 @@ check_box:
|
||||
movzx esi,word ch_text_length ;‡ £à㧨¬ ¤«¨ã ¤¯¨á¨ ¢ esi
|
||||
;¢¥á¥¬ ¢ eax § 票¥ ¢ë¢®¤ ¤¯¨á¨ ª ¢ã
|
||||
mov eax,4
|
||||
int 0x40 ;‚뢮¤
|
||||
mcall ;‚뢮¤
|
||||
popa ;¢®ááâ ®¢¨âì § 票ï ॣ¨áâ஢ ¨§ á⥪
|
||||
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
|
||||
|
||||
@@ -96,13 +96,13 @@ ret ;
|
||||
shl ecx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
mov cx,bp ;§ £à㧨¬ § 票ï ॣ¨áâà 㪠§ â¥«ï ¡ §ë ¢ cx
|
||||
;pop cx
|
||||
int 0x40 ;¢ë¢®¤
|
||||
mcall ;¢ë¢®¤
|
||||
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
|
||||
.mouse: ;®¡à ¡®âª ¬ëè¨
|
||||
pusha
|
||||
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã á çâ® - ¨âì ¦ â®
|
||||
mov ebx,2 ;¢¥á⨠¢ ॣ¨áâà § 票¥ 2
|
||||
int 0x40 ;¯à®¢¥àª ¥ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª®¯ªã ¬ë誨
|
||||
mcall ;¯à®¢¥àª ¥ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª®¯ªã ¬ë誨
|
||||
test eax,eax ;¯à®¢¥àª ¥á«¨ ã á ¢ eax=0, â® ãáâ ®¢¨¬ ä« £ ¨ ¢ë©¤¥¬
|
||||
jnz @f ;¯¥à¥©â¨ ¨¦îî ¬¥âªã @@
|
||||
btr word ch_flags,2 ;¨§¢«¥ç¥¨¥ § ç¥¨ï § ¤ ®£® ¡¨â ¢ ä« £ cf ¨ ¨§¬¥¥¨¥ ¥£® § 票ï ã«¥¢®¥.
|
||||
@@ -120,7 +120,7 @@ pusha
|
||||
|
||||
mov eax,37 ;¯®«ã稬 ª®®à¤¨ âë ¬ë誨
|
||||
mov ebx,1 ;¤®¡ ¢¨âì 1
|
||||
int 0x40 ;¯®«ãç¨âì ª®®à¤¨ âë ªãàá®à ®â®á¨â¥«ì® ®ª
|
||||
mcall ;¯®«ãç¨âì ª®®à¤¨ âë ªãàá®à ®â®á¨â¥«ì® ®ª
|
||||
|
||||
movzx ebx,word ch_top ;§ £à㧨âì ¢ bx § 票¥ ª®®à¤¨ âë ã
|
||||
cmp ax,bx ;áà ¢¨âì á á ª®®à¤¨ ⮩ ªãàá®à
|
||||
|
||||
@@ -23,7 +23,7 @@ use32 ;
|
||||
; 㪠§ ⥫ì áâபã, ¢ ª®â®àãî § ¯¨á ¯ãâì,
|
||||
; ®âªã¤ § ¯ã饮 ¯à¨«®¦¥¨¥
|
||||
;------------------
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
include 'check.inc' ;¢ª«îç¨âì ä ©« check.inc
|
||||
; version_ch ;¥®¡å®¤¨¬ë© ¬ ªà®á ¤«ï ¢ª«î票ï "áâ ன" ¢¥àᨨ check_box
|
||||
version_ch1 ;¥®¡å®¤¨¬ë© ¬ ªà®á ¤«ï ¢ª«î票ï new ¢¥àᨨ check_box1
|
||||
@@ -36,16 +36,16 @@ start: ;
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,40 ;ãáâ ®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
|
||||
mov ebx,0x25 ;á¨á⥬ ¡ã¤¥â ॠ£¨à®¢ âì ⮫쪮 á®®¡é¥¨¥ ® ¯¥à¥à¨á®¢ª¥, ¦ â ª®¯ª , ®¯à¥¤¥«ñ ï à ¥¥, ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ¦ ⨥ ª®¯ªã ¬ëè¨ ¨«¨ ¯¥à¥¬¥é¥¨¥; á¡à áë¢ ¥âáï ¯à¨ ¯à®ç⥨¨)
|
||||
int 0x40
|
||||
mcall
|
||||
red_win:
|
||||
call draw_window ;¯¥à¢® ç «ì® ¥®¡å®¤¨¬® à¨á®¢ âì ®ª®
|
||||
still: ;®á®¢®© ®¡à ¡®â稪
|
||||
mov eax,10 ;ަ¨¤ âì ᮡëâ¨ï
|
||||
int 0x40 ;®¦¨¤ âì ᮡë⨥ ¢ â¥ç¥¨¥ 2 ¬¨««¨á¥ªã¤
|
||||
mcall ;®¦¨¤ âì ᮡë⨥ ¢ â¥ç¥¨¥ 2 ¬¨««¨á¥ªã¤
|
||||
|
||||
cmp al,0x1 ;¥á«¨ ¨§¬¥¨«®áì ¯®«®¦¥¨¥ ®ª
|
||||
jz red_win
|
||||
@@ -55,14 +55,14 @@ still: ;
|
||||
jmp still ;¥á«¨ ¨ç¥£® ¨§ ¯¥à¥ç¨á«¥®£® ⮠ᮢ ¢ 横«
|
||||
button:
|
||||
or eax,-1 ;¢ eax,-1 - 5 ,¡ ©â®¢ ã á ¦¥ ⮫쪮 3 ¢ë©â¨
|
||||
int 0x40 ;¤ «¥¥ ¢ë¯®«ï¥âáï ¢ë室 ¨§ ¯à®£à ¬¬ë
|
||||
mcall ;¤ «¥¥ ¢ë¯®«ï¥âáï ¢ë室 ¨§ ¯à®£à ¬¬ë
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
draw_window: ;à¨á®¢ ¨¥ ®ª ¯à¨«®¦¥¨ï
|
||||
mov eax,12 ;¢ ॣ¨áâà ¢¥á⨠§ 票¥ = 12
|
||||
mov ebx,1 ;¯à¨á¢®¨âì 1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
xor eax,eax ;®¡ã«¨âì eax
|
||||
mov ebx,50*65536+180 ;[ª®®à¤¨ â ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
|
||||
@@ -70,13 +70,13 @@ draw_window: ;
|
||||
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
|
||||
or edx,0xb3000000
|
||||
mov edi,hed
|
||||
int 0x40 ; à¨á®¢ âì ®ª® ¯à¨«®¦¥¨ï
|
||||
mcall ; à¨á®¢ âì ®ª® ¯à¨«®¦¥¨ï
|
||||
|
||||
draw_check_boxes check_boxes,check_boxes_end ;à¨á®¢ ¨¥ 祪¡®ªá®¢
|
||||
|
||||
mov eax,12 ;”ãªæ¨ï 12 - ç âì/§ ª®ç¨âì ¯¥à¥à¨á®¢ªã ®ª .
|
||||
mov ebx,2 ;<3B>®¤äãªæ¨ï 2 - § ª®ç¨âì ¯¥à¥à¨á®¢ªã ®ª .
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
@@ -1,269 +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) | (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
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
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
|
||||
@@ -16,7 +16,7 @@ use32
|
||||
dd 0x1000 ; esp
|
||||
dd 0x00000000 ; reserved=no extended header
|
||||
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ START: ; start of execution
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
dec eax ; redraw request ?
|
||||
jz red
|
||||
@@ -38,16 +38,16 @@ still:
|
||||
|
||||
button:
|
||||
mov al,17 ; get id
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne noclose
|
||||
or eax,-1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
key: ; key
|
||||
mov al,2 ; just read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
jmp still
|
||||
noclose:
|
||||
|
||||
@@ -61,12 +61,12 @@ shape_window:
|
||||
mov eax,50 ; give the shape reference area
|
||||
mov ebx,0
|
||||
mov ecx,shape_reference
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,50 ; give the shape scale 32 x 32 -> 128 x 128
|
||||
mov ebx,1 ; you dont have to give this, scale is 1:1 by default
|
||||
mov ecx,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
popa
|
||||
|
||||
@@ -118,7 +118,7 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; DRAW WINDOW
|
||||
xor eax,eax ; function 0 : define and draw window
|
||||
@@ -129,7 +129,7 @@ draw_window:
|
||||
mov edx,0x00cccc00 ; color of work area RRGGBB,8->color glide
|
||||
mov esi,0x00cccc00 ; color of grab bar RRGGBB,8->color glide
|
||||
mov edi,0x00cccc00 ; color of frames RRGGBB
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
; CLOSE BUTTON
|
||||
@@ -138,12 +138,12 @@ draw_window:
|
||||
mov ecx,20*65536+12 ; [y start] *65536 + [y size]
|
||||
mov edx,1 ; button id
|
||||
mov esi,0x5599cc ; button color RRGGBB
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm cpuspeed.asm cpuspeed
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm cpuspeed.asm cpuspeed
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -16,13 +16,13 @@
|
||||
dd 0x00000000 ; reserved=no extended header
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
mov eax,18
|
||||
mov ebx,5
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
xor edx,edx
|
||||
mov ebx,1000000
|
||||
@@ -38,13 +38,20 @@ START: ; start of execution
|
||||
mov [edi],dl
|
||||
sub edi,1
|
||||
loop newnum
|
||||
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
mcall
|
||||
|
||||
red:
|
||||
call draw_window ; at first, draw the window
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
jz red
|
||||
@@ -57,17 +64,17 @@ still:
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jnz still
|
||||
or eax,-1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
; *********************************************
|
||||
@@ -79,13 +86,7 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
@@ -93,8 +94,8 @@ draw_window:
|
||||
mov ecx,100*65536+65 ; [y start] *65536 + [y size]
|
||||
mov edx,[sc.work] ; color of work area RRGGBB,8->color glide
|
||||
or edx,0x33000000 ; color of grab bar RRGGBB,8->color
|
||||
mov edi,header ; WINDOW LABEL
|
||||
int 0x40
|
||||
mov edi,title ; WINDOW LABEL
|
||||
mcall
|
||||
|
||||
|
||||
mov ebx,20*65536+14 ; draw info text with function 4
|
||||
@@ -102,11 +103,11 @@ draw_window:
|
||||
mov edx,text
|
||||
mov esi,24
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -117,7 +118,7 @@ draw_window:
|
||||
text:
|
||||
db 'CPU RUNNING AT MHZ'
|
||||
|
||||
header db 'CPU SPEED',0
|
||||
title db 'CPU SPEED',0
|
||||
|
||||
I_END:
|
||||
|
||||
|
||||
@@ -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 equ <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
|
||||
@@ -13,7 +13,7 @@ use32 ;
|
||||
dd i_end ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪ ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢¨¬ £à¨æã 4 ¡ ©â
|
||||
dd i_end ; à ᯮ«®¦¨¬ ¯®§¨æ¨î á⥪ ¢ ®¡« á⨠¯ ¬ïâ¨, áà §ã § ⥫®¬ ¯à®£à ¬¬ë. ‚¥àè¨ á⥪ ¢ ¤¨ ¯ §®¥ ¯ ¬ïâ¨, 㪠§ ®¬ ¢ëè¥
|
||||
dd 0x0,0x0 ; 㪠§ ⥫ì áâபã á ¯ à ¬¥âà ¬¨.
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
include 'editbox.inc'
|
||||
align 4
|
||||
use_edit_box procinfo,22,5
|
||||
|
||||
@@ -1,269 +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) | (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
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
;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
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm example.asm example
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm example.asm example
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -24,7 +24,7 @@
|
||||
dd 0x0 ; § १¥à¢¨à®¢ ®
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§ì áᥬ¡«¥à騪®¢!
|
||||
include '..\..\..\..\macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§ì áᥬ¡«¥à騪®¢!
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- <20>€—€‹Ž <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||||
@@ -108,7 +108,7 @@ draw_window:
|
||||
; mov edi,header ; ‡€ƒŽ‹Ž‚ŽŠ ŽŠ<C5BD>€
|
||||
; int 0x40
|
||||
|
||||
mcall 0, <200,200>, <200,50>, 0x33AABBCC,,header
|
||||
mcall 0, <200,200>, <200,50>, 0x33AABBCC,,title
|
||||
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ lsz message,\
|
||||
en,'Press any key...',\
|
||||
fr,'Pressez une touche...'
|
||||
|
||||
lsz header,\
|
||||
lsz title,\
|
||||
ru,'<27><>ˆŒ…<C592> <20><>Žƒ<C5BD>€ŒŒ›',\
|
||||
en,'EXAMPLE APPLICATION',\
|
||||
fr,"L'exemplaire programme"
|
||||
|
||||
@@ -1,267 +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
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm example2.asm example2
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm example2.asm example2
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -59,7 +59,7 @@ check_mouse:
|
||||
|
||||
mov eax,37
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp [window_on],0
|
||||
jne openw2
|
||||
@@ -73,14 +73,14 @@ check_mouse:
|
||||
|
||||
mov eax,23
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,0
|
||||
jne no_open
|
||||
|
||||
mov eax,37
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,0
|
||||
jne waitformouse
|
||||
@@ -88,7 +88,7 @@ check_mouse:
|
||||
|
||||
mov eax,37
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov esi,eax
|
||||
|
||||
@@ -120,7 +120,7 @@ check_mouse:
|
||||
waitm:
|
||||
mov eax,5
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
mcall
|
||||
dec ecx
|
||||
jz no_open
|
||||
cmp [window_on],0
|
||||
@@ -150,7 +150,7 @@ check_mouse:
|
||||
mov eax,9
|
||||
mov ebx,table
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,[table+34]
|
||||
mov [mo_x],eax
|
||||
@@ -161,7 +161,7 @@ check_mouse:
|
||||
mov ebx,1
|
||||
mov ecx,alert_entry
|
||||
mov edx,[g_stack]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov [esp+28],dword 0 ; clear button entry
|
||||
|
||||
@@ -179,7 +179,7 @@ draw_menu:
|
||||
mov eax,9
|
||||
mov ebx,table
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp [table+46],dword 30
|
||||
jb drmr
|
||||
@@ -193,7 +193,7 @@ draw_menu:
|
||||
shl ecx,16
|
||||
add ecx,[m_ys]
|
||||
mov edx,0xf0f8ff
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,38 ; egde lines
|
||||
mov ebx,[m_x]
|
||||
@@ -204,14 +204,14 @@ draw_menu:
|
||||
shl ecx,16
|
||||
add ecx,[m_y]
|
||||
mov edx,0x000000
|
||||
int 0x40
|
||||
mcall
|
||||
mov eax,38
|
||||
mov ecx,[m_y]
|
||||
add ecx,[m_ys]
|
||||
shl ecx,16
|
||||
add ecx,[m_y]
|
||||
add ecx,[m_ys]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov esi,menu-1
|
||||
mov edi,[m_x]
|
||||
@@ -231,7 +231,7 @@ draw_menu:
|
||||
mov edx,esi
|
||||
add edx,3
|
||||
mov esi,12
|
||||
int 0x40 ; draw text
|
||||
mcall ; draw text
|
||||
pop esi
|
||||
add esi,2
|
||||
add edi,50
|
||||
@@ -282,7 +282,7 @@ alert_box:
|
||||
mov ebx,1
|
||||
mov ecx,alert_entry
|
||||
mov edx,[g_stack]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov [menu_action],'MA '
|
||||
|
||||
@@ -298,7 +298,7 @@ alert_still:
|
||||
|
||||
mov eax,23 ; wait here for event
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je alert_red
|
||||
@@ -313,7 +313,7 @@ alert_still:
|
||||
mov eax,9
|
||||
mov ebx,table
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ax,[table+4]
|
||||
je no_close
|
||||
@@ -323,7 +323,7 @@ alert_still:
|
||||
mov [menu_action],'----'
|
||||
mov [window_on],0
|
||||
mov eax,-1
|
||||
int 0x40
|
||||
mcall
|
||||
no_close:
|
||||
|
||||
jmp alert_still
|
||||
@@ -334,12 +334,12 @@ alert_still:
|
||||
|
||||
alert_key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
jmp alert_still
|
||||
|
||||
alert_button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
shr eax,8
|
||||
cmp eax,3
|
||||
@@ -364,7 +364,7 @@ alert_still:
|
||||
mov [g_n],-1
|
||||
mov [window_on],0
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
rtext db 'NO YES OK '
|
||||
|
||||
@@ -381,7 +381,7 @@ alert_draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp [window_on],2
|
||||
jne no_win_type_2
|
||||
@@ -418,7 +418,7 @@ alert_draw_window:
|
||||
mov edx,0x00ffffff ; color of work area RRGGBB,8->color gl
|
||||
mov esi,0x00ffffff ; color of grab bar RRGGBB,8->color gl
|
||||
mov edi,0x000000cc ; color of frames RRGGBB
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
pop edx
|
||||
|
||||
@@ -445,10 +445,10 @@ alert_draw_window:
|
||||
mov edx,0x40000000
|
||||
add edx,ebp
|
||||
mov esi,0
|
||||
int 0x40
|
||||
mcall
|
||||
popa
|
||||
mov eax,4 ; draw text
|
||||
int 0x40
|
||||
mcall
|
||||
inc ebp
|
||||
add ebx,14
|
||||
jmp no_d_found
|
||||
@@ -461,7 +461,7 @@ alert_draw_window:
|
||||
jne no_win_1
|
||||
|
||||
mov eax,14 ; to middle of screen
|
||||
int 0x40
|
||||
mcall
|
||||
mov ecx,eax
|
||||
and ecx,0xffff
|
||||
shr ecx,1
|
||||
@@ -480,7 +480,7 @@ alert_draw_window:
|
||||
mov edx,0x02ffffff ; color of work area RRGGBB,8->color gl
|
||||
mov esi,0x80d05050 ; color of grab bar RRGGBB,8->color gl
|
||||
mov edi,0x00d05050 ; color of frames RRGGBB
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
mov eax,4 ; label
|
||||
@@ -488,14 +488,14 @@ alert_draw_window:
|
||||
mov ecx,0x10ddeeff
|
||||
mov edx,alert_labelt1
|
||||
mov esi,alert_label1len-alert_labelt1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,4
|
||||
mov ebx,10*65536+43
|
||||
mov ecx,0x10000000
|
||||
mov edx,[g_t]
|
||||
mov esi,[g_l]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp [g_1],1
|
||||
jne gadgets_no_1
|
||||
@@ -509,7 +509,7 @@ alert_draw_window:
|
||||
mov ecx,75*65536+16
|
||||
mov edx,3
|
||||
mov esi,0x446688
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,4
|
||||
mov ebx,[g_x]
|
||||
@@ -520,7 +520,7 @@ alert_draw_window:
|
||||
mov ecx,0x10ffffff
|
||||
mov edx,alert_t2
|
||||
mov esi,alert_t2len-alert_t2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
gadgets_no_1:
|
||||
|
||||
@@ -536,7 +536,7 @@ alert_draw_window:
|
||||
mov ecx,75*65536+16
|
||||
mov edx,1
|
||||
mov esi,0x446688
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,8
|
||||
mov ebx,[g_x]
|
||||
@@ -547,7 +547,7 @@ alert_draw_window:
|
||||
mov ecx,75*65536+16
|
||||
mov edx,2
|
||||
mov esi,0x446688
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,4
|
||||
mov ebx,[g_x]
|
||||
@@ -558,7 +558,7 @@ alert_draw_window:
|
||||
mov ecx,0x10ffffff
|
||||
mov edx,alert_t1
|
||||
mov esi,alert_t1len-alert_t1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
gadgets_no_2:
|
||||
|
||||
@@ -566,7 +566,7 @@ alert_draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
|
||||
@@ -18,20 +18,20 @@ use32
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
include 'dialogs1.inc'
|
||||
|
||||
menu_history dd 0x0
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
red:
|
||||
call draw_window_main
|
||||
|
||||
still: ; wait here for event
|
||||
|
||||
mov eax,23
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mov eax,10
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; process events
|
||||
je red
|
||||
@@ -52,42 +52,38 @@ still: ; wait here for event
|
||||
mov ebx,220*65536+6*4
|
||||
mov ecx,70*65536+8
|
||||
mov edx,0xffffff
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,4 ; show menu selections
|
||||
mov ebx,220*65536+70
|
||||
mov ecx,0x000000
|
||||
mov edx,menu_action
|
||||
mov esi,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
nodisplay:
|
||||
|
||||
cmp word [menu_action],word 'AD' ; user requests close
|
||||
jne no_menu_close
|
||||
mov eax,-1
|
||||
int 0x40
|
||||
mcall
|
||||
no_menu_close:
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window_main
|
||||
jmp still
|
||||
|
||||
key:
|
||||
mov eax,2 ; key in buffer
|
||||
int 0x40
|
||||
mcall
|
||||
jmp still
|
||||
|
||||
button: ; button in buffer
|
||||
mov eax,17
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1 ; close application
|
||||
jne noclose
|
||||
mov eax,-1
|
||||
int 0x40
|
||||
or eax,-1
|
||||
mcall
|
||||
noclose:
|
||||
|
||||
cmp ah,2
|
||||
@@ -122,7 +118,7 @@ draw_window_main:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,0 ; open window
|
||||
mov ebx,100*65536+300
|
||||
@@ -130,7 +126,7 @@ draw_window_main:
|
||||
mov edx,0x02ffffff
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call draw_menu ; DRAW MENU
|
||||
|
||||
@@ -139,28 +135,28 @@ draw_window_main:
|
||||
mov ecx,0x10ddeeff
|
||||
mov edx,labelt
|
||||
mov esi,labellen-labelt
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,8 ; close button
|
||||
mov ebx,(300-17)*65536+10
|
||||
mov ecx,5*65536+10
|
||||
mov edx,1
|
||||
mov esi,0x4466bb
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,8 ; button : OPEN ALERT BOX
|
||||
mov ebx,25*65536+150
|
||||
mov ecx,61*65536+14
|
||||
mov edx,2
|
||||
mov esi,0x4466aa
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,8 ; button : OPEN CHOOSE BOX
|
||||
mov ebx,25*65536+150
|
||||
mov ecx,81*65536+14
|
||||
mov edx,3
|
||||
mov esi,0x4466aa
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ebx,20*65536+55 ; draw info text with function 4
|
||||
mov ecx,0xffffff
|
||||
@@ -168,7 +164,7 @@ draw_window_main:
|
||||
mov esi,40
|
||||
newline:
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,10
|
||||
add edx,40
|
||||
cmp [edx],byte 'x'
|
||||
@@ -176,7 +172,7 @@ draw_window_main:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
|
||||
@@ -1,267 +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
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm example3.asm example3
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm example3.asm example3
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -16,44 +16,37 @@
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
red:
|
||||
call draw_window ; draw window
|
||||
call clear_data ; clear status bar
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je red ; yes jump to it
|
||||
jz red ; yes jump to it
|
||||
cmp eax,2 ; key in buffer ?
|
||||
je key ; yes jump to it
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button ; yes jump to it
|
||||
jmp still ; start again
|
||||
|
||||
red: ; redraw
|
||||
call draw_window ; redraw window
|
||||
call clear_data ; clear status info
|
||||
jmp still ; start again
|
||||
jnz button
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
jmp still ; start again
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
cmp ah,1 ; is it the close button
|
||||
jne noclose ; no then jump code
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40 ; do it
|
||||
or eax,-1 ; close this program
|
||||
mcall ; do it
|
||||
noclose:
|
||||
|
||||
cmp ah,100 ; is it main menu
|
||||
@@ -92,7 +85,7 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12: tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
mov eax,0 ; function 0: define and draw window
|
||||
mov ebx,50*65536 ; [x start] *65536
|
||||
@@ -101,21 +94,21 @@ draw_window:
|
||||
add ecx,[y_size] ; add [y size]
|
||||
mov edx,0x80ffffff ; colour of work area RRGGBB
|
||||
mov esi,0x806688dd ; grab bar colour. negative glide
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
mov eax,4 ; function 4: write text to window
|
||||
mov ebx,6*65536+7 ; [x start] *65536 + [y start]
|
||||
mov ecx,0x00ffffff ; text colour
|
||||
mov edx,window_text ; pointer to text beginning
|
||||
mov esi,12 ; text length
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
mov eax,8 ; function 8: define and draw button
|
||||
mov ebx,(381-18)*65536+13 ; [x start] *65536 + [x size]
|
||||
mov ecx,4*65536+13 ; [y start] *65536 + [y size]
|
||||
mov edx,1 ; button id
|
||||
mov esi,0x6688dd ; button color RRGGBB
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
mov eax,13 ; function 13: draw bar
|
||||
mov ebx,1*65536 ; [x start] *65536
|
||||
@@ -126,7 +119,7 @@ draw_window:
|
||||
shl ecx,16 ; *65536
|
||||
add ecx,17 ; add height
|
||||
mov edx,0x006688dd ; bar colour
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
mov ebx,5*65536 ; [x start] *65536
|
||||
@@ -135,17 +128,17 @@ draw_window:
|
||||
xor ecx,ecx ; text colour
|
||||
mov edx,button_no ; pointer to text beginning
|
||||
mov esi,14 ; text length
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
add ebx,95*65536 ; move xy position
|
||||
mov edx,menu_text ; pointer to text beginning
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
call write_main ; draw menu
|
||||
|
||||
mov eax,12 ; function 12: tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
pop eax ; restore register
|
||||
ret ; return
|
||||
@@ -160,7 +153,7 @@ write_main:
|
||||
dec ebx ; x size - 1
|
||||
mov ecx,21*65536+17 ; [y start] *65536 +[y size]
|
||||
mov edx,[menu_colour] ; menu colour
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
mov [main_pos],1 ; start position first button
|
||||
xor edi,edi ; data offset = 0
|
||||
@@ -184,14 +177,14 @@ main_menu:
|
||||
xor edx,edx ; clear register
|
||||
mov dl,[MENU_DATA+edi+2] ; get byte button id number
|
||||
mov esi,[menu_colour] ; button colour
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
mov eax,4 ; function 4: write text to window
|
||||
add ebx,6*65536-49 ; move xy position
|
||||
xor ecx,ecx ; text colour
|
||||
mov edx,MENU_DATA+3 ; point at menu text
|
||||
add edx,edi ; add our offset
|
||||
mov esi,11 ; number of characters
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
is_main_bar:
|
||||
add [main_pos],76 ; update button position
|
||||
@@ -217,7 +210,7 @@ draw_data:
|
||||
add edx,[y_size] ; +[y start]
|
||||
sub edx,12 ; move position
|
||||
xor esi,esi ; text colour
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
pop eax ; restore register
|
||||
|
||||
cmp [button_press],1 ; has a sub button been pressed
|
||||
@@ -238,7 +231,7 @@ draw_data:
|
||||
mov esi,1 ; 1 character
|
||||
mov eax,4 ; function 4: write text to window
|
||||
xor ecx,ecx ; text colour
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
pop eax ; restore register
|
||||
|
||||
draw_get_out:
|
||||
@@ -256,9 +249,9 @@ clear_data:
|
||||
shl ecx,16 ; *65536
|
||||
add ecx,13 ; [y size]
|
||||
mov edx,0x00aaaaaa ; bar colour
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
mov ebx,185*65536+11 ; move position
|
||||
int 0x40 ; do it again
|
||||
mcall ; do it again
|
||||
|
||||
pop eax ; restore register
|
||||
ret ; return
|
||||
@@ -309,7 +302,7 @@ sub_menu:
|
||||
mov ecx,[but_pos] ; [y start]
|
||||
shl ecx,16 ; *65536
|
||||
add ecx,17 ; [y size]
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
jmp is_sub_bar ; jump button code
|
||||
|
||||
is_sub_button:
|
||||
@@ -323,7 +316,7 @@ is_sub_button:
|
||||
shl ecx,16 ; *65536
|
||||
add ecx,16 ; [y size]
|
||||
mov esi,[menu_colour] ; button colour
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
|
||||
mov ebx,[sub_pos] ; [x start]
|
||||
shl ebx,16 ; *65536
|
||||
@@ -335,7 +328,7 @@ is_sub_button:
|
||||
add edx,edi ; add offset
|
||||
mov esi,11 ; number of characters
|
||||
mov eax,4 ; function 4: write text to window
|
||||
int 0x40 ; do it
|
||||
mcall ; do it
|
||||
is_sub_bar:
|
||||
add [but_pos],17 ; move y position
|
||||
|
||||
|
||||
@@ -1,267 +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
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm hello.asm hello
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm hello.asm hello
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,10 +1,10 @@
|
||||
include "macros.inc"
|
||||
include "..\..\..\..\macros.inc"
|
||||
|
||||
initipc:
|
||||
mov eax,9
|
||||
mov ebx,prc
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ecx,eax
|
||||
loop1:
|
||||
@@ -12,7 +12,7 @@ loop1:
|
||||
|
||||
mov eax,9
|
||||
mov ebx,prc
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp word [prc+10],'CM'
|
||||
jne no_cmd
|
||||
@@ -39,18 +39,18 @@ no_exit:
|
||||
mov ecx,dword [cmdpid]
|
||||
mov edx,printf
|
||||
mov esi,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call initcmd
|
||||
|
||||
waitcmdinit:
|
||||
mov eax,40
|
||||
mov ebx,01000000b
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,23
|
||||
mov ebx,100
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,7
|
||||
je cmd_ok
|
||||
@@ -64,19 +64,19 @@ cmd_ok:
|
||||
mov eax,18
|
||||
mov ebx,3
|
||||
mov ecx,dword [cmdnumb]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
pause1:
|
||||
mov eax,5
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
|
||||
exit:
|
||||
mov eax,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cls:
|
||||
mov eax,60
|
||||
@@ -84,7 +84,7 @@ cls:
|
||||
mov ecx,dword [cmdpid]
|
||||
mov edx,ipccls
|
||||
mov esi,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call pause1
|
||||
|
||||
@@ -120,7 +120,7 @@ loopprt:
|
||||
mov ecx,dword [cmdpid]
|
||||
mov edx,stripc
|
||||
mov esi,84
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call pause1
|
||||
|
||||
@@ -132,7 +132,7 @@ eol:
|
||||
mov ecx,dword [cmdpid]
|
||||
mov edx,ipceol
|
||||
mov esi,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call pause1
|
||||
|
||||
@@ -144,13 +144,13 @@ initcmd:
|
||||
mov ecx,dword [cmdpid]
|
||||
mov edx,ipckey
|
||||
mov esi,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,60
|
||||
mov ebx,1
|
||||
mov ecx,ipcb
|
||||
mov edx,28
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,28
|
||||
@@ -166,10 +166,10 @@ getkey:
|
||||
waitagain:
|
||||
mov eax,40
|
||||
mov ebx,01000000b
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,7
|
||||
jne waitagain
|
||||
@@ -186,7 +186,7 @@ endipc:
|
||||
mov ecx,dword [cmdpid]
|
||||
mov edx,ipcend
|
||||
mov esi,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
jmp exit
|
||||
|
||||
|
||||
@@ -1,265 +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 { ; mike.dld
|
||||
if ~a 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
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm ir.asm ir
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm ir.asm ir
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -17,7 +17,7 @@ use32
|
||||
dd 0, 0
|
||||
|
||||
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
@@ -27,17 +27,17 @@ set_variables:
|
||||
mov ebx,0
|
||||
mov ecx,0x3f0
|
||||
mov edx,0x3ff
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,45 ; reserve irq 4
|
||||
mov ebx,0
|
||||
mov ecx,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,44 ; set read ports for irq 4
|
||||
mov ebx,irqtable
|
||||
; mov ecx,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov dh, 3 ; all ports have number 3xx hex
|
||||
|
||||
@@ -67,7 +67,7 @@ set_variables:
|
||||
|
||||
mov eax,5
|
||||
mov ebx,100
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov dl, 0xf8
|
||||
mov al, 'I'
|
||||
@@ -75,14 +75,14 @@ set_variables:
|
||||
|
||||
mov eax,5
|
||||
mov ebx,10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov al, 'R'
|
||||
out dx, al
|
||||
|
||||
mov eax,40 ; get com 1 data with irq 4
|
||||
mov ebx,0000000000010000b shl 16 + 101b
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
red:
|
||||
call draw_window
|
||||
@@ -90,7 +90,7 @@ red:
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
dec eax
|
||||
jz red
|
||||
dec eax
|
||||
@@ -99,23 +99,23 @@ still:
|
||||
|
||||
button: ; button
|
||||
mov al,17 ; get id
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; we have only one button, close
|
||||
|
||||
mov eax,45 ; free irq
|
||||
mov ebx,1
|
||||
mov ecx,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,46 ; free ports 0x3f0-0x3ff
|
||||
mov ebx,1
|
||||
mov ecx,0x3f0
|
||||
mov edx,0x3ff
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
or eax,-1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
pos dd 0x0
|
||||
|
||||
@@ -130,14 +130,14 @@ cdplayer:
|
||||
readir:
|
||||
mov eax,42
|
||||
mov ebx,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ebx,80
|
||||
jne nocd
|
||||
|
||||
mov eax,70
|
||||
mov ebx,cdplayer
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
nocd:
|
||||
@@ -156,7 +156,7 @@ cdplayer:
|
||||
mov ebx,20*65536+260
|
||||
mov ecx,22*65536+220
|
||||
mov edx,[wcolor]
|
||||
int 0x40
|
||||
mcall
|
||||
mov eax,10*19+1
|
||||
noeaxz:
|
||||
mov [pos],eax
|
||||
@@ -209,7 +209,7 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
@@ -217,7 +217,7 @@ draw_window:
|
||||
mov ecx,100*65536+250 ; [y start] *65536 + [y size]
|
||||
mov edx,[wcolor] ; color of work area RRGGBB,8->color
|
||||
mov edi,labelt ; caption string
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; ; WINDOW LABEL
|
||||
; mov eax,4 ; function 4 : write text to window
|
||||
@@ -225,7 +225,7 @@ draw_window:
|
||||
; mov ecx,0x00ffffff ; color of text RRGGBB
|
||||
; mov edx,labelt ; pointer to text beginning
|
||||
; mov esi,labellen-labelt ; text length
|
||||
; int 0x40
|
||||
; mcall
|
||||
|
||||
; CLOSE BUTTON
|
||||
; mov eax,8 ; function 8 : define and draw button
|
||||
@@ -233,7 +233,7 @@ draw_window:
|
||||
; mov ecx,5*65536+12 ; [y start] *65536 + [y size]
|
||||
; mov edx,1 ; button id
|
||||
; mov esi,0x5599cc ; button color RRGGBB
|
||||
; int 0x40
|
||||
; mcall
|
||||
|
||||
draw_text:
|
||||
|
||||
@@ -244,7 +244,7 @@ draw_text:
|
||||
mov edi,20
|
||||
newline:
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,10
|
||||
add edx,esi
|
||||
dec edi
|
||||
@@ -252,7 +252,7 @@ draw_text:
|
||||
|
||||
mov eax,12
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
|
||||
@@ -1,267 +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
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm md5.asm md5
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm md5.asm md5
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -12,20 +12,7 @@
|
||||
;
|
||||
; Š®¬¯¨«¨àã¥âìáï Fasm'®¬ ¤«ï Œ¥ãí⎑
|
||||
include 'lang.inc'
|
||||
macro diff16 title,l2
|
||||
{
|
||||
local s,d,l1
|
||||
s = l2
|
||||
display title,': 0x'
|
||||
repeat 8
|
||||
d = 48 + s shr ((8-%) shl 2) and $0F
|
||||
if d > 57
|
||||
d = d + 65-57-1
|
||||
end if
|
||||
display d
|
||||
end repeat
|
||||
display 13,10
|
||||
}
|
||||
include '..\..\..\..\macros.inc'
|
||||
|
||||
use32
|
||||
|
||||
@@ -35,47 +22,39 @@ use32
|
||||
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1)
|
||||
dd START ; ¤à¥á ¯¥à¢®© ª®¬ ¤ë
|
||||
dd I_END ; à §¬¥à ¯à®£à ¬¬ë
|
||||
dd 0x100000 ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
|
||||
dd 0x100000 ; ¤à¥á ¢¥àè¨ë áâíª
|
||||
dd 0x4000 ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
|
||||
dd 0x4000 ; ¤à¥á ¢¥àè¨ë áâíª
|
||||
dd 0x0 ; ¤à¥á ¡ãä¥à ¤«ï ¯ à ¬¥â஢ (¥ ¨á¯®«ì§ã¥âáï)
|
||||
dd 0x0 ; § १¥à¢¨à®¢ ®
|
||||
|
||||
START: ; <20> ç «® ¢ë¯®«¥¨ï ¯à®£à ¬¬ë
|
||||
|
||||
red:
|
||||
call draw_window ; ‘¯¥à¢ ¯¥à¥à¨á㥬 ®ª®
|
||||
|
||||
still:
|
||||
|
||||
mov eax,23 ; ަ¨¤ ¥¬ ᮡë⨩
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
mov eax,10 ; ަ¨¤ ¥¬ ᮡë⨩
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; ‡ ¯à®á ¯¥à¥à¨á®¢ªã ?
|
||||
jz red
|
||||
cmp eax,2 ; ¦ â ª« ¢¨è¨ ?
|
||||
jz key
|
||||
cmp eax,3 ; ¦ â ª®¯ª ?
|
||||
jz button
|
||||
|
||||
jmp still
|
||||
|
||||
red:
|
||||
call draw_window
|
||||
jmp still
|
||||
jnz button
|
||||
|
||||
key:
|
||||
mov eax,2
|
||||
int 0x40
|
||||
mcall
|
||||
jmp still
|
||||
|
||||
button:
|
||||
mov eax,17
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1 ; id ª®¯ª¨ = 1 ?
|
||||
jnz noclose
|
||||
mov eax,-1
|
||||
int 0x40
|
||||
or eax,-1
|
||||
mcall
|
||||
|
||||
noclose:
|
||||
|
||||
@@ -356,30 +335,23 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
mcall
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
|
||||
mov ecx,60*65536+100 ; [y start] *65536 + [y size]
|
||||
mov edx,0x03ffffff ; color of work area RRGGBB
|
||||
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
|
||||
mov edi,0x00aabbcc ; color of frames RRGGBB
|
||||
int 0x40
|
||||
mov edx,0x13ffffff ; color of work area RRGGBB
|
||||
mov edi,title ; WINDOW LABEL
|
||||
mcall
|
||||
|
||||
; WINDOW LABEL
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
|
||||
mov ecx,0x00ffffff ; color of text RRGGBB
|
||||
mov edx,labeltext ; pointer to text beginning
|
||||
mov esi,lte-labeltext ; text length
|
||||
int 0x40
|
||||
|
||||
; <20>¨á㥬 ª®¯ªã ¤«ï £¥¥à 樨
|
||||
mov eax,8 ; function 8 : define and draw button
|
||||
mov ebx,20*65536+80 ; [x start] *65536 + [x size]
|
||||
mov ecx,34*65536+14 ; [y start] *65536 + [y size]
|
||||
mov edx,2 ; button id
|
||||
mov esi,0x5588dd ; button color RRGGBB
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; <20> §¢ ¨¥ ª®¯ªã
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
@@ -387,9 +359,8 @@ draw_window:
|
||||
mov ecx,0x000000 ; color of text RRGGBB
|
||||
mov edx,gen_txt ; pointer to text beginning
|
||||
mov esi,gen_len-gen_txt ; text length
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,4 ; draw info text with function 4
|
||||
mov ebx,20*65536+70
|
||||
mov ecx,0x000000
|
||||
mov edx,[text]
|
||||
@@ -397,18 +368,17 @@ draw_window:
|
||||
mov al, [textlen]
|
||||
mov esi,eax
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
;Ž¡« áâì ¤ ëå
|
||||
|
||||
labeltext: db 'MD5 Generator'
|
||||
lte:
|
||||
title db 'MD5 Generator',0
|
||||
|
||||
text: dd 0
|
||||
textlen: dd 0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
include '..\..\..\..\macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
@@ -15,24 +16,24 @@ start:
|
||||
pop ebx
|
||||
mov cl, 45h ; NumLock scancode
|
||||
xor edx, edx
|
||||
int 40h
|
||||
mcall
|
||||
mov al, 40 ; старшие биты уже обнулены
|
||||
mov bl, 2 ; старшие биты уже обнулены
|
||||
int 40h
|
||||
mcall
|
||||
event:
|
||||
push 10
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
; у нас может быть только одно событие - нажата клавиша
|
||||
mov al, 2
|
||||
int 40h
|
||||
mcall
|
||||
cmp al, 2
|
||||
jnz event
|
||||
; у нас есть только одна горячая клавиша
|
||||
push 70
|
||||
pop eax
|
||||
mov ebx, fileinfo
|
||||
int 40h
|
||||
mcall
|
||||
jmp event
|
||||
|
||||
fileinfo:
|
||||
|
||||
@@ -1,269 +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) | (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
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
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
|
||||
@@ -23,7 +23,7 @@ use32 ;
|
||||
; 㪠§ ⥫ì áâபã, ¢ ª®â®àãî § ¯¨á ¯ãâì,
|
||||
; ®âªã¤ § ¯ã饮 ¯à¨«®¦¥¨¥
|
||||
;------------------
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
include 'optionbox.inc' ;¢ª«îç¨âì ä ©« opeck.inc
|
||||
|
||||
version_op ;¢ ਠâ, ¯à¨ ª®â®à®¬ ¨á¯®«ì§ãîâáï æ¢¥â , ª®â®àë¥ § ¤ ¥â ¯®«ì§®¢ ⥫ì
|
||||
@@ -36,16 +36,16 @@ start: ;
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,40 ;ãáâ ®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
|
||||
mov ebx,0x25 ;á¨á⥬ ¡ã¤¥â ॠ£¨à®¢ âì ⮫쪮 á®®¡é¥¨¥ ® ¯¥à¥à¨á®¢ª¥, ¦ â ª®¯ª , ®¯à¥¤¥«ñ ï à ¥¥, ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ¦ ⨥ ª®¯ªã ¬ëè¨ ¨«¨ ¯¥à¥¬¥é¥¨¥; á¡à áë¢ ¥âáï ¯à¨ ¯à®ç⥨¨)
|
||||
int 0x40
|
||||
mcall
|
||||
red_win:
|
||||
call draw_window ;¯¥à¢® ç «ì® ¥®¡å®¤¨¬® à¨á®¢ âì ®ª®
|
||||
still: ;®á®¢®© ®¡à ¡®â稪
|
||||
mov eax,10 ;ަ¨¤ âì ᮡëâ¨ï
|
||||
int 0x40 ;®¦¨¤ âì ᮡë⨥ ¢ â¥ç¥¨¥ 2 ¬¨««¨á¥ªã¤
|
||||
mcall ;®¦¨¤ âì ᮡë⨥ ¢ â¥ç¥¨¥ 2 ¬¨««¨á¥ªã¤
|
||||
|
||||
cmp al,0x1 ;¥á«¨ ¨§¬¥¨«®áì ¯®«®¦¥¨¥ ®ª
|
||||
jz red_win
|
||||
@@ -55,17 +55,17 @@ still: ;
|
||||
jmp still ;¥á«¨ ¨ç¥£® ¨§ ¯¥à¥ç¨á«¥®£® ⮠ᮢ ¢ 横«
|
||||
button:
|
||||
; mov eax,17 ;¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª« ¢¨è¨
|
||||
; int 0x40
|
||||
; mcall
|
||||
; test ah,ah ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ®¡à ¡®â稪 ᮡë⨩ still
|
||||
; jz still
|
||||
or eax,-1 ;¢ eax,-1 - 5 ,¡ ©â®¢ ã á ¦¥ ⮫쪮 3 ¢ë©â¨
|
||||
int 0x40 ;¤ «¥¥ ¢ë¯®«ï¥âáï ¢ë室 ¨§ ¯à®£à ¬¬ë
|
||||
mcall ;¤ «¥¥ ¢ë¯®«ï¥âáï ¢ë室 ¨§ ¯à®£à ¬¬ë
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
draw_window: ;à¨á®¢ ¨¥ ®ª ¯à¨«®¦¥¨ï
|
||||
mov eax,12 ;¢ ॣ¨áâà ¢¥á⨠§ 票¥ = 12
|
||||
mov ebx,1 ;¯à¨á¢®¨âì 1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
xor eax,eax ;®¡ã«¨âì eax
|
||||
mov ebx,50*65536+180 ;[ª®®à¤¨ â ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
|
||||
@@ -73,13 +73,13 @@ draw_window: ;
|
||||
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
|
||||
or edx,0xb3000000
|
||||
mov edi,hed
|
||||
int 0x40 ; à¨á®¢ âì ®ª® ¯à¨«®¦¥¨ï
|
||||
mcall ; à¨á®¢ âì ®ª® ¯à¨«®¦¥¨ï
|
||||
|
||||
draw_option_boxes option_boxes,option_boxes_end ;à¨á®¢ ¨¥ 祪¡®ªá®¢
|
||||
|
||||
mov eax,12 ;”ãªæ¨ï 12 - ç âì/§ ª®ç¨âì ¯¥à¥à¨á®¢ªã ®ª .
|
||||
mov ebx,2 ;<3B>®¤äãªæ¨ï 2 - § ª®ç¨âì ¯¥à¥à¨á®¢ªã ®ª .
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
@fasm.exe optionbox.asm optionbox
|
||||
@kpack.exe optionbox
|
||||
REM @klbrinwin.exe optionbox
|
||||
@pause
|
||||
@@ -48,12 +48,12 @@ op_size=11 ;ࠧ
|
||||
shl ecx,16
|
||||
add ecx,op_size
|
||||
mov edx,op_border_color
|
||||
int 0x40 ;à¨á㥬 à ¬ªã
|
||||
mcall ;à¨á㥬 à ¬ªã
|
||||
|
||||
mov edx,op_color
|
||||
add ebx,1 shl 16 - 2
|
||||
add ecx,1 shl 16 - 2
|
||||
int 0x40 ;§ ªà 訢 ¥¬ ¢ãâ८á⨠祪¡®ªá
|
||||
mcall ;§ ªà 訢 ¥¬ ¢ãâ८á⨠祪¡®ªá
|
||||
|
||||
mov eax,option_group
|
||||
mov dword eax,[eax]
|
||||
@@ -74,7 +74,7 @@ op_size=11 ;ࠧ
|
||||
movzx esi,word op_text_length ;‡ £à㧨¬ ¤«¨ã ¤¯¨á¨ ¢ esi
|
||||
;¢¥á¥¬ ¢ eax § 票¥ ¢ë¢®¤ ¤¯¨á¨ ª ¢ã
|
||||
mov eax,4
|
||||
int 0x40 ;‚뢮¤
|
||||
mcall ;‚뢮¤
|
||||
popa ;¢®ááâ ®¢¨âì § 票ï ॣ¨áâ஢ ¨§ á⥪
|
||||
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
|
||||
|
||||
@@ -97,14 +97,14 @@ ret ;
|
||||
add ecx,(op_size/3) ;¤®¡ ¢¨âì (áâ®à® ¯àאַ㣮«ì¨ª /3)
|
||||
shl ecx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
mov cx,bp ;§ £à㧨¬ § 票ï ॣ¨áâà 㪠§ â¥«ï ¡ §ë ¢ cx
|
||||
int 0x40 ;¢ë¢®¤
|
||||
mcall ;¢ë¢®¤
|
||||
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
|
||||
|
||||
.mouse: ;®¡à ¡®âª ¬ëè¨
|
||||
pusha
|
||||
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã á çâ® - ¨âì ¦ â®
|
||||
mov ebx,2 ;¢¥á⨠¢ ॣ¨áâà § 票¥ 2
|
||||
int 0x40 ;¯à®¢¥àª ¥ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª®¯ªã ¬ë誨
|
||||
mcall ;¯à®¢¥àª ¥ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª®¯ªã ¬ë誨
|
||||
test eax,eax ;¯à®¢¥àª ¥á«¨ ã á ¢ eax=0, â® ãáâ ®¢¨¬ ä« £ ¨ ¢ë©¤¥¬
|
||||
jnz @f ;¯¥à¥©â¨ ¨¦îî ¬¥âªã @@
|
||||
popa ;¥á«¨ ¨ç¥£® ¥ ¯à®¨§®è«®, â® ¢®ááâ ®¢¨¬ § 票ï ॣ¨áâ஢ ¨§ á⥪
|
||||
@@ -120,7 +120,7 @@ pusha
|
||||
|
||||
mov eax,37 ;¯®«ã稬 ª®®à¤¨ âë ¬ë誨
|
||||
inc ebx ;¤®¡ ¢¨âì 1
|
||||
int 0x40 ;¯®«ãç¨âì ª®®à¤¨ âë ªãàá®à ®â®á¨â¥«ì® ®ª
|
||||
mcall ;¯®«ãç¨âì ª®®à¤¨ âë ªãàá®à ®â®á¨â¥«ì® ®ª
|
||||
|
||||
movzx ebx,word op_top ;§ £à㧨âì ¢ bx § 票¥ ª®®à¤¨ âë ã
|
||||
cmp ax,bx ;áà ¢¨âì á á ª®®à¤¨ ⮩ ªãàá®à
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm rtdata.asm rtdata
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm rtdata.asm rtdata
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -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
|
||||
@@ -5,7 +5,7 @@
|
||||
;
|
||||
|
||||
include "lang.inc"
|
||||
include "macros.inc"
|
||||
include "..\..\..\..\macros.inc"
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
@@ -25,31 +25,38 @@ START: ; start of execution
|
||||
mov eax,45 ; reserve irq 4
|
||||
mov ebx,0
|
||||
mov ecx,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,46 ; reserve ports 0x3f8-0x3ff
|
||||
mov ebx,0
|
||||
mov ecx,0x3f8
|
||||
mov edx,0x3ff
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,44 ; read these ports at interrupt/irq 4
|
||||
mov ebx,irqtable
|
||||
mov ecx,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,40 ; enable event for interrupt/irq 4
|
||||
mov ebx,10000b shl 16 + 111b
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call program_com1
|
||||
|
||||
mov eax, 48
|
||||
mov ebx, 3
|
||||
mov ecx, sc
|
||||
mov edx, sizeof.system_colors
|
||||
mcall
|
||||
|
||||
red:
|
||||
call draw_window
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je red
|
||||
@@ -62,13 +69,9 @@ still:
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov al,ah
|
||||
mov dx,0x3f8
|
||||
@@ -78,14 +81,14 @@ still:
|
||||
|
||||
button: ; button
|
||||
or eax,-1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
irq4:
|
||||
|
||||
mov eax,42
|
||||
mov ebx,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; eax = number of bytes left
|
||||
; ecx = 0 success, =1 fail
|
||||
@@ -141,15 +144,9 @@ program_com1:
|
||||
|
||||
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
|
||||
mcall
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax, 0 ; function 0 : define and draw window
|
||||
@@ -157,16 +154,16 @@ draw_window:
|
||||
mov ecx, 100*65536+85 ; [y start] *65536 + [y size]
|
||||
mov edx, [sc.work]
|
||||
or edx, 0x03000000 ; color of work area RRGGBB,8->color gl
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; WINDOW LABEL
|
||||
mov eax, 4 ; function 4 : write text to window
|
||||
mov ebx, 8*65536+8 ; [x start] *65536 + [y start]
|
||||
mov ecx, [sc.grab_text]
|
||||
or ecx, 0x10000000 ; font 1 & color ( 0xF0RRGGBB )
|
||||
mov edx, header ; pointer to text beginning
|
||||
mov esi, header.len ; text length
|
||||
int 0x40
|
||||
mov edx, title ; pointer to text beginning
|
||||
mov esi, title.len ; text length
|
||||
mcall
|
||||
|
||||
mov eax, 4 ; draw text
|
||||
mov ebx, 20*65536+33
|
||||
@@ -176,7 +173,7 @@ draw_window:
|
||||
mov esi, [edx-4]
|
||||
test esi, 0xFF000000
|
||||
jnz .finstr
|
||||
int 0x40
|
||||
mcall
|
||||
add edx, esi
|
||||
add edx, 4
|
||||
add ebx, 10
|
||||
@@ -187,7 +184,7 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -198,7 +195,7 @@ draw_string:
|
||||
mov ecx, [sc.work_text]
|
||||
mov edx, string
|
||||
mov esi, 32
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
|
||||
|
||||
@@ -209,16 +206,16 @@ if lang eq ru
|
||||
text mstr "‚‚Ž„ˆŒ›… ‘ˆŒ‚Ž‹› <20>…<EFBFBD>…„€ž’‘Ÿ ŒŽ„…Œ“.",\
|
||||
"„€<EFBFBD><EFBFBD>›… Ž’ ŒŽ„…Œ€ ‘—ˆ’›‚€ž’‘Ÿ <EFBFBD>Ž",\
|
||||
"<EFBFBD><EFBFBD>…<EFBFBD>›‚€<EFBFBD>ˆž IRQ4 ˆ Ž’Ž<EFBFBD><EFBFBD>€†€ž’‘Ÿ <EFBFBD>ˆ†…."
|
||||
header:
|
||||
title:
|
||||
db 'ŒŽ„…Œ <20>€ COM1'
|
||||
.len = $ - header
|
||||
.len = $ - title
|
||||
else
|
||||
text mstr "TYPED CHARACTERS ARE SENT TO MODEM.",\
|
||||
"DATA FROM MODEM IS READ BY IRQ4",\
|
||||
"INTERRUPT AND DISPLAYED BELOW."
|
||||
header:
|
||||
title:
|
||||
db 'MODEM AT COM1'
|
||||
.len = $ - header
|
||||
.len = $ - title
|
||||
end if
|
||||
|
||||
pos dd 0x0
|
||||
|
||||
@@ -1,269 +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) | (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
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
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
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
; <--- include all MeOS stuff --->
|
||||
include "lang.inc"
|
||||
include "macros.inc"
|
||||
include "..\..\..\..\macros.inc"
|
||||
|
||||
|
||||
; <--- start of MenuetOS application --->
|
||||
@@ -23,14 +23,14 @@ CODE
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
redraw: ; redraw event handler
|
||||
call draw_window ; at first create and draw the window
|
||||
|
||||
wait_event: ; main cycle
|
||||
mov eax, 10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
dec eax ; if event = 1
|
||||
jz redraw ; jump to redraw handler
|
||||
@@ -40,36 +40,36 @@ CODE
|
||||
|
||||
button: ; button event handler
|
||||
mov al, 17 ; get button identifier
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah, 1
|
||||
jne wait_event ; return if button id != 1
|
||||
|
||||
or eax, -1 ; exit application
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
key: ; key event handler
|
||||
mov al, 2 ; get key code
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
jmp wait_event
|
||||
|
||||
draw_window:
|
||||
mov eax, 12 ; start drawing
|
||||
mov ebx, 1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
xor eax, eax ; create and draw the window
|
||||
mov ebx, 100*65536+200 ; (window_cx)*65536+(window_sx)
|
||||
mov ecx, 100*65536+100 ; (window_cy)*65536+(window_sy)
|
||||
mov edx, [sc.work] ; work area color
|
||||
or edx, 0x33000000 ; & window type 3
|
||||
mov edi, header ; window header
|
||||
mov edi, title ; window title
|
||||
int 0x40
|
||||
|
||||
mov eax, 12 ; finish drawing
|
||||
mov ebx, 2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -77,11 +77,11 @@ CODE
|
||||
DATA
|
||||
|
||||
if lang eq ru
|
||||
header db '˜ ¡«® ¯à®£à ¬¬ë',0
|
||||
title db '˜ ¡«® ¯à®£à ¬¬ë',0
|
||||
else if lang eq fr
|
||||
header db 'La programme poncive',0
|
||||
title db 'La programme poncive',0
|
||||
else
|
||||
header db 'Template program',0
|
||||
title db 'Template program',0
|
||||
end if
|
||||
|
||||
; <--- uninitialised data --->
|
||||
|
||||
@@ -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 { ; mike.dld
|
||||
if ~a 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
|
||||
@@ -11,49 +11,42 @@
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd 0x2000 ; memory for app
|
||||
dd 0x1000 ; esp
|
||||
dd 0x2000 ; memory for app
|
||||
dd 0x2000 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
include '..\..\..\..\macros.inc'
|
||||
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
red: ; redraw
|
||||
call draw_window ; at first, draw the window
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
dec eax ; redraw request ?
|
||||
je red
|
||||
cmp eax,2 ; key in buffer ?
|
||||
je key
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window
|
||||
jmp still
|
||||
dec eax ; key in buffer ?
|
||||
jne button
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne noclose
|
||||
mov eax,-1 ; close this program (thread)
|
||||
int 0x40
|
||||
or eax,-1 ; close this program (thread)
|
||||
mcall
|
||||
noclose:
|
||||
|
||||
cmp ah,2
|
||||
@@ -67,7 +60,7 @@ still:
|
||||
mov ebx,1
|
||||
mov ecx,START
|
||||
mov edx,[thread_stack]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
jmp still
|
||||
|
||||
@@ -75,6 +68,7 @@ still:
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
thread_stack dd 0x1000
|
||||
|
||||
|
||||
@@ -87,10 +81,10 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
xor eax,eax ; function 0 : define and draw window
|
||||
mov ebx,10*65536+290 ; [x start] *65536 + [x size]
|
||||
mov ecx,10*65536+130 ; [y start] *65536 + [y size]
|
||||
mov esi,[thread_stack]
|
||||
@@ -99,33 +93,25 @@ draw_window:
|
||||
shl esi,16
|
||||
add ebx,esi
|
||||
add ecx,esi
|
||||
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
|
||||
mov esi,0x808899ff ; color of grab bar RRGGBB,8->color gl
|
||||
mov edi,0x008899ff ; color of frames RRGGBB
|
||||
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,0x10ddeeff ; color of text RRGGBB
|
||||
mov edx,labelt ; pointer to text beginning
|
||||
mov esi,labellen-labelt ; text length
|
||||
int 0x40
|
||||
mov edx,0x33ffffff ; color of work area RRGGBB,8->color gl
|
||||
mov edi,title ; WINDOW LABEL
|
||||
mcall
|
||||
|
||||
|
||||
mov eax,8 ; NEW THREAD BUTTON
|
||||
mov ebx,25*65536+128
|
||||
mov ecx,88*65536+20
|
||||
mov ebx,20*65536+128
|
||||
mov ecx,63*65536+20
|
||||
mov edx,2
|
||||
mov esi,0x90b0d0 ;0x5577cc
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ebx,25*65536+35 ; draw info text with function 4
|
||||
mov eax,4
|
||||
mov ebx,20*65536+10 ; draw info text with function 4
|
||||
mov ecx,0x224466
|
||||
mov edx,text
|
||||
mov esi,40
|
||||
newline:
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,10
|
||||
add edx,40
|
||||
cmp [edx],byte 'x'
|
||||
@@ -134,7 +120,7 @@ draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -143,19 +129,17 @@ draw_window:
|
||||
|
||||
if lang eq ru
|
||||
text:
|
||||
db '<27>’€ <20><>Žƒ<C5BD>€ŒŒ€ ‘އ„€…’ <20>Ž’ŽŠˆ, ‡€<E280A1>“‘Š€Ÿ '
|
||||
db 'Ž„ˆ<EFBFBD> ˆ ’Ž’ †… ŠŽ„ Œ<>ŽƒŽ <20>€‡. <20>€Œ <20>“†<E2809C>Ž '
|
||||
db '’Ž‹œŠŽ <20>އ€<E280A1>Ž’ˆ’œ‘Ÿ Ž<> Ž’„…‹œ<E280B9>ŽŒ ‘’<E28098>Š… '
|
||||
db '„‹Ÿ Š€†„ŽƒŽ <20>Ž’ŽŠ€. '
|
||||
db '<27>€ŒŸ’œ „‹Ÿ ‚‘…• <20>Ž’ŽŠŽ‚ Ž<>™€Ÿ. '
|
||||
db '<27>â ¯à®£à ¬¬ á®§¤ ¥â ¯®â®ª¨, § ¯ã᪠ï '
|
||||
db '®¤¨ ¨ â®â ¦¥ ª®¤ ¬®£® à §. <20> ¬ 㦮 '
|
||||
db '⮫쪮 ¯®§ ¡®â¨âìáï ®¡ ®â¤¥«ì®¬ áâíª¥ '
|
||||
db '¤«ï ª ¦¤®£® ¯®â®ª . '
|
||||
db '<27> ¬ïâì ¤«ï ¢á¥å ¯®â®ª®¢ ®¡é ï. '
|
||||
db ' '
|
||||
db ' ‘އ„€’œ <20>Ž‚›‰ <20>Ž’ŽŠ '
|
||||
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
|
||||
labelt:
|
||||
db '<27><>ˆŒ…<C592> ˆ‘<CB86>Ž‹œ‡Ž‚€<E2809A>ˆŸ 51®© ”“<E2809D>Š–ˆˆ'
|
||||
labellen:
|
||||
title db '<27>ਬ¥à ¨á¯®«ì§®¢ ¨ï ¯®â®ª®¢',0
|
||||
|
||||
else
|
||||
text:
|
||||
db 'THIS EXAMPLE CREATES THREADS BY RUNNING '
|
||||
@@ -165,11 +149,9 @@ else
|
||||
db ' '
|
||||
db ' '
|
||||
db ' CREATE NEW THREAD '
|
||||
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
|
||||
labelt:
|
||||
db 'THREAD EXAMPLE'
|
||||
labellen:
|
||||
title db 'THREAD EXAMPLE',0
|
||||
|
||||
end if
|
||||
I_END:
|
||||
|
||||
Reference in New Issue
Block a user