Subversion Repositories Kolibri OS

Rev

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

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