; MLOG.MAC ; ; This program does the following: ; 1. hangs up, then continuously checks for CR ; 2. while waiting, displays the time ; 3. tests and verifies baud rate in following order: ; 300 1200 300 etc (or 1200 2400 300) ; 4. performs user logon with T-14 ; cr equ 0dh lf equ 0ah rl equ 0bh ;reverse linefeed ; chan equ 1 ;channel number defdma equ 80h cfunc equ 5 tfunc equ 50h logon equ 14 ;T-function logon user equ 41 ;user defined T-function savus equ 80h ;save user structure subfunction ; ; externals .request syslib ; extrn print ;print string extrn pstr ;print @HL extrn pafdc extrn cout extrn fi0$open extrn fi0$close extrn f0$get extrn condin extrn cin extrn mafdc extrn crlf ; public sttime,entime,elaptm extrn timdif ; .z80 ;oh yeah, Z-80 only... ; cseg ;code section ; start: ld sp,stack call print db cr,lf,lf,lf,lf db '[MLOG v2.20 (c) ESKAY]',cr,lf db '[AWAITING NEXT CALLER]',cr,lf,0 ld c,10 call tfunc ex de,hl ld de,sttime ;stash away reset time call puttme call revon ;reverse video on ld hl,ctimed call pstr call revoff ;reverse video off call cycle ;cycle phone just to make sure ld c,41 ld b,0 ld h,92h ;get/set break ld l,0 call tfunc ckl: ld hl,table-1 ckl1: inc hl ld a,(hl) cp 0ffh jr z,ckl or a jr z,ckl1 ld e,a call setcom call chkcom jr ckl1 ; setcom: push hl push de ld c,37 ld d,0 call tfunc cokay: pop de ld hl,3000 scl: dec hl ld a,h or l jr nz,scl pop hl ret ; chkcom: call condin jr nz,got call time jr chkcom ; got: and 7fh cp '\' ;time switch jr nz,notsw ld a,(timtgl) cpl ld (timtgl),a notsw: cp 0dh ret nz ; ; got the right baud rate ; gotbd: call print db cr,lf,lf db '[RTDS (c) 1984 ESKAY]',cr,lf db '[MLOG ver 2.20]',cr,lf,0 ld c,10 call tfunc ex de,hl ld de,entime ;stash away reset time call puttme call timdif ld hl,hello call pstr ld de,welfcb ;type the welcome file call typfil ld de,bulfcb ;type the bulletins call typfil ld c,14 ;logon ld e,85h ;to user 5 ld d,0 ;on drive a call tfunc ;do it jp nz,nolog ld c,18 ld de,cmdl call tfunc rst 0 ; cmdl: db 6,'\LOGIN',0 ; nolog: call print db cr,lf db 'Sorry, system is unable to log you on.',cr,lf,lf,0 di halt ; time: push de push hl ld c,40 ld d,0 call tfunc and 20h jr nz,skt ld a,(timtgl) or a jr z,skt ld c,10 call tfunc ld a,(lastm) cp b jr nz,dspl skt: pop hl pop de ret ; dspl: ex de,hl ld de,ctm ld a,b ld (lastm),a call puttme ld de,dblt call video ld hl,curtm call pstr ld de,dblb call video ld hl,curtm call pstr ld de,vt call video pop hl pop de ret ; pdec: cp 10 jr nc,tens push af ld a,'0' ld (de),a inc de pop af tens: jp mafdc ; ; entry: hlb=HHMMSS exit (de)="HH:MM:SS" ; puttme: ld a,h call pdec ld a,':' ld (de),a inc de ld a,l call pdec ld a,':' ld (de),a inc de ld a,b jr pdec ; abort: call print db cr,lf db 7,'*** not allowed to abort ***',7,cr,lf,0 ret ; setbd: ld d,chan ld c,37 jp tfunc ; ; reverse video on ; revon: ld de,rvon jr video ; ; reverse video off ; revoff: ld de,rvof video: ld c,9 jp 5 ; ; cycle DTR ; cycle: ld c,39 ld d,0 ld e,0 ;DTR low call tfunc ld hl,0 clp1: dec hl ld a,h or l jr nz,clp1 ld c,39 ld d,0 ld e,40h jp tfunc ; ; type a bulletin etc ; typfil: call fi0$open ret nz ;don't worry about errors typfl: call f0$get jr nz,typnd cp 1ah jr z,typnd call cout call condin jr z,typfl and 1fh cp 'K'-40h jr z,typnd cp 'C'-40h jr z,typnd cp 'S'-40h jr nz,typfl call cin jr typfl ; typnd: jp fi0$close ; dseg ;data section ; lastm: db 0 ; ; baud rate table, 0=invalid, 0ffh=end ; table: db 5 ;300 baud ; db 6 ;600 baud db 7 ;1200 baud db 10 ;2400 baud db 0ffh ;eof ; rvon: db 27,'d`$' rvof: db 27,'d@$' dblt: db 27,'dL$' dblb: db 27,'dM$' vt: db rl,rl,'$' ; curtm: db ' [' ctm: db '00:00:00]',cr,lf,0 timtgl: db 0 ; hello: db '[' entime: db '00:00:00 WAIT=' elaptm: db '00:00:00]',cr,lf,0 ; ; time display field ; ctimed: db '[LOGOUT AT ' sttime: db '00:00:00]',cr,lf,lf,0 ; welfcb: db 0,'WELCOME ','SYS' ds 24 bulfcb: db 0,'BULLETIN','SYS' ds 24 ds 80 stack equ $ ; end