Subversion Repositories SvarDOS

Rev

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

Rev 1871 Rev 1872
Line 469... Line 469...
469
push ds
469
push ds
470
pushf
470
pushf
471
 
471
 
472
mov ch, ah      ; backup AH flags into CH
472
mov ch, ah      ; backup AH flags into CH
473
 
473
 
474
; get the segment to the original process PSP and save it on stack
474
; Get the segment to the original process PSP. Using int 21h,ah=62h should be
475
; using int 21h,ah=62h should be safe, RBIL says: "This function does not use
475
; safe, RBIL says: "This function does not use any of the DOS-internal stacks
476
; any of the DOS-internal stacks and may thus be called at any time, even
476
; and may thus be called at any time, even during another INT 21h call"
477
; during another INT 21h call."
-
 
478
mov ah, 0x62
477
mov ah, 0x62
479
int 0x21
478
int 0x21        ; segment of the original PSP is in BX now
480
push bx
-
 
481
 
479
 
482
; set DS to original PSP
480
; set DS to the original PSP
-
 
481
mov ds, bx
-
 
482
 
-
 
483
; load the pointer to the JFT and save it on stack
-
 
484
mov bx, [0x34] ; offset
-
 
485
mov dx, [0x36] ; seg
-
 
486
push dx
483
push bx
487
push bx
-
 
488
 
-
 
489
; switch DS to the JFT seg
484
pop ds
490
mov ds, dx
485
 
491
 
486
; save the original process stdin and stdout on stack
492
; save the original process stdin and stdout on stack
487
mov dx, [0x18]   ; original stdin and stdout (from the JFT)
493
mov dx, [bx]   ; original stdin and stdout (from the JFT)
488
push dx
494
push dx
489
 
495
 
490
; overwrite the original process stdin and stdout with stderr, in case stdout
496
; overwrite the original process stdin and stdout with stderr, in case stdout
491
; or stdin was redirected.
497
; or stdin was redirected.
492
mov dl, [0x1a]   ; the process stderr (3rd entry of the JFT in original PSP)
498
mov dl, [bx+2]   ; the process stderr (3rd entry of the JFT in original PSP)
493
mov dh, dl
499
mov dh, dl
494
mov [0x18], dx
500
mov [bx], dx
495
 
501
 
496
; set DS to myself so I can reach (and display) my messages
502
; set DS to myself so I can reach (and display) my messages
497
push cs
503
push cs
498
pop ds
504
pop ds
499
 
505
 
Line 637... Line 643...
637
 
643
 
638
jmp CRITERR_ASKCHOICE   ; invalid answer -> ask again
644
jmp CRITERR_ASKCHOICE   ; invalid answer -> ask again
639
 
645
 
640
QUIT_WITH_AL_SET:
646
QUIT_WITH_AL_SET:
641
 
647
 
642
; restore original stdin/stdout handlers in the original PSP
648
; restore original stdin/stdout handlers in the original JFT
643
; (saved on stack as STDINSTDOUT PSPSEG"
-
 
644
pop dx    ; original process' stdin and stdout handlers (dh=stdin / dl=stdout)
649
pop dx     ; original process' stdin and stdout handlers
645
pop bx    ; original process' PSP
650
pop bx     ; original process' JFT offset
646
push bx
-
 
647
pop ds    ; set DS to the original process so I can access its PSP
651
pop ds     ; original process' JFT segment
648
mov [0x18], dx
652
mov [bx], dx
649
 
653
 
650
; restore registers and quit the handler
654
; restore registers to their original values and quit the handler (AL is
-
 
655
; already set to a proper action value and AH does not matter since it was
-
 
656
; changed by the kernel's int 24h calling routine anyway)
651
popf
657
popf
652
pop ds
658
pop ds
653
pop dx
659
pop dx
654
pop cx
660
pop cx
655
pop bx
661
pop bx