Subversion Repositories SvarDOS

Rev

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

Rev 529 Rev 537
Line 1... Line 1...
1
;
1
;
2
; rmod - resident module of the SvarCOM command interpreter
2
; rmod - resident module of the SvarCOM command interpreter (NASM code)
3
;
3
;
4
; Copyright (C) 2021 Mateusz Viste
4
; Copyright (C) 2021 Mateusz Viste
5
; MIT license
5
; MIT license
6
;
6
;
7
; this is installed in memory by the transient part of SvarCOM. it has only
7
; this is installed in memory by the transient part of SvarCOM. it has only
Line 52... Line 52...
52
; needs to be redirected (0xffff=no redirection)
52
; needs to be redirected (0xffff=no redirection)
53
REDIR_OUTFIL dw 0xffff    ; +EAh
53
REDIR_OUTFIL dw 0xffff    ; +EAh
54
REDIR_INFIL dw 0xffff     ; +ECh
54
REDIR_INFIL dw 0xffff     ; +ECh
55
REDIR_OUTAPPEND dw 0      ; +EEh
55
REDIR_OUTAPPEND dw 0      ; +EEh
56
 
56
 
-
 
57
; CTRL+BREAK (int 23h) handler
-
 
58
; According to the TechHelp! Manual: "If you want to abort (exit to the parent
-
 
59
; process), then set the carry flag and return via a FAR RET. This causes DOS
-
 
60
; to perform normal cleanup and exit to the parent." (otherwise use iret)
-
 
61
BREAK_HANDLER:            ; +F0h
-
 
62
stc
-
 
63
retf
-
 
64
 
-
 
65
 
57
skipsig:         ; +F0h
66
skipsig:                  ; +F2h
58
 
67
 
59
; set up CS=DS=SS and point SP to my private stack buffer
68
; set up CS=DS=SS and point SP to my private stack buffer
60
mov ax, cs
69
mov ax, cs
61
mov ds, ax
70
mov ds, ax
62
mov es, ax
71
mov es, ax
63
mov ss, ax
72
mov ss, ax
64
mov sp, STACKPTR
73
mov sp, STACKPTR
65
 
74
 
-
 
75
; set up myself as break handler
-
 
76
mov ax, 0x2523  ; set int vector 23h
-
 
77
mov dx, BREAK_HANDLER
-
 
78
int 0x21
-
 
79
 
66
; revert stdin/stdout redirections (if any) to their initial state
80
; revert stdin/stdout redirections (if any) to their initial state
67
call REVERT_REDIR_IF_ANY
81
call REVERT_REDIR_IF_ANY
68
 
82
 
69
; redirect stdout if required
83
; redirect stdout if required
70
call REDIR_OUTFILE_IF_REQUIRED
84
call REDIR_OUTFILE_IF_REQUIRED