;Program: DIALER ;Version: 1.0 ;Author: Bruce Morgen ;Date: July 23, 1991 ;Purpose: DIALER is a hardware-independent voice call phone ; dialer for Z-System and Hayes-compatible modems. ; It assumes only that data can be sent to the modem ; via the PUN: device and that the modem will accept ; the string "ATX0S7=0" to allow blind dialing (no ; dial tone or busy signal detection) and not wait ; for a carrier before going back on-hook. Result ; codes are not read at all -- the RDR: device would ; have to be used to maintain hardware-independence ; and that device has no character-ready status ; capability according to DRI specs. ; DIALER does not read or maintain a mnemonic phone ; number directory. It was written to relieve the ; tedium of manual number entry to find out my ; checking account balance via "touch-tone banking." ; Anyone who has struggled to read his/her access ; number from a shiny plastic card after a hard day ; squinting at a CRT and THEN had to hand enter it ; on a phone keypad will understand why I prefer a ; DIALER-based Z-System script. I don't do this ; (at least not yet), but DIALER could readily be ; used for general purpose phone dialing through use ; of constructs like SHVAR/RESOLVE variables and/or ; ALIAS/ARUNZ script lines. DIALER can also output ; "raw" modem control strings, which may give it ; some more general utility beyond voice call ; dialing. ;Production: Standard Z-System utility sequence, can be linked ; as Type 3 or Type 4. Assembles with ZMAC, M80, ; ZAS, or an SLR Zilog-convention assembler, links ; with ZML (recommended, especially for Type 4), or ; SLRNK+. LINK, SLRNK, L80, etc. should also work, ; but weren't tested and might entail more effort. .request z3lib,syslib public $memry,pstr extrn crlf,cout,cin,pout,sksp,isdigit,isgraph,isalpha,phl4hc extrn bline,eprint,epstr,print,z3init,waitp1s,prtnam fcb equ 5ch tbuff equ 80h cr equ 13 lf equ 10 entry: jp start ; We begin db 'Z3ENV',3 z3eadr: dw 00 dw entry $memry: ds 2 start: ld hl,(z3eadr) ; Get environment pointer call z3init ; Educate Z3LIB xor a ; Clear carry, A = 0 ld hl,(fcb+1) ; Get possible help query "//" ld de,'//' ; Get actual "//" sbc hl,de ; Test jp z,help ; Give help if requested ld (qflag),a ; Muzzle PSTR for now cpl ld (rawflg),a ; Go to raw mode ld a,(runflg) ; Invoke by GO or JUMP? or a jp nz,running ; Then skip init. and prompt cpl ld (runflg),a ; Set the GO/JUMP indicator call eprint ; First user prompt db 'Make sure the modem is on, pick up the phone,' db ' and press RET (Control-C aborts).',0 call cin ; Get character cp 3 ; Test for abort ret z ; Abort if wanted call print ; Reset modem to defaults db 'ATZ',0 ld a,cr call pout call halfsec ; Allow modem to digest command call print ; Blind dial & no carrier wait db 'ATX0S7=0',0 ld a,cr call pout call halfsec ; Allow modem to digest command running: ld hl,tbuff ; Point at tail character count getnbr: xor a ; Get a zero ld (rawflg),a ; Turn off raw mode add a,(hl) ; Get character count jp z,nonumbr ; If none, go get some ld (qflag),a ; Remove PSTR's muzzle inc hl ; Bump to first tail character call sksp ; Skip any spaces ld a,(hl) ; See if its a null or a ret z ; Done if so call eprint ; Tell user what we're doing db cr,lf,'Dialing: ',0 cp '/' ; The control string test jr nz,notraw ; It's not if NZ ld (rawflg),a ; Otherwise turn raw back on inc hl ; Bump, call sksp ; skip blanks, jr raw ; & send notraw: call print ; Send dialing prefix first db 'ATDT',0 raw: call pstr ; Then the string ld a,cr call pout jp nc,crlf ; All done if NC call eprint ; Otherwise, prompt user db cr,lf,'Press Control-C to abort, R to repeat last' db cr,lf,'number, any other key to dial next number.',0 call cin ; Get his/her response cp 3 ; Abort? ret z ; Done if so and 5fh ; Caps cp 'R' ; Repeat last string? jr nz,jploop ; No, proceed to next one ex de,hl ; Yes, get old pointer back dec hl ; Adjust & jploop: jp getnbr ; Loop around nonumbr: call eprint ; Prompt for input db cr,lf,'Please enter the number you want to dial,' db cr,lf,'start with "/" for direct modem control: ',0 ld hl,($memry) ; Get first available memory ld a,((z3eadr-1)) ; Get Z3 COMfile type cp 4 ; Type 4? jr nz,ednmbr ; No, use $MEMRY ld hl,entry-128 ; Yes, use memory beneath us ednmbr: ld (hl),126 ; Maximum length call bline ; Call BDOS via SYSLIB or a ; Any characters? jr nz,movnbr ; Yes, go move them call crlf ; Otherwise newline to CON: jr nonumbr ; and try again movnbr: inc a ; Bump count to include null ld de,tbuff ; Destination buffer's counter ld (de),a ; Poke in ours inc de ; Destination buffer's start ld b,d ; B = D = 0 ld c,a ; Count now in BC ldir ; Move 'em out call crlf ; Newline to CON: jp running ; Do the big loop around pstr: ld d,h ; Save initial pointer into DE ld e,l pstrlp: ld a,(hl) ; Get character or a ; Test for terminal null ret z ; Return if found cp '&' ; Test for string separator scf ; Set CPU carry flag ret z ; Return if found inc hl ; Bump pointer for next loop ld b,a ; Stow character in B ld a,(rawflg) ; Are we raw? or a ld a,b ; Get back character jr nz,pstr0 ; Yes, skip the testing call isgraph ; Must be printable jr nz,pstrlp ; Otherwise skip it call isalpha ; A letter? jr z,pstr1 ; Then send it quietly call isdigit ; A number? jr z,pstr0 ; Then send it noisily cp ',' ; A comma (Hayes pause)? jr z,pstr1 ; Then send it quietly cp '#' ; Pound key? jr z,pstr0 ; Then send it noisily cp '*' ; Asterisk? jr nz,pstrlp ; If not, skip it pstr0: ld b,a ; Save character in B again ld a,(qflag) ; Test muzzler or a ld a,b ; Get back character call nz,cout ; To CON: if not muzzled pstr1: call pout ; To modem call waitp1s ; Sensible inter-character delay jr pstrlp ; Loop for next one halfsec: ld b,5 ; Set counter halflp: call waitp1s ; Delay 1/10 second djnz halflp ; Count down ret ; Return to caller help: call eprint db 'DIALER, Version 1.0, Voice Phone Dialing Utility (Type ',0 ld a,((z3eadr-1)) add a,'0' call cout call eprint db ' at ',0 ld hl,entry call phl4hc call eprint db 'h)',cr,lf db 'Syntax:',cr,lf,' ',0 call prtnam call eprint db ' phone_number_string[&phone_number_string&....]',cr,lf,' ',0 call prtnam call eprint db ' /modem_control_string',cr,lf,' ',0 call prtnam call eprint db ' {prompts user for input}',0 ret dseg runflg: db 0 ; Non-zero if GO/JUMP re-run rawflg: ds 1 ; Non-zero for raw control string qflag: ds 1 ; PSTR muzzled if zero end