Metropoli BBS
VIEWER: config.asm MODE: TEXT (ASCII)
proc		ReadGConfig
		push	ds
		mov	ax,MyData
		mov	ds,ax
		mov	si,offset GConfigFile
		call	PutName
		mov	dx,offset GDirectory
                mov     cx,seg GDirectory
		mov	ds,cx
		mov	ax,3D00h
		int	21h
		jb	@@NoFind
		mov	bx,ax
		mov	cx,11
		mov	ax,cs
		mov	ds,ax
		mov	dx,offset GUSPort
		mov	ah,3Fh
                int     21h
		mov	ah,3Eh
                int     21h
		pop	ds
		ret
@@NoFind:	mov	dx,offset NoGCFound
		call	Error
		pop	ds
		ret
endp		ReadGConfig

; si - offset Config file name
proc            ReadConfig
		push	ds
		mov	ax,MyData
		mov	ds,ax
		call	PutName
		mov	dx,offset GDirectory
                mov     cx,seg GDirectory
		mov	ds,cx
		mov	ax,3D00h
		int	21h
		jb	@@SetInfo
		mov	bx,ax
		mov	cx,11
		mov	ax,cs
		mov	ds,ax
		mov	dx,offset Mode
		mov	ah,3Fh
                int     21h
		mov	ah,3Eh
                int     21h
@@SetInfo:	call	GetInfo
		mov	al,[cs:MaxVol]
                mov     [cs:offset MMus+(offset (SMus).MaxVolume)],al
		mov	al,[cs:PlayStat]
		mov	[cs:offset MMus+(offset (SMus).PlayStatus)],al
		mov	cx,00000011b
		call	SetInfo
                cli
		les	di,[cs:offset MMus+(offset (SMus).ChannelLoc)]
		mov	bx,0
@@CopyLoop:	mov	al,[cs:bx+PanPos]
		mov	[es:di+MS.sc_PanPosition],al
		mov	al,[cs:bx+ChanVol]
		mov	[es:di+MS.MasterVolume],al
		add	di,size MS
		inc	bx
		cmp	bx,4
		jnz	@@CopyLoop
		sti
		call	GetInfo
		call	Ed_Percent
		call	Ed_Pan
                call    Ed_PlayStatus
@@NoFind:       pop     ds
		ret
endp            ReadConfig

; si - Config Name
proc            WriteConfig
		push	ds
		mov	ax,MyData
		mov	ds,ax
		call	PutName
		mov	dx,offset GDirectory
                mov     cx,seg GDirectory
		mov	ds,cx
		mov	cx,0
		mov	ah,3Ch
		int	21h
		jb	@@NoFind
		push	ax
		call	GetInfo
                cli
                les     di,[cs:offset MMus+(offset (SMus).ChannelLoc)]
                mov     bx,0
@@CopyLoop:	mov	al,[es:di+MS.sc_PanPosition]
                mov     [cs:bx+PanPos],al
		mov	al,[es:di+MS.MasterVolume]
                mov     [cs:bx+ChanVol],al
                add     di,size MS
                inc     bx
                cmp     bx,4
                jnz     @@CopyLoop
		mov	al,[cs:offset MMus+(offset (SMus).MaxVolume)]
		mov	[cs:MaxVol],al
		mov	al,[cs:offset MMus+(offset (SMus).PlayStatus)]
		mov	[cs:PlayStat],al
                sti
                pop     bx
		mov	cx,11
		mov	ax,cs
		mov	ds,ax
		mov	dx,offset Mode
		mov	ah,40h
                int     21h
		mov	ah,3Eh
                int     21h
@@NoFind:       pop     ds
		ret
endp		WriteConfig

[ RETURN TO DIRECTORY ]