TITLE SuperZap - CP/M Disk Utility ;------------------------------------------------------------------------------ ; ; SuperZap - A screen-oriented disk editor for CP/M-80 ; ; Usage: ; ZAP start in full directory of current drive/user ; ZAP [d:] start in full directory on selected drive ; ZAP [d:]afn start with directory mask on selected drive ; ZAP [d:]ufn start in file-relative view/edit mode ; ZAP [d:]DSK: start in sector-relative view/edit mode ; ; Created by: ; W.M. Davidson & H.J. Sheldrake ; 18 Dean Park Cr. ; Edinburgh EH4 1PH ; Scotland, U.K. ; ; Upgraded to CP/M 3 operation by: ; John Hastwell-Batten ; SysOp, Tesseract RCPM+ ; P.O. Box 242 ; Dural, NSW 2158 ; Australia ; ;------------------------------------------------------------------------------ ; ; Update history (most recent first) ; ; 5.1 9 Dec 90 Minor bug fix - George A. Havach ; Fixed small but annoying anomaly (introduced because of compression ; of routines ) in 'SCCH' that caused premature exit from sector ; edit on typing an illegal hexadecimal or ASCII character. ; ; 5.0 Rewritten with corrections - gah ; (9 July-26 Oct 90) ; - Rewrote/rearranged most named routines to streamline logic and avoid ; unnecessary repetition of code, by simple hand optimization, thereby ; saving another couple of hundred bytes. ; - Rearranged menu-item order in panels for more logical placement of ; options; added highlight on/off and cursor on/off to installable ; screen-control codes to enhance menu, directory, type, and sector ; displays. Error messages now also consistently use inverse video. ; - Character output is now by direct BIOS call, producing a noticeable ; (about 20%) increase in the speed of screen display. ; - Fumigated remarkably buggy string-entry routine 'ASIN' for ASCII ; search: escape now actually quits, backspace no longer strays ; bizarrely past initial character-input position, and delete-character ; works as advertised, similar to usage in setting of directory mask. ; In addition, cursor-forward can now be used to recover the previous ; search string, character by character, greatly facilitating multiple ; searches on the same string or variations thereof. ; - Repaired page-forward routine 'FTYP', which previously corrupted page ; queue by failing to initially update pointers, thus causing the other ; paging functions (e.g., 'Go to page No.') to go off track. Also ; corrected 'TYPP' and 'TYPS' to reselect current page on escape, ; instead of advancing to the next page. ; - Modified 'TYPE' so that panel display remains on screen during paging. ; - Added equate 'INSFFX' to simplify cursor-positioning code for the ; vast majority of terminals that don't need infix and suffix strings. ; - The clipboard (previously "scratchpad," which it really isn't!) is ; now called by its proper name. ; - Drive ID is now echoed to the screen on selecting a new drive. ; - Created two distinct files, ZAP.MAC and ZAP.AZM, to facilitate user ; assembly with Macro-80 ("M80") and Z80MR, respectively. ; ; 4.1 ?? "Alta Systems, Inc." ; Bogus release with a dubious copyright. Frankly, the less said about ; this regrettable aberration, the better. Version 4 skipped completely ; here to disavow any further association with the mainline of program ; development. ; ; 3.6 Long-overdue code maintenance - gah ; (18 Feb-31 Mar 89) ; - Repaired disk-selection routine in 'CHDR', which previously caused ; reversion to parameters for drive A: instead of the requested drive ; because of a CP/M disk-system reset (function 13), thus effectively ; wiping out possible use of multiple disk formats on the same machine. ; - Fixed clipboard operation so that exchange function now works in ; track/sector as well as file-relative mode. ; - Fixed user-number selection so that current disk is reselected ; instead of default disk. ; - Eliminated useless reselecting of default drive and resetting of ; disk system before exit via a warm boot, which does all that anyway. ; - Cosmetic editing of screen display and source code: ; o Made placement of prompts more consistent with panel displays. ; o Split off user-configurable code as a separate file for easier ; terminal installation. ; o Z80 source code is now in uppercase, comments in lowercase ; throughout (except for most recent round of corrections). ; o Eliminated many superfluous JumPs and RETurns placed in the name ; of "structure," resulting in rather reduced stack usage, a slight ; improvement in speed, and an overall savings of more than 300 ; bytes in program size. ; o Substituted relative ('JR') for absolute ('JP') jumps wherever ; possible for further economy of code size. ; o Removed macro '$RTN' as label generator for "standard routines." ; (5 Oct 89) ; - Added blinking-video option for use with find marker 'FNDMK'. ; (30 Dec 89-2 Jan 90) ; - Display now pauses for the next keystroke after key interrupt ; during find. ; - Added prompt for a keystroke if find failed. ; - Added panel display of current user number in directory mode ; (an item from jhb's "wish list"). ; ; 3.5 2-17 Sept 86 Further revisions, bug fixes - Peter G. Martin ; - Generalized & updated hex/ascii searches to facilitate use ; in both file and physical-sector mode. Varied previous 'type' ; for continuous run-thru paging, with fewer complications. ; - Reinstalled option to go to a specific page in file 'type' mode. ; ; 3.4 11-24 July 86 pgm ; Added hex & ASCII searches in Edit mode, random sector/page/line ; access in Type mode (rough), and alternative line-end interpretation ; for Type for word-processed ("document") files. ; ; 3.3 20 Mar 86 Willie Davidson (mods done by John Hastwell-Batten) ; Incorporated Willie Davidson's updates to the CP/M 2.2 version ; into this universal version. ; ; 3.2 24 Feb 86 John Hastwell-Batten ; Removed CP/M 3 configuration/implementation dependencies. SuperZap ; should now run on any CP/M 2.2 or 3 system with a Z80 CPU. ; ; 3.1 11 Jan 86 jhb ; - Added ability to select user number (very crude). ; - Changed default track number to directory track. ; - Made terminal functions more general and object-patchable. ; ; 3.0 9 Jan 86 jhb ; - ASEG and ORG directives added, .LIST and .XLIST directives moved ; to simplify use with Z8E debugger. ; - Upgraded for compatibility with CP/M 3. ; - Introduced inverse-video display of characters with high bit set ; to make sector displays more readable. ; ; 2.3 ? 1984 Richard Solomon ; Version for Kaypro. ; ; 2.2 July 81 Willie Davidson ; Version for Osborne 1. ; ; 2.1 ?? W.M. Davidson and H.J. Sheldrake ; Original version (as distributed by SIG/M). ; ;------------------------------------------------------------------------------ .Z80 ;for assembly with Microsoft's Macro-80 ASEG ORG 0100H ;just makes things a little easier ;---------------- GLOBAL EQUATES ----------------- BEL EQU 07H ;ASCII bell LF EQU 0AH ;ASCII linefeed CR EQU 0DH ;ASCII carriage return FALSE EQU 0 TRUE EQU NOT FALSE ;---------------- ENTRY POINT TO PROGRAM ----------------- JP INIT ;now we have to do this ourselves DB 'Z3ENV' ;for future use with Z-System $VER DEFL '5' ;version number $MOD DEFL '1' ;modification level ; DB ' SuperZap 5 ' ;deleted a few "blank" lines ; DB ' for CP/M 2.2 ' ; DB ' and CP/M 3.1 ' ;screen controls now at 0108H ; DB ' W.M. Davidson ' ; instead of 0150H - gah ; DB '& H.J. Sheldrake' ; DB '18 Dean Park Cr.' ; DB ' Edinburgh ' ; DB ' EH4 1PH ' ; DB ' Scotland, U.K.' ; **** USER-CONFIGURABLE AREA FOLLOWS **** ; ; CURSOR-MOVEMENT CHARACTERS (must be single bytes, 01H thru 1FH) ; Variations added - pgm ; $LEFT EQU 08H ;cursor left is ^H $RIGHT EQU 0CH ;cursor right is ^L $UP EQU 0BH ;cursor up is ^K $DOWN EQU 0AH ;cursor down is ^J $TAB EQU 09H ;cursor tab is ^I $ESC EQU 1BH ;escape is ESC $INSRT EQU 'V'-40H ;insert is ^V $DELETE EQU 7FH ;delete is DEL $QUIT EQU 'Q'-40H ;quit edit is ^Q $END EQU 'W'-40H ;end edit is ^W ; Terminal's highest displayable ASCII character + 1 ; $MAXASC EQU 7FH+1 ;use 7DH for stupid Hazeltines ; ; Flag character for use in directory display ; $FLAGCH EQU '>' ;arrow-like pointer ; ; SCREEN CONTROL (set for Kaypro with highlight) ; Format of these sequences is, first, a length byte, followed by exactly ; that many code bytes. ; CLSSTR: DB 1,1AH ;clear screen CLLSTR: DB 1,18H ;clear to end of line VINV: DB 6,1BH,'B0',1BH,'B1' ;inverse video ; (also half-intensity on Kaypro) VNORM: DB 6,1BH,'C0',1BH,'C1' ;normal video (inverse off) VHILIT: DB 3,1BH,'B1' ;highlight on (half-intensity) VUNHIL: DB 3,1BH,'C1' ;highlight off VBLNK: DB 6,1BH,'B0',1BH,'B2' ;blinking on VUNBL: DB 6,1BH,'C0',1BH,'C2' ;blinking off VCRON: DB 3,1BH,'B4' ;cursor on VCROFF: DB 3,1BH,'C4' ;cursor off ; ; ABSOLUTE CURSOR POSITIONING ; Added equate to cover optional need for infix and suffix strings, which ; most terminals don't use. - 23 Aug 90 gah ; INSFFX EQU FALSE ;set true if your terminal ; needs infix and suffix strings ; CPPREF: DB 2,1BH,'=' ;cursor-positioning prefix if insffx CPMID: DB 0,0,0,0,0,0,0,0 ;cursor-positioning infix ; (sent between row/column values) CPEND: DB 0,0,0,0,0,0,0,0 ;cursor-positioning suffix endif ; (sent after row/column values) ; ROW1ST: DB 1 ;1 = row 1st, 0 = col 1st ; --- WARNING WARNING WARNING WARNING --- ; THE VALUE OF ROW1ST MUST NOT BE SET TO ANY VALUE OTHER THAN 0 OR 1! ROWOFF: DB 20H ;offset for row COLOFF: DB 20H ;offset for column CPBIN: DB 1 ;0 for decimal cursor coordinates, ; non-0 for binary ; ; WORD-PROCESSOR NEWLINE CHARACTERS FOR TYPING OF FILES ; ; Standard, which should be harmless, is to have all "line end" characters ; set to 0DH, which is normally handled by the "hardwired" code... This ; means you may insert UP TO TWO "soft" codes for those line ends used by ; your word-processor files which are NOT NORMALLY FOLLOWED BY A LF, and ; TWO "hard" codes for CRs NORMALLY FOLLOWED BY LFs, such as WordStar's ; 8DH,0AH combination. ; pgm 24 July 86 ; ; DEFAULT FOR ALL FOUR ENTRIES IS 0DH - SELECT FOR WORD PROCESSOR YOU USE ; OR LEAVE HARMLESS AS 0DH ; SOFT1: DB 0AH ; <= CHANGE AS YOU WILL OR LEAVE AS 0DH SOFT2: DB 0DH ; <= CHANGE AS YOU WILL OR LEAVE AS 0DH HARD1: DB 8DH ; <= This one's for WordStar's 8DH,0AH combo HARD2: DB 0DH ; <= CHANGE AS YOU WILL OR LEAVE AS 0DH ; ; **** END OF USER-CONFIGURABLE AREA **** ;---------------- MACRO DEFINITIONS ----------------- ; $FLD - LOAD HL AND DISPLAY FIELD $FLD MACRO $FLDNM LD HL,$FLDNM CALL DFLD ENDM ; $CFLD - LOAD HL AND CLEAR FIELD $CFLD MACRO $FLDNM LD HL,$FLDNM CALL CFLD ENDM ; $PANEL - LOAD HL AND DISPLAY PANEL $PANEL MACRO $PNLNM LD HL,$PNLNM CALL DPNL ENDM ; $NPANEL - CLEAR SCREEN AND DISPLAY PANEL $NPANEL MACRO $PNLNM CALL DHDR $PANEL $PNLNM ENDM ; $STRO - PRINT STRING AT (HL) $STRO MACRO $STRNM LD HL,$STRNM CALL STRO ENDM ; $STRL - PRINT STRING AT (HL) WHERE FIRST BYTE IS LENGTH $STRL MACRO $STRNM LD HL,$STRNM CALL STRL ENDM ; $IFLD - LOAD HL, DISPLAY FIELD, GET AND FOLD INPUT $IFLD MACRO $FLDNM LD HL,$FLDNM CALL DFLD CALL CHRF ENDM ; $MTCH - CALL BYTE MATCHER $MTCH MACRO $LST LD HL,$LST CALL MTCH ENDM ; $EXVA - EXECUTE VECTORED ACTION $EXVA MACRO $LST LD DE,$LST CALL EXVA ENDM ; $HEXW - DISPLAY HEX WORD $HEXW MACRO $WORD LD HL,($WORD) CALL HEXW ENDM INCLUDE ZAP51 ;rest of program code split off for ; convenience of reassembly - gah