@@ -1854,7 +1854,7 @@ static unsigned short loadfix_allocations[LOADFIX_NUMBLOCKS];
18541854static int loadfix_ii ;
18551855static unsigned loadfix_initialised ;
18561856
1857- static void loadfix_init (void )
1857+ static void loadfix_init (unsigned para )
18581858{
18591859 int allocated ;
18601860 unsigned short allocation , to_64kib , max , size ;
@@ -1873,7 +1873,7 @@ static void loadfix_init(void)
18731873#if DEBUG
18741874 printf ("LOADFIX: allocated block at %04Xh\n" , allocation );
18751875#endif
1876- if (allocation >= 0x1000 ) /* does it start above 64 KiB ? */
1876+ if (allocation >= para ) /* does it start above 64 KiB ? */
18771877 {
18781878 r .h .ah = 0x49 ;
18791879 r .x .es = allocation ;
@@ -1897,7 +1897,7 @@ static void loadfix_init(void)
18971897 /* Note that this expands the block to the maximum
18981898 * available size. */
18991899 max = r .x .bx ;
1900- to_64kib = 0x1000 - allocation ; /* note: does not underflow */
1900+ to_64kib = para - allocation ; /* note: does not underflow */
19011901 size = to_64kib < max ? to_64kib : max ;
19021902 r .x .bx = size ;
19031903 r .h .ah = 0x4A ;
@@ -1944,15 +1944,30 @@ static void loadfix_exit(void)
19441944
19451945static void perform_loadfix (const char * arg )
19461946 {
1947+ unsigned para = 0x1000 ;
19471948 if (!* arg )
19481949 {
19491950 cprintf ("loadfix: command name missing\r\n" );
19501951 reset_batfile_call_stack ();
19511952 return ;
19521953 }
1954+ if (* cmd_switch == '/' )
1955+ {
1956+ char * endp = NULL ;
1957+ switch (cmd_switch [1 ])
1958+ {
1959+ case 'P' :
1960+ case 'p' :
1961+ /* alloc up to specified para */
1962+ para = strtol (cmd_args + 3 , & endp , 0 );
1963+ if (endp && endp != cmd_args )
1964+ memmove (cmd_args , endp , strlen (endp ) + 1 );
1965+ break ;
1966+ }
1967+ }
19531968 shift_cmdline ();
19541969
1955- loadfix_init ();
1970+ loadfix_init (para );
19561971 loadfix_initialised = 1 ;
19571972
19581973 perform_external_cmd (false, false, cmd );
@@ -3185,7 +3200,7 @@ static void perform_external_cmd(int call, int lh, char *ext_cmd)
31853200 }
31863201
31873202 if (do_auto_loadfix )
3188- loadfix_init ();
3203+ loadfix_init (0x1000 );
31893204 lh_d = getenv ("SHELL_LOADHIGH_DEFAULT" );
31903205 if ((lh_d && lh_d [0 ] == '1' ))
31913206 lh ++ ;
0 commit comments