Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 1729 → Rev 1730

/svarcom/trunk/cmd/loadhigh.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021-2022 Mateusz Viste
* Copyright (C) 2021-2024 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
29,7 → 29,14
static enum cmd_result cmd_loadhigh(struct cmd_funcparam *p) {
 
if ((p->argc == 0) || (imatch(p->argv[0], "/?"))) {
nls_outputnl(0,9); /* "This command is not implemented" */
nls_outputnl(40,0);
outputnl("");
output("LOADHIGH ");
nls_outputnl(40,1);
output("LH ");
nls_outputnl(40,1);
outputnl("");
nls_outputnl(40,2);
return(CMD_OK);
}
 
38,5 → 45,5
memmove((void *)p->cmdline, p->cmdline + p->argoffset, strlen(p->cmdline + p->argoffset) + 1);
}
 
return(CMD_CHANGED);
return(CMD_CHANGED_BY_LH);
}
/svarcom/trunk/cmd.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021-2022 Mateusz Viste
* Copyright (C) 2021-2024 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
30,6 → 30,7
* CMD_FAIL command ended in error
* CMD_CHANGED command-line has been modified (used by IF)
* CMD_CHANGED_BY_CALL command-line has been modified by CALL
* CMD_CHANGED_BY_LH command-line has been modified by LOADHIGH
* CMD_NOTFOUND command unrecognized
*/
 
/svarcom/trunk/cmd.h
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021-2022 Mateusz Viste
* Copyright (C) 2021-2024 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
29,11 → 29,12
 
/* what cmd_process may return */
enum cmd_result {
CMD_OK, /* command executed and succeeded */
CMD_FAIL, /* command executed and failed */
CMD_NOTFOUND, /* no such command (not an internal command) */
CMD_CHANGED, /* command-line transformed, please reparse it */
CMD_CHANGED_BY_CALL /* command-line transformed by CALL */
CMD_OK, /* command executed and succeeded */
CMD_FAIL, /* command executed and failed */
CMD_NOTFOUND, /* no such command (not an internal command) */
CMD_CHANGED, /* command-line transformed, please reparse it */
CMD_CHANGED_BY_CALL, /* command-line transformed by CALL */
CMD_CHANGED_BY_LH /* command-line transformed by LOADHIGH */
};
 
/* process internal commands */
/svarcom/trunk/command.c
46,7 → 46,7
* with what I think it is.
* *** INCREMENT THIS AT EACH NEW SVARCOM RELEASE! ***
* (or at least whenever RMOD's struct is changed) */
#define BYTE_VERSION 4
#define BYTE_VERSION 5
 
 
struct config {
402,6 → 402,7
/* a few internal flags */
#define DELETE_STDIN_FILE 1
#define CALL_FLAG 2
#define LOADHIGH_FLAG 4
 
static void run_as_external(char *buff, const char *cmdline, unsigned short envseg, struct rmod_props far *rmod, struct redir_data *redir, unsigned char flags) {
char *cmdfile = buff + 512;
581,6 → 582,12
 
/* set up rmod to execute the command */
 
/* loadhigh? */
if (flags & LOADHIGH_FLAG) {
unsigned char far *farptr = MK_FP(rmod->rmodseg, RMOD_OFFSET_EXEC_LH);
*farptr = 1;
}
 
ExecParam->envseg = envseg;
ExecParam->cmdtail = (unsigned long)MK_FP(rmod->rmodseg, 0x80); /* farptr, must be in PSP format (lenbyte args \r) */
/* far pointers to unopened FCB entries (stored in RMOD's own PSP) */
1156,6 → 1163,9
/* the distinction is important since it changes the way batch files are processed */
flags |= CALL_FLAG;
goto EXEC_CMDLINE;
} else if (cmdres == CMD_CHANGED_BY_LH) { /* cmdline changed *specifically* by LH */
flags |= LOADHIGH_FLAG;
goto EXEC_CMDLINE;
} else if (cmdres == CMD_NOTFOUND) {
/* this was not an internal command, try matching an external command */
run_as_external(BUFFER, cmdline, *rmod_envseg, rmod, &redirprops, flags);
1173,6 → 1183,7
/* reset one-time only flags */
flags &= ~CALL_FLAG;
flags &= ~FLAG_STEPBYSTEP;
flags &= ~LOADHIGH_FLAG;
 
/* repeat unless /C was asked - but always finish running an ongoing batch
* file (otherwise only first BAT command would be executed with /C) */
/svarcom/trunk/history.txt
13,6 → 13,7
- command-line parsing modified to work around a DN bug. Thanks to bttr for
reporting the issue and to ECM for locating the root cause.
ref: https://github.com/SvarDOS/bugz/issues/67
- implemented the internal LOADHIGH command
 
 
=== ver 2024.1 (17.01.2024) ==================================================
/svarcom/trunk/lang/en-utf8.txt
255,6 → 255,12
39.0:Returns a fully qualified path or filename.
39.1:TRUENAME [[drive:][path][filename]]
 
# LOADHIGH
40.0:Loads a program into the upper memory area.
40.1:[drive:][path]filename [parameters]
40.2:parameters: any arguments required by the program you want to load.
 
 
# DOS ERRORS
255.1:Function number invalid
255.2:File not found
/svarcom/trunk/lang/pl-utf8.txt
3,7 → 3,7
#
# Language...: Polish
# Author.....: Mateusz Viste
# Last update: 17 Feb 2023
# Last update: 16 Feb 2024
#
 
# GENERIC MESSAGES USED BY MULTIPLE INTERNAL COMMANDS
255,6 → 255,12
39.0:Zwraca w pełni kwalifikowaną ścieżkę lub nazwę pliku.
39.1:TRUENAME [dysk:][ścieżka]nazwapliku
 
# LOADHIGH
40.0:Ładuje program do pamięci wyższej.
40.1:[dysk:][ścieżka]nazwapliku [parametry]
40.2:parametry: argumenty wymagane przez program który chcesz załadować.
 
 
# DOS ERRORS
255.1:Błędny numer funkcji
255.2:Nie znaleziono pliku
/svarcom/trunk/rmod.asm
1,7 → 1,7
;
; rmod - resident module of the SvarCOM command interpreter (NASM code)
;
; Copyright (C) 2021-2022 Mateusz Viste
; Copyright (C) 2021-2024 Mateusz Viste
; MIT license
;
; this is installed in memory by the transient part of SvarCOM. it has only
65,11 → 65,15
; MUST contain the 1st char of
; REDIR_INFIL!
 
EXEC_LH: db 0 ; +271h EXECPROG to be loaded high?
ORIG_UMBLINKSTATE: db 0 ; +272h
ORIG_ALLOCSTRAT: db 0 ; +273h
 
; CTRL+BREAK (int 23h) handler
; According to the TechHelp! Manual: "If you want to abort (exit to the parent
; process), then set the carry flag and return via a FAR RET. This causes DOS
; to perform normal cleanup and exit to the parent." (otherwise use iret)
BREAK_HANDLER: ; +271h
BREAK_HANDLER: ; +274h
stc
retf
 
78,7 → 82,7
xor ax, ax
iret
 
skipsig: ; +276h
skipsig: ; +279h
 
; set up CS=DS=SS and point SP to my private stack buffer
mov ax, cs
113,6 → 117,30
;mov bx, cs
;int 0x21
 
 
; LOADHIGH?
cmp [EXEC_LH], byte 0
je NO_LOADHIGH
; SAVE CURRENT UMB LINK STATE
mov ax, 0x5802 ; GET UMB LINK STATE
int 0x21
mov [ORIG_UMBLINKSTATE], al
; SAVE CURRENT ALLOCATION STRATEGY
mov ax, 0x5800
int 0x21
mov [ORIG_ALLOCSTRAT], al
 
; LOADHIGH: link in the UMB memory chain for enabling high-memory allocation
; (and save initial status on stack)
mov ax, 0x5803 ; SET UMB LINK STATE */
mov bx, 1
int 0x21
; set strategy to 'last fit, try high then low memory'
mov ax, 0x5801
mov bx, 0x0082
int 0x21
NO_LOADHIGH:
 
; exec an application preset (by SvarCOM) in the ExecParamRec
mov ax, 0x4B00 ; DOS 2+ - load & execute program
mov dx, EXECPROG ; DS:DX - ASCIZ program name (preset at PSP[already)
120,8 → 148,26
int 0x21
mov [cs:EXECPROG], byte 0 ; do not run app again (+DS might have been changed)
 
jmp short skipsig ; enforce valid ds/ss/etc (can be lost after int 21,4b)
; go to start if nothing else to do (this will enforce valid ds/ss/etc)
cmp [cs:EXEC_LH], byte 0
je skipsig
 
; restore UMB link state and alloc strategy to original values (but make sure
; to base it on CS since DS might have been trashed by the program)
mov ax, 0x5803
xor bx, bx
mov bl, [cs:ORIG_UMBLINKSTATE]
int 0x21
; restore original memory allocation strategy
mov ax, 0x5801
mov bl, [cs:ORIG_ALLOCSTRAT]
int 0x21
; turn off the LH flag
mov [cs:EXEC_LH], byte 0
 
 
jmp skipsig ; enforce valid ds/ss/etc (can be lost after int 21,4b)
 
EXEC_COMMAND_COM:
 
; collect the exit code of previous application
136,6 → 182,9
cld ; stosb must move forward
rep stosb ; repeat cx times
 
; zero out the LH flag
mov [EXEC_LH], byte 0
 
; preset the default COMSPEC pointer to ES:DX (ES is already set to DS)
mov dx, COMSPECBOOT
 
/svarcom/trunk/rmodinit.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021-2022 Mateusz Viste
* Copyright (C) 2021-2024 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
/svarcom/trunk/rmodinit.h
79,8 → 79,11
#define RMOD_OFFSET_STDOUTFILE (0x100 + 0x1EE)
#define RMOD_OFFSET_STDOUTAPP (0x100 + 0x26E)
#define RMOD_OFFSET_STDIN_DEL (0x100 + 0x270)
#define RMOD_OFFSET_BRKHANDLER (0x100 + 0x271)
#define RMOD_OFFSET_ROUTINE (0x100 + 0x276)
#define RMOD_OFFSET_EXEC_LH (0x100 + 0x271)
#define RMOD_OFFSET_ORIGUMBLNK (0x100 + 0x272)
#define RMOD_OFFSET_ORIGALLOCS (0x100 + 0x273)
#define RMOD_OFFSET_BRKHANDLER (0x100 + 0x274)
#define RMOD_OFFSET_ROUTINE (0x100 + 0x279)
 
struct rmod_props far *rmod_install(unsigned short envsize, unsigned char *rmodcore, unsigned short rmodcore_len);
struct rmod_props far *rmod_find(unsigned short rmodcore_len);