forked from KolibriOS/kolibrios
"net" branch:
Removed some files that dont belong in specific branch. Added some applications that work with this kernel only. git-svn-id: svn://kolibrios.org@1164 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
cbfb59ad64
commit
bb5be0798a
89
kernel/branches/net/applications/netcfg/drivers.inc
Normal file
89
kernel/branches/net/applications/netcfg/drivers.inc
Normal file
@ -0,0 +1,89 @@
|
||||
driverlist:
|
||||
db 'RTL8139',0
|
||||
dd 0x813910ec
|
||||
dd 0x813810ec
|
||||
dd 0x12111113
|
||||
dd 0x13601500
|
||||
dd 0x13604033
|
||||
dd 0x13001186
|
||||
dd 0x13401186
|
||||
dd 0xab0613d1
|
||||
dd 0xa1171259
|
||||
dd 0xa11e1259
|
||||
dd 0xab0614ea
|
||||
dd 0xab0714ea
|
||||
dd 0x123411db
|
||||
dd 0x91301432
|
||||
dd 0x101202ac
|
||||
dd 0x0106018a
|
||||
dd 0x1211126c
|
||||
dd 0x81391743
|
||||
dd 0x8139021b
|
||||
dd 0x0 ; end
|
||||
|
||||
db 'RTL8029',0
|
||||
dd 0x802910ec
|
||||
dd 0x0
|
||||
|
||||
db 'I8255X',0
|
||||
dd 0x12098086
|
||||
dd 0x10298086
|
||||
dd 0x12298086
|
||||
dd 0x10308086
|
||||
dd 0x24498086
|
||||
dd 0x0
|
||||
|
||||
db 'RTL8169',0
|
||||
dd 0x816810ec
|
||||
dd 0x816910ec
|
||||
dd 0x011616ec
|
||||
dd 0x43001186
|
||||
dd 0x0
|
||||
|
||||
db '3C59X',0
|
||||
dd 0x590010b7
|
||||
dd 0x592010b7
|
||||
dd 0x597010b7
|
||||
dd 0x595010b7
|
||||
dd 0x595110b7
|
||||
dd 0x595210b7
|
||||
dd 0x900010b7
|
||||
dd 0x900110b7
|
||||
dd 0x900410b7
|
||||
dd 0x900510b7
|
||||
dd 0x900610b7
|
||||
dd 0x900A10b7
|
||||
dd 0x905010b7
|
||||
dd 0x905110b7
|
||||
dd 0x905510b7
|
||||
dd 0x905810b7
|
||||
dd 0x905A10b7
|
||||
dd 0x920010b7
|
||||
dd 0x980010b7
|
||||
dd 0x980510b7
|
||||
dd 0x764610b7
|
||||
dd 0x505510b7
|
||||
dd 0x605510b7
|
||||
dd 0x605610b7
|
||||
dd 0x5b5710b7
|
||||
dd 0x505710b7
|
||||
dd 0x515710b7
|
||||
dd 0x525710b7
|
||||
dd 0x656010b7
|
||||
dd 0x656210b7
|
||||
dd 0x656410b7
|
||||
dd 0x450010b7
|
||||
dd 0x0
|
||||
|
||||
db 'SIS900',0
|
||||
dd 0x09001039
|
||||
dd 0x70161039
|
||||
dd 0x0
|
||||
|
||||
db 'PCNET32',0
|
||||
dd 0x20001022
|
||||
dd 0x26251022
|
||||
dd 0x20011022
|
||||
dd 0x0
|
||||
|
||||
dd 0x0 ; driverlist end
|
543
kernel/branches/net/applications/netcfg/macros.inc
Normal file
543
kernel/branches/net/applications/netcfg/macros.inc
Normal file
@ -0,0 +1,543 @@
|
||||
@^ fix macro comment {
|
||||
^@ fix }
|
||||
|
||||
; -------------------------
|
||||
macro library [lname,fname]
|
||||
{
|
||||
forward
|
||||
dd __#lname#_library_table__,__#lname#_library_name__
|
||||
common
|
||||
dd 0
|
||||
forward
|
||||
align 4
|
||||
__#lname#_library_name__ db fname,0
|
||||
}
|
||||
|
||||
macro import lname,[name,sname]
|
||||
{
|
||||
common
|
||||
align 4
|
||||
__#lname#_library_table__:
|
||||
forward
|
||||
if used name
|
||||
name dd __#name#_import_name__
|
||||
end if
|
||||
common
|
||||
dd 0
|
||||
forward
|
||||
if used name
|
||||
align 4
|
||||
__#name#_import_name__ db sname,0
|
||||
end if
|
||||
}
|
||||
|
||||
macro export [name,sname]
|
||||
{
|
||||
forward
|
||||
dd __#name#_export_name__,name
|
||||
common
|
||||
dd 0
|
||||
forward
|
||||
align 4
|
||||
__#name#_export_name__ db sname,0
|
||||
}
|
||||
; -------------------------
|
||||
|
||||
macro m2m dest,src {
|
||||
push src
|
||||
pop dest
|
||||
}
|
||||
|
||||
|
||||
macro iglobal {
|
||||
IGlobals equ IGlobals,
|
||||
macro __IGlobalBlock { }
|
||||
|
||||
macro uglobal {
|
||||
UGlobals equ UGlobals,
|
||||
macro __UGlobalBlock { }
|
||||
|
||||
endg fix } ; Use endg for ending iglobal and uglobal blocks.
|
||||
|
||||
|
||||
macro IncludeIGlobals{
|
||||
macro IGlobals dummy,[n] \{ __IGlobalBlock
|
||||
purge __IGlobalBlock \}
|
||||
match I, IGlobals \{ I \} }
|
||||
|
||||
macro IncludeUGlobals{
|
||||
macro UGlobals dummy,[n] \{
|
||||
\common
|
||||
\local begin, size
|
||||
begin = $
|
||||
virtual at $
|
||||
\forward
|
||||
__UGlobalBlock
|
||||
purge __UGlobalBlock
|
||||
\common
|
||||
size = $ - begin
|
||||
end virtual
|
||||
rb size
|
||||
\}
|
||||
match U, UGlobals \{ U \} }
|
||||
|
||||
uglobal
|
||||
endg
|
||||
|
||||
iglobal
|
||||
endg
|
||||
|
||||
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
IncludeIGlobals
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
IncludeUGlobals
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mls [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring ; mod
|
||||
ssize = $
|
||||
end virtual
|
||||
db ssize
|
||||
db sstring
|
||||
common
|
||||
db -1 ; mod
|
||||
}
|
||||
|
||||
|
||||
|
||||
; strings
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
name db data
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
db data
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m
|
||||
m = 0
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
common
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
end if
|
||||
}
|
||||
|
||||
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m,c
|
||||
m = 0
|
||||
c = 0
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
c = c+1
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
.count = c
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
else if (~a eq)&(b eq)
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
__CPU_type equ p5
|
||||
SYSENTER_VAR equ 0
|
||||
|
||||
macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls
|
||||
local ..ret_point
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
|
||||
if __CPU_type eq p5
|
||||
int 0x40
|
||||
else
|
||||
if __CPU_type eq p6
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push ..ret_point ; it may be 2 or 5 byte
|
||||
sysenter
|
||||
..ret_point:
|
||||
pop edx
|
||||
pop ecx
|
||||
|
||||
else
|
||||
if __CPU_type eq k6
|
||||
push ecx
|
||||
syscall
|
||||
pop ecx
|
||||
else
|
||||
display 'ERROR : unknown CPU type (set to p5)', 10, 13
|
||||
__CPU_type equ p5
|
||||
int 0x40
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
; -------------------------
|
||||
macro header a,[b] {
|
||||
common
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET',a
|
||||
forward
|
||||
if b eq
|
||||
dd 0
|
||||
else
|
||||
dd b
|
||||
end if }
|
||||
macro section name { align 16
|
||||
label name }
|
||||
macro func name {
|
||||
if ~used name
|
||||
display 'FUNC NOT USED: ',`name,13,10
|
||||
else
|
||||
align 4
|
||||
name:
|
||||
;diff16 `name,0,name
|
||||
;pushad
|
||||
;pushfd
|
||||
;dps `name
|
||||
;newline
|
||||
;mcall 5,1
|
||||
;popfd
|
||||
;popad
|
||||
}
|
||||
macro endf { end if }
|
||||
|
||||
macro diff16 title,l1,l2
|
||||
{
|
||||
local s,d
|
||||
s = l2-l1
|
||||
display title,': 0x'
|
||||
repeat 8
|
||||
d = '0' + s shr ((8-%) shl 2) and $0F
|
||||
if d > '9'
|
||||
d = d + 'A'-'9'-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
|
||||
}
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro RGB [a] {
|
||||
common
|
||||
match (r=,g=,b),a \{
|
||||
\dd ((r) shl 16) or ((g) shl 8) or (b)
|
||||
\}
|
||||
}
|
||||
|
||||
|
||||
struc POINT _t,_dx,_dy {
|
||||
.x _t _dx
|
||||
.y _t _dy
|
||||
}
|
||||
|
||||
; structure definition helper
|
||||
include 'struct.inc'
|
||||
|
||||
struct RECT
|
||||
left dd ?
|
||||
top dd ?
|
||||
right dd ?
|
||||
bottom dd ?
|
||||
ends
|
||||
|
||||
struct BOX
|
||||
left dd ?
|
||||
top dd ?
|
||||
width dd ?
|
||||
height dd ?
|
||||
ends
|
||||
|
||||
; structures used in MeOS
|
||||
struct process_information
|
||||
cpu_usage dd ? ; +0
|
||||
window_stack_position dw ? ; +4
|
||||
window_stack_value dw ? ; +6
|
||||
dw ? ; +8
|
||||
process_name rb 12 ; +10
|
||||
memory_start dd ? ; +22
|
||||
used_memory dd ? ; +26
|
||||
PID dd ? ; +30
|
||||
box BOX ; +34
|
||||
slot_state dw ? ; +50
|
||||
dw ? ; +52
|
||||
client_box BOX ; +54
|
||||
wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
ends
|
||||
|
||||
struct system_colors
|
||||
frame dd ?
|
||||
grab dd ?
|
||||
grab_button dd ?
|
||||
grab_button_text dd ?
|
||||
grab_text dd ?
|
||||
work dd ?
|
||||
work_button dd ?
|
||||
work_button_text dd ?
|
||||
work_text dd ?
|
||||
work_graph dd ?
|
||||
ends
|
||||
|
||||
struct FILEDATE
|
||||
Second db ?
|
||||
Minute db ?
|
||||
Hour db ?
|
||||
db ?
|
||||
Day db ?
|
||||
Month db ?
|
||||
Year dw ?
|
||||
ends
|
||||
|
||||
struct FILEINFO
|
||||
Attributes dd ?
|
||||
IsUnicode db ?
|
||||
db 3 dup(?)
|
||||
DateCreate FILEDATE
|
||||
DateAccess FILEDATE
|
||||
DateModify FILEDATE
|
||||
Size dq ?
|
||||
ends
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
||||
|
466
kernel/branches/net/applications/netcfg/netcfg.asm
Normal file
466
kernel/branches/net/applications/netcfg/netcfg.asm
Normal file
@ -0,0 +1,466 @@
|
||||
include 'macros.inc'
|
||||
MEOS_APP_START
|
||||
|
||||
type_ethernet equ 1
|
||||
|
||||
CODE
|
||||
call draw_window
|
||||
|
||||
still: mcall 10 ; wait here for event
|
||||
dec eax ; redraw request ?
|
||||
jz red
|
||||
dec eax ; key in buffer ?
|
||||
jz key
|
||||
dec eax ; button in buffer ?
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
mcall 9, Proc_Info, -1 ; window redraw requested so get new window coordinates and size
|
||||
mov eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure
|
||||
mov [Form + 2], ax ; x start position
|
||||
mov eax, [Proc_Info.box.top];
|
||||
mov [Form + 6], ax ; ystart position
|
||||
mov eax, [Proc_Info.box.width] ;
|
||||
mov [Form], ax ; window width
|
||||
mov eax, [Proc_Info.box.height] ;
|
||||
mov [Form + 4] ,ax ; window height
|
||||
call draw_window ; go redraw window now
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mcall 2 ; just read it and ignore
|
||||
jmp still
|
||||
button: ; button
|
||||
mcall 17 ; get id
|
||||
|
||||
cmp ah, 1 ; button id = 1 ?
|
||||
jne @f
|
||||
mcall -1 ; close this program
|
||||
@@:
|
||||
cmp eax,0x0000fe00
|
||||
jg @f
|
||||
|
||||
cmp ah, 4
|
||||
je hook
|
||||
|
||||
jmp still
|
||||
@@:
|
||||
shr eax, 16
|
||||
mov dword[MAC],0
|
||||
mov word [MAC+4],0
|
||||
mov word [selected], ax
|
||||
|
||||
call load_drv
|
||||
call draw_window
|
||||
|
||||
jmp still
|
||||
|
||||
load_drv:
|
||||
; mov ax , [selected]
|
||||
test ax , ax
|
||||
jz still
|
||||
|
||||
mov bl , 6 ; get a dword
|
||||
mov bh , ah ; bus
|
||||
mov ch , al ; dev
|
||||
mov cl , 0 ; offset to device/vendor id
|
||||
mcall 62 ; get ID's
|
||||
|
||||
mov word [PCI_Vendor], ax
|
||||
shr eax, 16
|
||||
mov word [PCI_Device], ax
|
||||
call get_drv_ptr
|
||||
|
||||
mov ecx, eax
|
||||
mcall 68, 16
|
||||
|
||||
mov [IOCTL.handle], eax
|
||||
|
||||
ret
|
||||
|
||||
hook:
|
||||
mov ax , [selected]
|
||||
test ax , ax
|
||||
jz still
|
||||
|
||||
mov [hardwareinfo.pci_dev], al
|
||||
mov [hardwareinfo.pci_bus], ah
|
||||
|
||||
mov [IOCTL.io_code], 1 ; SRV_HOOK
|
||||
mov [IOCTL.inp_size], 3
|
||||
mov [IOCTL.input], hardwareinfo
|
||||
mov [IOCTL.out_size], 0
|
||||
mov [IOCTL.output], 0
|
||||
|
||||
mcall 68, 17, IOCTL
|
||||
|
||||
mov byte[drivernumber], al
|
||||
|
||||
printhdwaddr:
|
||||
|
||||
call draw_window
|
||||
|
||||
jmp still
|
||||
|
||||
draw_window:
|
||||
mcall 12, 1 ; start of draw
|
||||
mcall 0, dword [Form], dword [Form + 4], 0x13ffffff, 0x805080d0, title
|
||||
|
||||
mcall 73, 0
|
||||
mov ecx, eax
|
||||
mcall 47, 1 shl 18, , 50 shl 16 + 10, 0x00000000
|
||||
|
||||
call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device
|
||||
|
||||
cmp edx, 20 shl 16 + 110
|
||||
je .nonefound
|
||||
|
||||
mcall 4, 20 shl 16 + 100, 1 shl 31 + 0x00000000 , caption
|
||||
|
||||
mcall 8, 122 shl 16 + 100, 50 shl 16 + 18, 0x00000004, 0x00007f00
|
||||
mcall ,, 70 shl 16 + 18, 0x00000005, 0x007f0000
|
||||
|
||||
mcall 4, 137 shl 16 + 57, 1 shl 31 + 0x00ffffff , btn_start
|
||||
mcall , 140 shl 16 + 77, , btn_stop
|
||||
|
||||
mcall , 240 shl 16 + 77, 1 shl 31 + 0x00000000 , lbl_hdw_addr
|
||||
mcall , 312 shl 16 + 57, , lbl_type
|
||||
add ebx, 38 shl 16
|
||||
cmp byte [type],type_ethernet
|
||||
jne @f
|
||||
mcall , , 1 shl 31 + 0x00000000, lbl_ethernet
|
||||
|
||||
mcall 8,345 shl 16 + 17, 73 shl 16 + 14, 0x00000006, 0x00aaaa00
|
||||
mcall ,365 shl 16 + 17, , 0x00000007
|
||||
mcall ,385 shl 16 + 17, , 0x00000008
|
||||
mcall ,405 shl 16 + 17, , 0x00000009
|
||||
mcall ,425 shl 16 + 17, , 0x0000000a
|
||||
mcall ,445 shl 16 + 17, , 0x0000000b
|
||||
movzx ecx,byte[MAC]
|
||||
mcall 47, 1 shl 17 + 1 shl 8,,349 shl 16 + 77, 0x000022cc
|
||||
movzx ecx,byte[MAC+1]
|
||||
add edx, 20 shl 16
|
||||
mcall
|
||||
movzx ecx,byte[MAC+2]
|
||||
add edx, 20 shl 16
|
||||
mcall
|
||||
movzx ecx,byte[MAC+3]
|
||||
add edx, 20 shl 16
|
||||
mcall
|
||||
movzx ecx,byte[MAC+4]
|
||||
add edx, 20 shl 16
|
||||
mcall
|
||||
movzx ecx,byte[MAC+5]
|
||||
add edx, 20 shl 16
|
||||
mcall
|
||||
|
||||
jmp .done
|
||||
|
||||
@@:
|
||||
mcall 4, , 1 shl 31 + 0x00ff0000, lbl_unknown
|
||||
jmp .done
|
||||
|
||||
.nonefound :
|
||||
mcall 4, 20 shl 16 + 30, 1 shl 31 + 0x00ff0000 , nonefound
|
||||
.done:
|
||||
mcall 12, 2 ; end of draw
|
||||
ret
|
||||
|
||||
|
||||
;------------------------------------------------------------------
|
||||
;* Gets the PCI Version and Last Bus
|
||||
Get_PCI_Info:
|
||||
mcall 62, 0
|
||||
mov word [PCI_Version], ax
|
||||
mcall 62, 1
|
||||
mov byte [PCI_LastBus], al
|
||||
;----------------------------------------------------------
|
||||
;* Get all devices on PCI Bus
|
||||
mov edx, 20 shl 16 + 110 ; set start write position
|
||||
cmp al , 0xff ; 0xFF means no pci bus found
|
||||
jne Pci_Exists ;
|
||||
ret ; if no bus then leave
|
||||
Pci_Exists:
|
||||
mov byte [V_Bus], 0 ; reset varibles
|
||||
mov byte [V_Dev], 0 ;
|
||||
Start_Enum:
|
||||
mov bl , 6 ; get a dword
|
||||
mov bh , byte [V_Bus] ; bus of pci device
|
||||
mov ch , byte [V_Dev] ; device number/function
|
||||
mov cl , 0 ; offset to device/vendor id
|
||||
mcall 62 ; get ID's
|
||||
|
||||
cmp ax, 0 ; Vendor ID should not be 0 or 0xFFFF
|
||||
je nextDev ; check next device if nothing exists here
|
||||
cmp ax, 0xffff ;
|
||||
je nextDev ;
|
||||
|
||||
mov word [PCI_Vendor], ax ; There is a device here, save the ID's
|
||||
shr eax, 16 ;
|
||||
mov word [PCI_Device], ax ;
|
||||
mov bl , 4 ; Read config byte
|
||||
mov bh , byte [V_Bus] ; Bus #
|
||||
mov ch , byte [V_Dev] ; Device # on bus
|
||||
mov cl , 0x08 ; Register to read (Get Revision)
|
||||
mcall 62 ; Read it
|
||||
mov byte [PCI_Rev], al ; Save it
|
||||
mov cl , 0x0b ; Register to read (Get class)
|
||||
mcall 62 ; Read it
|
||||
|
||||
mov byte [PCI_Class], al ; Save it
|
||||
mov cl , 0x0a ; Register to read (Get Subclass)
|
||||
mcall 62 ; Read it
|
||||
mov byte [PCI_SubClass], al ; Save it
|
||||
mov cl , 0x09 ; Register to read (Get Interface)
|
||||
mcall 62 ; Read it
|
||||
mov [PCI_Interface], al ; Save it
|
||||
mov cl , 0x3c ; Register to read (Get IRQ)
|
||||
@@: mcall 62 ; Read it
|
||||
mov [PCI_IRQ], al ; Save it
|
||||
;
|
||||
; inc byte [total] ; one more device found
|
||||
|
||||
cmp byte [PCI_Class],2
|
||||
jne nextDev
|
||||
|
||||
call Print_New_Device ; print device info to screen
|
||||
nextDev:
|
||||
add byte [V_Dev], 8 ; lower 3 bits are the function number
|
||||
|
||||
jnz Start_Enum ; jump until we reach zero
|
||||
mov byte [V_Dev], 0 ; reset device number
|
||||
inc byte [V_Bus] ; next bus
|
||||
mov al , byte [PCI_LastBus] ; get last bus
|
||||
cmp byte [V_Bus], al ; was it last bus
|
||||
jbe Start_Enum ; if not jump to keep searching
|
||||
ret
|
||||
|
||||
;------------------------------------------------------------------
|
||||
;* Print device info to screen
|
||||
Print_New_Device:
|
||||
|
||||
push edx ; Magic ! (to print a button...)
|
||||
|
||||
mov ebx, 18 shl 16
|
||||
mov bx , [Form]
|
||||
sub bx , 36
|
||||
|
||||
mov cx , dx
|
||||
dec cx
|
||||
shl ecx, 16
|
||||
add ecx, 9
|
||||
|
||||
movzx edx, byte [V_Bus]
|
||||
shl dx , 8
|
||||
mov dl , byte [V_Dev]
|
||||
|
||||
mov esi, 0x0000c0ff ; color: yellow if selected, blue otherwise
|
||||
cmp word [selected], dx
|
||||
jne @f
|
||||
mov esi, 0x00c0c000
|
||||
@@:
|
||||
|
||||
shl edx, 8
|
||||
or dl , 0xff
|
||||
|
||||
mcall 8
|
||||
pop edx
|
||||
|
||||
xor esi, esi ; Color of text
|
||||
movzx ecx, word [PCI_Vendor] ; number to be written
|
||||
mcall 47, 0x00040100 ; Write Vendor ID
|
||||
|
||||
add edx, (4*6+18) shl 16
|
||||
movzx ecx, word [PCI_Device] ; get Vendor ID
|
||||
mcall ; Draw Vendor ID to Window
|
||||
|
||||
add edx, (4*6+18) shl 16
|
||||
movzx ecx, byte [V_Bus] ; get bus number
|
||||
mcall ,0x00020100 ; draw bus number to screen
|
||||
|
||||
add edx, (2*6+18) shl 16
|
||||
movzx ecx, byte [V_Dev] ; get device number
|
||||
shr ecx, 3 ; device number is bits 3-7
|
||||
mcall ; Draw device Number To Window
|
||||
|
||||
add edx, (2*6+18) shl 16
|
||||
movzx ecx, byte [PCI_Rev] ; get revision number
|
||||
mcall ; Draw Revision to screen
|
||||
|
||||
add edx, (2*6+18) shl 16
|
||||
movzx ecx, [PCI_IRQ]
|
||||
cmp cl , 0x0f ; IRQ must be between 0 and 15
|
||||
ja @f
|
||||
mcall
|
||||
@@:
|
||||
;
|
||||
;Write Names
|
||||
movzx ebx, dx ; Set y position
|
||||
or ebx, 230 shl 16 ; set Xposition
|
||||
|
||||
;------------------------------------------------------------------
|
||||
; Prints the Vendor's Name based on Vendor ID
|
||||
;------------------------------------------------------------------
|
||||
mov edx, VendorsTab
|
||||
mov cx , word[PCI_Vendor]
|
||||
|
||||
.fn: mov ax , [edx]
|
||||
add edx, 6
|
||||
test ax , ax
|
||||
jz .find
|
||||
cmp ax , cx
|
||||
jne .fn
|
||||
.find: mov edx, [edx - 4]
|
||||
mcall 4,, 0x80000000 ; lets print the vendor Name
|
||||
|
||||
;------------------------------------------------------------------
|
||||
; Get description based on Class/Subclass
|
||||
;------------------------------------------------------------------
|
||||
mov eax, dword [PCI_Class]
|
||||
and eax, 0xffffff
|
||||
xor edx, edx
|
||||
xor esi, esi
|
||||
.fnc: inc esi
|
||||
mov ecx, [Classes + esi * 8 - 8]
|
||||
cmp cx , 0xffff
|
||||
je .endfc
|
||||
cmp cx , ax
|
||||
jne .fnc
|
||||
test ecx, 0xff000000
|
||||
jz @f
|
||||
mov edx, [Classes + esi * 8 - 4]
|
||||
jmp .fnc
|
||||
@@: cmp eax, ecx
|
||||
jne .fnc
|
||||
xor edx, edx
|
||||
.endfc: test edx, edx
|
||||
jnz @f
|
||||
mov edx, [Classes + esi * 8 - 4]
|
||||
@@:
|
||||
add ebx, 288 shl 16
|
||||
mcall 4,, 0x80000000,, 32 ; draw the text
|
||||
movzx edx, bx ; get y coordinate
|
||||
add edx, 0x0014000A ; add 10 to y coordinate and set x coordinate to 20
|
||||
|
||||
;------------------------------------------------------------------
|
||||
; Print Driver Name
|
||||
;------------------------------------------------------------------
|
||||
push edx
|
||||
add ebx, 120 shl 16
|
||||
push ebx
|
||||
|
||||
call get_drv_ptr
|
||||
mov edx, eax
|
||||
pop ebx
|
||||
mcall 4,,0x80000000 ; lets print the vendor Name
|
||||
pop edx
|
||||
ret
|
||||
|
||||
get_drv_ptr:
|
||||
mov eax, driverlist ; eax will be the pointer to latest driver title
|
||||
mov ebx, driverlist ; ebx is the current pointer
|
||||
mov ecx, dword[PCI_Vendor] ; the device/vendor id of we want to find
|
||||
|
||||
driverloop:
|
||||
inc ebx
|
||||
|
||||
cmp byte[ebx],0
|
||||
jne driverloop
|
||||
|
||||
inc ebx ; the device/vendor id list for the driver eax is pointing to starts here.
|
||||
|
||||
deviceloop:
|
||||
cmp dword[ebx],0
|
||||
je nextdriver
|
||||
|
||||
cmp dword[ebx],ecx
|
||||
je driverfound
|
||||
|
||||
add ebx,4
|
||||
jmp deviceloop
|
||||
|
||||
nextdriver:
|
||||
add ebx,4
|
||||
|
||||
cmp dword[ebx],0
|
||||
je nodriver
|
||||
|
||||
mov eax,ebx
|
||||
jmp driverloop
|
||||
|
||||
nodriver:
|
||||
mov eax, lbl_none ; lets print the vendor Name
|
||||
ret
|
||||
|
||||
driverfound:
|
||||
ret
|
||||
|
||||
include 'VENDORS.INC'
|
||||
include 'DRIVERS.INC'
|
||||
;------------------------------------------------------------------
|
||||
; DATA AREA
|
||||
DATA
|
||||
|
||||
|
||||
Form: dw 800 ; window width (no more, special for 800x600)
|
||||
dw 100 ; window x start
|
||||
dw 220 ; window height
|
||||
dw 100 ; window y start
|
||||
|
||||
title db 'Network Driver Control Center', 0
|
||||
|
||||
caption db 'Vendor Device Bus Dev Rev IRQ Company Description DRIVER',0
|
||||
lbl_1 db 'Hardware control',0
|
||||
nonefound db 'No compatible devices were found!',0
|
||||
btn_start db 'Start driver',0
|
||||
btn_stop db 'Stop driver',0
|
||||
lbl_hdw_addr db 'hardware address:',0
|
||||
lbl_type db 'type:',0
|
||||
lbl_none db 'none',0
|
||||
lbl_unknown db 'unknown',0
|
||||
lbl_ethernet db 'ethernet',0
|
||||
|
||||
|
||||
IOCTL:
|
||||
.handle dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
.output dd ?
|
||||
.out_size dd ?
|
||||
|
||||
drivernumber db ?
|
||||
MAC dp ?
|
||||
|
||||
hardwareinfo:
|
||||
.type db 1 ; pci
|
||||
.pci_bus db ?
|
||||
.pci_dev db ?
|
||||
|
||||
|
||||
;------------------------------------------------------------------
|
||||
; UNINITIALIZED DATA AREA
|
||||
UDATA
|
||||
|
||||
type db ?
|
||||
selected dw ?
|
||||
V_Bus db ?
|
||||
V_Dev db ?
|
||||
PCI_Version dw ?
|
||||
PCI_LastBus db ?
|
||||
PCI_Vendor dw ?
|
||||
PCI_Device dw ?
|
||||
PCI_Bus db ?
|
||||
PCI_Dev db ?
|
||||
PCI_Rev db ?
|
||||
; don`t change order!!!
|
||||
PCI_Class db ?
|
||||
PCI_SubClass db ?
|
||||
PCI_Interface db ?
|
||||
PCI_IRQ db ?
|
||||
|
||||
Proc_Info process_information
|
||||
|
||||
|
||||
MEOS_APP_END
|
270
kernel/branches/net/applications/netcfg/proc32.inc
Normal file
270
kernel/branches/net/applications/netcfg/proc32.inc
Normal file
@ -0,0 +1,270 @@
|
||||
|
||||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call proc
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
match name params, args>
|
||||
\{ define@proc name,<params \} }
|
||||
|
||||
prologue@proc equ prologuedef
|
||||
|
||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ if parmbytes | localbytes
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
if localbytes
|
||||
sub esp,localbytes
|
||||
end if
|
||||
end if
|
||||
irps reg, reglist \{ push reg \} }
|
||||
|
||||
epilogue@proc equ epiloguedef
|
||||
|
||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ irps reg, reglist \{ reverse pop reg \}
|
||||
if parmbytes | localbytes
|
||||
leave
|
||||
end if
|
||||
if flag and 10000b
|
||||
retn
|
||||
else
|
||||
retn parmbytes
|
||||
end if }
|
||||
|
||||
macro define@proc name,statement
|
||||
{ local params,flag,regs,parmbytes,localbytes,current
|
||||
if used name
|
||||
name:
|
||||
match =stdcall args, statement \{ params equ args
|
||||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at ebp+8
|
||||
match =uses reglist=,args, params \{ regs equ reglist
|
||||
params equ args \}
|
||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||
params equ \}
|
||||
match =regs, regs \{ regs equ \}
|
||||
match =,args, params \{ defargs@proc args \}
|
||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||
parmbytes = $ - (ebp+8)
|
||||
end virtual
|
||||
name # % = parmbytes/4
|
||||
all@vars equ
|
||||
current = 0
|
||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||
macro locals
|
||||
\{ virtual at ebp-localbytes+current
|
||||
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
|
||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||
struc du [val] \\{ \common deflocal@proc .,du,val \\}
|
||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||
macro endl
|
||||
\{ purge label
|
||||
restruc db,du,dw,dp,dd,dt,dq
|
||||
restruc rb,rw,rp,rd,rt,rq
|
||||
current = $-(ebp-localbytes)
|
||||
end virtual \}
|
||||
macro ret operand
|
||||
\{ match any, operand \\{ retn operand \\}
|
||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
||||
end if \} }
|
||||
|
||||
macro defargs@proc [arg]
|
||||
{ common
|
||||
if ~ arg eq
|
||||
forward
|
||||
local ..arg,current@arg
|
||||
match argname:type, arg
|
||||
\{ current@arg equ argname
|
||||
label ..arg type
|
||||
argname equ ..arg
|
||||
if dqword eq type
|
||||
dd ?,?,?,?
|
||||
else if tbyte eq type
|
||||
dd ?,?,?
|
||||
else if qword eq type | pword eq type
|
||||
dd ?,?
|
||||
else
|
||||
dd ?
|
||||
end if \}
|
||||
match =current@arg,current@arg
|
||||
\{ current@arg equ arg
|
||||
arg equ ..arg
|
||||
..arg dd ? \}
|
||||
common
|
||||
args@proc equ current@arg
|
||||
forward
|
||||
restore current@arg
|
||||
common
|
||||
end if }
|
||||
|
||||
macro deflocal@proc name,def,[val]
|
||||
{ common
|
||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||
all@vars equ all@vars name
|
||||
forward
|
||||
local ..var,..tmp
|
||||
match =label,def \{ ..tmp equ \}
|
||||
match tmp,..tmp \{ ..var def val \}
|
||||
match ,..tmp \{ label ..var val \}
|
||||
match =?, val \{ ..tmp equ \}
|
||||
match any =dup (=?), val \{ ..tmp equ \}
|
||||
match tmp : value, ..tmp : val
|
||||
\{ tmp: end virtual
|
||||
initlocal@proc ..var,def value
|
||||
virtual at tmp\}
|
||||
common
|
||||
match first rest, ..var, \{ name equ first \} }
|
||||
|
||||
macro initlocal@proc name,def
|
||||
{ virtual at name
|
||||
def
|
||||
size@initlocal = $ - name
|
||||
end virtual
|
||||
position@initlocal = 0
|
||||
while size@initlocal > position@initlocal
|
||||
virtual at name
|
||||
def
|
||||
if size@initlocal - position@initlocal < 2
|
||||
current@initlocal = 1
|
||||
load byte@initlocal byte from name+position@initlocal
|
||||
else if size@initlocal - position@initlocal < 4
|
||||
current@initlocal = 2
|
||||
load word@initlocal word from name+position@initlocal
|
||||
else
|
||||
current@initlocal = 4
|
||||
load dword@initlocal dword from name+position@initlocal
|
||||
end if
|
||||
end virtual
|
||||
if current@initlocal = 1
|
||||
mov byte [name+position@initlocal],byte@initlocal
|
||||
else if current@initlocal = 2
|
||||
mov word [name+position@initlocal],word@initlocal
|
||||
else
|
||||
mov dword [name+position@initlocal],dword@initlocal
|
||||
end if
|
||||
position@initlocal = position@initlocal + current@initlocal
|
||||
end while }
|
||||
|
||||
macro endp
|
||||
{ purge ret,locals,endl
|
||||
finish@proc
|
||||
purge finish@proc
|
||||
restore regs@proc
|
||||
match all,args@proc \{ restore all \}
|
||||
restore args@proc
|
||||
match all,all@vars \{ restore all \} }
|
||||
|
||||
macro local [var]
|
||||
{ common
|
||||
locals
|
||||
forward done@local equ
|
||||
match varname[count]:vartype, var
|
||||
\{ match =BYTE, vartype \\{ varname rb count
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname rw count
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname rd count
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname rp count
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname rq count
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname rt count
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
rq count+count
|
||||
restore done@local \\}
|
||||
match , done@local \\{ virtual
|
||||
varname vartype
|
||||
end virtual
|
||||
rb count*sizeof.\#vartype
|
||||
restore done@local \\} \}
|
||||
match :varname:vartype, done@local:var
|
||||
\{ match =BYTE, vartype \\{ varname db ?
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname dw ?
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname dd ?
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname dp ?
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname dq ?
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname dt ?
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
dq ?,?
|
||||
restore done@local \\}
|
||||
match , done@local \\{ varname vartype
|
||||
restore done@local \\} \}
|
||||
match ,done@local
|
||||
\{ var
|
||||
restore done@local \}
|
||||
common
|
||||
endl }
|
180
kernel/branches/net/applications/netcfg/struct.inc
Normal file
180
kernel/branches/net/applications/netcfg/struct.inc
Normal file
@ -0,0 +1,180 @@
|
||||
; Macroinstructions for defining data structures
|
||||
|
||||
macro struct name
|
||||
{ fields@struct equ name
|
||||
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
||||
sub@struct equ
|
||||
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
|
||||
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
|
||||
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
|
||||
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
|
||||
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
|
||||
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
|
||||
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
|
||||
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
|
||||
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
|
||||
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
|
||||
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
|
||||
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
|
||||
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
|
||||
macro db [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,<val> \}
|
||||
macro dw [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,<val> \}
|
||||
macro du [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,du,<val> \}
|
||||
macro dd [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,<val> \}
|
||||
macro dp [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,<val> \}
|
||||
macro dq [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,<val> \}
|
||||
macro dt [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,<val> \}
|
||||
macro rb count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
|
||||
macro rw count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
|
||||
macro rd count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
|
||||
macro rp count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
|
||||
macro rq count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
|
||||
macro rt count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
|
||||
macro union \{ fields@struct equ fields@struct,,union,<
|
||||
sub@struct equ union \}
|
||||
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
||||
sub@struct equ substruct \}
|
||||
virtual at 0 }
|
||||
|
||||
macro ends
|
||||
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
||||
restruc rb,rw,rd,rp,rq,rt
|
||||
purge db,dw,du,dd,dp,dq,dt
|
||||
purge rb,rw,rd,rp,rq,rt
|
||||
purge union,struct
|
||||
match name=,fields,fields@struct \\{ fields@struct equ
|
||||
make@struct name,fields
|
||||
fields@\\#name equ fields \\}
|
||||
end virtual \}
|
||||
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
||||
restore sub@struct }
|
||||
|
||||
macro make@struct name,[field,type,def]
|
||||
{ common
|
||||
if $
|
||||
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
|
||||
err
|
||||
end if
|
||||
local define
|
||||
define equ name
|
||||
forward
|
||||
local sub
|
||||
match , field \{ make@substruct type,name,sub def
|
||||
define equ define,.,sub, \}
|
||||
match any, field \{ define equ define,.#field,type,<def> \}
|
||||
common
|
||||
match fields, define \{ define@struct fields \} }
|
||||
|
||||
macro define@struct name,[field,type,def]
|
||||
{ common
|
||||
local list
|
||||
list equ
|
||||
forward
|
||||
if ~ field eq .
|
||||
name#field type def
|
||||
sizeof.#name#field = $ - name#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
match any, list \{ list equ list, \}
|
||||
list equ list <value>
|
||||
common
|
||||
sizeof.#name = $
|
||||
restruc name
|
||||
match values, list \{
|
||||
struc name value \\{
|
||||
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
||||
match , fields@struct \\\{ label .
|
||||
forward
|
||||
match , value \\\\{ field type def \\\\}
|
||||
match any, value \\\\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#name#field - ($-field)
|
||||
end if \\\\}
|
||||
common \\\} \\} \} }
|
||||
|
||||
macro enable@substruct
|
||||
{ macro make@substruct substruct,parent,name,[field,type,def]
|
||||
\{ \common
|
||||
\local define
|
||||
define equ parent,name
|
||||
\forward
|
||||
\local sub
|
||||
match , field \\{ match any, type \\\{ enable@substruct
|
||||
make@substruct type,name,sub def
|
||||
purge make@substruct
|
||||
define equ define,.,sub, \\\} \\}
|
||||
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
||||
\common
|
||||
match fields, define \\{ define@\#substruct fields \\} \} }
|
||||
|
||||
enable@substruct
|
||||
|
||||
macro define@union parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
virtual at 0
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
end virtual
|
||||
if sizeof.#parent#field > $
|
||||
rb sizeof.#parent#field - $
|
||||
end if
|
||||
else if sizeof.#type > $
|
||||
rb sizeof.#type - $
|
||||
end if
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name [value] \{ \common
|
||||
label .\#name
|
||||
last@union equ
|
||||
forward
|
||||
match any, last@union \\{ virtual at .\#name
|
||||
field type def
|
||||
end virtual \\}
|
||||
match , last@union \\{ match , value \\\{ field type def \\\}
|
||||
match any, value \\\{ field type value \\\} \\}
|
||||
last@union equ field
|
||||
common rb sizeof.#name - ($ - .\#name) \} }
|
||||
|
||||
macro define@substruct parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name value \{
|
||||
label .\#name
|
||||
forward
|
||||
match , value \\{ field type def \\}
|
||||
match any, value \\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#parent#field - ($-field)
|
||||
end if \\}
|
||||
common \} }
|
||||
|
1071
kernel/branches/net/applications/netcfg/vendors.inc
Normal file
1071
kernel/branches/net/applications/netcfg/vendors.inc
Normal file
File diff suppressed because it is too large
Load Diff
422
kernel/branches/net/applications/zeroconf/debug-fdo.inc
Normal file
422
kernel/branches/net/applications/zeroconf/debug-fdo.inc
Normal file
@ -0,0 +1,422 @@
|
||||
;
|
||||
; Formatted Debug Output (FDO)
|
||||
; Copyright (c) 2005-2006, mike.dld
|
||||
; Created: 2005-01-29, Changed: 2006-11-10
|
||||
;
|
||||
; For questions and bug reports, mail to mike.dld@gmail.com
|
||||
;
|
||||
; Available format specifiers are: %s, %d, %u, %x (with partial width support)
|
||||
;
|
||||
|
||||
; to be defined:
|
||||
; __DEBUG__ equ 1
|
||||
; __DEBUG_LEVEL__ equ 5
|
||||
|
||||
macro debug_func name {
|
||||
if used name
|
||||
name@of@func equ name
|
||||
}
|
||||
|
||||
macro debug_beginf {
|
||||
align 4
|
||||
name@of@func:
|
||||
}
|
||||
|
||||
debug_endf fix end if
|
||||
|
||||
macro DEBUGS _sign,[_str] {
|
||||
common
|
||||
local tp
|
||||
tp equ 0
|
||||
match _arg:_num,_str \{
|
||||
DEBUGS_N _sign,_num,_arg
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 _arg,tp _str \{
|
||||
DEBUGS_N _sign,,_arg
|
||||
\}
|
||||
}
|
||||
|
||||
macro DEBUGS_N _sign,_num,[_str] {
|
||||
common
|
||||
pushf
|
||||
pushad
|
||||
local ..str,..label,is_str
|
||||
is_str = 0
|
||||
forward
|
||||
if _str eqtype ''
|
||||
is_str = 1
|
||||
end if
|
||||
common
|
||||
if is_str = 1
|
||||
jmp ..label
|
||||
..str db _str,0
|
||||
..label:
|
||||
add esp,4*8+4
|
||||
mov edx,..str
|
||||
sub esp,4*8+4
|
||||
else
|
||||
mov edx,_str
|
||||
end if
|
||||
if ~_num eq
|
||||
if _num eqtype eax
|
||||
if _num in <eax,ebx,ecx,edx,edi,ebp,esp>
|
||||
mov esi,_num
|
||||
else if ~_num eq esi
|
||||
movzx esi,_num
|
||||
end if
|
||||
else if _num eqtype 0
|
||||
mov esi,_num
|
||||
else
|
||||
local tp
|
||||
tp equ 0
|
||||
match [_arg],_num \{
|
||||
mov esi,dword[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 =dword[_arg],tp _num \{
|
||||
mov esi,dword[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 =word[_arg],tp _num \{
|
||||
movzx esi,word[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 =byte[_arg],tp _num \{
|
||||
movzx esi,byte[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0,tp \{
|
||||
'Error: specified string width is incorrect'
|
||||
\}
|
||||
end if
|
||||
else
|
||||
mov esi,0x7FFFFFFF
|
||||
end if
|
||||
call fdo_debug_outstr
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
macro DEBUGD _sign,_dec {
|
||||
local tp
|
||||
tp equ 0
|
||||
match _arg:_num,_dec \{
|
||||
DEBUGD_N _sign,_num,_arg
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 _arg,tp _dec \{
|
||||
DEBUGD_N _sign,,_arg
|
||||
\}
|
||||
}
|
||||
|
||||
macro DEBUGD_N _sign,_num,_dec {
|
||||
pushf
|
||||
pushad
|
||||
if (~_num eq)
|
||||
if (_dec eqtype eax | _dec eqtype 0)
|
||||
'Error: precision allowed only for in-memory variables'
|
||||
end if
|
||||
if (~_num in <1,2,4>)
|
||||
if _sign
|
||||
'Error: 1, 2 and 4 are only allowed for precision in %d'
|
||||
else
|
||||
'Error: 1, 2 and 4 are only allowed for precision in %u'
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
if _dec eqtype eax
|
||||
if _dec in <ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
mov eax,_dec
|
||||
else if ~_dec eq eax
|
||||
if _sign = 1
|
||||
movsx eax,_dec
|
||||
else
|
||||
movzx eax,_dec
|
||||
end if
|
||||
end if
|
||||
else if _dec eqtype 0
|
||||
mov eax,_dec
|
||||
else
|
||||
add esp,4*8+4
|
||||
if _num eq
|
||||
mov eax,dword _dec
|
||||
else if _num = 1
|
||||
if _sign = 1
|
||||
movsx eax,byte _dec
|
||||
else
|
||||
movzx eax,byte _dec
|
||||
end if
|
||||
else if _num = 2
|
||||
if _sign = 1
|
||||
movsx eax,word _dec
|
||||
else
|
||||
movzx eax,word _dec
|
||||
end if
|
||||
else
|
||||
mov eax,dword _dec
|
||||
end if
|
||||
sub esp,4*8+4
|
||||
end if
|
||||
mov cl,_sign
|
||||
call fdo_debug_outdec
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
macro DEBUGH _sign,_hex {
|
||||
local tp
|
||||
tp equ 0
|
||||
match _arg:_num,_hex \{
|
||||
DEBUGH_N _sign,_num,_arg
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 _arg,tp _hex \{
|
||||
DEBUGH_N _sign,,_arg
|
||||
\}
|
||||
}
|
||||
|
||||
macro DEBUGH_N _sign,_num,_hex {
|
||||
pushf
|
||||
pushad
|
||||
if (~_num eq) & (~_num in <1,2,3,4,5,6,7,8>)
|
||||
'Error: 1..8 are only allowed for precision in %x'
|
||||
end if
|
||||
if _hex eqtype eax
|
||||
if _hex in <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
if ~_hex eq eax
|
||||
mov eax,_hex
|
||||
end if
|
||||
else if _hex in <ax,bx,cx,dx,si,di,bp,sp>
|
||||
if ~_hex eq ax
|
||||
movzx eax,_hex
|
||||
end if
|
||||
shl eax,16
|
||||
if (_num eq)
|
||||
mov edx,4
|
||||
end if
|
||||
else if _hex in <al,ah,bl,bh,cl,ch,dl,dh>
|
||||
if ~_hex eq al
|
||||
movzx eax,_hex
|
||||
end if
|
||||
shl eax,24
|
||||
if (_num eq)
|
||||
mov edx,2
|
||||
end if
|
||||
end if
|
||||
else if _hex eqtype 0
|
||||
mov eax,_hex
|
||||
else
|
||||
add esp,4*8+4
|
||||
mov eax,dword _hex
|
||||
sub esp,4*8+4
|
||||
end if
|
||||
if ~_num eq
|
||||
mov edx,_num
|
||||
else
|
||||
mov edx,8
|
||||
end if
|
||||
call fdo_debug_outhex
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
debug_func fdo_debug_outchar
|
||||
debug_beginf
|
||||
pushad
|
||||
mov cl,al
|
||||
mov ebx,1
|
||||
mov eax,63
|
||||
mcall
|
||||
popad
|
||||
ret
|
||||
debug_endf
|
||||
|
||||
debug_func fdo_debug_outstr
|
||||
debug_beginf
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
.l1: dec esi
|
||||
js .l2
|
||||
mov cl,[edx]
|
||||
or cl,cl
|
||||
jz .l2
|
||||
mcall
|
||||
inc edx
|
||||
jmp .l1
|
||||
.l2: ret
|
||||
debug_endf
|
||||
|
||||
debug_func fdo_debug_outdec
|
||||
debug_beginf
|
||||
or cl,cl
|
||||
jz @f
|
||||
or eax,eax
|
||||
jns @f
|
||||
neg eax
|
||||
push eax
|
||||
mov al,'-'
|
||||
call fdo_debug_outchar
|
||||
pop eax
|
||||
@@: push 10
|
||||
pop ecx
|
||||
push -'0'
|
||||
.l1: xor edx,edx
|
||||
div ecx
|
||||
push edx
|
||||
test eax,eax
|
||||
jnz .l1
|
||||
.l2: pop eax
|
||||
add al,'0'
|
||||
jz .l3
|
||||
call fdo_debug_outchar
|
||||
jmp .l2
|
||||
.l3: ret
|
||||
debug_endf
|
||||
|
||||
debug_func fdo_debug_outhex
|
||||
__fdo_hexdigits db '0123456789ABCDEF'
|
||||
debug_beginf
|
||||
mov cl,dl
|
||||
neg cl
|
||||
add cl,8
|
||||
shl cl,2
|
||||
rol eax,cl
|
||||
.l1: rol eax,4
|
||||
push eax
|
||||
and eax,0x0000000F
|
||||
mov al,[__fdo_hexdigits+eax]
|
||||
call fdo_debug_outchar
|
||||
pop eax
|
||||
dec edx
|
||||
jnz .l1
|
||||
ret
|
||||
debug_endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
macro DEBUGF _level,_format,[_arg] {
|
||||
common
|
||||
if __DEBUG__ = 1 & _level >= __DEBUG_LEVEL__
|
||||
local ..f1,f2,a1,a2,c1,c2,c3,..lbl
|
||||
_debug_str_ equ __debug_str_ # a1
|
||||
a1 = 0
|
||||
c2 = 0
|
||||
c3 = 0
|
||||
f2 = 0
|
||||
repeat ..lbl-..f1
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
load c1 word from %-1
|
||||
end virtual
|
||||
if c1 = '%s'
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
store word 0 at %-1
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if c1 <> 0
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
c2 = c2 + 1
|
||||
f2 = %+1
|
||||
DEBUGF_HELPER S,a1,0,_arg
|
||||
else if c1 = '%x'
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
store word 0 at %-1
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if c1 <> 0
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
c2 = c2 + 1
|
||||
f2 = %+1
|
||||
DEBUGF_HELPER H,a1,0,_arg
|
||||
else if c1 = '%d' | c1 = '%u'
|
||||
local c4
|
||||
if c1 = '%d'
|
||||
c4 = 1
|
||||
else
|
||||
c4 = 0
|
||||
end if
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
store word 0 at %-1
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if c1 <> 0
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
c2 = c2 + 1
|
||||
f2 = %+1
|
||||
DEBUGF_HELPER D,a1,c4,_arg
|
||||
else if c1 = '\n'
|
||||
c3 = c3 + 1
|
||||
end if
|
||||
end repeat
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if (c1<>0)&(f2<>..lbl-..f1-1)
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
virtual at 0
|
||||
..f1 db _format,0
|
||||
..lbl:
|
||||
__debug_strings equ __debug_strings,_debug_str_,<_format>,..lbl-..f1-1-c2-c3
|
||||
end virtual
|
||||
end if
|
||||
}
|
||||
|
||||
macro __include_debug_strings dummy,[_id,_fmt,_len] {
|
||||
common
|
||||
local c1,a1,a2
|
||||
forward
|
||||
if defined _len & ~_len eq
|
||||
_id:
|
||||
a1 = 0
|
||||
a2 = 0
|
||||
repeat _len
|
||||
virtual at 0
|
||||
db _fmt,0,0
|
||||
load c1 word from %+a2-1
|
||||
end virtual
|
||||
if (c1='%s')|(c1='%x')|(c1='%d')|(c1='%u')
|
||||
db 0
|
||||
a2 = a2 + 1
|
||||
else if (c1='\n')
|
||||
dw $0A0D
|
||||
a1 = a1 + 1
|
||||
a2 = a2 + 1
|
||||
else
|
||||
db c1 and 0x0FF
|
||||
end if
|
||||
end repeat
|
||||
db 0
|
||||
end if
|
||||
}
|
||||
|
||||
macro DEBUGF_HELPER _letter,_num,_sign,[_arg] {
|
||||
common
|
||||
local num
|
||||
num = 0
|
||||
forward
|
||||
if num = _num
|
||||
DEBUG#_letter _sign,_arg
|
||||
end if
|
||||
num = num+1
|
||||
common
|
||||
_num = _num+1
|
||||
}
|
||||
|
||||
macro include_debug_strings {
|
||||
if __DEBUG__ = 1
|
||||
match dbg_str,__debug_strings \{
|
||||
__include_debug_strings dbg_str
|
||||
\}
|
||||
end if
|
||||
}
|
263
kernel/branches/net/applications/zeroconf/dhcp.inc
Normal file
263
kernel/branches/net/applications/zeroconf/dhcp.inc
Normal file
@ -0,0 +1,263 @@
|
||||
;Name Number Length Meaning
|
||||
|
||||
dhcp_pad_option equ 0 ; 0 None
|
||||
dhcp_end_option equ 255 ; 0 None
|
||||
dhcp_subnet_mask equ 1 ; 4 Subnet Mask Value
|
||||
dhcp_time_offset equ 2 ; 4 Time Offset in Seconds from UTC
|
||||
dhcp_router equ 3 ; N×4 Router addresses
|
||||
dhcp_time_server equ 4 ; N×4 Timeserver addresses
|
||||
dhcp_name_server equ 5 ; N×4 IEN-116 Server addresses
|
||||
dhcp_domain_server equ 6 ; N×4 DNS Server addresses
|
||||
dhcp_log_server equ 7 ; N×4 Logging Server addresses
|
||||
dhcp_quotes_server equ 8 ; N×4 Quotes Server addresses
|
||||
dhcp_lpr_server equ 9 ; N×4 Printer Server addresses
|
||||
dhcp_impress_server equ 10 ; N×4 Impress Server addresses
|
||||
dhcp_rlp_server equ 11 ; N×4 N RLP Server addresses
|
||||
dhcp_hostname equ 12 ; N Hostname string
|
||||
dhcp_boot_file_size equ 13 ; 2 Size of boot file in 512-octet blocks
|
||||
dhcp_merit_dump_file equ 14 ; N Client to dump and name the file to dump it to
|
||||
dhcp_domain_name equ 15 ; N The DNS domain name of the client
|
||||
dhcp_swap_server equ 16 ; 4 Swap Server address
|
||||
dhcp_root_path equ 17 ; N Path name for root disk
|
||||
dhcp_extension_file equ 18 ; N Path name for more BOOTP info
|
||||
|
||||
;IP Layer Parameters per Host
|
||||
|
||||
dhcp_forward equ 19 ; 1 Enable/Disable IP Forwarding
|
||||
dhcp_srcrte equ 20 ; 1 Enable/Disable Non-Local Source Routing
|
||||
dhcp_policy equ 21 ; N×8 Non-Local Source Routing Policy Filters
|
||||
dhcp_mag_dg_assembly equ 22 ; 2 Max Datagram Reassembly Size
|
||||
dhcp_default_ip_tll equ 23 ; 1 Default IP Time to Live
|
||||
dhcp_mtu_timeout equ 24 ; 4 Path MTU Aging Timeout
|
||||
dhcp_mtu_plateau equ 25 ; N×2 Path MTU Plateau Table
|
||||
|
||||
;IP Layer Parameters per Interface
|
||||
|
||||
dhcp_mtu_interface equ 26 ; 2 Interface MTU Size
|
||||
dhcp_mtu_subnet equ 27 ; 1 All Subnets are Local
|
||||
dhcp_broadcast_address equ 28 ; 4 Broadcast Address
|
||||
dhcp_mask_discovery equ 29 ; 1 Perform Mask Discovery
|
||||
dhcp_mask_supplier equ 30 ; 1 Provide Mask to Others
|
||||
dhcp_router_discovery equ 31 ; 1 Perform Router Discovery
|
||||
dhcp_router_request equ 32 ; 4 Router Solicitation Address
|
||||
dhcp_static_route equ 33 ; N×8 Static Routing Table
|
||||
|
||||
;Link Layer Parameters per Interface
|
||||
|
||||
dhcp_trailers equ 34 ; 1 Trailer Encapsulation
|
||||
dhcp_arp_timeout equ 35 ; 4 ARP Cache Timeout
|
||||
dhcp_ethernet equ 36 ; 1 Ethernet Encapsulation
|
||||
|
||||
;TCP Parameters
|
||||
|
||||
dhcp_default_tcp_tll equ 37 ; 1 Default TCP Time to Live
|
||||
dhcp_keepalive_time equ 38 ; 4 TCP Keepalive Interval
|
||||
dhcp_keepalive_data equ 39 ; 1 TCP Keepalive Garbage
|
||||
|
||||
;Application and Service Parameters
|
||||
|
||||
dhcp_nis_domain equ 40 ; N NIS Domain Name
|
||||
dhcp_nis_servers equ 41 ; N×4 NIS Server Addresses
|
||||
dhcp_ntp_servers equ 42 ; N×4 NTP Server Addresses
|
||||
dhcp_vendor_specific equ 43 ; N Vendor Specific Information
|
||||
dhcp_netbios_name_srv equ 44 ; N×4 NETBIOS Name Servers
|
||||
dhcp_netbios_dist_srv equ 45 ; N×4 NETBIOS Datagram Distribution
|
||||
dhcp_netbios_node_type equ 46 ; 1 NETBIOS Node Type
|
||||
dhcp_netbios_scope equ 47 ; N NETBIOS Scope
|
||||
dhcp_x_window_font equ 48 ; N×4 X Window Font Server
|
||||
dhcp_x_window_manager equ 49 ; N×4 X Window Display Manager
|
||||
dhcp_nis_domain_name equ 64 ; N NIS+ v3 Client Domain Name
|
||||
dhcp_nis_server_addr equ 65 ; N×4 NIS+ v3 Server Addresses
|
||||
dhcp_home_agent_addrs equ 68 ; N×4 Mobile IP Home Agent Addresses
|
||||
dhcp_smtp_server equ 69 ; N×4 Simple Mail Server Addresses
|
||||
dhcp_pop3_server equ 70 ; N×4 Post Office Server Addresses
|
||||
dhcp_nntp_server equ 71 ; N×4 Network News Server Addresses
|
||||
dhcp_www_server equ 72 ; N×4 WWW Server Addresses
|
||||
dhcp_finger_server equ 73 ; N×4 Finger Server Addresses
|
||||
dhcp_irc_server equ 74 ; N×4 Chat Server Addresses
|
||||
dhcp_streettalk_server equ 75 ; N×4 StreetTalk Server Addresses
|
||||
dhcp_stda_server equ 76 ; N×4 ST Directory Assist. Addresses
|
||||
|
||||
;DHCP Extensions
|
||||
|
||||
dhcp_address_request equ 50 ; 4 Requested IP Address
|
||||
dhcp_address_time equ 51 ; 4 IP Address Lease Time
|
||||
dhcp_option_overload equ 52 ; 1 Overload "sname" or "file"
|
||||
dhcp_msg_type equ 53 ; 1 DHCP Message Type
|
||||
dhcp_dhcp_server_id equ 54 ; 4 DHCP Server Identification
|
||||
dhcp_parameter_list equ 55 ; N Parameter Request List
|
||||
dhcp_dhcp_message equ 56 ; N DHCP Error Message
|
||||
dhcp_dhcp_max_msg_size equ 57 ; 2 DHCP Maximum Message Size
|
||||
dhcp_renewal_time equ 58 ; 4 DHCP Renewal (T1) Time
|
||||
dhcp_rebinding_time equ 59 ; 4 DHCP Rebinding (T2) Time
|
||||
dhcp_class_id equ 60 ; N Vendor Class Identifier
|
||||
dhcp_client_id equ 61 ; N Client Identifier
|
||||
dhcp_server_name equ 66 ; N TFTP Server Name
|
||||
dhcp_bootfile_name equ 67 ; N Boot File Name
|
||||
|
||||
;Newer extensions
|
||||
|
||||
dhcp_netware_ip_domain equ 62 ; N Netware/IP Domain Name
|
||||
dhcp_netware_ip_option equ 63 ; N Netware/IP sub Options
|
||||
dhcp_user_class equ 77 ; N User Class Information
|
||||
dhcp_directory_agent equ 78 ; N directory agent information
|
||||
dhcp_service_scope equ 79 ; N service location agent scope
|
||||
dhcp_rapid_commit equ 80 ; 0 Rapid Commit
|
||||
dhcp_client_fqdn equ 81 ; N Fully Qualified Domain Name
|
||||
dhcp_relay_agent_info equ 82 ; N Relay Agent Information, RFC 3046
|
||||
dhcp_isns equ 83 ; N Internet Storage Name Service
|
||||
; 84 REMOVED/Unassigned
|
||||
dhcp_nds_servers equ 85 ; N Novell Directory Services
|
||||
dhcp_nds_tree_name equ 86 ; N Novell Directory Services
|
||||
dhcp_nds_conext equ 87 ; N Novell Directory Services
|
||||
dhcp_bcmcs equ 88 ; Controller Domain Name list
|
||||
dhcp_bcmcs equ 89 ; Controller IPv4 address option
|
||||
dhcp_authentication equ 90 ; N Authentication
|
||||
; 91 REMOVED/Unassigned
|
||||
; 92 REMOVED/Unassigned
|
||||
dhcp_client_system equ 93 ; N Client System Architecture
|
||||
dhcp_client_ndi equ 94 ; N Client Network Device Interface
|
||||
dhcp_ldap equ 95 ; N Lightweight Directory Access Protocol
|
||||
; 96 REMOVED/Unassigned
|
||||
dhcp_uuid_guid equ 97 ; N UUID/GUID-based Client Identifier
|
||||
dchp_user_auth equ 98 ; N Open Group's User Authentication
|
||||
; 99 REMOVED/Unassigned
|
||||
; 100 REMOVED/Unassigned
|
||||
; 101 REMOVED/Unassigned
|
||||
; 102 REMOVED/Unassigned
|
||||
; 103 REMOVED/Unassigned
|
||||
; 104 REMOVED/Unassigned
|
||||
; 105 REMOVED/Unassigned
|
||||
; 106 REMOVED/Unassigned
|
||||
; 107 REMOVED/Unassigned
|
||||
; 108 REMOVED/Unassigned
|
||||
; 109 REMOVED/Unassigned
|
||||
; 110 REMOVED/Unassigned
|
||||
; 111 REMOVED/Unassigned
|
||||
dhcp_netinfo_address equ 112 ; N NetInfo Parent Server Address
|
||||
dhcp_netinfo_tag equ 113 ; N NetInfo Parent Server Tag
|
||||
dhcp_url equ 114 ; N URL
|
||||
; 115 REMOVED/Unassigned
|
||||
dhcp_auto_config equ 116 ; N DHCP Auto-Configuration
|
||||
dhcp_ns_search equ 117 ; N Name Service Search
|
||||
dhcp_subnet_selection equ 118 ; 4 Subnet Selection Option
|
||||
dhcp_domain_search equ 119 ; N DNS domain search list
|
||||
dhcp_sip_servers equ 120 ; N SIP Servers DHCP Option
|
||||
dhcp_cl_static_route equ 121 ; N Classless Static Route Option
|
||||
dhcp_ccc equ 122 ; N CableLabs Client Configuration
|
||||
dhcp_geoconf equ 123 ; 16 GeoConf Option
|
||||
dhcp_v_i_vendor_class equ 124 ; Vendor-Identifying Vendor Class
|
||||
dhcp_v_i_vendor_spec equ 125 ; Vendor-Identifying Vendor-Specific
|
||||
; 126 REMOVED/Unassigned
|
||||
; 127 REMOVED/Unassigned
|
||||
dhcp_pxe equ 128 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_etherboot_sign equ 128 ; Etherboot signature. 6 bytes: E4:45:74:68:00:00
|
||||
dhcp_docsis equ 128 ; DOCSIS "full security" server IP address
|
||||
dhcp_tftp_server_ip equ 128 ; TFTP Server IP address (for IP Phone software load)
|
||||
dhcp_pxe equ 129 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_kernel_options equ 129 ; Kernel options. Variable length string
|
||||
dhcp_call_server_ip equ 129 ; Call Server IP address
|
||||
dhcp_pxe equ 130 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_ethernet_interface equ 130 ; Ethernet interface. Variable length string.
|
||||
dhcp_siscrimination equ 130 ; Discrimination string (to identify vendor)
|
||||
dhcp_pxe equ 131 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_remote_stat_server equ 131 ; Remote statistics server IP address
|
||||
dhcp_pxe equ 132 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_802.1p equ 132 ; 802.1P VLAN ID
|
||||
dhcp_pxe equ 133 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_802.1q equ 133 ; 802.1Q L2 Priority
|
||||
dhcp_pxe equ 134 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_diffserv equ 134 ; Diffserv Code Point
|
||||
dhcp_pxe equ 135 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_http_proxy_psa equ 135 ; HTTP Proxy for phone-specific applications
|
||||
; 136 REMOVED/Unassigned
|
||||
; 137 REMOVED/Unassigned
|
||||
; 138 REMOVED/Unassigned
|
||||
; 139 REMOVED/Unassigned
|
||||
; 140 REMOVED/Unassigned
|
||||
; 141 REMOVED/Unassigned
|
||||
; 142 REMOVED/Unassigned
|
||||
; 143 REMOVED/Unassigned
|
||||
; 144 REMOVED/Unassigned
|
||||
; 145 REMOVED/Unassigned
|
||||
; 146 REMOVED/Unassigned
|
||||
; 147 REMOVED/Unassigned
|
||||
; 148 REMOVED/Unassigned
|
||||
; 149 REMOVED/Unassigned
|
||||
dhcp_tftp_server_addr equ 150 ; TFTP server address (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_etherboot equ 150 ; Etherboot
|
||||
dhcp_grub_conf_path equ 150 ; GRUB configuration path name
|
||||
; 151 REMOVED/Unassigned
|
||||
; 152 REMOVED/Unassigned
|
||||
; 153 REMOVED/Unassigned
|
||||
; 154 REMOVED/Unassigned
|
||||
; 155 REMOVED/Unassigned
|
||||
; 156 REMOVED/Unassigned
|
||||
; 157 REMOVED/Unassigned
|
||||
; 158 REMOVED/Unassigned
|
||||
; 159 REMOVED/Unassigned
|
||||
; 160 REMOVED/Unassigned
|
||||
; 161 REMOVED/Unassigned
|
||||
; 162 REMOVED/Unassigned
|
||||
; 163 REMOVED/Unassigned
|
||||
; 164 REMOVED/Unassigned
|
||||
; 165 REMOVED/Unassigned
|
||||
; 166 REMOVED/Unassigned
|
||||
; 167 REMOVED/Unassigned
|
||||
; 168 REMOVED/Unassigned
|
||||
; 169 REMOVED/Unassigned
|
||||
; 170 REMOVED/Unassigned
|
||||
; 171 REMOVED/Unassigned
|
||||
; 172 REMOVED/Unassigned
|
||||
; 173 REMOVED/Unassigned
|
||||
; 174 REMOVED/Unassigned
|
||||
dhcp_etherboot equ 175 ; Etherboot (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_ip_telephone equ 176 ; IP Telephone (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_etherboot equ 177 ; Etherboot (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_packetcable equ 177 ; PacketCable and CableHome (replaced by 122)
|
||||
; 178 REMOVED/Unassigned
|
||||
; 179 REMOVED/Unassigned
|
||||
; 180 REMOVED/Unassigned
|
||||
; 181 REMOVED/Unassigned
|
||||
; 182 REMOVED/Unassigned
|
||||
; 183 REMOVED/Unassigned
|
||||
; 184 REMOVED/Unassigned
|
||||
; 185 REMOVED/Unassigned
|
||||
; 186 REMOVED/Unassigned
|
||||
; 187 REMOVED/Unassigned
|
||||
; 188 REMOVED/Unassigned
|
||||
; 189 REMOVED/Unassigned
|
||||
; 190 REMOVED/Unassigned
|
||||
; 191 REMOVED/Unassigned
|
||||
; 192 REMOVED/Unassigned
|
||||
; 193 REMOVED/Unassigned
|
||||
; 194 REMOVED/Unassigned
|
||||
; 195 REMOVED/Unassigned
|
||||
; 196 REMOVED/Unassigned
|
||||
; 197 REMOVED/Unassigned
|
||||
; 198 REMOVED/Unassigned
|
||||
; 199 REMOVED/Unassigned
|
||||
; 200 REMOVED/Unassigned
|
||||
; 201 REMOVED/Unassigned
|
||||
; 202 REMOVED/Unassigned
|
||||
; 203 REMOVED/Unassigned
|
||||
; 204 REMOVED/Unassigned
|
||||
; 205 REMOVED/Unassigned
|
||||
; 206 REMOVED/Unassigned
|
||||
; 207 REMOVED/Unassigned
|
||||
dhcp_pxelinux.magic equ 208 ; pxelinux.magic (string) = F1:00:74:7E (241.0.116.126) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_pxelinux.conffile equ 209 ; pxelinux.configfile (text) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_pxelinux.path equ 210 ; pxelinux.pathprefix (text) (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_pxelinux.reboot equ 211 ; pxelinux.reboottime (unsigned integer 32 bits) (Tentatively Assigned - 23 June 2005)
|
||||
; 212 REMOVED/Unassigned
|
||||
; 213 REMOVED/Unassigned
|
||||
; 214 REMOVED/Unassigned
|
||||
; 215 REMOVED/Unassigned
|
||||
; 216 REMOVED/Unassigned
|
||||
; 217 REMOVED/Unassigned
|
||||
; 218 REMOVED/Unassigned
|
||||
; 219 REMOVED/Unassigned
|
||||
dhcp_subnet_aloc equ 220 ; Subnet Allocation Option (Tentatively Assigned - 23 June 2005)
|
||||
dhcp_virtual_subnet equ 221 ; Virtual Subnet Selection Option (Tentatively Assigned - 23 June 2005)
|
||||
; 222 REMOVED/Unassigned
|
||||
; 223 REMOVED/Unassigned
|
157
kernel/branches/net/applications/zeroconf/dll.inc
Normal file
157
kernel/branches/net/applications/zeroconf/dll.inc
Normal file
@ -0,0 +1,157 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
proc mem.Alloc size ;/////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
push ebx ecx
|
||||
mov eax,[size]
|
||||
lea ecx,[eax+4+4095]
|
||||
and ecx,not 4095
|
||||
mcall 68,12
|
||||
add ecx,-4
|
||||
mov [eax],ecx
|
||||
add eax,4
|
||||
pop ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
proc mem.ReAlloc mptr,size;///////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
push ebx ecx esi edi eax
|
||||
mov eax,[mptr]
|
||||
mov ebx,[size]
|
||||
or eax,eax
|
||||
jz @f
|
||||
lea ecx,[ebx+4+4095]
|
||||
and ecx,not 4095
|
||||
add ecx,-4
|
||||
cmp ecx,[eax-4]
|
||||
je .exit
|
||||
@@: mov eax,ebx
|
||||
call mem.Alloc
|
||||
xchg eax,[esp]
|
||||
or eax,eax
|
||||
jz .exit
|
||||
mov esi,eax
|
||||
xchg eax,[esp]
|
||||
mov edi,eax
|
||||
mov ecx,[esi-4]
|
||||
cmp ecx,[edi-4]
|
||||
jbe @f
|
||||
mov ecx,[edi-4]
|
||||
@@: add ecx,3
|
||||
shr ecx,2
|
||||
cld
|
||||
rep movsd
|
||||
xchg eax,[esp]
|
||||
call mem.Free
|
||||
.exit:
|
||||
pop eax edi esi ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
proc mem.Free mptr ;//////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
mov eax,[mptr]
|
||||
or eax,eax
|
||||
jz @f
|
||||
push ebx ecx
|
||||
lea ecx,[eax-4]
|
||||
mcall 68,13
|
||||
pop ecx ebx
|
||||
@@: ret
|
||||
endp
|
||||
|
||||
|
||||
proc dll.Load, import_table:dword
|
||||
mov esi,[import_table]
|
||||
.next_lib: mov edx,[esi]
|
||||
or edx,edx
|
||||
jz .exit
|
||||
push esi
|
||||
mov esi,[esi+4]
|
||||
mov edi,s_libdir.fname
|
||||
@@: lodsb
|
||||
stosb
|
||||
or al,al
|
||||
jnz @b
|
||||
mcall 68,19,s_libdir
|
||||
or eax,eax
|
||||
jz .fail
|
||||
stdcall dll.Link,eax,edx
|
||||
stdcall dll.Init,[eax+4]
|
||||
pop esi
|
||||
add esi,8
|
||||
jmp .next_lib
|
||||
.exit: xor eax,eax
|
||||
ret
|
||||
.fail: add esp,4
|
||||
xor eax,eax
|
||||
inc eax
|
||||
ret
|
||||
endp
|
||||
|
||||
proc dll.Link, exp:dword,imp:dword
|
||||
push eax
|
||||
mov esi,[imp]
|
||||
test esi,esi
|
||||
jz .done
|
||||
.next: lodsd
|
||||
test eax,eax
|
||||
jz .done
|
||||
stdcall dll.GetProcAddress,[exp],eax
|
||||
or eax,eax
|
||||
jz @f
|
||||
mov [esi-4],eax
|
||||
jmp .next
|
||||
@@: mov dword[esp],0
|
||||
.done: pop eax
|
||||
ret
|
||||
endp
|
||||
|
||||
proc dll.Init, dllentry:dword
|
||||
pushad
|
||||
mov eax,mem.Alloc
|
||||
mov ebx,mem.Free
|
||||
mov ecx,mem.ReAlloc
|
||||
mov edx,dll.Load
|
||||
stdcall [dllentry]
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
proc dll.GetProcAddress, exp:dword,sz_name:dword
|
||||
mov edx,[exp]
|
||||
xor eax,eax
|
||||
.next: or edx,edx
|
||||
jz .end
|
||||
cmp dword[edx],0
|
||||
jz .end
|
||||
stdcall strcmp,[edx],[sz_name]
|
||||
test eax,eax
|
||||
jz .ok
|
||||
add edx,8
|
||||
jmp .next
|
||||
.ok: mov eax,[edx+4]
|
||||
.end: ret
|
||||
endp
|
||||
|
||||
proc strcmp, str1:dword,str2:dword
|
||||
push esi edi
|
||||
mov esi,[str1]
|
||||
mov edi,[str2]
|
||||
xor eax,eax
|
||||
@@: lodsb
|
||||
scasb
|
||||
jne .fail
|
||||
or al,al
|
||||
jnz @b
|
||||
jmp .ok
|
||||
.fail: or eax,-1
|
||||
.ok: pop edi esi
|
||||
ret
|
||||
endp
|
||||
|
||||
s_libdir:
|
||||
db '/sys/lib/'
|
||||
.fname rb 32
|
613
kernel/branches/net/applications/zeroconf/zeroconf.asm
Normal file
613
kernel/branches/net/applications/zeroconf/zeroconf.asm
Normal file
@ -0,0 +1,613 @@
|
||||
; Zero-config
|
||||
; v 1.4
|
||||
;
|
||||
; DHCP code is based on that by Mike Hibbet (DHCP client for menuetos)
|
||||
;
|
||||
; Written by HidnPlayr & Derpenguin
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd IM_END ; size of image
|
||||
dd I_END ; memory for app
|
||||
dd I_END ; esp
|
||||
dd 0x0 , path ; I_Param , I_Icon
|
||||
|
||||
; CONFIGURATION
|
||||
|
||||
|
||||
TIMEOUT equ 60 ; in seconds
|
||||
BUFFER equ 1024 ; in bytes
|
||||
__DEBUG__ equ 1 ; enable/disable
|
||||
__DEBUG_LEVEL__ equ 1 ; 1 = all, 2 = errors
|
||||
|
||||
; CONFIGURATION FOR LINK-LOCAL
|
||||
|
||||
PROBE_WAIT equ 1 ; second (initial random delay)
|
||||
PROBE_MIN equ 1 ; second (minimum delay till repeated probe)
|
||||
PROBE_MAX equ 2 ; seconds (maximum delay till repeated probe)
|
||||
PROBE_NUM equ 3 ; (number of probe packets)
|
||||
|
||||
ANNOUNCE_NUM equ 2 ; (number of announcement packets)
|
||||
ANNOUNCE_INTERVAL equ 2 ; seconds (time between announcement packets)
|
||||
ANNOUNCE_WAIT equ 2 ; seconds (delay before announcing)
|
||||
|
||||
MAX_CONFLICTS equ 10 ; (max conflicts before rate limiting)
|
||||
|
||||
RATE_LIMIT_INTERVAL equ 60 ; seconds (delay between successive attempts)
|
||||
|
||||
DEFEND_INTERVAL equ 10 ; seconds (min. wait between defensive ARPs)
|
||||
|
||||
|
||||
|
||||
|
||||
AF_INET4 equ 1337 ;;;;;
|
||||
|
||||
|
||||
|
||||
|
||||
include '../../../proc32.inc'
|
||||
include '../../../macros.inc'
|
||||
include 'debug-fdo.inc'
|
||||
include 'dhcp.inc'
|
||||
include 'dll.inc'
|
||||
|
||||
|
||||
Ip2dword:
|
||||
push edx
|
||||
|
||||
; This code validates if the query is an IP containing 4 numbers and 3 dots
|
||||
|
||||
xor al, al ; make al (dot count) zero
|
||||
|
||||
@@:
|
||||
cmp byte[edx],'0' ; check if this byte is a number, if not jump to no_IP
|
||||
jl no_IP ;
|
||||
cmp byte[edx],'9' ;
|
||||
jg no_IP ;
|
||||
|
||||
inc edx ; the byte was a number, so lets check the next byte
|
||||
|
||||
cmp byte[edx],0 ; is this byte zero? (have we reached end of query?)
|
||||
jz @f ; jump to next @@ then
|
||||
cmp byte[edx],':'
|
||||
jz @f
|
||||
|
||||
cmp byte[edx],'.' ; is this byte a dot?
|
||||
jne @r ; if not, jump to previous @@
|
||||
|
||||
inc al ; the byte was a dot so increment al(dot count)
|
||||
inc edx ; next byte
|
||||
jmp @r ; lets check for numbers again (jump to previous @@)
|
||||
|
||||
@@: ; we reach this when end of query reached
|
||||
cmp al,3 ; check if there where 3 dots
|
||||
jnz no_IP ; if not, jump to no_IP
|
||||
|
||||
; The following code will convert this IP into a dword and output it in eax
|
||||
; If there is also a port number specified, this will be returned in ebx, otherwise ebx is -1
|
||||
|
||||
pop esi ; edx (query address) was pushed onto stack and is now popped in esi
|
||||
|
||||
xor edx, edx ; result
|
||||
xor eax, eax ; current character
|
||||
xor ebx, ebx ; current byte
|
||||
|
||||
.outer_loop:
|
||||
shl edx, 8
|
||||
add edx, ebx
|
||||
xor ebx, ebx
|
||||
.inner_loop:
|
||||
lodsb
|
||||
test eax, eax
|
||||
jz .finish
|
||||
cmp al, '.'
|
||||
jz .outer_loop
|
||||
sub eax, '0'
|
||||
imul ebx, 10
|
||||
add ebx, eax
|
||||
jmp .inner_loop
|
||||
.finish:
|
||||
shl edx, 8
|
||||
add edx, ebx
|
||||
|
||||
bswap edx ; we want little endian order
|
||||
|
||||
ret
|
||||
|
||||
no_IP:
|
||||
pop edx
|
||||
xor edx, edx
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
mcall 40, 1 shl 7 ; network event
|
||||
|
||||
; eth.set_network_drv 0x00000383
|
||||
|
||||
DEBUGF 1,"Zero-config service:\n"
|
||||
|
||||
; eth.status eax ; Read the Stack status
|
||||
; test eax,eax ; if eax is zero, no driver was found
|
||||
; jnz @f
|
||||
; DEBUGF 1,"No Card found!\n"
|
||||
; jmp close
|
||||
|
||||
; @@:
|
||||
; DEBUGF 1,"Detected card: %x\n",eax
|
||||
; @@:
|
||||
; eth.check_cable eax
|
||||
; test al,al
|
||||
; jnz @f
|
||||
; DEBUGF 1,"Cable disconnected!\n"
|
||||
; mcall 5, 500 ; loop until cable is connected (check every 5 sec)
|
||||
; jmp @r
|
||||
|
||||
; @@:
|
||||
; eth.read_mac MAC
|
||||
|
||||
mcall 73, 10
|
||||
mov word[MAC], bx
|
||||
mov dword[MAC+2], eax
|
||||
|
||||
DEBUGF 1,"MAC: %x-%x-%x-%x-%x-%x\n",[MAC]:2,[MAC+1]:2,[MAC+2]:2,[MAC+3]:2,[MAC+4]:2,[MAC+5]:2
|
||||
|
||||
cld
|
||||
mov edi, path ; Calculate the length of zero-terminated string
|
||||
xor al , al
|
||||
mov ecx, 1024
|
||||
repnz scas byte[es:edi]
|
||||
dec edi
|
||||
|
||||
mov esi, filename
|
||||
movsd
|
||||
movsb
|
||||
|
||||
DEBUGF 1,"path to ini: %s\n", path
|
||||
|
||||
mcall 68,11
|
||||
|
||||
stdcall dll.Load,@IMPORT
|
||||
or eax,eax
|
||||
jnz skip_ini
|
||||
|
||||
|
||||
invoke ini.get_str, path, str_ipconfig, str_type, inibuf, 16, 0
|
||||
|
||||
mov eax,dword[inibuf]
|
||||
|
||||
cmp eax,'stat'
|
||||
jne skip_ini
|
||||
|
||||
invoke ini.get_str, path, str_ipconfig, str_ip, inibuf, 16, 0
|
||||
mov edx, inibuf
|
||||
call Ip2dword
|
||||
mcall 73, 3, edx
|
||||
|
||||
invoke ini.get_str, path, str_ipconfig, str_gateway, inibuf, 16, 0
|
||||
mov edx, inibuf
|
||||
call Ip2dword
|
||||
mcall 73, 9, edx
|
||||
|
||||
invoke ini.get_str, path, str_ipconfig, str_dns, inibuf, 16, 0
|
||||
mov edx, inibuf
|
||||
call Ip2dword
|
||||
mcall 73, 7, edx
|
||||
|
||||
invoke ini.get_str, path, str_ipconfig, str_subnet, inibuf, 16, 0
|
||||
mov edx, inibuf
|
||||
call Ip2dword
|
||||
mcall 73, 5, edx
|
||||
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
skip_ini:
|
||||
|
||||
DEBUGF 1,"Skip ini\n"
|
||||
|
||||
mcall 74, 0, AF_INET4, 1, 0 ; open socket (parameters: domain, type, protocol)
|
||||
cmp eax, -1
|
||||
je error
|
||||
mov [socketNum], eax
|
||||
|
||||
DEBUGF 1,"socket %x opened\n", eax
|
||||
|
||||
mcall 74, 2, [socketNum], sockaddr1, 18 ; bind socket to local port 68
|
||||
cmp eax, -1
|
||||
je error
|
||||
|
||||
DEBUGF 1,"Socket Bound to local port 68\n"
|
||||
|
||||
|
||||
mcall 74, 4, [socketNum], sockaddr2, 18 ; connect to 255.255.255.255 on port 67
|
||||
cmp eax, -1
|
||||
je error
|
||||
|
||||
DEBUGF 1,"Connected to 255.255.255.255 on port 67\n"
|
||||
|
||||
mov byte [dhcpMsgType], 0x01 ; DHCP discover
|
||||
mov dword [dhcpLease], esi ; esi is still -1 (-1 = forever)
|
||||
|
||||
mcall 26, 9
|
||||
imul eax,100
|
||||
mov [currTime],eax
|
||||
|
||||
buildRequest: ; Creates a DHCP request packet.
|
||||
|
||||
DEBUGF 1,"Building request\n"
|
||||
|
||||
stdcall mem.Alloc, BUFFER
|
||||
mov [dhcpMsg], eax
|
||||
test eax,eax
|
||||
jz apipa
|
||||
|
||||
|
||||
mov edi, eax
|
||||
mov ecx,BUFFER
|
||||
xor eax,eax
|
||||
cld
|
||||
rep stosb
|
||||
|
||||
mov edx,[dhcpMsg]
|
||||
|
||||
mov [edx], byte 0x01 ; Boot request
|
||||
mov [edx+1], byte 0x01 ; Ethernet
|
||||
mov [edx+2], byte 0x06 ; Ethernet h/w len
|
||||
mov [edx+4], dword 0x11223344 ; xid
|
||||
mov eax,[currTime]
|
||||
mov [edx+8], eax ; secs, our uptime
|
||||
mov [edx+10], byte 0x80 ; broadcast flag set
|
||||
mov eax, dword [MAC] ; first 4 bytes of MAC
|
||||
mov [edx+28],dword eax
|
||||
mov ax, word [MAC+4] ; last 2 bytes of MAC
|
||||
mov [edx+32],word ax
|
||||
mov [edx+236], dword 0x63538263 ; magic number
|
||||
mov [edx+240], word 0x0135 ; option DHCP msg type
|
||||
mov al, [dhcpMsgType]
|
||||
mov [edx+240+2], al
|
||||
mov [edx+240+3], word 0x0433 ; option Lease time = infinity
|
||||
mov eax, [dhcpLease]
|
||||
mov [edx+240+5], eax
|
||||
mov [edx+240+9], word 0x0432 ; option requested IP address
|
||||
mov eax, [dhcpClientIP]
|
||||
mov [edx+240+11], eax
|
||||
mov [edx+240+15], word 0x0437 ; option request list
|
||||
mov [edx+240+17], dword 0x0f060301
|
||||
|
||||
cmp [dhcpMsgType], byte 0x01 ; Check which msg we are sending
|
||||
jne request_options
|
||||
|
||||
mov [edx+240+21], byte 0xff ; "Discover" options
|
||||
|
||||
mov [dhcpMsgLen], dword 262 ; end of options marker
|
||||
jmp send_request
|
||||
|
||||
request_options:
|
||||
mov [edx+240+21], word 0x0436 ; server IP
|
||||
mov eax, [dhcpServerIP]
|
||||
mov [edx+240+23], eax
|
||||
|
||||
mov [edx+240+27], byte 0xff ; end of options marker
|
||||
|
||||
mov [dhcpMsgLen], dword 268
|
||||
|
||||
send_request:
|
||||
mcall 74, 6, [socketNum], [dhcpMsg], [dhcpMsgLen] ; write to socket ( send broadcast request )
|
||||
|
||||
mov eax, [dhcpMsg] ; Setup the DHCP buffer to receive response
|
||||
mov [dhcpMsgLen], eax ; Used as a pointer to the data
|
||||
|
||||
mcall 23, TIMEOUT*10 ; wait for data
|
||||
|
||||
read_data: ; we have data - this will be the response
|
||||
|
||||
mcall 74, 7, [socketNum], [dhcpMsg], BUFFER ; read data from socket
|
||||
|
||||
DEBUGF 1,"%u bytes received\n", eax
|
||||
|
||||
push eax
|
||||
mcall 74, 10, [socketNum] ; close the socket
|
||||
pop eax
|
||||
|
||||
cmp eax, -1
|
||||
je error
|
||||
|
||||
mov [dhcpMsgLen], eax
|
||||
|
||||
; depending on which msg we sent, handle the response
|
||||
; accordingly.
|
||||
; If the response is to a dhcp discover, then:
|
||||
; 1) If response is DHCP OFFER then
|
||||
; 1.1) record server IP, lease time & IP address.
|
||||
; 1.2) send a request packet
|
||||
; If the response is to a dhcp request, then:
|
||||
; 1) If the response is DHCP ACK then
|
||||
; 1.1) extract the DNS & subnet fields. Set them in the stack
|
||||
|
||||
cmp [dhcpMsgType], byte 0x01 ; did we send a discover?
|
||||
je discover
|
||||
cmp [dhcpMsgType], byte 0x03 ; did we send a request?
|
||||
je request
|
||||
|
||||
jmp close ; really unknown, what we did
|
||||
|
||||
discover:
|
||||
call parseResponse
|
||||
|
||||
cmp [dhcpMsgType], byte 0x02 ; Was the response an offer?
|
||||
jne apipa ; NO - so we do zeroconf
|
||||
mov [dhcpMsgType], byte 0x03 ; DHCP request
|
||||
jmp buildRequest
|
||||
|
||||
request:
|
||||
call parseResponse
|
||||
|
||||
cmp [dhcpMsgType], byte 0x05 ; Was the response an ACK? It should be
|
||||
jne apipa ; NO - so we do zeroconf
|
||||
|
||||
jmp close
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; parseResponse
|
||||
;
|
||||
; Description
|
||||
; extracts the fields ( client IP address and options ) from
|
||||
; a DHCP response
|
||||
; The values go into
|
||||
; dhcpMsgType,dhcpLease,dhcpClientIP,dhcpServerIP,
|
||||
; dhcpDNSIP, dhcpSubnet
|
||||
; The message is stored in dhcpMsg
|
||||
;
|
||||
;***************************************************************************
|
||||
parseResponse:
|
||||
DEBUGF 1,"Data received, parsing response\n"
|
||||
mov edx, [dhcpMsg]
|
||||
|
||||
pusha
|
||||
mcall 73, 3, [edx+16]
|
||||
mov eax,[edx]
|
||||
mov [dhcpClientIP],eax
|
||||
DEBUGF 1,"Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1
|
||||
popa
|
||||
|
||||
add edx, 240 ; Point to first option
|
||||
xor ecx, ecx
|
||||
|
||||
next_option:
|
||||
add edx, ecx
|
||||
pr001:
|
||||
mov al, [edx]
|
||||
cmp al, 0xff ; End of options?
|
||||
je pr_exit
|
||||
|
||||
cmp al, dhcp_msg_type ; Msg type is a single byte option
|
||||
jne @f
|
||||
|
||||
mov al, [edx+2]
|
||||
mov [dhcpMsgType], al
|
||||
add edx, 3
|
||||
jmp pr001 ; Get next option
|
||||
|
||||
@@:
|
||||
inc edx
|
||||
movzx ecx, byte [edx]
|
||||
inc edx ; point to data
|
||||
|
||||
cmp al, dhcp_dhcp_server_id ; server ip
|
||||
jne @f
|
||||
mov eax, [edx]
|
||||
mov [dhcpServerIP], eax
|
||||
DEBUGF 1,"Server: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
|
||||
jmp next_option
|
||||
|
||||
@@:
|
||||
cmp al, dhcp_address_time
|
||||
jne @f
|
||||
|
||||
pusha
|
||||
mov eax,[edx]
|
||||
bswap eax
|
||||
mov [dhcpLease],eax
|
||||
DEBUGF 1,"lease: %d\n",eax
|
||||
popa
|
||||
|
||||
jmp next_option
|
||||
|
||||
@@:
|
||||
cmp al, dhcp_subnet_mask
|
||||
jne @f
|
||||
|
||||
pusha
|
||||
mcall 73, 5, [edx]
|
||||
DEBUGF 1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
|
||||
popa
|
||||
|
||||
jmp next_option
|
||||
|
||||
@@:
|
||||
cmp al, dhcp_router
|
||||
jne @f
|
||||
|
||||
pusha
|
||||
mcall 73, 9, [edx]
|
||||
DEBUGF 1,"Gateway: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
|
||||
popa
|
||||
|
||||
jmp next_option
|
||||
|
||||
|
||||
@@:
|
||||
cmp al, dhcp_domain_server
|
||||
jne next_option
|
||||
|
||||
pusha
|
||||
mcall 73, 7, [edx]
|
||||
DEBUGF 1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
|
||||
popa
|
||||
|
||||
jmp next_option
|
||||
|
||||
pr_exit:
|
||||
|
||||
; DEBUGF 1,"Sending ARP announce\n"
|
||||
; eth.ARP_ANNOUNCE [dhcpClientIP] ; send an ARP announce packet
|
||||
|
||||
jmp close
|
||||
|
||||
apipa:
|
||||
stdcall mem.Free, [dhcpMsg]
|
||||
|
||||
link_local:
|
||||
call random
|
||||
mov ecx,0xfea9 ; IP 169.254.0.0 link local net, see RFC3927
|
||||
mov cx,ax
|
||||
mcall 73, 3, ecx ; mask is 255.255.0.0
|
||||
DEBUGF 1,"Link Local IP assinged: 169.254.%u.%u\n",[generator+2]:1,[generator+3]:1
|
||||
mcall 73, 5, 0xffff
|
||||
mcall 73, 9, 0x0
|
||||
mcall 73, 7, 0x0
|
||||
|
||||
mcall 5, PROBE_WAIT*100
|
||||
|
||||
xor esi,esi
|
||||
probe_loop:
|
||||
call random ; create a pseudo random number in eax (seeded by MAC)
|
||||
|
||||
cmp al,PROBE_MIN*100 ; check if al is bigger then PROBE_MIN
|
||||
jge @f ; all ok
|
||||
add al,(PROBE_MAX-PROBE_MIN)*100 ; al is too small
|
||||
@@:
|
||||
|
||||
cmp al,PROBE_MAX*100
|
||||
jle @f
|
||||
sub al,(PROBE_MAX-PROBE_MIN)*100
|
||||
@@:
|
||||
|
||||
movzx ebx,al
|
||||
DEBUGF 1,"Waiting %u0ms\n",ebx
|
||||
mcall 5
|
||||
|
||||
DEBUGF 1,"Sending Probe\n"
|
||||
; eth.ARP_PROBE MAC
|
||||
inc esi
|
||||
|
||||
cmp esi,PROBE_NUM
|
||||
jl probe_loop
|
||||
|
||||
; now we wait further ANNOUNCE_WAIT seconds and send ANNOUNCE_NUM ARP announces. If any other host has assingned
|
||||
; IP within this time, we should create another adress, that have to be done later
|
||||
|
||||
DEBUGF 1,"Waiting %us\n",ANNOUNCE_WAIT
|
||||
mcall 5, ANNOUNCE_WAIT*100
|
||||
xor esi,esi
|
||||
announce_loop:
|
||||
|
||||
DEBUGF 1,"Sending Announce\n"
|
||||
; eth.ARP_ANNOUNCE MAC
|
||||
|
||||
inc esi
|
||||
cmp esi,ANNOUNCE_NUM
|
||||
je @f
|
||||
|
||||
DEBUGF 1,"Waiting %us\n",ANNOUNCE_INTERVAL
|
||||
mcall 5, ANNOUNCE_INTERVAL*100
|
||||
jmp announce_loop
|
||||
@@:
|
||||
; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;)
|
||||
|
||||
error:
|
||||
close:
|
||||
mcall -1
|
||||
|
||||
|
||||
random: ; Pseudo random actually
|
||||
|
||||
mov eax,[generator]
|
||||
add eax,-43ab45b5h
|
||||
ror eax,1
|
||||
bswap eax
|
||||
xor eax,dword[MAC]
|
||||
ror eax,1
|
||||
xor eax,dword[MAC+2]
|
||||
mov [generator],eax
|
||||
|
||||
ret
|
||||
|
||||
; DATA AREA
|
||||
|
||||
align 16
|
||||
@IMPORT:
|
||||
|
||||
library \
|
||||
libini,'libini.obj'
|
||||
|
||||
import libini, \
|
||||
ini.get_str,'ini.get_str'
|
||||
|
||||
include_debug_strings
|
||||
|
||||
filename db '.ini',0
|
||||
str_ip db 'ip',0
|
||||
str_subnet db 'subnet',0
|
||||
str_gateway db 'gateway',0
|
||||
str_dns db 'dns',0
|
||||
str_ipconfig db 'ipconfig',0
|
||||
str_type db 'type',0
|
||||
|
||||
|
||||
sockaddr1:
|
||||
|
||||
dw AF_INET4
|
||||
dw 68 ; local port
|
||||
dd 0 ; local IP
|
||||
|
||||
rb 10
|
||||
|
||||
|
||||
sockaddr2:
|
||||
|
||||
dw AF_INET4
|
||||
dw 67 ; destination port
|
||||
dd -1 ; destination IP
|
||||
|
||||
rb 10
|
||||
|
||||
|
||||
IM_END:
|
||||
|
||||
inibuf rb 16
|
||||
|
||||
dhcpClientIP dd ?
|
||||
dhcpMsgType db ?
|
||||
dhcpLease dd ?
|
||||
dhcpServerIP dd ?
|
||||
|
||||
dhcpMsgLen dd ?
|
||||
socketNum dd ?
|
||||
|
||||
MAC dp ?
|
||||
|
||||
currTime dd ?
|
||||
renewTime dd ?
|
||||
generator dd ?
|
||||
|
||||
dhcpMsg dd ?
|
||||
|
||||
I_END_2:
|
||||
|
||||
path rb 1024+5
|
||||
|
||||
I_END:
|
9
kernel/branches/net/applications/zeroconf/zeroconf.ini
Normal file
9
kernel/branches/net/applications/zeroconf/zeroconf.ini
Normal file
@ -0,0 +1,9 @@
|
||||
[ipconfig]
|
||||
; type should be static or zeroconf
|
||||
; zeroconf means the service first tries to contact a DHCP server
|
||||
; If dhcp is not available, it switches to link-local
|
||||
type = zeroconf
|
||||
ip = 192.168.1.150
|
||||
gateway = 192.168.1.1
|
||||
dns = 192.168.1.1
|
||||
subnet = 255.255.255.0
|
@ -1,287 +0,0 @@
|
||||
; FAT12 boot sector for Kolibri OS
|
||||
;
|
||||
; Copyright (C) Alex Nogueira Teixeira
|
||||
; Copyright (C) Diamond
|
||||
; Copyright (C) Dmitry Kartashov aka shurf
|
||||
;
|
||||
; Distributed under GPL, see file COPYING for details
|
||||
;
|
||||
; Version 1.0
|
||||
|
||||
lf equ 0ah
|
||||
cr equ 0dh
|
||||
|
||||
pos_read_tmp equ 0700h ;position for temporary read
|
||||
boot_program equ 07c00h ;position for boot code
|
||||
seg_read_kernel equ 01000h ;segment to kernel read
|
||||
|
||||
jmp start_program
|
||||
nop
|
||||
|
||||
; Boot Sector and BPB Structure
|
||||
include 'floppy1440.inc'
|
||||
;include 'floppy2880.inc'
|
||||
;include 'floppy1680.inc'
|
||||
;include 'floppy1743.inc'
|
||||
|
||||
start_program:
|
||||
|
||||
xor ax,ax
|
||||
mov ss,ax
|
||||
mov sp,boot_program
|
||||
push ss
|
||||
pop ds
|
||||
|
||||
; print loading string
|
||||
mov si,loading+boot_program
|
||||
loop_loading:
|
||||
lodsb
|
||||
or al,al
|
||||
jz read_root_directory
|
||||
mov ah,0eh
|
||||
mov bx,7
|
||||
int 10h
|
||||
jmp loop_loading
|
||||
|
||||
read_root_directory:
|
||||
push ss
|
||||
pop es
|
||||
|
||||
; calculate some disk parameters
|
||||
; - beginning sector of RootDir
|
||||
mov ax,word [BPB_FATSz16+boot_program]
|
||||
xor cx,cx
|
||||
mov cl,byte [BPB_NumFATs+boot_program]
|
||||
mul cx
|
||||
add ax,word [BPB_RsvdSecCnt+boot_program]
|
||||
mov word [FirstRootDirSecNum+boot_program],ax ; 19
|
||||
mov si,ax
|
||||
|
||||
; - count of sectors in RootDir
|
||||
mov bx,word [BPB_BytsPerSec+boot_program]
|
||||
mov cl,5 ; divide ax by 32
|
||||
shr bx,cl ; bx = directory entries per sector
|
||||
mov ax,word [BPB_RootEntCnt+boot_program]
|
||||
xor dx,dx
|
||||
div bx
|
||||
mov word [RootDirSecs+boot_program],ax ; 14
|
||||
|
||||
; - data start
|
||||
add si,ax ; add beginning sector of RootDir and count sectors in RootDir
|
||||
mov word [data_start+boot_program],si ; 33
|
||||
; reading root directory
|
||||
; al=count root dir sectrors !!!! TODO: al, max 255 sectors !!!!
|
||||
mov ah,2 ; read
|
||||
push ax
|
||||
|
||||
mov ax,word [FirstRootDirSecNum+boot_program]
|
||||
call conv_abs_to_THS ; convert abs sector (AX) to BIOS T:H:S (track:head:sector)
|
||||
pop ax
|
||||
mov bx,pos_read_tmp ; es:bx read buffer
|
||||
call read_sector
|
||||
|
||||
mov si,bx ; read buffer address: es:si
|
||||
mov ax,[RootDirSecs+boot_program]
|
||||
mul word [BPB_BytsPerSec+boot_program]
|
||||
add ax,si ; AX = end of root dir. in buffer pos_read_tmp
|
||||
|
||||
; find kernel file in root directory
|
||||
loop_find_dir_entry:
|
||||
push si
|
||||
mov cx,11
|
||||
mov di,kernel_name+boot_program
|
||||
rep cmpsb ; compare es:si and es:di, cx bytes long
|
||||
pop si
|
||||
je found_kernel_file
|
||||
add si,32 ; next dir. entry
|
||||
cmp si,ax ; end of directory
|
||||
jb loop_find_dir_entry
|
||||
|
||||
file_error_message:
|
||||
mov si,error_message+boot_program
|
||||
|
||||
loop_error_message:
|
||||
lodsb
|
||||
or al,al
|
||||
jz freeze_pc
|
||||
mov ah,0eh
|
||||
mov bx,7
|
||||
int 10h
|
||||
jmp loop_error_message
|
||||
|
||||
freeze_pc:
|
||||
jmp $ ; endless loop
|
||||
|
||||
; === KERNEL FOUND. LOADING... ===
|
||||
|
||||
found_kernel_file:
|
||||
mov bp,[si+01ah] ; first cluster of kernel file
|
||||
; <diamond>
|
||||
mov [cluster1st+boot_program],bp ; starting cluster of kernel file
|
||||
; <\diamond>
|
||||
|
||||
; reading first FAT table
|
||||
mov ax,word [BPB_RsvdSecCnt+boot_program] ; begin first FAT abs sector number
|
||||
call conv_abs_to_THS ; convert abs sector (AX) to BIOS T:H:S (track:head:sector)
|
||||
mov bx,pos_read_tmp ; es:bx read position
|
||||
mov ah,2 ; ah=2 (read)
|
||||
mov al, byte [BPB_FATSz16+boot_program] ; FAT size in sectors (TODO: max 255 sectors)
|
||||
call read_sector
|
||||
jc file_error_message ; read error
|
||||
|
||||
mov ax,seg_read_kernel
|
||||
mov es,ax
|
||||
xor bx,bx ; es:bx = 1000h:0000h
|
||||
|
||||
|
||||
; reading kernel file
|
||||
loop_obtains_kernel_data:
|
||||
; read one cluster of file
|
||||
call obtain_cluster
|
||||
jc file_error_message ; read error
|
||||
|
||||
; add one cluster length to segment:offset
|
||||
push bx
|
||||
mov bx,es
|
||||
mov ax,word [BPB_BytsPerSec+boot_program] ;\
|
||||
movsx cx,byte [BPB_SecPerClus+boot_program] ; | !!! TODO: !!!
|
||||
mul cx ; | out this from loop !!!
|
||||
shr ax,4 ;/
|
||||
add bx,ax
|
||||
mov es,bx
|
||||
pop bx
|
||||
|
||||
mov di,bp
|
||||
shr di,1
|
||||
pushf
|
||||
add di,bp ; di = bp * 1.5
|
||||
add di,pos_read_tmp
|
||||
mov ax,[di] ; read next entry from FAT-chain
|
||||
popf
|
||||
jc move_4_right
|
||||
and ax,0fffh
|
||||
jmp verify_end_sector
|
||||
move_4_right:
|
||||
mov cl,4
|
||||
shr ax,cl
|
||||
verify_end_sector:
|
||||
cmp ax,0ff8h ; last cluster
|
||||
jae execute_kernel
|
||||
mov bp,ax
|
||||
jmp loop_obtains_kernel_data
|
||||
|
||||
execute_kernel:
|
||||
; <diamond>
|
||||
mov ax,'KL'
|
||||
push 0
|
||||
pop ds
|
||||
mov si,loader_block+boot_program
|
||||
; </diamond>
|
||||
push word seg_read_kernel
|
||||
push word 0
|
||||
retf ; jmp far 1000:0000
|
||||
|
||||
|
||||
;------------------------------------------
|
||||
; loading cluster from file to es:bx
|
||||
obtain_cluster:
|
||||
; bp - cluster number to read
|
||||
; carry = 0 -> read OK
|
||||
; carry = 1 -> read ERROR
|
||||
|
||||
; print one dot
|
||||
push bx
|
||||
mov ax,0e2eh ; ah=0eh (teletype), al='.'
|
||||
xor bh,bh
|
||||
int 10h
|
||||
|
||||
; convert cluster number to sector number
|
||||
mov ax,bp ; data cluster to read
|
||||
sub ax,2
|
||||
xor bx,bx
|
||||
mov bl,byte [BPB_SecPerClus+boot_program]
|
||||
mul bx
|
||||
add ax,word [data_start+boot_program]
|
||||
pop bx
|
||||
|
||||
writesec:
|
||||
call conv_abs_to_THS ; convert abs sector (AX) to BIOS T:H:S (track:head:sector)
|
||||
patchhere:
|
||||
mov ah,2 ; ah=2 (read)
|
||||
mov al,byte [BPB_SecPerClus+boot_program] ; al=(one cluster)
|
||||
call read_sector
|
||||
retn
|
||||
;------------------------------------------
|
||||
|
||||
;------------------------------------------
|
||||
; read sector from disk
|
||||
read_sector:
|
||||
push bp
|
||||
mov bp,20 ; try 20 times
|
||||
newread:
|
||||
dec bp
|
||||
jz file_error_message
|
||||
push ax bx cx dx
|
||||
int 13h
|
||||
pop dx cx bx ax
|
||||
jc newread
|
||||
pop bp
|
||||
retn
|
||||
;------------------------------------------
|
||||
; convert abs. sector number (AX) to BIOS T:H:S
|
||||
; sector number = (abs.sector%BPB_SecPerTrk)+1
|
||||
; pre.track number = (abs.sector/BPB_SecPerTrk)
|
||||
; head number = pre.track number%BPB_NumHeads
|
||||
; track number = pre.track number/BPB_NumHeads
|
||||
; Return: cl - sector number
|
||||
; ch - track number
|
||||
; dl - drive number (0 = a:)
|
||||
; dh - head number
|
||||
conv_abs_to_THS:
|
||||
push bx
|
||||
mov bx,word [BPB_SecPerTrk+boot_program]
|
||||
xor dx,dx
|
||||
div bx
|
||||
inc dx
|
||||
mov cl, dl ; cl = sector number
|
||||
mov bx,word [BPB_NumHeads+boot_program]
|
||||
xor dx,dx
|
||||
div bx
|
||||
; !!!!!!! ax = track number, dx = head number
|
||||
mov ch,al ; ch=track number
|
||||
xchg dh,dl ; dh=head number
|
||||
mov dl,0 ; dl=0 (drive 0 (a:))
|
||||
pop bx
|
||||
retn
|
||||
;------------------------------------------
|
||||
|
||||
loading db cr,lf,'Starting system ',00h
|
||||
error_message db 13,10
|
||||
kernel_name db 'KERNEL MNT ?',cr,lf,00h
|
||||
FirstRootDirSecNum dw ?
|
||||
RootDirSecs dw ?
|
||||
data_start dw ?
|
||||
|
||||
; <diamond>
|
||||
write1st:
|
||||
push cs
|
||||
pop ds
|
||||
mov byte [patchhere+1+boot_program], 3 ; change ah=2 to ah=3
|
||||
mov ax,[cluster1st+boot_program]
|
||||
push 1000h
|
||||
pop es
|
||||
xor bx,bx
|
||||
call writesec
|
||||
mov byte [patchhere+1+boot_program], 2 ; change back ah=3 to ah=2
|
||||
retf
|
||||
cluster1st dw ?
|
||||
loader_block:
|
||||
db 1
|
||||
dw 0
|
||||
dw write1st+boot_program
|
||||
dw 0
|
||||
; <\diamond>
|
||||
|
||||
times 0x1fe-$ db 00h
|
||||
|
||||
db 55h,0aah ;boot signature
|
@ -1,19 +0,0 @@
|
||||
BS_OEMName db 'KOLIBRI ' ; db 8
|
||||
BPB_BytsPerSec dw 512 ; bytes per sector
|
||||
BPB_SecPerClus db 1 ; sectors per cluster
|
||||
BPB_RsvdSecCnt dw 1 ; number of reserver sectors
|
||||
BPB_NumFATs db 2 ; count of FAT data structures
|
||||
BPB_RootEntCnt dw 224 ; count of 32-byte dir. entries (224*32 = 14 sectors)
|
||||
BPB_TotSec16 dw 2880 ; count of sectors on the volume (2880 for 1.44 mbytes disk)
|
||||
BPB_Media db 0f0h ; f0 - used for removable media
|
||||
BPB_FATSz16 dw 9 ; count of sectors by one copy of FAT
|
||||
BPB_SecPerTrk dw 18 ; sectors per track
|
||||
BPB_NumHeads dw 2 ; number of heads
|
||||
BPB_HiddSec dd 0 ; count of hidden sectors
|
||||
BPB_TotSec32 dd 0 ; count of sectors on the volume (if > 65535)
|
||||
BS_DrvNum db 0 ; int 13h drive number
|
||||
BS_Reserved db 0 ; reserved
|
||||
BS_BootSig db 29h ; Extended boot signature
|
||||
BS_VolID dd 0 ; Volume serial number
|
||||
BS_VolLab db 'KOLIBRI ' ; Volume label (db 11)
|
||||
BS_FilSysType db 'FAT12 ' ; file system type (db 8)
|
@ -1,19 +0,0 @@
|
||||
BS_OEMName db 'KOLIBRI ' ; db 8
|
||||
BPB_BytsPerSec dw 512 ; bytes per sector
|
||||
BPB_SecPerClus db 1 ; sectors per cluster
|
||||
BPB_RsvdSecCnt dw 1 ; number of reserver sectors
|
||||
BPB_NumFATs db 2 ; count of FAT data structures
|
||||
BPB_RootEntCnt dw 112 ; count of 32-byte dir. entries (112*32 = 7 sectors)
|
||||
BPB_TotSec16 dw 3360 ; count of sectors on the volume (3360 for 1.68 mbytes disk)
|
||||
BPB_Media db 0f0h ; f0 - used for removable media
|
||||
BPB_FATSz16 dw 10 ; count of sectors by one copy of FAT
|
||||
BPB_SecPerTrk dw 21 ; sectors per track
|
||||
BPB_NumHeads dw 2 ; number of heads
|
||||
BPB_HiddSec dd 0 ; count of hidden sectors
|
||||
BPB_TotSec32 dd 0 ; count of sectors on the volume (if > 65535)
|
||||
BS_DrvNum db 0 ; int 13h drive number
|
||||
BS_Reserved db 0 ; reserved
|
||||
BS_BootSig db 29h ; Extended boot signature
|
||||
BS_VolID dd 0 ; Volume serial number
|
||||
BS_VolLab db 'KOLIBRI ' ; Volume label (db 11)
|
||||
BS_FilSysType db 'FAT12 ' ; file system type (db 8)
|
@ -1,19 +0,0 @@
|
||||
BS_OEMName db 'KOLIBRI ' ; db 8
|
||||
BPB_BytsPerSec dw 512 ; bytes per sector
|
||||
BPB_SecPerClus db 1 ; sectors per cluster
|
||||
BPB_RsvdSecCnt dw 1 ; number of reserver sectors
|
||||
BPB_NumFATs db 2 ; count of FAT data structures
|
||||
BPB_RootEntCnt dw 224 ; count of 32-byte dir. entries (224*32 = 14 sectors)
|
||||
BPB_TotSec16 dw 3486 ; count of sectors on the volume (3486 for 1.74 mbytes disk)
|
||||
BPB_Media db 0f0h ; f0 - used for removable media
|
||||
BPB_FATSz16 dw 11 ; count of sectors by one copy of FAT
|
||||
BPB_SecPerTrk dw 21 ; sectors per track
|
||||
BPB_NumHeads dw 2 ; number of heads
|
||||
BPB_HiddSec dd 0 ; count of hidden sectors
|
||||
BPB_TotSec32 dd 0 ; count of sectors on the volume (if > 65535)
|
||||
BS_DrvNum db 0 ; int 13h drive number
|
||||
BS_Reserved db 0 ; reserved
|
||||
BS_BootSig db 29h ; Extended boot signature
|
||||
BS_VolID dd 0 ; Volume serial number
|
||||
BS_VolLab db 'KOLIBRI ' ; Volume label (db 11)
|
||||
BS_FilSysType db 'FAT12 ' ; file system type (db 8)
|
@ -1,19 +0,0 @@
|
||||
BS_OEMName db 'KOLIBRI ' ; db 8
|
||||
BPB_BytsPerSec dw 512 ; bytes per sector
|
||||
BPB_SecPerClus db 2 ; sectors per cluster
|
||||
BPB_RsvdSecCnt dw 1 ; number of reserver sectors
|
||||
BPB_NumFATs db 2 ; count of FAT data structures
|
||||
BPB_RootEntCnt dw 240 ; count of 32-byte dir. entries (240*32 = 15 sectors)
|
||||
BPB_TotSec16 dw 5760 ; count of sectors on the volume (5760 for 2.88 mbytes disk)
|
||||
BPB_Media db 0f0h ; f0 - used for removable media
|
||||
BPB_FATSz16 dw 9 ; count of sectors by one copy of FAT
|
||||
BPB_SecPerTrk dw 36 ; sectors per track
|
||||
BPB_NumHeads dw 2 ; number of heads
|
||||
BPB_HiddSec dd 0 ; count of hidden sectors
|
||||
BPB_TotSec32 dd 0 ; count of sectors on the volume (if > 65535)
|
||||
BS_DrvNum db 0 ; int 13h drive number
|
||||
BS_Reserved db 0 ; reserved
|
||||
BS_BootSig db 29h ; Extended boot signature
|
||||
BS_VolID dd 0 ; Volume serial number
|
||||
BS_VolLab db 'KOLIBRI ' ; Volume label (db 11)
|
||||
BS_FilSysType db 'FAT12 ' ; file system type (db 8)
|
@ -1,43 +0,0 @@
|
||||
‡ £à㧮çë© á¥ªâ®à ¤«ï Ž‘ Š®«¨¡à¨ (FAT12, ¤¨áª¥â )
|
||||
|
||||
- Ž¯¨á ¨¥
|
||||
<20>®§¢®«ï¥â § £à㦠âì KERNEL.MNT á ¤¨áª¥â/®¡à §®¢
|
||||
®¡êñ¬®¬ 1.44M, 1.68M, 1.72M ¨ 2.88M
|
||||
„«ï ¢ë¡®à ®¡êñ¬ ¤¨áª , ¤«ï ª®â®à®£® ¤® ᮡà âì
|
||||
§ £à㧮çë© á¥ªâ®à, ¥®¡å®¤¨¬® ¢ ä ©«¥ boot_fat12.asm
|
||||
à ᪮¬¬¥â¨à®¢ âì áâப㠢¨¤ :
|
||||
include 'floppy????.inc'
|
||||
¤«ï ¥®¡å®¤¨¬®£® ®¡êñ¬ ¤¨áª . „®áâã¯ë¥ ¢ ਠâë:
|
||||
floppy1440.inc,
|
||||
floppy1680.inc,
|
||||
floppy1743.inc ¨ floppy2880.inc
|
||||
|
||||
- ‘¡®àª
|
||||
fasm boot_fat12.asm
|
||||
|
||||
- „«ï § ¯¨á¨ § £à㧮箣® ᥪâ®à ¤¨áª/®¡à § ¯®¤ Linux
|
||||
¬®¦® ¢®á¯®«ì§®¢ âìáï á«¥¤ãî饩 ª®¬ ¤®©:
|
||||
dd if=boot_fat12.bin of=288.img bs=512 count=1 conv=notrunc
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Floppy FAT12 boot sector for KolibriOS.
|
||||
|
||||
- Description
|
||||
Allows booting KERNEL.MNT floppies/images
|
||||
with volumes of 1.44M, 1.68M, 1.72M and 2.88M
|
||||
To select the volume of the disk, which should gather
|
||||
boot sector, it was necessary in file boot_fat12.asm
|
||||
uncomment line:
|
||||
include 'floppy????. inc'
|
||||
for the necessary disk volume. Available options is:
|
||||
floppy1440.inc,
|
||||
floppy1680.inc,
|
||||
floppy1743.inc and floppy2880.inc
|
||||
|
||||
- Compile
|
||||
fasm boot_fat12.asm
|
||||
|
||||
- To write boot sector to the floppy/image under Linux
|
||||
you can use the following command:
|
||||
dd if=boot_fat12.bin of=288.img bs=512 count=1 conv=notrunc
|
@ -1,518 +0,0 @@
|
||||
--------p-155300-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - INSTALLATION CHECK
|
||||
AX = 5300h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
AH = major version (BCD)
|
||||
AL = minor version (BCD)
|
||||
BX = 504Dh ("PM")
|
||||
CX = flags (see #00472)
|
||||
CF set on error
|
||||
AH = error code (06h,09h,86h) (see #00473)
|
||||
BUG: early versions of the Award Modular BIOS with built-in APM support
|
||||
reportedly do not set BX on return
|
||||
|
||||
Bitfields for APM flags:
|
||||
Bit(s) Description (Table 00472)
|
||||
0 16-bit protected mode interface supported
|
||||
1 32-bit protected mode interface supported
|
||||
2 CPU idle call reduces processor speed
|
||||
3 BIOS power management disabled
|
||||
4 BIOS power management disengaged (APM v1.1)
|
||||
5-7 reserved
|
||||
|
||||
(Table 00473)
|
||||
Values for APM error code:
|
||||
01h power management functionality disabled
|
||||
02h interface connection already in effect
|
||||
03h interface not connected
|
||||
04h real-mode interface not connected
|
||||
05h 16-bit protected-mode interface already connected
|
||||
06h 16-bit protected-mode interface not supported
|
||||
07h 32-bit protected-mode interface already connected
|
||||
08h 32-bit protected-mode interface not supported
|
||||
09h unrecognized device ID
|
||||
0Ah invalid parameter value in CX
|
||||
0Bh (APM v1.1) interface not engaged
|
||||
0Ch (APM v1.2) function not supported
|
||||
0Dh (APM v1.2) Resume Timer disabled
|
||||
0Eh-1Fh reserved for other interface and general errors
|
||||
20h-3Fh reserved for CPU errors
|
||||
40h-5Fh reserved for device errors
|
||||
60h can't enter requested state
|
||||
61h-7Fh reserved for other system errors
|
||||
80h no power management events pending
|
||||
81h-85h reserved for other power management event errors
|
||||
86h APM not present
|
||||
87h-9Fh reserved for other power management event errors
|
||||
A0h-FEh reserved
|
||||
FFh undefined
|
||||
--------p-155301-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CONNECT REAL-MODE INTERFACE
|
||||
AX = 5301h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (02h,05h,07h,09h) (see #00473)
|
||||
Note: on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
|
||||
compatibility mode until it is informed that the user supports a
|
||||
newer version of APM (see AX=530Eh)
|
||||
SeeAlso: AX=5302h,AX=5303h,AX=5304h
|
||||
--------p-155302-----------------------------
|
||||
INT 15 R - Advanced Power Management v1.0+ - CONNECT 16-BIT PROTMODE INTERFACE
|
||||
AX = 5302h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
AX = real-mode segment base address of protected-mode 16-bit code
|
||||
segment
|
||||
BX = offset of entry point
|
||||
CX = real-mode segment base address of protected-mode 16-bit data
|
||||
segment
|
||||
---APM v1.1---
|
||||
SI = APM BIOS code segment length
|
||||
DI = APM BIOS data segment length
|
||||
CF set on error
|
||||
AH = error code (02h,05h,06h,07h,09h) (see #00473)
|
||||
Notes: the caller must initialize two consecutive descriptors with the
|
||||
returned segment base addresses; these descriptors must be valid
|
||||
whenever the protected-mode interface is called, and will have
|
||||
their limits arbitrarily set to 64K.
|
||||
the protected mode interface is invoked by making a far call with the
|
||||
same register values as for INT 15; it must be invoked while CPL=0,
|
||||
the code segment descriptor must have a DPL of 0, the stack must be
|
||||
in a 16-bit segment and have enough room for BIOS use and possible
|
||||
interrupts, and the current I/O permission bit map must allow access
|
||||
to the I/O ports used for power management.
|
||||
functions 00h-03h are not available from protected mode
|
||||
on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
|
||||
compatibility mode until it is informed that the user supports a
|
||||
newer version of APM (see AX=530Eh)
|
||||
SeeAlso: AX=5301h,AX=5303h,AX=5304h
|
||||
--------p-155303-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CONNECT 32-BIT PROTMODE INTERFACE
|
||||
AX = 5303h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
AX = real-mode segment base address of protected-mode 32-bit code
|
||||
segment
|
||||
EBX = offset of entry point
|
||||
CX = real-mode segment base address of protected-mode 16-bit code
|
||||
segment
|
||||
DX = real-mode segment base address of protected-mode 16-bit data
|
||||
segment
|
||||
---APM v1.1---
|
||||
SI = APM BIOS code segment length
|
||||
DI = APM BIOS data segment length
|
||||
CF set on error
|
||||
AH = error code (02h,05h,07h,08h,09h) (see #00473)
|
||||
Notes: the caller must initialize three consecutive descriptors with the
|
||||
returned segment base addresses for 32-bit code, 16-bit code, and
|
||||
16-bit data, respectively; these descriptors must be valid whenever
|
||||
the protected-mode interface is called, and will have their limits
|
||||
arbitrarily set to 64K.
|
||||
the protected mode interface is invoked by making a far call to the
|
||||
32-bit code segment with the same register values as for INT 15; it
|
||||
must be invoked while CPL=0, the code segment descriptor must have a
|
||||
DPL of 0, the stack must be in a 32-bit segment and have enough room
|
||||
for BIOS use and possible interrupts, and the current I/O permission
|
||||
bit map must allow access to the I/O ports used for power management.
|
||||
functions 00h-03h are not available from protected mode
|
||||
on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
|
||||
compatibility mode until it is informed that the user supports a
|
||||
newer version of APM (see AX=530Eh)
|
||||
SeeAlso: AX=5301h,AX=5302h,AX=5304h
|
||||
--------p-155304-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - DISCONNECT INTERFACE
|
||||
AX = 5304h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (03h,09h) (see #00473)
|
||||
SeeAlso: AX=5301h,AX=5302h,AX=5303h
|
||||
--------p-155305-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CPU IDLE
|
||||
AX = 5305h
|
||||
Return: CF clear if successful (after system leaves idle state)
|
||||
CF set on error
|
||||
AH = error code (03h,0Bh) (see #00473)
|
||||
Notes: call when the system is idle and should be suspended until the next
|
||||
system event or interrupt
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
if an interrupt causes the system to resume normal processing, the
|
||||
interrupt may or may not have been handled when the BIOS returns
|
||||
from this call; thus, the caller should allow interrupts on return
|
||||
interrupt handlers may not retain control if the BIOS allows
|
||||
interrupts while in idle mode even if they are able to determine
|
||||
that they were called from idle mode
|
||||
the caller should issue this call continuously in a loop until it needs
|
||||
to perform some processing of its own
|
||||
SeeAlso: AX=1000h,AX=5306h,INT 2F/AX=1680h
|
||||
--------p-155306-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CPU BUSY
|
||||
AX = 5306h
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (03h,0Bh) (see #00473)
|
||||
Notes: called to ensure that the system runs at full speed even on systems
|
||||
where the BIOS is unable to recognize increased activity (especially
|
||||
if interrupts are hooked by other programs and not chained to the
|
||||
BIOS)
|
||||
this call may be made even when the system is already running at full
|
||||
speed, but it will create unnecessary overhead
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=5305h
|
||||
--------p-155307-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - SET POWER STATE
|
||||
AX = 5307h
|
||||
BX = device ID (see #00474)
|
||||
CX = system state ID (see #00475)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,03h,09h,0Ah,0Bh,60h) (see #00473)
|
||||
Note: should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=530Ch
|
||||
|
||||
(Table 00474)
|
||||
Values for APM device IDs:
|
||||
0000h system BIOS
|
||||
0001h all devices for which the system BIOS manages power
|
||||
01xxh display (01FFh for all attached display devices)
|
||||
02xxh secondary storage (02FFh for all attached secondary storage devices)
|
||||
03xxh parallel ports (03FFh for all attached parallel ports)
|
||||
04xxh serial ports (04FFh for all attached serial ports)
|
||||
---APM v1.1+ ---
|
||||
05xxh network adapters (05FFh for all attached network adapters)
|
||||
06xxh PCMCIA sockets (06FFh for all)
|
||||
0700h-7FFFh reserved
|
||||
80xxh system battery devices (APM v1.2)
|
||||
8100h-DFFFh reserved
|
||||
Exxxh OEM-defined power device IDs
|
||||
F000h-FFFFh reserved
|
||||
|
||||
(Table 00475)
|
||||
Values for system state ID:
|
||||
0000h ready (not supported for device ID 0001h)
|
||||
0001h stand-by
|
||||
0002h suspend
|
||||
0003h off (not supported for device ID 0001h in APM v1.0)
|
||||
---APM v1.1---
|
||||
0004h last request processing notification (only for device ID 0001h)
|
||||
0005h last request rejected (only for device ID 0001h)
|
||||
0006h-001Fh reserved system states
|
||||
0020h-003Fh OEM-defined system states
|
||||
0040h-007Fh OEM-defined device states
|
||||
0080h-FFFFh reserved device states
|
||||
--------p-155307CX0001-----------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - SYSTEM STAND-BY
|
||||
AX = 5307h
|
||||
CX = 0001h
|
||||
BX = 0001h (device ID for all power-managed devices)
|
||||
Return: CF clear
|
||||
Notes: puts the entire system into stand-by mode; normally called in response
|
||||
to a System Stand-by Request notification after any necessary
|
||||
processing, but may also be invoked at the caller's discretion
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
the stand-by state is typically exited on an interrupt
|
||||
SeeAlso: AX=4280h,AX=5307h/CX=0002h"SUSPEND",AX=5307h/CX=0003h,AX=530Bh
|
||||
--------p-155307CX0002-----------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - SUSPEND SYSTEM
|
||||
AX = 5307h
|
||||
CX = 0002h
|
||||
BX = 0001h (device ID for all power-managed devices)
|
||||
Return: after system is resumed
|
||||
CF clear
|
||||
Notes: puts the entire system into a low-power suspended state; normally
|
||||
called in response to a Suspend System Request notification after
|
||||
any necessary processing, but may also be invoked at the caller's
|
||||
discretion
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
the caller may need to update its date and time values because the
|
||||
system could have been suspended for a long period of time
|
||||
SeeAlso: AX=5307h/CX=0001h"STAND-BY",AX=530Bh
|
||||
--------p-155307CX0003-----------------------
|
||||
INT 15 - Advanced Power Management v1.2 - TURN OFF SYSTEM
|
||||
AX = 5307h
|
||||
CX = 0003h
|
||||
BX = 0001h (device ID for all power-managed devices)
|
||||
Return: after system is resumed
|
||||
CF clear
|
||||
Notes: if supported by the system's power supply, turns off the system power
|
||||
SeeAlso: AX=5307h/CX=0001h"STAND-BY",AX=530Bh
|
||||
--------p-155308-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - ENABLE/DISABLE POWER MANAGEMENT
|
||||
AX = 5308h
|
||||
BX = device ID for all devices power-managed by APM
|
||||
0001h (APM v1.1+)
|
||||
FFFFh (APM v1.0)
|
||||
CX = new state
|
||||
0000h disabled
|
||||
0001h enabled
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,03h,09h,0Ah,0Bh) (see #00473)
|
||||
Notes: when power management is disabled, the system BIOS will not
|
||||
automatically power down devices, enter stand-by or suspended mode,
|
||||
or perform any power-saving actions in response to AX=5305h calls
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
the APM BIOS should never be both disabled and disengaged at the same
|
||||
time
|
||||
SeeAlso: AX=5309h,AX=530Dh,AX=530Fh
|
||||
--------p-155309-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - RESTORE POWER-ON DEFAULTS
|
||||
AX = 5309h
|
||||
BX = device ID for all devices power-managed by APM
|
||||
0001h (APM v1.1)
|
||||
FFFFh (APM v1.0)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Bh) (see #00473)
|
||||
Note: should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=5308h
|
||||
--------p-15530A-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - GET POWER STATUS
|
||||
AX = 530Ah
|
||||
BX = device ID
|
||||
0001h all devices power-managed by APM
|
||||
80xxh specific battery unit number XXh (01h-FFh) (APM v1.2)
|
||||
Return: CF clear if successful
|
||||
BH = AC line status
|
||||
00h off-line
|
||||
01h on-line
|
||||
02h on backup power (APM v1.1)
|
||||
FFh unknown
|
||||
other reserved
|
||||
BL = battery status (see #00476)
|
||||
CH = battery flag (APM v1.1+) (see #00477)
|
||||
CL = remaining battery life, percentage
|
||||
00h-64h (0-100) percentage of full charge
|
||||
FFh unknown
|
||||
DX = remaining battery life, time (APM v1.1) (see #00478)
|
||||
---if specific battery unit specified---
|
||||
SI = number of battery units currently installed
|
||||
CF set on error
|
||||
AH = error code (09h,0Ah) (see #00473)
|
||||
Notes: should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
supported in real mode (INT 15) and both 16-bit and 32-bit protected
|
||||
mode
|
||||
|
||||
(Table 00476)
|
||||
Values for APM v1.0+ battery status:
|
||||
00h high
|
||||
01h low
|
||||
02h critical
|
||||
03h charging
|
||||
FFh unknown
|
||||
other reserved
|
||||
SeeAlso: #00477,#00478
|
||||
|
||||
Bitfields for APM v1.1+ battery flag:
|
||||
Bit(s) Description (Table 00477)
|
||||
0 high
|
||||
1 low
|
||||
2 critical
|
||||
3 charging
|
||||
4 selected battery not present (APM v1.2)
|
||||
5-6 reserved (0)
|
||||
7 no system battery
|
||||
Note: all bits set (FFh) if unknown
|
||||
SeeAlso: #00476,#00478
|
||||
|
||||
Bitfields for APM v1.1+ remaining battery life:
|
||||
Bit(s) Description (Table 00478)
|
||||
15 time units: 0=seconds, 1=minutes
|
||||
14-0 battery life in minutes or seconds
|
||||
Note: all bits set (FFFFh) if unknown
|
||||
SeeAlso: #00476,#00477
|
||||
--------p-15530B-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - GET POWER MANAGEMENT EVENT
|
||||
AX = 530Bh
|
||||
Return: CF clear if successful
|
||||
BX = event code (see #00479)
|
||||
CX = event information (APM v1.2) if BX=0003h or BX=0004h
|
||||
bit 0: PCMCIA socket was powered down in suspend state
|
||||
CF set on error
|
||||
AH = error code (03h,0Bh,80h) (see #00473)
|
||||
Notes: although power management events are often asynchronous, notification
|
||||
will not be made until polled via this call to permit software to
|
||||
only receive event notification when it is prepared to process
|
||||
power management events; since these events are not very time-
|
||||
critical, it should be sufficient to poll once or twice per second
|
||||
the critical resume notification is made after the system resumes
|
||||
from an emergency suspension; normally, the system BIOS only notifies
|
||||
its partner that it wishes to suspend and relies on the partner to
|
||||
actually request the suspension, but no notification is made on an
|
||||
emergency suspension
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=5307h,AX=5307h/CX=0001h"STAND-BY",AX=5307h/CX=0002h"SUSPEND"
|
||||
|
||||
(Table 00479)
|
||||
Values for APM event code:
|
||||
0001h system stand-by request
|
||||
0002h system suspend request
|
||||
0003h normal resume system notification
|
||||
0004h critical resume system notification
|
||||
0005h battery low notification
|
||||
---APM v1.1---
|
||||
0006h power status change notification
|
||||
0007h update time notification
|
||||
0008h critical system suspend notification
|
||||
0009h user system standby request notification
|
||||
000Ah user system suspend request notification
|
||||
000Bh system standby resume notification
|
||||
---APM v1.2---
|
||||
000Ch capabilities change notification (see AX=5310h)
|
||||
------
|
||||
000Dh-00FFh reserved system events
|
||||
01xxh reserved device events
|
||||
02xxh OEM-defined APM events
|
||||
0300h-FFFFh reserved
|
||||
--------p-15530C-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - GET POWER STATE
|
||||
AX = 530Ch
|
||||
BX = device ID (see #00474)
|
||||
Return: CF clear if successful
|
||||
CX = system state ID (see #00475)
|
||||
CF set on error
|
||||
AH = error code (01h,09h) (see #00473)
|
||||
SeeAlso: AX=5307h
|
||||
--------p-15530D-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - EN/DISABLE DEVICE POWER MANAGEMENT
|
||||
AX = 530Dh
|
||||
BX = device ID (see #00474)
|
||||
CX = function
|
||||
0000h disable power management
|
||||
0001h enable power management
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,03h,09h,0Ah,0Bh) (see #00473)
|
||||
Desc: specify whether automatic power management should be active for a
|
||||
given device
|
||||
SeeAlso: AX=5308h,AX=530Fh
|
||||
--------p-15530E-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - DRIVER VERSION
|
||||
AX = 530Eh
|
||||
BX = device ID of system BIOS (0000h)
|
||||
CH = APM driver major version (BCD)
|
||||
CL = APM driver minor version (BCD) (02h for APM v1.2)
|
||||
Return: CF clear if successful
|
||||
AH = APM connection major version (BCD)
|
||||
AL = APM connection minor version (BCD)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Bh) (see #00473)
|
||||
SeeAlso: AX=5300h,AX=5303h
|
||||
--------p-15530F-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - ENGAGE/DISENGAGE POWER MANAGEMENT
|
||||
AX = 530Fh
|
||||
BX = device ID (see #00474)
|
||||
CX = function
|
||||
0000h disengage power management
|
||||
0001h engage power management
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,09h) (see #00473)
|
||||
Notes: unlike AX=5308h, this call does not affect the functioning of the APM
|
||||
BIOS
|
||||
when cooperative power management is disengaged, the APM BIOS performs
|
||||
automatic power management of the system or device
|
||||
SeeAlso: AX=5308h,AX=530Dh
|
||||
--------p-155310-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - GET CAPABILITIES
|
||||
AX = 5310h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
Return: CF clear if successful
|
||||
BL = number of battery units supported (00h if no system batteries)
|
||||
CX = capabilities flags (see #00480)
|
||||
CF set on error
|
||||
AH = error code (01h,09h,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces; it does not require that a
|
||||
connection be established prior to use
|
||||
this function will return the capabilities currently in effect, not
|
||||
any new settings which have been made but do not take effect until
|
||||
a system restart
|
||||
SeeAlso: AX=5300h,AX=530Fh,AX=5311h,AX=5312h,AX=5313h
|
||||
|
||||
Bitfields for APM v1.2 capabilities flags:
|
||||
Bit(s) Description (Table 00480)
|
||||
15-8 reserved
|
||||
7 PCMCIA Ring Indicator will wake up system from suspend mode
|
||||
6 PCMCIA Ring Indicator will wake up system from standby mode
|
||||
5 Resume on Ring Indicator will wake up system from suspend mode
|
||||
4 Resume on Ring Indicator will wake up system from standby mode
|
||||
3 resume timer will wake up system from suspend mode
|
||||
2 resume timer will wake up system from standby mode
|
||||
1 can enter global suspend state
|
||||
0 can enter global standby state
|
||||
--------p-155311-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - GET/SET/DISABLE RESUME TIMER
|
||||
AX = 5311h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
CL = function
|
||||
00h disable Resume Timer
|
||||
01h get Resume Timer
|
||||
02h set Resume Timer
|
||||
CH = resume time, seconds (BCD)
|
||||
DL = resume time, minutes (BCD)
|
||||
DH = resume time, hours (BCD)
|
||||
SI = resume date (BCD), high byte = month, low byte = day
|
||||
DI = resume date, year (BCD)
|
||||
Return: CF clear if successful
|
||||
---if getting timer---
|
||||
CH = resume time, seconds (BCD)
|
||||
DL = resume time, minutes (BCD)
|
||||
DH = resume time, hours (BCD)
|
||||
SI = resume date (BCD), high byte = month, low byte = day
|
||||
DI = resume date, year (BCD)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Ah,0Bh,0Ch,0Dh,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces
|
||||
SeeAlso: AX=5300h,AX=5310h,AX=5312h,AX=5313h
|
||||
--------p-155312-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE RESUME ON RING
|
||||
AX = 5312h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
CL = function
|
||||
00h disable Resume on Ring Indicator
|
||||
01h enable Resume on Ring Indicator
|
||||
02h get Resume on Ring Indicator status
|
||||
Return: CF clear if successful
|
||||
CX = resume status (0000h disabled, 0001h enabled)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Ah,0Bh,0Ch,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces
|
||||
SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5313h
|
||||
--------p-155313-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE TIMER-BASED REQUESTS
|
||||
AX = 5313h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
CL = function
|
||||
00h disable timer-based requests
|
||||
01h enable timer-based requests
|
||||
02h get timer-based requests status
|
||||
Return: CF clear if successful
|
||||
CX = timer-based requests status (0000h disabled, 0001h enabled)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Ah,0Bh,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces
|
||||
some BIOSes set AH on return even when successful
|
||||
SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5312h
|
@ -1,88 +0,0 @@
|
||||
; (english text below)
|
||||
|
||||
;------------------------------------------
|
||||
; Èíòåðôåéñ ñîõðàíåíèÿ ïàðàìåòðîâ
|
||||
;------------------------------------------
|
||||
Åñëè ïðè ïåðåäà÷å óïðàâëåíèÿ ÿäðó çàãðóç÷èê óñòàíàâëèâàåò AX='KL',
|
||||
òî â DS:SI ÿäðî îæèäàåò äàëüíåãî óêàçàòåëÿ íà ñëåäóþùóþ ñòðóêòóðó:
|
||||
db âåðñèÿ ñòðóêòóðû, äîëæíà áûòü 1
|
||||
dw ôëàãè:
|
||||
áèò 0 óñòàíîâëåí = ïðèñóòñòâóåò îáðàç ðàìäèñêà â ïàìÿòè
|
||||
dd äàëüíèé óêàçàòåëü íà ïðîöåäóðó ñîõðàíåíèÿ ïàðàìåòðîâ
|
||||
ìîæåò áûòü 0, åñëè çàãðóç÷èê íå ïîääåðæèâàåò
|
||||
Ïðîöåäóðà ñîõðàíåíèÿ ïàðàìåòðîâ äîëæíà çàïèñàòü ïåðâûé ñåêòîð ÿäðà
|
||||
kernel.mnt íàçàä íà òî ìåñòî, îòêóäà îíà åãî ñ÷èòàëà; âîçâðàò èç
|
||||
ïðîöåäóðû îñóùåñòâëÿåòñÿ ïî retf.
|
||||
|
||||
;------------------------------------------
|
||||
; Óêàçàíèå çàãðóç÷èêîì ñèñòåìíîãî êàòàëîãà
|
||||
;------------------------------------------
|
||||
Ïåðåä ïåðåäà÷åé óïðàâëåíèÿ ÿäðó ìîãóò áûòü óñòàíîâëåíû ñëåäóþùèå ðåãèñòðû:
|
||||
CX='HA'
|
||||
DX='RD'
|
||||
Ýòî óêàçûâàåò íà òî, ÷òî ðåãèñòð BX óêàçûâàåò íà ñèñòåìíûé ðàçäåë. Êàòàëîã /kolibri/ íà
|
||||
ýòîì ðàçäåëå ÿâëÿåòñÿ ñèñòåìíûì, ê íåìó ìîæíî îáðàùàòüñÿ êàê ê /sys/
|
||||
|
||||
Âîçìîæíûå çíà÷åíèÿ ðåãèñòðà BL (óêàçûâàåò íà óñòðîéñòâî):
|
||||
'a' - Primary Master
|
||||
'b' - Primary Slave
|
||||
'c' - Secondary Master
|
||||
'd' - Secondary Slave
|
||||
'r' - RAM äèñê
|
||||
'm' - Ïðèâîäû CD-ROM
|
||||
|
||||
Âîçìîæíûå çíà÷åíèÿ ðåãèñòðà BH (óêàçûâàåò íà ðàçäåë):
|
||||
äëÿ BL='a','b','c','d','r' - óêàçûâàåò íà ðàçäåë, ãäå ðàñïîëîæåí ñèñòåìíûé êàòàëîã
|
||||
äëÿ BL='m',óêàçûâàåò íà íîìåð ôèçè÷åñêîãî óñòðîéñòâà, ñ êîòîðîãî íàäî íà÷èíàòü ïîèñê ñèñòåìíîãî êàòàëîãà.
|
||||
|
||||
ïðèìåðû çíà÷åíèé ðåãèñòðà BX:
|
||||
'a1' - /hd0/1/
|
||||
'a2' - /hd0/2/
|
||||
'b1' - /hd1/1/
|
||||
'd4' - /hd3/4/
|
||||
'm0' - ïîèñê ïî ñèäþêàì êàòàëîãà kolibri
|
||||
'r1' - /rd/1/
|
||||
|
||||
|
||||
;------------------------------------------
|
||||
; Interface for saving boot-screen settings
|
||||
;------------------------------------------
|
||||
If a loader sets AX='KL' when transferring control to the kernel,
|
||||
the kernel expects in DS:SI far pointer to the following structure:
|
||||
db structure version, must be 1
|
||||
dw flags
|
||||
bit 0 set = ramdisk image in memory is present
|
||||
dd far pointer to save settings procedure
|
||||
may be 0 if such procedure is not supported by loader
|
||||
Procedure for saving settings must write the first sector of the kernel
|
||||
kernel.mnt back to the place, from where it has been read; return from
|
||||
this procedure must be with retf.
|
||||
|
||||
;------------------------------------------
|
||||
; System directory information from loader
|
||||
;------------------------------------------
|
||||
Before transfer of control to the kernel following registers can be set:
|
||||
CX = 'HA'
|
||||
DX = 'RD'
|
||||
This indicates that the register BX identifies system partition. The folder /kolibri/ in
|
||||
this partition is system folder, it can be referenced as /sys/
|
||||
|
||||
Possible values for register BL (indicates the device):
|
||||
'a' - Primary Master
|
||||
'b' - Primary Slave
|
||||
'c' - Secondary Master
|
||||
'd' - Secondary Slave
|
||||
'r' - RAM disc
|
||||
'm' - ROM drives
|
||||
|
||||
Possible values for register BH (indicates section):
|
||||
for BL = 'a', 'b', 'c', 'd', 'r' to denote partition where the system folder
|
||||
for BL = 'm', indicates the number of physical devices, which must begin a systematic search directory.
|
||||
|
||||
Examples of register BX:
|
||||
'a1' - /hd0/1/
|
||||
'a2' - /hd0/2/
|
||||
'b1' - /hd1/1/
|
||||
'd4' - /hd3/4/
|
||||
'm0' - search directory 'kolibri' by all CD-ROMs
|
||||
'r1' - /rd/1/
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 584 B |
Binary file not shown.
Before Width: | Height: | Size: 584 B |
@ -1,38 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
include 'me_skin.inc'
|
||||
|
||||
SKIN_PARAMS \
|
||||
height = bmp_base.height,\ ; skin height
|
||||
margins = [5:1:43:1],\ ; margins [left:top:right:bottom]
|
||||
colors active = [binner=0x00081d:\ ; border inner color
|
||||
bouter=0x00081d:\ ; border outer color
|
||||
bframe=0x0054e7],\ ; border frame color
|
||||
colors inactive = [binner=0x00081d:\ ; border inner color
|
||||
bouter=0x00081d:\ ; border outer color
|
||||
bframe=0x1a8acc],\ ; border frame color
|
||||
dtp = 'myblue.dtp' ; dtp colors
|
||||
|
||||
SKIN_BUTTONS \
|
||||
close = [-21:3][16:16],\ ; buttons coordinates
|
||||
minimize = [-39:3][16:16] ; [left:top][width:height]
|
||||
|
||||
SKIN_BITMAPS \
|
||||
left active = bmp_left,\ ; skin bitmaps pointers
|
||||
left inactive = bmp_left1,\
|
||||
oper active = bmp_oper,\
|
||||
oper inactive = bmp_oper1,\
|
||||
base active = bmp_base,\
|
||||
base inactive = bmp_base1
|
||||
|
||||
BITMAP bmp_left ,'left.bmp' ; skin bitmaps
|
||||
BITMAP bmp_oper ,'oper.bmp'
|
||||
BITMAP bmp_base ,'base.bmp'
|
||||
BITMAP bmp_left1,'left_1.bmp'
|
||||
BITMAP bmp_oper1,'oper_1.bmp'
|
||||
BITMAP bmp_base1,'base_1.bmp'
|
Binary file not shown.
Before Width: | Height: | Size: 670 B |
Binary file not shown.
Before Width: | Height: | Size: 670 B |
@ -1,242 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;============================================================================
|
||||
; This file should be used to generate skins of new standard
|
||||
;============================================================================
|
||||
; skin file structure:
|
||||
;----------------------------------------------------------------------------
|
||||
; header:
|
||||
; dd 'SKIN'
|
||||
; dd = version (1 for now)
|
||||
; dd @ params
|
||||
; dd @ buttons
|
||||
; dd @ bitmaps
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; NOTE: order of sections listed below is insignificant
|
||||
; since they're identified by pointer in above header
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; params:
|
||||
; dd = skin height
|
||||
; dw = right margin
|
||||
; dw = left margin
|
||||
; dw = bottom margin
|
||||
; dw = top margin
|
||||
; dd = inner line color
|
||||
; dd = outer line color
|
||||
; dd = frame color
|
||||
; dd = dtp file size
|
||||
; ?? = dtp file itself
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; buttons:
|
||||
; dd = button type (1 = close, 2 = minimize)
|
||||
; dw = left button coord (could be negative)
|
||||
; dw = top button coord (could be negative)
|
||||
; dw = button width
|
||||
; dw = button height
|
||||
; ... etc for all buttons
|
||||
; dd = 0 (end of buttons list)
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; bitmaps:
|
||||
; dw = bitmap kind (1 = left, 2 = oper, 3 = base)
|
||||
; dw = bitmap type (1 = active, 0 = inactive)
|
||||
; dd @ bitmap
|
||||
; ... etc for all bitmaps
|
||||
; dd 0 (end of bitmaps list)
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; bitmap:
|
||||
; dd = bitmap width
|
||||
; dd = bitmap height
|
||||
; ?? = raw bitmap data
|
||||
; ... etc for all bitmaps
|
||||
; ...
|
||||
;============================================================================
|
||||
|
||||
dd 'SKIN',1,__params__,__buttons__,__bitmaps__
|
||||
|
||||
struc BITMAPFILEHEADER {
|
||||
.bfType dw ? ; WORD
|
||||
.bfSize dd ? ; DWORD
|
||||
.bfReserved1 dw ? ; WORD
|
||||
.bfReserved2 dw ? ; WORD
|
||||
.bfOffBits dd ? ; DWORD
|
||||
}
|
||||
|
||||
struc BITMAPINFOHEADER {
|
||||
.biSize dd ? ; DWORD
|
||||
.biWidth dd ? ; LONG
|
||||
.biHeight dd ? ; LONG
|
||||
.biPlanes dw ? ; WORD
|
||||
.biBitCount dw ? ; WORD
|
||||
.biCompression dd ? ; DWORD
|
||||
.biSizeImage dd ? ; DWORD
|
||||
.biXPelsPerMeter dd ? ; LONG
|
||||
.biYPelsPerMeter dd ? ; LONG
|
||||
.biClrUsed dd ? ; DWORD
|
||||
.biClrImportant dd ? ; DWORD
|
||||
}
|
||||
|
||||
struc _bmp {
|
||||
.h BITMAPFILEHEADER
|
||||
.i BITMAPINFOHEADER
|
||||
}
|
||||
virtual at 0
|
||||
_bmp _bmp
|
||||
end virtual
|
||||
|
||||
macro BITMAP _name*,_fname*
|
||||
{
|
||||
local w,h,a,r,g,b
|
||||
virtual at 0
|
||||
file _fname
|
||||
load w dword from _bmp.i.biWidth
|
||||
load h dword from _bmp.i.biHeight
|
||||
end virtual
|
||||
align 4
|
||||
label _name
|
||||
.width = w
|
||||
.height = h
|
||||
dd w,h
|
||||
a=54+(w*3+(w mod 4))*(h-1)
|
||||
size = $
|
||||
repeat h
|
||||
repeat w
|
||||
virtual at 0
|
||||
file _fname
|
||||
load r from a+0
|
||||
load g from a+1
|
||||
load b from a+2
|
||||
end virtual
|
||||
db r,g,b
|
||||
a=a+3
|
||||
end repeat
|
||||
a=a-w*3*2-(w mod 4)
|
||||
end repeat
|
||||
}
|
||||
|
||||
macro define_colors name,[col,val]
|
||||
{
|
||||
common
|
||||
local a,b,c
|
||||
forward
|
||||
match =binner,col \{ a = val \}
|
||||
match =bouter,col \{ b = val \}
|
||||
match =bframe,col \{ c = val \}
|
||||
common
|
||||
name equ a,b,c
|
||||
}
|
||||
|
||||
macro SKIN_PARAMS [a]
|
||||
{
|
||||
common
|
||||
local _height,_margins,_colors,_colors_1,_dtp,_dtp_sz
|
||||
__params__:
|
||||
forward
|
||||
match qq == ww,a
|
||||
\{
|
||||
match =height,qq \\{ _height = ww \\}
|
||||
match =margins,qq \\{
|
||||
match [q1:q2:q3:q4],ww
|
||||
\\\{
|
||||
_margins equ q3,q1,q4,q2
|
||||
\\\}
|
||||
\\}
|
||||
match =colors =active,qq
|
||||
\\{
|
||||
match [q10==q11:q20==q21:q30==q31],ww
|
||||
\\\{
|
||||
define_colors _colors,q10,q11,q20,q21,q30,q31
|
||||
\\\}
|
||||
\\}
|
||||
match =colors =inactive,qq
|
||||
\\{
|
||||
match [q10==q11:q20==q21:q30==q31],ww
|
||||
\\\{
|
||||
define_colors _colors_1,q10,q11,q20,q21,q30,q31
|
||||
\\\}
|
||||
\\}
|
||||
match =dtp,qq \\{ _dtp equ ww \\}
|
||||
\}
|
||||
common
|
||||
dd _height
|
||||
dw _margins
|
||||
dd _colors,_colors_1
|
||||
virtual at 0
|
||||
file _dtp
|
||||
_dtp_sz = $
|
||||
end virtual
|
||||
dd _dtp_sz
|
||||
file _dtp
|
||||
}
|
||||
|
||||
macro SKIN_BUTTONS [a]
|
||||
{
|
||||
common
|
||||
local btn
|
||||
__buttons__:
|
||||
forward
|
||||
match qq == ww,a
|
||||
\{
|
||||
btn = 0
|
||||
match =close,qq \\{ btn = 1 \\}
|
||||
match =minimize,qq \\{ btn = 2 \\}
|
||||
match [q1:q2][q3:q4],ww
|
||||
\\{
|
||||
if btn <> 0
|
||||
dd btn
|
||||
dw q1,q2,q3,q4
|
||||
end if
|
||||
\\}
|
||||
\}
|
||||
common
|
||||
dd 0
|
||||
}
|
||||
|
||||
macro SKIN_BITMAPS [a]
|
||||
{
|
||||
common
|
||||
local bmp
|
||||
__bitmaps__:
|
||||
forward
|
||||
match qq == ww,a
|
||||
\{
|
||||
bmp=-1
|
||||
match qqq =active,qq \\{ bmp = 1 \\}
|
||||
match qqq =inactive,qq \\{ bmp = 0 \\}
|
||||
match =left qqq,qq
|
||||
\\{
|
||||
if bmp >= 0
|
||||
dw 1,bmp
|
||||
dd ww
|
||||
end if
|
||||
\\}
|
||||
match =oper qqq,qq
|
||||
\\{
|
||||
if bmp >= 0
|
||||
dw 2,bmp
|
||||
dd ww
|
||||
end if
|
||||
\\}
|
||||
match =base qqq,qq
|
||||
\\{
|
||||
if bmp >= 0
|
||||
dw 3,bmp
|
||||
dd ww
|
||||
end if
|
||||
\\}
|
||||
\}
|
||||
common
|
||||
dd 0
|
||||
}
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue
Block a user