Subversion Repositories SvarDOS

Rev

Rev 520 | Rev 537 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 520 Rev 529
Line 24... Line 24...
24
; DOS int 21h functions that I use require at least 40 bytes of stack under
24
; DOS int 21h functions that I use require at least 40 bytes of stack under
25
; DOS-C (FreeDOS) kernel, so here I reserve 64 bytes juste to be sure
25
; DOS-C (FreeDOS) kernel, so here I reserve 64 bytes juste to be sure
26
STACKBUF db "XXX  SVARCOM RMOD BY MATEUSZ VISTE  XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
26
STACKBUF db "XXX  SVARCOM RMOD BY MATEUSZ VISTE  XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
27
STACKPTR dw 0
27
STACKPTR dw 0
28
 
28
 
29
; exit code of last application
-
 
30
LEXCODE  dw 0    ; +4Ah
-
 
31
 
-
 
32
; offset of the COMSPEC variable in the environment block, 0 means "use
29
; offset of the COMSPEC variable in the environment block, 0 means "use
33
; boot drive". this value is patched by the transient part of COMMAND.COM
30
; boot drive". this value is patched by the transient part of COMMAND.COM
34
COMSPECPTR dw 0  ; +4Ch
31
COMSPECPTR dw 0  ; +4Ah
35
 
32
 
36
; fallback COMSPEC string used if no COMPSEC is present in the environment
33
; fallback COMSPEC string used if no COMPSEC is present in the environment
37
; drive. drive is patched by the transient part of COMMAND.COM
34
; drive. drive is patched by the transient part of COMMAND.COM
38
COMSPECBOOT db "@:\COMMAND.COM", 0 ; +4Eh
35
COMSPECBOOT db "@:\COMMAND.COM", 0 ; +4Ch
-
 
36
 
-
 
37
; exit code of last application
-
 
38
LEXCODE  db 0    ; +5Bh
39
 
39
 
40
; ExecParamRec used by INT 21h, AX=4b00 (load and execute program), 14 bytes:
40
; ExecParamRec used by INT 21h, AX=4b00 (load and execute program), 14 bytes:
41
;  offset  size  content
41
;  offset  size  content
42
;     +0     2   segment of environment for child (0 = current)
42
;     +0     2   segment of environment for child (0 = current)
43
;     +2     4   address of command line to place at PSP:0080
43
;     +2     4   address of command line to place at PSP:0080
44
;     +6     4   address of an FCB to be placed at PSP:005c
44
;     +6     4   address of an FCB to be placed at PSP:005c
45
;    +0Ah    4   address of an FCB to be placed at PSP:006c
45
;    +0Ah    4   address of an FCB to be placed at PSP:006c
46
EXEC_PARAM_REC db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0   ; +5Dh
46
EXEC_PARAM_REC db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0   ; +5Ch
47
 
47
 
48
; Program to execute, preset by SvarCOM (128 bytes, ASCIIZ)  ; +6Bh
48
; Program to execute, preset by SvarCOM (128 bytes, ASCIIZ)  ; +6Ah
49
EXECPROG dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
49
EXECPROG dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
50
 
50
 
51
; offset within EXECPROG for out and in filenames in case stdin or stdout
51
; offset within EXECPROG for out and in filenames in case stdin or stdout
52
; needs to be redirected (0xffff=no redirection)
52
; needs to be redirected (0xffff=no redirection)
53
REDIR_OUTFIL dw 0xffff    ; +EBh
53
REDIR_OUTFIL dw 0xffff    ; +EAh
54
REDIR_INFIL dw 0xffff     ; +EDh
54
REDIR_INFIL dw 0xffff     ; +ECh
55
REDIR_OUTAPPEND dw 0      ; +EFh
55
REDIR_OUTAPPEND dw 0      ; +EEh
56
 
56
 
57
skipsig:         ; +F1h
57
skipsig:         ; +F0h
58
 
58
 
59
; set up CS=DS=SS and point SP to my private stack buffer
59
; set up CS=DS=SS and point SP to my private stack buffer
60
mov ax, cs
60
mov ax, cs
61
mov ds, ax
61
mov ds, ax
62
mov es, ax
62
mov es, ax
Line 91... Line 91...
91
EXEC_COMMAND_COM:
91
EXEC_COMMAND_COM:
92
 
92
 
93
; collect the exit code of previous application
93
; collect the exit code of previous application
94
mov ah, 0x4D
94
mov ah, 0x4D
95
int 0x21
95
int 0x21
96
xor ah, ah          ; clear out termination status, I only want the exit code
-
 
97
mov [LEXCODE], ax
96
mov [LEXCODE], al
98
 
97
 
99
; zero out the exec param block (14 bytes)
98
; zero out the exec param block (14 bytes)
100
mov al, 0              ; byte to write
99
mov al, 0              ; byte to write
101
mov cx, 14             ; how many times
100
mov cx, 14             ; how many times
102
mov di, EXEC_PARAM_REC ; ES:DI = destination
101
mov di, EXEC_PARAM_REC ; ES:DI = destination