Subversion Repositories Kolibri OS

Rev

Rev 506 | Rev 750 | 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: 521 $
  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 16
  45.     d = 48 + s shr ((16-%) 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. include 'kglobals.inc'
  75.  
  76. ; \begin{diamond}[29.09.2006]
  77. ; may be useful for kernel debugging
  78. ; example 1:
  79. ;       dbgstr 'Hello, World!'
  80. ; example 2:
  81. ;       dbgstr 'Hello, World!', save_flags
  82. macro dbgstr string*, f
  83. {
  84. local a
  85. iglobal_nested
  86. a db 'K : ',string,13,10,0
  87. endg_nested
  88. if ~ f eq
  89.         pushfd
  90. end if
  91.         push    esi
  92.         mov     esi, a
  93.         call    sys_msg_board_str
  94.         pop     esi
  95. if ~ f eq
  96.         popfd
  97. end if
  98. }
  99. ; \end{diamond}[29.09.2006]
  100.