; ; System-dependent code / assembly code overlay for RZMP ; ; Insert your own code as necessary in this file. Code contained herein ; has been written in Z80 code for use with M80. Once assembled, ; convert to hex with RELHEX and use MLOAD to overlay it over the main ; RZMPX.COM file to produce your very own RZMP.COM. ; ; Notes on modifying this file: ; Hi-Tech C requires that functions do not change either index register ; (IX or IY). If your overlay requires either of these to be changed, ensure ; they are restored to their original values on return. ; Since collecting parameters from C functions can be tricky, only change ; the parts marked 'Insert your own code here'. Do NOT modify the jump ; table at the start. Do NOT modify the entry/exit sections of each ; function. Do NOT pass 'GO'. Do NOT collect $200. You should, however, ; modify the section marked 'user-set variables' to reflect your system ; configuration. ; This file is derived from the main ZMP installation overlay file, and ; contains the same jokes. It has, however, been modified to remove the ; necessity for modem stuff to be included. These are handled by BYE5 and ; later: note that BYE must be running for it to work. ; Terminal characteristics are also included: these are useful if you are ; monitoring a call on the remote system. Most have been set up for ADM-3A ; (with a few of my own additions). Modify to suit your own terminal. An ; inline print routine is provided for printing strings in the usual way: ; usage is ; ; call print ; db 'required string',0 ; ; If you find your overlay exceeds the maximum size (currently 0400h), ; you will have to re-compile the whole thing. Good luck. You might try ; informing us if you need to do this: if too many people need to do it, we ; haven't allowed enough room. ; ; Ron Murray 8/9/88 ; ;****************************************************************************** ;User-set variables: whladd equ 03eh ; Address of wheel byte ; If your system doesn't support a wheel byte ; for system security, set this to point to a ; byte which is permanently zero. All incoming ; callers will then have the same security ; level -- there will be no special features ; for the sysop. mspeed equ 03ch ; Address of mspeed byte ;The following two addresses point to memory which will be incremented on ; each upload/download. If your system doesn't use this feature, set them ; to point to 'junk'. uploads equ junk ; Address of upload count byte dnloads equ junk ; Address of download count byte defdrv equ 'B' ; Default upload du: for non-wheels defusr equ 0 ; B0: logdrv equ 'A' ; du: for .LOG file logusr equ 14 ; A14: (not yet implemented) upridrv equ 'B' ; du: for private uploads upriusr equ 15 ; B15: dpridrv equ 'B' ; du: for private downloads dpriusr equ 14 ; B14: clkspd equ 4 ; Processor clock speed in MHz ;****************************************************************************** ;Don't change the following equates userdef equ 0145h ; origin of this overlay: get this value ; from the .SYM file produced when RZMP.COM ; is linked ovsize equ 0400h ; max size of this overlay ;****************************************************************************** .z80 ; use z80 code aseg ; absolute org userdef esc equ 1bh ctrlq equ 11h cr equ 0dh lf equ 0ah bdos equ 5 codebgn equ $ ;Jump table for the overlay: do NOT change this jump_tab: jp getvars ; get system variables jp mrd ; modem read with timeout jp mchin ; get a character from modem jp mchout ; send a character to the modem jp mordy ; test for tx buffer empty jp mirdy ; test for character received jp sndbrk ; send break jp cursadd ; cursor addressing jp cls ; clear screen jp invon ; inverse video on jp invoff ; inverse video off jp hide ; hide cursor jp show ; show cursor jp savecu ; save cursor position jp rescu ; restore cursor position jp mint ; service modem interrupt jp invec ; initialise interrupt vectors jp dinvec ; de-initialise interrupt vectors jp mdmerr ; test uart flags for error jp dtron ; turn DTR on jp dtroff ; turn DTR OFF jp init ; initialise uart jp wait ; wait seconds jp mswait ; wait milliseconds jp userin ; user-defined entry routine jp userout ; user-defined exit routine ;Spares to accommodate future additions jp spare ; spares for later use jp spare ; spares for later use jp spare ; spares for later use jp spare ; spares for later use jp spare ; spares for later use ; ; Main code starts here ; ;User-defined entry routine userin: ret ;User-defined exit routine userout: ret ;Bad filetypes: rzmp won't send these unless WHEEL is set. They will be ; renamed to .OBJ on receive, also unless WHEEL is set. They can be in upper ; or lower case, but must be exactly THREE characters long. A null terminates ; the list. There's no limit to the size of the list, consistent with the ; maximum overlay size. badtypes: db 'com' ; No .COM files db 'env' ; No ZCPR3 .ENV db 'fcp' ; or .FCP db 'iop' ; or .IOP db 'ndr' ; or .NDR db 'rcp' ; or .RCP db 0 ; end of list: leave this! ;**************************************************************************** ;Video terminal sequences: these are for ADM-3A: Modify as you wish ;Cursor addressing: cursadd: ld hl,2 ; get parameters add hl,sp ex de,hl call getparm ; in HL ld (row),hl ; row call getparm ld (col),hl ; column ; <== Insert your own code here ; using values in row and col call print db esc,'=',0 ; ADM-3A leadin ld a,(row) ; row first add a,' ' ; add offset call cout ld a,(col) ; same for column add a,' ' call cout ; <== end of your own code ret row: ds 2 ; row col: ds 2 ; column ;Clear screen: cls: call print db 01ah,0 ret ;Inverse video on: invon: call print db esc,')',0 ret ;Inverse video off: invoff: call print db esc,'(',0 ret ;Turn off cursor: hide: ret ;Turn on cursor: show: ret ;Save cursor position: savecu: ret ;Restore cursor position: rescu: ret ;**************************************************************************** ;Service modem interrupt: mint: ret ; my system doesn't need this ;Initialise interrupt vectors: invec: ret ; ditto ;De-initialise interrupt vectors: dinvec: ret ; ditto ;****************** End of user-defined code ******************************** ;*************** Don't change anything below this point ********************* spare: ret ;Get a character from the modem: return in HL mchin: ld c,64 ; BYE function 64 call bdos ld h,0 ld l,a or a ret ;Send a character to the modem mchout: ld hl,2 ; get the character add hl,sp ld e,(hl) ld c,63 ; BYE function 63 call bdos ret ; done ;Test for output ready: return TRUE (1) in HL if ok mordy: ld c,62 ; BYE function 62 call bdos ld hl,0 ; assume not ready or a jr z,mordy1 ld hl,1 ; ready mordy1: ret ;Test for character at modem: return TRUE (1) in HL if so mirdy: push bc ; must save bc for mrd() ld c,61 ; BYE function 61 call bdos ld hl,0 ; assume not ready or a jr z,mirdy1 ld hl,1 mirdy1: pop bc ret ;Send a break to the modem: leave empty if your system can't do it sndbrk: ret ; It's not going to be easy with BYE ;Test UART flags for error: return TRUE (1) in HL if error mdmerr: ld hl,0 xor a ; set no error ret ; not used ;Turn DTR ON dtron: ret ; not used ;Turn DTR OFF dtroff: ret ; not used ;Initialise the UART init: ret ; not used ;Return pointer to system variables getvars: ld hl,sysvars ret ;Modem character test for 100 ms mrd: push bc ; save bc ld bc,100 ; set limit mrd1: call mirdy ; char at modem? jr nz,mrd2 ; yes, exit ld hl,1 ; else wait 1ms call waithlms dec bc ; loop till done ld a,b or c jr nz,mrd1 ld hl,0 ; none there, result=0 xor a mrd2: pop bc ret ; Inline print routine: destroys A and HL print: ex (sp),hl ; get address of string ploop: ld a,(hl) ; get next inc hl ; bump pointer or a ; done if zero jr z,pdone call cout ; else print jr ploop ; and loop pdone: ex (sp),hl ; restore return address ret ; and quit ; ;Output a character in A to the local console only ; cout: push bc ; save regs push de push hl ld e,a ; character to E ld c,68 ; BYE function 68 call bdos ; print it pop hl pop de pop bc ret ;Wait(seconds) wait: ld hl,2 add hl,sp ex de,hl ; get delay size call getparm ; fall thru to.. ;Wait seconds in HL waithls: push bc ; save bc push de ; de push ix ; and ix ld ix,0 ; then point ix to 0 ; so we don't upset memory-mapped i/o ;Calculate values for loop constants. Need to have two loops to avoid ; 16-bit overflow with clock speeds above 9 MHz. outerval equ (clkspd / 10) + 1 innerval equ (6667 / outerval) * clkspd wait10: ld b,outerval wait11: ld de,innerval wait12: bit 0,(ix) ; time-wasters bit 0,(ix) bit 0,(ix) ; 20 T-states each bit 0,(ix) bit 0,(ix) bit 0,(ix) dec de ld a,e ld a,d or e jr nz,wait12 ; 150 T-states per inner loop djnz wait11 ; decrement outer loop dec hl ; ok, decrement count in hl ld a,h or l jr nz,wait10 pop ix ; done -- restore ix pop de ; de pop bc ; and bc ret ;Wait milliseconds mswait: ld hl,2 add hl,sp ex de,hl ; get delay size call getparm ; fall thru to.. ;Wait milliseconds in HL waithlms: push de w1ms0: ld de,39 * clkspd w1ms1: dec de ld a,d or e jr nz,w1ms1 dec hl ld a,h or l jr nz,w1ms0 pop de ret ;Get next parameter from (de) into hl getparm: ex de,hl ; get address into hl ld e,(hl) ; get lo inc hl ld d,(hl) ; then hi inc hl ; bump for next ex de,hl ; result in hl, address still in de ret ;------------------------------------------------------------------------------ ;User variables appear here sysvars: dw whladd ; address of wheel byte dw mspeed ; address of mspeed byte dw uploads ; address of upload count dw dnloads ; address of download count dw badtypes ; bad filetype list dw junk ; spare dw junk ; spare dw junk ; spare dw junk ; spare dw junk ; spare db defdrv,defusr ; default upload du: db logdrv,logusr ; du: for .LOG files db upridrv,upriusr ; du: for private uploads db dpridrv,dpriusr ; du: for private downloads ;------------------------------------------------------------------------------ junk: ds 2 ; junk bytes: no significance if ($ - codebgn) gt ovsize toobig: jp errval ; Overlay too large! endif end