home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
tbsource.lha
/
TBSource
/
NBBS
/
SetProg
/
SetProg.bak
next >
Wrap
Text File
|
1993-12-21
|
26KB
|
1,246 lines
***********************************************
* *
* (C)opyright 1991 *
* *
* by Tomi Blinnikka *
* *
* Don´t try to understand the code *
* *
* NBBS IISUP *
* (Intuition Interfaced SetUp Program) *
* *
***********************************************
INCLUDE "JMPLibs.i"
INCLUDE "exec/types.i"
INCLUDE "exec/io.i"
INCLUDE "libraries/dos.i"
INCLUDE "libraries/reqbase.i"
INCLUDE "devices/serial.i"
INCLUDE "intuition/intuition.i"
INCLUDE "XREF:dos.xref"
INCLUDE "XREF:gfx.xref"
INCLUDE "XREF:intuition.xref"
INCLUDE "XREF:exec.xref"
XREF _CreatePort
XREF _DeletePort
XREF _CreateExtIO
XREF _DeleteExtIO
XREF _printf
XDEF _DOSBase
XDEF _SysBase
XDEF _stdout
DReq set 1
section NBBS,CODE
Start: move.l a0,ConfigAddress ;Get Config filename
clr.b -1(a0,d0.l) ;add null to end of filename
openlib Dos,ShutDown
move.l _DosBase,_DOSBase
move.l $4,_SysBase
lib Dos,Output
move.l d0,_stdout
move.l ConfigAddress,a0
tst.b (a0)
bne GotFileName
jmp StartMain
GotFileName:
;Move filename to FRPathName so if user saves straight away it goes into
;the correct file, and not the default one.
move.l ConfigAddress,a0
lea.l FRPathName,a1
cmp.b #"?",(a0)
beq CommandLineHelp
CopyFName: move.b (a0)+,(a1)+
cmp.b #$00,(a0)
bne CopyFName
clr.b (a1)
move.l ConfigAddress,a0
lea.l FRFile,a1
CopyFName1: move.b (a0)+,(a1)+
cmp.b #$00,(a0)
bne CopyFName1
clr.b (a1)
move.l ConfigAddress,d1
move.l #MODE_OLDFILE,d2
lib Dos,Open
move.l d0,ConfigFile
beq ConfigNotOpen
move.l ConfigFile,d1
lea.l CONFIG,a0
move.l a0,d2
lea.l CONFIG,a1
lea.l CONFIG_END,a2
sub.l a1,a2
move.l a2,d3
lib Dos,Read
jsr SetGads
;Close config file, we've got what we want
move.l ConfigFile,d1
lib Dos,Close
move.l #$00,ConfigFile
move.l #$01,CheckSum
StartMain: move.l #2,d0
move.l $4,a6
lea.l _ReqLib,a1
jsr _LVOOpenLibrary(a6)
move.l d0,_ReqBase
beq NoShutDown
;Reset checksum so we can tell if the user has played with any of the
;gadgets, and later if (s)he has, warn him/her about it before quitting
move.l #$00,CheckSum
openlib Intuition,ShutDown
openlib Gfx,ShutDown
;Find our task
move.l #$00,a1
lib Exec,FindTask
move.l d0,OurTask
move.l d0,a0
move.l $b8(a0),OldTaskWinPtr
;Open Screen
lea.l NewScreen1,a0
lib Intuition,OpenScreen
move.l d0,Screen1
beq ShutDown
move.l d0,SToW1
move.l d0,SToW2
move.l d0,SToW3
move.l d0,SToW4
move.l d0,SToW5
move.l d0,SToW6
move.l d0,SToW7
add.l #$2c,d0
move.l d0,ViewPort1
;Open Window1
StartWin1: lea.l NewWindow1,a0
lib Intuition,OpenWindow
move.l d0,Window1
beq ShutDown
move.l d0,a0
move.l $32(a0),RP1
;Close the second, third or fourth window
move.l Window2,a0
jsr ClearMSGs
move.l #$00,Window2
move.l Window3,a0
jsr ClearMSGs
move.l #$00,Window3
move.l Window4,a0
jsr ClearMSGs
move.l #$00,Window4
;move requesters to Window1
move.l OurTask,a0
move.l Window1,$b8(a0)
;Add Menus to Window1
move.l Window1,a0
lea.l Menu1,a1
lib Intuition,SetMenuStrip
;Add all the texts to Window1 of course
move.l RP1,a0
lea.l Win1Txt1,a1
move.l #$00,d0
move.l #$00,d1
lib Intuition,PrintIText
;Read page 215 Paragraph 3 of the RKRM L&D, activate string 1st Gad!
lea.l SerBRKTGad,a0
move.l Window1,a1
move.l #$00,a2
lib Intuition,ActivateGadget
;Reset ActiveWinNum
move.w #$01,ActiveWinNum
Window1IDCMP: cmp.w #$01,ActiveWinNum
beq Window1IDCMP1
cmp.w #$02,ActiveWinNum
beq Window2IDCMP1
cmp.w #$03,ActiveWinNum
beq Window3IDCMP1
cmp.w #$04,ActiveWinNum
beq Window4IDCMP1
INCLUDE "LWF:NBBS/SetProg/SPWin1IDCMP.i"
INCLUDE "LWF:NBBS/SetProg/SPSetGads.i"
INCLUDE "LWF:NBBS/SetProg/SPSetSer.i"
StartWin2:
;Open Window2
lea.l NewWindow2,a0
lib Intuition,OpenWindow
move.l d0,Window2
beq ShutDown
move.l d0,a0
move.l $32(a0),RP2
;Move the requesters to the window now active
move.l OurTask,a0
move.l Window2,$b8(a0)
;Close the first, third or fourth window
move.l Window1,a0
jsr ClearMSGs
move.l #$00,Window1
move.l Window3,a0
jsr ClearMSGs
move.l #$00,Window3
move.l Window4,a0
jsr ClearMSGs
move.l #$00,Window4
Win2Start1:
;Add Menus to Window2
move.l Window2,a0
lea.l Menu1,a1
lib Intuition,SetMenuStrip
move.w #$02,ActiveWinNum
;Activate 1st string gad.
; lea.l Gad,a0
move.l Window2,a1
move.l #$00,a2
; lib Intuition,ActivateGadget
jmp Window1IDCMP
StartWin3:
;Open Window3
lea.l NewWindow3,a0
lib Intuition,OpenWindow
move.l d0,Window3
beq ShutDown
move.l d0,a0
move.l $32(a0),RP3
;Move the requesters to the window now active
move.l OurTask,a0
move.l Window3,$b8(a0)
;Close the first, second or fourth window
move.l Window1,a0
jsr ClearMSGs
move.l #$00,Window1
move.l Window2,a0
jsr ClearMSGs
move.l #$00,Window2
move.l Window4,a0
jsr ClearMSGs
move.l #$00,Window4
Win3Start1:
;Add Menus to Window3
move.l Window3,a0
lea.l Menu1,a1
lib Intuition,SetMenuStrip
move.w #$03,ActiveWinNum
;Activate 1st string gad.
; lea.l Gad,a0
move.l Window3,a1
move.l #$00,a2
; lib Intuition,ActivateGadget
jmp Window1IDCMP
StartWin4:
;Open Window4
lea.l NewWindow4,a0
lib Intuition,OpenWindow
move.l d0,Window4
beq ShutDown
move.l d0,a0
move.l $32(a0),RP4
;Move the requesters to the window now active
move.l OurTask,a0
move.l Window4,$b8(a0)
;Close the first, second or third window
move.l Window1,a0
jsr ClearMSGs
move.l #$00,Window1
move.l Window2,a0
jsr ClearMSGs
move.l #$00,Window2
move.l Window3,a0
jsr ClearMSGs
move.l #$00,Window3
Win4Start1:
;Add Menus to Window4
move.l Window4,a0
lea.l Menu1,a1
lib Intuition,SetMenuStrip
move.w #$04,ActiveWinNum
;Activate 1st string gad.
; lea.l Gad,a0
move.l Window4,a1
move.l #$00,a2
; lib Intuition,ActivateGadget
jmp Window1IDCMP
NoReq: print <"You need req.library ver.2.5 or higher!",13,10>,_stdout
jmp ShutDown
ShutDown: move.l OurTask,a0
move.l OldTaskWinPtr,$b8(a0)
tst.l ConfigFile
beq ShutDown9000
move.l ConfigFile,d1
lib Dos,Close
move.l #$00,ConfigFile
ShutDown9000:
ShutDown5000: tst.l Window1
beq ShutDown4900
move.l Window1,a0
lib Intuition,ClearMenuStrip
move.l Window1,a0
jsr ClearMSGs
ShutDown4900: move.l Window2,a0
jsr ClearMSGs
move.l Window3,a0
jsr ClearMSGs
move.l Window4,a0
jsr ClearMSGs
move.l AbWin,a0
jsr ClearMSGs
move.l QuitWin1,a0
jsr ClearMSGs
move.l HelpWin1,a0
jsr ClearMSGs
ShutDown4500: tst.l Screen1
beq ShutDown3000
move.l Screen1,a0
lib Intuition,CloseScreen
ShutDown3000: tst.l _ReqBase
beq ShutDown2000
lea.l FileRequest1,a0
lib Req,PurgeFiles
ShutDown2000:
ShutDown1100: tst.l _IntuitionBase
beq ShutDown1000
lib Intuition,OpenWorkBench ;For that xtra touch
ShutDown1000: closlib Intuition
closlib Gfx
closlib Dos
closlib Req
ShutDownOut: move.l #RETURN_OK,d0
rts
INCLUDE "LWF:NBBS/DosError.i"
INCLUDE "LWF:NBBS/SetProg/SPCommandLineHelp.i"
MenusOn: lea.l Menu1,a1
cmp.w #$01,ActiveWinNum
beq MenusOn1
cmp.w #$02,ActiveWinNum
beq MenusOn2
cmp.w #$03,ActiveWinNum
beq MenusOn3
cmp.w #$04,ActiveWinNum
beq MenusOn4
rts
MenusOn1: move.l Window1,a0
lib Intuition,SetMenuStrip
rts
MenusOn2: move.l Window2,a0
lib Intuition,SetMenuStrip
rts
MenusOn3: move.l Window3,a0
lib Intuition,SetMenuStrip
rts
MenusOn4: move.l Window4,a0
lib Intuition,SetMenuStrip
rts
MenusOff: cmp.w #$01,ActiveWinNum
beq MenusOff1
cmp.w #$02,ActiveWinNum
beq MenusOff2
cmp.w #$03,ActiveWinNum
beq MenusOff3
cmp.w #$04,ActiveWinNum
beq MenusOff4
rts
MenusOff1: move.l Window1,a0
lib Intuition,ClearMenuStrip
rts
MenusOff2: move.l Window2,a0
lib Intuition,ClearMenuStrip
rts
MenusOff3: move.l Window3,a0
lib Intuition,ClearMenuStrip
rts
MenusOff4: move.l