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:
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm cmd.asm cmd
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix de >lang.inc
|
||||
@fasm cmd.asm cmd
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -18,7 +18,7 @@ use32
|
||||
dd 0x0
|
||||
dd 0x0
|
||||
|
||||
include "macros.inc"
|
||||
include "..\..\..\macros.inc"
|
||||
include "lang.inc"
|
||||
START:
|
||||
|
||||
@@ -33,7 +33,7 @@ START:
|
||||
still:
|
||||
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,1
|
||||
je re
|
||||
@@ -46,7 +46,7 @@ still:
|
||||
|
||||
button:
|
||||
mov eax,17
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1
|
||||
jne noclose
|
||||
@@ -84,7 +84,7 @@ loop1:
|
||||
mov edx,tic_table
|
||||
add edx,dword [linev]
|
||||
mov esi,81
|
||||
int 0x40
|
||||
mcall
|
||||
add dword [xpos],10
|
||||
add dword [linev],81
|
||||
pop ecx
|
||||
@@ -101,7 +101,7 @@ no_red:
|
||||
|
||||
key:
|
||||
mov eax,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,27
|
||||
jne no_escape
|
||||
@@ -287,7 +287,7 @@ clear:
|
||||
shl ecx,16
|
||||
add ecx,9
|
||||
mov edx,0
|
||||
int 0x40
|
||||
mcall
|
||||
add dword [ypos],6
|
||||
ret
|
||||
|
||||
@@ -295,18 +295,18 @@ draw:
|
||||
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,0
|
||||
mov ebx,100*65536+492
|
||||
mov ecx,100*65536+280
|
||||
mov edx,0x13000000
|
||||
mov edi,title
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,12
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -318,7 +318,7 @@ print:
|
||||
mov ecx,0x00ddeeff
|
||||
mov edx,smb
|
||||
mov esi,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov edi,tic_table
|
||||
add edi,dword [linen]
|
||||
@@ -337,7 +337,7 @@ cursor:
|
||||
mov ecx,0x00ddeeff
|
||||
mov edx,smb_cursor
|
||||
mov esi,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov edi,tic_table
|
||||
mov esi,smb_cursor
|
||||
@@ -356,7 +356,7 @@ ppr:
|
||||
mov ecx,0x00ddeeff
|
||||
mov edx,prompt
|
||||
mov esi,5
|
||||
int 0x40
|
||||
mcall
|
||||
mov dword [ypos],42
|
||||
|
||||
cld
|
||||
@@ -471,7 +471,7 @@ loopls:
|
||||
|
||||
mov eax, 70
|
||||
mov ebx, dirinfo
|
||||
int 0x40
|
||||
mcall
|
||||
inc dword [dirinfo+4]
|
||||
cmp ebx, 1
|
||||
jnz ls_end
|
||||
@@ -542,7 +542,7 @@ ls_print:
|
||||
mov edx,filename
|
||||
mov ecx,0x00ddeeff
|
||||
mov esi,12
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,12
|
||||
@@ -618,7 +618,7 @@ chdot:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je nosuchfile
|
||||
@@ -647,7 +647,7 @@ chnodot:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je nosuchfile
|
||||
@@ -667,7 +667,7 @@ lschok:
|
||||
mov edx,tic_table+400
|
||||
mov esi,12
|
||||
mov ecx,0x00ddeeff
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,12
|
||||
@@ -701,7 +701,7 @@ ps:
|
||||
mov eax,9
|
||||
mov ebx,tic_table
|
||||
mov ecx,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov dword [count2],eax
|
||||
|
||||
@@ -710,7 +710,7 @@ ll1:
|
||||
mov eax,9
|
||||
mov ebx,tic_table
|
||||
mov ecx,[pn]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ebx,[tic_table+30]
|
||||
mov dword [fnumb],4
|
||||
@@ -741,7 +741,7 @@ ll1:
|
||||
add ebx,[xpos]
|
||||
mov ecx,0x00ddeeff
|
||||
mov esi,12
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,11
|
||||
@@ -838,7 +838,7 @@ printn:
|
||||
shl edx,16
|
||||
add edx,[xpos]
|
||||
mov esi,0x00ddeeff
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
|
||||
pause2:
|
||||
@@ -847,7 +847,7 @@ pause2:
|
||||
call printf
|
||||
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
red3:
|
||||
cmp eax,2
|
||||
@@ -859,19 +859,19 @@ red3:
|
||||
call red
|
||||
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
jmp red3
|
||||
|
||||
back:
|
||||
mov eax,2
|
||||
int 0x40
|
||||
mcall
|
||||
cmp ah,27
|
||||
je checmd
|
||||
ret
|
||||
|
||||
exit:
|
||||
mov eax,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
checmd:
|
||||
cmp byte [callp],1
|
||||
@@ -894,7 +894,7 @@ err:
|
||||
add ebx,[xpos]
|
||||
mov ecx,0x00ddeeff
|
||||
mov esi,33
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,27
|
||||
@@ -1046,7 +1046,7 @@ gocp1:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je nosuchfile
|
||||
@@ -1125,7 +1125,7 @@ gocp2:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
jne alreadyexist
|
||||
@@ -1135,7 +1135,7 @@ gocp2:
|
||||
mov ecx,tic_table+25000
|
||||
mov edx,dword [filesize]
|
||||
mov esi,0
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,0
|
||||
jne no_ok
|
||||
@@ -1145,7 +1145,7 @@ gocp2:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je no_ok
|
||||
@@ -1289,7 +1289,7 @@ gorn1:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je nosuchfile
|
||||
@@ -1366,7 +1366,7 @@ gorn2:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
jne alreadyexist
|
||||
@@ -1376,7 +1376,7 @@ gorn2:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov dword [filesize],eax
|
||||
|
||||
@@ -1385,7 +1385,7 @@ gorn2:
|
||||
mov ecx,tic_table+25000
|
||||
mov edx,dword [filesize]
|
||||
mov esi,0
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,0
|
||||
jne no_ok1
|
||||
@@ -1395,14 +1395,14 @@ gorn2:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je no_ok1
|
||||
|
||||
mov eax,32
|
||||
mov ebx,tic_table+9000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call newline
|
||||
mov edx,mess14
|
||||
@@ -1504,14 +1504,14 @@ godel:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+25000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je nosuchfile2
|
||||
|
||||
mov eax,32
|
||||
mov ebx,tic_table+400
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call newline
|
||||
mov edx,mess6
|
||||
@@ -1562,7 +1562,7 @@ autoexec:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+15000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je noaxfile
|
||||
@@ -1620,7 +1620,7 @@ strup7:
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,tic_table+15000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,4294967295
|
||||
je nosuchfile3
|
||||
@@ -1755,7 +1755,7 @@ go4:
|
||||
mov ecx,0x00ddeeff
|
||||
mov edx,tic_table+200
|
||||
mov esi,dword [fnumb]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -1795,7 +1795,7 @@ kill:
|
||||
|
||||
mov eax,9
|
||||
mov ebx,tic_table
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,ecx
|
||||
jb nosuchprocess
|
||||
@@ -1803,7 +1803,7 @@ kill:
|
||||
mov eax,18
|
||||
mov ebx,2
|
||||
mov edx,0
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call clearsum
|
||||
call newline
|
||||
@@ -1868,7 +1868,7 @@ gonext13:
|
||||
mov edx,tic_table+300
|
||||
mov ecx,0x00ddeeff
|
||||
mov esi,dword [count]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,dword [count]
|
||||
@@ -1895,7 +1895,7 @@ printf:
|
||||
add ebx,[xpos]
|
||||
mov ecx,0x00ddeeff
|
||||
mov esi,45
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,45
|
||||
@@ -1918,7 +1918,7 @@ printipc:
|
||||
add ebx,[xpos]
|
||||
mov ecx,0x00ddeeff
|
||||
mov esi,79
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,79
|
||||
@@ -2078,7 +2078,7 @@ cls1:
|
||||
mov ebx,6*65536+483
|
||||
mov ecx,24*65536+250
|
||||
mov edx,0
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
|
||||
cls2:
|
||||
@@ -2290,11 +2290,11 @@ no_cls:
|
||||
|
||||
mov eax,18
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,5
|
||||
mov ebx,200
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
no_shutdown:
|
||||
cmp word [tic_table+600],'ps'
|
||||
@@ -2454,17 +2454,17 @@ cmd_ok:
|
||||
mov ebx,1
|
||||
mov ecx,ipcb
|
||||
mov edx,118
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call clearipc
|
||||
|
||||
mov eax,40
|
||||
mov ebx,01000111b
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,23
|
||||
mov ebx,10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,7
|
||||
jne noipc
|
||||
@@ -2478,7 +2478,7 @@ ipccontinue:
|
||||
mov eax,9
|
||||
mov ebx,tic_table+100000
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ecx,eax
|
||||
loopfindipc:
|
||||
@@ -2486,7 +2486,7 @@ loopfindipc:
|
||||
|
||||
mov eax,9
|
||||
mov ebx,tic_table+100000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov bl,[tic_table+600]
|
||||
cmp byte [tic_table+100000+10],bl
|
||||
@@ -2548,7 +2548,7 @@ ipcfinished:
|
||||
mov ecx,dword [ipcpid]
|
||||
mov edx,ddot
|
||||
mov esi,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call newline
|
||||
call clearipc
|
||||
@@ -2576,7 +2576,7 @@ printcmd:
|
||||
mov edx,tic_table+600
|
||||
mov ecx,0x00ddeeff
|
||||
mov esi,dword [count]
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cld
|
||||
mov ecx,dword [count]
|
||||
@@ -2605,10 +2605,10 @@ cmd_ok2:
|
||||
waitipc:
|
||||
mov eax,40
|
||||
mov ebx,01000111b
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,7
|
||||
je ipcok
|
||||
@@ -2623,7 +2623,7 @@ waitipc:
|
||||
|
||||
keyipc:
|
||||
mov eax,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
jmp waitipc
|
||||
|
||||
@@ -2662,7 +2662,7 @@ reipc2:
|
||||
|
||||
ipckey:
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,1
|
||||
je reipc2
|
||||
@@ -2675,7 +2675,7 @@ ipckey:
|
||||
|
||||
ipckeypressed:
|
||||
mov eax,2
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov byte [ipckeyvalue],ah
|
||||
|
||||
@@ -2684,7 +2684,7 @@ ipckeypressed:
|
||||
mov ecx,dword [ipcpid]
|
||||
mov edx,ipckeyvalue
|
||||
mov esi,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call clearipc
|
||||
jmp waitipc
|
||||
@@ -2717,7 +2717,7 @@ cmdexist:
|
||||
mov eax,9
|
||||
mov ebx,tic_table
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ecx,eax
|
||||
loopex:
|
||||
@@ -2725,7 +2725,7 @@ loopex:
|
||||
|
||||
mov eax,9
|
||||
mov ebx,I_END
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp word [I_END+10],'CM'
|
||||
jne no_cmd
|
||||
@@ -2764,7 +2764,7 @@ start_rd_app:
|
||||
mov eax, 70
|
||||
mov ebx, fileinfo_start
|
||||
mov [ebx+8], ecx
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
fileinfo_start:
|
||||
dd 7
|
||||
@@ -2775,8 +2775,7 @@ fileinfo_start:
|
||||
db 0
|
||||
dd fileinfo_buffer
|
||||
|
||||
title:
|
||||
db 'CMD - Command line interpreter',0
|
||||
title db 'CMD - Command line interpreter',0
|
||||
|
||||
smb_cursor db '|'
|
||||
|
||||
|
||||
@@ -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
|
||||
or eax,-1
|
||||
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,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
|
||||
@@ -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 ;�®¤äãªæ¨ï 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' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§ì áᥬ¡«¥à騪®¢!
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- �€—€‹Ž ��Žƒ�€ŒŒ› ----------------------------------------------
|
||||
@@ -108,7 +108,7 @@ draw_window:
|
||||
; mov edi,header ; ‡€ƒŽ‹Ž‚ŽŠ ŽŠ�€
|
||||
; 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,'��ˆŒ…� ��Žƒ�€ŒŒ›',\
|
||||
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: ; � ç «® ¢ë¯®«¥¨ï ¯à®£à ¬¬ë
|
||||
|
||||
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
|
||||
|
||||
; �¨á㥬 ª®¯ªã ¤«ï £¥¥à 樨
|
||||
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
|
||||
|
||||
; � §¢ ¨¥ ª®¯ªã
|
||||
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 ;�®¤äãªæ¨ï 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 "‚‚Ž„ˆŒ›… ‘ˆŒ‚Ž‹› �…�…„€ž’‘Ÿ ŒŽ„…Œ“.",\
|
||||
"„€��›… Ž’ ŒŽ„…Œ€ ‘—ˆ’›‚€ž’‘Ÿ �Ž",\
|
||||
"��…�›‚€�ˆž IRQ4 ˆ Ž’Ž��€†€ž’‘Ÿ �ˆ†…."
|
||||
header:
|
||||
title:
|
||||
db 'ŒŽ„…Œ �€ 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 '�’€ ��Žƒ�€ŒŒ€ ‘އ„€…’ �Ž’ŽŠˆ, ‡€�“‘Š€Ÿ '
|
||||
db 'Ž„ˆ� ˆ ’Ž’ †… ŠŽ„ Œ�ŽƒŽ �€‡. �€Œ �“†�Ž '
|
||||
db '’Ž‹œŠŽ �އ€�Ž’ˆ’œ‘Ÿ Ž� Ž’„…‹œ�ŽŒ ‘’�Š… '
|
||||
db '„‹Ÿ Š€†„ŽƒŽ �Ž’ŽŠ€. '
|
||||
db '�€ŒŸ’œ „‹Ÿ ‚‘…• �Ž’ŽŠŽ‚ Ž�™€Ÿ. '
|
||||
db '�â ¯à®£à ¬¬ á®§¤ ¥â ¯®â®ª¨, § ¯ã᪠ï '
|
||||
db '®¤¨ ¨ â®â ¦¥ ª®¤ ¬®£® à §. � ¬ 㦮 '
|
||||
db '⮫쪮 ¯®§ ¡®â¨âìáï ®¡ ®â¤¥«ì®¬ áâíª¥ '
|
||||
db '¤«ï ª ¦¤®£® ¯®â®ª . '
|
||||
db '� ¬ïâì ¤«ï ¢á¥å ¯®â®ª®¢ ®¡é ï. '
|
||||
db ' '
|
||||
db ' ‘އ„€’œ �Ž‚›‰ �Ž’ŽŠ '
|
||||
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
|
||||
labelt:
|
||||
db '��ˆŒ…� ˆ‘�Ž‹œ‡Ž‚€�ˆŸ 51®© ”“�Š–ˆˆ'
|
||||
labellen:
|
||||
title db '�ਬ¥à ¨á¯®«ì§®¢ ¨ï ¯®â®ª®¢',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:
|
||||
|
||||
@@ -32,6 +32,7 @@ use32
|
||||
dd params,0x0 ; parameters,icon
|
||||
|
||||
include 'lang.inc'
|
||||
include '..\..\..\macros.inc'
|
||||
include 'fasm.inc'
|
||||
|
||||
center fix true
|
||||
@@ -90,7 +91,7 @@ red: ; Redraw
|
||||
still:
|
||||
push 10 ; Wait here for event
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
dec eax
|
||||
je red ; Redraw request
|
||||
dec eax
|
||||
@@ -98,18 +99,18 @@ still:
|
||||
|
||||
key: ; Key
|
||||
mov al,2 ; Read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
jmp still
|
||||
|
||||
button: ; Button in Window
|
||||
|
||||
mov al,17
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1
|
||||
jne noclose
|
||||
or eax,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
noclose:
|
||||
cmp ah,2 ; Start compiling
|
||||
@@ -150,13 +151,13 @@ draw_window:
|
||||
mov ecx,50*65536+250
|
||||
mov edx,[sc.work]
|
||||
or edx,0x33000000
|
||||
mov edi,header ; Draw Window Label Text
|
||||
int 0x40
|
||||
mov edi,title ; Draw Window Label Text
|
||||
mcall
|
||||
|
||||
mcall 9,PROCESSINFO,-1
|
||||
|
||||
mpack ecx,1,1
|
||||
mov ebx,[pinfo.x_size]
|
||||
mov ebx,[pinfo.box.left]
|
||||
sub ebx,10
|
||||
|
||||
push ecx
|
||||
@@ -189,7 +190,7 @@ draw_window:
|
||||
madd ecx, 14,0
|
||||
mcall ,,,0x4000000D ; Button: Enter Path
|
||||
|
||||
mpack ebx,[pinfo.x_size],MAGIC1
|
||||
mpack ebx,[pinfo.box.left],MAGIC1
|
||||
msub ebx,MAGIC1+10+1,0
|
||||
mpack ecx,0, 14*3/2-1
|
||||
madd ecx,1,0
|
||||
@@ -204,13 +205,13 @@ draw_window:
|
||||
mov esi,text.line_size
|
||||
mov eax,4
|
||||
newline:
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx, 14
|
||||
add edx,text.line_size
|
||||
cmp byte[edx],'x'
|
||||
jne newline
|
||||
|
||||
mov ebx,[pinfo.x_size]
|
||||
mov ebx,[pinfo.box.left]
|
||||
sub ebx,MAGIC1+10+1-9
|
||||
shl ebx,16
|
||||
add ebx,1+( 14*3/2-1)/2-3
|
||||
@@ -220,7 +221,7 @@ draw_window:
|
||||
|
||||
mpack ebx,MAGIC1+6,0
|
||||
add ebx,1+ 14/2-3+ 14*0
|
||||
mov esi,[pinfo.x_size]
|
||||
mov esi,[pinfo.box.left]
|
||||
sub esi,MAGIC1*2+5*2+6+3
|
||||
mov eax,esi
|
||||
mov cl,6
|
||||
@@ -246,16 +247,16 @@ bottom_right dd ?
|
||||
|
||||
draw_messages:
|
||||
mov eax,13 ; clear work area
|
||||
mpack ebx,7-2,[pinfo.x_size]
|
||||
mpack ebx,7-2,[pinfo.box.left]
|
||||
sub ebx,5*2+7*2-1-2*2
|
||||
mpack ecx,0,[pinfo.y_size]
|
||||
mpack ecx,0,[pinfo.box.top]
|
||||
madd ecx, 14*3+1+7+1,-( 14*3+1+7*2+25)
|
||||
mov word[bottom_right+2],bx
|
||||
mov word[bottom_right],cx
|
||||
msub [bottom_right],7,11
|
||||
add [bottom_right],7 shl 16 + 53
|
||||
mov edx,[sc.work]
|
||||
int 0x40
|
||||
mcall
|
||||
_cy = 0
|
||||
_sy = 2
|
||||
_cx = 4
|
||||
@@ -360,7 +361,7 @@ f11:mcall 10
|
||||
|
||||
print_text:
|
||||
|
||||
mpack ebx,MAGIC1+6,[pinfo.x_size]
|
||||
mpack ebx,MAGIC1+6,[pinfo.box.left]
|
||||
sub ebx,MAGIC1*2+19
|
||||
movzx esi,bx
|
||||
mov ecx,[ya-2]
|
||||
@@ -487,7 +488,7 @@ start:
|
||||
mov eax,70
|
||||
mov ebx,file_info_start
|
||||
xor ecx,ecx
|
||||
int 0x40
|
||||
mcall
|
||||
@@:
|
||||
jmp exit_program
|
||||
|
||||
@@ -503,7 +504,7 @@ include 'formats.inc'
|
||||
include 'x86_64.inc'
|
||||
include 'tables.inc'
|
||||
|
||||
header db appname,VERSION_STRING,0
|
||||
title db appname,VERSION_STRING,0
|
||||
|
||||
_logo db 'flat assembler version ',VERSION_STRING,13,10,0
|
||||
|
||||
|
||||
@@ -18,64 +18,6 @@ macro draw_caption _edx,_esi {
|
||||
call __draw_caption
|
||||
}
|
||||
|
||||
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 {
|
||||
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 {
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
int 0x40
|
||||
}
|
||||
|
||||
macro sz name,[data] {
|
||||
if used name
|
||||
common
|
||||
label name
|
||||
forward
|
||||
db data
|
||||
common
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] {
|
||||
if used name
|
||||
common
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
db data
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro mmov reg,a1,a2 {
|
||||
mov reg,(a1) shl 16 + (a2)
|
||||
}
|
||||
@@ -109,39 +51,3 @@ macro endf {
|
||||
|
||||
@^ fix macro comment {
|
||||
^@ fix }
|
||||
|
||||
; structure definition helper
|
||||
|
||||
;include '%fasminc%struct.inc'
|
||||
include 'struct.inc'
|
||||
|
||||
; structures used in MeOS
|
||||
struct process_information
|
||||
cpu_usage dd ? ; +0
|
||||
window_stack_position dw ? ; +4
|
||||
window_stack_value dw ? ; +6
|
||||
not_used1 dw ? ; +8
|
||||
process_name db 12 dup(?) ; +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
|
||||
not_used2 db 1024-52 dup(?)
|
||||
ends
|
||||
|
||||
struct 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 ?
|
||||
ends
|
||||
|
||||
@@ -63,7 +63,7 @@ exit_program:
|
||||
cmp [_mode],NORMAL_MODE
|
||||
je still
|
||||
or eax,-1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
make_timestamp:
|
||||
push ebx
|
||||
@@ -144,7 +144,7 @@ open:
|
||||
mov dword [ebx+16], fileinfo
|
||||
mov eax, 70
|
||||
push ebx
|
||||
int 0x40
|
||||
mcall
|
||||
pop ebx
|
||||
test eax, eax
|
||||
jnz .fail
|
||||
@@ -172,7 +172,7 @@ read:
|
||||
mov [ebx+16], edx
|
||||
push ebx
|
||||
mov eax, 70
|
||||
int 0x40
|
||||
mcall
|
||||
xchg eax, [esp]
|
||||
add [eax+4], ebx
|
||||
adc [eax+8], dword 0
|
||||
@@ -201,7 +201,7 @@ write:
|
||||
; mov [filesize],edx
|
||||
; mov eax,58
|
||||
; mov ebx,file_info_write
|
||||
; int 0x40
|
||||
; mcall
|
||||
; popa
|
||||
; ret
|
||||
|
||||
@@ -209,7 +209,7 @@ write:
|
||||
mov [ebx+16], edx
|
||||
push ebx
|
||||
mov eax, 70
|
||||
int 0x40
|
||||
mcall
|
||||
xchg eax, [esp]
|
||||
add [eax+4], ebx
|
||||
adc [eax+8], dword 0
|
||||
@@ -344,7 +344,7 @@ dc1:
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
mov cl,dl
|
||||
int 0x40
|
||||
mcall
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm h2d2b.asm h2d2b
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm h2d2b.asm h2d2b
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -13,7 +13,7 @@
|
||||
dd 0x0 ; адрес буфера для параметров (не используется)
|
||||
dd 0x0 ; зарезервировано
|
||||
|
||||
include 'MACROS.INC' ; ìàêðîñû îáëåã÷àþò æèçíü àññåìáëåðùèêîâ!
|
||||
include '..\..\..\MACROS.INC' ; ìàêðîñû îáëåã÷àþò æèçíü àññåìáëåðùèêîâ!
|
||||
|
||||
|
||||
START:
|
||||
@@ -37,7 +37,7 @@ still:
|
||||
|
||||
key: ; нажата клавиша на клавиатуре
|
||||
mov eax, 2
|
||||
int 0x40
|
||||
mcall
|
||||
mov edi, [index]
|
||||
cmp edi, string1
|
||||
jz no_back
|
||||
@@ -147,7 +147,7 @@ next_digit:
|
||||
draw_window:
|
||||
;------------------------------------------------
|
||||
mcall 12, 1
|
||||
mcall 0, 200*65536+300, 200*65536+175, 0x13AABBCC,,header
|
||||
mcall 0, 200*65536+300, 200*65536+175, 0x13AABBCC,,title
|
||||
|
||||
mcall 8, 15 *65536+ 38, 90*65536+ 15, 2, 0x6688DD ; кнопка shl
|
||||
mcall , ,110*65536+ 15, , ; кнопка sal
|
||||
@@ -239,7 +239,7 @@ string1_end:
|
||||
num dd 0
|
||||
|
||||
|
||||
header db 'hex2dec2bin 0.2',0
|
||||
title db 'hex2dec2bin 0.2',0
|
||||
minus db '-'
|
||||
numstr db 'Number:',0
|
||||
hexstr db 'hex:',0
|
||||
|
||||
@@ -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 heed.asm heed
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm heed.asm heed
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -23,21 +23,23 @@ KEY_ENDBOTTOM equ 253 ;Ctrl + ']'
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
include '..\..\..\macros.inc'
|
||||
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
mov eax,40
|
||||
mov ebx,100111b ;event mouse
|
||||
int 0x40
|
||||
mcall
|
||||
mov dword [process_info+42],540
|
||||
mov dword [process_info+46],414
|
||||
|
||||
red:
|
||||
call draw_window
|
||||
|
||||
still:
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
dec al ; redraw request ?
|
||||
je red
|
||||
dec al ; key in buffer ?
|
||||
@@ -48,20 +50,17 @@ still:
|
||||
mouse:
|
||||
mov eax,37
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mcall
|
||||
or eax,eax
|
||||
jz still
|
||||
cmp [menu_opened],1
|
||||
jne still
|
||||
mov [menu_opened],0
|
||||
|
||||
red: ; redraw
|
||||
call redraw_window
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2
|
||||
int 0x40
|
||||
mcall
|
||||
; test al,al
|
||||
; jnz still
|
||||
cmp ah,KEY_ESC
|
||||
@@ -230,18 +229,18 @@ still:
|
||||
or edx,edi
|
||||
mov eax,47
|
||||
add edx,8
|
||||
int 0x40
|
||||
mcall
|
||||
call redraw_window
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
mcall
|
||||
dec ah ;close programm button
|
||||
jne @f
|
||||
close:
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
@@:
|
||||
dec ah
|
||||
jne @f
|
||||
@@ -383,7 +382,7 @@ still:
|
||||
xor ecx,ecx
|
||||
or edx,-1
|
||||
mov esi,0x10000
|
||||
int 0x40
|
||||
mcall
|
||||
inc [o_s_flag]
|
||||
mov [sizefile],eax
|
||||
jmp end_Go
|
||||
@@ -395,7 +394,7 @@ still:
|
||||
xor esi,esi
|
||||
dec edx
|
||||
mov eax,33
|
||||
int 0x40
|
||||
mcall
|
||||
end_Go:
|
||||
call CtrlHome
|
||||
jmp still
|
||||
@@ -646,7 +645,7 @@ output_screen:
|
||||
sub edx,0x10
|
||||
mov esi,0x10
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
pop eax
|
||||
pop ecx
|
||||
loop @b
|
||||
@@ -668,7 +667,7 @@ form_str:
|
||||
add edx,[esp+0x24] ; ç «® ¯® “
|
||||
mov esi,0x00ffffff ;梥â
|
||||
mov eax,47 ;¢ë¢¥á⨠ç¨á«®
|
||||
int 0x40
|
||||
mcall
|
||||
add edx,0x600000 ;0x40 - 8chars + 0x20 - space
|
||||
mov ebx,0x20100 ;2 æ¨äàë, 16-à¨çë¥, ç¨á«® ¢ ecx
|
||||
@@:
|
||||
@@ -677,7 +676,7 @@ form_str:
|
||||
and ecx,0xff
|
||||
cmp edi,0x11
|
||||
jz endstr
|
||||
int 0x40
|
||||
mcall
|
||||
add edx,0x100000
|
||||
jmp @b
|
||||
endstr:
|
||||
@@ -695,12 +694,12 @@ draw_cursor:
|
||||
mov ecx,[esp+0x24]
|
||||
mov edx,[color]
|
||||
mov eax,13
|
||||
int 0x40
|
||||
mcall
|
||||
movzx edi,[o_s_flag]
|
||||
and edi,8
|
||||
jnz @f
|
||||
add ebx,[text_cursor]
|
||||
int 0x40
|
||||
mcall
|
||||
@@:
|
||||
popad
|
||||
ret 4
|
||||
@@ -731,13 +730,13 @@ menufile:
|
||||
mov ecx,[sc.work_button_text]
|
||||
or ecx,0x10000000
|
||||
sub eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,0x0c ;next full base text
|
||||
add edx,4 ;next string
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,0x0c
|
||||
add edx,4
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
|
||||
menucoding:
|
||||
@@ -759,7 +758,7 @@ menucoding:
|
||||
or ecx,0x10000000
|
||||
sub eax,4
|
||||
@@:
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,0x0c
|
||||
add edx,8 ;next string
|
||||
dec edi
|
||||
@@ -782,11 +781,11 @@ menuhelp:
|
||||
mov ecx,[sc.work_button_text]
|
||||
or ecx,0x10000000
|
||||
sub eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,0x0c
|
||||
inc esi ;add lebgth output text
|
||||
add edx,4
|
||||
int 0x40
|
||||
mcall
|
||||
ret
|
||||
|
||||
f1:;uses for drawing low-level menu buttons
|
||||
@@ -798,7 +797,7 @@ f1:;uses for drawing low-level menu buttons
|
||||
push ecx ;for output text
|
||||
@@:
|
||||
add ecx,0xc0000
|
||||
int 0x40
|
||||
mcall
|
||||
inc edx ;id
|
||||
dec edi ;counter
|
||||
jnz @b
|
||||
@@ -819,7 +818,7 @@ debug:
|
||||
mov edx,0x10000a0
|
||||
mov eax,47
|
||||
mov esi,0x00ffffff
|
||||
int 0x40
|
||||
mcall
|
||||
popad
|
||||
ret 4
|
||||
|
||||
@@ -833,11 +832,11 @@ draw_window:
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
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
|
||||
; [x start] *65536 + [x size]
|
||||
@@ -845,7 +844,7 @@ draw_window:
|
||||
; [y start] *65536 + [y size]
|
||||
mov ecx,[process_info+46]
|
||||
mov 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]
|
||||
@@ -853,7 +852,7 @@ draw_window:
|
||||
or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB )
|
||||
mov edx,labelt ; pointer to text beginning
|
||||
mov esi,labellen-labelt ; text length
|
||||
int 0x40
|
||||
mcall
|
||||
;check for only header window output
|
||||
cmp dword [process_info+46],25
|
||||
jle minimaze_view
|
||||
@@ -873,7 +872,7 @@ draw_window:
|
||||
shl ecx,0x10
|
||||
mov eax,13
|
||||
add ecx,0x10
|
||||
int 0x40
|
||||
mcall
|
||||
;MENU BUTTONS
|
||||
;now in hi-half ecx register begin Y-coord. menu area
|
||||
;in hi-half ebx begin X-coord.
|
||||
@@ -888,18 +887,18 @@ draw_window:
|
||||
mov [xf_menu],ebx;for low-level menus func.
|
||||
mov eax,8
|
||||
push ebx ;for output buttons texts
|
||||
int 0x40
|
||||
mcall
|
||||
;registers is't change
|
||||
;menu 'Coding'
|
||||
add ebx,0x290018 ;80x12
|
||||
inc edx ;menu 'coding' id = 3
|
||||
mov [xe_menu],ebx;for low-level menus func.
|
||||
int 0x40
|
||||
mcall
|
||||
;menu 'Help'
|
||||
add ebx,0x40ffe8 ;+0x280000 - 0x28, 40x12
|
||||
inc edx ;menu 'Help' id = 4
|
||||
mov [xh_menu],ebx;for low-level menus func.
|
||||
int 0x40
|
||||
mcall
|
||||
;MENU BUTTONS TEXTS
|
||||
;'File'
|
||||
pop ebx
|
||||
@@ -914,7 +913,7 @@ draw_window:
|
||||
mov ecx,[sc.work_button_text]
|
||||
or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB )
|
||||
push esi ;for 'Help' menu text
|
||||
int 0x40
|
||||
mcall
|
||||
;'coding'
|
||||
;registers is't change
|
||||
add ebx,0x2d0000
|
||||
@@ -922,14 +921,14 @@ draw_window:
|
||||
add esi,2
|
||||
; mov edx,e_menu
|
||||
add edx,4
|
||||
int 0x40
|
||||
mcall
|
||||
;'Help'
|
||||
add ebx,0x3b0000
|
||||
; mov esi,4
|
||||
pop esi
|
||||
; mov edx,h_menu
|
||||
add edx,6
|
||||
int 0x40
|
||||
mcall
|
||||
;LOW_LEVEL MENU
|
||||
;for every hi-level menu exists one procedure
|
||||
;in begin programm they are not calls,
|
||||
@@ -951,7 +950,7 @@ draw_window:
|
||||
shl ecx,16 ;y start
|
||||
mov eax,13
|
||||
add ecx,20
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
;filename input area
|
||||
; mov ecx,[process_info+46]
|
||||
@@ -966,7 +965,7 @@ draw_window:
|
||||
add ecx,16
|
||||
mov eax,13
|
||||
push ecx ;for button 'Go'
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
;button 'Go', press in case open/save if filename input complete
|
||||
;button size = 24x16
|
||||
@@ -976,7 +975,7 @@ draw_window:
|
||||
dec ecx
|
||||
mov edx,0xff ;id
|
||||
mov esi,[sc.work_button]
|
||||
int 0x40
|
||||
mcall
|
||||
shr ecx,0x10
|
||||
and ebx,0xffff0000
|
||||
add ecx,0x50004
|
||||
@@ -986,7 +985,7 @@ draw_window:
|
||||
mov ecx,[sc.work_button_text]
|
||||
or ecx,0x10000000
|
||||
sub eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
;where output cursor?
|
||||
mov al,[o_s_flag]
|
||||
@@ -1011,7 +1010,7 @@ draw_window:
|
||||
add ebx,eax
|
||||
movzx esi,[name_l]
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
;info strings
|
||||
; sizefile text
|
||||
@@ -1024,13 +1023,13 @@ draw_window:
|
||||
mov edx,sizestr ; pointer to text beginning
|
||||
mov eax,4
|
||||
mov esi,5
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,0x00530000
|
||||
inc esi
|
||||
; mov edx,offst
|
||||
add edx,5
|
||||
inc esi
|
||||
int 0x40
|
||||
mcall
|
||||
;sizefile
|
||||
mov ecx,[sizefile]
|
||||
mov edx,ebx
|
||||
@@ -1038,10 +1037,10 @@ draw_window:
|
||||
sub edx,0x00350000
|
||||
mov eax,47
|
||||
mov ebx,0x80100
|
||||
int 0x40
|
||||
mcall
|
||||
mov ecx,[current]
|
||||
add edx,0x005f0000
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
push [text_cursor] ;íâ® ¯®§¨æ¨ï ªãàá®à ¢ ⥪á⮢®© áâப¥
|
||||
call draw_cursor
|
||||
@@ -1052,7 +1051,7 @@ draw_window:
|
||||
minimaze_view:
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
popad
|
||||
ret
|
||||
|
||||
@@ -1066,7 +1065,7 @@ get_process_info:
|
||||
mov ebx,process_info
|
||||
xor ecx,ecx
|
||||
dec ecx
|
||||
int 0x40
|
||||
mcall
|
||||
popad
|
||||
ret
|
||||
|
||||
@@ -1104,7 +1103,7 @@ create_process:
|
||||
mov ecx,[esp+0x24]
|
||||
inc ebx
|
||||
mov edx,0x7E000 ;0x1000
|
||||
int 0x40
|
||||
mcall
|
||||
popad
|
||||
ret 4
|
||||
|
||||
@@ -1112,7 +1111,7 @@ help_thread:
|
||||
call help_window
|
||||
help_still:
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
dec eax
|
||||
jz help_red
|
||||
dec eax
|
||||
@@ -1126,35 +1125,35 @@ help_thread:
|
||||
help_key:
|
||||
inc eax
|
||||
inc eax
|
||||
int 0x40
|
||||
mcall
|
||||
jmp help_still
|
||||
help_button:
|
||||
mov eax,17
|
||||
int 0x40
|
||||
mcall
|
||||
dec ah
|
||||
jne help_still
|
||||
shr eax,8
|
||||
dec eax
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
help_window:
|
||||
pushad
|
||||
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,0x500140 ; [x start] *65536 + [x size]
|
||||
mov ecx,0x700110 ; [y start] *65536 + [y size]
|
||||
mov 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,0x10ffffff ; font 1 & color ( 0xF0RRGGBB )
|
||||
mov edx,help_label ; pointer to text beginning
|
||||
mov esi,14 ; text length
|
||||
int 0x40
|
||||
mcall
|
||||
; HELP TEXT
|
||||
add edx,14 ;help_text addr.
|
||||
add esi,37 ; = 51 - length 1 line
|
||||
@@ -1162,7 +1161,7 @@ help_window:
|
||||
mov edi,(help_end-help_text)/51
|
||||
@@:
|
||||
add ebx,0x10
|
||||
int 0x40
|
||||
mcall
|
||||
add edx,51
|
||||
dec edi
|
||||
jnz @b
|
||||
@@ -1170,7 +1169,7 @@ help_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
popad
|
||||
ret
|
||||
|
||||
@@ -1178,7 +1177,7 @@ about_thread:
|
||||
call about_window
|
||||
about_still:
|
||||
mov eax,10
|
||||
int 0x40
|
||||
mcall
|
||||
dec eax
|
||||
jz about_red
|
||||
dec eax
|
||||
@@ -1192,28 +1191,28 @@ about_thread:
|
||||
about_key:
|
||||
inc eax
|
||||
inc eax
|
||||
int 0x40
|
||||
mcall
|
||||
jmp about_still
|
||||
about_button:
|
||||
mov eax,17
|
||||
int 0x40
|
||||
mcall
|
||||
dec ah
|
||||
jne about_still
|
||||
shr eax,8
|
||||
dec eax
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
about_window:
|
||||
pushad
|
||||
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,0x500140 ; [x start] *65536 + [x size]
|
||||
mov ecx,0x700110 ; [y start] *65536 + [y size]
|
||||
mov 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]
|
||||
@@ -1221,7 +1220,7 @@ about_window:
|
||||
or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB )
|
||||
mov edx,about_label ; pointer to text beginning
|
||||
mov esi,17 ; text length
|
||||
int 0x40
|
||||
mcall
|
||||
; ABOUT TEXT
|
||||
add edx,17 ;about_text addr.
|
||||
add esi,34 ; = 51 - length 1 line
|
||||
@@ -1229,14 +1228,14 @@ about_window:
|
||||
mov edi,15
|
||||
@@:
|
||||
add ebx,0x10
|
||||
int 0x40
|
||||
mcall
|
||||
add edx,51
|
||||
dec edi
|
||||
jnz @b
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
@@ -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 hexview.asm hexview
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm hexview.asm hexview
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -17,7 +17,7 @@ use32
|
||||
dd 0x00000000 ; reserved=no extended header
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
include '..\..\..\macros.inc'
|
||||
|
||||
begin dd 0
|
||||
|
||||
@@ -31,7 +31,7 @@ red:
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
dec eax ; redraw request ?
|
||||
je red
|
||||
@@ -48,12 +48,12 @@ 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,3
|
||||
jne no_up
|
||||
@@ -72,9 +72,8 @@ still:
|
||||
|
||||
dec ah ; button id=1 ?
|
||||
jne still
|
||||
xor eax,eax ; close this program
|
||||
dec eax
|
||||
int 0x40
|
||||
or eax,-1 ; close this program
|
||||
mcall
|
||||
|
||||
|
||||
; *********************************************
|
||||
@@ -86,40 +85,32 @@ 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
|
||||
mov ebx,100*65536+400 ; [x start] *65536 + [x size]
|
||||
mov ecx,100*65536+270 ; [y start] *65536 + [y size]
|
||||
mov edx,0x03224466 ; color of work area RRGGBB,8->c
|
||||
mov esi,0x006688aa ; color of grab bar RRGGBB,8->color gl
|
||||
mov edi,0x00ffffff ; 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,0x00ffffff ; color of text RRGGBB
|
||||
mov edx,labelt ; pointer to text beginning
|
||||
mov esi,labellen-labelt ; text length
|
||||
int 0x40
|
||||
mov edx,0x13224466 ; color of work area RRGGBB,8->c
|
||||
mov edi,title ; WINDOW LABEL
|
||||
mcall
|
||||
|
||||
|
||||
mov eax,8
|
||||
mov ebx,280*65536+16*6
|
||||
mov ecx,240*65536+14
|
||||
mov edx,2
|
||||
mov esi,0x5599cc
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ebx,15*65536+125
|
||||
inc edx
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
add ebx,127*65536
|
||||
inc edx
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
mov eax,4
|
||||
@@ -127,7 +118,7 @@ draw_window:
|
||||
mov ecx,0xffffff
|
||||
mov edx,buttons
|
||||
mov esi,blen-buttons
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
mov ebx,280*65536+35 ; draw info text with function 4
|
||||
@@ -156,7 +147,7 @@ push edi
|
||||
|
||||
; mov ebx,0x00020101
|
||||
; mov esi,0xffff00
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
add edx,16*65536
|
||||
inc ecx
|
||||
@@ -171,7 +162,7 @@ pop ebx
|
||||
mov eax,4 ; text
|
||||
mov esi,16
|
||||
mov ecx,0xffffff
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,12
|
||||
add edx,16
|
||||
dec edi
|
||||
@@ -179,7 +170,7 @@ pop ebx
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -197,7 +188,7 @@ open_file:
|
||||
xor ecx,ecx
|
||||
mov edx,-1
|
||||
mov esi,text
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
popa
|
||||
|
||||
@@ -207,8 +198,7 @@ open_file:
|
||||
|
||||
; DATA AREA
|
||||
|
||||
labelt: db 'HEXVIEW'
|
||||
labellen:
|
||||
title db 'HEXVIEW',0
|
||||
|
||||
buttons db ' UP DOWN'
|
||||
db ' EXAMPLE '
|
||||
|
||||
@@ -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 keyascii.asm keyascii
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm keyascii.asm keyascii
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -15,7 +15,7 @@ use32
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
include '..\..\..\macros.inc'
|
||||
|
||||
START: ; start of execution
|
||||
red:
|
||||
@@ -24,7 +24,7 @@ START: ; start of execution
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je red
|
||||
@@ -37,20 +37,20 @@ still:
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
mov [keyid],ah
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne noclose
|
||||
|
||||
or eax,-1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
noclose:
|
||||
|
||||
jmp still
|
||||
@@ -68,39 +68,39 @@ 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+270 ; [x start] *65536 + [x size]
|
||||
mov ecx,100*65536+80 ; [y start] *65536 + [y size]
|
||||
mov edx,0x33ffffff ; color of work area RRGGBB,8->color gl
|
||||
mov edi,header
|
||||
int 0x40
|
||||
mov edi,title
|
||||
mcall
|
||||
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
xor ecx,ecx
|
||||
mov esi,4
|
||||
mov ebx,8*65536+8
|
||||
mov edx,tdec
|
||||
int 0x40
|
||||
mcall
|
||||
add ebx,23
|
||||
mov edx,thex
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov ecx,[keyid]
|
||||
mov eax,47
|
||||
mov ebx,3*65536
|
||||
mov edx,40*65536+8
|
||||
mov esi,0x224466
|
||||
int 0x40
|
||||
mcall
|
||||
add edx,23
|
||||
mov bh,1
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -109,7 +109,7 @@ draw_window:
|
||||
|
||||
tdec: db 'DEC:'
|
||||
thex: db 'HEX:'
|
||||
header db 'KEYBOARD ASCIICODES-PRESS ANY KEY',0
|
||||
title db 'KEYBOARD ASCIICODES-PRESS ANY KEY',0
|
||||
keyid: db 0
|
||||
I_END:
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
format binary
|
||||
include '..\..\macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
@@ -67,14 +68,14 @@ start:
|
||||
push 40
|
||||
pop eax
|
||||
mov ebx, 0x107
|
||||
int 40h
|
||||
mcall
|
||||
; set debug messages buffer
|
||||
mov ecx, dbgbufsize
|
||||
mov dword [ecx], 256
|
||||
xor ebx, ebx
|
||||
mov [ecx+4], ebx
|
||||
mov al, 69
|
||||
int 40h
|
||||
mcall
|
||||
mov esi, i_param
|
||||
call skip_spaces
|
||||
test al, al
|
||||
@@ -89,7 +90,7 @@ dodraw:
|
||||
waitevent:
|
||||
push 10
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
cmp al, 9
|
||||
jz debugmsg
|
||||
dec eax
|
||||
@@ -101,10 +102,10 @@ waitevent:
|
||||
; button pressed - we have only one button (close)
|
||||
push -1
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
keypressed:
|
||||
mov al, 2
|
||||
int 40h
|
||||
mcall
|
||||
shr eax, 8
|
||||
cmp al, 8
|
||||
jz .backspace
|
||||
@@ -334,7 +335,7 @@ clear_cmdline_end:
|
||||
or ebx, ecx
|
||||
mov ecx, cmdline_y_pos*10000h + cmdline_y_size
|
||||
mov edx, 0xFFFFFF
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
|
||||
draw_cmdline:
|
||||
@@ -353,7 +354,7 @@ draw_cmdline_end:
|
||||
add ebx, cmdline_x_pos
|
||||
shl ebx, 16
|
||||
or ebx, cmdline_y_pos+1
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
|
||||
put_message_nodraw:
|
||||
@@ -449,7 +450,7 @@ draw_messages:
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, messages_x_pos*10000h+messages_x_size
|
||||
mov ecx, messages_y_pos*10000h+messages_y_size
|
||||
int 40h
|
||||
mcall
|
||||
mov edx, messages
|
||||
push messages_width
|
||||
pop esi
|
||||
@@ -457,7 +458,7 @@ draw_messages:
|
||||
mov al, 4
|
||||
mov ebx, messages_x_pos*10000h+messages_y_pos
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
add edx, esi
|
||||
add ebx, 10
|
||||
cmp edx, messages+messages_width*messages_height
|
||||
@@ -475,7 +476,7 @@ draw_cursor:
|
||||
shl ebx, 16
|
||||
or ebx, edx
|
||||
xor edx, edx
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
hide_cursor:
|
||||
mov ebx, [cmdline_pos]
|
||||
@@ -487,7 +488,7 @@ hide_cursor:
|
||||
inc ebx
|
||||
mov ecx, cmdline_y_pos*10000h + cmdline_y_size
|
||||
mov edx, 0xFFFFFF
|
||||
int 40h
|
||||
mcall
|
||||
mov ebx, [cmdline_pos]
|
||||
cmp ebx, [cmdline_len]
|
||||
jae .ret
|
||||
@@ -500,7 +501,7 @@ hide_cursor:
|
||||
or ebx, cmdline_y_pos+1
|
||||
push 1
|
||||
pop esi
|
||||
int 40h
|
||||
mcall
|
||||
.ret:
|
||||
ret
|
||||
|
||||
@@ -510,13 +511,13 @@ redraw_title:
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, title_x_pos*10000h + data_x_pos+data_x_size-title_x_pos
|
||||
mov ecx, title_y_pos*10000h + title_y_size
|
||||
int 40h
|
||||
mcall
|
||||
draw_title:
|
||||
mov al, 38
|
||||
mov ebx, (data_x_pos-2)*10000h + title_x_pos-5
|
||||
mov ecx, (title_y_pos+5)*10001h
|
||||
xor edx, edx
|
||||
int 40h
|
||||
mcall
|
||||
push NoPrgLoaded_len
|
||||
pop esi
|
||||
cmp [debuggee_pid], 0
|
||||
@@ -530,9 +531,9 @@ draw_title:
|
||||
jz @f
|
||||
add ebx, 6
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
mov ebx, (data_x_pos+data_x_size-10+4)*0x10000 + data_x_pos+data_x_size+2
|
||||
int 40h
|
||||
mcall
|
||||
mov al, 4
|
||||
mov ebx, title_x_pos*10000h+title_y_pos
|
||||
xor ecx, ecx
|
||||
@@ -541,7 +542,7 @@ draw_title:
|
||||
jz @f
|
||||
mov edx, [prgname_ptr]
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
cmp [debuggee_pid], 0
|
||||
jz .nodebuggee
|
||||
mov ebx, (data_x_pos+data_x_size-10-6*7)*10000h + title_y_pos
|
||||
@@ -554,7 +555,7 @@ draw_title:
|
||||
mov edx, aPaused
|
||||
dec esi
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
.nodebuggee:
|
||||
mov al, 38
|
||||
@@ -584,14 +585,14 @@ draw_register:
|
||||
.cd:
|
||||
push 4
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
imul esi, 60000h
|
||||
lea edx, [ebx+esi]
|
||||
mov al, 47
|
||||
mov ebx, 80101h
|
||||
mov esi, ecx
|
||||
pop ecx
|
||||
int 40h
|
||||
mcall
|
||||
lea ebx, [edx+60000h*18]
|
||||
mov esi, ecx
|
||||
pop ecx
|
||||
@@ -622,7 +623,7 @@ draw_flag:
|
||||
mov ecx, 0x00AA00
|
||||
.doit:
|
||||
mov ah, 0
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
|
||||
redraw_registers:
|
||||
@@ -631,7 +632,7 @@ redraw_registers:
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, data_x_pos*10000h + data_x_size
|
||||
mov ecx, registers_y_pos*10000h + registers_y_size
|
||||
int 40h
|
||||
mcall
|
||||
draw_registers:
|
||||
mov esi, _eax
|
||||
push 4
|
||||
@@ -672,7 +673,7 @@ draw_registers:
|
||||
xor esi, esi
|
||||
inc esi
|
||||
mov ebx, (registers_x_pos+37*6)*10000h + registers_y_pos+20
|
||||
int 40h
|
||||
mcall
|
||||
mov edx, flags
|
||||
@@:
|
||||
add ebx, 2*6*10000h
|
||||
@@ -688,7 +689,7 @@ redraw_dump:
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, data_x_pos*10000h + data_x_size
|
||||
mov ecx, dump_y_pos*10000h + dump_y_size
|
||||
int 40h
|
||||
mcall
|
||||
draw_dump:
|
||||
; addresses
|
||||
mov al, 47
|
||||
@@ -702,7 +703,7 @@ draw_dump:
|
||||
jz @f
|
||||
xor esi, esi
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
add ecx, 10h
|
||||
add edx, 10
|
||||
cmp dl, dump_y_pos + dump_y_size
|
||||
@@ -716,7 +717,7 @@ draw_dump:
|
||||
cmp [dumpread], edi
|
||||
jz .hexdumpdone1
|
||||
.hexdumploop1:
|
||||
int 40h
|
||||
mcall
|
||||
add edx, 3*6*10000h
|
||||
inc ecx
|
||||
inc edi
|
||||
@@ -740,7 +741,7 @@ draw_dump:
|
||||
.hexdumploop2:
|
||||
cmp edi, dump_height*10h
|
||||
jae .hexdumpdone2
|
||||
int 40h
|
||||
mcall
|
||||
add ebx, 3*6*10000h
|
||||
inc edi
|
||||
test edi, 15
|
||||
@@ -757,14 +758,14 @@ draw_dump:
|
||||
mov ebx, (data_x_pos+8*6)*10000h + dump_y_pos
|
||||
mov edx, aColon
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
add ebx, 10
|
||||
cmp bl, dump_y_pos+dump_height*10
|
||||
jb @b
|
||||
mov ebx, (data_x_pos+(12+3*8)*6)*10000h + dump_y_pos
|
||||
mov edx, aMinus
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
add ebx, 10
|
||||
cmp bl, dump_y_pos+dump_height*10
|
||||
jb @b
|
||||
@@ -778,7 +779,7 @@ draw_dump:
|
||||
jae @f
|
||||
mov edx, aPoint
|
||||
@@:
|
||||
int 40h
|
||||
mcall
|
||||
pop edx
|
||||
inc edx
|
||||
add ebx, 6*10000h
|
||||
@@ -797,7 +798,7 @@ redraw_disasm:
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, data_x_pos*10000h + data_x_size
|
||||
mov ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1)
|
||||
int 40h
|
||||
mcall
|
||||
draw_disasm:
|
||||
mov eax, [disasm_start_pos]
|
||||
mov [disasm_cur_pos], eax
|
||||
@@ -820,7 +821,7 @@ draw_disasm:
|
||||
push 13
|
||||
pop eax
|
||||
mov edx, 0xFF0000
|
||||
int 40h
|
||||
mcall
|
||||
.nored:
|
||||
mov eax, [_eip]
|
||||
cmp eax, ebp
|
||||
@@ -828,7 +829,7 @@ draw_disasm:
|
||||
push 13
|
||||
pop eax
|
||||
mov edx, 0x0000FF
|
||||
int 40h
|
||||
mcall
|
||||
mov esi, 0xFFFFFF ; on blue bgr, use white color
|
||||
.noblue:
|
||||
push 47
|
||||
@@ -838,14 +839,14 @@ draw_disasm:
|
||||
imul edx, 10
|
||||
add edx, data_x_pos*10000h + disasm_y_pos
|
||||
mov ecx, ebp
|
||||
int 40h
|
||||
mcall
|
||||
mov al, 4
|
||||
lea ebx, [edx+8*6*10000h]
|
||||
mov ecx, esi
|
||||
push 1
|
||||
pop esi
|
||||
mov edx, aColon
|
||||
int 40h
|
||||
mcall
|
||||
push 9
|
||||
pop edi
|
||||
lea edx, [ebx+2*6*10000h]
|
||||
@@ -856,7 +857,7 @@ draw_disasm:
|
||||
sub ecx, [disasm_start_pos]
|
||||
add ecx, disasm_buffer
|
||||
.drawhex:
|
||||
int 40h
|
||||
mcall
|
||||
add edx, 6*3*10000h
|
||||
inc ecx
|
||||
inc ebp
|
||||
@@ -876,7 +877,7 @@ draw_disasm:
|
||||
push 3
|
||||
pop esi
|
||||
mov edx, aDots
|
||||
int 40h
|
||||
mcall
|
||||
mov esi, ecx
|
||||
.hexdone:
|
||||
xor eax, eax
|
||||
@@ -891,7 +892,7 @@ draw_disasm:
|
||||
imul ebx, 10
|
||||
add ebx, (data_x_pos+6*40)*10000h+disasm_y_pos
|
||||
mov al, 4
|
||||
int 40h
|
||||
mcall
|
||||
inc [disasm_cur_str]
|
||||
cmp [disasm_cur_str], disasm_height
|
||||
jb .loop
|
||||
@@ -927,7 +928,7 @@ update_disasm:
|
||||
mov edi, disasm_buffer
|
||||
mov edx, 256
|
||||
mov esi, [disasm_start_pos]
|
||||
int 40h
|
||||
mcall
|
||||
cmp eax, -1
|
||||
jnz @f
|
||||
mov esi, read_mem_err
|
||||
@@ -945,13 +946,13 @@ draw_window:
|
||||
pop eax
|
||||
push 1
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
; define window
|
||||
xor eax, eax
|
||||
mov ebx, wnd_x_size
|
||||
mov ecx, wnd_y_size
|
||||
mov edx, 3FFFFFFh
|
||||
int 40h
|
||||
mcall
|
||||
; caption
|
||||
mov al, 4
|
||||
mov ecx, 0xFFFFFF
|
||||
@@ -959,34 +960,34 @@ draw_window:
|
||||
mov edx, caption_str
|
||||
push caption_len
|
||||
pop esi
|
||||
int 40h
|
||||
mcall
|
||||
; messages frame
|
||||
mov al, 38
|
||||
mov ebx, (messages_x_pos-2)*10000h + (messages_x_pos+messages_x_size+2)
|
||||
push ebx
|
||||
mov ecx, (messages_y_pos-2)*10001h
|
||||
xor edx, edx
|
||||
int 40h
|
||||
mcall
|
||||
mov ecx, (messages_y_pos+messages_y_size+2)*10001h
|
||||
int 40h
|
||||
mcall
|
||||
mov ebx, (messages_x_pos-2)*10001h
|
||||
push ebx
|
||||
mov ecx, (messages_y_pos-2)*10000h + (messages_y_pos+messages_y_size+2)
|
||||
int 40h
|
||||
mcall
|
||||
mov ebx, (messages_x_pos+messages_x_size+2)*10001h
|
||||
push ebx
|
||||
int 40h
|
||||
mcall
|
||||
; command line frame
|
||||
mov ecx, (cmdline_y_pos-2)*10000h + (cmdline_y_pos+cmdline_y_size+2)
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
pop ebx
|
||||
mov ecx, (cmdline_y_pos+cmdline_y_size+2)*10001h
|
||||
int 40h
|
||||
mcall
|
||||
mov ecx, (cmdline_y_pos-2)*10001h
|
||||
int 40h
|
||||
mcall
|
||||
; messages
|
||||
call draw_messages
|
||||
; command line & cursor
|
||||
@@ -996,14 +997,14 @@ draw_window:
|
||||
mov al, 38
|
||||
mov ebx, (data_x_pos-2)*10001h
|
||||
mov ecx, (title_y_pos+5)*10000h + (messages_y_pos-2)
|
||||
int 40h
|
||||
mcall
|
||||
mov ebx, (data_x_pos+data_x_size+2)*10001h
|
||||
int 40h
|
||||
mcall
|
||||
mov ebx, (data_x_pos-2)*10000h + (data_x_pos+data_x_size+2)
|
||||
mov ecx, (dump_y_pos-3)*10001h
|
||||
int 40h
|
||||
mcall
|
||||
mov ecx, (disasm_y_pos-4)*10001h
|
||||
int 40h
|
||||
mcall
|
||||
call draw_title
|
||||
call draw_registers
|
||||
call draw_dump
|
||||
@@ -1012,7 +1013,7 @@ draw_window:
|
||||
mov al, 12
|
||||
push 2
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -1037,7 +1038,7 @@ OnHelp:
|
||||
OnQuit:
|
||||
xor eax, eax
|
||||
dec eax
|
||||
int 40h
|
||||
mcall
|
||||
|
||||
get_new_context:
|
||||
mov esi, context
|
||||
@@ -1053,7 +1054,7 @@ get_context:
|
||||
mov esi, context
|
||||
push 28h
|
||||
pop edx
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
set_context:
|
||||
push 2
|
||||
@@ -1064,7 +1065,7 @@ set_context:
|
||||
mov esi, context
|
||||
push 28h
|
||||
pop edx
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
|
||||
get_dump:
|
||||
@@ -1080,7 +1081,7 @@ get_dump:
|
||||
mov al, 69
|
||||
push 6
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
cmp eax, -1
|
||||
jnz @f
|
||||
mov esi, read_mem_err
|
||||
@@ -1141,13 +1142,13 @@ do_reload:
|
||||
pop eax
|
||||
push 7
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
mov [dbgwnd], eax
|
||||
xchg ecx, eax
|
||||
push 70
|
||||
pop eax
|
||||
mov ebx, fn70_load_block
|
||||
int 40h
|
||||
mcall
|
||||
test eax, eax
|
||||
jns .load_ok
|
||||
.load_err:
|
||||
@@ -1180,7 +1181,7 @@ do_reload:
|
||||
mov bl, 3
|
||||
push 18
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
call redraw_title
|
||||
call redraw_registers
|
||||
call get_dump
|
||||
@@ -1273,24 +1274,24 @@ do_reload:
|
||||
pop eax
|
||||
push 7
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
.wait:
|
||||
push 10
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
dec eax
|
||||
jz .redraw
|
||||
dec eax
|
||||
jz .key
|
||||
or eax, -1
|
||||
int 40h
|
||||
mcall
|
||||
.redraw:
|
||||
call draw_window
|
||||
call hide_cursor
|
||||
jmp .wait
|
||||
.key:
|
||||
mov al, 2
|
||||
int 40h
|
||||
mcall
|
||||
cmp ah, 'y'
|
||||
jz .yes
|
||||
cmp ah, 'Y'
|
||||
@@ -1305,7 +1306,7 @@ do_reload:
|
||||
push 40
|
||||
pop eax
|
||||
mov ebx, 0x107
|
||||
int 40h
|
||||
mcall
|
||||
call draw_cursor
|
||||
mov esi, aN_str
|
||||
jmp put_message
|
||||
@@ -1313,7 +1314,7 @@ do_reload:
|
||||
push 40
|
||||
pop eax
|
||||
mov ebx, 0x107
|
||||
int 40h
|
||||
mcall
|
||||
call draw_cursor
|
||||
mov esi, aY_str
|
||||
call put_message
|
||||
@@ -1402,7 +1403,7 @@ OnTerminate:
|
||||
pop ebx
|
||||
push 69
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
|
||||
AfterSuspend:
|
||||
@@ -1421,7 +1422,7 @@ OnSuspend:
|
||||
pop ebx
|
||||
push 69
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
call AfterSuspend
|
||||
mov esi, aSuspended
|
||||
jmp put_message
|
||||
@@ -1431,7 +1432,7 @@ DoResume:
|
||||
pop ebx
|
||||
push 69
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
mov [bSuspended], 0
|
||||
ret
|
||||
OnResume:
|
||||
@@ -1481,7 +1482,7 @@ OnDetach:
|
||||
pop ebx
|
||||
push 69
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
and [debuggee_pid], 0
|
||||
call redraw_title
|
||||
call redraw_registers
|
||||
@@ -1620,7 +1621,7 @@ exception:
|
||||
mov esi, [_eip]
|
||||
push 1
|
||||
pop edx
|
||||
int 40h
|
||||
mcall
|
||||
pop eax
|
||||
cmp al, 0xCC
|
||||
jnz .notdbg
|
||||
@@ -1657,7 +1658,7 @@ exception:
|
||||
push 3
|
||||
pop ebx
|
||||
mov ecx, [dbgwnd]
|
||||
int 40h ; activate dbg window
|
||||
mcall ; activate dbg window
|
||||
call redraw_title
|
||||
call redraw_registers
|
||||
call redraw_dump
|
||||
@@ -1713,7 +1714,7 @@ OnStep:
|
||||
pop edx
|
||||
mov edi, esp
|
||||
mov esi, [_eip]
|
||||
int 40h
|
||||
mcall
|
||||
cmp eax, edx
|
||||
pop eax
|
||||
jnz .doit
|
||||
@@ -1850,7 +1851,7 @@ get_byte_nobreak:
|
||||
push edx
|
||||
inc edx
|
||||
mov edi, esp
|
||||
int 40h
|
||||
mcall
|
||||
dec eax
|
||||
clc
|
||||
jz @f
|
||||
@@ -2338,7 +2339,7 @@ DoBpm:
|
||||
mov esi, ebp
|
||||
push 9
|
||||
pop ebx
|
||||
int 40h
|
||||
mcall
|
||||
test eax, eax
|
||||
jz .ok
|
||||
pop ecx
|
||||
@@ -2570,7 +2571,7 @@ disable_breakpoint:
|
||||
xor edx, edx
|
||||
inc edx
|
||||
mov esi, [edi-5]
|
||||
int 40h
|
||||
mcall
|
||||
pop esi
|
||||
.ret:
|
||||
ret
|
||||
@@ -2583,7 +2584,7 @@ disable_breakpoint:
|
||||
push 9
|
||||
pop ebx
|
||||
mov ecx, [debuggee_pid]
|
||||
int 40h
|
||||
mcall
|
||||
ret
|
||||
|
||||
enable_breakpoint:
|
||||
@@ -2607,14 +2608,14 @@ enable_breakpoint:
|
||||
mov ecx, [debuggee_pid]
|
||||
xor edx, edx
|
||||
inc edx
|
||||
int 40h
|
||||
mcall
|
||||
dec eax
|
||||
jnz .err
|
||||
mov al, 69
|
||||
push 0xCC
|
||||
mov edi, esp
|
||||
inc ebx
|
||||
int 40h
|
||||
mcall
|
||||
pop eax
|
||||
.ret:
|
||||
pop esi
|
||||
@@ -2636,7 +2637,7 @@ enable_breakpoint:
|
||||
shr dl, 6
|
||||
mov dh, [edi]
|
||||
and dh, 0xF
|
||||
int 40h
|
||||
mcall
|
||||
test eax, eax
|
||||
jnz .err
|
||||
pop esi
|
||||
@@ -2712,7 +2713,7 @@ OnUnpack:
|
||||
@@:
|
||||
push 69
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
test eax, eax
|
||||
jz .breakok
|
||||
inc edx
|
||||
@@ -2724,7 +2725,7 @@ OnUnpack:
|
||||
.wait:
|
||||
push 10
|
||||
pop eax
|
||||
int 40h
|
||||
mcall
|
||||
dec eax
|
||||
jz .redraw
|
||||
dec eax
|
||||
@@ -2733,13 +2734,13 @@ OnUnpack:
|
||||
jnz .debug
|
||||
; button; we have only one button, close
|
||||
or eax, -1
|
||||
int 40h
|
||||
mcall
|
||||
.redraw:
|
||||
call draw_window
|
||||
jmp .wait
|
||||
.key:
|
||||
mov al, 2
|
||||
int 40h
|
||||
mcall
|
||||
cmp ah, 3 ; Ctrl+C
|
||||
jnz .wait
|
||||
.userbreak:
|
||||
@@ -2754,7 +2755,7 @@ OnUnpack:
|
||||
push 9
|
||||
pop ebx
|
||||
mov ecx, [debuggee_pid]
|
||||
int 40h
|
||||
mcall
|
||||
cmp esi, aUnpacked
|
||||
jnz OnSuspend
|
||||
jmp AfterSuspend
|
||||
@@ -2776,7 +2777,7 @@ OnUnpack:
|
||||
push 9
|
||||
pop ebx
|
||||
mov ecx, [debuggee_pid]
|
||||
int 40h
|
||||
mcall
|
||||
jmp debugmsg
|
||||
.our:
|
||||
and [dbgbuflen], 0
|
||||
@@ -2791,7 +2792,7 @@ OnUnpack:
|
||||
pop edx
|
||||
push 0xC
|
||||
pop esi
|
||||
int 40h
|
||||
mcall
|
||||
pop eax
|
||||
pop edx
|
||||
cmp eax, [_eip]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm param.asm param
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm param.asm param
|
||||
@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
|
||||
or ecx,-1
|
||||
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
|
||||
or eax,-1
|
||||
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,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 scancode.asm scancode
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm scancode.asm scancode
|
||||
@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
|
||||
@@ -23,20 +23,27 @@ START: ; start of execution
|
||||
mov eax,66 ; keyboard mode definitions
|
||||
mov ebx,1 ; set
|
||||
mov ecx,1 ; return scancodes
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax,26 ; get setup for keyboard
|
||||
mov ebx,2
|
||||
mov ecx,1 ; base keymap
|
||||
mov edx,keymap
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov eax, 48 ; GET SYSTEM COLORS
|
||||
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
|
||||
@@ -50,7 +57,7 @@ still:
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
mov esi,scan_codes+1
|
||||
mov edi,scan_codes+0
|
||||
@@ -135,7 +142,7 @@ still:
|
||||
|
||||
button: ; button
|
||||
or eax, -1 ; close this program
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
|
||||
|
||||
@@ -147,15 +154,10 @@ still:
|
||||
|
||||
draw_window:
|
||||
|
||||
mov eax, 48 ; GET SYSTEM COLORS
|
||||
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
|
||||
@@ -163,21 +165,21 @@ draw_window:
|
||||
mov ecx, 100*65536+275 ; [y start] *65536 + [y size]
|
||||
mov edx, [sc.work] ; color of work area RRGGBB,8->color gl
|
||||
or edx, 0x33000000
|
||||
mov edi, header ; WINDOW LABEL
|
||||
int 0x40
|
||||
mov edi, title ; WINDOW LABEL
|
||||
mcall
|
||||
|
||||
mov eax, 4
|
||||
mov ebx, 15*65536+10
|
||||
xor ecx, ecx
|
||||
mov edx, text
|
||||
mov esi, text.len
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
call draw_codes
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
@@ -197,7 +199,7 @@ draw_codes:
|
||||
mov eax,13 ; filled rectangle
|
||||
mov ebx,15*65536+160
|
||||
mov edx,[sc.work]
|
||||
int 0x40
|
||||
mcall
|
||||
popa
|
||||
pusha
|
||||
mov ebx,edx
|
||||
@@ -208,10 +210,10 @@ draw_codes:
|
||||
imul edi,12
|
||||
add edx,edi
|
||||
mov esi,12
|
||||
int 0x40
|
||||
mcall
|
||||
popa
|
||||
movzx ecx,byte [scan_codes+edi]
|
||||
int 0x40 ; number
|
||||
mcall ; number
|
||||
inc ecx
|
||||
add edx,12
|
||||
inc edi
|
||||
@@ -291,13 +293,13 @@ if lang eq ru
|
||||
db '‘—ˆ’›‚€ž „€��›… ‘ Š‹€‚ˆ€’“�›'
|
||||
.len = $ - text
|
||||
|
||||
header db '‘Š€�ŠŽ„› Š‹€‚ˆ€’“�›',0
|
||||
title db '‘Š€�ŠŽ„› Š‹€‚ˆ€’“�›',0
|
||||
else
|
||||
text:
|
||||
db 'READING RAW SCANCODE DATA'
|
||||
.len = $ - text
|
||||
|
||||
header db 'KEYBOARD SCANCODES',0
|
||||
title db 'KEYBOARD SCANCODES',0
|
||||
end if
|
||||
|
||||
ext db 0x0
|
||||
|
||||
@@ -1,419 +0,0 @@
|
||||
@^ fix macro comment {
|
||||
^@ fix }
|
||||
|
||||
|
||||
macro m2m dest,src {
|
||||
push src
|
||||
pop dest
|
||||
}
|
||||
|
||||
; 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
|
||||
name db data
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
db data
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m
|
||||
m = 0
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
common
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
end if
|
||||
}
|
||||
|
||||
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m,c
|
||||
m = 0
|
||||
c = 0
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
c = c+1
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
.count = c
|
||||
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 __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
|
||||
}
|
||||
|
||||
|
||||
; -------------------------
|
||||
macro header a,[b] {
|
||||
common
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET',a
|
||||
forward
|
||||
if b eq
|
||||
dd 0
|
||||
else
|
||||
dd b
|
||||
end if }
|
||||
macro section name { align 16
|
||||
label name }
|
||||
macro func name {
|
||||
if ~used name
|
||||
display 'FUNC NOT USED: ',`name,13,10
|
||||
else
|
||||
align 4
|
||||
name:
|
||||
;diff16 `name,0,name
|
||||
;pushad
|
||||
;pushfd
|
||||
;dps `name
|
||||
;newline
|
||||
;mcall 5,1
|
||||
;popfd
|
||||
;popad
|
||||
}
|
||||
macro endf { end if }
|
||||
|
||||
macro diff16 title,l1,l2
|
||||
{
|
||||
local s,d
|
||||
s = l2-l1
|
||||
display title,': 0x'
|
||||
repeat 8
|
||||
d = '0' + s shr ((8-%) shl 2) and $0F
|
||||
if d > '9'
|
||||
d = d + 'A'-'9'-1
|
||||
end if
|
||||
display d
|
||||
end repeat
|
||||
display 13,10
|
||||
}
|
||||
|
||||
macro diff10 title,l1,l2
|
||||
{
|
||||
local s,d,z,m
|
||||
s = l2-l1
|
||||
z = 0
|
||||
m = 1000000000
|
||||
display title,': '
|
||||
repeat 10
|
||||
d = '0' + s / m
|
||||
s = s - (s/m)*m
|
||||
m = m / 10
|
||||
if d <> '0'
|
||||
z = 1
|
||||
end if
|
||||
if z <> 0
|
||||
display d
|
||||
end if
|
||||
end repeat
|
||||
display 13,10
|
||||
}
|
||||
|
||||
; 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 RGB [a] {
|
||||
common
|
||||
match (r=,g=,b),a \{
|
||||
\dd ((r) shl 16) or ((g) shl 8) or (b)
|
||||
\}
|
||||
}
|
||||
|
||||
|
||||
struc POINT _t,_dx,_dy {
|
||||
.x _t _dx
|
||||
.y _t _dy
|
||||
}
|
||||
|
||||
; structure definition helper
|
||||
include 'struct.inc'
|
||||
|
||||
struct RECT
|
||||
left dd ?
|
||||
top dd ?
|
||||
right dd ?
|
||||
bottom dd ?
|
||||
ends
|
||||
|
||||
struct BOX
|
||||
left dd ?
|
||||
top dd ?
|
||||
width dd ?
|
||||
height dd ?
|
||||
ends
|
||||
|
||||
; structures used in MeOS
|
||||
struct process_information
|
||||
cpu_usage dd ? ; +0
|
||||
window_stack_position dw ? ; +4
|
||||
window_stack_value dw ? ; +6
|
||||
dw ? ; +8
|
||||
process_name rb 12 ; +10
|
||||
memory_start dd ? ; +22
|
||||
used_memory dd ? ; +26
|
||||
PID dd ? ; +30
|
||||
box BOX ; +34
|
||||
slot_state dw ? ; +50
|
||||
dw ? ; +52
|
||||
client_box BOX ; +54
|
||||
rb (1024-52)
|
||||
ends
|
||||
|
||||
struct 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 ?
|
||||
ends
|
||||
|
||||
struct FILEDATE
|
||||
Second db ?
|
||||
Minute db ?
|
||||
Hour db ?
|
||||
db ?
|
||||
Day db ?
|
||||
Month db ?
|
||||
Year dw ?
|
||||
ends
|
||||
|
||||
struct FILEINFO
|
||||
Attributes dd ?
|
||||
IsUnicode db ?
|
||||
db 3 dup(?)
|
||||
DateCreate FILEDATE
|
||||
DateAccess FILEDATE
|
||||
DateModify FILEDATE
|
||||
Size dq ?
|
||||
ends
|
||||
|
||||
; 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,180 +0,0 @@
|
||||
|
||||
; Macroinstructions for defining data structures
|
||||
|
||||
macro struct name
|
||||
{ fields@struct equ name
|
||||
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
||||
sub@struct equ
|
||||
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
|
||||
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
|
||||
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
|
||||
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
|
||||
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
|
||||
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
|
||||
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
|
||||
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
|
||||
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
|
||||
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
|
||||
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
|
||||
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
|
||||
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
|
||||
macro db [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,<val> \}
|
||||
macro dw [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,<val> \}
|
||||
macro du [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,du,<val> \}
|
||||
macro dd [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,<val> \}
|
||||
macro dp [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,<val> \}
|
||||
macro dq [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,<val> \}
|
||||
macro dt [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,<val> \}
|
||||
macro rb count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
|
||||
macro rw count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
|
||||
macro rd count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
|
||||
macro rp count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
|
||||
macro rq count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
|
||||
macro rt count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
|
||||
macro union \{ fields@struct equ fields@struct,,union,<
|
||||
sub@struct equ union \}
|
||||
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
||||
sub@struct equ substruct \}
|
||||
virtual at 0 }
|
||||
|
||||
macro ends
|
||||
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
||||
restruc rb,rw,rd,rp,rq,rt
|
||||
purge db,dw,du,dd,dp,dq,dt
|
||||
purge rb,rw,rd,rp,rq,rt
|
||||
purge union,struct
|
||||
match name=,fields,fields@struct \\{ fields@struct equ
|
||||
make@struct name,fields
|
||||
fields@\\#name equ fields \\}
|
||||
end virtual \}
|
||||
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
||||
restore sub@struct }
|
||||
|
||||
macro make@struct name,[field,type,def]
|
||||
{ common
|
||||
if $
|
||||
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
|
||||
err
|
||||
end if
|
||||
local define
|
||||
define equ name
|
||||
forward
|
||||
local sub
|
||||
match , field \{ make@substruct type,name,sub def
|
||||
define equ define,.,sub, \}
|
||||
match any, field \{ define equ define,.#field,type,<def> \}
|
||||
common
|
||||
match fields, define \{ define@struct fields \} }
|
||||
|
||||
macro define@struct name,[field,type,def]
|
||||
{ common
|
||||
local list
|
||||
list equ
|
||||
forward
|
||||
if ~ field eq .
|
||||
name#field type def
|
||||
sizeof.#name#field = $ - name#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
match any, list \{ list equ list, \}
|
||||
list equ list <value>
|
||||
common
|
||||
sizeof.#name = $
|
||||
restruc name
|
||||
match values, list \{
|
||||
struc name value \\{
|
||||
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
||||
match , fields@struct \\\{ label .
|
||||
forward
|
||||
match , value \\\\{ field type def \\\\}
|
||||
match any, value \\\\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#name#field - ($-field)
|
||||
end if \\\\}
|
||||
common \\\} \\} \} }
|
||||
|
||||
macro enable@substruct
|
||||
{ macro make@substruct substruct,parent,name,[field,type,def]
|
||||
\{ \common
|
||||
\local define
|
||||
define equ parent,name
|
||||
\forward
|
||||
\local sub
|
||||
match , field \\{ match any, type \\\{ enable@substruct
|
||||
make@substruct type,name,sub def
|
||||
purge make@substruct
|
||||
define equ define,.,sub, \\\} \\}
|
||||
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
||||
\common
|
||||
match fields, define \\{ define@\#substruct fields \\} \} }
|
||||
|
||||
enable@substruct
|
||||
|
||||
macro define@union parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
virtual at 0
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
end virtual
|
||||
if sizeof.#parent#field > $
|
||||
rb sizeof.#parent#field - $
|
||||
end if
|
||||
else if sizeof.#type > $
|
||||
rb sizeof.#type - $
|
||||
end if
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name [value] \{ \common
|
||||
label .\#name
|
||||
last@union equ
|
||||
forward
|
||||
match any, last@union \\{ virtual at .\#name
|
||||
field type def
|
||||
end virtual \\}
|
||||
match , last@union \\{ match , value \\\{ field type def \\\}
|
||||
match any, value \\\{ field type value \\\} \\}
|
||||
last@union equ field
|
||||
common rb sizeof.#name - ($ - .\#name) \} }
|
||||
|
||||
macro define@substruct parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name value \{
|
||||
label .\#name
|
||||
forward
|
||||
match , value \\{ field type def \\}
|
||||
match any, value \\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#parent#field - ($-field)
|
||||
end if \\}
|
||||
common \} }
|
||||
@@ -151,7 +151,7 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc' ; useful stuff
|
||||
include '..\..\..\macros.inc' ; useful stuff
|
||||
;include 'proc32.inc'
|
||||
include 'tinypad.inc'
|
||||
;purge mov,add,sub ; SPEED
|
||||
|
||||
Reference in New Issue
Block a user