Subversion Repositories Kolibri OS

Rev

Rev 1816 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1815 yogev_ezra 1
;include 'kinc/imports.inc'
2
 
3
macro debug_print str
4
{
5
   local ..string, ..label
6
 
7
   jmp ..label
8
   ..string db str,0
9
  ..label:
10
 
11
   pushf
12
   pushad
13
   ;mov  edx,..string
14
   mov	esi, ..string
15
   ;call debug_outstr
16
   call  SysMsgBoardStr
17
   popad
18
   popf
19
}
20
 
21
dps fix debug_print
22
 
23
macro debug_print_dec arg
24
{
25
   pushf
26
   pushad
27
   if ~arg eq eax
28
     mov  eax,arg
29
   end if
30
   call debug_outdec
31
   popad
32
   popf
33
}
34
 
35
dpd fix debug_print_dec
36
 
37
;---------------------------------
38
debug_outdec:		;(eax - num, edi-str)
39
	push 10 	;2
40
	pop ecx 	;1
41
	push -'0'	;2
42
    .l0:
43
	xor edx,edx	;2
44
	div ecx 	;2
45
	push edx	;1
46
	test eax,eax	;2
47
	jnz .l0 	;2
48
    .l1:
49
	pop eax 	;1
50
	add al,'0'	;2
51
	call debug_outchar ; stosb
52
	jnz .l1 	;2
53
	ret		;1
54
;---------------------------------
55
 
56
debug_outchar:		; al - char
57
   pushf
58
   pushad
59
   ;mov  cl,al
60
   ;mov  eax,63
61
   ;mov  ebx,1
62
   ;int  0x40
63
   mov	bl, al
64
   mov	eax, 1
3614 shikhin 65
   call SysMsgBoard
1815 yogev_ezra 66
   popad
67
   popf
68
ret
69
 
70
;debug_outstr:
71
;   mov  eax,63
72
;   mov  ebx,1
73
; @@:
74
;   mov  cl,[edx]
75
;   test cl,cl
76
;   jz   @f
77
;   int  40h
78
;   inc  edx
79
;   jmp  @b
80
; @@:
81
;   ret
82
 
83
 
84
macro newline
85
{
86
  dps <13,10>
87
}
88
 
89
macro print message
90
{
91
  dps message
92
  newline
93
}
94
 
95
macro pregs
96
{
97
  dps "EAX: "
98
  dpd eax
99
  dps "   EBX: "
100
  dpd ebx
101
  newline
102
  dps "ECX: "
103
  dpd ecx
104
  dps "   EDX: "
105
  dpd edx
106
  newline
107
}
108
 
109
macro debug_print_hex arg
110
{
111
    pushf
112
    pushad
113
    if ~arg eq eax
114
      mov eax, arg
115
    end if
116
    call debug_outhex
117
    popad
118
    popf
119
}
120
dph fix debug_print_hex
121
 
122
debug_outhex:
123
    ;  eax - number
124
    pushf
125
    pushad
126
    mov   edx, 8
127
  .new_char:
128
    rol   eax, 4
129
    movzx ecx, al
130
    and   cl,  0x0f
131
    mov   cl,  [__hexdigits + ecx]
132
    pushad
133
    mcall 63, 1
134
    popad
135
    dec   edx
136
    jnz   .new_char
137
    popad
138
    popf
139
ret
140
 
3614 shikhin 141
SysMsgBoard:
1816 yogev_ezra 142
   push   eax ebx ecx
1815 yogev_ezra 143
   mov	  cl, al
144
   mov	  eax, 63
145
   mov	  ebx, 1
146
   int	  0x40
1816 yogev_ezra 147
   pop	  ecx ebx eax
1815 yogev_ezra 148
ret
149
 
150
SysMsgBoardStr:
151
   push   eax
152
 @@:
153
   lodsb
154
   or	  al, al
155
   jz	  @f
3614 shikhin 156
   call   SysMsgBoard
1815 yogev_ezra 157
   jmp	  @b
158
 @@:
159
   pop	  eax
160
ret
161
 
162
 
163
__hexdigits:
164
  db '0123456789ABCDEF'