Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*-----------------18.02.02 23:55-------------------
  2.   â®â ä ©« ¨á¯®«ì§ã¥â ª®¬¯¨«ïâ®à ¤«ï £¥­¥à æ¨¨ ­ ç «ì­®£® ª®¤  ¯à®£à ¬¬ë.
  3.  ” ©« ¤®«¦¥­ ­ å®¤¨âìáï ¢ ¤¨à¥ªâ®à¨¨ ¢¬¥áâ¥ á ®áâ «ì­ë¬¨ § £®«®¢®ç­ë¬¨ ä ©« ¬¨.
  4.  ‚ª«îç âì íâ®â ä ©« ¢ á¢®î ¯à®£à ¬¬ã ¤¨à¥ªâ¨¢®© ?include ­¥«ì§ï.
  5.  --------------------------------------------------*/
  6.  
  7. :void CLEARPOSTAREA( (E)AX )
  8. {
  9.         (E)DI = # __startpostvar;
  10.         (E)CX = # __sizepostarea;
  11.         $rep $stosb
  12. }
  13.  
  14. ?ifdef __OBJ__
  15. #ifndef __FLAT__
  16.         ?ifdef __argc
  17.                 ?define __SIZEBUFCOMSTR 128+80
  18.         ?else
  19.                 ?ifdef __parsecommandline
  20.                         ?define __SIZEBUFCOMSTR 128
  21.                 ?endif
  22.         ?endif
  23.         ?ifdef __parsecommandline
  24.                 word __numparam;
  25.                 byte __bufcomstr[__SIZEBUFCOMSTR];
  26.         ?endif
  27.         ?ifdef __atexit
  28.                 word __numatexit;
  29.                 word __atexitproc[16];
  30.         ?endif
  31.         #ifdef __environ
  32.                 int environ;
  33.         #endif
  34.  
  35. __startupproc()
  36. inline
  37. {
  38.         ?ifdef __resizemem
  39.                 AX=SS;
  40.                 BX=ES;
  41.                 AX-=BX;
  42.                 BX=SP-1>>4+AX+1;
  43.                 AH=0x4a;
  44.                 $int 0x21
  45.         ?endif
  46.         #ifdef __environ
  47.                 environ=ESWORD[0x2C];
  48.         #endif
  49.         $CLD
  50.         ?ifdef __parsecommandline
  51.                 DI=#__bufcomstr;
  52.                 DX=0;
  53.                 ?ifdef __argc
  54.                         AH=0x30;
  55.                         $int 0x21
  56.                         IF(AL<3){
  57.                                 AX=0x20;
  58.                                 $stosw
  59.                         }
  60.                         ELSE{
  61.                                 $push DS
  62.                                 DS=ESWORD[0x2C];
  63.                                 SI=0;
  64.                                 do{
  65.                                         $lodsw
  66.                                         SI--;
  67.                                 }while(AX!=0);
  68.                                 $lodsw
  69.                                 $lodsb
  70.                                 ES=SS;
  71.                                 do{
  72.                                         $lodsb
  73.                                         $stosb
  74.                                 }while(AL!=0);
  75.                                 $pop DS
  76.                         }
  77.                         DX++;
  78.                 ?else
  79.                         ES=SS;
  80.                 ?endif
  81.                 SI=0x81;
  82. NEXTPAR:
  83.                 BL=1;
  84.                 do{
  85.                         $lodsb
  86.                 }while(AL==0x20);
  87. NEXTCHAR:
  88.                 IF(AL!=13){
  89.                         IF(AL!=0x20){
  90.                                 $stosb
  91.                                 $lodsb
  92.                                 DL+=BL;
  93.                                 BX=0;
  94.                                 GOTO NEXTCHAR;
  95.                         }
  96.                         AL=0;
  97.                         $stosb
  98.                         GOTO NEXTPAR;
  99.                 }
  100.                 ESWORD[#__numparam]=DX;
  101.                 AX=0;
  102.                 $stosw
  103.         ?else
  104.                 $push SS
  105.                 $pop ES
  106.         ?endif
  107.         $push SS
  108.         $pop DS
  109.         ?ifdef __atexit
  110.                 ?ifndef __parsecommandline
  111.                         AX=0;
  112.                 ?endif
  113.                 __numatexit=AX;
  114.         ?endif
  115.         main();
  116.         ?ifdef __atexit
  117. __startexit:
  118.                 $push AX
  119.                 for(;;){
  120.                         BX=__numatexit;
  121.                         BX--;
  122.                         IF(MINUSFLAG)BREAK;
  123.                         __numatexit=BX;
  124.                         BX+=BX;
  125.                         $call NEAR __atexitproc[BX]
  126.                 }
  127.                 $pop AX
  128.         ?endif
  129.         AH=0x4C;
  130.         $int 0x21
  131. }
  132. #endif //__FLAT__
  133. ?else   //__OBJ__
  134.  
  135. #ifdef __COM__
  136. //ä ©« ⨯  *.com
  137.         #ifdef __argc
  138.                 #define __SIZEBUFCOMSTR 128+80
  139.         #else
  140.                 #ifdef __parsecommandline
  141.                         #define __SIZEBUFCOMSTR 128
  142.                 #endif  //__parsecommandline
  143.         #endif  //__argc
  144.         #ifdef __parsecommandline
  145.                 word __numparam;
  146.                 byte __bufcomstr[__SIZEBUFCOMSTR];
  147.         #endif  //__parsecommandline
  148.         #ifdef __atexit
  149.                 word __numatexit;
  150.                 word __atexitproc[16];
  151.         #endif  //__atexit
  152.         #ifdef __environ
  153.                 int environ;
  154.         #endif
  155.  
  156. __startupproc()
  157. inline
  158. {
  159.         //¨­¨æ¨ «¨§ æ¨ï com-symbios
  160.         #ifdef __comsymbios
  161.                 #ifdef cpu==0
  162.                         $push AX,BX,CX,DX,DI,SI,BP,ES;
  163.                 #else
  164.                         $pusha
  165.                         $push ES
  166.                 #endif
  167.                 main();
  168.                 BX=__STARTPTR;
  169.                 DSWORD[BX]=__STARTVALW;
  170.                 DSBYTE[BX+2]=__STARTVALB;
  171.                 $pop ES
  172.                 #ifdef cpu==0
  173.                         $pop BP,SI,DI,DX,CX,BX,AX;
  174.                 #else
  175.                         $popa
  176.                 #endif
  177.                 goto __STARTPTR;
  178.                 #undef __STARTPTR
  179.                 #undef __STARTVALW
  180.                 #undef __STARTVALB
  181.                 #undef __comsymbios
  182.         #else
  183.         //®áâ «ì­ë¥ com-ä ©«ë
  184.                 #ifdef __clearpost
  185.                         @CLEARPOSTAREA(0);
  186.                 #endif  //__clearpost
  187.                 #ifdef __resizemem
  188.                         $pop AX
  189.                         $db 0xbc
  190. __stackval:
  191.                         $dw 0
  192.                         $push AX
  193.                         AH=0x4a;
  194.                         $db 0xbb
  195. __stackseg:
  196.                         $dw 0
  197.                         $int 0x21
  198.                         $DB 0x73
  199.                         #ifndef __resizemessage
  200.                                 #ifdef __ctrl_c
  201.                                         $DB 2
  202.                                 #else
  203.                                         $DB 1
  204.                                 #endif  //__ctrl_c
  205.                         #else
  206.                                 #ifdef __ctrl_c
  207.                                         $DB 9
  208.                                 #else
  209.                                         $DB 8
  210.                                 #endif  //__ctrl_c
  211.                                 AH=9;
  212.                                 DX=__RESIZEMESSAGE;
  213.                                 $int 0x21
  214.                         #endif  //__resizemessage
  215.                         $ret
  216.                 #endif  //__resizemem
  217.                 #ifdef __ctrl_c
  218.                         #ifndef __resizemem
  219.                                 GOTO SKIPIRET;
  220.                         #endif  //__resizemem
  221.                         $iret
  222. SKIPIRET:
  223.                         $push DS
  224.                         DS=0;
  225.                         DSWORD[0x8c]=SKIPIRET-1;
  226.                         DSWORD[0x8e]=CS;
  227.                         $pop DS
  228.                 #endif  //__ctrl_c
  229.                 #ifdef __environ
  230.                         environ=DSWORD[0x2C];
  231.                 #endif
  232.                 #ifdef __parsecommandline
  233. //                      ES=SS;
  234.                         DI=#__bufcomstr;
  235.                         DX=0;
  236.                         #ifdef __argc
  237.                                 AH=0x30;
  238.                                 $int 0x21
  239.                                 IF(AL<3){
  240.                                         AX=0x20;
  241.                                         $stosw
  242.                                 }
  243.                                 ELSE{
  244.                                         $push DS
  245.                                         DS=DSWORD[0x2C];
  246.                                         SI=0;
  247.                                         do{
  248.                                                 $lodsw
  249.                                                 SI--;
  250.                                         }while(AX!=0);
  251.                                         $lodsw
  252.                                         $lodsb
  253.                                         do{
  254.                                                 $lodsb
  255.                                                 $stosb
  256.                                         }while(AL!=0);
  257.                                         $pop DS
  258.                                 }
  259.                                 DX++;
  260.                         #endif
  261.                         SI=0x81;
  262. NEXTPAR:
  263.                         BL=1;
  264.                         do{
  265.                                 $lodsb
  266.                         }while(AL==0x20);
  267. NEXTCHAR:
  268.                         IF(AL!=13){
  269.                                 IF(AL!=0x20){
  270.                                         $stosb
  271.                                         $lodsb
  272.                                         DL+=BL;
  273.                                         BX=0;
  274.                                         GOTO NEXTCHAR;
  275.                                 }
  276.                                 AL=0;
  277.                                 $stosb
  278.                                 GOTO NEXTPAR;
  279.                         }
  280.                         __numparam=DX;
  281.                         AX=0;
  282.                         $stosw
  283.                 #endif
  284.                 #ifdef __atexit
  285.                         #ifndef __parsecommandline
  286.                                 AX=0;
  287.                         #endif
  288.                         __numatexit=AX;
  289.                         main();
  290. __startexit:
  291.                         for(;;){
  292.                                 BX=__numatexit;
  293.                                 BX--;
  294.                                 IF(MINUSFLAG)BREAK;
  295.                                 __numatexit=BX;
  296.                                 BX+=BX;
  297.                                 $call NEAR __atexitproc[BX]
  298.                         }
  299.                         $ret
  300.                 #else
  301.                         #ifndef __nonejmptomain
  302.                                 #ifdef __shortjmp
  303.                                         GOTO main;
  304.                                 #else
  305.                                         goto main;
  306.                                 #endif
  307.                         #endif
  308.                 #endif
  309.         #endif  //__comsymbios
  310. }
  311. #endif  //__COM__
  312.  
  313. //ä ©« ⨯  *.exe ¬®¤¥«ì small
  314. ?ifdef __EXE__
  315.         ?ifdef __argc
  316.                 ?define __SIZEBUFCOMSTR 128+80
  317.         ?else
  318.                 ?ifdef __parsecommandline
  319.                         ?define __SIZEBUFCOMSTR 128
  320.                 ?endif
  321.         ?endif
  322.         ?ifdef __parsecommandline
  323.                 word __numparam;
  324.                 byte __bufcomstr[__SIZEBUFCOMSTR];
  325.         ?endif
  326.         ?ifdef __atexit
  327.                 word __numatexit;
  328.                 word __atexitproc[16];
  329.         ?endif
  330.         #ifdef __environ
  331.                 int environ;
  332.         #endif
  333.  
  334. __startupproc()
  335. inline
  336. {
  337.         $CLD
  338.         #ifdef __environ
  339.                 environ=ESWORD[0x2C];
  340.         #endif
  341.         ?ifdef __parsecommandline
  342.                 DI=#__bufcomstr;
  343.                 DX=0;
  344.                 ?ifdef __argc
  345.                         AH=0x30;
  346.                         $int 0x21
  347.                         IF(AL<3){
  348.                                 AX=0x20;
  349.                                 $stosw
  350.                         }
  351.                         ELSE{
  352.                                 $push DS
  353.                                 DS=ESWORD[0x2C];
  354.                                 SI=0;
  355.                                 do{
  356.                                         $lodsw
  357.                                         SI--;
  358.                                 }while(AX!=0);
  359.                                 $lodsw
  360.                                 $lodsb
  361.                                 ES=SS;
  362.                                 do{
  363.                                         $lodsb
  364.                                         $stosb
  365.                                 }while(AL!=0);
  366.                                 $pop DS
  367.                         }
  368.                         DX++;
  369.                 ?else
  370.                         ES=SS;
  371.                 ?endif
  372.                 SI=0x81;
  373. NEXTPAR:
  374.                 BL=1;
  375.                 do{
  376.                         $lodsb
  377.                 }while(AL==0x20);
  378. NEXTCHAR:
  379.                 IF(AL!=13){
  380.                         IF(AL!=0x20){
  381.                                 $stosb
  382.                                 $lodsb
  383.                                 DL+=BL;
  384.                                 BX=0;
  385.                                 GOTO NEXTCHAR;
  386.                         }
  387.                         AL=0;
  388.                         $stosb
  389.                         GOTO NEXTPAR;
  390.                 }
  391.                 ESWORD[#__numparam]=DX;
  392.                 AX=0;
  393.                 $stosw
  394.         ?else
  395.                 $push SS
  396.                 $pop ES
  397.         ?endif
  398.         $push SS
  399.         $pop DS
  400.         #ifdef __clearpost
  401.                 @CLEARPOSTAREA(0);
  402.         #endif  //__clearpost
  403.         ?ifdef __atexit
  404.                 ?ifndef __parsecommandline
  405.                         #ifndef __clearpost
  406.                                 AX=0;
  407.                         #endif  //__clearpost
  408.                 ?endif
  409.                 __numatexit=AX;
  410.         ?endif
  411.         main();
  412.         ?ifdef __atexit
  413. __startexit:
  414.                 $push AX
  415.                 for(;;){
  416.                         BX=__numatexit;
  417.                         BX--;
  418.                         IF(MINUSFLAG)BREAK;
  419.                         __numatexit=BX;
  420.                         BX+=BX;
  421.                         $call NEAR __atexitproc[BX]
  422.                 }
  423.                 $pop AX
  424.         ?endif
  425.         AH=0x4C;
  426.         $int 0x21
  427. }
  428. ?endif  //__EXE__
  429.  
  430. //ä ©« ⨯  *.exe ¬®¤¥«ì tiny
  431. ?ifdef __TEXE__
  432.         ?ifdef __argc
  433.                 ?define __SIZEBUFCOMSTR 128+80
  434.         ?else
  435.                 ?ifdef __parsecommandline
  436.                         ?define __SIZEBUFCOMSTR 128
  437.                 ?endif
  438.         ?endif
  439.         ?ifdef __parsecommandline
  440.                 word __numparam;
  441.                 byte __bufcomstr[__SIZEBUFCOMSTR];
  442.         ?endif
  443.         ?ifdef __atexit
  444.                 word __numatexit;
  445.                 word __atexitproc[16];
  446.         ?endif
  447.         #ifdef __environ
  448.                 int environ;
  449.         #endif
  450.  
  451. __startupproc()
  452. inline
  453. {
  454.         $cld
  455.         #ifdef __clearpost
  456.                 @CLEARPOSTAREA(0);
  457.         #endif  //__clearpost
  458.         ?ifdef __resizemem
  459.                 #ifdef __clearpost
  460.                         $push AX
  461.                 #else
  462.                         ?ifdef cpu > 1
  463.                                 $push 0
  464.                         ?else
  465.                                 AX=0;
  466.                                 $push AX
  467.                         ?endif
  468.                 #endif  //__clearpost
  469.         ?endif
  470.         ?ifdef __ctrl_c
  471.                 GOTO SKIPIRET;
  472.                 $iret
  473. SKIPIRET:
  474.                 ES=0;
  475.                 ESWORD[0x8c]=SKIPIRET-1;
  476.                 ESWORD[0x8e]=CS;
  477.         ?endif  //__ctrl_c
  478.         #ifdef __environ
  479.                 environ=DSWORD[0x2C];
  480.         #endif
  481.         ?ifdef __parsecommandline
  482.                 ES=SS;
  483.                 DI=#__bufcomstr;
  484.                 DX=0;
  485.                 ?ifdef __argc
  486.                         AH=0x30;
  487.                         $int 0x21
  488.                         IF(AL<3){
  489.                                 AX=0x20;
  490.                                 $stosw
  491.                         }
  492.                         ELSE{
  493.                                 $push DS
  494.                                 DS=DSWORD[0x2C];
  495.                                 SI=0;
  496.                                 do{
  497.                                         $lodsw
  498.                                         SI--;
  499.                                 }while(AX!=0);
  500.                                 $lodsw
  501.                                 $lodsb
  502.                                 do{
  503.                                         $lodsb
  504.                                         $stosb
  505.                                 }while(AL!=0);
  506.                                 $pop DS
  507.                         }
  508.                         DX++;
  509.                 ?endif
  510.                 SI=0x81;
  511. NEXTPAR:
  512.                 BL=1;
  513.                 do{
  514.                         $lodsb
  515.                 }while(AL==0x20);
  516. NEXTCHAR:
  517.                 IF(AL!=13){
  518.                         IF(AL!=0x20){
  519.                                 $stosb
  520.                                 $lodsb
  521.                                 DL+=BL;
  522.                                 BX=0;
  523.                                 GOTO NEXTCHAR;
  524.                         }
  525.                         AL=0;
  526.                         $stosb
  527.                         GOTO NEXTPAR;
  528.                 }
  529.                 __numparam=DX;
  530.                 AX=0;
  531.                 $stosw
  532.         ?endif
  533.         ?ifdef __atexit
  534.                 ?ifndef __parsecommandline
  535.                         AX=0;
  536.                 ?endif
  537.                 __numatexit=AX;
  538.                 main();
  539. __startexit:
  540.                 $push AX
  541.                 for(;;){
  542.                         BX=__numatexit;
  543.                         BX--;
  544.                         IF(MINUSFLAG)BREAK;
  545.                         __numatexit=BX;
  546.                         BX+=BX;
  547.                         $call NEAR __atexitproc[BX]
  548.                 }
  549.                 $pop AX
  550.                 AH=0x4C;
  551.                 $int 0x21
  552.         ?else
  553.                 ?ifdef __shortjmp
  554.                         GOTO main;
  555.                 ?else
  556.                         goto main;
  557.                 ?endif
  558.         ?endif
  559. }
  560. ?endif  //__TEXE__
  561. #endif  //__OBJ__
  562.  
  563. //ä ©« ⨯  *.exe ¬®¤¥«ì DOS 32
  564. ?ifdef __DOS32__
  565.         ?ifdef __argc
  566.                 ?define __SIZEBUFCOMSTR 128+80
  567.         ?else
  568.                 ?ifdef __parsecommandline
  569.                         ?define __SIZEBUFCOMSTR 128
  570.                 ?endif
  571.         ?endif
  572.         ?ifdef __parsecommandline
  573.                 dword __numparam;
  574.                 byte __bufcomstr[__SIZEBUFCOMSTR];
  575.         ?endif
  576.         ?ifdef __atexit
  577.                 dword __numatexit;
  578.                 dword __atexitproc[16];
  579.         ?endif
  580.         #ifdef __environ
  581.                 int environ;
  582.         #endif
  583.  
  584. __startupproc()
  585. inline
  586. {
  587.         #ifdef __DPMIonly
  588. #code32 FALSE
  589.                 #ifdef __OBJ__
  590.                         #ifdef __resizemem
  591.                                 AX=SS;
  592.                                 BX=ES;
  593.                                 AX-=BX;
  594.                                 BX=SP-1>>4+AX+1;
  595.                                 AH=0x4a;
  596.                                 $int 0x21
  597.                         #endif
  598.                 #endif
  599.                 $CLD
  600.                 $push CS
  601.                 $pop DS
  602.                 AX=0x1687;
  603.                 $INT 0x2F;
  604.                 BL>>=1;
  605.                 IF(!CARRYFLAG)||(AX)GOTO DPMI_ERROR;
  606.                 $push ES,DI
  607.                 EAX=CS;
  608.                 BX=SS;
  609.                 BX-=AX;
  610.                 DSWORD[#__startupproc]=BX;
  611.                 EAX=EAX*16;
  612.                 DSDWORD[#GDT_CODE32+2]|=EAX;
  613.                 BX=SI;
  614.                 AH=0x48;
  615.                 $INT 0x21;
  616.                 ES=AX;
  617.                 AX=1;
  618.                 $call SSDWORD[ESP]
  619.                 IF(CARRYFLAG){
  620. DPMI_ERROR:
  621.                         ?ifdef __resizemessage
  622.                                 AH=9;
  623.                                 DX=__RESIZEMESSAGE;
  624.                                 $int 0x21
  625.                         ?endif  //__resizemessage
  626.                         AL=-1;
  627.                         GOTO EXI;
  628.                 }
  629.                 ES=DS;
  630.                 EDI=#GDT_CODE32;
  631.                 SI=SP;
  632.                 DX=2;
  633.                 loop(DX){
  634.                         AX=0;
  635.                         CX=1;
  636.                         $INT 0x31 //ALLOCATE LDT DESCRIPTOR
  637.                         DSWORD[SI]=AX; // SAVE SELECTOR
  638.                         BX><AX;
  639.                         AX=0xC;
  640.                         $INT 0x31 // SET DESCRIPTOR
  641.                         DSBYTE[DI+5]=0xF2;
  642.                         SI++;
  643.                         SI++;
  644.                 }
  645.                 AX=DSWORD[SI-2];
  646.                 DS=AX;
  647.                 ES=AX;
  648.                 SS=AX;
  649.                 $push dword #RETR
  650.                 $opsize
  651.                 $retf
  652. RETR:
  653. #code32 TRUE
  654.                 EAX=DSWORD[#__startupproc]<<4;
  655.                 ESP+=EAX;
  656.                 #ifdef __clearpost
  657.                         @CLEARPOSTAREA(0);
  658.                 #endif  //__clearpost
  659.                 #ifdef __atexit
  660.                         #ifndef __clearpost
  661.                                 EAX=0;
  662.                         #endif  //__clearpost
  663.                         __numatexit=EAX;
  664.                 #endif
  665.                 main();
  666. __startexit:
  667.                 #ifdef __atexit
  668.                         $push EAX
  669.                         for(;;){
  670.                                 EBX=__numatexit;
  671.                                 EBX--;
  672.                                 IF(MINUSFLAG)BREAK;
  673.                                 __numatexit=EBX;
  674.                                 $call DSDWORD[#__atexitproc+EBX*4]
  675.                         }
  676.                         $pop EAX
  677.                 #endif
  678. EXI:
  679.                 AH=0x4C;
  680.                 $int 0x21
  681.         #else //__DPMIonly
  682.                 #ifdef __useDOS4GW
  683.                         GOTO LABL1;
  684.                         $db "WATCOM"
  685. LABL1:
  686.                         #undef __useDOS4GW
  687.                 #endif  //__useDOS4GW
  688.                 #ifndef __nonejmptomain
  689.                         AX=0x901;
  690.                         $int 0x31
  691.                         $CLD
  692.                         #ifdef __environ
  693.                                 environ=ESWORD[0x2C];
  694.                         #endif
  695.                         #ifdef __parsecommandline
  696.                                 DS><ES;
  697.                                 EDI=#__bufcomstr;
  698.                                 EDX=0;
  699.                                 #ifdef __argc
  700.                                         $push DS
  701.                                         DS=DSWORD[0x2C];
  702.                                         ESI=0;
  703.                                         do{
  704.                                                 $lodsw
  705.                                                 ESI--;
  706.                                         }while(AX!=0);
  707.                                         ESI+=3;
  708.                                         do{
  709.                                                 $lodsb
  710.                                                 $stosb
  711.                                         }while(AL!=0);
  712.                                         EDX++;
  713.                                         $pop DS
  714.                                 #endif
  715.                                 ESI=0x81;
  716.                                 for(;;){
  717.                                         ECX=0;
  718.                                         BL=1;
  719.                                         do{
  720.                                                 $lodsb
  721.                                         }while(AL==0x20);
  722.                                         IF(AL=='"'){
  723.                                                 ECX++;
  724.                                                 $lodsb
  725.                                         }
  726. LAB2:
  727.                                         IF(AL==13)BREAK;
  728.                                         IF(ECX==0){
  729.                                                 IF(AL==' ')GOTO LAB4;
  730.                                         }
  731.                                         ELSE IF(AL=='"')GOTO LAB4;
  732.                                         $stosb
  733.                                         $lodsb
  734.                                         DL+=BL;
  735.                                         EBX=0;
  736.                                         GOTO LAB2;
  737. LAB4:
  738.                                         AL=0;
  739.                                         $stosb
  740.                                 }
  741.                                 EAX=0;
  742.                                 $stosw
  743.                                 DS=ES;
  744.                                 DSBYTE[#__numparam]=DL;
  745.                         #endif
  746.                         #ifdef __clearpost
  747.                                 @CLEARPOSTAREA(0);
  748.                         #endif  //__clearpost
  749.                         main();
  750. __startexit:
  751.                         #ifdef __atexit
  752.                                 $push EAX
  753.                                 for(;;){
  754.                                         EBX=__numatexit;
  755.                                         EBX--;
  756.                                         IF(MINUSFLAG)BREAK;
  757.                                         __numatexit=EBX;
  758.                                         $call DSDWORD[#__atexitproc+EBX*4]
  759.                                 }
  760.                                 $pop EAX
  761.                         #endif
  762.                         AH=0x4C;
  763.                         $int 0x21
  764.                 #endif  //__nonejmptomain
  765.         #endif //__DPMIonly
  766. }
  767.  
  768. #ifdef __DPMIonly
  769. word GDT_CODE32={-1,0,0xFA00,0xCF};
  770. #undef GDT_CODE32
  771. #undef __DPMIonly
  772. #endif
  773.  
  774. #endif  //__DOS32__
  775.  
  776. #ifdef __TLS__
  777. //ä ©« ⨯  *.exe ¯®¤ Windows
  778.         ?ifndef __DLL__
  779.                 dword hThisInst;
  780.                 #ifdef __CONSOLE__
  781.                         dword hStdOut;
  782.                 #endif
  783.                 ?ifdef __parsecommandline
  784.                         ?define __SIZEBUFCOMSTR 256
  785.                         dword __numparam;
  786.                         byte __bufcomstr[__SIZEBUFCOMSTR];
  787.                 ?else
  788.                         dword lpszArgs;
  789.                 ?endif
  790.                 ?ifdef __atexit
  791.                         dword __numatexit;
  792.                         dword __atexitproc[16];
  793.                 ?endif
  794.                 #ifdef __environ
  795.                         extern WINAPI "KERNEL32.dll"{
  796.                                 int GetEnvironmentStringsA();
  797.                         }
  798.                         int environ;
  799.                 #endif
  800.  
  801.                 extern WINAPI "KERNEL32.dll"
  802.                 {
  803.                         dword GetModuleHandleA();
  804.                         void  ExitProcess();
  805.                         dword GetCommandLineA();
  806.                         dword GetStdHandle();
  807.                 }
  808.         ?endif //__DLL__
  809.  
  810. __startupproc()
  811. inline
  812. {
  813.         ?ifdef __DLL__
  814.                 EAX=1;
  815.                 $ret 12
  816.         ?else
  817.                 #ifdef __clearpost
  818.                         @CLEARPOSTAREA(0);
  819.                         hThisInst=GetModuleHandleA(EAX);
  820.                 #else
  821.                         hThisInst=GetModuleHandleA(0);
  822.                 #endif  //__clearpost
  823.                 #ifdef __CONSOLE__
  824.                         hStdOut=GetStdHandle(-11);
  825.                 #endif
  826.                 GetCommandLineA();
  827.                 $cld
  828.                 ?ifdef __parsecommandline
  829.                         EDI=#__bufcomstr;
  830.                         EDX=0;
  831.                         ESI><EAX;
  832.                         for(;;){
  833.                                 ECX=0;
  834.                                 BL=1;
  835.                                 do{
  836.                                         $lodsb
  837.                                 }while(AL==0x20);
  838.                                 IF(AL=='"'){
  839.                                         ECX++;
  840.                                         $lodsb
  841.                                 }
  842. LAB2:
  843.                                 IF(AL==0)BREAK;
  844.                                 IF(ECX==0){
  845.                                         IF(AL==' ')GOTO LAB4;
  846.                                 }
  847.                                 ELSE IF(AL=='"')GOTO LAB4;
  848.                                 $stosb
  849.                                 $lodsb
  850.                                 DL+=BL;
  851.                                 EBX=0;
  852.                                 GOTO LAB2;
  853. LAB4:
  854.                                 AL=0;
  855.                                 $stosb
  856.                         }
  857.                         EAX=0;
  858.                         $stosw
  859.                         __numparam=EDX;
  860.                 ?else
  861.                         lpszArgs=EAX;
  862.                 ?endif
  863.                 #ifdef __environ;
  864.                         environ=GetEnvironmentStringsA();
  865.                 #endif
  866.                 main();
  867. __startexit:
  868.                 $push EAX
  869.                 ?ifdef __atexit
  870.                         for(;;){
  871.                                 EBX=__numatexit;
  872.                                 EBX--;
  873.                                 IF(MINUSFLAG)BREAK;
  874.                                 __numatexit=EBX;
  875.                                 $call DSDWORD[#__atexitproc+EBX*4]
  876.                         }
  877.                 ?endif
  878.                 ExitProcess();
  879.         ?endif
  880. }
  881. ?endif  //__TLS__
  882.  
  883. //£¥­¥à æ¨ï ROM
  884. ?ifdef __ROM__
  885.         ?ifdef __SMALL__
  886.                 dword bakstack=0;
  887.         ?endif
  888.  
  889. __startupproc()
  890. inline
  891. {
  892.         $DW 0xAA55
  893.         $DB __ROMSIZE/512
  894.         ?ifdef __SMALL__
  895.                 ES=__DATASEG;
  896.                 DI=0;
  897.                 $cld
  898.                 $cli
  899.                 $db 0xB8        //mov ax,stackstart
  900. __stackval:
  901.                 $dw 0
  902.                 AX><SP;
  903.                 $stosw
  904.                 AX=SS;
  905.                 $stosw
  906.                 AX=ES;
  907.                 SS=AX;
  908.                 $sti
  909.                 $db 0xBE        //mov si,startdata
  910. __startdata:
  911.                 $dw 0
  912.                 DS=CS;
  913.                 $db 0xBE        //mov cx,sizedata/2
  914. __sizedata:
  915.                 $dw 0
  916.                 $rep $movsw
  917.         ?else
  918.                 AX=__DATASEG;
  919.         ?endif
  920.         DS=AX;
  921.         main();
  922.         ?ifdef __SMALL__
  923.                 $cli
  924.                 SP=DSWORD[0];
  925.                 SS=DSWORD[2];
  926.                 $sti
  927.         ?endif
  928.         $retf
  929.         ?undef __ROMSIZE
  930.         ?undef __DATASEG
  931. }
  932. ?endif
  933.  
  934. //­ ç «ì­ë© ª®¤ ¤«ï ¤à ©¢¥à®¢ ãáâனáâ¢
  935. ?ifdef __SYS__
  936. __startupproc()
  937. inline
  938. {
  939.         $DD 0xFFFFFFFF
  940.         $DW __SYSATRIB
  941.         $DD 0x210016;
  942.         $DB __SYSNAME
  943.         $DD 0
  944.         $DB 0x2e,0x8c,0x06,0x14,0x00,0x2e,0x89,0x1e,0x12,0x00,0xcb,0xfc,0x1e,0x06;
  945.         ?ifdef cpu!=0
  946.                 $pusha
  947.         ?else
  948.                 $push AX,BX,CX,DX,DI,SI
  949.         ?endif
  950.         $push CS
  951.         $pop DS
  952.         ?ifdef __SYSSTACK
  953.                 $cli
  954.                 $DW 0x2689
  955.                 $DW #OLDSP
  956.                 $DW 0x168c
  957.                 $DW #OLDSP+2
  958.                 SS=CS;
  959.                 SP=#OLDSP+__SYSSTACK+4;
  960.                 $sti
  961.         ?endif
  962.         $db 0x8B,0x1E,0x12,0x00 //mov bx,[0x12]
  963.         $db 0x8E,0x06,0x14,0x00 //mov es,[0x14]
  964.         $DB 0x26,0x8a,0x47,0x02,0xd0,0xe0,0xb4,0x00;
  965.         DI=#__listcom;
  966.         $DB 0x01,0xc7,0xff,0x15,0x8b,0x1e,0x12,0x00,0x8e,0x06,0x14,0x00
  967.         $DB 0x0D,0x00,0x01      //or ax,0x100
  968.         $db 0x26,0x89,0x47,0x03 //mov es:[bx+3],ax
  969.         ?ifdef __SYSSTACK
  970.                 $cli
  971.                 $DW 0x168e;
  972.                 $DW #OLDSP+2
  973.                 $DW 0x268b;
  974.                 $DW #OLDSP
  975.                 $sti
  976.         ?endif
  977.         ?ifdef cpu!=0
  978.                 $popa
  979.         ?else
  980.                 $pop SI,DI,DX,CX,BX,AX
  981.         ?endif
  982.         $pop ES,DS
  983.         $retf
  984.         ?ifdef __SYSSTACK
  985.                 ?align
  986. OLDSP: $DD 0
  987.                 $DB __SYSSTACK dup 0
  988.         ?endif
  989. __listcom:
  990.         $DW __SYSNUMCOM dup 0
  991. }
  992.  
  993. NONE()
  994. {
  995.         AX=0x100;
  996.         ?undef __SYSATRIB
  997.         ?undef __SYSNAME
  998.         ?ifdef __SYSSTACK
  999.                 ?undef __SYSSTACK
  1000.         ?endif
  1001.         ?ifdef __SYSNUMCOM
  1002.                 ?undef __SYSNUMCOM
  1003.         ?endif
  1004. }
  1005. ?endif  //__SYS__
  1006.  
  1007. //ã¡à âì ­¥­ã¦­ë¥ ª®­áâ ­âë
  1008. ?ifdef __argc
  1009.         ?undef __argc
  1010. ?endif
  1011.  
  1012. ?ifdef __resizemem
  1013.         ?undef __resizemem
  1014. ?endif
  1015.  
  1016. ?ifdef __ctrl_c
  1017.         ?undef __ctrl_c
  1018. ?endif
  1019.  
  1020. ?ifdef __parsecommandline
  1021.         ?undef __parsecommandline
  1022. ?endif
  1023.  
  1024. ?ifdef __atexit
  1025.         ?undef __atexit
  1026. ?endif
  1027.  
  1028. ?ifdef __shortjmp
  1029.         ?undef __sortjmp
  1030. ?endif
  1031.  
  1032. ?ifdef __nonejmptomain
  1033.         ?undef __nonejmptomain
  1034. ?endif
  1035.  
  1036. #ifdef __environ
  1037.         #undef __environ
  1038. #endif
  1039.  
  1040. #ifdef __clearpost
  1041.         #undef __clearpost
  1042. #endif
  1043.  
  1044. #ifdef __SIZEBUFCOMSTR
  1045.         #undef __SIZEBUFCOMSTR
  1046. #endif
  1047.