2005-10-06 21:56:22 +04:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; KERNEL32.INC ;;
|
|
|
|
;; ;;
|
|
|
|
;; Included 32 bit kernel files for MenuetOS ;;
|
|
|
|
;; ;;
|
|
|
|
;; This file is kept separate as it will be easier to ;;
|
|
|
|
;; maintain and compile with an automated SETUP program ;;
|
|
|
|
;; in the future. ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
; structure definition helper
|
|
|
|
macro struct name, [arg]
|
|
|
|
{
|
|
|
|
common
|
2006-02-03 15:33:36 +03:00
|
|
|
name@struct equ name
|
2005-10-06 21:56:22 +04:00
|
|
|
struc name arg {
|
|
|
|
}
|
|
|
|
|
|
|
|
macro struct_helper name
|
|
|
|
{
|
2006-02-03 15:33:36 +03:00
|
|
|
match xname,name
|
|
|
|
\{
|
2005-10-06 21:56:22 +04:00
|
|
|
virtual at 0
|
2006-02-03 15:33:36 +03:00
|
|
|
xname xname
|
|
|
|
sizeof.#xname = $ - xname
|
|
|
|
name equ sizeof.#xname
|
2005-10-06 21:56:22 +04:00
|
|
|
end virtual
|
2006-02-03 15:33:36 +03:00
|
|
|
\}
|
2005-10-06 21:56:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ends fix } struct_helper name@struct
|
|
|
|
|
2006-02-01 09:07:36 +03:00
|
|
|
;// mike.dld, 2006-29-01 [
|
|
|
|
|
|
|
|
; macros definition
|
|
|
|
macro diff16 title,l1,l2
|
|
|
|
{
|
|
|
|
local s,d
|
|
|
|
s = l2-l1
|
|
|
|
display title,': 0x'
|
|
|
|
repeat 8
|
|
|
|
d = 48 + s shr ((8-%) shl 2) and $0F
|
|
|
|
if d > 57
|
|
|
|
d = d + 65-57-1
|
|
|
|
end if
|
|
|
|
display d
|
|
|
|
end repeat
|
|
|
|
display 13,10
|
|
|
|
}
|
|
|
|
|
2006-10-04 18:35:44 +04:00
|
|
|
; \begin{diamond}[29.09.2006]
|
|
|
|
; may be useful for kernel debugging
|
|
|
|
; example 1:
|
|
|
|
; dbgstr 'Hello, World!'
|
|
|
|
; example 2:
|
|
|
|
; dbgstr 'Hello, World!', save_flags
|
|
|
|
macro dbgstr string*, f
|
|
|
|
{
|
|
|
|
local a
|
|
|
|
iglobal_nested
|
|
|
|
a db 'K : ',string,13,10,0
|
|
|
|
endg_nested
|
|
|
|
if ~ f eq
|
|
|
|
pushfd
|
|
|
|
end if
|
|
|
|
push esi
|
|
|
|
mov esi, a
|
|
|
|
call sys_msg_board_str
|
|
|
|
pop esi
|
|
|
|
if ~ f eq
|
|
|
|
popfd
|
|
|
|
end if
|
|
|
|
}
|
|
|
|
; \end{diamond}[29.09.2006]
|
|
|
|
|
2006-02-01 09:07:36 +03:00
|
|
|
struc db [a] { common . db a
|
|
|
|
if ~used .
|
|
|
|
display 'not used db: ',`.,13,10
|
|
|
|
end if }
|
|
|
|
struc dw [a] { common . dw a
|
|
|
|
if ~used .
|
|
|
|
display 'not used dw: ',`.,13,10
|
|
|
|
end if }
|
|
|
|
struc dd [a] { common . dd a
|
|
|
|
if ~used .
|
|
|
|
display 'not used dd: ',`.,13,10
|
|
|
|
end if }
|
|
|
|
struc dp [a] { common . dp a
|
|
|
|
if ~used .
|
|
|
|
display 'not used dp: ',`.,13,10
|
|
|
|
end if }
|
|
|
|
struc dq [a] { common . dq a
|
|
|
|
if ~used .
|
|
|
|
display 'not used dq: ',`.,13,10
|
|
|
|
end if }
|
|
|
|
struc dt [a] { common . dt a
|
|
|
|
if ~used .
|
|
|
|
display 'not used dt: ',`.,13,10
|
|
|
|
end if }
|
|
|
|
|
|
|
|
struc RECT {
|
|
|
|
.left dd ?
|
|
|
|
.top dd ?
|
|
|
|
.right dd ?
|
|
|
|
.bottom dd ?
|
|
|
|
}
|
|
|
|
virtual at 0
|
|
|
|
RECT RECT
|
|
|
|
end virtual
|
|
|
|
|
|
|
|
struc BOX {
|
|
|
|
.left dd ?
|
|
|
|
.top dd ?
|
|
|
|
.width dd ?
|
|
|
|
.height dd ?
|
|
|
|
}
|
|
|
|
virtual at 0
|
|
|
|
BOX BOX
|
|
|
|
end virtual
|
|
|
|
|
2006-08-03 23:30:32 +04:00
|
|
|
; constants definition
|
2006-10-06 10:09:41 +04:00
|
|
|
WSTATE_NORMAL = 00000000b
|
2006-08-03 23:30:32 +04:00
|
|
|
WSTATE_MAXIMIZED = 00000001b
|
|
|
|
WSTATE_MINIMIZED = 00000010b
|
|
|
|
WSTATE_ROLLEDUP = 00000100b
|
|
|
|
|
|
|
|
WSTATE_REDRAW = 00000001b
|
|
|
|
WSTATE_WNDDRAWN = 00000010b
|
|
|
|
|
|
|
|
WSTYLE_HASCAPTION = 00010000b
|
|
|
|
WSTYLE_CLIENTRELATIVE = 00100000b
|
|
|
|
|
2006-08-06 14:29:45 +04:00
|
|
|
struc TASKDATA
|
2006-08-03 23:30:32 +04:00
|
|
|
{
|
|
|
|
.event_mask dd ?
|
|
|
|
.pid dd ?
|
|
|
|
dw ?
|
2006-08-06 14:29:45 +04:00
|
|
|
.state db ?
|
|
|
|
db ?
|
2006-08-03 23:30:32 +04:00
|
|
|
dw ?
|
|
|
|
.wnd_number db ?
|
|
|
|
db ?
|
|
|
|
.mem_start dd ?
|
|
|
|
.counter_sum dd ?
|
|
|
|
.counter_add dd ?
|
|
|
|
.cpu_usage dd ?
|
|
|
|
}
|
|
|
|
virtual at 0
|
2006-08-06 14:29:45 +04:00
|
|
|
TASKDATA TASKDATA
|
2006-08-03 23:30:32 +04:00
|
|
|
end virtual
|
|
|
|
|
|
|
|
; structures definition
|
|
|
|
struc WDATA {
|
|
|
|
.box BOX
|
|
|
|
.cl_workarea dd ?
|
|
|
|
.cl_titlebar dd ?
|
|
|
|
.cl_frames dd ?
|
|
|
|
.reserved db ?
|
|
|
|
.fl_wstate db ?
|
|
|
|
.fl_wdrawn db ?
|
|
|
|
.fl_redraw db ?
|
|
|
|
}
|
|
|
|
virtual at 0
|
|
|
|
WDATA WDATA
|
|
|
|
end virtual
|
|
|
|
label WDATA.fl_wstyle byte at 0x13
|
|
|
|
|
|
|
|
struc APPDATA
|
|
|
|
{
|
|
|
|
.app_name db 11 dup(?)
|
|
|
|
db 5 dup(?)
|
2006-10-06 10:09:41 +04:00
|
|
|
|
|
|
|
.fpu_state dd ? ;+16
|
2006-12-02 11:18:48 +03:00
|
|
|
.ev_count dd ? ;+20
|
2006-10-06 10:09:41 +04:00
|
|
|
.fpu_handler dd ? ;+24
|
|
|
|
.sse_handler dd ? ;+28
|
|
|
|
.event dd ? ;+32
|
2006-10-10 09:11:30 +04:00
|
|
|
.heap_base dd ? ;+36
|
|
|
|
.heap_top dd ? ;+40
|
2006-11-27 13:07:51 +03:00
|
|
|
.cursor dd ? ;+44
|
2006-12-02 11:18:48 +03:00
|
|
|
.ev_first dd ? ;+48
|
|
|
|
.ev_last dd ? ;+52
|
2006-10-06 10:09:41 +04:00
|
|
|
|
2006-12-02 11:18:48 +03:00
|
|
|
db 72 dup(?) ;+56
|
2006-10-06 10:09:41 +04:00
|
|
|
|
|
|
|
.wnd_shape dd ? ;+128
|
2006-12-02 11:18:48 +03:00
|
|
|
.wnd_shape_scale dd ? ;+132
|
|
|
|
dd ? ;+136
|
|
|
|
.mem_size dd ? ;+140
|
2006-08-03 23:30:32 +04:00
|
|
|
.saved_box BOX
|
|
|
|
.ipc_start dd ?
|
|
|
|
.ipc_size dd ?
|
|
|
|
.event_mask dd ?
|
|
|
|
.debugger_slot dd ?
|
2006-08-06 14:29:45 +04:00
|
|
|
dd ?
|
2006-08-03 23:30:32 +04:00
|
|
|
.keyboard_mode db ?
|
|
|
|
db 3 dup(?)
|
|
|
|
.dir_table dd ?
|
|
|
|
.dbg_event_mem dd ?
|
|
|
|
.dbg_regs:
|
|
|
|
.dbg_regs.dr0 dd ?
|
|
|
|
.dbg_regs.dr1 dd ?
|
|
|
|
.dbg_regs.dr2 dd ?
|
|
|
|
.dbg_regs.dr3 dd ?
|
|
|
|
.dbg_regs.dr7 dd ?
|
|
|
|
.wnd_caption dd ?
|
|
|
|
.wnd_clientbox BOX
|
|
|
|
}
|
|
|
|
virtual at 0
|
|
|
|
APPDATA APPDATA
|
|
|
|
end virtual
|
|
|
|
|
2006-02-01 09:07:36 +03:00
|
|
|
;// mike.dld, 2006-29-01 ]
|
|
|
|
|
2005-10-06 21:56:22 +04:00
|
|
|
|
|
|
|
; Core functions
|
2006-08-03 23:30:32 +04:00
|
|
|
include "core/sync.inc" ; macros for synhronization objects
|
2005-10-06 21:56:22 +04:00
|
|
|
include "core/sys32.inc" ; process management
|
|
|
|
include "core/sched.inc" ; process scheduling
|
|
|
|
include "core/syscall.inc" ; system call
|
2006-11-20 10:06:00 +03:00
|
|
|
include "core/fpu.inc" ; all fpu/sse support
|
2006-10-06 10:09:41 +04:00
|
|
|
include "core/memory.inc"
|
2006-11-20 10:06:00 +03:00
|
|
|
include "core/heap.inc" ; kernel and app heap
|
2006-10-06 10:09:41 +04:00
|
|
|
include "core/taskman.inc"
|
|
|
|
include "core/dll.inc"
|
|
|
|
include "core/exports.inc"
|
2005-10-06 21:56:22 +04:00
|
|
|
|
|
|
|
; GUI stuff
|
|
|
|
include "gui/window.inc"
|
|
|
|
include "gui/event.inc"
|
|
|
|
include "gui/font.inc"
|
|
|
|
include "gui/button.inc"
|
|
|
|
|
|
|
|
; shutdown
|
|
|
|
|
|
|
|
include "boot/shutdown.inc" ; shutdown or restart
|
|
|
|
|
|
|
|
; file system
|
|
|
|
|
|
|
|
include "fs/fs.inc" ; syscall
|
|
|
|
include "fs/fat32.inc" ; read / write for fat32 filesystem
|
2006-12-29 18:42:36 +03:00
|
|
|
include "fs/ntfs.inc" ; read / write for ntfs filesystem
|
2005-10-06 21:56:22 +04:00
|
|
|
include "fs/fat12.inc" ; read / write for fat12 filesystem
|
2006-04-22 17:54:35 +04:00
|
|
|
include "blkdev/rd.inc" ; ramdisk read /write
|
2006-04-27 10:14:25 +04:00
|
|
|
include "fs/fs_lfn.inc" ; syscall, version 2
|
2006-06-18 20:42:03 +04:00
|
|
|
include "fs/iso9660.inc" ; read for iso9660 filesystem CD
|
2005-10-06 21:56:22 +04:00
|
|
|
|
|
|
|
; sound
|
|
|
|
|
|
|
|
include "sound/sb16.inc" ; playback for Sound Blaster 16
|
|
|
|
include "sound/playnote.inc" ; player Note for Speaker PC
|
|
|
|
|
|
|
|
; display
|
|
|
|
|
|
|
|
include "video/vesa12.inc" ; Vesa 1.2 functions
|
|
|
|
include "video/vesa20.inc" ; Vesa 2.0 functions
|
|
|
|
include "video/vga.inc" ; VGA 16 color functions
|
2006-11-27 13:07:51 +03:00
|
|
|
include "video/cursors.inc" ; cursors functions
|
2005-10-06 21:56:22 +04:00
|
|
|
|
|
|
|
; Network Interface & TCPIP Stack
|
|
|
|
|
|
|
|
include "network/stack.inc"
|
|
|
|
|
|
|
|
; Mouse pointer
|
|
|
|
|
|
|
|
include "gui/mouse.inc"
|
|
|
|
|
|
|
|
; Window skinning
|
|
|
|
|
|
|
|
include "gui/skincode.inc"
|
|
|
|
|
|
|
|
; Pci functions
|
|
|
|
|
|
|
|
include "bus/pci/pci32.inc"
|
|
|
|
|
|
|
|
; Floppy drive controller
|
|
|
|
|
|
|
|
include "blkdev/fdc.inc"
|
|
|
|
include "blkdev/flp_drv.inc"
|
|
|
|
|
2006-09-27 18:58:51 +04:00
|
|
|
; HD drive controller
|
|
|
|
include "blkdev/hd_drv.inc"
|
|
|
|
|
2005-10-06 21:56:22 +04:00
|
|
|
; CD drive controller
|
|
|
|
|
|
|
|
include "blkdev/cdrom.inc"
|
2006-06-18 20:42:03 +04:00
|
|
|
include "blkdev/cd_drv.inc"
|
2005-10-06 21:56:22 +04:00
|
|
|
|
|
|
|
; Character devices
|
|
|
|
|
|
|
|
include "hid/keyboard.inc"
|
2006-01-06 14:46:26 +03:00
|
|
|
include "hid/mousedrv.inc"
|
2005-10-06 21:56:22 +04:00
|
|
|
|
|
|
|
; setting date,time,clock and alarm-clock
|
|
|
|
|
|
|
|
include "hid/set_dtc.inc"
|
|
|
|
|
|
|
|
;% -include
|