home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
tbsource.lha
/
TBSource
/
ShellBench
/
SB.bak
next >
Wrap
Text File
|
1993-12-21
|
23KB
|
1,123 lines
*************************************************
* *
* (C)opyright 1991 *
* *
* by Tomi Blinnikka *
* *
* Don´t try to understand the code *
* *
* Version 0.01 11/01/1992 *
* *
* BUGS: Version string incompatible. *
* *
* Version 0.02 05/06/1992 *
* *
* BUGS: *
* *
*************************************************
;add prefs and config file
INCLUDE "JMPLibs.i"
INCLUDE "libraries/dos.i"
INCLUDE "libraries/dosextens.i"
INCLUDE "intuition/intuition.i"
INCLUDE "intuition/gadgetclass.i"
INCLUDE "libraries/gadtools.i"
INCLUDE "XREF:2.0.xref"
INCLUDE "XREF:gfx.xref"
INCLUDE "XREF:intuition.xref"
INCLUDE "XREF:exec.xref"
INCLUDE "XREF:dos.xref"
TRUE: EQU 1
DGadTools: set 1
section SB,CODE
Start: push d2-d7/a2-a6
push a0
sub.l a1,a1 ;Find our task
lib Exec,FindTask
move.l d0,OurTask
move.l d0,a4
move.l $b8(a4),OldTaskWinPtr
move.l pr_CLI(a4),d0
bne OpenDos
lea.l pr_MsgPort(a4),a0
lib Exec,WaitPort
lea.l pr_MsgPort(a4),a0
flib Exec,GetMsg
move.l d0,WBMsg
OpenDos: openlib Dos,NoDos
move.l pr_CLI(a4),d0
bne CLIStart
add.l #4,sp
lea.l NILName,a0
move.l a0,d1
move.l #MODE_NEWFILE,d2
lib Dos,Open
move.l d0,NILFile
beq ShutDown
move.l NILFile,_stdout
bra MainStart
CLIStart: lib Dos,Output
move.l d0,_stdout
beq ShutDown
pull a0
cmp.b #'?',(a0)
beq Usage
cmp.w #'-?',(a0)
beq Usage
cmp.w #'-h',(a0)
beq Usage
;To see if we have ks2.0 we'll try to open the gadtools.library
MainStart: move.l #37,d0
lea.l _GadToolsLib,a1
lib Exec,OpenLibrary
move.l d0,_GadToolsBase
beq NoKS20
openlib Intuition,NoInt
;Open screen and main window
lea.l NewScreen1,a0
lea.l Screen1TagList,a1
lib Intuition,OpenScreenTagList
move.l d0,Screen1
beq NoScreen
move.l Screen1,d0
lea.l NewWindow1,a0 ;do stuff for win1
move.l d0,nw_Screen(a0)
move.l d0,a1
move.b sc_BarHeight(a1),BHeight+1
add.w #1,BHeight
move.l sc_Width(a1),nw_Width(a0)
move.w BHeight,d2
move.w d2,nw_TopEdge(a0)
sub.w d2,nw_Height(a0)
lea.l NewWindow2,a0 ;do stuff for win2
move.l d0,nw_Screen(a0)
add.w d2,nw_Height(a0)
lea.l NewWindow3,a0 ;do stuff for win3
move.l d0,nw_Screen(a0)
add.w d2,nw_Height(a0)
add.w d2,PubGad1Top
add.l #$2c,d0 ;get ViewPort
move.l d0,VP1
move.l Screen1,a0
clr.l d0
lib Intuition,PubScreenStatus
lea.l PubName,a0
lib Intuition,SetDefaultPubScreen
move.w #SHANGHAI!POPPUBSCREEN,d0
lib Intuition,SetPubScreenModes
move.l d0,OldPubModes
;Do GadTools preparations, gadgets and menus
lea.l glist,a0
lib GadTools,CreateContext
move.l d0,ContextGad
beq NoContextGad
move.l Screen1,a0
lea.l Screen1TagList,a1
lib GadTools,GetVisualInfoA
move.l d0,vi
move.l glist,a0
lea.l NGExecuteGad1,a1
move.l #TEXT_KIND,d0
move.l vi,gng_VisualInfo(a1)
sub.l a2,a2
lib GadTools,CreateGadgetA
move.l d0,a0
add.w #GRELBOTTOM,$c(a0)
lea.l NGCommandGad1,a1
move.l #STRING_KIND,d0
move.l vi,gng_VisualInfo(a1)
lea.l CommandGadTagList,a2
lib GadTools,CreateGadgetA
move.l d0,CommandGad1
move.l d0,a0
move.l $22(a0),a1
move.l (a1),CommandGadBuf
add.w #GRELBOTTOM,$c(a0)
lea.l NGOKGad,a1
move.l #BUTTON_KIND,d0
move.l vi,gng_VisualInfo(a1)
lea.l GadTagList,a2
lib GadTools,CreateGadgetA
move.l d0,a0
add.w #GRELBOTTOM,$c(a0)
lea.l NGCancelGad,a1
move.l #BUTTON_KIND,d0
move.l vi,gng_VisualInfo(a1)
lea.l GadTagList,a2
lib GadTools,CreateGadgetA
move.l d0,a0
add.w #GRELBOTTOM+GRELRIGHT,$c(a0)
lea.l MNProjectMenu1,a0
lea.l MenuTagList,a1
lib GadTools,CreateMenusA
move.l d0,mlist
beq NoMenus
move.l mlist,a0
move.l vi,a1
lea.l MenuTagList,a2
lib GadTools,LayoutMenusA
lea.l MNProjectMenu2,a0
lea.l MenuTagList,a1
lib GadTools,CreateMenusA
move.l d0,mlist2
beq NoMenus
move.l mlist2,a0
move.l vi,a1
lea.l MenuTagList2,a2
lib GadTools,LayoutMenusA
bsr OpenWin1
tst.l d0
beq NoWindow
;move requesters to Window1
move.l OurTask,a0
move.l Window1,$b8(a0)
move.l Window1,a0
lib Intuition,WindowToFront
;Start of main loop
Window1IDCMP: move.l Window1,a0
bsr CheckIDCMP
cmp.l #CLOSEWINDOW,d2
beq Quit
cmp.l #REFRESHWINDOW,d2
beq Refresher
cmp.l #VANILLAKEY,d2
beq VanillaKeys
cmp.l #MENUPICK,d2
beq Win1Menus
cmp.l #RAWKEY,d2
; beq RawKeys
cmp.l #GADGETUP,d2
beq GadgetSelect
cmp.l #ACTIVEWINDOW,d2
; beq ActivateGads
bra Window1IDCMP
GadgetSelect: cmp.w #51,$26(a5)
beq DoPubState
bra Window1IDCMP
DoPubState: move.w gg_Flags(a5),d0
and.w #SELECTED,d0
cmp.w #SELECTED,d0
bne DoPubState1
lea.l PubName,a0
lib Intuition,SetDefaultPubScreen
bra Window1IDCMP
DoPubState1: sub.l a0,a0
lib Intuition,SetDefaultPubScreen
bra Window1IDCMP
Refresher: move.l Window1,a0
lib GadTools,GT_BeginRefresh
move.l Window1,a0
move.l #TRUE,d0
lib GadTools,GT_EndRefresh
bra Window1IDCMP
VanillaKeys: cmp.w #$1b,d3
beq Quit
bra Window1IDCMP
RawKeys: cmp.w #$5f,d3
beq Help
bra Window1IDCMP
Win1Menus: bsr MenuNull
cmp.w #$00,d6
beq Win1Menus1
cmp.w #$01,d6
beq Win1Menus2
bra Window1IDCMP
Win1Menus1: cmp.w #$00,d5
beq DoBackDrop
cmp.w #$01,d5
beq ExecuteCommand
cmp.w #$02,d5
beq About
cmp.w #$04,d5
beq Quit
bra Window1IDCMP
Win1Menus2: bra Window1IDCMP
ExecuteCommand: bsr MenusOff
bsr SleepPointer
bsr OpenWin2
tst.l d0
beq NoWindow
Window2IDCMP: move.l Window2,a0
bsr CheckIDCMP
cmp.l #CLOSEWINDOW,d2
beq ExecuteQuit
cmp.l #VANILLAKEY,d2
beq ExecuteVKeys
cmp.l #MENUPICK,d2
beq Win2Menus
cmp.l #GADGETUP,d2
beq ExecuteGads
bra Window2IDCMP
ExecuteGads: cmp.w #10,$26(a5)
beq DoExecute
cmp.w #98,$26(a5)
beq DoExecute
cmp.w #99,$26(a5)
beq ExecuteQuit
bra Window2IDCMP
Win2Menus: bsr MenuNull
cmp.w #$00,d6
beq Win2Menus1
bra Window2IDCMP
Win2Menus1: cmp.w #$00,d5
beq DoExecute
cmp.w #$02,d5
beq ExecuteQuit
bra Window2IDCMP
ExecuteVKeys: cmp.w #$1b,d3
beq ExecuteQuit
bra Window2IDCMP
DoExecute: lea.l CONName,a0
move.l a0,d1
move.l #MODE_OLDFILE,d2
lib Dos,Open
move.l d0,CONFile
beq NoCON
move.l CommandGadBuf,d1
clr.l d2
move.l CONFile,d3
lib Dos,Execute
tst.l CONFile
beq ShutDown2000
move.l CONFile,d1
lib Dos,Close
clr.l CONFile
bra ExecuteQuit
ExecuteQuit: bsr CloseWin2
bsr MenusOn
bsr NormalPointer
bra Window1IDCMP
About: bsr SleepPointer
bsr MenusOff
move.l Window1,a0
lea.l AboutTxt1,a1
move.l #$00,a2 ;positive text
lea.l OKTxt,a3 ;a bit the wrong way around but...
move.l #$00,d0
move.l #$00,d1
move.l #320,d2
move.l #$50,d3
lib Intuition,AutoRequest
bsr MenusOn
bsr NormalPointer
bra Window1IDCMP
DoBackDrop: move.l mlist,a0
move.l #$F800,d0
lib Intuition,ItemAddress
move.l d0,a0
move.w mu_Flags(a0),d0
and.w #CHECKED,d0
cmp.w #CHECKED,d0
beq DoBackDrop1
bsr CloseWin1
lea.l NewWindow1,a0
and.l #~BACKDROP!BORDERLESS,nw_Flags(a0)
or.l #WINDOWDEPTH!WINDOWCLOSE!WINDOWDRAG!WINDOWSIZING,nw_Flags(a0)
lea.l SBName1,a1
move.l a1,nw_Title(a0)
bra DoBD_OUT
DoBackDrop1: bsr CloseWin1
lea.l NewWindow1,a0
or.l #BACKDROP!BORDERLESS,nw_Flags(a0)
and.l #~WINDOWDEPTH!WINDOWCLOSE!WINDOWDRAG!WINDOWSIZING,nw_Flags(a0)
clr.l nw_Title(a0)
move.l Screen1,a1
move.l sc_Width(a1),nw_Width(a0)
move.w BHeight,d2
move.w d2,nw_TopEdge(a0)
sub.w d2,nw_Height(a0)
DoBD_OUT: bsr OpenWin1
tst.l d0
beq NoWindow
bra Window1IDCMP
Help: bra Window1IDCMP
Quit: bsr CloseWin1
Quit1: bsr CloseScreen1
tst.l d0
beq Quit2
move.l OldPubModes,d0
lib Intuition,SetPubScreenModes
sub.l a0,a0
lib Intuition,SetDefaultPubScreen
bra ShutDown
Quit2: bsr OpenWin1
tst.l d0
beq Quit1
bsr VisitorsOpen
bra Window1IDCMP
OpenWin1: lea.l NewWindow1,a0
lib Intuition,OpenWindow
move.l d0,Window1
beq OpenWin1_ERR1
move.l d0,a0
move.l $32(a0),RP1
; move.l Window1,a0
move.l mlist,a1
lib Intuition,SetMenuStrip
move.l #-1,d0
rts
OpenWin1_ERR1: clr.l d0
rts
CloseWin1: tst.l Window1
beq CloseWin1_OUT
move.l Window1,a0
lib Intuition,ClearMenuStrip
move