; ; ZFINDGFG.Z80 - JTH 08/07/91 ; ;--------------------------------------------------------- vers equ 14 ;zfind version number ; ZFIND Patch offsets defdel equ 0bh ;default display flag delim equ 0ch ;delimiter cfg equ 0dh ;cfg file name allf equ 16h ;display all files page equ 17h ;page display contxt equ 18h ;context flag wcu equ 19h ;wildcard user flag ovrwrt equ 1ah ;overwrite file flag ;--------------------------------------------------------- ;DATA FOR CNFG PROGRAM LINKAGE ;function definitions - **needed for CASE Table entries** switch equ 0 ;toggle bit n in a byte (n is specified) text equ 1 ;replace a text string of specified length duspec equ 2 ;replace a ZCPR style DU specification (NOT DIR:!) hexrad equ 3 ;edit byte/word using HEX radix decrad equ 4 ;edit byte/word using decimal radix togl3 equ 7 ;toggle to one of three options: 001B, 010B, 100B togltf equ 8 ;toggle a byte between 0ffh and 0 filesp equ 9 ;change d, du, fn.ft, or du:fn.ft ;ASCII definitions ;these are convenient, but only required if you wish ;to use them in text or data fields (including HELP) ctlc equ 3 bs equ 8 ;backspace ht equ 9 ;horizontal tab lf equ 10 ;line feed cr equ 13 ;carriage return spc equ 20h ;space char ;========================================================= ; MACRO DEFINITIONS ;You don't HAVE to use the macros. But it does make it ;easier to fill in the tables! ;this macro is used for creating a CASE table ;entry which specifies toggling or setting a ;single bit (0..7) in a configuration data byte. ;It is useful when the 'switch' function is named. bitmap macro a,sub,off,bit,scr,dat db '&A' dw sub,off db 1 shl bit ;;make a mask byte dw scr,dat endm ;========================================================= ;macro parameter definitions ; A = the character used in the screen for a menu item ; off = byte offset in config block ; sub = subroutine for translation to screen ; scr = screen location ; dat = extra data word if required. Normally 0 ;produces a record which is 8 bytes long ;========================================================= ;this macro is used to create a case table entry ;which contains a byte of data required by the function ;to be performed. (see table of function definitions above) vector macro a,sub,off,byte,scr,dat db '&A' dw sub,off db byte ;;a byte of data dw scr,dat endm ;************************************************************ ; START OF OVERLAY CODE ;************************************************************ ;The next 13 bytes must remain in this location. rst 0 ;for safety - file won't execute dw amenu ;for relocation of addresses, this ;points to the NEXT location. ;first MENU list must be here. All names are local. amenu: dw amenu,amenu,ascrn,acase,ahelp ;MENU A ;========================================================= ;Case table used for ZFIND, first menu & screen: ;========================================================= acase: db (acasex-acase1)/(acase2-acase1) ;number of cases db acase2-acase1 ;length of each record ; macro .single char menu selector ; | | .function (see above) ; | | | .offset in cnfg block ; | | | | .function dependent data ; | | | | | .screen location ; | | | | | | ;acse1: bitmap 0, switch, obyte0, crtflg, ascrl0, yndata ; | ; address of data structure used by function._| ; ;The first two entries in the case table must be labeled to ;provide data for the calculation at ACASE:. Subsequent ;entries (one for each menu selection) need not be labeled. acase1: vector 0, text, cfg, 8, ascr0, 0 acase2: vector 1, togltf, wcu, 1, ascr1, udata vector 2, togltf, allf, 1, ascr2, amdata vector 3, togltf, contxt, 1, ascr3, cdata vector 4, togltf, defdel, 1, ascr4, dldata vector 5, hexrad, delim, 1, ascr5, 0 vector 6, togltf, page, 1, ascr6, pdata vector 7, togltf, ovrwrt, 1, ascr7, odata ;the next entry is a label which terminates the list. ;It is required for use in the calculation at ACASE: acasex: ;label used to calc number of entries ;========================================================= ascrn: ;screen image for first screen ;db cr,lf ;ensure clean top of screen ;Title line db cr,lf db ht,ht,ht,1,' ZFIND VERS ',vers/10+'0','.',vers mod 10+'0' db ' DEFAULTS ',2 db cr,lf,lf db 'Default CFG filename (FILENAME)........ (0) ',1 ascr0: db ' ',2 db cr,lf db 'Search for files on.................... (1) ',1 ascr1: db ' ',2 db cr,lf db 'When searching a list of files, display (2) ',1 ascr2: db ' ',2 db cr,lf db 'Default to displaying found string line (3) ',1 ascr3: db ' ',2 db cr,lf db 'Default to displaying found string in a (4) ',1 ascr4: db ' ',2 db cr,lf db 'Block delimiter string..... Line feed + (5) ',1 ascr5: db ' <--as a HEX character ',2 db cr,lf db 'Screen display paging default.......... (6) ',1 ascr6: db ' ',2 db cr,lf db 'Overwrite existing output file......... (7) ',1 ascr7: db ' ',2 db 0 ;terminator ;----------------------------------- ; FUNCTION DATA LIST ;data pair for representing bit values in screen image ;Can also be used for function 8 display (True/False) udata: db 'all user areas ',0 dâ 'specified useò areá onlù',0 amdata: db 'all files searched ',0 db 'only files with matches',0 cdata: db 'in context (3 lines)',0 db 'as found line only ',0 dldata: db 'delimited block',0 db 'line ',0 pdata: db 'Page display ',0 db 'Don''t page display',0 odata: db 'without asking',0 db 'Ask first ',0 ;========================================================= ahelp: ;help screen for menu A db cr,lf db ht,ht,ht,1,' ZFIND VERS ' db vers/10+'0','.',vers mod 10+'0' db ' DEFAULTS ',2 db cr,lf,lf ; db 1,'Default CFG Filename',2,cr,lf,lf db 'Enter the desired default CFG filename in the form: ' db 'form ''FILENAME''.',cr,lf db 'Up to 8 characters may be entered.' db cr,lf,lf ; db 1,'File Search',2,cr,lf,lf db 'This option can be set to search all user areas on ' db 'the specified drive',cr,lf db 'for files, or to search only the specified or default ' db 'user area.',cr,lf,lf ; db 1,'Default Found String Display',2,cr,lf,lf db 'Sets the default found string display to either Line ' db 'or Delimited Block.',cr,lf db 'When set to Line, ZFIND displays the line in which the ' db 'string was found.',cr,lf db 'When set to Delimited Block, ZFIND displays the block in ' db 'which the string ',cr,lf db 'was found. The block is defined as the text between two ' db 'delimiter strings, ',cr,lf db 'set using the delimiter configuration byte.' db cr,lf,lf,lf,lf ; db 1,'Default Found String Line Display',2,cr,lf,lf db 'Context displays the found line with the previous ' db 'line and the next line.',cr,lf db 'Otherwise, only the found string line will be ' db 'displayed.',cr,lf,lf db 'This option is only active in the line display mode, and ' db 'will be ignored',cr,lf db 'in the demimited block display mode.' db cr,lf,lf ; db 1,'Block Delimiter String',2,cr,lf,lf db 'The block delimiter string is two characters long. The ' db 'first character is',cr,lf db 'always a line feed, which means that the second ' db 'configurable delimiter',cr,lf db 'character must always appear as the first character in ' db 'a line. Because the',cr,lf db 'delimiter is not limited to displayable characters, it ' db 'must be entered as a',cr,lf db 'HEX character.' db cr,lf,lf db 'The distribution default delimiter is ''-'' (2Dh),' db ' matching the XFOR string',cr,lf db 'of LF,''-''. A delimiter of RETURN (0Dh) will match' db ' a double spaced line',cr,lf db '(cr,LF,CR,lf,...). A delimiter of '';'' (3Bh) will' db ' match source code comments',cr,lf db 'beginning in the first column.' db cr,lf,lf,lf db 1,'Filename Display',2,cr,lf,lf db 'Set to display all filenames being searched or to ' db 'display only the filenames',cr,lf db 'containing matched strings.' db cr,lf,lf db 1,'Page Screen Display',2,cr,lf,lf db 'The screen display is normally paged. This option ' db 'may also be set to',cr,lf db 'disable screen paging, useful when writing ' db 'to an output file.' db cr,lf,lf db 1,'Overwrite Existing Output File',2,cr,lf,lf db 'Normally set to ask before overwriting an existing ' db 'output file. May be',cr,lf db 'set to overwrite without asking. When appending ' db 'to a file, it is assumed',cr,lf db ' that the output file exists. If not, a file ' db 'will automatically be created.',cr,lf db 0 ;=========================================================