Subversion Repositories Kolibri OS

Rev

Rev 1635 | Rev 2143 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. __REV = 0
  3.  
  4. macro $Revision a {
  5.   match =: Num =$,a \{
  6.     if __REV < Num
  7.       __REV = Num
  8.     end if
  9.   \}
  10. }
  11.  
  12. $Revision: 2130 $
  13.  
  14.  
  15. ; structure definition helper
  16. macro struct name, [arg]
  17.  {
  18.   common
  19.    name@struct equ name
  20.    struc name arg {
  21.  }
  22.  
  23. macro declare_sizeof xname,value
  24. { sizeof.#xname = value }
  25.  
  26. macro struct_helper name
  27.  {
  28.   match xname,name
  29.   \{
  30.    virtual at 0
  31.    xname xname
  32.    declare_sizeof xname, $ - xname
  33.    name equ sizeof.#xname
  34.    end virtual
  35.   \}
  36.  }
  37.  
  38. ends fix } struct_helper name@struct
  39.  
  40. ;// mike.dld, 2006-29-01 [
  41.  
  42. ; macros definition
  43. macro diff16 title,l1,l2
  44. {
  45.   local s,d
  46.   s = l2-l1
  47.   display title,': 0x'
  48.   repeat 16
  49.     d = 48 + s shr ((16-%) shl 2) and $0F
  50.     if d > 57
  51.       d = d + 65-57-1
  52.     end if
  53.     display d
  54.   end repeat
  55.   display 13,10
  56. }
  57. macro diff10 title,l1,l2
  58.  {
  59.   local s,d,z,m
  60.   s = l2-l1
  61.   z = 0
  62.   m = 1000000000
  63.   display title,': '
  64.   repeat 10
  65.    d = '0' + s / m
  66.    s = s - (s/m)*m
  67.    m = m / 10
  68.    if d <> '0'
  69.     z = 1
  70.    end if
  71.    if z <> 0
  72.     display d
  73.    end if
  74.   end repeat
  75.   display 13,10
  76.  }
  77.  
  78. include 'kglobals.inc'
  79.  
  80. ; \begin{diamond}[29.09.2006]
  81. ; may be useful for kernel debugging
  82. ; example 1:
  83. ;       dbgstr 'Hello, World!'
  84. ; example 2:
  85. ;       dbgstr 'Hello, World!', save_flags
  86. macro dbgstr string*, f
  87. {
  88. local a
  89. iglobal_nested
  90. a db 'K : ',string,13,10,0
  91. endg_nested
  92. if ~ f eq
  93.         pushfd
  94. end if
  95.         push    esi
  96.         mov     esi, a
  97.         call    sys_msg_board_str
  98.         pop     esi
  99. if ~ f eq
  100.         popfd
  101. end if
  102. }
  103. ; \end{diamond}[29.09.2006]
  104.  
  105. macro Mov op1,op2,op3 ; op1 = op2 = op3
  106.  {
  107.         mov   op2,op3
  108.         mov   op1,op2
  109.  }
  110.