home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / tptools.zip / FIRSTED.ZIP / EDMESG.ASM < prev    next >
Assembly Source File  |  1987-12-21  |  5KB  |  133 lines

  1. ;
  2. ;       EDMESG.ASM
  3. ;       ED 4.0
  4. ;       Copyright (c) 1985, 87 by Borland International, Inc.
  5. ;
  6. ;       Message area and access routine
  7. ;
  8.  
  9. DATA    SEGMENT BYTE PUBLIC
  10.  
  11. DATA    ENDS
  12.  
  13. CODE    SEGMENT BYTE PUBLIC
  14.  
  15.         ASSUME  CS:CODE,DS:DATA
  16.  
  17.         PUBLIC  EdMessagePtr
  18.  
  19. ;CS-relative data:
  20. ;Be sure to terminate list with a pair of 0 bytes
  21.  
  22. Messages LABEL BYTE
  23. ;first two bytes are message number
  24. ;next byte is string length
  25.       db   2,  0, 15, ' File not found'
  26.       db   3,  0, 15, ' Path not found'
  27.       db   5,  0, 19, ' File access denied'
  28.       db  21,  0, 27, '  Typeahead buffer overflow'
  29.       db  22,  0, 23, '  Window size too small'
  30.       db  26,  0, 21, '  No block is defined'
  31.       db  28,  0, 23, '  Invalid marker number'
  32.       db  29,  0, 25, '  Marker has not been set'
  33.       db  30,  0, 36, '  Marker is not in a viewable window'
  34.       db  34,  0, 27, '  Cannot read from a device'
  35.       db  35,  0, 21, '  Insufficient memory'
  36.       db  36,  0, 17, '  Invalid integer'
  37.       db  37,  0, 17, '  Command aborted'
  38.       db  38,  0, 11, '  Not found'
  39.       db  41,  0, 15, '  Line too long'
  40.       db  49,  0, 45, '  Default extension may not contain wildcards'
  41.       db  56,  0, 32, '  You only have one window open!'
  42.       db 100,  0, 16, ' Disk read error'
  43.       db 101,  0, 17, ' Disk write error'
  44.       db 104,  0, 28, '  Unable to create .BAK file'
  45.       db 120,  0, 31, '  Window is too small to divide'
  46.       db 122,  0, 24, '  Invalid directory path'
  47.       db 127,  0, 34, '  Cannot create another window now'
  48.       db 128,  0, 39, '  DOS critical error - Device not ready'
  49.       db 153,  0, 25, '  !Unexpected end of file'
  50.       db 240,  0, 28, '  !Disk write error occurred'
  51.       db 241,  0, 40, '  !File creation error or directory full'
  52.       db  45,  1,  9, ' New File'
  53.       db  49,  1, 24, ' Press <Esc> to continue'
  54.       db  50,  1, 30, ' File modified. Save it? (Y/N)'
  55.       db  54,  1, 22, ' Filename to Write to:'
  56.       db  55,  1, 21, ' Go to Column number:'
  57.       db  56,  1, 19, ' Go to Line number:'
  58.       db  61,  1, 23, ' New Drive or Pathname:'
  59.       db  62,  1, 16, ' Options (UBWL):'
  60.       db  63,  1, 22, ' Overwrite file? (Y/N)'
  61.       db  64,  1, 18, ' Pathname of file:'
  62.       db  65,  1, 11, ' Read file:'
  63.       db  67,  1, 12, ' Search for:'
  64.       db  69,  1,  8, ' Reading'
  65.       db  70,  1, 10, ' Searching'
  66.       db  71,  1,  8, ' Working'
  67.       db  72,  1, 15, ' RAM bytes free'
  68.       db  73,  1, 11, ' <Y/N/A/Q>:'
  69.       db  81,  1, 18, ' Options (UWBGLN):'
  70.       db  82,  1, 14, ' Replace with:'
  71.       db  83,  1,  9, ' Replace?'
  72.       db  87,  1, 16, ' FirstEd Version'
  73.       db  99,  1, 43, ' Use  to resize window, <Enter> to accept'
  74.       db 105,  1, 12, ' Undo limit:'
  75.       db 121,  1, 23, ' 3 Character Extension:'
  76.       db 130,  1, 23, ' File Name to Write to:'
  77.       db   0,  0      ;termination of messages
  78.  
  79. ;****************************************************** EdMessagePtr
  80.  
  81. ;  function EdMessagePtr(msgno:word) : Pointer; external;
  82.  
  83. ;    {-Return a pointer to the message string, nil if not available}
  84.  
  85. MsgNo           EQU       WORD PTR [BP+4]
  86.  
  87. EdMessagePtr    PROC NEAR
  88.  
  89.         PUSH    BP                      ;Save BP
  90.         MOV     BP,SP                   ;Set up stack frame
  91.         PUSH    DS                      ;Save DS
  92.  
  93.         MOV     BX,MsgNo                ;Get message number to seek
  94.  
  95.         MOV     AX,CS
  96.         MOV     DS,AX                   ;Put CS into DS
  97.         ASSUME  DS:CODE
  98.         LEA     SI,Messages             ;Now DS:SI points to Messages
  99.  
  100. EMPNext:
  101.         LODSW                           ;Next message number into AX
  102.         OR      AX,AX                   ;Last message?
  103.         JZ      EMPNotFound
  104.         CMP     AX,BX                   ;The message we seek?
  105.         JZ      EMPFound
  106.         LODSB                           ;Get length byte of string
  107.         XOR     AH,AH                   ;Clear upper byte
  108.         ADD     SI,AX                   ;Skip over string
  109.         JMP     Short EMPNext           ;Try again
  110.  
  111. EMPNotFound:
  112.         XOR     DX,DX                   ;Clear pointer if Message not found
  113.                                         ;AX is already zero is we get here
  114.         JMP     Short EMPDone
  115.  
  116. EMPFound:
  117.                                         ;Return pointer in DX:AX
  118.         MOV     DX,CS                   ;Pointer Segment is current CS
  119.         MOV     AX,SI                   ;SI points to length byte of string
  120.  
  121. EMPDone:
  122.         POP     DS                      ;Restore DS
  123.         ASSUME  DS:DATA
  124.         MOV     SP,BP                   ;Restore SP
  125.         POP     BP                      ;Restore BP
  126.         RET     2                       ;Remove parameter from stack
  127.  
  128. EdMessagePtr    ENDP
  129.  
  130. CODE    ENDS
  131.  
  132.         END
  133.