Subversion Repositories SvarDOS

Rev

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

Rev 1868 Rev 1869
Line 467... Line 467...
467
push cx
467
push cx
468
push dx
468
push dx
469
push ds
469
push ds
470
pushf
470
pushf
471
 
471
 
-
 
472
mov ch, ah      ; backup AH flags into CH
-
 
473
 
-
 
474
; get the segment to the original process PSP and save it on stack
-
 
475
; using int 21h,ah=62h should be safe, RBIL says: "This function does not use
-
 
476
; any of the DOS-internal stacks and may thus be called at any time, even
-
 
477
; during another INT 21h call."
-
 
478
mov ah, 0x62
-
 
479
int 0x21
-
 
480
push bx
-
 
481
 
472
; set DS to myself
482
; set DS to original PSP
-
 
483
push bx
-
 
484
pop ds
-
 
485
 
-
 
486
; save the original process stdin and stdout on stack
-
 
487
mov dh, [0x18]   ; original stdin (from the JFT)
-
 
488
mov dl, [0x19]   ; original stdout (from the JFT)
-
 
489
push dx
-
 
490
 
-
 
491
; overwrite the original process stdin and stdout with stderr, in case stdout
-
 
492
; or stdin was redirected.
-
 
493
mov dl, [0x1f]   ; the process stderr (3rd entry of the JFT in original PSP)
-
 
494
mov [0x18], dl
-
 
495
mov [0x19], dl
-
 
496
 
-
 
497
; set DS to myself so I can reach (and display) my messages
473
push cs
498
push cs
474
pop ds
499
pop ds
475
 
500
 
476
; is this a DISK error?
501
; is this a DISK error?
477
test ah, 0x80
502
test ch, 0x80
478
jz DISKERROR
503
jz DISKERROR
479
; non-disk error: output "CRITICAL ERROR #XXX SYSTEM HALTED" and freeze
504
; non-disk error: output "CRITICAL ERROR #XXX SYSTEM HALTED" and freeze
480
; update the crit string so it contains the proper error code
505
; update the crit string so it contains the proper error code
481
mov bx, CRITERRSYST+1
506
mov bx, CRITERRSYST+1
482
mov ax, di
507
mov ax, di
Line 511... Line 536...
511
 
536
 
512
DISKERROR:
537
DISKERROR:
513
; disk errors produce this message:
538
; disk errors produce this message:
514
; A: - READ|WRITE FAILURE
539
; A: - READ|WRITE FAILURE
515
; (A)bort, (R)etry, (I)gnore, (F)ail
540
; (A)bort, (R)etry, (I)gnore, (F)ail
516
mov ch, ah      ; backup AH flags into CH
-
 
517
add al, 'A'
541
add al, 'A'
518
mov [CRITERRDISK], al
542
mov [CRITERRDISK], al
519
mov ah, 0x09
543
mov ah, 0x09
520
mov dx, CRITERRDISK
544
mov dx, CRITERRDISK
521
int 0x21
545
int 0x21
Line 614... Line 638...
614
 
638
 
615
jmp CRITERR_ASKCHOICE   ; invalid answer -> ask again
639
jmp CRITERR_ASKCHOICE   ; invalid answer -> ask again
616
 
640
 
617
QUIT_WITH_AL_SET:
641
QUIT_WITH_AL_SET:
618
 
642
 
-
 
643
; restore original stdin/stdout handlers in the original PSP
-
 
644
; (saved on stack as STDINSTDOUT PSPSEG"
-
 
645
pop dx    ; original process' stdin and stdout handlers (dh=stdin / dl=stdout)
-
 
646
pop bx    ; original process' PSP
-
 
647
push bx
-
 
648
pop ds    ; set DS to the original process so I can access its PSP
-
 
649
mov [0x18], dh
-
 
650
mov [0x19], dl
-
 
651
 
619
; restore registers and quit the handler
652
; restore registers and quit the handler
620
popf
653
popf
621
pop ds
654
pop ds
622
pop dx
655
pop dx
623
pop cx
656
pop cx