Subversion Repositories Kolibri OS

Rev

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