home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
tptools.zip
/
FIRSTED.ZIP
/
EDMESG.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-12-21
|
5KB
|
133 lines
;
; EDMESG.ASM
; ED 4.0
; Copyright (c) 1985, 87 by Borland International, Inc.
;
; Message area and access routine
;
DATA SEGMENT BYTE PUBLIC
DATA ENDS
CODE SEGMENT BYTE PUBLIC
ASSUME CS:CODE,DS:DATA
PUBLIC EdMessagePtr
;CS-relative data:
;Be sure to terminate list with a pair of 0 bytes
Messages LABEL BYTE
;first two bytes are message number
;next byte is string length
db 2, 0, 15, ' File not found'
db 3, 0, 15, ' Path not found'
db 5, 0, 19, ' File access denied'
db 21, 0, 27, ' Typeahead buffer overflow'
db 22, 0, 23, ' Window size too small'
db 26, 0, 21, ' No block is defined'
db 28, 0, 23, ' Invalid marker number'
db 29, 0, 25, ' Marker has not been set'
db 30, 0, 36, ' Marker is not in a viewable window'
db 34, 0, 27, ' Cannot read from a device'
db 35, 0, 21, ' Insufficient memory'
db 36, 0, 17, ' Invalid integer'
db 37, 0, 17, ' Command aborted'
db 38, 0, 11, ' Not found'
db 41, 0, 15, ' Line too long'
db 49, 0, 45, ' Default extension may not contain wildcards'
db 56, 0, 32, ' You only have one window open!'
db 100, 0, 16, ' Disk read error'
db 101, 0, 17, ' Disk write error'
db 104, 0, 28, ' Unable to create .BAK file'
db 120, 0, 31, ' Window is too small to divide'
db 122, 0, 24, ' Invalid directory path'
db 127, 0, 34, ' Cannot create another window now'
db 128, 0, 39, ' DOS critical error - Device not ready'
db 153, 0, 25, ' !Unexpected end of file'
db 240, 0, 28, ' !Disk write error occurred'
db 241, 0, 40, ' !File creation error or directory full'
db 45, 1, 9, ' New File'
db 49, 1, 24, ' Press <Esc> to continue'
db 50, 1, 30, ' File modified. Save it? (Y/N)'
db 54, 1, 22, ' Filename to Write to:'
db 55, 1, 21, ' Go to Column number:'
db 56, 1, 19, ' Go to Line number:'
db 61, 1, 23, ' New Drive or Pathname:'
db 62, 1, 16, ' Options (UBWL):'
db 63, 1, 22, ' Overwrite file? (Y/N)'
db 64, 1, 18, ' Pathname of file:'
db 65, 1, 11, ' Read file:'
db 67, 1, 12, ' Search for:'
db 69, 1, 8, ' Reading'
db 70, 1, 10, ' Searching'
db 71, 1, 8, ' Working'
db 72, 1, 15, ' RAM bytes free'
db 73, 1, 11, ' <Y/N/A/Q>:'
db 81, 1, 18, ' Options (UWBGLN):'
db 82, 1, 14, ' Replace with:'
db 83, 1, 9, ' Replace?'
db 87, 1, 16, ' FirstEd Version'
db 99, 1, 43, ' Use to resize window, <Enter> to accept'
db 105, 1, 12, ' Undo limit:'
db 121, 1, 23, ' 3 Character Extension:'
db 130, 1, 23, ' File Name to Write to:'
db 0, 0 ;termination of messages
;****************************************************** EdMessagePtr
; function EdMessagePtr(msgno:word) : Pointer; external;
; {-Return a pointer to the message string, nil if not available}
MsgNo EQU WORD PTR [BP+4]
EdMessagePtr PROC NEAR
PUSH BP ;Save BP
MOV BP,SP ;Set up stack frame
PUSH DS ;Save DS
MOV BX,MsgNo ;Get message number to seek
MOV AX,CS
MOV DS,AX ;Put CS into DS
ASSUME DS:CODE
LEA SI,Messages ;Now DS:SI points to Messages
EMPNext:
LODSW ;Next message number into AX
OR AX,AX ;Last message?
JZ EMPNotFound
CMP AX,BX ;The message we seek?
JZ EMPFound
LODSB ;Get length byte of string
XOR AH,AH ;Clear upper byte
ADD SI,AX ;Skip over string
JMP Short EMPNext ;Try again
EMPNotFound:
XOR DX,DX ;Clear pointer if Message not found
;AX is already zero is we get here
JMP Short EMPDone
EMPFound:
;Return pointer in DX:AX
MOV DX,CS ;Pointer Segment is current CS
MOV AX,SI ;SI points to length byte of string
EMPDone:
POP DS ;Restore DS
ASSUME DS:DATA
MOV SP,BP ;Restore SP
POP BP ;Restore BP
RET 2 ;Remove parameter from stack
EdMessagePtr ENDP
CODE ENDS
END