Subversion Repositories Kolibri OS

Rev

Rev 109 | Rev 485 | 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. ;   int  0x40
  28.  
  29.    mcall 18,15
  30.  
  31.    mov  eax, 58               ; load AUTORUN.DAT
  32.    mov  ebx, autorun_dat_info
  33.    int  0x40
  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.    int  0x40
  58.  
  59.  
  60.  run_program:     ; time to delay in eax
  61.    push eax
  62.    mcall 58, start_info
  63.    pop  ebx
  64.  
  65.    mov  eax, 5
  66.    int  0x40
  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.    xor  al, al
  81.    rep  stosb
  82.  
  83.    popad
  84.  ret
  85.  
  86.  
  87.  get_string: ; pointer to destination buffer in edi
  88.    pushad
  89.    call skip_spaces
  90.    mov  esi, [position]
  91. ;dpd esi
  92. ;dps <13,10>
  93.    add  esi, file_data
  94.   .start:
  95.    lodsb
  96.    cmp  al, ' '
  97.    je   .finish
  98.    stosb
  99.    inc  [position]
  100.    jmp  .start
  101.   .finish:
  102.    popad
  103.  ret
  104.  
  105.  
  106.  get_number:
  107.    push ebx esi
  108.    call skip_spaces
  109.    mov  esi, [position]
  110.    add  esi, file_data
  111.    xor  eax, eax
  112.    xor  ebx, ebx
  113.   .start:
  114.    lodsb
  115.    cmp  al, '0'
  116.    jb   .finish
  117.    cmp  al, '9'
  118.    ja   .finish
  119.    sub  al, '0'
  120.    imul ebx, 10
  121.    add  ebx, eax
  122.    inc  [position]
  123.    jmp  .start
  124.   .finish:
  125.    mov  eax, ebx
  126.    pop  esi ebx
  127.  ret
  128.  
  129.  
  130.  skip_spaces:
  131.    pushad
  132.    xor  eax, eax
  133.    mov  esi, [position]
  134.    add  esi, file_data
  135.   .start:
  136.    lodsb
  137.    cmp  al, ' '
  138.    jne  .finish
  139.    inc  [position]
  140.    jmp  .start
  141.   .finish:
  142. ;dps "NOW AL = "
  143. ;mov [tmp],al
  144. ;mov edx, tmp
  145. ;call debug_outstr
  146. ;dps <13,10>
  147.    popad
  148.  ret
  149.  
  150.  
  151.  next_line:
  152.    pushad
  153.    mov  esi, [position]
  154.    add  esi, file_data
  155.   .start:
  156.    lodsb
  157.    cmp  al, 13
  158.    je   .finish
  159.    inc  [position]
  160.    jmp  .start
  161.   .finish:
  162.    add  [position], 2
  163.    inc  esi
  164.    lodsb
  165.    cmp  al, '#'
  166.    je   .skipline
  167.    cmp  al, 13
  168.    jne  .donotskip
  169.   .skipline:
  170.    call next_line
  171.   .donotskip:
  172.    popad
  173.  ret
  174.  
  175.  
  176.  
  177. ; DATA:
  178.  position          dd 0            ; position in file
  179.  
  180.  autorun_dat_info:                 ; AUTORUN.DAT
  181.    .mode           dd 0            ; read file
  182.    .start_block    dd 0            ; block to read
  183.    .blocks         dd 0x10         ; 16*512 bytes max
  184.    .address        dd file_data
  185.    .workarea       dd work_area
  186.    db "/RD/1/AUTORUN.DAT",0
  187.  
  188.  start_info:
  189.    .mode           dd 16
  190.                    dd 0
  191.    .params         dd parameters
  192.                    dd 0
  193.    .workarea       dd work_area
  194.    .path: ;      
  195.  
  196. I_END:
  197.  
  198.  program           rb 61 ; 60 + [0] char
  199.  parameters        rb 61
  200.  
  201.  number_of_files   dd ?
  202.  
  203.  work_area         rb 0x4000
  204.  file_data         rb 16*512
  205.