2007-03-22 04:09:49 +03:00
|
|
|
|
|
|
|
__REV = 0
|
|
|
|
|
|
|
|
macro $Revision a {
|
|
|
|
match =: Num =$,a \{
|
|
|
|
if __REV < Num
|
|
|
|
__REV = Num
|
|
|
|
end if
|
|
|
|
\}
|
|
|
|
}
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
2007-07-27 17:52:03 +04:00
|
|
|
|
2007-03-22 04:09:49 +03:00
|
|
|
; structure definition helper
|
|
|
|
macro struct name, [arg]
|
|
|
|
{
|
|
|
|
common
|
|
|
|
name@struct equ name
|
|
|
|
struc name arg {
|
|
|
|
}
|
|
|
|
|
2011-08-24 17:11:18 +04:00
|
|
|
macro declare_sizeof xname,value
|
|
|
|
{ sizeof.#xname = value }
|
|
|
|
|
2007-03-22 04:09:49 +03:00
|
|
|
macro struct_helper name
|
|
|
|
{
|
|
|
|
match xname,name
|
|
|
|
\{
|
|
|
|
virtual at 0
|
|
|
|
xname xname
|
2011-08-24 17:11:18 +04:00
|
|
|
declare_sizeof xname, $ - xname
|
2007-03-22 04:09:49 +03:00
|
|
|
name equ sizeof.#xname
|
|
|
|
end virtual
|
|
|
|
\}
|
|
|
|
}
|
|
|
|
|
|
|
|
ends fix } struct_helper name@struct
|
|
|
|
|
|
|
|
;// mike.dld, 2006-29-01 [
|
|
|
|
|
|
|
|
; macros definition
|
|
|
|
macro diff16 title,l1,l2
|
|
|
|
{
|
|
|
|
local s,d
|
|
|
|
s = l2-l1
|
|
|
|
display title,': 0x'
|
2007-05-17 23:54:49 +04:00
|
|
|
repeat 16
|
|
|
|
d = 48 + s shr ((16-%) shl 2) and $0F
|
2007-03-22 04:09:49 +03:00
|
|
|
if d > 57
|
|
|
|
d = d + 65-57-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
|
|
|
|
}
|
|
|
|
|
2007-05-24 15:27:05 +04:00
|
|
|
include 'kglobals.inc'
|
|
|
|
|
2007-03-22 04:09:49 +03:00
|
|
|
; \begin{diamond}[29.09.2006]
|
|
|
|
; may be useful for kernel debugging
|
|
|
|
; example 1:
|
|
|
|
; dbgstr 'Hello, World!'
|
|
|
|
; example 2:
|
|
|
|
; dbgstr 'Hello, World!', save_flags
|
|
|
|
macro dbgstr string*, f
|
|
|
|
{
|
|
|
|
local a
|
|
|
|
iglobal_nested
|
|
|
|
a db 'K : ',string,13,10,0
|
|
|
|
endg_nested
|
|
|
|
if ~ f eq
|
|
|
|
pushfd
|
|
|
|
end if
|
|
|
|
push esi
|
|
|
|
mov esi, a
|
|
|
|
call sys_msg_board_str
|
|
|
|
pop esi
|
|
|
|
if ~ f eq
|
|
|
|
popfd
|
|
|
|
end if
|
|
|
|
}
|
|
|
|
; \end{diamond}[29.09.2006]
|
2009-03-28 21:36:41 +03:00
|
|
|
|
|
|
|
macro Mov op1,op2,op3 ; op1 = op2 = op3
|
|
|
|
{
|
|
|
|
mov op2,op3
|
|
|
|
mov op1,op2
|
|
|
|
}
|