]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/EDLIN/EDLMES.ASM
3 ;======================= START OF SPECIFICATIONS =========================
5 ; MODULE NAME: EDLMES.SAL
7 ; DESCRIPTIVE NAME: MESSAGE RETRIEVER INTERFACE MODULE
9 ; FUNCTION: THIS MODULE PROVIDES AN INTERFACE FOR THE MODULES THAT ARE
10 ; NEEDED TO INVOKE THE MESSAGE RETRIEVER.
14 ; INPUT: OFFSET CARRIED IN DX TO APPLICABLE MESSAGE TABLE
16 ; EXIT NORMAL: NO CARRY
20 ; INTERNAL REFERENCES:
22 ; ROUTINE: PRINTF - PROVIDES THE ORIGINAL INTERFACE FOR THE ORIGINAL
23 ; PRINTF USED PRIOR TO VERSION 4.00. PRINTS MESSAGES.
25 ; DISP_MESSAGE - BUILDS THE REGISTERS NECESSARY FOR INVOCATION
26 ; OF THE MESSAGE RETRIEVER, BASED ON THE TABLE
29 ; DISP_FATAL - INVOKED IF AN ERROR OCCURS (CARRY) IN THE
30 ; MESSAGE RETRIEVER. IT DISPLAYS THE APPROPRIATE
33 ; EXTERNAL REFERENCES:
35 ; ROUTINE: SYSLOADMSG - LOAD MESSAGES FOR THE MESSAGE RETRIEVER
36 ; SYSDISPMSG - DISPLAYS THE REQUESTED MESSAGE
38 ; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS
39 ; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE
43 ; AN000 VERSION DOS 4.00 - IMPLEMENTATION OF MESSAGE RETRIEVER
45 ; COPYRIGHT: "MS DOS EDLIN UTILITY"
46 ; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft"
47 ; "LICENSED MATERIAL - PROPERTY OF Microsoft "
49 ; MICROSOFT REVISION HISTORY
51 ; MODIFIED BY: AARON R
54 ;======================= END OF SPECIFICATIONS ===========================
58 include sysmsg
.inc ;an000;message retriever
60 msg_utilname
<EDLIN
> ;an000;EDLIN messages
62 ;-----------------------------------------------------------------------;
64 ; Done for Vers 2.00 (rev 9) by Aaron R ;
65 ; Update for rev. 11 by M.A. U ;
66 ; Printf for 2.5 by Nancy P ;
68 ;-----------------------------------------------------------------------;
70 ;=========================================================================
72 ;=========================================================================
74 fatal_error equ
30 ;an000;fatal message handler
75 unlim_width equ
00h ;an000;unlimited output width
76 pad_blank equ 20h
;an000;blank pad
77 pre_load equ
00h ;an000;normal pre-load
81 message_table
struc ;an000;struc for message table
83 entry1 dw 0 ;an000;message number
84 entry2 db 0 ;an000;message type
85 entry3 dw 0 ;an000;display handle
86 entry4 dw 0 ;an000;pointer to sublist
87 entry5 dw 0 ;an000;substitution count
88 entry6 db 0 ;an000;use keyb input?
89 entry7 dw 0 ;an000;keyb buffer to use
91 message_table ends
;an000;end struc
93 ;=========================================================================
94 ; macro disp_message: this macro takes a pointer to a message table
95 ; and displays the applicable message based on
96 ; the table's contents.
97 ; this is to provide an interface into the module
98 ; of the message retriever, SYSDISPMSG.
101 ;=========================================================================
103 disp_message
macro tbl
;an000;display message macro
111 push tbl
;an000;exchange tbl with si
112 pop si ;an000;exchanged
114 mov ax,[si].entry1
;an000;move message number
115 mov bx,[si].entry3
;an000;display handle
116 mov cx,[si].entry5
;an000;number of subs
117 mov dl,[si].entry6
;an000;function type
118 mov di,[si].entry7
;an000;input buffer if appl.
119 mov dh,[si].entry2
;an000;message type
120 mov si,[si].entry4
;an000;sublist
122 call sysdispmsg
;an000;display the message
124 pop si ;an000;restore affected regs
130 endm
;an000;end macro disp_message
132 ;=========================================================================
133 ; macro disp_message: end macro
134 ;=========================================================================
136 CODE SEGMENT PUBLIC BYTE
139 CONST
SEGMENT PUBLIC BYTE
145 DATA SEGMENT PUBLIC BYTE
151 DG GROUP
CODE,CONST
,cstack
,DATA
153 code segment public byte ;an000;code segment
154 assume
cs:dg
,ds:dg
,es:dg
,ss:CStack
;an000;
156 public printf
;an000;share printf
157 public disp_fatal
;an000;fatal error display
158 public pre_load_message
;an000;message loader
161 msg_services
<MSGDATA
> ;an000;
164 ;======================= sysmsg.inc invocation ===========================
166 ; include sysmsg.inc - message retriever services
179 ;=========================================================================
183 msg_services
<LOADmsg
> ;an000;no version check
184 msg_services
<DISPLAYmsg
,CHARmsg
,NUMmsg
,INPUTmsg
> ;an000;display messages
185 msg_services
<EDLIN
.CLA
,EDLIN
.CLB
,EDLIN
.CLC> ;an000;message types
186 msg_services
<EDLIN
.CL1
,EDLIN
.CL2
> ;an000;message types
187 msg_services
<EDLIN
.CTL
> ;an000;
191 ;=========================================================================
192 ; printf: printf is a replacement of the printf procedure used in DOS
193 ; releases prior to 4.00. printf invokes the macro disp_message
194 ; to display a message through the new message handler. the
195 ; interface into printf will continue to be a pointer to a message
196 ; passed in DX. the pointer is pointing to more than a message
197 ; now. it is pointing to a table for that message containing
198 ; all relevant information for printing the message. the macro
199 ; disp_message operates on these tables.
202 ;=========================================================================
204 printf proc
near ;an000;printf procedure
206 disp_message
dx ;an000;display a message
207 ; $if c ;an000;if an error occurred
209 call disp_fatal
;an000;display the fatal error
213 ret ;an000;return to caller
215 printf endp
;an000;end printf proc
218 ;=========================================================================
219 ; disp_fatal: this routine displays a fatal error message in the event
220 ; an error occurred in disp_message.
223 ;=========================================================================
225 disp_fatal proc
near ;an000;fatal error message
227 mov ax,fatal_error
;an000;fatal_error number
228 mov bx,stdout
;an000;print to console
229 mov cx,0 ;an000;no parameters
230 mov dl,no_input
;an000;no keyboard input
231 mov dh,UTILITY_MSG_CLASS
;an000;utility messages
233 call sysdispmsg
;an000;display fatal error
235 ret ;an000;return to caller
237 disp_fatal endp
;an000;end disp_fatal proc
239 ;=========================================================================
240 ; PRE_LOAD_MESSAGE : This routine provides access to the messages required
241 ; by EDLIN. This routine will report if the load was
242 ; successful. An unsuccessful load will cause EDLIN
243 ; to terminate with an appropriate error message.
246 ;=========================================================================
248 PRE_LOAD_MESSAGE proc
near ;an000;pre-load messages
251 call SYSLOADMSG
;an000;invoke loader
253 ; $if c ;an000;if an error
255 pushf ;an000;save flags
256 call SYSDISPMSG
;an000;let him say why
257 popf ;an000;restore flags
261 ret ;an000;return to caller
263 PRE_LOAD_MESSAGE endp
;an000;end proc
267 code ends
;an000;end code segment
272 CONST
SEGMENT PUBLIC BYTE
274 extrn arg_buf
:byte ;an000;
275 extrn line_num
:byte ;an000;
276 extrn line_flag
:byte ;an000;
277 extrn Temp_Path
:byte ;an000;
279 public baddrv_ptr
,bad_vers_err
,opt_err_ptr
,nobak_ptr
280 public too_many_ptr
,dskful_ptr
,memful_ptr
,badcom_ptr
281 public nodir_ptr
,filenm_ptr
,newfil_ptr
,read_err_ptr
282 public nosuch_ptr
,toolng_ptr
,eof_ptr
,dest_ptr
283 public mrgerr_ptr
,ro_err_ptr
,bcreat_ptr
,ndname_ptr
284 public ask_ptr
,qmes_ptr
,crlf_ptr
,lf_ptr
,yes_byte
286 public line_num_buf_ptr
;an000;DMS:6/15/87
287 public arg_buf_ptr
;an000;DMS:6/15/87
288 public cont_ptr
;an000;DMS:6/18/87
289 public cp_err_ptr
;an000;DMS:6/22/87
290 public Del_Bak_Ptr
;an000;dms;
294 ;============== REPLACEABLE PARAMETER SUBLIST STRUCTURE ==================
296 ; byte 1 - substitution list size, always 11
297 ; byte 2 - reserved for use by message handler
298 ; byte 3 - pointer to parameter to be used as a substitution
299 ; byte 7 - which parameter is this to replace, %1, %2, etc.
300 ; byte 8 - determines how the parameter is to be output
301 ; byte 9 - determines the maximum width of the parameter string
302 ; byte 10 - determines the minimum width of the parameter string
303 ; byte 11 - define what is to be used as a pad character
305 ;=========================================================================
307 ;=========================================================================
308 ; replaceable parameter sublists
309 ;=========================================================================
311 ed_read_sub
label dword ;an000;a read error occurred
313 db 11 ;an000;sublist size
314 db 00 ;an000;reserved
315 dd dg
:path_name
;an000;pointer to parameter
317 db Char_Field_ASCIIZ
;an000;left align/asciiz/char.
318 db unlim_width
;an000;unlimited width
319 db 00 ;an000;minimum width of 0
320 db pad_blank
;an000;pad with blanks
322 arg_sub
label dword ;an000;line output buffer
324 db 11 ;an000;sublist size
325 db 00 ;an000;reserved
326 dd dg
:arg_buf
;an000;pointer to parameter
328 db Char_Field_ASCIIZ
;an000;left align/asciiz/char.
329 db unlim_width
;an000;unlimited width
330 db 00 ;an000;minimum width of 0
331 db pad_blank
;an000;pad with blank
333 num_sub
label dword ;an000;line number
335 db 11 ;an000;sublist size
336 db 00 ;an000;reserved
337 dd dg
:line_num
;an000;pointer to parameter
339 db Right_Align
+Unsgn_Bin_Word
;an000;right align/decimal
340 db 08 ;an000;maximum width
341 db 08 ;an000;minimum width of 0
342 db pad_blank
;an000;pad with blank
344 db 11 ;an000;optional flag
345 db 00 ;an000;reserved
346 dd dg
:line_flag
;an000;pointer to parameter
348 db Char_Field_Char
;an000;character
349 db 01 ;an000;minimum width of 1
350 db 01 ;an000;maximum width of 1
351 db pad_blank
;an000;pad with blank
353 BAK_Sub
label dword ;an000;line output buffer
355 db 11 ;an000;sublist size
356 db 00 ;an000;reserved
357 dd dg
:Temp_Path
;an000;pointer to parameter
359 db Char_Field_ASCIIZ
;an000;left align/asciiz/char.
360 db unlim_width
;an000;unlimited width
361 db 00 ;an000;minimum width of 0
362 db pad_blank
;an000;pad with blank
365 ;=========================================================================
366 ; end replaceable parameter sublists
367 ;=========================================================================
369 ;======================= TABLE STRUCTURE =================================
371 ; bute 1-2 : message number of message to be displayed
372 ; byte 3 : message type to be used, i.e.;class 1, utility, etc.
373 ; byte 4-5 : display handle, i.e.; console, printer, etc.
374 ; byte 6-7 : pointer to substitution list, if any.
375 ; byte 8-9 : number of replaceable parameters, if any.
376 ; byte 10 : type of input from keyboard, if any.
377 ; byte 11-12: pointer to buffer for keyboard input, if any.
379 ;=========================================================================
382 bad_vers_err
label word ;an000;"Incorrect DOS version"
383 dw 0001 ;an000;message number
384 db UTILITY_MSG_CLASS
;an000;utility message
385 dw stdout
;an000;display handle
386 dw 00 ;an000;no sublist
388 db no_input
;an000;no keyboard input
389 dw 00 ;an000;no keyboard buffer
391 prompt_ptr
label word ;an000;"*",0
392 dw 0006 ;an000;message number
393 db UTILITY_MSG_CLASS
;an000;utility message
394 dw stdout
;an000;display handle
395 dw 00 ;an000;no sublist
397 db no_input
;an000;no keyboard input
398 dw 00 ;an000;no keyboard buffer
401 baddrv_ptr
label word ;an000;"Invalid drive or file name"
403 dw 0007 ;an000;message number
404 db UTILITY_MSG_CLASS
;an000;utility message
405 dw stdout
;an000;display handle
406 dw 00 ;an000;no sublist
408 db no_input
;an000;no keyboard input
409 dw 00 ;an000;no keyboard buffer
411 ndname_ptr
label word ;an000;"File name must be
412 ;an000;specified",0d,0a,0
413 dw 0008 ;an000;message number
414 db UTILITY_MSG_CLASS
;an000;utility message
415 dw stdout
;an000;display handle
416 dw 00 ;an000;no sublist
418 db no_input
;an000;no keyboard input
419 dw 00 ;an000;no keyboard buffer
421 opt_err_ptr
label word ;an000;"Invalid parameter",0d,0a,0
422 dw 0010 ;an000;message number
423 db Parse_Err_Class
;an000;utility message
424 dw StdErr
;an000;display handle
425 dw 00 ;an000;no sublist
427 db no_input
;an000;no keyboard input
428 dw 00 ;an000;no keyboard buffer
430 ro_err_ptr
label word ;an000;"File is READ-ONLY",0d,0a,0
431 dw 0010 ;an000;message number
432 db UTILITY_MSG_CLASS
;an000;utility message
433 dw stdout
;an000;display handle
434 dw 00 ;an000;no sublist
436 db no_input
;an000;no keyboard input
437 dw 00 ;an000;no keyboard buffer
439 bcreat_ptr
label word ;an000;"File Creation Error",0d,0a,0
440 dw 0011 ;an000;message number
441 db UTILITY_MSG_CLASS
;an000;utility message
442 dw stdout
;an000;display handle
443 dw 00 ;an000;no sublist
445 db no_input
;an000;no keyboard input
446 dw 00 ;an000;no keyboard buffer
448 too_many_ptr
label word ;an000;"Too many files open",0d,0a,0
449 dw 0012 ;an000;message number
450 db UTILITY_MSG_CLASS
;an000;utility message
451 dw stdout
;an000;display handle
452 dw 00 ;an000;no sublist
454 db no_input
;an000;no keyboard input
455 dw 00 ;an000;no keyboard buffer
457 read_err_ptr
label word ;an000;"Read error in:",
458 ;an000;0d,0a,"%1",0d,0a,0
459 dw 0013 ;an000;message number
460 db UTILITY_MSG_CLASS
;an000;utility message
461 dw stdout
;an000;display handle
462 dw dg
:ed_read_sub
;an000;point to sublist
464 db no_input
;an000;no keyboard input
465 dw 00 ;an000;no keyboard buffer
468 nobak_ptr
label word ;an000;"Cannot edit .BAK file
469 ;an000;--rename file",0d,0a,0
470 dw 0014 ;an000;message number
471 db UTILITY_MSG_CLASS
;an000;utility message
472 dw stdout
;an000;display handle
473 dw 00 ;an000;no sublist
475 db no_input
;an000;no keyboard input
476 dw 00 ;an000;no keyboard buffer
478 nodir_ptr
label word ;an000;"No room in directory
479 ;an000;for file",0d,0d,0
480 dw 0015 ;an000;message number
481 db UTILITY_MSG_CLASS
;an000;utility message
482 dw stdout
;an000;display handle
483 dw 00 ;an000;no sublist
485 db no_input
;an000;no keyboard input
486 dw 00 ;an000;no keyboard buffer
488 dskful_ptr
label word ;an000;"Disk full. Edits lost.",0d,0a,0
489 dw 0016 ;an000;message number
490 db UTILITY_MSG_CLASS
;an000;utility message
491 dw stdout
;an000;display handle
492 dw 00 ;an000;no sublist
494 db no_input
;an000;no keyboard input
495 dw 00 ;an000;no keyboard buffer
497 memful_ptr
label word ;an000;"Insufficient memory",0d,0a,0
498 dw 0008 ;an000;message number
499 db Ext_Err_Class
;an000;extended error
500 dw stderr
;an000;display handle
501 dw 00 ;an000;no sublist
503 db no_input
;an000;no keyboard input
504 dw 00 ;an000;no keyboard buffer
506 filenm_ptr
label word ;an000;"File not found",0d,0a
507 dw 0002 ;an000;message number
508 db Ext_Err_Class
;an000;utility message
509 dw stderr
;an000;display handle
510 dw 00 ;an000;no sublist
512 db no_input
;an000;no keyboard input
513 dw 00 ;an000;no keyboard buffer
515 badcom_ptr
label word ;an000;"Entry error",0d,0a,0
516 dw 0018 ;an000;message number
517 db UTILITY_MSG_CLASS
;an000;utility message
518 dw stdout
;an000;display handle
519 dw 00 ;an000;no sublist
521 db no_input
;an000;no keyboard input
522 dw 00 ;an000;no keyboard buffer
524 newfil_ptr
label word ;an000;"New file",0d,0a,0
525 dw 0019 ;an000;message number
526 db UTILITY_MSG_CLASS
;an000;utility message
527 dw stdout
;an000;display handle
528 dw 00 ;an000;no sublist
530 db no_input
;an000;no keyboard input
531 dw 00 ;an000;no keyboard buffer
533 nosuch_ptr
label word ;an000;"Not found",0d,0a,0
534 dw 0020 ;an000;message number
535 db UTILITY_MSG_CLASS
;an000;utility message
536 dw stdout
;an000;display handle
537 dw 00 ;an000;no sublist
539 db no_input
;an000;no keyboard input
540 dw 00 ;an000;no keyboard buffer
542 ask_ptr
label word ;an000;"O.K.? ",0
543 dw 0021 ;an000;message number
544 db UTILITY_MSG_CLASS
;an000;utility message
545 dw stdout
;an000;display handle
546 dw 00 ;an000;no sublist
548 db DOS_KEYB_INP
;an000;keyboard input - AX
549 dw 00 ;an000;no keyboard buffer
551 toolng_ptr
label word ;an000;"Line too long",0d,0a,0
552 dw 0022 ;an000;message number
553 db UTILITY_MSG_CLASS
;an000;utility message
554 dw stdout
;an000;display handle
555 dw 00 ;an000;no sublist
557 db no_input
;an000;no keyboard input
558 dw 00 ;an000;no keyboard buffer
560 eof_ptr
label word ;an000;"End of input file",0d,0a,0
561 dw 0023 ;an000;message number
562 db UTILITY_MSG_CLASS
;an000;utility message
563 dw stdout
;an000;display handle
564 dw 00 ;an000;no sublist
566 db no_input
;an000;no keyboard input
567 dw 00 ;an000;no keyboard buffer
569 qmes_ptr
label word ;an000;"Abort edit (Y/N)? ",0
570 dw 0024 ;an000;message number
571 db UTILITY_MSG_CLASS
;an000;utility message
572 dw stdout
;an000;display handle
573 dw 00 ;an000;no sublist
575 db DOS_KEYB_INP
;an000;keyboard input - AX
576 dw 00 ;an000;no keyboard buffer
578 dest_ptr
label word ;an000;"Must specify destination
579 ;an000;line number",0d,0a,0
580 dw 0025 ;an000;message number
581 db UTILITY_MSG_CLASS
;an000;utility message
582 dw stdout
;an000;display handle
583 dw 00 ;an000;no sublist
585 db no_input
;an000;no keyboard input
586 dw 00 ;an000;no keyboard buffer
588 mrgerr_ptr
label word ;an000;"Not enough room to
589 ;an000;merge the entire file",0d,0a,0
590 dw 0026 ;an000;message number
591 db UTILITY_MSG_CLASS
;an000;utility message
592 dw stdout
;an000;display handle
593 dw 00 ;an000;no sublist
595 db no_input
;an000;no keyboard input
596 dw 00 ;an000;no keyboard buffer
598 crlf_ptr
label word ;an000;0d,0a,0
599 dw 0027 ;an000;message number
600 db UTILITY_MSG_CLASS
;an000;utility message
601 dw stdout
;an000;display handle
602 dw 00 ;an000;no sublist
604 db no_input
;an000;no keyboard input
605 dw 00 ;an000;no keyboard buffer
607 lf_ptr
label word ;an000;0a,0
608 dw 0028 ;an000;message number
609 db UTILITY_MSG_CLASS
;an000;utility message
610 dw stdout
;an000;display handle
611 dw 00 ;an000;no sublist
613 db no_input
;an000;no keyboard input
614 dw 00 ;an000;no keyboard buffer
616 cont_ptr
label word ;an000;"Continue (Y/N)?"
617 dw 0029 ;an000;message number
618 db UTILITY_MSG_CLASS
;an000;utility message
619 dw stdout
;an000;display handle
620 dw 00 ;an000;no sublist
622 db DOS_KEYB_INP
;an000;keyboard input
623 dw 00 ;an000;no keyboard buffer
625 arg_buf_ptr
label word ;an000;argument buffer for
627 dw 0031 ;an000;message number
628 db UTILITY_MSG_CLASS
;an000;utility message
629 dw stdout
;an000;display handle
630 dw dg
:arg_sub
;an000;argument sublist
632 db no_input
;an000;no keyboard input
633 dw 00 ;an000;no keyboard buffer
635 line_num_buf_ptr
label word ;an000;holds line numbers
636 dw 0032 ;an000;message number
637 db UTILITY_MSG_CLASS
;an000;utility message
638 dw stdout
;an000;display handle
639 dw dg
:num_sub
;an000;argument sublist
641 db no_input
;an000;no keyboard input
642 dw 00 ;an000;no keyboard buffer
644 cp_err_ptr
label word ;an000;"Cannot merge - Code page
646 dw 0033 ;an000;message number
647 db UTILITY_MSG_CLASS
;an000;utility message
648 dw stdout
;an000;display handle
649 dw 00 ;an000;no sublist
651 db no_input
;an000;no keyboard input
652 dw 00 ;an000;no keyboard buffer
654 del_bak_ptr
label word ;an000;"Access Denied - xxxxxxxx.BAK"
655 dw 0005 ;an000;message number
656 db Ext_Err_Class
;an000;utility message
657 dw stderr
;an000;display handle
658 dw dg
:BAK_Sub
;an000;no sublist
660 db no_input
;an000;no keyboard input
661 dw 00 ;an000;no keyboard buffer