Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ORG 0
  2. BITS 32
  3. ; ---------------------------------------------------------------------------- ;
  4. STACK_SIZE     equ 256
  5. ; ---------------------------------------------------------------------------- ;
  6. MENUET01       db 'MENUET01'
  7. version        dd 1
  8. program.start  dd start_
  9. program.end    dd end_
  10. program.memory dd end_ + STACK_SIZE
  11. program.stack  dd end_ + STACK_SIZE
  12. program.params dd 0
  13. program.path   dd 0
  14. ; ---------------------------------------------------------------------------- ;
  15. Partition:
  16. .full_space    dd 0
  17. .free_space    dd 0
  18. ; ---------------------------------------------------------------------------- ;
  19. FS_Info:
  20. .cluster_size  dd 0
  21. .all_clusters  dd 0
  22. .free_clusters dd 0
  23. ; ---------------------------------------------------------------------------- ;
  24. sz_caption       db "RDInfo",0
  25. sz_all_clusters  db "All clusters:",0
  26. sz_free_clusters db "Free clusters:",0
  27. sz_cluster_size  db "Cluster size:",0
  28. sz_full_space    db "Full space(kb):",0
  29. sz_free_space    db "Free space(kb):",0
  30. ; ---------------------------------------------------------------------------- ;
  31. %define buffer [esp + 8]
  32. %define disk   [esp + 4]
  33. get_file_system_info:
  34.         mov    edx, esp
  35.         sub    edx, 24
  36.         mov    [edx], dword 15
  37.         mov    eax, disk
  38.         mov    [edx + 20], eax
  39.         mov    eax, 58
  40.         lea    ebx, [edx]
  41.         int    64
  42.         mov    esi, eax
  43.         mov    edx, [edx]
  44.         mov    eax, buffer
  45.         mov    [eax], edx
  46.         mov    [eax + 4], ebx
  47.         mov    [eax + 8], ecx
  48.         mov    eax, esi
  49.         ret    8
  50. ; ---------------------------------------------------------------------------- ;
  51. start_:
  52. ; set.event:
  53.         mov    eax, 40
  54.         mov    ebx, 5 ; redraw + button
  55.         int    64
  56. on_redraw:
  57. ; redraw.start
  58.         mov    eax, 12
  59.         mov    ebx, 1
  60.         int    64
  61. ; draw.window
  62.         xor    eax, eax
  63.         mov    ebx, 200
  64.         mov    ecx, 100
  65.         mov    edx, 0x34CCDDEE
  66.         mov    edi, sz_caption
  67.         int    64
  68. ; get.info
  69.         push   dword FS_Info
  70.         push   dword "/rd" ; ramdisk
  71.         call   get_file_system_info
  72.  
  73.         mov    eax, [FS_Info.all_clusters]
  74.         mul    dword [FS_Info.cluster_size]
  75.         shr    eax, 10
  76.         mov    [Partition.full_space], eax
  77.  
  78.         mov    eax, [FS_Info.free_clusters]
  79.         mul    dword [FS_Info.cluster_size]
  80.         shr    eax, 10
  81.         mov    [Partition.free_space], eax
  82. ; draw.info
  83.         mov    eax, 4
  84.         mov    ecx, 0xC0000000
  85.         mov    edi, 0x00CCDDEE
  86.  
  87.         mov    ebx, (10 << 16) | 10
  88.         mov    edx, sz_all_clusters
  89.         int    64
  90.         mov    ebx, (10 << 16) | 20
  91.         mov    edx, sz_free_clusters
  92.         int    64
  93.         mov    ebx, (10 << 16) | 30
  94.         mov    edx, sz_cluster_size
  95.         int    64
  96.         mov    ebx, (10 << 16) | 40
  97.         mov    edx, sz_full_space
  98.         int    64
  99.         mov    ebx, (10 << 16) | 50
  100.         mov    edx, sz_free_space
  101.         int    64
  102.  
  103.         mov    eax, 47
  104.         mov    ebx, (10 << 16) | 0x80000000
  105.         mov    esi, ecx
  106.  
  107.         mov    ecx, [FS_Info.all_clusters]
  108.         mov    edx, (110 << 16) | 10
  109.         int    64
  110.         mov    ecx, [FS_Info.free_clusters]
  111.         mov    edx, (110 << 16) | 20
  112.         int    64
  113.         mov    ecx, [FS_Info.cluster_size]
  114.         mov    edx, (110 << 16) | 30
  115.         int    64
  116.         mov    ecx, [Partition.full_space]
  117.         mov    edx, (110 << 16) | 40
  118.         int    64
  119.         mov    ecx, [Partition.free_space]
  120.         mov    edx, (110 << 16) | 50
  121.         int    64
  122. ; redraw.finish
  123.         mov    eax, 12
  124.         mov    ebx, 2
  125.         int    64
  126. ; wait.event
  127.         mov    eax, 10
  128.         int    64
  129.         dec    eax
  130.         jz     on_redraw
  131. ; program.terminate:
  132.         or     eax, -1
  133.         int    64
  134. ; ---------------------------------------------------------------------------- ;
  135. end_: