diff --git a/Binary/Apps/zmp.doc b/Binary/Apps/zmp.doc new file mode 100644 index 00000000..aeb5383e --- /dev/null +++ b/Binary/Apps/zmp.doc @@ -0,0 +1,389 @@ + ** ZMP Documentation ** + +1. Introduction. + + ZMP is a communications/file transfer program for CP/M which +performs Xmodem, Xmodem-1k (often erroneously called Ymodem), +true Ymodem and Zmodem file transfer protocols. Although tested +with Z80DOS, ZRDOS and CP/M 2.2, there seems to be no reason why +it shouldn't work with CP/M 3 as well. The only requirements are +a Z80 processor (sorry about that!), a computer running CP/M in +one of its various guises, with at least 45k of TPA (but the more +the better!), and a modem. + When you try to pack this many features into one program, +you end up with a pretty large file. The big problem occurs when +file transfers are attempted: unless you have at least 4-8k of +buffer size, you might as well use xmodem protocol. The approach +taken in ZMP is to use overlays for various functions, accepting +the time taken to load these from disk. Thus performance will +vary depending on your disk setup: if you have a hard disk and a +fast processor you will likely not notice the difference. If, on +the other hand, you are running a Commodore 128 with CP/M on a +1571 drive, there is no physical reason why ZMP won't work, but +you might consider investing in a book to read while the overlays +load. (A suitable book to read might be a computer catalogue!). + The curious amongst you may notice that the beginning of the +ZMPX.COM file has the magic 'Z3ENV' string, but don't let this +fool you into thinking that you don't need to add terminal +characteristics into the overlay if you have a ZCPR3 system. It +has proved possible to persuade this particular C compiler to +access ZCPR3's environment descriptor, but not for ZMP. Yet. +Perhaps later. In the meantime, the startup code is there for it. + In order to produce a program which would work with most +CP/M systems, the Zmodem protocol performed by ZMP is fairly +simple. The transmit section uses 'Full Streaming with Reverse +Interrupt', as Chuck Forsberg calls it in his description of the +Zmodem protocol. The receive section uses 'Segmented Streaming'. +This means that, if your system can do serial I/O and disk I/O at +the same time, ZMP does not take advantage of the faster transfer +rate which this capability provides. Since, however, I can't +write and listen at the same time, and neither can my computer, +and neither can the vast majority of CP/M computers, it seemed +the best approach to take. Segmented Streaming means that the +receive program tells the transmit program how big its buffer is. +The transmit program then sends just that much data, then waits +for an acknowledge from the receiver. We have encountered some +Zmodem programs which send too much data in this case: errors +will appear if this happens, but the protocol should recover and +the file will be received intact (we hope!). + The string which ZMP passes to the receiving program to +interrupt in case of errors is likewise simple. Basically it +causes the receiving program to send a control-C character and +then wait for one second. The receiver will then send its ZRPOS +string, by which time ZMP, as the transmitter, should be ready to +receive it. + + +2. Customisation. + + ZMP must be customised to suit your system. This involves +overlaying the un-installed copy of ZMP.COM (contained in this +library as ZMPX.COM) with a user-written installation overlay. +Some hints on writing this are given below; there is a blank +overlay file in this library, or you may be able to obtain one +for your computer from the same place you got this library. +This value is set at 0145 hex, and should stay there permanently. +See the notes in this document, and also the ZMP-OVL.UPD file, +for more details on how to set up your overlay. + Once the installation overlay is written, assemble it with +M80 (or SLR or whatever), use RELHEX to create a .HEX file, and +use MLOAD to overlay it over the ZMPX.COM file to produce your +very own ZMP.COM. + +3. Operation. + + The following files must be on the same disk and user area, +which must be specified in your customisation overlay: + + ZMCONFIG.OVR -- the configuration overlay + ZMINIT.OVR -- the initialisation overlay + ZMTERM.OVR -- the terminal overlay + ZMXFER.OVR -- the file transfer overlay + ZMP.HLP -- the help file (recommended). + + Start the program with ZMP. The screen should clear, then a +title message is printed, then ZMP enters terminal mode. You may +type escape-H for help at this point. When you first run the +program, the first thing you need to do is to enter the +configuration overlay (type escape-C) and set all the defaults +and others to suit your system as required. If you don't know +whether to change something or not, it's probably better to leave +it alone. When you exit the configuration program, answer 'Y' to +the 'Make changes permanent' question. ZMP.FON and ZMP.CFG will +be produced on your disk, in the same drive/user area as the +above files. + + Operation of the program is controlled by escape sequences +entered in terminal mode. Escape-H gives you a list of options. +Most of these are self-explanatory, but they will be summarized +here. + +B - Send Break to modem. + If your overlay has been set up to send a break command + to your UART, this command will perform this function. (Some + remote systems may require a break sent to them to interrupt + Zmodem transfers). + +C - Configure system. + This function is designed to set system defaults, save + phone numbers etc. Changing baud rates etc. for a particular + call are better handled with the escape-L option. If you + answer Y or y to the 'make changes permanent?' question, the + new configuration will be saved in a ZMP.CFG file, and the + phone numbers in a ZMP.FON file for later use. The .CFG file + is read, if it exists, when ZMP is first started. + +D - Get disk Directory. + Gets a directory of the current drive and user area. + Change to another with the escape-F command, described + below. The directory will be sorted and will include + filesizes unless you have so many files on the current + drive/user area that there is insufficient memory available + to sort them. In this case an unsorted directory, without + file sizes, will be printed. + +F - Disk/File operations. + This command is used to change the current drive/user + area, to reset a disk in the current drive, and to view, + erase, print or rename files. There are also options to give + a directory of the current drive/user area, and to supply a + new filename for the capture file. This filename may specify + a different drive/user area than the current one. If capture + mode is on, the status line printed when terminal mode is + entered will state the capture file name. + +H - Get Help. + Prints the ZMP.HLP file. You may then either type CR to + return to terminal mode, or enter the required function key. + +I - Initiate phone call. + Reads the ZMP.FON file, if any, and prints it. You have + four seconds after typing ESC I, during which you may enter + the letter corresponding to the required number, in which + case ZMP will dial it without printing a list. Otherwise the + full phone list will be printed, and you will be asked which + number you want. Enter the identifying letter of the number + you wish to call. You can also enter numbers not in the + list. Multiple numbers can be called by entering them separ- + ated with commas. Dialling will then commence, and will + continue until one of the numbers answers, or until you + abort the process with the escape key. Note that the baud + rate used for the call is that in the .FON file for that + number, or the current one if a new number is entered. This + function works best if the strings in the .CFG file have + been set up for your modem, and the initialisation string + sent to the modem sets it into verbose mode for status + messages (ATV1). + +K - Display Keyboard macros. + The configuration option allows up to ten macro keys to + be defined, and these are recalled by typing escape followed + by the numbers 0 to 9. This function prints the current + assignments. + +L - Change Line settings. + This function allows temporary changes of baud rate, + stop bits, and data bits. There is also an option to operate + terminal mode in full duplex (locally typed characters are + sent but not displayed on the screen), half duplex (locally + typed characters are sent and also displayed on the screen), + or echo mode (as for half duplex, but received characters + are echoed to the remote system as well as being displayed). + Don't have two computers talking to each other in echo mode + unless you're bored. There are also options to allow/dis- + allow control characters above CR to be displayed in term- + inal mode, to strip the parity bit in terminal mode, and to + re-initialise the currently selected UART and modem at the + current baud rate. + Like IMP, ZMP uses location 003C hex to store a value + corresponding to the present baud rate. Then, if you leave + ZMP and later re-enter, it checks location 003C. If it + contains a legal value, then that baud rate is set for you, + otherwise it sets the default baud rate as selected in the + .CFG file. + +M - Toggle capture mode in Memory. + Received characters will be saved in a buffer and saved + in a file named 'ZMP.LOG' when the buffer fills or when the + command is entered again. A control-S/control-Q sequence is + sent to the remote computer while the buffer is being saved + in an attempt to stop it sending more data. + +P - Toggle Printer. + This is similar to the 'M' command, except incoming + characters are sent to the printer. This functions best if + your system performs the BIOS 'List Status' function + correctly. + +Q - Quit the program. + Obvious. You will be asked if this is really what you + want. Any entry other than N or n will exit to CP/M. + +R - Receive a file. + You will be asked which protocol you wish to use. The + default is ZMODEM. The modem option will allow either + 128-byte blocks (standard XMODEM) or 1k blocks (XMODEM-1k), + since this is decided by the transmit end. If an attempt is + made to receive a file which has the same name as a file on + the current drive/user area, the current one will be renamed + to .BAK and the new one will then be received normally. + (However, see below for the transfer resumption feature in + ZMP v1.5 and above). + Note that the byte count on the screen is not kept up- + to-date on Zmodem receive. This is because the data arrives + non-stop and there is simply no time available with non- + interrupt driven computers to update the screen. An update + is performed if errors occur, and when the computer pauses + to write to the disk. + Starting with version 1.4, Zmodem file receive will + commence automatically upon receipt of the sender's ZRQINIT + string. Thus all you need to do is have the sender initiate + the transfer, select the drive and user area you wish + the file(s) to be received on, and wait.. + ZMP v1.5 adds the ability to resume an interrupted + Zmodem transfer. If a Zmodem receive attempt fails (either + because of manual cancellation or massive errors), you will + be asked if you wish to save the portion of the file already + received. If not, it will be erased. If so, and a subsequent + Zmodem receive attempt would result in a file of the same + name, you are asked if you wish to resume the transfer. If + you do, transfer will start at the end of the file. + Otherwise the old file will be renamed to .BAK as before. + Since this feature is a function of the receiver, it should + work with any Zmodem implementation which conforms + reasonably closely to Chuck Forsberg's standard. It has been + tested with ZMP and RZMP, and I would like to hear of any + programs with which it doesn't work. No attempt is made to + determine if the files are the same up to the commencement + point: the Zmodem protocol provides two ways in which this + may be determined (file date and CRC), but neither has yet + been implemented in ZMP. + +S - Send a file. + Operation is similar to the receive function. + Additional options available are ASCII send and the + capability of distinguishing between normal Xmodem and + Xmodem-1k. In Ymodem and Zmodem modes, wildcard filenames + and multiple filenames are allowed. Multiple filenames + should be entered separated by spaces. In all cases, files + on different drives/user areas may be specified by supplying + a zcpr3-style du: prefix (e.g. C7:NEATPROG.WOW). + Byte count information is displayed in Zmodem mode on + transmit. This causes noticeable breaks between packets, but + it is felt that this is outweighed by the usefulness of the + information. ZMP's Zmodem mode is capable of CRC-32 opera- + tion, although CRC-16 mode is used if the receiver is incap- + able of CRC-32. Some other terminal programs, however, do + strange things when faced with a receiving program which + claims it can do CRC-32 (we have encountered one for the + Amiga which exhibits this problem). If this happens, the + esc-L menu and the configuration overlay have an option to + disable CRC-32. + +X - Hangup. + This function causes the modem to disconnect from the + phone line, by momentarily dropping DTR. + +Y - Print screen. + Allows the current screen to be dumped to printer. Note + that this must be supported in the overlay: most terminals + are incapable of this function. The standard overlay prints + 'This function not supported.'. If you can make it work on + your system, good luck! + +Z - Clear screen. + Allows the screen to be cleared. Useful if it fills + with rubbish. + + +4. Other information. + +a) ZMP at higher baud rates. + When I first produced ZMP, I was more interested in + producing a universal Zmodem program than anything else. + Originally (several C compilers ago!) I had difficulty get- + ting it to work even at 300 baud, and so little thought was + given to accommodate higher transmission speeds. In partic- + ular, there is a "designed-in" bug/feature which would prob- + ably preclude ZMP working at much over 4800 baud. The prob- + lem is in the user overlay, in the mrd: routine. The requ- + irement here is to have a routine which returns either when + a character is available at the modem (in which case we + return TRUE), or 100 mS has elapsed (in which case we return + FALSE). The catch is that I used 100 x 1 mS waits, between + which we test for a character. A little calculation will + show that a 9600 baud character will take a little over 1 mS + to transfer, and 19200 baud characters take half this time. + Thus we are practically guaranteed to miss characters at + 19200 baud, and even 9600 baud characters leave little + processing timeto spare. Two possible ways to overcome this + are: + + i) Make the wait time shorter. Thus we could wait 1000 x + 100 uS periods instead. This, however, makes the actual + wait time more unpredictable, since subroutine + call/return times are comparable to the wait time. It + also just puts off the evil day. + + ii) Use a hardware timer to determine whether 100 mS has + elapsed. This is the preferred approach. Thus the mrd: + routine would loop continuously, exiting when either + there was a character at the modem or when the hardware + timer expired. An embryo CP/M-68K version of ZMP using + this approach has proved capable of reliable transfers + at 19,200 baud (although one must admit that it IS + running a 68010 at 10 MHz!). + + I would like to hear from anyone who has had any + success with either of these two approaches. + +5. Acknowledgements. + + ZMP was developed from Hal Maney's Heath-specific HMODEM II. +I would like to thank Hal for writing HMODEM: CP/M users have +been without ZMODEM capability for far too long. As requested in +the source file, acknowledgement is given to him therein. +Appreciations also go to the authors of the Hi-Tech C compiler, +which proved to be capable of producing fast and compact code for +Z80 machines. + ZMP in its various incarnations is refined by suggestions +from you, the user. In particular, I would like to thank Mike +Allen, Richard Kopplin and Fred Haines for their invaluable +suggestions. I may sometimes be a little slow at implementation, +but I usually get there eventually! Fred Haines has also kindly +offered to be the U.S. collection point for bug reports, +suggestions etc. His address appears at the bottom of this +document, and he'll forward them to me via what he calls 'U.S. +Snail'. I will try and respond using what I call 'Australia +Pest'. + I would also like to thank Lindsay Allen, sysop of Z-Node +62. His name was removed from the original zmp11 title screen at +his own request, since I had done most of the work in modifying +Hmodem to work on other machines. Without Lindsay's encouragement +at difficult times, suggestions as to how to go about +recalcitrant procedures, and experience in file transfers, ZMP +would not have been produced. Thank you. + + +6. Finally... + The files contained in this library are placed in the public +domain. Just don't sell it, claim you wrote it, or do anything +similar that might annoy me. Above all, don't bother trying to +sue me if it doesn't work, or you tripped over the disk, or +anything similar. I haven't distributed the source files partly +due to the size of them, partly due to the fact that compilation +is messy (several modifications were needed to "standard" library +functions!), and partly due to the fact that there's still work +to do on them. Besides, I feel a certain fatherly feeling towards +ZMP, having spent most of my spare time for the last four months +working on it. So here's the deal: I will continue to support ZMP +(and RZMP) until I get sick of it. This could take an unknown +amount of time! At that point, I will release the sources into +the RCP/M community, and you may make of them what you will. + ZMP has a remote system relative, called RZMP. This allows +Zmodem transfers to and from remote systems. It should be +available from the same place from which you obtained ZMP. + I have also produced an extremely cut-down version of ZMP +which runs under CP/M-68K, currently running quite well as a +single .68K file (no overlays!) on a system with 128k bytes of +memory. If there is enough interest from CP/M-68k users (are +there any??), I could be persuaded to upgrade this version to the +point where it could be released. + Comments and suggestions are welcome. Bug reports are not so +welcome, but we'd like them anyway! Send either to: + + Z-Node 62 + Perth, Western Australia + (061+) 09-450-0200 + (Soon to be on FidoNet) + + U.S. users may send reports/comments to: + + Fred Haines, + 733 North King's Road, Apt. 356 + Los Angeles, California 90069 + + -- Ron Murray + 26th March, 1989 +te systems. It should be +available from the same place fr diff --git a/Source/Apps/ZMP/Notes.txt b/Source/Apps/ZMP/Notes.txt index 2424af33..76fdf39b 100644 --- a/Source/Apps/ZMP/Notes.txt +++ b/Source/Apps/ZMP/Notes.txt @@ -1,3 +1,6 @@ +This ROMWBW version is an extract of https://github.com/mecparts/zmp/bin +as at Aug 23rd, 2021. + - Overlay files must reside on default drive at time program is launched. This seems to preclude the path search feature of ZSDOS/ZCPR which would be nice. Need to look into this. @@ -13,4 +16,15 @@ - System hangs after error message if there is no CIO 1 unit (fixed) - Initialization messages refer to CIO 1 as CIO 0 (fixed) ---WBW 1:58 PM 8/23/2021 \ No newline at end of file +--WBW 1:58 PM 8/23/2021 + +- Restore cursor on normal program exit. +- Revert original HBIOS conout and default console code as there + is no associated facility for direct HBIOS conin. +- Allow setting port 0 and port 1 CIO device from command line + ZMP 2 sets comms port to CIO 2. Can set primary and secondary + i.e. ZMP 21 but only primary supported on this ZMP version. + Untested on Ron Murrays ZMP15 +- Space getting short so messages shortened. + +--PMS 8/24/2021 \ No newline at end of file diff --git a/Source/Apps/ZMP/zmo-rw01.z80 b/Source/Apps/ZMP/zmo-rw01.z80 index 54435c31..b3412760 100644 --- a/Source/Apps/ZMP/zmo-rw01.z80 +++ b/Source/Apps/ZMP/zmo-rw01.z80 @@ -98,10 +98,6 @@ debug equ false ; to allow debugging of overlay with Z8E etc. overdrive equ 0 ; Drive to find overlay files on ('A'-'P') overuser equ 0 ; User area to find files ; -; Initial ROMWBW CIO device -; -initdev equ 1 ; Second CIO device on system -; ; Initial baud rate code ; initbr equ 10 ; Refer to "baudtbl" table below - brate column @@ -132,7 +128,7 @@ ctrlq equ 11h cr equ 0dh lf equ 0ah bdos equ 5 - +fcb equ 05ch+1 ; Command line codebgn equ $ @@ -174,7 +170,12 @@ jump_tab: jp spare ; spare for later use jp spare ; spare for later use jp spare ; spare for later use - +; +; Port 0 & 1 defaults. Can be overwritten by command line +; +hbport0 db 1 ; default hbios CIO serial port 0 +hbport1 db 2 ; alternate hbios CIO serial port 0 +port: db 1 ; current cio port. ; ; Main code starts here ; @@ -197,9 +198,23 @@ spare: ; millisv (msv) userin: - ld a,-1 ; force re-init - ld (mspeed),a - + ld a,-1 ; force re-init ; forcing reinit will resend AT command to modem, reset + ld (mspeed),a ; current line defaults and eat up buffered characters + + ld a,(fcb) ; first character + cp ' ' ; of parsed filename + jr z,defport0 ; is port 0 + sub '0' + ld (hbport0),a ; set CIO for port 0 + ld (port),a ; reconfigure default +defport0: + ld a,(fcb+1) ; second character + cp ' ' ; of parsed filename + jr z,defport1 ; is port 1 + sub '0' + ld (hbport1),a +defport1: +; push bc ld bc,0f8f0h ; get clock speed in l rst 08 @@ -279,7 +294,7 @@ _loop1: ; User-defined exit routine: leave empty if not needed userout: - + call show ret @@ -417,7 +432,7 @@ init: ; <== Insert your own code here ; using values below call print - db cr,lf,cr,lf,'Initializing CIO device ...',cr,lf,0 + db cr,lf,cr,lf,'CIO Init ...',cr,lf,0 ld a,(port) ; get device type ld c,a @@ -455,9 +470,8 @@ init: jr nz,initerr call print - db 'CIO device initialized: ',0 + db 'Device: ',0 ld a,(port) - ;add a,'0'-1 add a,'0' call cout call print @@ -471,9 +485,8 @@ init: ret initerr: call print - db 'Unable to initialize CIO device: ',0 + db 'Init failed, CIO device: ',0 ld a,(port) - ;add a,'0'-1 add a,'0' call cout call print @@ -520,6 +533,8 @@ baudtbl: ; this routine returning with no changes made. Note that ZMP calls this ; routine with both values for the port on initialisation. ; +; Only originl ZMP calls setport. Mecports +; setport: ld hl,2 ; get port number add hl,sp @@ -528,23 +543,27 @@ setport: ; <== Insert your own code here - inc l ; l = cio 1 or cio 2 + ld a,l ; point to which port + ld hl,hbport0 ; we want to set + or a + jr z,isport0 + inc hl +isport0: + ld c,(hl) ; get the associated CIO port + push hl ld b,06h ; test if a valid cio - ld c,l rst 08 pop hl or a - ld a,l - ld (port),a + ld a,(hl) ; get the associated CIO port jr nz,seterr + ld (port),a ; save the valid port push hl call print db 'Setting CIO device: ',0 pop hl - ld a,l - ;add a,'0'-1 add a,'0' call cout call print @@ -555,8 +574,7 @@ seterr: call print db 'Unable to set CIO device: ',0 pop hl - ld a,l - ;add a,'0'-1 + ld a,(hl) ; get port we wanted to set add a,'0' call cout call print @@ -564,7 +582,7 @@ seterr: ; <== End of your own code ret -port: db initdev ; zmp port 0 = cio 1, zmp port 1 = cio 2 + ;**************************************************************************** ;Video terminal sequences: these are for VT-100: Modify as you wish @@ -754,13 +772,9 @@ cout: push bc ; save regs push de push hl -; ld e,a ; character to E -; ld c,2 -; call bdos ; print it - ld b,01h - ld c,80h - ld e,a - rst 08 + ld e,a ; character to E + ld c,2 + call bdos ; print it pop hl pop de pop bc diff --git a/Source/Apps/ZMP/zmp15+-.new b/Source/Apps/ZMP/zmp15+-.new index 0e027d6b..07e1c277 100644 --- a/Source/Apps/ZMP/zmp15+-.new +++ b/Source/Apps/ZMP/zmp15+-.new @@ -25,5 +25,3 @@ the format of this file." June 7, 2021 -This ROMWBW version is an extract of https://github.com/mecparts/zmp/bin -as at Aug 23rd, 2021.