Subversion Repositories Kolibri OS

Rev

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

  1. ; Copyright (c) 2009, <Lrz>
  2. ; All rights reserved.
  3. ;
  4. ; Redistribution and use in source and binary forms, with or without
  5. ; modification, are permitted provided that the following conditions are met:
  6. ;       * Redistributions of source code must retain the above copyright
  7. ;       notice, this list of conditions and the following disclaimer.
  8. ;       * Redistributions in binary form must reproduce the above copyright
  9. ;       notice, this list of conditions and the following disclaimer in the
  10. ;       documentation and/or other materials provided with the distribution.
  11. ;       * Neither the name of the <organization> nor the
  12. ;       names of its contributors may be used to endorse or promote products
  13. ;       derived from this software without specific prior written permission.
  14. ;
  15. ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
  16. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  19. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. ;*****************************************************************************
  26.  
  27. ; Ìîäóëü ïàðñèíãà - ýòî ñòàíäàðòíûé êîìïîíåíò, âñòðàèâàåìûé âî âòîðè÷íûé çàãðóç÷èê.
  28. ; Äàííûé ìîäóëü ïîçâîëÿåò ñòàíäàðòíî ïðîèçâåñòè ðàçáîð ini ôàéëà
  29. ; (è ñ èñïîëüçîâàíèåì ïîëó÷åííûõ äàííûõ ÎÑ áóäåò çàãðóæàòüñÿ äàëüøå).
  30. ;  íà÷àëå íàéäåì îòêðûâàþùèé "[" - ýòî áóäåò óêàçûâàòü íà íà÷àëî
  31. ; ñåêöèè. Ïîääåðæèâàåòñÿ 1 ñåêöèÿ ýòî [loader], îñòàëüíûå ñåêöèè ìîãóò èìåòü
  32. ; ëþáûå èìåíà, íî îíè äîëæíû áûòü çàêëþ÷åíû â â ñêîáêè []
  33. macro  use_parse
  34. {
  35. ;input cx=size of ini file
  36. parse_start:
  37. ;es:di as 2000:0000 new segment
  38. ;óñòàíîâèì óêàçàòåëü íà çàãðóæåííûé áëîê
  39.         enter   256,0   ;set 16 byte for current task in stack
  40. ;we are is not use bp because bp is pointer on array 16 byte
  41.         mov     word [save_bp_from_timer],bp    ;save point to own data array
  42.         mov     save_cx,cx      ;it's placed size of ini file
  43.         les     di,dword [file_data]
  44. ;îáíóëèì âñå ïåðåìåííûå âûäåëåííûå èç ñòåêà
  45. ;init flag
  46.         xor     ax,ax
  47.         mov     status_flag,ax
  48. ;set data size
  49.         mov     info_real_mode_size,ini_data_ +0x1000    ;èçìåíèì çíà÷åíèå çàíÿòîñòè ïàìÿòè
  50.  
  51. ;ïîèñê íà÷àëà áëîêà.
  52. ;///////////check [loader]
  53.         cld
  54.  
  55.         mov     ret_on_ch,.start     ;set return
  56.         mov     al,byte [es:di]
  57.         push    word .first_ret
  58.         cmp     al,' '
  59.         jz      .first_sp_1
  60.         jmp     get_firs_sym.not_space
  61. .first_sp_1:
  62.         jmp     get_firs_sym.first_sp
  63.  
  64. .start:
  65.         call    get_firs_sym    ;get first symbol on new line
  66. .first_ret:                     ;ïåðâûé âîçâðàò
  67. ;        jcxz   .end_file       ;.end_loader     ;found or not found parametrs in section  exit in section
  68.         test    cx,cx
  69.         jz      error.not_loader
  70.         cmp     al,'['
  71.         jz      .parse_loader
  72.         jmp     .start
  73. ;////// ïðîâåðêà íà íàëè÷åå ñåêöèè loader
  74. use_parse_loader
  75. ;pause
  76. if DEBUG
  77.         xor     ax,ax
  78.         int     16h
  79. end if 
  80. ;////// âûâîä ãðàôè÷åñêîãî ýêðàíà, âûáîð, ñåêöèè ïîä äåôîëòó
  81. use_any_sec
  82. ;ïàðñèíã âûáðàíîé èëè äåôîëòíîé ñåêöèè ò.å. ðàçáîð ïàðàìåòðîâ âûïîëíåíèå ñöåíàðèÿ
  83. use_parse_def_sect
  84.  
  85. ;//////////////////
  86. ;/end parse block
  87. ;//////////////////
  88. ;.end_bl:
  89. ;        mov     cx,bx
  90. ;
  91. ;        jmp     .start
  92.  
  93. .exit:
  94.  
  95. ;        mov     si,parse_ini_end
  96. ;        call    printplain
  97. ;        
  98. ;if DEBUG        
  99. ;        pusha
  100. ;        mov     ax,cx
  101. ;        mov     cx,0x0a
  102. ;        mov     di,show_db1_dec
  103. ;        mov     dword[ds:di],'    '
  104. ;        call    decode
  105. ;Show size
  106. ;        mov     si,show_db1
  107. ;        call    printplain
  108. ;
  109. ;        popa
  110. ;end if  
  111.         jmp     $
  112.  
  113. ;///////////////////procedure //////////
  114. ;input es:di - is pointer to date
  115. ;cx - counter
  116. ;return: cx - status if =0 - end of date else es:di point to first symbol on new line
  117.  
  118. }