Subversion Repositories Kolibri OS

Rev

Rev 5788 | Rev 9715 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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