; cornovl.z80 ; ; user-set overlay for cornflakes/fido mail ; ; rjm 13/11/88 ; modified rjm 13/1/90 to use bye inserts ; ; this version dated 19/2/90 rjm ; " " " 18/2/92 bld ; " " " 14/10/93 bld ; Leave this lot alone. false equ 0 true equ not false no equ false yes equ true cr equ 0dh lf equ 0ah bdos equ 5 imodem equ false ; Don't include intelligent modem stuff in bye ; insert -- we do it in the main program ;------------------------------------------------------------------------------ ; User-set variables ; Note: Unless you have included code in your serial I/O code to cater for ; 4800 & 9600 bps, set the fast equ to.. NO fast equ no ; Leave NO, unless you know what you are doing dtr equ yes ; YES to drop DTR between calls atz equ yes ; YES to do atz between outward calls pabx equ no ; YES if dialling through a pabx system ;------------------------------------------------------------------------------ ; DO NOT ALTER THESE EQUATES, OTHER WISE IT WILL NOT WORK wait1ms equ 400h delay equ wait1ms+3 binbcd equ wait1ms+6 bcdbin equ wait1ms+9 bdelay equ wait1ms+12 ;------------------------------------------------------------------------------ org 0109h ; Start after initial jp, and then some ; Your _must_ place your ENV address here as BYE loads cornflax.com and as ; a result the env pointer does not get set. ; Place your Z3ENV address here.. dw 0f580h ; Your ENV address dw 0 ; Do NOT alter this one ; Jump table: do not change order of this jp getvars ; get variables jp mdinit ; initialise modem and uart jp mdinst ; test for character at modem jp mdoutst ; test for modem tx ready jp mdcarck ; test for carrier jp mdinp ; get character from modem jp mdoutp ; send character to modem jp mdstop ; disconnect modem from line jp mstrout ; send a string to the modem jp imdmto ; get a character with timeout jp gettime ; get time into buffer in hl jp getdate ; get date into buffer in hl jp set300 ; set modem to 300 baud jp set1200 ; set modem to 1200 bps jp set2400 ; set modem to 2400 bps jp set4800 ; set modem to 4800 bps jp set9600 ; set modem to 9600 bps ;--------------------- ; User-supplied data : ;--------------------- ;------------------------------------------------------------------------------ ; Place your local STD area code number here ; Edit this to reflect your local STD number. stdnum: db '09' ; Your local STD code. Up to eight numbers allowed ; DO NOT ALTER THIS! db '-' ; DO NOT alter this one. It is ALWAYS last! ;------------------------------------------------------------------------------ ; Strings etc for smart modem. Use the ~ character to include a 1-second delay. ; ensure the string is null-terminated. ; ; Modem initialisation string: add or delete as you wish, but ensure that ; verbose mode (atv--) is off), auto-answer register (s0) is zero, and wait ; time for remote to answer (s7) is less than 60. S2 is also best reset to ; 43 ('+') since bye510 sets it to 128. If possible, set your modem so that ; it hangs up the phone when DTR is dropped. If this is not possible, be sure ; you enter a hangup string below. initstr:db 'ATV0X4S9=6S7=55',cr,0 ; Hangup string: if there is only the terminating null here, cornflax will ; assume that dropping dtr hangs up the phone. The following byte determines ; the delay in tenths of seconds after dtr is restored before further ; commands will be sent. If the first byte is not a null, the string will be ; sent instead. hangstr: if dtr db 0 ; If dtr hangs ups, don't send a string db 20 ; and wait 2 second afterwards. else db '~+++~ath',cr,0 ; If dtr doesn't hang up endif ; Dial prefix string: usually atdt for tone-dialling exchanges or atdp for ; pulse-dialling ones. Include anything else you wish before the 'dt' or 'dp'. dialstr:db 'ATDT' if pabx db '0W' endif db 0 ; Dial suffix string: usually just a carriage return, but you may have some ; other uses. edstr: db cr,0 ; Modem reset string. Usually atz. atzstr: db 'ATZ',cr,0 ;------------------------------------------------------------------------------ ; ; Insert the name of your bye modem insert here. Ensure that it and the clock ; insert are in the correct drive/user area when you assemble this file! ; include modem.lib ;------------------------------------------------------------------------------ ; ; Insert the name of your bye clock insert here. note that both this and the ; modem insert must be in z80 code. Translate using xiz or whatever if ; necessary. ; include clock.lib ; ;------------------------------------------------------------------------------ ; ** don't change anything below this point ** ; (no user-serviceable parts inside) ; Get time into a 3-byte buffer pointed to by hl in hh:mm:ss order ; 0 <= hh <= 23 ; 0 <= mm <= 60 ; 0 <= ss <= 60 gettime:push bc push de push hl call time ; call bye clock insert pop hl ; restore pointer ld b,3 ; convert 3 bytes ld de,rtcbuf gtloop: ld a,(de) ; get next call bcdbin ; convert to binary ld (hl),a ; store inc hl inc de djnz gtloop pop de pop bc ret ; Get date into a 3-byte buffer pointed to by hl in dd:mm:yy order ; 1 <= dd <= 31 ; 1 <= mm <= 12 ; 0 <= yy <= 99 getdate:push bc push de push hl call time ; call bye clock insert pop hl ; restore pointer ld de,rtcbuf+6 ld b,3 gdlp: ld a,(de) call bcdbin ld (hl),a inc hl dec de djnz gdlp pop de pop bc ret ; Send a null-terminated string in hl to the modem mstrout:ld a,(hl) ; get next character cp '-' jr nz,nodash inc hl ld a,(hl) nodash: call caps ; capitalise inc hl or a ; quit if zero ret z cp '~' ; pause? jr z,mstpaus ; yes push af ; otherwise save it mstr1: call mdoutst ; wait till tx ready jr z,mstr1 pop af call mdoutp ; then send it jr mstrout ; and loop mstpaus:push bc ; wait 1s ld b,10 call bdelay pop bc jr mstrout ; Get a character from the modem, with timeout in b (0.1 s intervals) ; exit with z=1 if timed out. imdmto: push bc imdmto1:ld c,100 ; 100 little loops imdmto2:call mdinst ; test for character jr nz,imdmto3 ; ok, got one call wait1ms ; no, wait 1 ms dec c ; done inside loop? jr nz,imdmto2 ; no djnz imdmto1 ; yes, done all waits? jr imdmto4 ; yes, timed out imdmto3:call mdinp ; get it ld c,0 dec c ; ensure nz pop bc ret imdmto4:xor a ; bad exit pop bc ret ; Capitalise character in a caps: and 07fh ; remove parity cp 'a' ; only a-z ret c cp 'z'+1 ret nc and 05fh ret ;---------------------------------------------------------- if (not fast) set4800: set9600:xor a ; Set flag dec a ; Say not available ret endif ; Get pointers to variables getvars:ld hl,bytevars ; return with address of 1-byte vars ld de,wordvars ; and 2-byte vars ret bytevars: db atz ; do atz between calls? wordvars: dw initstr ; initialisation string dw hangstr ; hangup string dw dialstr ; dial string dw edstr ; end-of-dial string dw atzstr ; atz string dw stdnum ; std phone code ; Dummy rtc buffers to fool bye clock insert rtcbuf: ds 7 cchour: ds 1 ccmin: ds 1 if $ ge 0400h ; cornflax's overlay is especially big. jp xxerror ; overlay too large! endif end