Subversion Repositories Kolibri OS

Rev

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

  1. {cp866}
  2.  
  3. { User interface }
  4. procedure kos_definewindow(x, y, w, h: Word; style, header, clframe: DWord); assembler; register;
  5. asm
  6.   pushl %ebx
  7.   pushl %ecx
  8.   pushl %edx
  9.   pushl %esi
  10.   pushl %edi
  11.   movl  %eax, %ebx
  12.   xchgl %edx, %ecx
  13.   movl  header, %esi
  14.   shll  $16, %ebx
  15.   shll  $16, %ecx
  16.   movl  clframe, %edi
  17.   movw  %dx, %bx
  18.   movw  h, %cx
  19.   xorl  %eax, %eax
  20.   movl  style, %edx
  21.   decl  %ebx  {㬥­ìè¨âì è¨à¨­ã ­  1}
  22.   decl  %ecx  {㬥­ìè¨âì ¢ëá®âã ­  1}
  23.   andl  $0xEFFFFFFF, %edx
  24.   int   $0x40
  25.   popl %edi
  26.   popl %esi
  27.   popl %edx
  28.   popl %ecx
  29.   popl %ebx
  30. end;
  31.  
  32. procedure kos_movewindow(x, y, w, h: DWord); assembler; register;
  33. asm
  34.   pushl %eax
  35.   pushl %ebx
  36.   pushl %ecx
  37.   pushl %edx
  38.   pushl %esi
  39.   movl  %eax, %ebx
  40.   xchgl %ecx, %edx
  41.   movl  $67, %eax
  42.   movl  h, %esi
  43.   decl  %edx  {㬥­ìè¨âì è¨à¨­ã ­  1}
  44.   decl  %esi  {㬥­ìè¨âì ¢ëá®âã ­  1}
  45.   int   $0x40
  46.   popl  %esi
  47.   popl  %edx
  48.   popl  %ecx
  49.   popl  %ebx
  50.   popl  %eax
  51. end;
  52.  
  53. function kos_getkey(): DWord; assembler; register;
  54. asm
  55.   movl $2, %eax
  56.   int  $0x40
  57. end;
  58.  
  59. function kos_getevent(wait: Boolean = True): DWord; assembler; register;
  60. asm
  61.   andl $1, %eax
  62.   xorb $1, %al
  63.   addl $10, %eax
  64.   int  $0x40
  65. end;
  66.  
  67. function kos_waitevent(timeout: DWord): DWord; assembler; register;
  68. asm
  69.   pushl %ebx
  70.   movl  $23, %ebx
  71.   xchgl %eax, %ebx
  72.   int  $0x40
  73.   popl  %ebx
  74. end;
  75.  
  76. function kos_getbutton(): DWord; assembler; register;
  77. asm
  78.   movl  $17, %eax
  79.   int   $0x40
  80.   shrl  $8, %eax
  81.   andl  $0xFF, %eax
  82. end;
  83.  
  84. function kos_getmousepos(): TKosPoint; assembler; register;
  85. {@return: x*65536 + y}
  86. asm
  87.   pushl %eax
  88.   pushl %ebx
  89.   pushl %ecx
  90.   pushl %eax
  91.   movl  $37, %eax
  92.   xorl  %ebx, %ebx
  93.   int   $0x40
  94.   movswl %ax, %ecx
  95.   popl  %ebx
  96.   shrl  $16, %eax
  97.   movl  %ecx, TKosPoint.Y(%ebx)
  98.   movl  %eax, TKosPoint.X(%ebx)
  99.   popl  %ecx
  100.   popl  %ebx
  101.   popl  %eax
  102. end;
  103.  
  104. function kos_getmousewinpos(): TKosPoint; assembler; register;
  105. {@return: x*65536 + y}
  106. asm
  107.   pushl %eax
  108.   pushl %ebx
  109.   pushl %ecx
  110.   pushl %eax
  111.   movl  $37, %eax
  112.   movl  $1, %ebx
  113.   int   $0x40
  114.   movswl %ax, %ecx
  115.   popl  %ebx
  116.   shrl  $16, %eax
  117.   movl  %ecx, TKosPoint.Y(%ebx)
  118.   movl  %eax, TKosPoint.X(%ebx)
  119.   popl  %ecx
  120.   popl  %ebx
  121.   popl  %eax
  122. end;
  123.  
  124. function kos_getmousebuttons(): DWord; assembler; register;
  125. {@return:
  126.   ¡¨â 0 ãáâ ­®¢«¥­ = «¥¢ ï ª­®¯ª  ­ ¦ â 
  127.   ¡¨â 1 ãáâ ­®¢«¥­ = ¯à ¢ ï ª­®¯ª  ­ ¦ â 
  128.   ¡¨â 2 ãáâ ­®¢«¥­ = á।­ïï ª­®¯ª  ­ ¦ â 
  129.   ¡¨â 3 ãáâ ­®¢«¥­ = 4-ï ª­®¯ª  ­ ¦ â 
  130.   ¡¨â 4 ãáâ ­®¢«¥­ = 5-ï ª­®¯ª  ­ ¦ â }
  131. asm
  132.   pushl %ebx
  133.   movl  $37, %eax
  134.   movl  $2, %ebx
  135.   int   $0x40
  136.   popl  %ebx
  137. end;
  138.  
  139. procedure kos_maskevents(mask: DWord); assembler; register;
  140. asm
  141.   pushl %ebx
  142.   xchgl %eax, %ebx
  143.   movl  $40, %eax
  144.   int   $0x40
  145.   xchgl %eax, %ebx
  146.   popl  %ebx
  147. end;
  148.  
  149. procedure kos_setcaption(caption: PChar); assembler; register;
  150. asm
  151.   pushl %ecx
  152.   pushl %ebx
  153.   xchgl %eax, %ecx
  154.   movl $1, %ebx
  155.   movl $71, %eax
  156.   int  $0x40
  157.   xchgl %eax, %ecx
  158.   popl %ebx
  159.   popl %ecx
  160. end;
  161.  
  162.  
  163. { Graphics }
  164.  
  165. function kos_screensize(): TKosPoint; assembler; register;
  166. asm
  167.   pushl %eax
  168.   pushl %ecx
  169.   pushl %eax
  170.   movl  $14, %eax
  171.   int   $0x40
  172.   movswl %ax, %ecx
  173.   popl  %ebx
  174.   shrl  $16, %eax
  175.   movl  %ecx, TKosPoint.Y(%ebx)
  176.   movl  %eax, TKosPoint.X(%ebx)
  177.   popl  %ecx
  178.   popl  %eax
  179. end;
  180.  
  181. procedure kos_begindraw(); assembler; register;
  182. asm
  183.   pushl %ebx
  184.   movl  $12, %eax
  185.   movl  $1, %ebx
  186.   int   $0x40
  187.   popl  %ebx
  188. end;
  189.  
  190. procedure kos_enddraw(); assembler; register;
  191. asm
  192.   pushl %ebx
  193.   movl  $12, %eax
  194.   movl  $2, %ebx
  195.   int   $0x40
  196.   popl  %ebx
  197. end;
  198.  
  199. procedure kos_putpixel(x, y: Word; color: DWord); assembler; register;
  200. asm
  201.   pushl %ebx
  202.   movl  %eax, %ebx
  203.   xchgl %edx, %ecx
  204.   movl  $1, %eax
  205.   int   $0x40
  206.   xchgl %edx, %ecx
  207.   popl  %ebx
  208. end;
  209.  
  210. procedure kos_drawtext(x, y: Word; text: String; flags, bgcolor: DWord); assembler; register;
  211. label nobg;
  212. asm
  213.   pusha
  214.   shll  $16, %eax
  215.   pushl %ecx
  216.   movl  flags, %ecx  {ä« £¨, 梥â}
  217.   movl  bgcolor, %edi
  218.   movw  %dx, %ax
  219.   andl   $0x7FFFFFFF, %ecx
  220.   btl   $31, %edi
  221.   jnc   nobg
  222.   orl   $0x40000000, %ecx
  223. nobg:
  224.   popl  %edx
  225.   movl  %eax, %ebx    {ª®®à¤¨­ âë}
  226.   movzbl (%edx), %esi {¤«¨­  áâப¨}
  227.   movl  $4, %eax      {­®¬¥à ä㭪樨}
  228.   incl  %edx          {㪠§ â¥«ì ­  áâபã}
  229.   andl  $0xFFFFFF, %edi
  230.   int   $0x40
  231.   popa
  232. end;
  233.  
  234. procedure kos_drawrect(x, y, w, h: Word; color: DWord); assembler; register;
  235. asm
  236.   pushl %eax
  237.   pushl %ebx
  238.   pushl %ecx
  239.   pushl %edx
  240.   movl  %eax, %ebx
  241.   xchgl %edx, %ecx
  242.   shll  $16, %ebx
  243.   shll  $16, %ecx
  244.   movl  $13, %eax
  245.   movw  %dx, %bx
  246.   movw  h, %cx
  247.   movl  color, %edx
  248.   int   $0x40
  249.   popl %edx
  250.   popl %ecx
  251.   popl %ebx
  252.   popl %eax
  253. end;
  254.  
  255. procedure kos_drawline(x1, y1, x2, y2: Word; color: DWord = $000000); assembler; register;
  256. asm
  257.   pushl %eax
  258.   pushl %ebx
  259.   pushl %ecx
  260.   pushl %edx
  261.  
  262.   xchgl %eax, %ecx
  263.   xchgl %ecx, %edx
  264.   movl  color, %ebx
  265.   {eax - x2, ebx - color, ecx - y1, edx - x1}
  266.   shll  $16, %ecx
  267.   shll  $16, %edx
  268.   movw  %ax, %dx
  269.   movw  y2, %cx
  270.   movl  $38, %eax
  271.   xchgl %ebx, %edx
  272.   int   $0x40
  273.  
  274.   popl  %edx
  275.   popl  %ecx
  276.   popl  %ebx
  277.   popl  %eax
  278. end;
  279.  
  280. procedure kos_drawimage(x, y, w, h, depth: DWord; image: Pointer; palette: Pointer; xoffset: DWord); assembler; register;
  281. asm
  282.   pusha
  283.   shll  $16, %eax
  284.   shll  $16, %ecx
  285.   orl   %eax, %edx
  286.   orl   h, %ecx
  287.   movl  depth, %esi
  288.   movl  image, %ebx
  289.   movl  palette, %edi
  290.   movl  xoffset, %ebp
  291.   movl  $65, %eax
  292.   int   $0x40
  293.   popa
  294. end;
  295.  
  296. procedure kos_drawimage24(x, y, w, h: DWord; image: Pointer); assembler; register;
  297. asm
  298.   pushl %eax
  299.   pushl %ebx
  300.   pushl %ecx
  301.   pushl %edx
  302.   shll  $16, %eax
  303.   shll  $16, %ecx
  304.   orl   %eax, %edx
  305.   orl   h, %ecx
  306.   movl  image, %ebx
  307.   movl  $7, %eax
  308.   int   $0x40
  309.   popl  %edx
  310.   popl  %ecx
  311.   popl  %ebx
  312.   popl  %eax
  313. end;
  314.  
  315.  
  316. { Work with system }
  317.  
  318. { Work with system - System services }
  319.  
  320. function kos_killthread(tid: TThreadID): Boolean; assembler; register;
  321. asm
  322.   pushl %ecx
  323.   pushl %ebx
  324.   movl  $18, %ecx
  325.   movl  $18, %ebx
  326.   xchgl %eax, %ecx
  327.   int   $0x40
  328.   andl  $1, %eax
  329.   popl  %ebx
  330.   popl  %ecx
  331.   xorb  $1, %al
  332. end;
  333.  
  334. procedure kos_setactivewindow(slot: TThreadSlot); assembler; register;
  335. asm
  336.   pushl %ecx
  337.   pushl %ebx
  338.   movl  $18, %ecx
  339.   movl  $3, %ebx
  340.   xchgl %eax, %ecx
  341.   int   $0x40
  342.   xchgl %eax, %ecx
  343.   popl  %ebx
  344.   popl  %ecx
  345. end;
  346.  
  347. {$ifdef EMULATOR}
  348. function kos_getthreadslot(tid: TThreadID): TThreadSlot;
  349. var
  350.   ThreadInfo: TKosThreadInfo;
  351.   HighThreadSlot: TThreadSlot;
  352. begin
  353.   Result := 0;
  354.   repeat
  355.     Inc(Result);
  356.     HighThreadSlot := kos_threadinfo(@ThreadInfo, Result);
  357.   until (Result > HighThreadSlot) or (ThreadInfo.ThreadID = tid);
  358. end;
  359.  
  360. {$else}
  361.  
  362. function kos_getthreadslot(tid: TThreadID): TThreadSlot; assembler; register;
  363. asm
  364.   pushl %ecx
  365.   pushl %ebx
  366.   movl  $18, %ecx
  367.   movl  $21, %ebx
  368.   xchgl %eax, %ecx
  369.   int   $0x40
  370.   popl  %ebx
  371.   popl  %ecx
  372. end;
  373. {$endif}
  374.  
  375. { Work with system - Set system parameters }
  376.  
  377. procedure kos_enablepci(); assembler; register;
  378. asm
  379.   pushl %eax
  380.   pushl %ebx
  381.   pushl %ecx
  382.   movl  $21, %eax
  383.   movl  $12, %ebx
  384.   movl  $1, %ecx
  385.   int   $0x40
  386.   popl  %ecx
  387.   popl  %ebx
  388.   popl  %eax
  389. end;
  390.  
  391. { Work with system - Get system parameters }
  392.  
  393. function kos_timecounter(): DWord; assembler; register;
  394. asm
  395.   pushl %ebx
  396.   movl  $26, %eax
  397.   movl  $9, %ebx
  398.   int   $0x40
  399.   popl  %ebx
  400. end;
  401.  
  402. { Work with system - Internal system services }
  403.  
  404. procedure kos_switchthread(); assembler; register;
  405. asm
  406.   pushl %eax
  407.   pushl %ebx
  408.   movl  $68, %eax
  409.   movl  $1, %ebx
  410.   int   $0x40
  411.   popl  %ebx
  412.   popl  %eax
  413. end;
  414.  
  415. function kos_initheap(): DWord; assembler; register;
  416. asm
  417.   pushl %ebx
  418.   movl  $68, %eax
  419.   movl  $11, %ebx
  420.   int   $0x40
  421.   popl  %ebx
  422. end;
  423.  
  424. function kos_alloc(size: DWord): Pointer; assembler; register;
  425. asm
  426.   pushl %ebx
  427.   pushl %ecx
  428.   movl  %eax, %ecx
  429.   movl  $68, %eax
  430.   movl  $12, %ebx
  431.   int   $0x40
  432.   popl  %ecx
  433.   popl  %ebx
  434. end;
  435.  
  436. function kos_free(ptr: Pointer): Boolean; assembler; register;
  437. asm
  438.   pushl %ebx
  439.   pushl %ecx
  440.   movl  %eax, %ecx
  441.   movl  $68, %eax
  442.   movl  $13, %ebx
  443.   int   $0x40
  444.   popl  %ecx
  445.   popl  %ebx
  446. end;
  447.  
  448. function kos_loaddriver(name: PChar): THandle; assembler; register;
  449. asm
  450.   pushl %ebx
  451.   pushl %ecx
  452.   movl  %eax, %ecx
  453.   movl  $68, %eax
  454.   movl  $16, %ebx
  455.   int   $0x40
  456.   popl  %ecx
  457.   popl  %ebx
  458. end;
  459.  
  460.  
  461. { Processes and threads }
  462.  
  463. function kos_threadinfo(info: PKosThreadInfo; slot: TThreadSlot): DWord; assembler; register;
  464. asm
  465.   pushl %ebx
  466.   movl  %eax, %ebx
  467.   xchgl %edx, %ecx
  468.   movl  $9, %eax
  469.   int   $0x40
  470.   xchgl %edx, %ecx
  471.   popl  %ebx
  472. end;
  473.  
  474. function kos_newthread(entry, stack: Pointer): TThreadID; assembler; register;
  475. asm
  476.   pushl %ebx
  477.   pushl %ecx
  478.   movl  $1, %ebx
  479.   movl  %eax, %ecx
  480.   movl  $51, %eax
  481.   int   $0x40
  482.   popl  %ecx
  483.   popl  %ebx
  484. end;
  485.  
  486. procedure kos_initipc(ipc: PKosIPC; size: DWord); assembler; register;
  487. asm
  488.   pushl %ebx
  489.   pushl %ecx
  490.   movl  $60, %ecx
  491.   movl  $1, %ebx
  492.   xchgl %eax, %ecx
  493.   int   $0x40
  494.   popl  %ecx
  495.   popl  %ebx
  496. end;
  497.  
  498. function kos_sendmsg(tid: TThreadID; msg: Pointer; size: DWord): DWord; assembler; register;
  499. {@return:
  500.   0 - ãᯥ譮
  501.   1 - ¯à¨ñ¬­¨ª ­¥ ®¯à¥¤¥«¨« ¡ãä¥à ¤«ï IPC-á®®¡é¥­¨©
  502.       (¬®¦¥â ¡ëâì, ¥éñ ­¥ ãᯥ«,   ¬®¦¥â ¡ëâì, íâ® ­¥ â®â ¯®â®ª, ª®â®àë© ­ã¦¥­)
  503.   2 - ¯à¨ñ¬­¨ª § ¡«®ª¨à®¢ « IPC-¡ãä¥à; ¯®¯à®¡ã©â¥ ­¥¬­®£® ¯®¤®¦¤ âì
  504.   3 - ¯¥à¥¯®«­¥­¨¥ IPC-¡ãä¥à  ¯à¨ñ¬­¨ª 
  505.   4 - ¯à®æ¥áá /¯®â®ª  á â ª¨¬ PID ­¥ áãé¥áâ¢ã¥â}
  506. asm
  507.   pushl %esi
  508.   pushl %ebx
  509.   movl  $60, %esi
  510.   movl  $2, %ebx
  511.   xchgl %ecx, %esi
  512.   xchgl %eax, %ecx
  513.   int   $0x40
  514.   xchgl %ecx, %esi
  515.   popl  %ebx
  516.   popl  %esi
  517. end;
  518.  
  519. function kos_resizemem(size: DWord): Boolean; assembler; register;
  520. asm
  521.   pushl %ebx
  522.   pushl %ecx
  523.   movl  %eax, %ecx
  524.   movl  $64, %eax
  525.   movl  $1, %ebx
  526.   int   $0x40
  527.   xorb  $1, %al
  528.   popl  %ecx
  529.   popl  %ebx
  530. end;
  531.  
  532.  
  533. { File system }
  534. { File system - Work with the current folder }
  535.  
  536. procedure kos_setdir(path: PChar); assembler; register;
  537. asm
  538.   pushl %ecx
  539.   pushl %ebx
  540.   movl  $30, %ecx
  541.   movl  $1, %ebx
  542.   xchgl %eax, %ecx
  543.   int   $0x40
  544.   popl  %ebx
  545.   popl  %ecx
  546. end;
  547.  
  548. function kos_getdir(path: PChar; size: DWord): DWord; assembler; register;
  549. asm
  550.   pushl %ecx
  551.   pushl %ebx
  552.   movl  $30, %ecx
  553.   movl  $2, %ebx
  554.   xchgl %eax, %ecx
  555.   int   $0x40
  556.   popl  %ebx
  557.   popl  %ecx
  558. end;
  559.  
  560. { File system - Work with file system with long names support }
  561.  
  562. function kos_readfile(kosfile: PKosFile; var readed: Longint): DWord; assembler; register;
  563. asm
  564.   pushl %ebx
  565.   movl  $70, %ebx
  566.   xchgl %eax, %ebx
  567.   movl  $0, (%ebx)
  568.   int   $0x40
  569.   movl  %ebx, (%edx)
  570.   popl  %ebx
  571. end;
  572.  
  573. function kos_rewritefile(kosfile: PKosFile; var writed: Longint): DWord; assembler; register;
  574. asm
  575.   pushl %ebx
  576.   movl  $70, %ebx
  577.   xchgl %eax, %ebx
  578.   movl  $2, (%ebx)
  579.   int   $0x40
  580.   movl  %ebx, (%edx)
  581.   popl  %ebx
  582. end;
  583.  
  584. function kos_writefile(kosfile: PKosFile; var writed: Longint): DWord; assembler; register;
  585. asm
  586.   pushl %ebx
  587.   movl  $70, %ebx
  588.   xchgl %eax, %ebx
  589.   movl  $3, (%ebx)
  590.   int   $0x40
  591.   movl  %ebx, (%edx)
  592.   popl  %ebx
  593. end;
  594.  
  595. function kos_fileinfo(kosfile: PKosFile): DWord; assembler; register;
  596. asm
  597.   pushl %ebx
  598.   movl  $70, %ebx
  599.   xchgl %eax, %ebx
  600.   movl  $5, (%ebx)
  601.   int   $0x40
  602.   popl  %ebx
  603. end;
  604.  
  605.  
  606. { Sound }
  607.  
  608. function kos_speaker(notes: Pointer): Boolean; assembler; register;
  609. asm
  610.   pushl %esi
  611.   pushl %ebx
  612.   movl  $55, %esi
  613.   movl  %esi, %ebx
  614.   xchgl %eax, %esi
  615.   int   $0x40
  616.   {eax = 55 - ®è¨¡ª }
  617.   andl  $1, %eax
  618.   popl  %ebx
  619.   popl  %esi
  620.   xorb  $1, %al
  621. end;
  622.  
  623.  
  624. { Work with hardware }
  625.  
  626. function kos_readport(index: DWord): DWord; assembler; register;
  627. label ok, exit;
  628. asm
  629.   pushl %ecx
  630.   pushl %ebx
  631.   xchgl %eax, %ecx         {index}
  632.   movl  $43, %eax
  633.   orl   $0x80000000, %ecx  {index}
  634.   int   $0x40
  635.   orl   %eax, %eax
  636.   jzl   ok
  637.   movl  $-1, %eax
  638.   jmp   exit
  639. ok:
  640.   movl  %ebx, %eax
  641. exit:
  642.   popl  %ebx
  643.   popl  %ecx
  644. end;
  645.  
  646. procedure kos_writeport(index, value: DWord); assembler; register;
  647. asm
  648.   pushl %eax
  649.   pushl %ebx
  650.   pushl %ecx
  651.   xchgl %edx, %ebx  {value}
  652.   xchgl %eax, %ecx  {index}
  653.   movl  $43, %eax
  654.   int   $0x40
  655.   xchgl %edx, %ebx
  656.   popl  %ecx
  657.   popl  %ebx
  658.   popl  %eax
  659. end;
  660.  
  661. function kos_reserveport(port: DWord): Boolean; assembler; register;
  662. asm
  663.   pushl %ebx
  664.   pushl %ecx
  665.   pushl %edx
  666.   movl  %eax, %ecx  {port}
  667.   movl  $46, %eax
  668.   movl  %ecx, %edx  {port}
  669.   xorl  %ebx, %ebx
  670.   int   $0x40
  671.   xorb  $1, %al
  672.   popl  %edx
  673.   popl  %ecx
  674.   popl  %ebx
  675. end;
  676.  
  677. { Work with hardware - Low-level access to PCI}
  678.  
  679. function kos_lastpcibus(): Byte; assembler; register;
  680. asm
  681.   pushl %ebx
  682.   movl  $62, %eax
  683.   movl  $1, %ebx
  684.   int   $0x40
  685.   popl  %ebx
  686. end;
  687.  
  688. function kos_readpcib(bus, dev, func, reg: Byte): Byte; assembler; register;
  689. asm
  690.   pushl %ebx
  691.   pushl %ecx
  692.   pushl %edx
  693.   shlb  $3, %dl   {dev}
  694.   movb  %al, %bh  {bus}
  695.   shlw  $8, %cx   {func}
  696.   movb  $4, %bl
  697.   movb  reg, %cl  {func}
  698.   andb  $7, %ch   {func}
  699.   movl  $62, %eax
  700.   orb   %dl, %ch  {dev/func}
  701.   int   $0x40
  702.   popl  %edx
  703.   popl  %ecx
  704.   popl  %ebx
  705. end;
  706.  
  707. function kos_readpciw(bus, dev, func, reg: Byte): Word; assembler; register;
  708. asm
  709.   pushl %ebx
  710.   pushl %ecx
  711.   pushl %edx
  712.   shlb  $3, %dl   {dev}
  713.   movb  %al, %bh  {bus}
  714.   shlw  $8, %cx   {func}
  715.   movb  $5, %bl
  716.   movb  reg, %cl  {reg}
  717.   andb  $7, %ch   {func}
  718.   movl  $62, %eax
  719.   orb   %dl, %ch  {dev/func}
  720.   int   $0x40
  721.   popl  %edx
  722.   popl  %ecx
  723.   popl  %ebx
  724. end;
  725.  
  726. function kos_readpcid(bus, dev, func, reg: Byte): DWord; assembler; register;
  727. asm
  728.   pushl %ebx
  729.   pushl %ecx
  730.   pushl %edx
  731.   shlb  $3, %dl   {dev}
  732.   movb  %al, %bh  {bus}
  733.   shlw  $8, %cx   {func}
  734.   movb  $6, %bl
  735.   movb  reg, %cl  {reg}
  736.   andb  $7, %ch   {func}
  737.   movl  $62, %eax
  738.   orb   %dl, %ch  {dev/func}
  739.   int   $0x40
  740.   popl  %edx
  741.   popl  %ecx
  742.   popl  %ebx
  743. end;
  744.  
  745.  
  746. { Other }
  747. procedure kos_delay(ms: DWord); assembler; register;
  748. asm
  749.   pushl %ebx
  750.   movl  %eax, %ebx
  751.   movl  $5, %eax
  752.   int   $0x40
  753.   popl  %ebx
  754. end;
  755.