home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
packet
/
rli120.ark
/
INIT.MAC
< prev
next >
Wrap
Text File
|
1987-05-11
|
10KB
|
508 lines
; INIT.MAC - 5/11/87 - Read the configuration file (CONFIG.TNC).
; This code is overlaid by the log file buffer.
.z80
.xlist
maclib TNC.LIB
asciictl
bdosdef
tncdefs
timdef
.list
entry init,logbuf,logsiz
external mcall,ocall,ckdrv,ckro
external @openr,@prtx,@fill,@mcmd,@outch
external rdstr,rdmstr,rdcmd,cmd,parse
external prtcmd,ckname,bindec,decbin,numb,muldec
external cafcb,ffcb,lfcb,mfcb,mbfcb,mofcb,msgfcb
external hfcb,ifcb,ufcb,ubfcb,rfcb,fcb1,defdrv
external settim,blink,ioini,monini
external opnmsg,opnusr,getusr,tnca,tncb
external $memry,memtop,cmdtnc,@docmd
; The following are parameters set by the call to this routine.
external achar,rchar,tchar,wchar
external bkm1,bkm2,bkm3,bkm4,bkm5,bkm6,bkm7,bkm8
external bbmenu,symenu,lmenul,lmenus,rmenus,rmenul
external gmenus,gmenul,seenew,motd,itime,dtime,utime
external mcalls,mxusr,hrdmax,seebea,excill,ndigia,ndigib
external illdig
external logging,loggate,logfile,logmsg,logloc,ncmsg
external bbsa,bbsb,bbsl,infm1,byemsg,lm1,lm2,lm3,lm4,lm5
external tm1,tm2,tm3,tm4,tm5
external mumsg,reqmsg,twotnc,gateok
external monok,moncnt,montim,primet
external scia,scib,scua,scub,scsa,scsb
external talkm1,talkm2,talkm3,talkm4
external gm1,gm2,gm3,gm4,gm5,gm6,gm7,gm9,gm10
external gm11,gm12,gm13,gm14,gm15
external mm1,mm2,mm3,mm4,mm5,mm6,mm7,mm8,mm9,mm9a
external mm10,mm11,mm12,mm13,mm14,mm15
external um1,um2,um3,um4,um5,um6,um7,um8,um9,um9a,um10
external um11,um12,um13,um14,um15,um16,um17,dname
external ucmax,fwdmin,kilfwd,fstay,svcmsg,fm2
external etflg,etmto,etmat,etmty,etmtit,etmerr
external mname,mcant,mfind,mprot,mexst
external mtime,mwhat,mdone
external mbbsq,msnoop,mplsno
@fn macro @f
ld hl,@f
call rdfn
endm
@cchr macro @a
call rdccr
ld (@a),a
endm
@kw macro @a
ld hl,@a
call rdkeyw
endm
@mst macro @a
call mstr
ld (@a),hl
endm
@st macro @a
call str
ld (@a),hl
endm
dseg
logbuf:
inia: ds 2
inib: ds 2
msiz: db '$Q bytes in pool memory.',cr,0
init: ld hl,(dosent+1) ; Last avail address + 1
dec hl
ld (memtop),hl ; Last avail address
call blink ; Link to BIOS character I/O
console ; Set local console
call ioini ; Initialize buffered file I/O
call rdpar ; Read CONFIG.TNC
call tnca
call cmdtnc ; TNC to command mode
docmd inia ; Initialize COMM TNC
cmpm twotnc,false ; Two TNCs?
jr z,inita ; No
call tncb
call cmdtnc ; TNC to command mode
docmd inib ; Initialize PRINTER TNC
inita: console
ld c,cr
call @outch ; TNC left cmd: on line
cmpm yr,0
call z,settim ; Was cold boot, get time/date
call opnmsg ; Open the mail file
call opnusr ; Open the user file
call getusr ; Make owner current user
call monini ; Initialize monitoring. Read CALLS.TNC
; call pioini ; Init PIO
; Tell how much memory left.
ld hl,(memtop)
ld de,($memry)
or a
sbc hl,de ; Available memory
call bindec
ld hl,msiz
call @prtx
ret
fcbad: ds 2
cfcb: db 0,'CONFIG TNC'
rept 24
db 0
endm
cnf1: db 'Error reading configuration file.',cr,0
cnf2: db 'Cannot open configuration file.',cr,0
cnf3: db '$F*** Configuration data:',cr,0
cnf4: db 'TNC on COMM port only.',cr,0
cnf5: db 'TNCs on both COMM and PRINTER ports.',cr,0
cnf6: db 'Gateway available.',cr,0
cnf7: db 'Gateway not available.',cr,0
cnf8: db 'Forward at minute $Q',cr,0
sc: db 'The call of this station is $O',cr,0
fne: db 'Error in file name: ',0
doff: db 'Drive off line: ',0
dro: db 'Drive read only: ',0
rdccr: call rdcmd
jp z,cnfe
ld a,(cmd)
sub 40H
ret
rdfn: ld (fcbad),hl
call rdcmd
jp z,cnfe
call parse
ckname fcb1
jr z,rdfnc
ld a,(fcb1)
call ckdrv
jr nc,rdfnd
ld a,(fcb1)
call ckro
jr c,rdfne
ld de,(fcbad)
zmov ,fcb1,fcbsize
ret
rdfnc: ld hl,fne
call @prtx
jr rdfnx
rdfnd: ld hl,doff
call @prtx
jr rdfnx
rdfne: ld hl,dro
call @prtx
rdfnx: call prtcmd
jp cnfe
rdnumb: call rdcmd
jp z,cnfe
call parse
zmov numb,fcb1+1,5
call decbin
ld a,l ; Return 8 bit value in A
ret
rdkeyw: ld (hl),false
push hl
call rdcmd
pop hl
jp z,cnfe
cmpm cmd,'Y'
jr nz, rdkw1
ld (hl),true
ret
rdkw1: cmpm cmd,'B' ; Busy hours?
jr nz, rdkw2
ld (hl),btime
ret
rdkw2: cmpm cmd,'Q' ; Quiet hours?
jr nz, rdkw3
ld (hl),qtime
ret
rdkw3: cmpm cmd,'N'
jp nz, cnfe
ret
rdtim: push hl
call rdcmd
pop hl
jp z, cnfe
ld de, cmd ;Point at string of 0s and 1s
ld b, 3 ;Count 3 bytes
rdtl1: push bc
ld b, 8 ;Count 8 bits per byte
rdtl2: ld a, (de) ;Char from config line
inc de
cp '0'
jr z, rdtn2
cp '1'
jp nz, cnfe ;Err if not 0 or 1
ccf
rdtn2: rl c ;Shift CY into byte
dec b ;Count 8 hours
jr nz, rdtl2
ld (hl),c ;Store 8 bits of hours
inc hl
pop bc
dec b ;Count 3 bytes of 8 hours each
jr nz, rdtl1
ret ;Read 24 hours (3 bytes)
mstr: call rdmstr
jp z,cnfe
ret
str: call rdstr
jp z,cnfe
ret
cnfe: ld hl,cnf1
call @prtx
jp wboot
cnfq: ld hl,cnf2
call @prtx
jp wboot
rdpar: ld hl,cnf3
call @prtx
ld a,(dfcb1+1)
cp ' '
jr z,rdpara ; No file given on command line.
zmov cfcb,dfcb1,16
ld a,(cfcb)
or a
jr nz,rdpara
ld a,(defdrv)
inc a
ld (cfcb),a
rdpara: openr cfcb
jp z,cnfq
; Message-of-the-day
@mst motd
prtx motd
; The remote menus
@mst bbmenu ; Menu for connected bbs
@mst symenu ; Remote sysop menu
@mst rmenus
@mst rmenul
; Gateway menus
@mst gmenus
@mst gmenul
; Local menu
@mst lmenus
@mst lmenul
; Multi-line messages
@mst mbbsq ; Ask for his home BBS
@mst msnoop ; Msg sent to mail snoopers
@mst mplsno ; Ask him not to S while *** linked
; Who are we?
call rdcmd
jp z,cnfe
fill ocall,6,' '
movcmd ocall,0,6
zmov mcall,ocall,6
ld hl,sc
call @prtx
; File names.
@fn hfcb
@fn ifcb
@fn cafcb
@fn ffcb
@fn lfcb
@fn mofcb
@fn msgfcb
@fn mfcb
@fn mbfcb
@fn ufcb
@fn ubfcb
; Allow download of "new" files?
@kw seenew
; Exclude user with illegal call?
@kw excill
; Exclude connect thru digi with illegal call?
@kw illdig
; Allow only BBS on COMM or PRINTER or LINKED
@kw bbsa
@kw bbsb
@kw bbsl
; Get busy/quiet hours
ld hl, primet
call rdtim
; # digi allowed on connect.
call rdnumb
ld (ndigia),a
call rdnumb
ld (ndigib),a
; Minutes timeout waiting for input from user.
call rdnumb
ex de,hl
ld c,60
call muldec
ld (itime),de
; Minutes allowed in GateWay monitor mode.
call rdnumb
ex de,hl
ld c,60
call muldec
ld (montim),de
; Max lines allowed in GateWay monitor mode.
call rdnumb
ld (moncnt),hl
; Seconds timeout waiting for disconnect.
call rdnumb
ld (dtime),hl
; Seconds between "user" routine calls.
call rdnumb
ld (utime),hl
; Max # calls in monitor list.
call rdnumb
ld (mcalls),hl
; Max # users in user file.
call rdnumb
ld (mxusr),hl
; Max # calls for "recent calls seen" lists.
call rdnumb
ld (hrdmax),hl
; Monitor beacons?
@kw seebea
; Are there two TNC's?
@kw twotnc
cmpm twotnc,true
ld hl,cnf5
jr z,cnfc
ld hl,cnf4
cnfc: call @prtx
; Is gateway avail?
@kw gateok
ld hl,cnf7
cmpm twotnc,true
jr nz,cnff
cmpm gateok,true
jr nz,cnff
ld hl,cnf6
cnff: call @prtx
@kw monok ; Monitor thru gate?
; Logging
@kw logging
@kw loggate
@kw logfile
@kw logmsg
@kw logloc
@st ncmsg
; Message to send at disconnect.
@st byemsg
; Info about calls heard header.
@st infm1
; Local messages.
@cchr achar
@cchr rchar
@cchr tchar
@cchr wchar
@st lm1
@st lm2
@st lm3
@st lm4
@st lm5
; Prompt text for setting day clock.
@st tm1
@st tm2
@st tm3
@st tm4
@st tm5
; TNC state changes
@mst scia
@mst scib
@mst scua
@mst scub
@mst scsa
@mst scsb
; TNC initialization
@mst inia
@mst inib
; Text for local display of user call.
@st mumsg
; Text to send when get connect request.
@st reqmsg
; Various "talk to the owner" texts.
@st talkm1
@st talkm2
@st talkm3
@st talkm4
; The GateWay messages
@st gm1
@st gm2
@st gm3
@st gm4
@st gm5
@st gm6
@st gm7
@st gm9
@st gm10
@st gm11
@st gm12
@st gm13
@st gm14
@st gm15
; MailBox messages.
@st mm1
@st mm2
@st mm3
@st mm4
@st mm5
@st mm6
@st mm7
@st mm8
@st mm9
@st mm9a
@st mm10
@st mm11
@st mm12
@st mm13
@st mm14
@st mm15
; What minute of the hour to attempt auto-forwarding.
call rdnumb
ld (fwdmin),a
ld hl,cnf8
call @prtx
; Max calls in unread mail list.
call rdnumb
ld (ucmax),hl
; Kill message after forward?
@kw kilfwd
; F message stays after forward?
@kw fstay
; Generate service msg after KT?
@kw svcmsg
; Allow non-sysop to do ET command?
@kw etflg
; Messages for ET command
@st etmto
@st etmat
@st etmty
@st etmtit
@st etmerr
; Upload/download prompts.
@st fm2
; User file text.
@st dname
@st um14
@st um6
@st um1
@st um2
@st um15
@st um9a
@st um4
@st um16
@st um17
@st um3
@st um10
@st um5
@st um7
@st um8
@st um9
@st um11
@st um12
@st um13
; Error/status messages.
@st mname
@st mcant
@st mfind
@st mprot
@st mexst
@st mtime
@st mwhat
@st mdone
@st bkm1
@st bkm2
@st bkm3
@st bkm4
@st bkm5
@st bkm6
@st bkm7
@st bkm8
ret
logsiz equ $-logbuf
end