Subversion Repositories SvarDOS

Rev

Rev 1874 | Rev 1881 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1874 Rev 1875
Line 478... Line 478...
478
int 0x21        ; segment of the original PSP is in BX now
478
int 0x21        ; segment of the original PSP is in BX now
479
 
479
 
480
; set DS to the original PSP
480
; set DS to the original PSP
481
mov ds, bx
481
mov ds, bx
482
 
482
 
483
; load the pointer to the JFT, save it on stack, and set DS to the JFT seg
483
; load the pointer to the original JFT, set DS to the JFT seg and BX to offset
484
lds bx, [0x34]  ; loads offset at [0x34] into BX and segment at [0x36] into DS
484
lds bx, [0x34]  ; same as "mov bx, [0x34]" + "mov ds, [0x36]", but smaller
-
 
485
 
-
 
486
; save the original process stdin and stdout (at [BX]) on stack, as well as a
-
 
487
; dword pointer to the original JFT
485
                ; same as "mov bx, [0x34]" + "mov ds, [0x36]", but smaller
488
push word [bx]  ; original stdin and stdout (from the JFT at DS:BX)
486
push ds
489
push ds
487
push bx
490
push bx
488
 
491
 
489
; save the original process stdin and stdout (at [BX]) on stack
-
 
490
push word [bx]  ; original stdin and stdout (from the JFT)
-
 
491
 
-
 
492
; overwrite the original process stdin and stdout with stderr, in case stdout
492
; overwrite the original process stdin and stdout with stderr, in case stdout
493
; or stdin was redirected.
493
; or stdin was redirected.
494
mov dl, [bx+2]   ; the process stderr (3rd entry of the JFT in original PSP)
494
mov dl, [bx+2]   ; the process stderr (3rd entry of the JFT in original PSP)
495
mov dh, dl       ; dup DL so I can overwrite stdin and stdout with one write
495
mov dh, dl       ; dup DL so I can overwrite stdin and stdout with one write
496
mov [bx], dx
496
mov [bx], dx
Line 640... Line 640...
640
jmp CRITERR_ASKCHOICE   ; invalid answer -> ask again
640
jmp CRITERR_ASKCHOICE   ; invalid answer -> ask again
641
 
641
 
642
QUIT_WITH_AL_SET:
642
QUIT_WITH_AL_SET:
643
 
643
 
644
; restore original stdin/stdout handlers in the original JFT
644
; restore original stdin/stdout handlers in the original JFT
645
pop dx     ; original process' stdin and stdout handlers
645
pop bx        ; original process' JFT offset
646
pop bx     ; original process' JFT offset
646
pop ds        ; original process' JFT segment
647
pop ds     ; original process' JFT segment
647
pop word [bx] ; original process' stdin and stdout handlers
648
mov [bx], dx
-
 
649
 
648
 
650
; restore registers to their original values and quit the handler (AL is
649
; restore registers to their original values and quit the handler (AL is
651
; already set to a proper action value and AH does not matter since it was
650
; already set to a proper action value and AH does not matter since it was
652
; changed by the kernel's int 24h calling routine anyway)
651
; changed by the kernel's int 24h calling routine anyway)
653
popf
652
popf