Changes to make __REV__ constant at any place in kernel

Output SVN revision number in boot screen

git-svn-id: svn://kolibrios.org@426 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2007-03-22 01:09:49 +00:00
parent 21e4bc0233
commit 6f7428a7e4
5 changed files with 145 additions and 96 deletions

View File

@ -156,6 +156,20 @@ printplain:
popa popa
ret ret
uint2str_16:
cmp ax,cx
jb @f
xor dx,dx
div cx
push dx
call uint2str_16
pop ax
@@: cmp al,10
sbb al,$69
das
stosb
ret
; Now int 16 is used for keyboard support. ; Now int 16 is used for keyboard support.
; This is shorter, simpler and more reliable. ; This is shorter, simpler and more reliable.
if 0 if 0
@ -532,7 +546,6 @@ wait_loop: ; variant 2
mov [si + 7], al mov [si + 7], al
_setcursor 0, 3 _setcursor 0, 3
call printplain call printplain
_setcursor d80x25_top_num,0
; ------------------ ; ------------------
mov ax, 0x5304 ; Disconnect interface mov ax, 0x5304 ; Disconnect interface
@ -561,6 +574,26 @@ wait_loop: ; variant 2
apm_end: apm_end:
; ----------------------------------------- ; -----------------------------------------
; --------------- REVISION ----------------
push ds
pop es
mov di,svn_num_buf - 0x10000
mov ax,__REV__
mov cx,10
call uint2str_16
mov ax,' '
stosw
sub di,svn_num_buf - 0x10000
mov dx,80 - 1 - msg_svn.len
sub dx,di
call setcursor
mov si,msg_svn - 0x10000
call printplain
mov si,svn_num_buf - 0x10000
call printplain
_setcursor d80x25_top_num,0
; -----------------------------------------
; DISPLAY VESA INFORMATION ; DISPLAY VESA INFORMATION
push 0 push 0
@ -1298,3 +1331,4 @@ setgr:
gmok2: gmok2:
push ds push ds
pop es pop es

View File

@ -10,15 +10,11 @@
;; Compile with last version FASM ;; Compile with last version FASM
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_REV_ = 0
macro $Revision a { include 'macros.inc'
match =: Num =$,a \{
if _REV_ < Num
_REV_ = Num
end if
\}
}
$Revision$ $Revision$
include "proc32.inc" include "proc32.inc"
include "kglobals.inc" include "kglobals.inc"
include "lang.inc" include "lang.inc"
@ -5112,4 +5108,7 @@ endofcode:
IncludeUGlobals IncludeUGlobals
uglobals_size = $ - endofcode uglobals_size = $ - endofcode
diff16 "end of kernel code",0,$ diff16 "end of kernel code",0,$
diff10 "revision",0,_REV_
__REV__ = __REV
diff10 "revision",0,__REV__

View File

@ -16,6 +16,10 @@ $Revision$
;% +include ;% +include
msg_svn db " SVN ",0
msg_svn.len = $ - msg_svn
svn_num_buf rb 12
;!!! ;!!!
if lang eq en if lang eq en
include "boot/booteng.inc" ; english system boot messages include "boot/booteng.inc" ; english system boot messages
@ -29,7 +33,7 @@ include "boot/bootge.inc" ; german system boot messages
end if end if
if lang eq et if lang eq et
include "boot/et.inc" ; Estonian font include "boot/et.inc" ; Estonian font
else else if lang eq ru
include "boot/ru.inc" ; Russian font include "boot/ru.inc" ; Russian font
end if end if

View File

@ -11,91 +11,6 @@ $Revision$
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; structure definition helper
macro struct name, [arg]
{
common
name@struct equ name
struc name arg {
}
macro struct_helper name
{
match xname,name
\{
virtual at 0
xname xname
sizeof.#xname = $ - xname
name equ sizeof.#xname
end virtual
\}
}
ends fix } struct_helper name@struct
;// mike.dld, 2006-29-01 [
; macros definition
macro diff16 title,l1,l2
{
local s,d
s = l2-l1
display title,': 0x'
repeat 8
d = 48 + s shr ((8-%) shl 2) and $0F
if d > 57
d = d + 65-57-1
end if
display d
end repeat
display 13,10
}
macro diff10 title,l1,l2
{
local s,d,z,m
s = l2-l1
z = 0
m = 1000000000
display title,': '
repeat 10
d = '0' + s / m
s = s - (s/m)*m
m = m / 10
if d <> '0'
z = 1
end if
if z <> 0
display d
end if
end repeat
display 13,10
}
; \begin{diamond}[29.09.2006]
; may be useful for kernel debugging
; example 1:
; dbgstr 'Hello, World!'
; example 2:
; dbgstr 'Hello, World!', save_flags
macro dbgstr string*, f
{
local a
iglobal_nested
a db 'K : ',string,13,10,0
endg_nested
if ~ f eq
pushfd
end if
push esi
mov esi, a
call sys_msg_board_str
pop esi
if ~ f eq
popfd
end if
}
; \end{diamond}[29.09.2006]
;struc db [a] { common . db a ;struc db [a] { common . db a
; if ~used . ; if ~used .
; display 'not used db: ',`.,13,10 ; display 'not used db: ',`.,13,10

97
kernel/trunk/macros.inc Normal file
View File

@ -0,0 +1,97 @@
__REV = 0
macro $Revision a {
match =: Num =$,a \{
if __REV < Num
__REV = Num
end if
\}
}
$Revision$
; structure definition helper
macro struct name, [arg]
{
common
name@struct equ name
struc name arg {
}
macro struct_helper name
{
match xname,name
\{
virtual at 0
xname xname
sizeof.#xname = $ - xname
name equ sizeof.#xname
end virtual
\}
}
ends fix } struct_helper name@struct
;// mike.dld, 2006-29-01 [
; macros definition
macro diff16 title,l1,l2
{
local s,d
s = l2-l1
display title,': 0x'
repeat 8
d = 48 + s shr ((8-%) shl 2) and $0F
if d > 57
d = d + 65-57-1
end if
display d
end repeat
display 13,10
}
macro diff10 title,l1,l2
{
local s,d,z,m
s = l2-l1
z = 0
m = 1000000000
display title,': '
repeat 10
d = '0' + s / m
s = s - (s/m)*m
m = m / 10
if d <> '0'
z = 1
end if
if z <> 0
display d
end if
end repeat
display 13,10
}
; \begin{diamond}[29.09.2006]
; may be useful for kernel debugging
; example 1:
; dbgstr 'Hello, World!'
; example 2:
; dbgstr 'Hello, World!', save_flags
macro dbgstr string*, f
{
local a
iglobal_nested
a db 'K : ',string,13,10,0
endg_nested
if ~ f eq
pushfd
end if
push esi
mov esi, a
call sys_msg_board_str
pop esi
if ~ f eq
popfd
end if
}
; \end{diamond}[29.09.2006]