Subversion Repositories Kolibri OS

Rev

Rev 5788 | Rev 8968 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2455 mario79 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
2455 mario79 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2288 clevermous 7
 
8
__REV = 0
9
 
10
macro $Revision a {
11
  match =: Num =$,a \{
12
    if __REV < Num
13
      __REV = Num
14
    end if
15
  \}
16
}
17
 
7114 dunkaist 18
macro ignore_empty_revision_keyword {
19
  ; svn keywords are neither substituted by git-svn nor catched by $Revision
20
  ; macro above, ignore them to not fail the build
21
  macro $Rev#ision$ \{\}
22
}
23
ignore_empty_revision_keyword
24
 
2288 clevermous 25
$Revision: 7114 $
26
 
27
 
28
;// mike.dld, 2006-29-01 [
29
 
30
; macros definition
31
macro diff16 title,l1,l2
32
{
33
  local s,d
34
  s = l2-l1
35
  display title,': 0x'
36
  repeat 16
37
    d = 48 + s shr ((16-%) shl 2) and $0F
38
    if d > 57
39
      d = d + 65-57-1
40
    end if
41
    display d
42
  end repeat
43
  display 13,10
44
}
45
macro diff10 title,l1,l2
46
 {
47
  local s,d,z,m
48
  s = l2-l1
49
  z = 0
50
  m = 1000000000
51
  display title,': '
52
  repeat 10
53
   d = '0' + s / m
54
   s = s - (s/m)*m
55
   m = m / 10
56
   if d <> '0'
57
    z = 1
58
   end if
59
   if z <> 0
60
    display d
61
   end if
62
  end repeat
63
  display 13,10
64
 }
65
 
66
include 'kglobals.inc'
67
 
68
; \begin{diamond}[29.09.2006]
69
; may be useful for kernel debugging
70
; example 1:
71
;       dbgstr 'Hello, World!'
72
; example 2:
73
;       dbgstr 'Hello, World!', save_flags
74
macro dbgstr string*, f
75
{
76
local a
77
iglobal_nested
78
a db 'K : ',string,13,10,0
79
endg_nested
80
if ~ f eq
81
        pushfd
82
end if
83
        push    esi
84
        mov     esi, a
85
        call    sys_msg_board_str
86
        pop     esi
87
if ~ f eq
88
        popfd
89
end if
90
}
91
; \end{diamond}[29.09.2006]
92
 
93
 
5130 serge 94
macro list_init head
95
{
96
        mov     [head+LHEAD.next], head
97
        mov     [head+LHEAD.prev], head
98
}
99
 
2288 clevermous 100
macro __list_add new, prev, next
101
{
102
        mov     [next+LHEAD.prev], new
103
        mov     [new+LHEAD.next], next
104
        mov     [new+LHEAD.prev], prev
105
        mov     [prev+LHEAD.next], new
106
}
107
 
108
macro list_add new, head
109
{
110
        mov     eax, [head+LHEAD.next]
111
    __list_add new, head, eax
112
}
113
 
114
macro list_add_tail new, head
115
{
116
        mov     eax, [head+LHEAD.prev]
117
    __list_add new, eax, head
118
}
119
 
120
macro list_del entry
121
{
5130 serge 122
        mov     edx, [entry+LHEAD.next]
123
        mov     ecx, [entry+LHEAD.prev]
124
        mov     [edx+LHEAD.prev], ecx
125
        mov     [ecx+LHEAD.next], edx
2288 clevermous 126
}
127
 
3598 clevermous 128
; MOV Immediate.
129
; Useful for things like movi eax,10:
130
; shorter than regular mov, but slightly slower,
131
; do not use it in performance-critical places.
132
macro movi dst, imm
133
{
134
if imm >= -0x80 & imm <= 0x7F
135
        push    imm
136
        pop     dst
137
else
138
        mov     dst, imm
139
end if
140
}