Subversion Repositories Kolibri OS

Rev

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