Subversion Repositories Kolibri OS

Rev

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

  1. ;
  2. ;   LAUNCHER - €‚’Ž‡€“‘Š Žƒ€ŒŒ
  3. ;     Š®¤ ¯à®£à ¬¬ë ᮢᥬ ­¥ ®¯â¨¬¨§¨à®¢ ­, ­® ®ç¥­ì ¯à®áâ ¤«ï ¯®­¨¬ ­¨ï.
  4. ;     â®â « ã­ç¥à £à㧨⠨­ä®à¬ æ¨î ® ¯à®£à ¬¬ å ¤«ï § ¯ã᪠ ¨§ ä ©« 
  5. ;     AUTORUN.DAT. ”®à¬ â ®ç¥­ì ¯à®áâ ¨ ¢ ª®¬¬¥­â à¨ïå ­¥ ­ã¦¤ ¥âáï.
  6. ;
  7. ;   Š®¬¯¨«¨àã©â¥ á ¯®¬®éìî FASM 1.52 ¨ ¢ëè¥
  8. ;
  9. include "..\..\..\MACROS.INC"
  10.  
  11.   use32
  12.   org    0x0
  13.   db     'MENUET01'              ; 8 byte id
  14.   dd     0x01                    ; header version
  15.   dd     START                   ; start of code
  16.   dd     I_END                   ; size of image
  17.   dd     0x8000                 ; memory for app
  18.   dd     0x8000                 ; esp
  19.   dd     0x0 , 0x0               ; I_Param , I_Icon
  20.  
  21. ;include "DEBUG.INC"
  22.  
  23. START:                           ; start of execution
  24.  
  25. ;   mov  eax, 5
  26. ;   mov  ebx, 10
  27. ;   mcall
  28.  
  29.    mcall 18,15
  30.  
  31.    mov  eax, 70               ; load AUTORUN.DAT
  32.    mov  ebx, autorun_dat_info
  33.    mcall
  34.  
  35.    call get_number
  36.    mov  [number_of_files], eax
  37. ;dps "NUMBER OF FILES: "
  38. ;dpd eax
  39. ;dps <13,10>
  40.    call next_line
  41.  
  42.  start_program:
  43. ;dps <"STARTING A PROGRAM",13,10>
  44.    call clear_strings
  45.    mov  edi, program
  46.    call get_string
  47.    mov  edi, parameters
  48.    call get_string
  49.    call get_number
  50.    call run_program
  51.    call next_line
  52.    dec  [number_of_files]
  53.    jnz  start_program
  54.  
  55.  exit:
  56.    or   eax, -1
  57.    mcall
  58.  
  59.  
  60.  run_program:     ; time to delay in eax
  61.    push eax
  62.    mcall 70, start_info
  63.    pop  ebx
  64.  
  65.    mov  eax, 5
  66.    mcall
  67.  ret
  68.  
  69.  
  70.  clear_strings:   ; clears buffers
  71.    pushad
  72.  
  73.    mov  ecx, 60
  74.    mov  edi, program
  75.    xor  al, al ;mov  al, ' '
  76.    rep  stosb
  77.  
  78.    mov  ecx, 60
  79.    mov  edi, parameters
  80.    rep  stosb
  81.  
  82.    popad
  83.  ret
  84.  
  85.  
  86.  get_string: ; pointer to destination buffer in edi
  87.    pushad
  88.    call skip_spaces
  89.    mov  esi, [position]
  90. ;dpd esi
  91. ;dps <13,10>
  92.    add  esi, file_data
  93.   .start:
  94.    lodsb
  95.    cmp  al, ' '
  96.    je   .finish
  97.    stosb
  98.    inc  [position]
  99.    jmp  .start
  100.   .finish:
  101.    popad
  102.  ret
  103.  
  104.  
  105.  get_number:
  106.    push ebx esi
  107.    call skip_spaces
  108.    mov  esi, [position]
  109.    add  esi, file_data
  110.    xor  eax, eax
  111.    xor  ebx, ebx
  112.   .start:
  113.    lodsb
  114.    sub  al, '0'
  115.    cmp  al, 9
  116.    ja   .finish
  117.    lea  ebx,[ebx*4+ebx]
  118.    lea  ebx,[ebx*2+eax]
  119.    inc  [position]
  120.    jmp  .start
  121.   .finish:
  122.    mov  eax, ebx
  123.    pop  esi ebx
  124.  ret
  125.  
  126.  
  127.  skip_spaces:
  128.    pushad
  129.    xor  eax, eax
  130.    mov  esi, [position]
  131.    add  esi, file_data
  132.   .start:
  133.    lodsb
  134.    cmp  al, ' '
  135.    jne  .finish
  136.    inc  [position]
  137.    jmp  .start
  138.   .finish:
  139. ;dps "NOW AL = "
  140. ;mov [tmp],al
  141. ;mov edx, tmp
  142. ;call debug_outstr
  143. ;dps <13,10>
  144.    popad
  145.  ret
  146.  
  147.  
  148.  next_line:
  149.    pushad
  150.    mov  esi, [position]
  151.    add  esi, file_data
  152.   .start:
  153.    lodsb
  154.    cmp  al, 13
  155.    je   .finish
  156.    inc  [position]
  157.    jmp  .start
  158.   .finish:
  159.    add  [position], 2
  160.    inc  esi
  161.    lodsb
  162.    cmp  al, '#'
  163.    je   .skipline
  164.    cmp  al, 13
  165.    jne  .donotskip
  166.   .skipline:
  167.    call next_line
  168.   .donotskip:
  169.    popad
  170.  ret
  171.  
  172.  
  173.  
  174. ; DATA:
  175.  position          dd 0            ; position in file
  176.  
  177.  autorun_dat_info:                 ; AUTORUN.DAT
  178.    .mode           dd 0            ; read file
  179.    .start_block    dd 0            ; block to read
  180.                    dd 0
  181.    .blocks         dd 16*512       ; 16*512 bytes max
  182.    .address        dd file_data
  183.    db "AUTORUN.DAT",0
  184.  
  185.  start_info:
  186.    .mode           dd 7
  187.                    dd 0
  188.    .params         dd parameters
  189.                    dd 0
  190.                    dd 0
  191.    .path: ;      
  192.  
  193. I_END:
  194.  
  195.  program           rb 61 ; 60 + [0] char
  196.  parameters        rb 61
  197.  
  198.  number_of_files   dd ?
  199.  
  200.  file_data         rb 16*512
  201.