Subversion Repositories Kolibri OS

Rev

Rev 1065 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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