Subversion Repositories Kolibri OS

Rev

Rev 373 | Rev 426 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. $Revision: 425 $
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;;                                                            ;;
  4. ;; KERNEL32.INC                                               ;;
  5. ;;                                                            ;;
  6. ;; Included 32 bit kernel files for MenuetOS                  ;;
  7. ;;                                                            ;;
  8. ;; This file is kept separate as it will be easier to         ;;
  9. ;; maintain and compile with an automated SETUP program       ;;
  10. ;; in the future.                                             ;;
  11. ;;                                                            ;;
  12. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.  
  14. ; structure definition helper
  15. macro struct name, [arg]
  16.  {
  17.   common
  18.    name@struct equ name
  19.    struc name arg {
  20.  }
  21.  
  22. macro struct_helper name
  23.  {
  24.   match xname,name
  25.   \{
  26.    virtual at 0
  27.    xname xname
  28.    sizeof.#xname = $ - xname
  29.    name equ sizeof.#xname
  30.    end virtual
  31.   \}
  32.  }
  33.  
  34. ends fix } struct_helper name@struct
  35.  
  36. ;// mike.dld, 2006-29-01 [
  37.  
  38. ; macros definition
  39. macro diff16 title,l1,l2
  40. {
  41.   local s,d
  42.   s = l2-l1
  43.   display title,': 0x'
  44.   repeat 8
  45.     d = 48 + s shr ((8-%) shl 2) and $0F
  46.     if d > 57
  47.       d = d + 65-57-1
  48.     end if
  49.     display d
  50.   end repeat
  51.   display 13,10
  52. }
  53. macro diff10 title,l1,l2
  54.  {
  55.   local s,d,z,m
  56.   s = l2-l1
  57.   z = 0
  58.   m = 1000000000
  59.   display title,': '
  60.   repeat 10
  61.    d = '0' + s / m
  62.    s = s - (s/m)*m
  63.    m = m / 10
  64.    if d <> '0'
  65.     z = 1
  66.    end if
  67.    if z <> 0
  68.     display d
  69.    end if
  70.   end repeat
  71.   display 13,10
  72.  }
  73.  
  74. ; \begin{diamond}[29.09.2006]
  75. ; may be useful for kernel debugging
  76. ; example 1:
  77. ;       dbgstr 'Hello, World!'
  78. ; example 2:
  79. ;       dbgstr 'Hello, World!', save_flags
  80. macro dbgstr string*, f
  81. {
  82. local a
  83. iglobal_nested
  84. a db 'K : ',string,13,10,0
  85. endg_nested
  86. if ~ f eq
  87.         pushfd
  88. end if
  89.         push    esi
  90.         mov     esi, a
  91.         call    sys_msg_board_str
  92.         pop     esi
  93. if ~ f eq
  94.         popfd
  95. end if
  96. }
  97. ; \end{diamond}[29.09.2006]
  98.  
  99. ;struc db [a] { common . db a
  100. ;  if ~used .
  101. ;    display 'not used db: ',`.,13,10
  102. ;  end if }
  103. ;struc dw [a] { common . dw a
  104. ;  if ~used .
  105. ;    display 'not used dw: ',`.,13,10
  106. ;  end if }
  107. ;struc dd [a] { common . dd a
  108. ;  if ~used .
  109. ;    display 'not used dd: ',`.,13,10
  110. ;  end if }
  111. ;struc dp [a] { common . dp a
  112. ;  if ~used .
  113. ;    display 'not used dp: ',`.,13,10
  114. ;  end if }
  115. ;struc dq [a] { common . dq a
  116. ;  if ~used .
  117. ;    display 'not used dq: ',`.,13,10
  118. ;  end if }
  119. ;struc dt [a] { common . dt a
  120. ;  if ~used .
  121. ;    display 'not used dt: ',`.,13,10
  122. ;  end if }
  123.  
  124. struc RECT {
  125.   .left   dd ?
  126.   .top    dd ?
  127.   .right  dd ?
  128.   .bottom dd ?
  129. }
  130. virtual at 0
  131.  RECT RECT
  132. end virtual
  133.  
  134. struc BOX {
  135.   .left   dd ?
  136.   .top    dd ?
  137.   .width  dd ?
  138.   .height dd ?
  139. }
  140. virtual at 0
  141.  BOX BOX
  142. end virtual
  143.  
  144. ; constants definition
  145. WSTATE_NORMAL    = 00000000b
  146. WSTATE_MAXIMIZED = 00000001b
  147. WSTATE_MINIMIZED = 00000010b
  148. WSTATE_ROLLEDUP  = 00000100b
  149.  
  150. WSTATE_REDRAW    = 00000001b
  151. WSTATE_WNDDRAWN  = 00000010b
  152.  
  153. WSTYLE_HASCAPTION     = 00010000b
  154. WSTYLE_CLIENTRELATIVE = 00100000b
  155.  
  156. struc TASKDATA
  157. {
  158.   .event_mask  dd ?
  159.   .pid         dd ?
  160.                dw ?
  161.   .state       db ?
  162.                db ?
  163.                dw ?
  164.   .wnd_number  db ?
  165.                db ?
  166.   .mem_start   dd ?
  167.   .counter_sum dd ?
  168.   .counter_add dd ?
  169.   .cpu_usage   dd ?
  170. }
  171. virtual at 0
  172.  TASKDATA TASKDATA
  173. end virtual
  174.  
  175. ; structures definition
  176. struc WDATA {
  177.   .box             BOX
  178.   .cl_workarea     dd ?
  179.   .cl_titlebar     dd ?
  180.   .cl_frames       dd ?
  181.   .reserved        db ?
  182.   .fl_wstate       db ?
  183.   .fl_wdrawn       db ?
  184.   .fl_redraw       db ?
  185. }
  186. virtual at 0
  187.  WDATA WDATA
  188. end virtual
  189. label WDATA.fl_wstyle byte at 0x13
  190.  
  191. struc APPDATA
  192. {
  193.   .app_name        db 11  dup(?)
  194.                    db 5   dup(?)
  195.  
  196.   .fpu_state       dd ?            ;+16
  197.   .ev_count        dd ?            ;+20
  198.   .fpu_handler     dd ?            ;+24
  199.   .sse_handler     dd ?            ;+28
  200.   .pl0_stack       dd ? ;unused    ;+32
  201.   .heap_base       dd ?            ;+36
  202.   .heap_top        dd ?            ;+40
  203.   .cursor          dd ?            ;+44
  204.   .fd_ev           dd ?            ;+48
  205.   .bk_ev           dd ?            ;+52
  206.   .fd_obj          dd ?            ;+56
  207.   .bk_obj          dd ?            ;+60
  208.  
  209.                    db 64 dup(?)    ;+64
  210.  
  211.   .wnd_shape       dd ?            ;+128
  212.   .wnd_shape_scale dd ?            ;+132
  213.                    dd ?            ;+136
  214.   .mem_size        dd ?            ;+140
  215.   .saved_box       BOX
  216.   .ipc_start       dd ?
  217.   .ipc_size        dd ?
  218.   .event_mask      dd ?
  219.   .debugger_slot   dd ?
  220.                    dd ?
  221.   .keyboard_mode   db ?
  222.                    db 3   dup(?)
  223.   .dir_table       dd ?
  224.   .dbg_event_mem   dd ?
  225.   .dbg_regs:
  226.   .dbg_regs.dr0    dd ?
  227.   .dbg_regs.dr1    dd ?
  228.   .dbg_regs.dr2    dd ?
  229.   .dbg_regs.dr3    dd ?
  230.   .dbg_regs.dr7    dd ?
  231.   .wnd_caption     dd ?
  232.   .wnd_clientbox   BOX
  233. }
  234. virtual at 0
  235.  APPDATA APPDATA
  236. end virtual
  237.  
  238. ;// mike.dld, 2006-29-01 ]
  239.  
  240.  
  241. ; Core functions
  242. include "core/sync.inc"     ; macros for synhronization objects
  243. include "core/sys32.inc"    ; process management
  244. include "core/sched.inc"    ; process scheduling
  245. include "core/syscall.inc"  ; system call
  246. include "core/fpu.inc"      ; all fpu/sse support
  247. include "core/memory.inc"
  248. include "core/heap.inc"     ; kernel and app heap
  249. include "core/malloc.inc"   ; small kernel heap
  250. include "core/taskman.inc"
  251. include "core/dll.inc"
  252. include "core/exports.inc"
  253.  
  254. ; GUI stuff
  255. include "gui/window.inc"
  256. include "gui/event.inc"
  257. include "gui/font.inc"
  258. include "gui/button.inc"
  259.  
  260. ; shutdown
  261.  
  262. include "boot/shutdown.inc" ; shutdown or restart
  263.  
  264. ; file system
  265.  
  266. include "fs/fs.inc"       ; syscall
  267. include "fs/fat32.inc"    ; read / write for fat32 filesystem
  268. include "fs/ntfs.inc"     ; read / write for ntfs filesystem
  269. include "fs/fat12.inc"    ; read / write for fat12 filesystem
  270. include "blkdev/rd.inc"   ; ramdisk read /write
  271. include "fs/fs_lfn.inc"    ; syscall, version 2
  272. include "fs/iso9660.inc"  ; read for iso9660 filesystem CD
  273.  
  274. ; sound
  275.  
  276. include "sound/sb16.inc"     ; playback for Sound Blaster 16
  277. include "sound/playnote.inc" ; player Note for Speaker PC
  278.  
  279. ; display
  280.  
  281. include "video/vesa12.inc"   ; Vesa 1.2 functions
  282. include "video/vesa20.inc"   ; Vesa 2.0 functions
  283. include "video/vga.inc"      ; VGA 16 color functions
  284. include "video/cursors.inc"  ; cursors functions
  285.  
  286. ; Network Interface & TCPIP Stack
  287.  
  288. include "network/stack.inc"
  289.  
  290. ; Mouse pointer
  291.  
  292. include "gui/mouse.inc"
  293.  
  294. ; Window skinning
  295.  
  296. include "gui/skincode.inc"
  297.  
  298. ; Pci functions
  299.  
  300. include "bus/pci/pci32.inc"
  301.  
  302. ; Floppy drive controller
  303.  
  304. include "blkdev/fdc.inc"
  305. include "blkdev/flp_drv.inc"
  306.  
  307. ; HD drive controller
  308. include "blkdev/hd_drv.inc"
  309.  
  310. ; CD drive controller
  311.  
  312. include "blkdev/cdrom.inc"
  313. include "blkdev/cd_drv.inc"
  314.  
  315. ; Character devices
  316.  
  317. include "hid/keyboard.inc"
  318. include "hid/mousedrv.inc"
  319.  
  320. ; setting date,time,clock and alarm-clock
  321.  
  322. include "hid/set_dtc.inc"
  323.  
  324. ;% -include
  325.