home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
util
/
xoper-2.4.lha
/
Xoper
/
Xoper.s
< prev
next >
Wrap
Text File
|
1993-10-05
|
182KB
|
9,251 lines
******************************************
* *
* Xoper 2.4 Copyright (C) Werner GÜnther *
* (68881 code by Lothar English) *
*(kick 2.0+ enhancements by Gunther Nikl)*
* *
******************************************
* Written for the A68K V2.6 Assembler *
* by Charlie Gibbs and Brian R. Anderson *
* *
* Do not use Smallcode/Smalldata when *
* linking *
******************************************
;DEBUG SET 1
; include stuff
include lvo13/dos_lib.i
include lvo13/exec_lib.i
include lvo13/console_lib.i
include lvo13/graphics_lib.i
include lvo13/diskfont_lib.i
include lvo13/intuition_lib.i
include exec/types.i
; >=V36 functions
_LVOColdReboot equ -726 ; exec
_LVOFindDisplayInfo equ -726 ; graphics
_LVOGetDisplayInfoData equ -756
_LVOGetVPModeID equ -792
_LVOLockPubScreen equ -510 ; intuition
_LVOUnlockPubScreen equ -516
_LVOLockPubScreenList equ -522
_LVOUnlockPubScreenList equ -528
_LVOPubScreenStatus equ -552
_LVOReadEClock equ -60 ; timer
_LVOAddAppIcon equ -60 ; workbench
_LVORemoveAppIcon equ -66
_LVOCreateCxObj equ -30 ; commodity
_LVOCxBroker equ -36
_LVOActivateCxObj equ -42
_LVODeleteCxObjAll equ -54
_LVOCxObjError equ -66
_LVOAttachCxObj equ -84
_LVOSetFilter equ -120
_LVOCxMsgType equ -138
_LVOCxMsgID equ -150
; macro stuff
CALL MACRO
move.l \2,a6
jsr _LVO\1(a6)
ENDM
RECALL MACRO
jsr _LVO\1(a6)
ENDM
ADDCMD MACRO
cmdnum set cmdnum+1
dc.b \1,0
ENDM
; global stuff
STRUCTURE Globals,0
ULONG sysbase
ULONG dosbase
ULONG intuibase
ULONG gfxbase
ULONG wbbase
ULONG cxbase
ULONG condev
ULONG wbmsg
ULONG myseg
ULONG realstack
ULONG idletask
ULONG node
ULONG parmtxt
ULONG infile
ULONG ptr
ULONG auxsig
ULONG mysignal ; init with $20000
ULONG trapsignal
ULONG tasksigs
ULONG cancelbit
ULONG cancelbnum
ULONG broker
ULONG filter
ULONG inputport
ULONG inputio
ULONG startmess
ULONG savedat
ULONG wnptr
ULONG tfont
ULONG aliaslist
ULONG screenptr
ULONG intuimsg
ULONG mytask
ULONG oldprwin
ULONG pointer
ULONG replyport
ULONG timerport
ULONG finfoptr
ULONG dispatches
ULONG maxdisp
ULONG oldswitches
ULONG remembr
ULONG remembr2
ULONG snoopport
ULONG captask
ULONG capiscli
ULONG capseg
ULONG blanks
ULONG hidestart
ULONG iocount
ULONG rastport
ULONG outchain
ULONG firstline
ULONG oldfirstline
ULONG numlines
ULONG oldnumlines
ULONG timeoutm
ULONG gothline
ULONG lastprinted
ULONG oldlastprinted
ULONG maxlines ; init with 500
ULONG oldpageend
ULONG secs
ULONG mics
ULONG time10
ULONG tsecs
ULONG tmics
ULONG devicelock
ULONG timerticks
ULONG excpterror
ULONG excpttask
ULONG excptaddr
ULONG excptpc
ULONG lasttime
STRUCT newtime,4*2
STRUCT osecs,4*4
STRUCT tdtasks,4*4
ULONG OldSwitch
ULONG OldAddTask
ULONG OldAllocMem
ULONG OldFreeMem
ULONG OldTrap
ULONG OldProcTrap
UWORD txheight
UWORD txwidth
UWORD firstpos
UWORD colms
UWORD timersig
UWORD cxsig
UWORD intuisig
UWORD ibufferlen
UWORD oldibuflen
UWORD cposy
UWORD curpos
UWORD oldpos
UWORD bottomin
UWORD ipos
UWORD hnum
UWORD minnumchars ; init with 2
UWORD maxhlines ; init with 10
UWORD qualifier
UWORD rows
UWORD maxllength
UWORD loffset
UWORD repeatlen
UWORD edline
UWORD cmdptr
UWORD currenty
UWORD cmdcompnr
UWORD cmdcomplen
UWORD cmdcplen
UWORD numtaskstimed
UWORD tasksnum
UWORD procnum
STRUCT hexarea,10
STRUCT binarea,12
STRUCT minus,2
STRUCT decimal,6
UBYTE entries
UBYTE timeout ; init with 5
UBYTE newpri
UBYTE tasktyp
UBYTE getanswer
UBYTE printed
UBYTE useageon
UBYTE tports
UBYTE hideon ; init with
UBYTE headon
UBYTE tinfo
UBYTE cmdcli ; |
UBYTE sorton ; |
UBYTE cxstate ; |
UBYTE iconifyon ; |
UBYTE propgadon ; V
UBYTE propupdate
UBYTE finfopen
UBYTE patchmode ; -1 !!!!
UBYTE timerstate
UBYTE cbreak
UBYTE bool
UBYTE wanttraps
UBYTE addlines
UBYTE gotguru
UBYTE ownscreen
UBYTE ownfont
UBYTE insmode
UBYTE repeat
UBYTE capgone
UBYTE capwaiting
UBYTE cliexec
UBYTE appicn
UBYTE pcheck
UBYTE snoopon
UBYTE msnoop
UBYTE newtab
UBYTE oldtab
UBYTE bleft
UBYTE waitexit
UBYTE wantexit
UBYTE wanthold
UBYTE wantwindow
UBYTE post_V34
STRUCT mypacket,68
; don't change argument order below !!!
STRUCT buffer,2800
STRUCT out,100
STRUCT dummy,80
STRUCT in,80
STRUCT cputime,1000
STRUCT taskstampid,128*4
STRUCT taskstamps,128*4
STRUCT usedtime,128*4
STRUCT ievent,32
STRUCT outevent,20
STRUCT inputbuffer,88
STRUCT timerio,40
STRUCT sampleio,40
STRUCT repeatbuffer,82
STRUCT hotkeybuf,42
STRUCT winkeybuf,82
LABEL gb_SIZEOF
; some defintions
mysigbit equ 17
maxarg equ 20
; Program startup.
; If called from DOS we use segment splitting to detach from our DOS-task.
start lea dataarea,a4 ; globals
move.l d0,d2 ; save arguments
move.l a0,a2
move.l a4,a1
move.w #(gb_SIZEOF>>2)-1,d1
1$ clr.l (a1)+ ; clear bss area
dbra d1,1$
bsr.s InitVars ; default values
move.l 4,a6
move.l a6,sysbase(a4)
move.l 276(a6),a3
tst.l 172(a3)
bne.s fromCLI
fromWB lea 92(a3),a0 ; get wb msg
RECALL WaitPort
lea 92(a3),a0
RECALL GetMsg
move.l d0,wbmsg(a4)
fromCLI lea dosname(pc),a1 ; open dos
moveq #33,d0
RECALL OpenLibrary
move.l d0,dosbase(a4)
beq.s exit
move.l wbmsg(a4),d1
beq.s 1$ ; not wb start
move.l d1,a1
bsr.s GetToolTypes ; make cmd line for wb
1$ bsr GetCmdLine
bsr CreateProc ; start prog
exit
IFD DEBUG
move.l sysbase(a4),a6
ENDC
move.l wbmsg(a4),d2
beq.s 2$
RECALL Forbid
move.l d2,a1
RECALL ReplyMsg
2$ move.l dosbase(a4),d0
beq.s 1$
move.l d0,a1
RECALL CloseLibrary
moveq #0,d0
1$ rts
; some default values (before zero!)
InitVars addq.w #2,mysignal(a4) ; mask :=$20000
move.w #500,maxlines+2(a4)
addq.w #1,bottomin(a4)
addq.w #2,minnumchars(a4)
move.w #10,maxhlines(a4)
move.w #999,edline(a4)
addq.b #5,timeout(a4)
subq.l #1,hideon(a4) ; +headon+tinfo+cmdcli
subq.l #1,sorton(a4) ; +cxstate+iconifyon+propgadon
subq.w #1,propupdate(a4) : + finfopen
subq.b #1,patchmode(a4)
rts
; a1 - wbmsg
_LVOGetDiskObject equ -78
_LVOFreeDiskObject equ -90
GetToolTypes move.l 36(a1),a3
lea icnname(pc),a1
moveq #33,d0
RECALL OpenLibrary
move.l d0,d6
beq.s 1$ ; no icon library ?!
move.l (a3),d1
CALL CurrentDir,dosbase(a4) ; set wa_Lock
move.l 4(a3),a0
CALL GetDiskObject,d6 ; iconbase
move.l d0,d3
beq.s 2$ ; no icon got
move.l d3,a3
move.l 54(a3),a3 ; do_ToolTypes
lea buffer(a4),a2
move.l a2,a1
bra.s 4$
6$ move.l d0,a0
cmp.b #'A',(a0)
bcs.s 4$ ; skip < A
cmp.b #'z'+1,(a0)
bcc.s 4$ ; skip > z
cmp.b #'Z'+1,(a0)
bcs.s 5$ ; ok < Z
cmp.b #'a',(a0)
bcs.s 4$ ; skip < a
5$ move.b (a0)+,(a1)+ ; copy value
bne.s 5$
move.b #' ',-1(a1) ; delimiter
4$ move.l (a3)+,d0
bne.s 6$
move.l a1,d2
sub.l a2,d2 ; line length
bne.s 3$
moveq #1,d2 ; don't clear illegal
3$ move.l d3,a0
RECALL FreeDiskObject
2$ move.l a6,a1 ; close icon lib
CALL CloseLibrary,sysbase(a4)
1$ rts
GetCmdLine clr.b -1(a2,d2.w) ; terminate line
move.l a2,a1
moveq #0,d2
lea out(a4),a2
; a1 - pointer into command line
; d2 - argc
; a2 - argv
ParseCLI bsr.s GetNext ; search argument
bmi.s doquote ; quotation sign
beq.s dosemi ; commentary stops all
bcs.s ParseCLI ; separation sign
lea -1(a1),a0 ; argument start
bsr.s BumpArgV ; argc+1 & ptr to argv
build_2 bsr.s GetNext ; search separation sign
beq.s dosemi ; commentary stops all
bcc.s build_2 ; no separation sign
clr.b -1(a1) ; mark end
bra.s ParseCLI ; continue search
doquote move.l a1,a0 ; argument start
bsr.s BumpArgV ; argc+1 & ptr to argv
quote_2 bsr.s GetNext ; search quotation sign
bpl.s quote_2 ; no quotation sign
clr.b -1(a1) ; mark end
quote_3 bsr.s GetNext ; search sepaartion sign
beq.s dosemi ; commentary stops all
bcc.s quote_3 ; no separation sign
bra.s ParseCLI ; continue search
dosemi clr.b -(a1) ; delete semicolon
bra.s ParseCLI ; go on
BumpArgV cmp.w #maxarg,d2 ; max argc reached ?
bcc.s 1$
move.l a0,(a2)+ ; store argptr
addq.w #1,d2 ; increment argc
1$ rts
GetNext move.b (a1)+,d0 ; test character
beq.s BuildRdy
moveq #-3,d1 ; N=1,Z=0,C=0 -> quotation
cmp.b #'"',d0
beq.s 1$
moveq #-2,d1 ; N=0,Z=1,C=1 -> semicolon
cmp.b #';',d0
beq.s 1$
moveq #-1,d1 ; N=0,Z=0,C=1 -> separation
cmp.b #'=',d0
beq.s 1$
cmp.b #' ',d0
beq.s 1$
cmp.b #9,d0
beq.s 1$
moveq #0,d1 ; N=0,Z=0,C=0 -> others
1$ addq.l #2,d1 ; set flags ( see above )
rts
BuildRdy move.b d2,entries(a4)
addq.l #4,sp ; set right return address
rts
; usage requsted
showhelp CALL Output,dosbase(a4)
move.l d0,d4
move.l d4,d1
lea template.str(pc),a2
move.l a2,d2
moveq #cmd.str-template.str-1,d3
RECALL Write
move.l d4,d1
lea buffer(a4),a2
move.l a2,d2
moveq #80,d3
RECALL Read
move.l d0,d2
bra GetCmdLine ; check input
; check template for cli or wb
CheckArgs tst.l wbmsg(a4) ; workbench ?
bne.s 1$
lea help.str(pc),a0 ; help ?
bsr.s findarg
bne.s 1$
bsr.s showhelp
1$ lea cxpop.str(pc),a0 ; popup ?
bsr.s findarg
bne.s 2$
bsr nextarg
beq.s 1$
lea cxyes.str(pc),a0
jsr StrCmp(a4)
beq.s 2$
st wanthold(a4)
2$ lea cxkey.str(pc),a0 ; new popkey ?
bsr.s findarg
bne.s 21$
bsr.s nextarg
bne.s 22$
21$ lea defhotkey(a4),a1
22$ lea hotkeybuf(a4),a0
moveq #39,d0
23$ move.b (a1)+,(a0)+ ; copy hotkey description
dbeq d0,23$
clr.b (a0)
lea cxpri.str(pc),a0
bsr.s findarg
bne.s 3$
bsr.s nextarg
beq.s 3$
move.l a1,a0
jsr GetNum(a4)
move.b d2,newbroker+18(a4) ; nb_Pri
3$ lea cmd.str(pc),a0 ; defaultcmd ?
bsr.s findarg
bne.s 31$
bsr.s nextarg
beq.s 31$
move.b (a1),d2 ; first char
lea kill.str(pc),a0
jsr StrCmp(a4)
bne.s 32$
st bool(a4) ; kill
31$ moveq #'t',d2 ; display default to tasks
32$ lsl.w #8,d2
or.w #10,d2 ; LF
move.w d2,in(a4)
rts
findarg move.b entries(a4),d2 ; search argument
lea out(a4),a2
1$ subq.b #1,d2
bcs.s 2$
move.l (a2)+,a1
jsr StrCmp(a4) ; compare it
bne.s 1$
2$ rts
nextarg move.l (a2),a1 ; make sure ptr is valid
move.l a1,d1
rts
CreateProc bsr CheckArgs
CALL Forbid,sysbase(a4)
lea xopcon(a4),a1
RECALL FindPort
move.l d0,a5
move.l a5,d0
beq.s 1$
move.l 16(a5),a1
move.l mysignal(a4),d0
IFND DEBUG ; kill for full version only !
tst.b bool(a4)
beq.s 2$ ; wake Xoper up
; This code tries to remove Xoper from the System in case Xoper 'freezes'
; or crashes. It works as follows:
; Xoper leaves the address of its cleanup routine in the UserData field of
; its Task structure. EXEC's context-restore code leaves the current PC of
; a task in the first longword of the tasks stack. All we have to do is to
; copy the address of Xoper's cleanup routine to its stack and to reschedule
; Xoper (using Signal() in this case).
move.l 54(a1),a0
btst #4,297(a6) ; AttnFlags FPU
beq.s 3$ ; no FPU
moveq #0,d0
move.b (a0),d1 ; NULL frame ?
beq.s 4$
move.w (a0),d1 ; frame flag / format word
lea 110(a0),a0 ; offset to fpu regs
addq.w #1,d1 ; -1 ?
beq.s 5$
lea 12(a0),a0 ; add 3 longs
5$ move.b 1(a0),d0 ; frame size
4$ lea 4(a0,d0.w),a0
3$ move.l 88(a1),0(a0)
moveq #-1,d0
ENDC
2$ RECALL Signal
1$ RECALL Permit
move.l a5,d0
bne.s leave
tst.b bool(a4) ; kill request only !
bne.s leave
IFND DEBUG
move.l dosbase(a4),a5 ; start as background proccess
exg.l a5,a6
tst.b wanthold(a4)
beq.s stt1 ; do not sleep
RECALL Output
move.l d0,d4
beq.s stt1
move.l d4,d1
lea windowname(a4),a2
move.l a2,d2
moveq #description-windowname-1,d3
RECALL Write
move.l d4,d1
lea cr(a4),a2
move.l a2,d2
moveq #1,d3
RECALL Write
stt1 move.l 276(a5),a1
move.l 152(a1),d1
RECALL DupLock
move.l d0,d5
exg.l a5,a6
RECALL Forbid
lea newname(a4),a1
move.l a1,d1
moveq #0,d2
lea start(pc),a1
move.l -(a1),d3
move.l d3,myseg(a4)
clr.l (a1)+
moveq #(4096>>6),d4
lsl.w #6,d4
exg.l a5,a6
RECALL CreateProc
exg.l a5,a6
move.l d0,a0
move.l a0,d0
beq.s leave
move.l d5,60(a0) ; set new lock
RECALL Permit
ENDC
IFD DEBUG
jsr mainprg
ENDC
leave rts
dosname dc.b 'dos.library',0
icnname dc.b 'icon.library',0
template.str dc.b 'CMD/K,CX_POPUP/K,CX_POPKEY/K,CX_PRIORITY/K/N: ',0
cmd.str dc.b 'CMD',0
kill.str dc.b 'KILL',0
cxpop.str dc.b 'CX_POPUP',0
cxkey.str dc.b 'CX_POPKEY',0
cxpri.str dc.b 'CX_PRIORITY',0
cxyes.str dc.b 'YES',0
help.str dc.b '?',0
SECTION Xoper,DATA
mainprg lea dataarea(pc),a4 ; global base ptr
move.l sp,realstack(a4)
move.l sysbase(a4),a6
cmp.w #36,20(a6) ; LIB_VERSION
blt.s 9$
st post_V34(a4) ; Kick2.0+
move.w #imagesize,d0
move.l image+10(a4),a0
10$ not.l (a0)+ ; reverse iconify image
dbra d0,10$
9$ move.l 304(a6),OldTrap(a4) ; original EXEC Trap-Handler
move.l 276(a6),a0 ; ExecBase->ThisTask
move.l a0,mytask(a4)
move.l 50(a0),OldProcTrap(a4) ; original AmigaDOS Trap-Handler
lea stopall(pc),a1
move.l a1,88(a0) ; leave a message for 'Kill Xoper'
move.l 184(a0),oldprwin(a4)
moveq #-1,d0 ; disable the 'please insert'
move.l d0,184(a0) ; requester
lea 350(a6),a0 ; nessecary libs & devs
lea conname(a4),a1
RECALL FindName
move.l d0,condev(a4)
lea 378(a6),a0
lea gfxname(a4),a1
RECALL FindName
move.l d0,gfxbase(a4)
lea 378(a6),a0
lea intname(a4),a1
RECALL FindName
move.l d0,intuibase(a4)
move.l d0,a0
move.l 56(a0),a0 ; ib_ActiveScreen
move.w 12(a0),d0 ; sc_Width
sub.w #550,d0
move.w d0,window_l(a4)
bsr OpenLibsV37 ; Kick 2.0+ libraries
moveq #0,d0
lea xopcon(a4),a0
bsr CreatePort
move.l d0,replyport(a4)
moveq #0,d0
suba.l a0,a0
bsr CreatePort
move.l d0,timerport(a4)
move.l d0,a0
move.b 15(a0),d0
ext.w d0
move.w d0,timersig(a4)
lea timerio(a4),a1
move.l a0,14(a1) ; timerport
lea timernam(a4),a0
moveq #1,d0
moveq #0,d1
RECALL OpenDevice ; open 'timer.device'
tst.b post_V34(a4)
beq.s 8$
lea newtime(a4),a0
CALL ReadEClock,timerio+20(a4)
move.l newtime+4(a4),lasttime(a4)
lsr.l #8,d0
bra.s 7$
8$ moveq #0,d0
suba.l a0,a0
bsr CreatePort
lea sampleio(a4),a1
move.l d0,14(a1)
lea timernam(a4),a0
moveq #0,d0
moveq #0,d1
RECALL OpenDevice ; open 'timer.device'
lea sampleio(a4),a1
move.l #3599999,32(a1)
move.w #9,28(a1)
RECALL SendIO
move.l #3906,d0
7$ move.l d0,timerticks(a4)
bsr starttasktimer
;assumes sysbase is in a6 !
;install a counter to determine the amount of cpu-time each task uses.
RECALL Forbid
move.l #_LVOSwitch,d0
lea myswitch(pc),a0
exg.l d0,a0
move.l a6,a1
RECALL SetFunction
move.l d0,OldSwitch(a4)
move.l #_LVOAddTask,d0
lea myaddtask(pc),a0
exg.l d0,a0
move.l a6,a1
RECALL SetFunction
move.l d0,OldAddTask(a4)
RECALL Permit
;install a counter for PORT-Interrupts
lea iocounter(a4),a1
move.l a4,14(a1)
moveq #3,d0
RECALL AddIntServer
moveq #$40,d0
lsl.w #2,d0 ; 256
moveq #-128,d1 ; Pri
lea kidlename(a4),a0 ; Name
lea killidle(pc),a1 ; Code
bsr CreateTask
move.l d0,idletask(a4)
bsr gettdtasks
;attempt to open a startup script
lea infile(a4),a2
lea dummy(a4),a5
lea startupname(a4),a0 ; 'ENV:Xoper.Startup'
move.l a5,a1
6$ move.b (a0)+,(a1)+ ; copy string
bne.s 6$
moveq #4,d1
add.l a5,d1
move.l #1005,d2
CALL Open,dosbase(a4) ; 'Xoper.startup'
move.l d0,(a2)
bne.s 5$
move.l a5,d1
RECALL Open ; 'ENV:Xoper.Startup'
move.l d0,(a2)
bne.s 5$
moveq #2,d1
move.b #'S',0(a5,d1.w)
add.l a5,d1
RECALL Open ; 'S:Xoper.startup'
move.l d0,(a2)
beq.s nostartup
5$ movem.l a2/a5/a6,-(sp) ; infile, dummy & dosbase
moveq #-1,d5
4$ addq.l #1,d5
move.l (a2),d1
move.l a5,d2
add.l d5,d2
moveq #1,d3
RECALL Read
tst.l d0
bgt.s 3$
move.l (a2),d1
RECALL Close
clr.l (a2)
tst.w d5
beq.s 1$
bra.s 2$
3$ cmp.b #10,0(a5,d5.l)
beq.s 2$
cmp.b #13,0(a5,d5.l)
bne.s 4$
2$ moveq #1,d0
add.l d5,d0
bsr cli ; execute the script as if typed in
1$ movem.l (sp)+,a2/a5/a6
tst.l (a2) ; check infile
bne.s 5$
nostartup moveq #-1,d0 ; prepare screen tags
CALL AllocSignal,sysbase(a4)
move.l d0,nspubsig+4(a4)
move.l mytask(a4),nspubtask+4(a4)
moveq #mysigbit,d0
RECALL AllocSignal
bsr installh
tst.b wanthold(a4) ; background task ?
bne instback
; This code just opens a Window. Position and size are
; taken from window_l,window_t,window_w,window_h.
restart move.l intuibase(a4),a6
lea setupwindow(pc),a0
tst.b ownscreen(a4)
beq.s 1$
clr.b ownscreen(a4)
lea createscreen(pc),a0
1$ jsr 0(a0) ; screen and/or window
move.l mytask(a4),a0
clr.l 26(a0) ; clear 'spurious' signals
clr.l ptr(a4)
tst.b gotguru(a4)
beq.s 2$
bsr showguru
clr.b gotguru(a4)
2$ bra processmsgs
OpenLibsV37 lea wbname(a4),a1
bsr.s 1$ ; open 'workbench.library'
move.l d0,wbbase(a4)
lea cxname(a4),a1
bsr.s 1$ ; open 'commodities.library'
move.l d0,cxbase(a4)
rts
1$ moveq #37,d0
jmp _LVOOpenLibrary(a6) ; a6 - SysBase !
starttasktimer lea tsecs(a4),a0
lea tmics(a4),a1
CALL CurrentTime,intuibase(a4)
bsr getaskdat2 ; returns SysBase in a6 !
move.l tsecs(a4),d0
lea taskstampid(a4),a0
lea taskstamps(a4),a1
lea usedtime(a4),a2
moveq #0,d1
1$ subq.b #1,d5
bmi.s 2$
lea -16(a5),a5
move.l 0(a5),(a0)+
move.l d0,(a1)+
clr.l (a2)+
addq.w #1,d1
cmp.w #128,d1
bmi.s 1$
2$ move.w d1,numtaskstimed(a4)
rts
gettdtasks lea 350(a6),a0 , a6 - SysBase
lea tdname(a4),a1
RECALL FindName
move.l d0,a3
move.l a3,d0
beq.s r_t_s
lea 36(a3),a3
lea tdtasks(a4),a5
1$ move.l (a3)+,d0
beq.s r_t_s
move.l d0,a2
move.l 16(a2),(a5)+
bra.s 1$
r_t_s rts
; exit program
stopall st waitexit(a4) ; wait until pubscr freed
tst.b appicn(a4)
beq.s exitall
move.l wnptr(a4),a0 ; remove appicon here
CALL RemoveAppIcon,wbbase(a4)
clr.l wnptr(a4)
exitall tst.b ownscreen(a4)
beq.s 6$ ; no screen == no pub screen !
st wantexit(a4)
bsr SetPubStatus
beq.s r_t_s ; pubscreen still used
6$ moveq #1,d0
bsr CloseGUI ; close screen & window
bsr killpage
bsr freeblank
bsr killhistory
bsr freehidmem
bsr freealias
bsr clrfkeys
5$ move.l stplist(a4),a3
tst.l 0(a3)
beq.s 4$
move.l a3,d0
bsr waok
bra.s 5$
4$ bsr removeh
bsr remtraps
move.l sysbase(a4),a6
bsr CloseLibsV37 ; close Kick 2.0+ libraries
move.l idletask(a4),a1
RECALL RemTask
st waitexit(a4)
st bool(a4)
36$ tst.b bool(a4)
beq.s 33$ ; exec patches removed !
RECALL Forbid
tst.b patchmode(a4)
beq.s 35$ ; don't check vectors
lea myswitch(pc),a0
cmp.l _LVOSwitch+2(a6),a0
bne.s 34$
lea myaddtask(pc),a0
cmp.l _LVOAddTask+2(a6),a0
bne.s 34$
35$ move.l OldSwitch(a4),d0
move.w #_LVOSwitch,a0
move.l a6,a1
RECALL SetFunction
move.l OldAddTask(a4),d0
move.w #_LVOAddTask,a0
move.l a6,a1
RECALL SetFunction
clr.b bool(a4)
34$ RECALL Permit
33$ bsr snoopend ; mem trace
bsr traceend ; dos trace
move.b bool(a4),d0 ; exec -> dispatch,addtask
add.b msnoop(a4),d0 ; exec -> memory
add.b DosTable+5(a4),d0 ; dos -> open
add.b DosTable+25(a4),d0 ; dos -> lock
beq.s 32$ ; zero == all removed
moveq #0,d0
move.l mysignal(a4),d1
CALL SetSignal,sysbase(a4)
st pcheck(a4) ; enable checking ...
move.l mysignal(a4),d0
RECALL Wait ; wait for intr signal
bra.s 36$ ; try again ...
32$ lea iocounter(a4),a1
moveq #3,d0
RECALL RemIntServer
move.l replyport(a4),d0
bsr DeletePort
bsr stoptimer
lea timerio(a4),a1
CALL CloseDevice,sysbase(a4)
move.l timerport(a4),d0
bsr DeletePort
tst.b post_V34(a4)
bne.s 3$
lea sampleio(a4),a1
CALL AbortIO,sysbase(a4)
lea sampleio(a4),a1
move.l 14(a1),d7
RECALL CloseDevice
move.l d7,d0
bsr DeletePort
3$ move.l dosbase(a4),a6
move.l infile(a4),d1
beq.s 2$
RECALL Close
2$ move.l mytask(a4),a2
IFND DEBUG
move.l 152(a2),d1
RECALL UnLock
move.l myseg(a4),d1
RECALL UnLoadSeg
ENDC
move.l oldprwin(a4),184(a2) ; reenable the requester
move.l realstack(a4),sp
moveq #0,d0
rts
CloseLibsV37 move.l cxbase(a4),a1 ; commodities base
bsr.s 2$
move.l wbbase(a4),a1 ; workbench base
2$ move.l a1,d0
beq.s 1$ ; no lib
RECALL CloseLibrary
1$ rts
;show a list. The string entered from keyboard is stored
;in 'in'. Every character is interpreted as one command
;i.e. 'rip' means 'resources'+'interrupts'+'ports'.
;search the command to be executed. If none is found,
;show a help message
showwhat tst.l infile(a4)
bne.s nomore
move.w cmdptr(a4),d7
input lea in(a4),a0
move.b 0(a0,d7.w),d0
beq.s endshow
addq.w #1,d7
cmpi.b #' ',d0
bne.s i1
bsr.s testifend
beq.s endshow
move.w d2,cmdptr(a4)
bra.s endshow2
i1 cmpi.b #10,d0
beq.s endshow
or.b #32,d0
cmpi.b #'q',d0
beq quithold
lea params(a4),a0
moveq #parmnum-1,d1
i2 cmp.b 0(a0,d1.w),d0
beq.s foundp
dbra d1,i2
move.w #usetxt,d0
bsr putnamw
bra.s endshow
foundp lea subs(pc),a0
lsl.w #2,d1
jsr 0(a0,d1.w)
bsr.s testifend
beq.s input
bsr newline
bra.s input
endshow clr.w cmdptr(a4)
endshow2 bsr starttimer
nomore tst.l infile(a4)
bne.s 1$
clr.l lastprinted(a4)
bsr blastout
1$ rts
testifend lea in(a4),a0
lea 0(a0,d7.w),a0
move.w d7,d2
2$ move.b (a0)+,d0
beq.s 1$
cmpi.b #' ',d0
bne.s 3$
addq.w #1,d2
bra.s 2$
3$ cmpi.b #10,d0
1$ rts
;get the string from inputbuffer; search and execute
;the command, if any.
cli lea dummy(a4),a0
subq.w #1,d0
cl2 subq.w #1,d0
bmi.s cl1
cmp.b #' ',0(a0,d0.w)
beq.s cl2
cl1 addq.w #1,d0
move.b #10,0(a0,d0.w)
bsr kllblnks ; remove trailing blanks ... !
cmpi.b #10,0(a0)
beq showwhat
cmpi.b #';',0(a0)
beq.s nomore
bsr.s findcmd
tst.l d2
bpl.s okcmd ; cmd found
bsr.s findalias
tst.l d2
bmi.s nm0 ; no alias
okcmd clr.w procnum(a4)
adda.w d1,a0
bsr kllblnks
lea cmdaddr(pc),a1
lsl.w #2,d2
jsr 0(a1,d2.w)
bra.s nomore
nm0 moveq #10,d1 ; LineFeed
lea in(a4),a1
lea buffer(a4),a2
movem.l a1/a2,-(sp) ; store for later use
nm1 move.b (a1),(a2)+ ; in -> buffer
cmp.b (a1)+,d1 ; LF ?
bne.s nm1
move.l (sp)+,a1
nm2 move.b (a0),(a1)+ ; cmd -> in
cmp.b (a0)+,d1 ; LF ?
bne.s nm2
move.l (sp)+,a1
lea dummy(a4),a2
nm3 move.b (a1),(a2)+ ; buffer -> dummy
cmp.b (a1)+,d1 ; LF ?
bne.s nm3
clr.w cmdptr(a4)
bra showwhat
findcmd move.l a0,-(sp)
bsr strbuf
lea commds(a4),a2
moveq #0,d2
1$ lea buffer(a4),a0
move.l a2,a1
bsr strcmp
beq.s 3$
2$ tst.b (a2)+
bne.s 2$
addq.w #1,d2
cmp.w #cmdnum,d2
bne.s 1$
moveq #-1,d2
3$ move.l (sp)+,a0
rts
findalias move.l a0,-(sp)
lea aliaslist(a4),a2
1$ move.l 0(a2),d2
move.l d2,a2
beq.s 3$
lea buffer(a4),a0
lea 5(a2),a1
move.b 4(a2),d2
ext.w d2
ext.l d2
bsr strcmp
beq.s 4$
bra.s 1$
3$ moveq #-1,d2
4$ move.l (sp)+,a0
rts
subs bra showtask
bra showaddr
bra showdevs
bra showlibs
bra showres
bra showresi
bra showmem
bra showprt
bra showint
bra stack
bra clicomm
bra tasktime
bra semaphores
cmdaddr bra settime
bra taskpri
bra info
bra pri
bra flush
bra freeze
bra warm
bra signal
bra break
bra alert
bra lastalert
bra instback
bra exitall
bra clear
bra cancel
bra taskports
bra hunks
bra devices
bra openlib
bra closelib
bra currentdir
bra cd
bra mypri
bra openfiles
bra locks
bra unlock
bra screens
bra windows
bra closescreen
bra closewindow
bra fonts
bra windowfonts
bra lockdrive
bra freedrive
bra capture
bra clrcold
bra clrcool
bra clrwarm
bra snoop
bra usage
bra inputhandler
bra nohead
bra sort
bra hide
bra hidden
bra setwindow
bra cancel
bra icongad
bra historylines
bra historylength
bra showhistory
bra repeatcmd
bra remresident
bra saveoutput
bra killhistory
bra iconbackdrp
bra setfont
bra trapguru
bra outputlines
bra usescreen
bra usewindow
bra usetopaz
bra grabtimerio
bra dchange
bra alias
bra remnode
bra setfkey
bra clicmd
bra taskinfo
bra coldreboot
bra reboot
bra zerotimer
bra propgad
bra iconpos
bra remport
bra remintserver
bra frags
bra tracefiles
bra tracelocks
bra cxhandler
bra cxpopkey
bra pubscreens
bra smartpatch
;------ Task-Structures-----
tasktime moveq #-1,d0
bra.s startask
showaddr moveq #0,d0
bra.s startask
showtask moveq #1,d0
startask move.b d0,tasktyp(a4)
bsr getdevhan
tst.b headon(a4)
beq.s noheader1
move.w #infoh1,d0
bsr putstrw
move.l sysbase(a4),a6
move.w 296(a6),d1 ; AttnFlags
move.w #cpu4,d0
btst #3,d1 ; mc 68040
bne.s cpupr
subq.w #cpu4-cpu3,d0
btst #2,d1 ; mc 68030 ?
bne.s cpupr
subq.w #cpu3-cpu2,d0
btst #1,d1 ; mc 68020 ?
bne.s cpupr
subq.w #cpu2-cpu1,d0
btst #0,d1 ; mc 68010 ?
bne.s cpupr
subq.w #cpu1-cpu0,d0 ; mc 68000
cpupr bsr putstrw
move.l d0,d1
move.w #cpu6,d0
btst #5,297(a6) ; mc 68882 ?
bne.s fpupr
move.l d1,d0
btst #4,297(a6) ; mc 68881 ?
beq.s no881
subq.w #cpu6-cpu5,d0
fpupr bsr putstrw
no881 moveq #20,d1
bsr tab
move.w #infoh3,d0
bsr putstrw
noheader1 moveq #1,d5
bsr getaskdat
move.l a5,savedat(a4)
bsr getstdio
lea usedtime(a4),a0
moveq #0,d4
moveq #0,d3
move.l idletask(a4),d2
moveq #0,d1
move.b entries(a4),d1
subq.w #1,d1
1$ lea -16(a5),a5
move.l 12(a5),d5
add.l d5,d4
move.l 0(a5),d0
cmp.l d0,d2
bne.s 2$
move.l d5,d3
2$ bsr gettimeentry
add.l d5,0(a0,d0.w)
dbra d1,1$
move.l d4,maxdisp(a4)
sub.l d3,d4
move.l d4,dispatches(a4)
tst.b headon(a4)
beq.s noheader2
move.l maxdisp(a4),d0
move.l dispatches(a4),d3
bsr prcent
bsr newline
move.w #infoh2,d0
bsr putstrw
noheader2 move.l sysbase(a4),a0
move.l 284(a0),d0 ; DispCount
move.l oldswitches(a4),d1
move.l d0,oldswitches(a4)
sub.l d1,d0
tst.b headon(a4)
beq.s noheader3
mulu #100,d0
move.l d0,-(sp)
lea secs(a4),a0
lea mics(a4),a1
CALL CurrentTime,intuibase(a4)
move.l secs(a4),d3
lsl.l #1,d3
move.l d3,d1
lsl.l #2,d3
add.l d1,d3
move.l mics(a4),d0
move.l #100000,d1
bsr div
add.l d0,d3
move.l time10(a4),d1
move.l d3,time10(a4)
sub.l d1,d3
move.l (sp)+,d0
move.l d3,-(sp)
move.l d3,d1
bsr div
moveq #1,d5
bsr putfrac
moveq #20,d1
bsr tab
move.w #infoh7,d0
bsr putstrw
move.l iocount(a4),d0
clr.l iocount(a4)
mulu #100,d0
move.l (sp)+,d3
move.l d3,d1
bsr div
moveq #1,d5
bsr putfrac
bsr newline
bsr newline
noheader3 lea t4header(a4),a0
tst.b tasktyp(a4)
bmi.s phedder
lea theader(a4),a0
tst.b tasktyp(a4)
bne.s phedder
lea t2header(a4),a0
move.l sysbase(a4),a6
btst #4,297(a6) ; AttnFlags FPU ?
bne.s phedder
lea t3header(a4),a0
phedder bsr puthead
move.l savedat(a4),a5
pt1 tst.b entries(a4)
beq pt2
lea -16(a5),a5
bsr hideit
beq ptend
move.l 0(a5),a3
cmp.l idletask(a4),a3
beq ptend
move.l a3,node(a4) ; ID = task address
move.l a3,d0
bsr hexa
tst.b tasktyp(a4)
ble.s pt12
moveq #0,d0
move.b 8(a3),d0
bsr gettype
pt12 moveq #0,d0
move.b 9(a5),d0
subq.w #1,d0
mulu #9,d0
move.w #status,d1
add.w d1,d0
bsr putstrw ; state
tst.b tasktyp(a4)
beq.s pt345
bpl pt13
move.l 0(a5),d0 ; for usage !
bsr gettimeentry
lea taskstamps(a4),a0
lea 0(a0,d0.w),a0
move.l secs(a4),d0
sub.l 0(a0),d0
bsr putstamp
bsr putblank
move.l usedtime-taskstamps(a0),d0
move.l timerticks(a4),d1
bsr div
bsr putstamp
moveq #'.',d0
bsr putchar
move.l d1,d0
move.l timerticks(a4),d1
addq.w #5,d1
divu #10,d1
divu d1,d0
or.b #'0',d0
bsr putchar
bsr putblank
bra pt346
pt345 move.l 18(a3),d0 ; SigAlloc
bsr hexa
move.w #longnix,d0
cmp.b #4,9(a5) ; tc_state waiting ?
beq.s pt14
bsr putstrw
bra.s pt15
pt14 move.l 22(a3),d0 ; SigWait
bsr hexa
pt15 move.l 26(a3),d0 ; SigRecvd
bsr hexa
move.w #nofpu,d1 ; keine fpu annehmen
move.l sysbase(a4),a6
btst #4,297(a6) ; AttnFlags FPU ?
beq.s prt154
move.w #nullstate,d1 ; fpu im null state annehmen
prt154 lea prt154(pc),a1
move.l a1,d0
cmp.b #2,9(a5) ; tc_state running ?
beq.s pt16 ; kann nur xoper selbst sein
moveq #0,d0 ; 0(sp) -> pc wenn keine fpu
move.l 54(a3),a1 ; tc_SPReg
btst #4,297(a6) ; AttnFlags FPU
beq.s prt151 ; keine FPU
tst.b (a1) ; NULL frame ?
beq.s prt150 ; ja
move.w (a1),d0 ; frame flag / format word
lea 110(a1),a1 ; offset fuer fpu regs
cmp.w #-1,d0
beq.s prt153
lea 12(a1),a1 ; 3 longs mehr
prt153 moveq #0,d0
move.b 1(a1),d0 ; frame size
move.l 4(a1,d0.w),d0 ; pc
move.w #idle,d1
cmp.b #$18,1(a1) ; mc 68881 idle ?
beq.s pt16
addq.w #busy-idle,d1
cmp.b #$b4,1(a1) ; mc 68881 busy ?
beq.s pt16
prt152 addq.w #weissnicht-busy,d1 ; vielleicht mc 68882 ??
bra.s pt16
prt150 moveq #4,d0 ; offset NULL frame
prt151 move.l 0(a1,d0.w),d0 ; n(sp) -> pc
pt16 bsr hexa
move.l sysbase(a4),a6
btst #4,297(a6) ; AttnFlags FPU ?
beq.s pt4
move.w d1,d0 ; fpu state
bsr putstrw
bra.s pt4
pt13 move.b 10(a5),d3 ; tc_Pri
bsr plusmins
move.l dispatches(a4),d0
tst.b useageon(a4)
beq.s pt37
move.l maxdisp(a4),d0
pt37 move.l 12(a5),d3
bsr prcent
pt346 cmpi.b #13,8(a5) ; num
bne.s noproc
tst.l 172(a3)
beq.s noproc
move.b 11(a5),d3
bsr bytedec
bra.s pt4
noproc move.w #nix,d0
bsr putstrw
pt4 bsr gettaskname ; taskname
tst.b tinfo(a4)
beq pt223
tst.b cliexec(a4) ; display 'real' taskname if
beq.s 10$ ; it is a CLI
bsr putblank
move.l 4(a5),d0
bsr putstr
10$ lea tdtasks(a4),a1 ; a trackdisk.device ?
moveq #3,d3
1$ cmp.l (a1)+,a3
dbeq d3,1$
bne.s pt224
eor.b #'0'+3,d3 ; print unit#
move.b d3,unitmsg+8(a4)
move.w #unitmsg,d0
bsr putstrw
pt224 moveq #0,d3 ; is it a device handler ?
lea buffer+2400(a4),a2
lea 200(a2),a1
1$ move.l (a2)+,d0
beq.s pt222
move.l (a1)+,d2
cmp.l 0(a5),d0
bne.s 1$
2$ move.l #' {',d0 ; print dos devicename
bsr putlongascii
move.l d2,d0
bsr putbcpl
move.l #':}',d0
bsr putlongascii
pt222 lea buffer+2160(a4),a1 ; is it a device handler for
lea 160(a1),a2 ; some CLI input/output ?
moveq #0,d5
3$ move.l (a1)+,d0
beq.s 4$
move.w (a2)+,d2
cmp.l 0(a5),d0
bne.s 3$
tst.w d5
bne.s 5$
move.l #' (',d0 ; print CLI#
bsr putlongascii
bra.s 6$
5$ move.l #'& ',d0
bsr putlongascii
6$ moveq #1,d5
moveq #'<',d0
tst.w d2
bmi.s 7$
moveq #'>',d0
7$ bsr putchar
move.l #'CLI ',d0
bsr putlongascii
moveq #0,d0
move.b d2,d0
moveq #0,d3
bsr longdec
bra.s 3$
4$ tst.w d5
beq.s pt223
subq.l #1,ptr(a4)
moveq #')',d0
bsr putchar
pt223 bsr newline
ptend subq.b #1,entries(a4)
bra pt1
pt2 rts
getdevhan tst.b tinfo(a4)
beq.s 4$
move.l a3,-(sp)
bsr devinfo
moveq #49,d3
lea buffer+2400(a4),a2
lea 200(a2),a3
1$ adda.l a1,a1
adda.l a1,a1
tst.l 4(a1)
bne.s 3$
move.l 8(a1),d0
beq.s 3$
moveq #92,d1
sub.l d1,d0
move.l d0,(a2)+
move.l 40(a1),(a3)+
subq.w #1,d3
beq.s 2$
3$ move.l 0(a1),d0
beq.s 2$
move.l d0,a1
bra.s 1$
2$ clr.l (a2)+
move.l (sp)+,a3
4$ rts
getstdio tst.b tinfo(a4)
beq.s 4$
move.l a5,-(sp)
lea buffer+2160(a4),a0
lea 160(a0),a1
moveq #0,d3
move.b entries(a4),d3
subq.w #1,d3
moveq #40,d4
3$ lea -16(a5),a5
cmpi.b #13,8(a5)
bne.s 1$
RECALL Forbid
move.l 0(a5),a3
move.b 143(a3),d2 ; pr_TaskNum
ext.w d2
beq.s 2$
move.l 172(a3),d0 ; pr_CLI
beq.s 2$
move.l 160(a3),d0 ; pr_COS
beq.s 2$
bsr.s getstdio2
or.w #$8000,d2
2$ move.l 156(a3),d0
beq.s 6$
bsr.s getstdio2
6$ RECALL Permit
tst.w d4
ble.s 7$
1$ dbra d3,3$
7$ clr.l (a0)+
move.l (sp)+,a5
4$ rts
getstdio2 lsl.l #2,d0
move.l d0,a2
move.l 8(a2),d0 ; fh_Type
ble.s 1$ ; negative = plain file
move.l d0,a2
move.l 16(a2),d0 ; mp_SigTask
beq.s 1$
move.l d0,(a0)+
move.w d2,(a1)+
subq.w #1,d4
1$ rts
getaskdat move.l d5,-(sp)
bsr.s getaskdat2
move.b d5,entries(a4)
move.l (sp)+,d5
beq.s 1$
clr.w tasksnum(a4)
1$ moveq #16,d2
lea -32(a5),a2
bsr.s sortlist
rts
sortlist tst.b sorton(a4)
beq.s sort5
lea buffer(a4),a1
sort1 lea 0(a1,d2.w),a3
sort2 move.l 0(a1),d1
cmp.l 0(a3),d1
bge.s sort3
move.l d2,d1
subq.w #1,d1
sort4 move.b 0(a3,d1.w),d0
move.b 0(a1,d1.w),0(a3,d1.w)
move.b d0,0(a1,d1.w)
dbra d1,sort4
sort3 lea 0(a3,d2.w),a3
cmp.l a2,a3
ble.s sort2
lea 0(a1,d2.w),a1
cmp.l a2,a1
bne.s sort1
sort5 rts
getaskdat2 move.l sysbase(a4),a6
lea buffer(a4),a5
getaskdat3 moveq #0,d5
move.w #$4000,$dff09a
lea stplist(a4),a3
bsr.s putlist
lea 420(a6),a3 ; SysBase->TaskWait
bsr.s putlist
lea 406(a6),a3 ; SysBase->TaskReady
bsr.s putlist
move.l 276(a6),a3 ; SysBase->ThisTask
bsr.s putdata
1$ move.w #$C000,$dff09a
rts
putlist move.l 0(a3),a3
tst.l 0(a3)
beq.s endlist
bsr.s putdata
bra.s putlist
endlist rts
putdata move.l a3,(a5)+ ; +0 = task node
move.l 10(a3),(a5)+ ; +4 = task->ln_Name
move.b 8(a3),(a5)+ ; +8 = task->ln_Type
move.b 15(a3),(a5)+ ; +9 = task->tc_State
move.b 9(a3),(a5)+ ; +10 = task->ln_Pri
move.b 143(a3),(a5)+ ; +11 = Process->pr_Tasknum
move.w tasksnum(a4),d0
lea cputime(a4),a0
bra.s pua2
pua3 move.l 500(a0),d1
cmp.l (a0)+,a3
beq.s pua1
pua2 dbra d0,pua3
moveq #0,d1
pua1 move.l d1,(a5)+ ; +12 = task time
addq.w #1,d5
rts
alloctaskbuf move.l #2800,d0
moveq #0,d1
CALL AllocMem,sysbase(a4)
move.l d0,a5
move.l a5,d0
beq.s 1$
move.l d0,-(sp)
bsr getaskdat3
move.l (sp)+,d0
1$ rts
freetaskbuf move.l a5,a1
move.l #2800,d0
CALL FreeMem,sysbase(a4)
rts
cleanuptimers bsr.s alloctaskbuf
beq.s 2$
moveq #0,d1
lea taskstampid(a4),a1
1$ lea -16(a5),a5
move.l 0(a5),d0
bsr.s gettimeentry
lea taskstampid(a4),a3
lea 0(a3,d0.w),a3
move.l 0(a3),d2
move.l 0(a1),0(a3)
move.l d2,(a1)
move.l taskstamps-taskstampid(a3),d2
move.l taskstamps-taskstampid(a1),taskstamps-taskstampid(a3)
move.l d2,taskstamps-taskstampid(a1)
move.l usedtime-taskstampid(a3),d2
move.l usedtime-taskstampid(a1),usedtime-taskstampid(a3)
move.l d2,usedtime-taskstampid(a1)
addq.l #4,a1
addq.w #1,d1
subq.b #1,d5
bne.s 1$
move.w d1,numtaskstimed(a4)
bsr.s freetaskbuf
2$ rts
gettimeentry movem.l d1/a0/a1,-(sp)
lea taskstampid(a4),a1
lea 4(a1),a0
move.w numtaskstimed(a4),d1
subq.w #1,d1
1$ cmp.l (a1)+,d0
dbeq d1,1$
sub.l a0,a1
move.l a1,d0
movem.l (sp)+,d1/a0/a1
rts
getaskname2 movem.l a3/a5,-(sp)
link a2,#-10
move.l sp,a5
move.l d0,a3
tst.l d0
bne.s 2$
bsr putstr
bra.s 1$
2$ move.b 8(a3),8(a5)
move.l 10(a3),4(a5)
bsr.s gettaskname
1$ unlk a2
movem.l (sp)+,a3/a5
rts
gettaskname movem.l a1-a2,-(sp)
clr.b cliexec(a4)
tst.b cmdcli(a4)
beq.s 2$
cmpi.b #13,8(a5)
bne.s 2$
CALL Forbid,sysbase(a4)
tst.l 140(a3) ; pr_TaskNum
beq.s 1$
move.l 172(a3),d0 ; pr_CLI
beq.s 1$
lsl.l #2,d0
move.l d0,a2
tst.l 60(a2) ; cli_Module
beq.s 1$
move.l 16(a2),a1
adda.l a1,a1
adda.l a1,a1
tst.b 0(a1)
beq.s 1$
move.w #openbrak,d0
bsr putstrw
move.l 16(a2),d0 ; cli_CommandName
bsr putbcpl
RECALL Permit
st cliexec(a4)
move.w #closebrak,d0
movem.l (sp)+,a1-a2
bra putstrw
1$ RECALL Permit ; a6 - still SysBase
2$ move.l 4(a5),d0
movem.l (sp)+,a1-a2
bra putstr
gettype moveq #$f,d1
and.l d1,d0
mulu #11,d0
add.w #type,d0
bra putstrw
*-------- mem-hunks ------------
showmem lea mheader(a4),a0
bsr puthead
move.l sysbase(a4),a5
lea 322(a5),a5 ; SysBase->MemList
moveq #0,d5
mem1 move.l 0(a5),a5 ; MemList->ln_Next
tst.l 0(a5)
beq.s mem2
move.l 20(a5),d0 ; MemHeader->mh_Lower
bsr hexa
move.l 24(a5),d0 ; MemHeader->mh_Upper
bsr hexa
move.l 28(a5),d0 ; MemHeader->mh_Free
add.l d0,d5
moveq #1,d3
bsr longdec
move.w 14(a5),d0 ; MemHeader->mh_Attributes
bsr gthex
addq.l #3,d0
move.l d0,a0
move.b #'$',(a0)
bsr putstr
move.b 9(a5),d3 ; MemHeader->ln_pri
bsr plusmins
move.l 10(a5),d0 ; MemHeader->ln_Name
move.l a5,node(a4)
bsr putnam
bra.s mem1
mem2 move.w #infoh6,d0
bsr putstrw
moveq #19,d1
bsr tab
move.l d5,d0
moveq #0,d3
bsr longdec
bra newline
frags move.l sysbase(a4),a5
lea 322(a5),a5 ; SysBase->MemList
1$ move.l 0(a5),a5 ; MemList->ln_Next
tst.l 0(a5)
bne.s 10$
rts
10$ move.w #memtyp,d0
bsr putstrw
move.l 10(a5),d0
bsr putnam
lea fraghead(a4),a0
bsr puthead
lea buffer(a4),a1
move.l a1,a2
moveq #64,d0
9$ clr.l (a2)+
dbra d0,9$
lea 128(a1),a2
lea 16(a5),a3 ; MemHeader->mh_First
CALL Forbid,sysbase(a4)
2$ move.l 0(a3),d0
beq.s 5$
move.l d0,a3
move.l 4(a3),d0
move.l d0,d5
moveq #31,d1
3$ add.l d0,d0
btst.l #31,d0
dbne d1,3$
lsl.l #2,d1
addq.l #1,0(a1,d1.w)
cmp.l 0(a2,d1.w),d5
ble.s 2$
move.l d5,0(a2,d1.w)
bra.s 2$
5$ CALL Permit,sysbase(a4)
moveq #0,d1
8$ move.l (a2)+,d5
move.l (a1)+,d2
beq.s 6$
moveq #0,d0
bset.l d1,d0
lsr.l #1,d0
move.l d0,d4
bsr hexa
move.l d4,d0
moveq #1,d3
bsr longdec
move.l d2,d0
bsr longdec
move.l d5,d0
bsr longdec
7$ bsr newline
6$ addq.w #1,d1
cmp.w #31,d1
ble.s 8$
bsr newline
bra 1$
*-------- Task-Stack ------------
stack lea stackhead(a4),a0
bsr puthead
moveq #0,d5
bsr getaskdat
bra.s sta4
sta1 lea -16(a5),a5
bsr hideit
beq.s sta4
moveq #1,d3 ; longdec right justified
move.l 0(a5),a1
cmp.l idletask(a4),a1
beq.s sta4
cmp.b #13,8(a1) ; task->ln_Type
bne.s sta2
move.l 172(a1),d0 ; pr_CLI
beq.s sta2
lsl.l #2,d0
move.l d0,a0
tst.l 60(a0) ; cli_Module
beq.s sta2
move.l 52(a0),d4 ; cli_DefaultStack
lsl.l #2,d4
move.l 176(a1),d0 ; pr_ReturnAddress
sub.l d4,d0
bsr hexa
move.l d4,d0
bsr longdec
move.l 176(a1),d0 ; pr_ReturnAddress
sub.l 54(a1),d0 ; tc_SPReg
bra.s sta3
sta2 move.l 58(a1),d0 ; tc_SPLower
bsr hexa
moveq #1,d3
move.l 62(a1),d0 ; tc_SPUpper
sub.l 58(a1),d0 ; tc_SPLower
bsr longdec
move.l 62(a1),d0 ; tc_SPUpper
sub.l 54(a1),d0 ; tc_SPReg
sta3 bsr longdec
move.l a1,a3
bsr gettaskname
bsr newline
sta4 subq.b #1,entries(a4)
bcc.s sta1 ; more entries
rts
clicomm lea clicomhead(a4),a0
bsr puthead
moveq #0,d5
bsr getaskdat
bra clic0
clic1 lea -16(a5),a5
bsr hideit
beq clic0
move.l 0(a5),a2
cmpi.b #13,8(a2) ; ln_Type
bne clic0
tst.l 172(a2)
beq clic0
move.l 140(a2),d3 ; pr_TaskNum
beq clic0
move.l a2,d0
move.l d0,node(a4)
bsr hexa
moveq #0,d0
move.b 9(a5),d0
subq.w #1,d0
mulu #9,d0
add.w #status,d0
bsr putstrw
move.l 172(a2),a3 ; pr_CLI
adda.l a3,a3
adda.l a3,a3
move.w #script,d0
tst.l 40(a3) ; cli_InterActive
beq.s clic5
addq.w #interact-script,d0
clic5 bsr putstrw
move.w #backg,d0
tst.l 44(a3) ; cli_Background
bne.s clic6
addq.w #foreg-backg,d0
clic6 bsr putstrw
bsr bytedec
move.l 4(a5),d0
bsr putstr
moveq #49,d1
bsr tab
bsr putblank
move.l 128(a2),d0 ; pr_SegList
beq.s noprogloadc
clic3 move.l 172(a2),d1 ; pr_CLI
bne.s clic4
noprogloadc move.w #longnix,d0
bsr putnamw
bra.s clic0
clic4 lsl.l #2,d1
move.l d1,a2
move.l 60(a2),d1 ; cli_Module
beq.s noprogloadc
move.l 16(a2),d0 ; cli_CommandName
bsr putbcpl
move.l 36(a2),d1 ; cli_CommandFile
beq.s 1$
move.l d1,d2
lsl.l #2,d1
move.l d1,a0
tst.b 0(a0)
beq.s 1$
bsr putblank
move.w #openbrak,d0
bsr putstrw
move.l d2,d0
bsr putbcpl
move.w #closebrak,d0
bsr putstrw
1$ bsr newline
clic0 subq.b #1,entries(a4)
bcc clic1
clic8 rts
*--------- interrupts ------------
showint lea iheader(a4),a0
bsr puthead
lea intnames(a4),a5
lea inttyp(a4),a1
moveq #0,d6
findint moveq #0,d1
lea inttyp(a4),a1
moveq #15,d5
move.l sysbase(a4),a3
lea 84(a3),a3 ; SysBase->IntVects[16]
si0 tst.b 0(a1,d1.w)
bne.s si4
move.l 8(a3),a2 ; IntVector->iv_Node
bra.s si5
si4 move.l 0(a3),a2 ; Interrupt->is_Node
si5 move.l a2,d0
beq nxtint
tst.b 0(a1,d1.w)
beq.s si1
si2 move.l 0(a2),a2 ; is_Node->ln_Next
tst.l 0(a2)
beq nxtint
si1 tst.w d6
beq.s 3$
cmp.l a2,d4
bne.s 4$
rts
3$ move.l a2,node(a4)
move.l a2,d0
bsr hexa
move.l 14(a2),d0 ; Interrupt->is_Data
bsr hexan
move.l 18(a2),d0 ; Interrupt->is_Code
bsr hexan
move.b 9(a2),d3 ; Interrupt->ln_Pri
movem.l d6/a3,-(sp)
bsr plusmins
move.w #intserv,d0
tst.b 0(a1,d1.w)
bne.s 1$
move.w #inthand,d0
1$ bsr putstrw
move.w #intdis,d0
move.w $dff01c,d3
btst.w d1,d3
beq.s 2$
move.w #inten,d0
2$ bsr putstrw
movem.l (sp)+,d6/a3
move.l a5,d0
bsr putstr
move.l 10(a2),d0 ; Interrupt->ln_Name
bsr putnam
tst.b 0(a1,d1.w)
bne si2
4$ tst.l 0(a2)
beq.s nxtint
move.l 0(a2),a2
bra si1
nxtint addq.w #1,d1
lea 12(a5),a5
lea 12(a3),a3
dbra d5,si0
rts
*--------- resident ------------
showresi lea rheader(a4),a0
bsr puthead
move.l sysbase(a4),a5
move.l 300(a5),a5 ; SysBase->ResModules
r1 move.l (a5)+,d0 ; Resident->ln_Next
beq.s r2
bpl.s r3
bclr #31,d0
movea.l d0,a5
bra.s r1
r3 move.l d0,node(a4)
movea.l d0,a3
bsr hexa
move.b 13(a3),d3 ; rt_Pri
bsr plusmins
move.b 10(a3),d0 ; rt_Flags
bsr bin
move.b 11(a3),d3 ; rt_Version
bsr bytedec
move.b 12(a3),d0 ; rt_Type
bsr gettype
move.l 14(a3),d0 ; rt_Name
bsr putnam
bra.s r1
r2 rts
*--------- ports -------------
showprt lea pheader(a4),a0
bsr puthead
moveq #0,d5
lea buffer(a4),a5
move.l a5,-(sp)
CALL Forbid,sysbase(a4)
move.w #$4000,$dff09a
bsr.s getprts
move.w #$C000,$dff09a
RECALL Permit
move.l (sp)+,a5 ; buffer
bra.s sp2
sp1 move.l (a5)+,d0
move.l d0,node(a4)
bsr hexa
move.l (a5)+,d0
bsr putstr
moveq #25,d1
bsr tab
bsr putblank
moveq #3,d0
and.b (a5)+,d0
mulu #9,d0
add.w #mp_flags,d0
bsr putstrw
lea bytedec(pc),a0
move.b (a5)+,d3
jsr 0(a0) ; bytedec
move.w (a5)+,d3
bpl.s 1$
lea putstrw(pc),a0
move.w #toomuch,d0
1$ jsr 0(a0) ; bytedec or putstrw
move.l (a5)+,d0
bsr getaskname2
bsr newline
sp2 subq.w #1,d5
bcc.s sp1
rts
getprts lea 392(a6),a3 ; SysBase->PortList
sp3 move.l 0(a3),a3 ; mp_Node.ln_Next
tst.l 0(a3)
beq.s sp4
bsr.s getpdata
bra.s sp3
sp4 tst.b tports(a4)
beq.s sp6
move.l 276(a6),a3 ; SysBase->ThisTask
lea 92(a3),a3 ; Process->pr_MsgPort
bsr.s getpdata
lea 406(a6),a2 ; SysBase->TaskReady
bsr.s sp5
lea 420(a6),a2 ; SysBase->TaskWait
sp5 move.l 0(a2),a2
tst.l 0(a2)
beq.s sp6
lea 92(a2),a3 ; pr_MsgPort
cmp.b #13,8(a2) ; ln_Type
bne.s sp5
bsr.s getpdata
bra.s sp5
sp6 rts
getpdata move.l a3,(a5)+
move.l 10(a3),(a5)+ ; +4 = ln_Name
move.b 14(a3),(a5)+ ; +8 = mp_Flags
move.b 15(a3),(a5)+ ; +9 = mp_SigBit
moveq #0,d0
suba.l a0,a0
movea.l 20(a3),a1 ; mp_MsgList
sp7 movea.l 0(a1),a1
cmpa.l a0,a1
beq.s sp8
addq.b #1,d0
bcc.s sp7 ; <256
subq.w #1,d0
sp8 move.w d0,(a5)+ ; +10 = msgcnt
move.l 16(a3),(a5)+ ; +12 = mp_SigTask
addq.w #1,d5
rts
*-------- resources ------------
showres lea resnam(a4),a3
move.w #336,d3 ; SysBase->ResourceList
bra.s show
*--------- devices -------------
showdevs lea devnam(a4),a3
move.w #350,d3 ; SysBase->DeviceList
bra.s show
*-------- libraries -------------
showlibs lea libnam(a4),a3
move.w #378,d3 ; SysBase->LibList
show lea lheader(a4),a0
bsr puthead1
move.l a3,a0
bsr puthead2
moveq #0,d5
lea buffer(a4),a5
move.l a5,-(sp)
CALL Forbid,sysbase(a4)
lea 0(a6,d3.w),a3
sl1 move.l 0(a3),a3 ; lib_Node.ln_Next
tst.l 0(a3)
beq.s sl2
move.l a3,(a5)+
move.b 33(a3),(a5)+ ; +4 = lib_OpenCnt
move.b 21(a3),(a5)+ ; +5 = lib_Version
move.b 23(a3),(a5)+ ; +6 = lib_Revision
move.b 14(a3),(a5)+ ; +7 = lib_Flags
move.l 10(a3),(a5)+ ; +8 = ln_Name
addq.w #1,d5
bra.s sl1
sl2 RECALL Permit
move.l (sp)+,a5 ; buffer
bra.s sl4
sl3 move.l (a5)+,d0
move.l d0,node(a4)
bsr hexa
move.b (a5)+,d3
bsr bytedec
move.b (a5)+,d3
bsr bytedec
move.b (a5)+,d3
bsr bytedec
move.b (a5)+,d0
bsr bin
move.l (a5)+,d0
bsr putnam
sl4 subq.w #1,d5
bcc.s sl3 ; not ready
rts
;--------- Semaphores ---------
semaphores lea semhead(a4),a0
bsr puthead
move.l sysbase(a4),a3
lea 532(a3),a3
bsr.s sema
tst.b post_V34(a4)
bne.s sema6
move.l intuibase(a4),a3
lea 1010(a3),a3
sema moveq #0,d5 ; examine list
lea buffer(a4),a5
move.l a5,-(sp)
move.w #$4000,$dff09a
sema2 move.l 0(a3),a3
tst.l 0(a3)
beq.s sema3
move.l a3,(a5)+
move.l $28(a3),(a5)+
move.b $2d(a3),(a5)+
move.b $f(a3),(a5)+
move.l 10(a3),(a5)+
addq.w #1,d5
bra.s sema2
sema3 move.w #$C000,$dff09a
move.l (sp)+,a5 ; buffer
bra.s sema5
sema4 move.l (a5)+,d0
bsr hexa
move.l (a5)+,d0
bsr getaskname2
moveq #24,d1
bsr tab
moveq #1,d3
add.b (a5)+,d3
bsr plusmins
move.b (a5)+,d3
bsr plusmins
move.l (a5)+,d0
bsr putnam
sema5 subq.w #1,d5
bcc.s sema4 ; not ready
sema6 rts
; unlock a file
unlock tst.l infile(a4)
bne.s ul6
bsr readhex
tst.b d7
beq syntax
move.l d0,remembr(a4)
move.l d0,-(sp)
moveq #-1,d6
bsr.s of44
tst.l remembr(a4)
beq.s ul1
move.w #unlerr,d0
bsr putnamw
bra.s ul4
ul1 bsr allocfinfo
bsr ResumeOutput
move.w #unl1,d0
bsr putstrw
move.l 0(sp),d0
bsr getpath
move.w #unltxt2,d0
bsr putstrw
bsr readline
cmp.b #'y',d0
bne.s ul5
move.l 0(sp),d1
CALL UnLock,dosbase(a4)
ul5 bsr freefinfo
ul4 addq.l #4,sp
ul6 rts
;---------- Show all Locks------------
locks moveq #0,d6
bra.s of33
;---------- Open Files-----------
openfiles moveq #1,d6
of33 lea ofheader(a4),a0
bsr puthead
of44 bsr allocfinfo
bsr devinfo ; get pointer to devicelist
move.l a1,a3
of1 move.l a3,devicelock(a4)
adda.l a3,a3
adda.l a3,a3
moveq #2,d2 ; 2 = DLT_VOLUME
cmp.l 4(a3),d2 ; DeviceList->dl_Type
bne of2
lea buffer(a4),a5
move.l a5,a1
move.l 40(a3),a2 ; dl_Name
adda.l a2,a2
adda.l a2,a2
move.b (a2)+,d2
bra.s of23
of22 move.b (a2)+,(a1)+ ; hack to access the 'RAM Disk'
of23 dbeq d2,of22 ; as 'RAM:' as the system may
bne.s of24
subq.w #1,a1
of24 move.b #':',(a1)+ ; GURU with KS1.2
clr.b 0(a1)
cmp.l #'RAM ',0(a5)
bne.s of5
cmp.l #'Disk',4(a5)
bne.s of5
move.l #'M:'<<16,2(a5)
of5 move.l a5,d1
moveq #-2,d2
CALL Lock,dosbase(a4) ; get a lock to the device
move.l d0,d2 ; not mounted' if fails
bne.s of6
move.l a5,d0 ; buffer points to device name
bsr putstr
move.w #nomount,d0
bsr putnamw
bra of2
of6 CALL Forbid,sysbase(a4)
move.l d2,-(sp) ; d2 = FileLock
lsl.l #2,d2
move.l d2,a5
lea buffer+40(a4),a6 ; where to store the locks we find
of4 move.l 0(a5),d0 ; fl_Link
cmp.l #50,d0 ; zero or bogus ?
ble.s 1$ ; exit loop
tst.l d6 ; searching for a lock ?
bpl.s 3$ ; no !
cmp.l remembr(a4),d0 ; yes, compare them
bne.s 3$
clr.l remembr(a4)
CALL Permit,sysbase(a4)
2$ move.l (sp)+,d1
CALL UnLock,dosbase(a4)
bra of55 ; exit if found
3$ move.l d0,(a6)+ ; put lock into buffer
clr.w (a6)+
tst.b post_V34(a4)
beq.s 5$
bsr IsBcplLock ; hack for KS2.0, see if BPTR
bne.s 5$ ; isn't really an APTR
move.w #1,-2(a6)
bra.s 4$
5$ lsl.l #2,d0 ; convert bptr into aptr
4$ move.l d0,a5
bra.s of4 ; get next lock
1$ clr.l (a6)+ ; end of buffer marker
CALL Permit,sysbase(a4)
tst.l d6 ; just searching for a lock ?
bmi of3 ; skip printing out info
of45 lea buffer+40(a4),a2 ; a2-> array of locks
of46 move.l (a2)+,d0 ; get a lock
beq of3 ; end of list ?
tst.w (a2)+
beq.s 2$
lsr.l #2,d0
2$ move.l d0,d5
lsl.l #2,d0 ; bptr -> aptr
move.l d0,a5
move.l 8(a5),d4 ; fl_Access
move.l d5,d0
bsr getfinfo ; get fileinfo
move.l finfoptr(a4),a5
tst.l d6
beq.s of8
bmi.s of8 ; looking for open files ?
tst.l 4(a5) ; fib_DirEntryType
bpl.s of46 ; not a file
of8 move.l d5,d0
move.l d0,node(a4)
bsr hexa ; display lock
move.w #access,d0 ; access mode
cmp.w #-2,d4
beq.s of7
addq.w #8,d0
of7 bsr putstrw
tst.l 4(a5) ; size
bmi.s of9
move.w #longnix,d0
bsr putstrw
bra.s of10
of9 bsr putblank
move.l 124(a5),d0
moveq #1,d3
bsr longdec
of10 move.l d5,d0 ; path and filename
bsr getpath
bra.s of46
of3 move.l (sp)+,d1
CALL UnLock,dosbase(a4)
of2 move.l 0(a3),d0
move.l d0,a3
bne of1
of55 bsr freefinfo
rts
IsBcplLock movem.l d0/d1/a0/a1,-(sp)
moveq #0,d1
btst d1,d0
bne.s 1$ ; is bcpl
bsr.s CheckAdr ; chk address
bne.s 2$
lsl.l #2,d0
moveq #1,d1
bsr.s CheckAdr ; chk address
2$ move.l d0,a0
move.l 16(a0),a0
cmp.l devicelock(a4),a0
bne.s 1$ ; is bcpl
move.l d1,d0
1$ movem.l (sp)+,d0/d1/a0/a1
rts
; validate address in d0 for accessibility to prevent illegal memory access !
CheckAdr move.l sysbase(a4),a0
move.l 322(a0),a0 ; SysBase->MemList
sub.l a1,a1
1$ cmp.l 20(a0),d0
bcs.s 2$
cmp.l 24(a0),d0
bcs.s 3$
2$ move.l (a0),a0
cmp.l a0,a1
bne.s 1$
3$ rts
;---------- Dos Devices ----------
devices lea ddheader(a4),a0
bsr puthead
bsr devinfo
dev1 adda.l a1,a1
adda.l a1,a1
tst.l 4(a1)
bne dev9
moveq #0,d6
move.l 40(a1),d0
bsr putbcpl
moveq #10,d1
bsr tab
move.w #notfile,d0
lea putstrw(pc),a0
moveq #20,d1
move.l 28(a1),a3
cmp.l d1,a3
ble.s dev3 ; =<20
moveq #1,d6
adda.l a3,a3
adda.l a3,a3
move.l 8(a3),a2
cmp.l d1,a2
ble.s dev3 ; =<20
adda.l a2,a2
adda.l a2,a2
move.l 12(a2),d3
bsr bytedec
move.l 20(a2),d0
moveq #1,d3
lea longdec(pc),a0
jsr 0(a0) ; longdec
move.l 40(a2),d0
beq.s dev2
addq.l #1,d0
sub.l 36(a2),d0
dev2 jsr 0(a0) ; longdec
move.l 44(a2),d0
dev3 jsr 0(a0) ; putstrw or longdec
dev4 move.w #devload,d0
tst.l 8(a1)
bne.s dev5
move.w #devnload,d0
dev5 bsr putstrw
lea putbcpl(pc),a0
tst.w d6
beq.s dev6
move.l 4(a3),d0
bne.s dev7
dev6 move.l 16(a1),d0
bne.s dev7
tst.l 8(a1)
beq.s dev8
move.l 8(a1),a3
move.l -82(a3),d0
lea putstr(pc),a0
dev7 jsr 0(a0) ; putbcpl or putstr
dev8 bsr newline
dev9 move.l (a1),d1
move.l d1,a1
bne dev1
rts
; Re-assign a drive to dos
freedrive moveq #0,d2
bra.s ldr3
; Inhibit a disk drive
lockdrive moveq #1,d2
ldr3 bsr getstr
bsr finddev
lea buffer(a4),a2
bne.s ldr1
ldr2 move.l a2,d0 ; buffer
bsr putstr
move.w #nomount,d0
bsr putstrw
move.w #dishelp,d0
bra putnamw
ldr1 move.l a2,d1 ; buffer
CALL DeviceProc,dosbase(a4)
move.l d0,a0
move.l a0,d0
beq.s ldr2
moveq #31,d0
move.l d2,d1
; send a packet
; d0 = packet type
; d1 = arg1
; a0 = msgport
cons1 lea mypacket(a4),a1
lea 20(a1),a2
move.l a2,10(a1) ; sp_Pkt to sp_Msg->ln_Name
move.l a1,20(a1) ; sp_Msg to sp_Pkt->dp_Link
move.l replyport(a4),a2
move.l a2,24(a1) ; sp_Pkt->dp_Port
move.l d0,28(a1) ; sp_Pkt->dp_Type
move.l d1,40(a1) ; sp_Pkt->dp_Arg1
CALL PutMsg,sysbase(a4)
move.l a2,a0
RECALL WaitPort
move.l a2,a0
jmp _LVOGetMsg(a6)
;display the current directory of all processes,
currentdir lea cdheader(a4),a0
bsr puthead
bsr allocfinfo
bsr alloctaskbuf
beq.s cd7
move.l d0,a5
move.b d5,entries(a4)
move.l a5,-(sp)
bra.s cd6
cd2 cmp.b #13,8(a5)
bne.s cd5
move.l 0(a5),a3
move.l a5,-(sp)
moveq #-1,d6
move.l 152(a3),remembr(a4)
bsr of44
move.l (sp)+,a5
tst.l remembr(a4)
bne.s cd5
move.l 0(a5),a3
move.l a3,node(a4)
bsr gettaskname
moveq #21,d1
bsr tab
move.l 152(a3),d0
bsr getpath
cd5 lea 16(a5),a5
cd6 subq.b #1,entries(a4)
bcc.s cd2 ; not ready
move.l (sp)+,a5
bsr freetaskbuf
bsr freefinfo
cd7 rts
;Change the current directory setting of a process
cd tst.l infile(a4)
bne.s cd7
bsr getstr
lea buffer(a4),a1
move.l a1,d1
moveq #-2,d2
move.l a0,-(sp)
CALL Lock,dosbase(a4)
move.l (sp)+,a0
tst.l d0
bne.s cd16
move.w #dnotf,d0
bra putnamw
cd16 move.l d0,remembr2(a4)
move.l a0,-(sp)
bsr allocfinfo
move.l remembr2(a4),d0
bsr getfinfo
move.l finfoptr(a4),a5
move.l (sp)+,a0
tst.l 4(a5)
bpl.s cd11
move.w #notdir,d0
bsr putnamw
bra.s cd18
cd11 bsr nodenam
moveq #2,d7
lea TRuNode(pc),a3
bsr findnam
tst.b d7
beq.s cd15
move.l d0,a5
cmp.b #13,8(a5)
beq.s cd15
bsr syntax
bra.s cd18
cd15 move.l 152(a5),d0
beq.s cd13
movem.l a5,-(sp)
moveq #-1,d6
move.l d0,remembr(a4)
bsr of44
move.l (sp)+,a5
tst.l remembr(a4)
bne.s cd18
cd13 move.l 152(a5),d1
move.l remembr2(a4),152(a5)
move.l d1,remembr2(a4)
cd12 beq.s cd14
bsr ResumeOutput
move.w #unltxt,d0
bsr putstrw
move.l remembr2(a4),d0
bsr getpath
move.w #unltxt2,d0
bsr putstrw
bsr readline
cmp.b #'y',d0
bne.s cd14
cd18 move.l remembr2(a4),d1
beq.s cd14
CALL UnLock,dosbase(a4)
cd14 bsr freefinfo
rts
;find the first entry in the device-list
;returns a1 = pointer to first entry
devinfo move.l dosbase(a4),a1
move.l 34(a1),a1 ; dl_Root
move.l 24(a1),a1 ; RootNode->rn_Info
adda.l a1,a1
adda.l a1,a1
move.l 4(a1),a1 ; DosInfo->di_DevInfo
rts
; Check if a named dos-device is mounted
; name in 'buffer'.
; Result: d0 = 0(false) anything else(true).
finddev bsr.s devinfo
fdev1 adda.l a1,a1
adda.l a1,a1
tst.l 4(a1)
bne.s fdev2
move.l 40(a1),a2
lea buffer(a4),a0
bsr.s strbcmp
tst.w d0
bne.s fdev3
fdev2 move.l 0(a1),d0
move.l d0,a1
bne.s fdev1
fdev3 rts
; compare bcpl string with string
; a0 = pointer to string
; a2 = bcpl-pointer to bcpl-string
; returns d0 = true(0) false(1)
strbcmp movem.l d1/a0/a2,-(sp)
moveq #0,d0
moveq #0,d1
adda.l a2,a2
adda.l a2,a2
move.b (a2)+,d1
beq.s stb1
subq.w #1,d1
stb2 cmp.b (a2)+,(a0)+
bne.s stb1
dbra d1,stb2
moveq #1,d0
stb1 movem.l (sp)+,d1/a0/a2
rts
;display the list of inputhandlers. It uses our hotkeyhandler
inputhandler move.w #500,d4
lea ininterrupt(a4),a5
inph2 tst.l 4(a5)
beq.s inph3
move.l 4(a5),a5
dbra d4,inph2
inph3 cmp.w #-1,d4
bne.s inph5
move.w #failed,d0
bra putnamw
inph5 lea inheader(a4),a0
bsr puthead
inph6 move.l 0(a5),a5
tst.l 0(a5)
beq.s inph7
move.l a5,d0
move.l d0,node(a4)
bsr hexa
move.l 14(a5),d0
bsr hexa
move.l 18(a5),d0
bsr hexa
move.b 9(a5),d3
bsr plusmins
move.l 10(a5),d0
inph8 bsr putnam
bra.s inph6
inph7 rts
;display list of public screens
pubscreens lea pscrheader(a4),a0
bsr puthead
tst.b post_V34(a4)
beq.s 1$ ; only Kick 2.0+
CALL LockPubScreenList,intuibase(a4)
movea.l d0,a5
move.l a5,d0
beq.s 1$ ; no list ???
5$ movea.l 0(a5),a5
tst.l 0(a5)
beq.s 2$ ; end of list
move.l a5,d0
move.l d0,node(a4)
bsr hexa ; node
move.l 10(a5),d0
bsr putstr ; name
moveq #25,d1
bsr tab
move.w #pscr_state,d0
btst #0,19(a5) ; public or private ?
beq.s 4$
add.w #10,d0
4$ bsr putstrw ; state
lea bytedec(pc),a0
move.w 22(a5),d3 ; visit count (locks & windows)
jsr 0(a0)
move.b 28(a5),d3
bpl.s 3$ ; valid signal
move.w #nix,d0
lea putstrw(pc),a0
3$ jsr 0(a0)
move.l 24(a5),d0 ; sigtask
bsr getaskname2
bsr newline
bra.s 5$
2$ CALL UnlockPubScreenList,intuibase(a4)
1$ rts
;get all screen pointers.
;result: d5=number of screens
; buffer+100 holds pointers.
getscr lea scrheader(a4),a0
bsr puthead
getscr2 movem.l d0/a0,-(sp)
moveq #0,d0
CALL LockIBase,intuibase(a4)
lea buffer+100(a4),a0
move.l 60(a6),a1 ; firstscreen
moveq #0,d5
sr1 addq.w #1,d5
move.l a1,(a0)+
move.l 0(a1),a1
move.l a1,d1
bne.s sr1
subq.w #1,d5
move.l d0,a0
RECALL UnlockIBase
movem.l (sp)+,d0/a0
rts
;display screen infos
screens bsr.s getscr
moveq #1,d6
lea buffer+100(a4),a5
sr2 move.w d6,d3
bsr bytedec ; number
move.l (a5)+,a2
move.l a2,node(a4)
move.l a2,d0
bsr hexa ; address
move.w 12(a2),d0
moveq #4,d3
bsr longdecn ; width
moveq #'X',d0
bsr putchar
move.w 14(a2),d0
bsr longdecn ; height
move.b 189(a2),d3
bsr bytedec
move.l 22(a2),d0 ; depth
bsr putnam ; name
tst.b post_V34(a4)
beq.s sr5 ; only kick 2.0+
move.w #monitorid,d0
bsr putstrw
lea 44(a2),a0 ; ViewPort
CALL GetVPModeID,gfxbase(a4)
move.l d0,-(sp)
bsr hexa ; DisplayID
move.l #'-> ',d0
bsr putlongascii
move.l (sp)+,d0
RECALL FindDisplayInfo
move.l d0,d2
beq.s sr3 ; no handle
move.l d0,a0
lea -104(a5),a1
moveq #56,d0 ; nif_SIZEOF
move.l #$80003000,d1 ; DTAG_NAME
moveq #0,d2
RECALL GetDisplayInfoData
sr3 lea -88(a5),a0 ; NameInfo.Name
cmp.l d2,d0
bne.s sr4 ; ok !
move.l #'???'<<8,(a0)
sr4 move.l a0,d0
bsr putnam ; name + LF
sr5 addq.w #1,d6 ; next screen
dbra d5,sr2
rts
;display windows and associated fonts
windowfonts moveq #1,d0
bra.s windows1
;display window addresses and titles
windows moveq #0,d0
windows1 move.b d0,bool(a4)
bsr getscr2
move.l d5,-(sp)
lea wnheader(a4),a0
bsr puthead
move.l (sp)+,d5
tst.b bool(a4)
beq.s wn20
move.l d5,-(sp)
lea fohead(a4),a0
bsr puthead
move.l (sp)+,d5
wn20 lea buffer+100(a4),a3
wn2 move.w #onscr,d0
bsr putstrw
move.l (a3)+,a2
move.l 22(a2),d0
bsr putnam
lea 4(a2),a1
wn1 move.l (a1),d0
move.l d0,a1
beq.s wn3
move.l d0,node(a4)
bsr hexa
move.l 86(a1),d0 ; wn->UserPort
beq.s 1$
move.l d0,a0
move.l 16(a0),d0 ; SigTask
1$ bsr getaskname2
moveq #20,d1
bsr tab
bsr putblank
moveq #4,d3
moveq #2,d2
lea 4(a1),a0
2$ move.w (a0)+,d0
bsr longdecn
dbra d2,2$
moveq #'X',d0
bsr putchar
move.w 10(a1),d0
bsr longdecn
move.l 32(a1),d0
bsr putnam
tst.b bool(a4)
beq.s wn21
move.l a1,-(sp)
move.l 50(a1),a1
move.l 52(a1),a1
bsr fontdata
move.l (sp)+,a1
wn21 bra.s wn1
wn3 dbra d5,wn2
rts
;close a specified screen
closescreen bsr getscr2
moveq #1,d6
cmp.b #'$',0(a0)
bne.s cs1
bsr readhex
tst.w d7
beq syntax
move.l d0,d4
csin moveq #0,d6
cs1 lea buffer+100(a4),a2
cs5 tst.w d6
bne.s cs2
cmp.l (a2)+,d4
beq.s cs3
bra.s cs4
cs2 move.l (a2)+,a1
move.l 22(a1),a1
bsr strcmp
beq.s cs3
cs4 dbra d5,cs5
move.w #scnofound,d0
bra putnamw
cs3 move.l -(a2),a0
move.l 4(a0),d0 ; Screen->FirstWindow
beq.s cs7
move.l a0,-(sp)
cs6 move.l d0,a3
move.l (a3),-(sp) ; Window->NextWindow
bsr.s clw
move.l (sp)+,d0
bne.s cs6 ; more windows !
move.l (sp)+,a0
cs7 CALL CloseScreen,intuibase(a4)
cs8 rts
;close a specified window
closewindow bsr.s getwnptr ; get windowptr
clw move.l a3,d0 ; close win in a3
beq.s cs8
move.l intuibase(a4),a6
cw1 move.l 36(a3),d0
move.l d0,a0
beq.s cw2
move.w #_LVOFreeSysRequest,d1
move.w 28(a0),d0
and.w #$4000,d0
bne.s cw3
move.l a3,a1
RECALL EndRequest
bra.s cw1
cw2 move.w #_LVOModifyIDCMP,d1 ; d0 already zero !
bsr.s cw3
move.w #_LVOCloseWindow,d1
cw3 move.l a3,a0
jmp 0(a6,d1.w) ; CloseWin/FreeSysReq/ModIDCMP
getwnptr bsr getscr2
moveq #1,d6
cmp.b #'$',0(a0)
bne.s cw4
bsr readhex
tst.w d7
bne.s cwin
bsr syntax
bra.s cw10
cwin move.l d0,d4
moveq #0,d6
cw4 lea buffer+100(a4),a2
cw5 move.l (a2)+,a3
move.l 4(a3),d0
beq.s cw9
cw6 move.l d0,a3
tst.w d6
bne.s cw7
cmp.l a3,d4
beq.s cw11
bra.s cw8
cw7 move.l 32(a3),a1
bsr strcmp
beq.s cw11
cw8 move.l 0(a3),d0
bne.s cw6
cw9 dbra d5,cw5
move.w #winnofound,d0
bsr putnamw
cw10 suba.l a3,a3
cw11 rts
windowoff movem.l d1-d7/a0-a6,-(sp)
bsr getscr2
bsr.s cwin
move.l a3,d1
beq.s woff1
bsr clw
move.l -(a2),a0
move.l a0,d4
tst.l 4(a0)
bne.s woff1
bsr getscr2
bsr csin
woff1 movem.l (sp)+,d1-d7/a0-a6
rts
closetskwin movem.l d1-d7/a0-a6,-(sp)
ctw0 bsr getscr2
lea buffer+100(a4),a2
ctw1 move.l (a2)+,a3
addq.l #4,a3
ctw6 move.l (a3),d1
move.l d1,a3
beq.s ctw4
move.l 86(a3),a0
move.l 16(a0),d1
cmp.l d0,d1
bne.s ctw6
move.l d0,d1
move.l a3,d0
bsr.s windowoff
move.l d1,d0
bra.s ctw0
ctw4 dbra d5,ctw1
movem.l (sp)+,d1-d7/a0-a6
rts
;Change the font of a specified Window
setfont bsr nodenam
tst.b 0(a5)
beq syntax
move.l a5,a3
1$ cmp.b #33,(a3)+
bge.s 1$
tst.b -(a3)
beq syntax
clr.b (a3)+
lea dummy(a4),a2
move.l a2,a0
move.l a5,(a0)+ ; +0
move.w procnum(a4),d0
cmp.w #8,d0
bcc.s 7$ ; not smaller than 8 pixels !
moveq #8,d0
7$ move.w d0,(a0)+ ; +4
clr.w (a0) ; +6
move.l a2,a0 ; TextAttr
CALL OpenFont,gfxbase(a4)
tst.l d0
bne.s 2$
lea diskfont(a4),a1
CALL OpenLibrary,sysbase(a4)
move.l d0,a6
move.l a6,d0
beq.s 4$
move.l a2,a0 ; TextAttr
RECALL OpenDiskFont
move.l d0,d4
move.l a6,a1
CALL CloseLibrary,sysbase(a4)
move.l d4,d0
bne.s 2$
4$ move.w #fonterr,d0
bsr putstrw
move.l 0(a2),d0 ; TextAttr->FontName
bra putnam
2$ move.l d0,-(sp)
move.l a3,a0
bsr kllblnks
bsr getwnptr
move.l (sp)+,a0
move.l gfxbase(a4),a6
move.l a3,d1
beq.s 5$ ; no window !
cmp.l wnptr(a4),a3
bne.s 6$ ; not our window !
st ownfont(a4)
move.l tfont(a4),-(sp)
move.l a0,tfont(a4)
bsr usetopaz2
move.l (sp)+,a0
move.l a0,d0
bne.s 5$
bra.s 3$
6$ move.l 50(a3),a1
RECALL SetFont
move.l a3,a0
CALL RefreshWindowFrame,intuibase(a4)
bra.s 3$
5$ move.l a0,a1
RECALL CloseFont
3$ rts
;display loaded font names and definitions
fonts lea fohead(a4),a0
bsr puthead
move.l gfxbase(a4),a1
lea 140(a1),a1 ; system fontlist
fo1 move.l 0(a1),a1
tst.l 0(a1)
beq.s fo3
bsr.s fontdata
bra.s fo1
fo3 rts
fontdata move.l a1,d0
move.l d0,node(a4)
bsr hexa
move.w 30(a1),d3
bsr bytedec
move.w 20(a1),d3
bsr bytedec
move.w 24(a1),d3
bsr bytedec
move.w #romfnt,d0
btst #1,23(a1)
beq.s fod1
addq.w #diskfnt-romfnt,d0
fod1 bsr putstrw
move.w #ffixed,d0
btst #5,23(a1)
beq.s 1$
addq.w #fprop-ffixed,d0
1$ bsr putstrw
move.b 32(a1),d3
bsr bytedec
move.b 33(a1),d3
bsr bytedec
move.l 10(a1),d0
bra putnam
;set update rate
settime bsr getfrac
tst.b d7
bne.s st1
move.w #whattime,d0
bsr putstrw
move.l timeoutm(a4),d0
move.l #100000,d1
bsr div
moveq #0,d1
move.b timeout(a4),d1
mulu #10,d1
add.l d1,d0
bne.s 1$
move.w #timenotset,d0
bra putnamw
1$ bsr putfrac
bra newline
st1 divs #10,d2
move.b d2,timeout(a4)
swap d2
ext.l d2
moveq #0,d3
subq.w #1,d2
bmi.s 1$
2$ add.l #100000,d3
dbra d2,2$
1$ move.l d3,timeoutm(a4)
rts
zerotimer bsr nodenam
moveq #2,d7
lea TRuNode(pc),a3
bsr findnam
tst.b d7
beq.s 1$
bsr gettimeentry
lea usedtime(a4),a0
clr.l 0(a0,d0)
1$ rts
;cancel a task or a process. The theory is quite simple:
;(Process->ReturnAddr)-4 points to the return address on
;the stack. Task->SPReg points to the next instruction
;to be executed. We just need a
; *(Task->SPReg) = *(Process->ReturnAddr-4).
;If the process has been started from Dos (CLI) and
;the process is doing disk I/O, the CLI will respond with
;a GURU #87000004 (AsyncPKT=unexpected packed received).
;Thats why the calling CLI is also canceled.
cancel tst.l infile(a4)
beq.s cancel1
rts
cancel1 clr.l remembr(a4) ; used for CLI stdio
clr.l remembr2(a4)
clr.b bool(a4)
bsr nodenam
testagain moveq #1,d7
lea TReNode(pc),a3
bsr findnam
tst.b d7
bne.s canok
cnerr move.w #stperr,d0
bra putnamw
canok moveq #0,d5
canok2 move.l d0,pointer(a4) ; d0=task
move.l d0,a1
cmp.b #1,8(a1) ; TASK ?
bne.s isproc
CALL RemTask,sysbase(a4)
move.l pointer(a4),d0
bsr closetsports
move.l pointer(a4),d0
bra closetskwin
isproc tst.w d5
bne.s isproc2 ; second try !
movem.l d0-d7/a0-a6,-(sp)
moveq #-1,d0 ; needed for recursive killing tasks
CALL AllocSignal,sysbase(a4)
move.l d0,cancelbnum(a4)
moveq #0,d1
bset d0,d1
move.l d1,cancelbit(a4)
movem.l (sp)+,d0-d7/a0-a6
isproc2 moveq #0,d5
tst.l 172(a1) ; pr_CLI
beq.s wascreproc
move.l $80(a1),a2 ; Seglist
adda.l a2,a2
adda.l a2,a2
move.l 12(a2),d1 ; empty ?
bne.s wascreproc
move.l 172(a1),a2 ; CommandLineInterface
adda.l a2,a2
adda.l a2,a2
move.l 60(a2),d5 ; cli_Module
tst.l 40(a2) ; IsInteractive
beq dosreturn
move.l 28(a2),remembr(a4) ; yes,get Cli-Window locks
move.l 56(a2),remembr2(a4)
bra dosreturn
wascreproc tst.b bool(a4) ; it is not a CLI, ask what to do
bne.s unload
move.b #3,bool(a4)
bsr ResumeOutput
move.w #canerr0,d0 ; ask for Workbench
bsr putstrw
bsr readline
cmp.b #'y',d0
beq.s andagain
move.b #2,bool(a4)
bsr ResumeOutput
move.w #canerr1,d0 ; ask for unload
bsr putstrw
bsr readline
cmp.b #'y',d0
bne.s andagain
move.b #1,bool(a4)
andagain move.l pointer(a4),d0
moveq #1,d7
lea TReNode(pc),a3
bsr tstnode
tst.w d5
beq cnerr
bra canok2
unload move.l 128(a1),d4 ; get Segmentlist
beq.s unl3
lsl.l #2,d4
move.l d4,a3
cmp.l #100,0(a3)
bpl.s ulerr
move.l 12(a3),d4
unl3 tst.l d4
bne.s unl4
ulerr move.w #unloaderr,d0 ; no Segments !?
bra putnamw
unl4 cmp.b #3,bool(a4) ; Workbench Task
bne.s unl2
move.l a1,-(sp)
moveq #40,d0 ; build a copy of the
moveq #1,d1
swap d1 ; Workbench startup-message
CALL AllocMem,sysbase(a4)
move.l d0,startmess(a4)
move.l d0,a0
move.l a0,-(sp)
move.b #5,8(a0)
move.w #20,18(a0)
move.l d4,24(a0)
moveq #92,d0
add.l 4(sp),d0
move.l d0,20(a0)
lea wbportnam(a4),a1
RECALL FindPort
movem.l (sp)+,a0/a1
move.l d0,14(a0)
bne.s unl2
move.w #noworkbench,d0
bra putnamw
unl2 cmp.b #1,bool(a4)
bne.s dosreturn
move.l a1,-(sp) ; unload process manualy
move.l d4,d1
CALL UnLoadSeg,dosbase(a4)
move.l (sp)+,a1
dosreturn move.l 140(a1),savedat(a4) ; Processnumber
dosret1 move.w #$4000,$dff09a
move.l 54(a1),a3
move.l #endtask,0(a3)
tst.b gotguru(a4)
bne.s 1$
tst.b bool(a4)
bne.s 1$
move.b #2,106(a1) ; ignore messages
1$ cmp.b #4,15(a1) ; if waiting
bne.s doswait
move.l a1,d4
CALL Remove,sysbase(a4)
move.l d4,a1
lea 406(a6),a0 ; activate the task
RECALL AddHead
move.l d4,a1
doswait move.w #$C000,$dff09a
tst.b bool(a4)
bne.s endnodos
tst.l d5
beq.s endcanc
move.l 172(a1),a2
adda.l a2,a2
adda.l a2,a2
dwa1 movem.l d0-d7/a0-a6,-(sp)
move.l cancelbit(a4),d0
CALL Wait,sysbase(a4)
movem.l (sp)+,d0-d7/a0-a6
tst.b gotguru(a4)
bne.s endnodos
moveq #0,d5
bra.s dosret1
endcanc move.l a1,-(sp)
move.l dosbase(a4),a6
move.l remembr(a4),d1 ; close CLI-Window
beq.s ecan1 ; if any
RECALL Close
ecan1 move.l remembr2(a4),d1
beq.s ecan2
RECALL Close
ecan2 move.l (sp)+,a1
move.l savedat(a4),d0 ; remove Task from
move.l dosbase(a4),a2 ; TaskArray
move.l 34(a2),a2
move.l 0(a2),a2
adda.l a2,a2
adda.l a2,a2
lsl.l #2,d0
clr.l 0(a2,d0)
endnodos move.l a1,d0
bsr closetskwin
move.l a1,d0
bsr closetsports
move.l cancelbnum(a4),d0 ; remove our Signal
CALL FreeSignal,sysbase(a4)
rts
;This Code is (hopefully) executed by the Process we want to kill
endtask lea dataarea(pc),a4
move.l sysbase(a4),a6
move.l 276(a6),a1
move.l 176(a1),a1 ; Process_ReturnAddr
lea -4(a1),sp ; reset Process Stackptr
tst.b bool(a4)
bne.s et0
movea.l mytask(a4),a1
move.l cancelbit(a4),d0 ; signal Xoper it
RECALL Signal ; died
et0 cmp.b #3,bool(a4) ; Workbench Process ?
bne.s et1
RECALL Forbid
move.l startmess(a4),a1
RECALL ReplyMsg ; reply startup message
et1 rts
;Stop a task (just queue it on a special list)
freeze bsr nodenam
moveq #1,d7
lea TReNode(pc),a3
bsr findnam
tst.b d7
bne.s frok
frerr move.w #stperr,d0
bra putstrw
frok move.l d0,a1
cmp.b #13,8(a1)
beq.s 1$
cmp.b #1,8(a1)
bne.s frerr
1$ move.w #$4000,$dff09a
CALL Remove,sysbase(a4)
move.w #$C000,$dff09a
move.l d0,a1
move.l d0,a5
lea stplist(a4),a0
RECALL AddHead
add.b #4,15(a5)
rts
;put the task back on its list
warm bsr nodenam
cmp.b #'$',0(a5)
bne.s 1$
move.l d7,d2
move.l a5,a0
bsr readhex
tst.b d7
beq.s 1$
move.l stplist(a4),a3
3$ tst.l 0(a3)
beq.s 2$
cmp.l a3,d0
beq.s waok
move.l 0(a3),a3
bra.s 3$
1$ lea stplist(a4),a0
movea.l a5,a1
moveq #0,d7
bsr fn4
tst.b d7
bne.s waok
2$ move.w #waerr,d0
bra putstrw
waok move.w #$4000,$dff09a
move.l d0,a1
CALL Remove,sysbase(a4)
move.l d0,a1
move.l d0,a5
move.l TReNode(pc),a0
cmp.b #8,15(a1)
bne.s wa1
move.l TWaNode(pc),a0
wa1 adda.l a6,a0
RECALL AddTail
move.l d0,a1
subq.b #4,15(a5)
move.w #$C000,$dff09a
move.l 18(a5),d0
and.l 26(a5),d0
beq.s wa2
movea.l a5,a1
RECALL Signal
wa2 rts
;show the hunks of a process
hunks bsr nodenam
moveq #2,d7
lea TRuNode(pc),a3
bsr findnam
tst.b d7
bne.s hu1
rts
hu1 move.l d0,a5
cmp.b #13,8(a5)
beq.s hu2
move.w #noprocs,d0
bra putnamw
hu2 move.l 128(a5),d0
beq.s noprogload
lsl.l #2,d0
move.l d0,a3
move.l 12(a3),d1
beq.s hu3
cmp.l #100,0(a3)
ble.s 1$
move.w #unloaderr,d0
bra.s huxx
1$ move.w #segloaded,d0
bsr putnamw
bra.s hu5
hu3 move.l 172(a5),d1
bne.s hu4
noprogload move.w #notload,d0
huxx bra putnam
hu4 move.w #cliprocs,d0
bsr putnamw
lsl.l #2,d1
move.l d1,a5
move.l 60(a5),d1
beq.s noprogload
move.w #procloaded,d0
bsr putstrw
move.l 16(a5),d0
bsr putbcpl
bsr newline
hu5 lea hunkheader(a4),a0
bsr puthead
moveq #0,d5
hu6 move.l d5,d3
bsr bytedec
addq.l #1,d5
move.l d1,d0
bsr hexa
lsl.l #2,d1
move.l d1,a5
move.l d1,d0
addq.l #4,d0
bsr hexa
move.l -4(a5),d0
moveq #1,d3
bsr longdec
move.l #'($',d0
bsr putlongascii
move.l -4(a5),d0
bsr hexa
subq.l #1,ptr(a4)
moveq #')',d0
bsr putchar
bsr newline
move.l 0(a5),d1
bne.s hu6
rts
;change the priority of a node
pri bsr getnum
tst.b d7
beq syntax
move.b d2,newpri(a4)
bsr nodenam2
moveq #8,d7
lea TRuNode(pc),a3
bsr findnam
tst.b d7
beq.s pi1
move.l d0,a1
cmp.b #13,8(a1)
beq.s tp2
cmp.b #1,8(a1)
beq.s tp2
move.b newpri(a4),9(a1)
lea SemNode(pc),a0
cmp.l a0,a3
ble.s pi2
move.w #listerr,d0
bra putnamw
pi2 CALL Forbid,sysbase(a4)
RECALL Remove
move.l d0,a1
movea.l (a3),a0
adda.l a6,a0
RECALL Enqueue
RECALL Permit
pi1 rts
;set the priority of our task
mypri bsr getnum
tst.b d7
beq syntax
move.l sysbase(a4),a1
move.l 276(a1),a1
move.l d2,d0
bra.s tp3
;modify a task's priority
taskpri bsr getnum
tst.b d7
beq syntax
move.b d2,newpri(a4)
bsr nodenam
moveq #2,d7
lea TRuNode(pc),a3
bsr findnam
tst.b d7
beq.s tp1
move.l d0,a1
tp2 move.b newpri(a4),d0
tp3 CALL SetTaskPri,sysbase(a4)
tp1 rts
;set all break signals of a task
break move.l #$f000,d0
bra.s setthem
signal bsr readhex
tst.b d7
beq syntax
setthem move.l d0,savedat(a4)
bsr nodenam
moveq #2,d7
lea TReNode(pc),a3
bsr findnam
tst.b d7
beq.s 1$
move.l d0,a1
move.l savedat(a4),d0
and.l 18(a1),d0
CALL Signal,sysbase(a4)
1$ rts
;set up a list of tasknames which should't be displayed
hide cmp.b #10,0(a0)
bne.s hid5
bra syntax
hid5 lea hidestart(a4),a2
move.l a2,d3
hid0 tst.l 0(a2)
beq.s hid1
move.l 0(a2),a2
lea 4(a2),a1
bsr strcmp
beq.s hid2
move.l a2,d3
bra.s hid0
hid1 move.l a0,a3
bsr strlen2
addq.l #5,d0
moveq #1,d1
swap d1
CALL AllocMem,sysbase(a4)
move.l d0,a1
move.l a1,d0
beq.s hid4
move.l d0,0(a2)
addq.l #4,a1
hid3 cmp.b #10,0(a3)
beq.s hid4
move.b (a3)+,(a1)+
bra.s hid3
hid4 rts
hid2 move.l d3,a3
move.l 0(a2),0(a3)
freehidden lea 4(a2),a0
bsr strlen
addq.l #5,d0
move.l a2,a1
CALL FreeMem,sysbase(a4)
rts
freehidmem move.l hidestart(a4),a3
fhm0 move.l a3,d0
beq.s fhm1
move.l a3,a2
move.l 0(a2),a3
bsr.s freehidden
bra.s fhm0
fhm1 rts
hideit tst.b hideon(a4)
beq.s pt76
lea hidestart(a4),a3
move.l 4(a5),a0
pt74 tst.l 0(a3)
beq.s pt76
move.l 0(a3),a3
lea 4(a3),a1
bsr strcmp
bne.s pt74
rts
pt76 moveq #1,d0
rts
;set up an ALIAS list
alias cmp.b #10,0(a0)
beq showalias
bsr strbuf
lea buffer(a4),a3
move.l a0,a5
move.l a3,a0
bsr strlen
tst.l d0
beq syntax
cmp.w #1,d0
bne.s 5$
lea params(a4),a0
moveq #parmnum-1,d1
move.b 0(a3),d2
6$ cmp.b (a0)+,d2
dbeq d1,6$
bne.s 5$
move.w #aliaserr,d0
bsr putstrw
move.w #params,d0
bsr putstrw
move.w #aliaserr2,d0
bra putnamw
5$ move.l d0,d5
bsr findalias
tst.l d2
bmi.s 7$ ; no alias
lea aliaslist(a4),a0
cmp.l (a0),a2
10$ beq.s 9$
move.l (a0),a0
bra.s 10$
9$ move.l (a2),(a0)
lea 5(a2),a0
8$ tst.b (a0)+
bne.s 8$
move.l a0,d0
move.l a2,a1
sub.l a1,d0
CALL FreeMem,sysbase(a4)
cmp.b #10,0(a5,d5.l)
beq.s 1$ ; was 'unalias'
7$ lea 0(a5,d5.l),a0
bsr kllblnks
bsr findcmd
tst.l d2
bmi syntax
move.l a5,a0
bsr strbuf
addq.l #6,d5
move.l d5,d0
moveq #1,d1
swap d1
CALL AllocMem,sysbase(a4)
tst.l d0
beq.s 1$
lea aliaslist(a4),a0
2$ move.l (a0),d1
beq.s 3$
move.l d1,a0
bra.s 2$
3$ move.l d0,0(a0)
move.l d0,a0
move.b d2,4(a0)
lea 5(a0),a0
4$ move.b (a3)+,(a0)+
bne.s 4$
1$ rts
showalias lea alhead(a4),a0
bsr puthead
move.l aliaslist(a4),d0
beq.s 1$
2$ move.l d0,a5
addq.l #5,d0
bsr putstr
move.w #15,d1
bsr tab
move.w #equal,d0
bsr putstrw
move.b 4(a5),d0
ext.w d0
bsr.s getcmdptr
bsr putnam
move.l 0(a5),d0
bne.s 2$
1$ rts
freealias move.l aliaslist(a4),a3
1$ move.l a3,d0
beq.s 2$
move.l a3,a2
move.l 0(a2),a3
lea 5(a2),a0
bsr strlen
addq.l #6,d0
move.l a2,a1
CALL FreeMem,sysbase(a4)
bra.s 1$
2$ rts
getcmdptr move.l a0,-(sp)
lea commds(a4),a0
2$ subq.w #1,d0
bcs.s 1$
3$ tst.b (a0)+
bne.s 3$
bra.s 2$
1$ move.l a0,d0
move.l (sp)+,a0
rts
;add a fkey definition to the fkey list. Each entry
;looks like this: long Succ, long Pred, byte Key#, byte length,
; char text[]
showfkeys lea fkhead(a4),a0
bsr puthead
lea fkeys(a4),a1
1$ move.l 0(a1),a1
tst.l 0(a1)
beq.s 2$
moveq #'F',d0
bsr putchar
moveq #1,d3
add.b 8(a1),d3
bsr bytedec
move.b 9(a1),d1
subq.b #1,d1
lea 10(a1),a2
3$ move.b (a2)+,d0
bsr putchar
subq.b #1,d1
bcc.s 3$ ; dbra for bytes ...
bsr newline
bra.s 1$
2$ rts
setfkey bsr nodenam
move.w procnum(a4),d5
beq.s showfkeys
cmp.w #21,d5
bcc syntax
subq.w #1,d5
move.w d5,procnum(a4)
move.l sysbase(a4),a6
lea fkeys(a4),a1
1$ move.l 0(a1),a1
tst.l 0(a1)
beq.s 2$
cmp.b 8(a1),d5
bne.s 1$
move.l a1,d3
RECALL Remove
move.l d3,a1
bsr.s removefkey
2$ tst.b 0(a5)
beq.s 4$
move.l a5,a0
bsr strlen
move.l d0,d5
add.w #10,d0
moveq #0,d1
RECALL AllocMem
move.l d0,a1
move.l a1,d0
beq.s 4$
move.l d0,a3
move.b procnum+1(a4),8(a1)
move.b d5,9(a1)
lea fkeys(a4),a0
RECALL AddHead
lea 10(a3),a3
subq.w #1,d5
3$ move.b (a5)+,(a3)+
dbeq d5,3$
4$ rts
clrfkeys move.l sysbase(a4),a6
2$ lea fkeys(a4),a0
RECALL RemHead
move.l d0,a1
move.l a1,d0
beq.s 1$
bsr.s removefkey
bra.s 2$
1$ rts
removefkey move.b 9(a1),d0 ; length
ext.w d0
ext.l d0
add.w #10,d0
jmp _LVOFreeMem(a6)
;'flushlibs'
flush moveq #-1,d0
moveq #0,d1
move.l sysbase(a4),a6
jmp _LVOAllocMem(a6)
;display library->lib_IDString
info bsr nodenam2
moveq #2,d7
lea DevNode(pc),a3
bsr findnam
tst.b d7
beq.s removefkey-2 ; hack !
move.l d0,a0
move.l 24(a0),d0
beq.s if2
move.l d0,a0
tst.b (a0)
bne.s if1
if2 move.w #noinfo,d0
bsr putstrw
move.l a5,d0
if1 bra putnam
; reset vectors
capture move.l sysbase(a4),a1
lea 42(a1),a0
moveq #2,d6
lea coldtxt(a4),a3
cap0 move.l a3,d0
bsr putstr
move.l (a0)+,d0
bne.s cap1
move.w #unset,d0
bsr putstrw
bra.s cap2
cap1 bsr hexa
cap2 bsr newline
lea 15(a3),a3
dbra d6,cap0
move.w #kicktxt,d0
bsr putstrw
move.l 546(a1),d0
bne.s kickm3
move.w #unset,d0
bra putnamw
kickm3 move.l d0,-(sp)
bsr newline
lea kickhead(a4),a0
bsr puthead
move.l (sp)+,a0
kickm0 move.l a0,d0
beq.s kickm4
bpl.s kickm1
bclr #31,d0
move.l d0,a0
bra.s kickm0
kickm1 move.w 14(a0),d6
subq.w #1,d6
lea 16(a0),a2
kickm2 move.l 0(a2),d0
bsr hexa
move.l (a2)+,d0
move.l (a2)+,d4
add.l d4,d0
bsr hexa
move.l d4,d0
moveq #0,d3
bsr longdec
bsr newline
dbra d6,kickm2
move.l 0(a0),a0
bra.s kickm0
kickm4 rts
clrcold moveq #42,d0
bra.s chksum
clrcool moveq #46,d0
bra.s chksum
clrwarm moveq #50,d0
chksum move.l sysbase(a4),a0
clr.l 0(a0,d0.w)
lea 34(a0),a1
moveq #22,d0
addchk add.w (a1)+,d1
dbra d0,addchk
not.w d1
move.w d1,82(a0)
rts
;Save the command line to be repeated. If this line doesn't produce
;any output, don't repeat it at all
repeatcmd not.b repeat(a4)
beq.s 3$
move.w repeatlen(a4),d0
subq.w #7,d0
beq.s 4$
move.w d0,repeatlen(a4)
lea repeatbuffer(a4),a1
lea dummy(a4),a2
move.w d0,d1
1$ move.b 0(a0),(a1)+
move.b (a0)+,(a2)+
2$ dbra d1,1$
clr.l lastprinted(a4)
clr.b printed(a4)
bsr cli
tst.b printed(a4)
beq.s 4$
bsr starttimer
3$ rts
4$ clr.b repeat(a4)
bra.s 3$
;save the parameters from a 'window x y width height' call
setwindow tst.l infile(a4)
bne.s wiw1
wiw3 move.w #wiwerr,d0
bra putnamw
wiw1 lea window_l(a4),a3
moveq #3,d5
wiw0 bsr getnum
tst.w d7
beq.s wiw2
move.w d2,(a3)+
dbra d5,wiw0
wiw2 rts
iconpos bsr getnum ; set icon position
tst.w d7
beq.s 1$
move.w d2,-(sp)
bsr getnum
swap d2
move.w (sp)+,d2
swap d2 ; X.w,Y.w
tst.w d7
beq.s 1$
move.l d2,icnwindow(a4) ; store new pos
1$ rts
iconbackdrp eor.w #$100,icnwindow+16(a4) ; wn_Flags+2
rts
;toggle prop gadget on/off
propgad moveq #0,d7
lea propgadon(a4),a2
lea sbgadget(a4),a3
bra.s gadonoff
;toggle iconify gadget on/off
icongad moveq #1,d7
lea iconifyon(a4),a2
lea iconifgad(a4),a3
gadonoff move.b (a2),-(sp) ; save old state
bsr.s onoff
move.b (sp)+,d0
tst.w d7
beq.s 3$ ; not iconify gadget
tst.b ownscreen(a4)
bne.s 1$ ; only window valid
tst.b post_V34(a4)
bne.s 1$ ; only pre Kick2.0+
3$ tst.l infile(a4)
bne.s 1$ ; from file
cmp.b (a2),d0
beq.s 1$ ; oldstate == newstate !
move.l intuibase(a4),a6
move.w #_LVORemoveGadget,d1
tst.b (a2)
beq.s 2$
move.w #_LVOAddGadget,d1
2$ moveq #0,d0 ; top of list !
move.l wnptr(a4),a0
move.l a3,a1
jsr 0(a6,d1.w) ; RemoveGadget or AddGadget
bsr setupscreen
1$ rts
;toggle patchmode
smartpatch lea patchmode(a4),a2
bra.s onoff
;toggle commodity on/off
cxhandler lea cxstate(a4),a2
bsr.s onoff
bra setwintitle
;toggle TaskInfo
taskinfo lea tinfo(a4),a2
bra.s onoff
;toggle CLI-Commands
clicmd lea cmdcli(a4),a2
bra.s onoff
;toggle task-header display
nohead lea headon(a4),a2
bra.s onoff
;toggle hide entries
hidden lea hideon(a4),a2
bra.s onoff
;toggle sort on/off
sort lea sorton(a4),a2
bra.s onoff
;toggle task-ports display
taskports lea tports(a4),a2
bra.s onoff
;toggle CPUSE task list
usage lea useageon(a4),a2
;test if 'on'(-1) or 'off'(0) was entered
onoff bsr kllblnks
moveq #0,d2
lea offstr(a4),a1
bsr strcmp
beq.s 1$
subq.b #1,d2
lea onstr(a4),a1
bsr strcmp
beq.s 1$
eor.b d2,0(a2)
move.b 0(a2),d2
1$ move.b d2,0(a2)
rts
;Open a library
openlib bsr nodenam2
move.l a5,a1
moveq #0,d0
CALL OpenLibrary,sysbase(a4)
tst.l d0
beq fn5
opli1 rts
;close it
closelib bsr nodenam2
moveq #0,d7
lea LibNode(pc),a3
bsr findnam
tst.b d7
beq.s clli1
move.l d0,a1
CALL CloseLibrary,sysbase(a4)
clli1 rts
remnode bsr nodenam2
moveq #7,d7
lea TReNode(pc),a3
bsr findnam
tst.b d7
beq.s 1$
move.l d0,-(sp)
CALL Disable,sysbase(a4)
move.l (sp)+,a1
RECALL Remove
RECALL Enable
1$ rts
remport bsr nodenam2
moveq #0,d7
lea PorNode(pc),a3
bsr findnam
tst.b d7
beq.s 1$
move.l d0,a1
move.b #2,14(a1)
CALL RemPort,sysbase(a4)
1$ rts
closetsports movem.l d1-d6/a0-a6,-(sp)
move.l d0,d6
move.l sysbase(a4),a3
lea 392(a3),a3
1$ move.l 0(a3),a3
tst.l 0(a3)
beq.s 2$
cmp.l 16(a3),d6
bne.s 1$
move.b #2,14(a1)
move.l a3,a1
CALL RemPort,sysbase(a4)
bra.s 1$
2$ movem.l (sp)+,d1-d6/a0-a6
rts
remintserver move.l a0,-(sp)
bsr readhex
move.l (sp)+,a0
tst.b d7
beq syntax
move.l d0,d4
moveq #1,d6
move.l a0,-(sp)
bsr findint
move.l (sp)+,a5
tst.w d5
bpl.s 1$
bra fn5
1$ tst.b 0(a3,d1.w)
bne.s 2$
move.w #nintrserv,d0
bra putnamw
2$ move.l d4,a1
move.w d1,d0
CALL RemIntServer,sysbase(a4)
rts
;Remove a resident module from the list. Clears the rt_Matchword
;to avoid being found and reinserted during the next reset
remresident bsr nodenam2
cmp.b #'$',0(a5)
bne.s 1$
move.l a5,a0
bsr readhex
move.l sysbase(a4),a6
tst.b d7
bne.s 2$
1$ move.l a5,a1
RECALL FindResident
tst.l d0
beq fn5
2$ move.l 300(a6),a3 ; SysBase->ResModules
8$ move.l (a3)+,d1
beq fn5
bpl.s 3$
bclr #31,d1
movea.l d1,a3
bra.s 8$
3$ cmp.l d1,d0
bne.s 8$
4$ move.l a3,a5
5$ tst.l (a5)+
bgt.s 5$
6$ move.l d0,a1
clr.w 0(a1) ; rt_MatchTag
clr.b 10(a1) ; rt_Flags
clr.l 22(a1) ; rt_Init
move.l a5,d0
sub.l a3,d0
lsr.w #2,d0
subq.w #1,d0
lea -4(a3),a1
7$ move.l (a3)+,(a1)+
dbra d0,7$
rts
;end Xoper but stay in background
quithold lea dummy(a4),a0
lea in(a4),a1
qh1 move.b (a0),(a1)+
cmp.b #10,(a0)+
bne.s qh1
instback move.l infile(a4),d1
beq.s 7$
CALL Close,dosbase(a4)
clr.l infile(a4)
7$ st wanthold(a4)
moveq #0,d0
bsr CloseGUI ; close screen & window
beq.s quithold-2 ; hack ! (pubscreen used)
tst.b wantwindow(a4)
beq.s 6$
clr.b wantwindow(a4)
clr.b ownscreen(a4)
6$ bsr killpage
bsr freeblank
move.l mysignal(a4),d0 ; build signal mask
or.l trapsignal(a4),d0
move.w cxsig(a4),d1
beq.s 5$
bset d1,d0
5$ tst.b iconifyon(a4)
beq.s 4$
bsr.s iconify
bra.s 2$
4$ CALL Wait,sysbase(a4)
and.l trapsignal(a4),d0
beq.s 3$
st gotguru(a4) ; guru !!
3$ bsr ChkBroker
2$ clr.b wanthold(a4)
tst.b wantexit(a4)
beq.s 1$
bsr exitall ; try quit
1$ move.l realstack(a4),sp
bra restart
; appicon (d7=2) or a window (d7=0) !
iconify move.l d0,d6 ; save signal mask
moveq #2,d7
move.l a4,-(sp)
move.l wbbase(a4),d0 ; try appicon
beq.s 3$
move.l d0,a6 ; library base
moveq #0,d0 ; id
moveq #0,d1 ; userdata
suba.l a0,a0 ; name
move.l replyport(a4),a1 ; port
suba.l a2,a2 ; lock
lea appobj(a4),a3 ; diskobj
suba.l a4,a4 ; tagitems
RECALL AddAppIcon
3$ move.l (sp)+,a4
tst.l d0
bne.s 4$
moveq #0,d7
lea icnwindow(a4),a0 ; try icon window
CALL OpenWindow,intuibase(a4)
4$ move.l d0,wnptr(a4)
move.b d7,appicn(a4)
bsr.s handleiconify ; do iconify
move.l wnptr(a4),d0
beq.s 6$
move.l d0,a0
moveq #_LVORemoveAppIcon,d0
tst.w d7
bne.s 5$
moveq #_LVOCloseWindow,d0
5$ jsr 0(a6,d0.w) ; remove iconify stuff
clr.l wnptr(a4)
6$ clr.b appicn(a4)
rts
; wait for wakeup
handleiconify move.l a6,-(sp)
move.l sysbase(a4),a6 ; setup a6 to ExecBase
waitforcall moveq #0,d0 ; build sig mask
move.l replyport(a4),a2
tst.w d7
bne.s 1$ ; appicon
move.l wnptr(a4),d2
beq.s 2$
move.l d2,a2
move.l 86(a2),a2 ; wn->UserPort
1$ moveq #0,d2
move.b 15(a2),d2 ; Port->SigBit
bset d2,d0
2$ or.l d6,d0 ; complete mask
RECALL Wait
st gotguru(a4)
move.l trapsignal(a4),d1
and.l d0,d1
bne.s icondone ; guru !!
clr.b gotguru(a4)
btst #mysigbit,d0
bne.s icondone ; hotkey !!
bsr ChkBroker ; check broker port
fromport move.l a2,a0 ; wn->UserPort
RECALL GetMsg
move.l d0,a1
move.l a1,d0
beq.s waitforcall
move.l 30(a1),-(sp)
RECALL ReplyMsg
tst.w d7 ; app icon ?
bne.s 1$
move.l a6,(sp) ; only flag
bsr.s chkpos
bne.s 1$
lea osecs(a4),a3
lea 8(a3),a0 ; nsecs
lea 12(a3),a1 ; nmics
move.l a6,-(sp)
CALL CurrentTime,intuibase(a4)
movem.l 0(a3),d0-d3
RECALL DoubleClick
move.l (sp)+,a6
move.l 8(a3),(a3)+ ; nsecs->osecs
move.l 8(a3),(a3)+ ; nmics->omics
tst.l d0
beq.s 1$
clr.l (sp) ; clear value
1$ move.l (sp)+,d0
bne.s fromport
icondone move.l (sp)+,a6
tst.w d7 ; appicon or window ?
bne.s chkpos2
chkpos move.l wnptr(a4),d0 ; window moved ?
beq.s chkpos2
move.l d0,a0
move.l 4(a0),d0 ; new pos
move.l icnwindow(a4),d1 ; old pos
move.l d0,icnwindow(a4)
sub.l d1,d0 ; zero == nothing changed !
chkpos2 rts
;fill all unused memory-chunks with a longword
clear moveq #0,d0
cmp.b #10,0(a0)
beq.s clr5
bsr readhex
tst.b d7
beq syntax
clr5 move.l sysbase(a4),a0
clr.l parmtxt(a4)
lea 322(a0),a0
move.w #$4000,$dff09a
clr1 move.l 0(a0),a0
tst.l 0(a0)
beq.s clr6
move.l 16(a0),a1
clr2 tst.l 0(a1)
beq.s clr1
addq.l #1,parmtxt(a4)
move.l 4(a1),d1
subq.l #8,d1
ble.s clr31
lsr.l #2,d1
subq.l #1,d1
bmi.s clr31
lea 8(a1),a2
clr3 move.l d0,(a2)+
dbra d1,clr3
clr31 move.l 0(a1),a1
bra.s clr2
clr6 move.w #$C000,$dff09a
move.l parmtxt(a4),d0
moveq #0,d3
bsr longdec
move.w #clrtxt,d0
bra putnamw
;change the number of maximum lines in the history buffer
historylines bsr getnum
tst.b d7
beq syntax
move.w d2,maxhlines(a4)
move.w hnum(a4),d0
1$ cmp.w maxhlines(a4),d0
ble.s 2$
bsr remhistline
subq.w #1,d0
bra.s 1$
2$ move.l history+8(a4),curhist(a4)
move.w d0,hnum(a4)
rts
;set the minimum number of characters a input line
;must have to be added to the history buffer
historylength bsr getnum
tst.b d7
beq syntax
tst.b d2
bne.s 1$
addq.w #1,d2
1$ move.w d2,minnumchars(a4)
rts
;display all lines in the history buffer
showhistory lea inputbuffer(a4),a3
moveq #1,d5
move.l history(a4),a5
1$ tst.l 0(a5)
beq.s 2$
move.l d5,d3
bsr bytedec
moveq #0,d0
move.w 8(a5),d0
clr.b 0(a3,d0.w)
lea 10(a5),a0
move.l a3,a1
CALL CopyMem,sysbase(a4)
move.l a3,d0
bsr putnam
move.l 0(a5),a5
addq.l #1,d5
bra.s 1$
2$ rts
;set the maximum lines the output buffer may hold
outputlines bsr getnum
tst.b d7
beq syntax
moveq #100,d3
tst.l d2
bmi.s 2$
cmp.l d3,d2
bge.s 1$
2$ move.l d3,d2
1$ move.l d2,maxlines(a4)
rts
;find a named node
;d7 = number of lists to search through
;a3 = pointer to the first entry in the
; list-offset-table
;a5 = pointer to name
;returns:
;d7 = TRUE(1) / FALSE (0)
;d0 = node
findnam tst.b 0(a5)
bne.s 1$
move.w #nameerr,d0
bsr putnamw
bra fnerr
1$ cmp.b #'$',0(a5)
bne.s fn2
move.l d7,d2
move.l a5,a0
bsr readhex
tst.b d7
beq.s fn6
move.l d2,d7
bsr.s tstnode
tst.w d5
bne.s fn3
bra fn5
fn6 move.l d2,d7
fn2 move.l sysbase(a4),a0
adda.l 0(a3),a0
move.l a5,a1
fn4 CALL FindName,sysbase(a4)
move.l d0,a0
move.l a0,d0
bne.s fn1
fn41 addq.w #4,a3
dbra d7,fn2
fn5 move.w #namerr,d0
bsr putstrw
move.l a5,d0
bsr putnam
fnerr moveq #0,d7
rts
fn1 move.w procnum(a4),d2
beq.s fn3
cmp.b 143(a0),d2
bne.s fn41
fn3 moveq #1,d7
rts
;list-offset-table
TRuNode dc.l 276
TReNode dc.l 406
TWaNode dc.l 420
DevNode dc.l 350
LibNode dc.l 378
ResNode dc.l 336
MemNode dc.l 322
PorNode dc.l 392
SemNode dc.l 532
;Node has been entered in hex. Check if this node exsists
tstnode tst.l infile(a4)
bne.s illegalhex
move.l d0,d1
btst #0,d1
beq.s inrange
move.w #adrerr,d0
bsr putnamw
illegalhex moveq #0,d5
rts
inrange movem.l d7/a3,-(sp)
moveq #1,d5
lea TRuNode(pc),a0
cmp.l a0,a3
bne.s 1$
move.l sysbase(a4),a0
cmp.l 276(a0),d0
beq.s nodefound
subq.w #1,d7
addq.w #4,a3
1$ move.w #$4000,$dff09a
getlist move.l sysbase(a4),a0
add.l 0(a3),a0
nxtnode tst.l 0(a0)
beq.s nxtlist
cmp.l a0,d0
beq.s nodefound
move.l 0(a0),a0
bra.s nxtnode
nxtlist addq.w #4,a3
dbra d7,getlist
moveq #0,d5
nodefound move.w #$C000,$dff09a
movem.l (sp)+,d7/a3
rts
;allocate FileInfoBlock
allocfinfo addq.b #1,finfopen(a4)
bne.s 1$
move.l #260,d0
moveq #0,d1
CALL AllocMem,sysbase(a4)
move.l d0,finfoptr(a4)
1$ rts
;free FileInfoBlock
freefinfo subq.b #1,finfopen(a4)
bpl.s 1$
move.l #260,d0
move.l finfoptr(a4),d1
beq.s 1$
move.l d1,a1
CALL FreeMem,sysbase(a4)
clr.l finfoptr(a4)
1$ rts
;Examine ,d0=Lock
getfinfo move.l d0,d1
move.l finfoptr(a4),d2
CALL Examine,dosbase(a4)
rts
;construct a Pathname from a lock
;d0=Lock ,resulting string is written to window
getpath movem.l d1-d7/a0-a6,-(sp)
move.l d0,d1
beq.s 1$
CALL DupLock,dosbase(a4)
1$ lea out(a4),a3
clr.b -(a3)
gp0 move.l d0,d5
bsr.s getfinfo
move.l finfoptr(a4),a0
move.l 4(a0),d4
addq.l #8,a0
bsr strlen
lea -1(a3),a5
tst.l d4
bmi.s nodir
move.b #'/',-(a3)
nodir subq.w #1,d0
bmi.s nofnam
gp1 move.b 0(a0,d0.w),-(a3)
dbra d0,gp1
nofnam move.l d5,d1
CALL ParentDir,dosbase(a4)
move.l d0,d4
move.l d5,d1
beq.s 2$
CALL UnLock,dosbase(a4)
2$ move.l d4,d0
bne.s gp0
cmp.b #'/',0(a5)
bne.s gp2
move.b #':',0(a5)
gp2 move.l a3,d0
bsr putnam
movem.l (sp)+,d1-d7/a0-a6
rts
dchange lea dchead(a4),a0
bsr puthead
move.l sysbase(a4),a6
lea 350(a6),a0
lea tdname(a4),a1
RECALL FindName
move.l d0,a2
move.l a2,d0
beq 14$
lea 36(a2),a2
moveq #0,d5
2$ move.l (a2)+,d2
beq 3$
RECALL Disable
move.l d2,a0
lea $18e(a0),a0
5$ tst.l 0(a0)
beq.s 6$
move.l 0(a0),a0
bra.s 5$
6$ lea -4(a0),a5
lea buffer+100(a4),a3
9$ move.l 0(a5),a5
tst.l 0(a5)
beq.s 11$
move.l a5,(a3)+
bne.s 9$
11$ clr.l (a3)+
RECALL Enable
lea buffer+100(a4),a3
7$ move.l (a3)+,d0
beq.s 3$
move.l d0,a5
cmp.w #20,28(a5)
bne.s 7$
move.l 40(a5),a3
move.l a3,d0
move.l d0,node(a4)
bsr hexan
move.l a3,d0
beq.s 10$
move.l 14(a3),d0
bsr hexan
move.l 18(a3),d0
bsr hexan
10$ move.l d5,d3
or.b #48,d3
move.b d3,tddrives+2(a4)
move.w #tddrives,d0
bsr putstrw
move.l 14(a5),d0
beq.s 8$
move.l d0,a0
move.l 16(a0),d0
8$ bsr getaskname2
bsr newline
bra.s 7$
3$ addq.w #1,d5
cmp.w #4,d5
bcs 2$
14$ rts
snoop lea snoophead(a4),a2
moveq #0,d2
bsr InitSnoop
beq.s snoop-2
tst.b msnoop(a4)
bne.s 1$ ; already patched !
RECALL Forbid
move.l #_LVOAllocMem,d0
lea capmalloc(pc),a0
exg.l d0,a0
move.l a6,a1
RECALL SetFunction
move.l d0,OldAllocMem(a4)
move.l #_LVOFreeMem,d0
lea capmfree(pc),a0
exg.l d0,a0
move.l a6,a1
RECALL SetFunction
move.l d0,OldFreeMem(a4)
st msnoop(a4)
RECALL Permit
1$ st snoopon(a4) ; enable snooping
clr.b bool(a4)
clr.b capgone(a4)
clr.b capwaiting(a4)
clr.l capiscli(a4)
move.l captask(a4),a1
cmp.b #13,8(a1) ; ln_Type
bne.s waitmem
tst.l 140(a1)
beq.s waitmem
move.l 172(a1),d0 ; pr_CLI
beq.s waitmem
lsl.l #2,d0
move.l d0,a0
lea 60(a0),a0
move.l a0,capiscli(a4)
move.l 0(a0),d0
move.l d0,capseg(a4)
bne.s waitmem
move.w #capwait,d0
bsr putnamw
st capwaiting(a4)
waitmem bsr processmsgs
tm7 move.l snoopport(a4),a0
CALL GetMsg,sysbase(a4)
move.l d0,a3
move.l a3,d0
bne.s tm8
tst.b cbreak(a4)
bne snoopend
tst.b capgone(a4)
bne snoopend
bra.s waitmem
tm8 tst.b capwaiting(a4)
beq.s tm15
move.l capiscli(a4),d7
beq.s tm15
move.l d7,a0
move.l 0(a0),capseg(a4)
beq tm12
clr.b capwaiting(a4)
tm15 move.l 20(a3),d3
tst.b 36(a3) ; free or alloc ?
beq freed
move.w #allok,d0
bsr putstrw
lea memname(pc),a2
moveq #9,d5
tm2 move.w (a2)+,d1
btst d1,d3
beq.s tm1
move.w (a2),d0
bsr putstrw
tm1 addq.w #2,a2
dbra d5,tm2
moveq #41,d1
bsr tab ; d0 - actual pos
bsr putblank
move.l 24(a3),d0
move.l d0,d3
bsr hexa
move.l 28(a3),d0
bne.s tm3
move.w #failed,d0
bsr putstrw
moveq #53,d1
bsr tab
bra.s tm4
tm3 bsr hexa
move.l 28(a3),d0
add.l d3,d0
bsr hexa
bra.s tm4
freed move.w #free,d0
bsr putstrw
move.b #'-',d0
moveq #34,d1
tm9 bsr putchar
dbra d1,tm9
bsr putblank
move.l d3,d0
bsr hexa
move.l 24(a3),d0
bsr hexa
move.l 24(a3),d0
add.l d3,d0
bsr hexa
tm4 move.l 32(a3),d0
bsr hexa
bsr newline
tm12 bsr freemsg
move.l captask(a4),a1
tm13 tst.b capwaiting(a4)
bne.s tm10
move.l capiscli(a4),d0
beq.s 1$
move.l d0,a0
move.l 0(a0),d0
cmp.l capseg(a4),d0
bne.s tm11
1$ move.b 15(a1),d0
cmp.b #5,d0
bge.s tm11
cmp.b #2,d0
bge.s tm10
tm11 st capgone(a4)
tm10 bra tm7
snoopend clr.b snoopon(a4) ; snooping off
tst.b msnoop(a4)
beq.s 1$ ; nothing patched !
CALL Forbid,sysbase(a4)
tst.b patchmode(a4)
beq.s 3$ ; don't check vectors
lea capmalloc(pc),a0
cmp.l _LVOAllocMem+2(a6),a0
bne.s 2$ ; another patch !
lea capmfree(pc),a0
cmp.l _LVOFreeMem+2(a6),a0
bne.s 2$ ; another patch !
3$ move.l OldFreeMem(a4),d0
move.w #_LVOFreeMem,a0
move.l a6,a1
RECALL SetFunction
move.l OldAllocMem(a4),d0
move.w #_LVOAllocMem,a0
move.l a6,a1
RECALL SetFunction
clr.b msnoop(a4)
2$ RECALL Permit
1$ bra ClrSnoop
memname dc.w 31,memnoexp,18,memrev,17,memlarg,16,memclr,10,memkick
dc.w 9,memdma,8,memloc,2,memfast,1,memchip,0,mempubl
capmalloc movem.l d0-d7/a0-a6,-(sp) ; a6 - SysBase !
lea dataarea(pc),a4
tst.b snoopon(a4)
beq.s capm1 ; snooping disabled
move.l 276(a6),d4
cmp.l captask(a4),d4
bne.s capm1
tst.b bool(a4)
bne.s capm1
addq.b #1,bool(a4)
moveq #40,d6
bsr allocmsg
beq.s capm2
move.l d1,20(a5)
move.l d0,24(a5)
move.l 60(sp),32(a5)
st 36(a5) ; is alloc msg
move.l a5,remembr(a4)
movem.l (sp)+,d0-d7/a0-a6
bsr.s memalloc
movem.l d0-d7/a0-a6,-(sp)
lea dataarea(pc),a4
move.l remembr(a4),a1
move.l d0,28(a1)
move.l snoopport(a4),a0
move.b #5,8(a1)
RECALL PutMsg
clr.b bool(a4)
movem.l (sp)+,d0-d7/a0-a6
rts
capm2 clr.b bool(a4)
capm1 movem.l (sp)+,d0-d7/a0-a6
memalloc move.l OldAllocMem+dataarea(pc),-(sp)
rts
capmfree movem.l d0-d7/a0-a6,-(sp) ; a6 - SysBase !
lea dataarea(pc),a4
tst.b snoopon(a4)
beq.s capf1 ; snooping disabled
move.l 276(a6),d4
cmp.l captask(a4),d4
bne.s capf1
tst.b bool(a4)
bne.s capf1
addq.b #1,bool(a4)
moveq #40,d6
bsr.s allocmsg
beq.s capf2
move.l d0,20(a5)
move.l a1,24(a5)
move.l 60(sp),32(a5)
; clr.b 36(a5) ; is free msg
move.l snoopport(a4),a0
move.b #5,8(a5)
move.l a5,a1
RECALL PutMsg
capf2 clr.b bool(a4)
capf1 movem.l (sp)+,d0-d7/a0-a6
move.l OldFreeMem+dataarea(pc),-(sp)
rts
allocmsg movem.l d0-d1/a0-a1,-(sp) ; a6 - SysBase
move.l d6,d0
moveq #1,d1
swap d1
tst.b msnoop(a4) ; memory snooping ?
bne.s 1$
RECALL AllocMem
bra.s 2$
1$ bsr.s memalloc
2$ tst.l d0
beq.s alm1
move.l d0,a5
move.w d6,18(a5)
alm1 movem.l (sp)+,d0-d1/a0-a1
rts
freemsg move.w 18(a3),d0
ext.l d0
move.l a3,a1
CALL FreeMem,sysbase(a4)
rts
tracelocks pea DosTable+20(a4) ; table entry for locks
bra.s tracedos
tracefiles pea DosTable+00(a4) ; table entry for open
tracedos lea fileshead(a4),a2
moveq #1,d2
bsr InitSnoop
move.l (sp)+,a2
beq.s tracelocks-2 ; error
RECALL Forbid
tst.b 5(a2)
bne.s 9$ ; already patched !
move.w 0(a2),a0 ; offset
move.l 16(a2),d0 ; myfunc
move.l dosbase(a4),a1
tst.b post_V34(a4)
beq.s 10$
RECALL SetFunction
move.l d0,12(a2) ; OldFuncPtr
bra.s 9$
10$ move.w 0(a1,a0.w),6(a2) ; OldVec1
move.w #$4ef9,0(a1,a0.w)
move.l 2(a1,a0.w),8(a2) ; OldVec2
move.l d0,2(a1,a0.w)
lea 78(a1),a1
move.l a1,12(a2) ; OldFuncPtr
9$ moveq #-1,d0
move.w d0,4(a2) ; function patched & active
RECALL Permit
8$ bsr processmsgs
7$ move.l snoopport(a4),a0
CALL GetMsg,sysbase(a4)
tst.l d0
bne.s 6$
tst.b cbreak(a4)
bne.s traceend
bra.s 8$
6$ move.l d0,a3
move.l 20(a3),d0
bsr getaskname2
moveq #11,d1
bsr tab
moveq #' ',d0
bsr putchar
move.l 24(a3),d0
bne.s 5$
move.w #failed,d0
bsr putstrw
moveq #21,d1
bsr tab
bra.s 4$
5$ bsr hexa
4$ move.b 28(a3),d0
bmi.s 3$
cmp.b #2,d0
ble.s 2$
3$ move.w #type,d0
bsr putstrw
moveq #28,d1
bsr tab
bra.s 1$
2$ ext.w d0
lsl.w #3,d0
add.w #fmode,d0
bsr putstrw
1$ moveq #29,d0
add.l a3,d0
bsr putnam
bsr freemsg
bra.s 7$
traceend lea DosTable+00(a4),a2
bsr.s remtrace ; for Open()
lea DosTable+20(a4),a2
bsr.s remtrace ; for Lock()
bra ClrSnoop
remtrace CALL Forbid,sysbase(a4)
tst.b 5(a2)
beq.s 2$ ; nothing patched !
move.w 0(a2),a0 ; offset
move.l 16(a2),d0 ; myfunc
move.l dosbase(a4),a1
move.b post_V34(a4),d1
beq.s 6$ ; not pre Kick2.0+ !
tst.b patchmode(a4)
beq.s 5$ ; don't check vectors
6$ cmp.l 2(a1,a0.w),d0
bne.s 2$ ; someone else patched !
tst.b d1 ; d1:=post_V34
beq.s 4$
5$ move.l 12(a2),d0
RECALL SetFunction
bra.s 3$
4$ move.w 6(a2),0(a1,a0.w)
move.l 8(a2),2(a1,a0.w)
3$ clr.b 5(a2)
2$ clr.b 4(a2) ; deactivate
RECALL Permit
rts
mylock moveq #20,d0 ; trace Lock()
bra.s mytrace
myopen moveq #0,d0 ; trace Open()
mytrace movem.l d3-d7/a0-a6,-(sp)
lea dataarea(pc),a4
lea DosTable(a4),a2
add.w d0,a2
move.b 4(a2),d7
beq.s 5$ ; disabled
move.l sysbase(a4),a6
movem.l d1-d2,-(sp)
move.l d1,a0
bsr strlen
moveq #30,d6
add.l d0,d6
bsr allocmsg
beq.s 2$
addq.w #3,d2 ; lock
move.w 2(a2),d3 ; dosoffset
addq.w #1,d3
bne.s 3$
sub.w #1007,d2 ; open
3$ move.b d2,28(a5)
move.l 276(a6),20(a5)
lea 29(a5),a1
move.l d1,a0
RECALL CopyMem
2$ movem.l (sp)+,d1-d2
5$ bsr.s RealDosFunc
tst.b d7 ; disabled
beq.s 6$
movem.l d1-d2,-(sp)
move.l d0,d7
move.l a5,d0
beq.s 1$
move.b #5,8(a5)
move.l d7,24(a5)
move.l snoopport(a4),a0
move.l a5,a1
CALL PutMsg,sysbase(a4)
1$ move.l d7,d0
movem.l (sp)+,d1-d2
6$ movem.l (sp)+,d3-d7/a0-a6
rts
RealDosFunc move.w 2(a2),d0 ; dosoffset
ext.l d0
move.l dosbase(a4),a6
move.l 12(a2),-(sp) ; OldFuncPtr
rts
_DosTable dc.w _LVOOpen,-1 ; patchwhat & dosoffset
dc.w 0,0 ; active,on/off & DosVec1
dc.l 0,0 ; DosVec2 & OldFunc
dc.l myopen ; myfunc
dc.w _LVOLock,-11 ; patchwhat & dosoffset
dc.w 0,0 ; active,on/off & DosVec1
dc.l 0,0 ; DosVec2 & OldFunc
dc.l mylock ; myfunc
;prepare snooping for memory or dos
InitSnoop bsr cls ; clear screen
tst.w d2
bne.s 2$ ; files
bsr nodenam
moveq #1,d7
lea TReNode(pc),a3
bsr findnam
tst.b d7
beq.s 3$ ; task not found
move.l d0,captask(a4)
2$ moveq #0,d0
lea memportname(a4),a0
bsr CreatePort
move.l d0,snoopport(a4)
beq.s 1$ ; no port
move.l d0,a0
moveq #0,d1
move.b 15(a0),d0
bset d0,d1
move.l d1,auxsig(a4)
clr.b cbreak(a4)
st addlines(a4)
move.l a2,a0 ; header
bsr puthead
bsr replyintui
move.l sysbase(a4),a6
moveq #1,d0
1$ rts
3$ move.w #stperr,d0
bsr putnamw ; task not found
moveq #0,d0
bra.s 1$
;end snooping for memory or dos
ClrSnoop move.l snoopport(a4),d0
beq.s 3$
bsr DeletePort
3$ tst.b waitexit(a4)
bne.s 1$ ; Xoper was killed
move.w #stopped,d0
tst.b cbreak(a4)
bne.s 2$
move.w #capexited,d0
2$ bsr putnamw
1$ clr.l snoopport(a4)
clr.b addlines(a4)
clr.l auxsig(a4)
rts
; function to determine cpu-time for each task
myswitch movem.l d0-d1/a0-a2/a4/a6,-(sp)
lea dataarea(pc),a4
move.w tasksnum(a4),d0
move.l sysbase(a4),a0
move.l 276(a0),a0
lea cputime(a4),a2
bra.s sw1
sw0 cmp.l (a2)+,a0
beq.s sw2
sw1 dbra d0,sw0
cmp.w #125,tasksnum(a4)
bcc.s swgo2 ; too much
addq.w #1,tasksnum(a4)
move.l a0,(a2)+ ; new entry
clr.l 496(a2)
sw2 tst.b post_V34(a4)
beq.s sw3
lea newtime(a4),a0
CALL ReadEClock,timerio+20(a4)
move.l newtime+4(a4),d0
move.l d0,d1
sub.l lasttime(a4),d0
bcs.s swgo2
move.l d1,lasttime(a4)
bra.s sw4
sw3 move.l #999999,d0
move.l d0,d1
sub.l sampleio+36(a4),d0
move.l d1,sampleio+36(a4)
sw4 lsr.l #8,d0
add.l d0,496(a2)
swgo2 movem.l (sp)+,d0-d1/a0-a2/a4/a6
move.l OldSwitch+dataarea(pc),-(sp)
rts
myaddtask movem.l d0/a0/a4,-(sp)
lea dataarea(pc),a4
tst.b wanttraps(a4)
beq.s 2$
lea mytrap(pc),a0 ; trap for task
move.l 50(a1),d0
beq.s 1$
cmp.l OldTrap(pc),d0
beq.s 1$
lea myproctrap(pc),a0 ; trap for process
cmp.l OldProcTrap(a4),d0
bne.s 2$
1$ move.l a0,50(a1)
2$ movem.l (sp)+,d0/a0/a4
move.l a1,-(sp)
bsr.s RealAddTask ; do original function
move.l (sp)+,d0
movem.l d1-d7/a0-a6,-(sp)
lea dataarea(pc),a4
move.l d0,d7
lea tsecs(a4),a0
lea tmics(a4),a1
CALL CurrentTime,intuibase(a4)
CALL Forbid,sysbase(a4)
move.w numtaskstimed(a4),d5
lsl.w #2,d5
lea taskstampid(a4),a5
lea 0(a5,d5.w),a5
move.l d7,0(a5)
move.l tsecs(a4),d0
move.l d0,taskstamps-taskstampid(a5)
clr.l usedtime-taskstampid(a5)
addq.w #1,numtaskstimed(a4)
bsr cleanuptimers
RECALL Permit
cmp.b #5,timerio+8(a4)
bne.s 3$
moveq #0,d0
move.w timersig(a4),d1
bset d1,d0
move.l mytask(a4),a1
RECALL Signal
3$ move.l d7,d0
movem.l (sp)+,d1-d7/a0-a6
rts
RealAddTask move.l OldAddTask+dataarea(pc),-(sp)
rts
; install or remove traphandlers
trapguru tst.b wanttraps(a4)
bne.s remtraps
addtraps moveq #-1,d0
CALL AllocSignal,sysbase(a4)
moveq #0,d1
bset d0,d1
move.l d1,trapsignal(a4)
RECALL Forbid ; change the trap handler of
moveq #0,d5 ; aleady running tasks
bsr getaskdat ; get task stucture pointers
bra.s 3$
1$ lea -16(a5),a5
move.l 0(a5),a3 ; pointer to a task structure
lea myproctrap(pc),a0
move.l 50(a3),d0 ; Task->tc_TrapCode
cmp.l OldProcTrap(a4),d0 ; AmigaDOS Handler ?
beq.s 2$
lea mytrap(pc),a0 ; EXEC Handler ?
cmp.l OldTrap(a4),d0
bne.s 3$ ; must be a custom one, skip it
2$ move.l a0,50(a3) ; replace it
3$ subq.b #1,entries(a4)
bcc.s 1$
RECALL Permit
st wanttraps(a4)
rts
remtraps tst.b wanttraps(a4)
beq.s 6$
tst.l infile(a4)
bne.s 5$
CALL Forbid,sysbase(a4)
moveq #0,d5
bsr getaskdat
bra.s 4$
2$ lea -16(a5),a5
move.l 0(a5),a3
lea 50(a3),a3
move.l OldProcTrap(a4),d0
lea myproctrap(pc),a0
cmp.l (a3),a0
beq.s 3$
move.l OldTrap(a4),d0
lea mytrap(pc),a0
cmp.l (a3),a0
bne.s 4$
3$ move.l d0,(a3)
4$ subq.b #1,entries(a4)
bcc.s 2$
RECALL Permit
moveq #32,d0
move.l trapsignal(a4),d1
7$ subq.l #1,d0
add.l d1,d1
bcc.s 7$
RECALL FreeSignal
clr.l trapsignal(a4)
5$ clr.b wanttraps(a4)
6$ rts
; execption handlers
myproctrap bsr.s traphandle
move.l OldProcTrap+dataarea(pc),-(sp)
rts
mytrap bsr.s traphandle
moveq #0,d0
CALL Wait,sysbase+dataarea(pc)
move.l OldTrap+dataarea(pc),-(sp)
rts
traphandle movem.l d0-d7/a0-a6,$180
lea dataarea(pc),a4
move.l sysbase(a4),a6
move.l 276(a6),excpttask(a4)
move.l 4(sp),d0
moveq #9,d1
cmp.l d1,d0
beq.s 2$
move.l d0,excpterror(a4)
moveq #10,d2
moveq #3,d1
cmp.l d1,d0
bne.s 1$
move.l 0(sp,d2.w),excptaddr(a4)
moveq #18,d2
1$ move.l 0(sp,d2.w),excptpc(a4)
move.l mytask(a4),a1
move.l trapsignal(a4),d0
RECALL Signal
2$ movem.l $180,d0-d7/a0-a6
rts
;display ExecBase->LastAlert
lastalert movem.l $100,d1-d2
tst.l d1
bne.s al1
move.l sysbase(a4),a0
movem.l 514(a0),d1-d2
al1 move.w #gurutxt,d0
bsr putstrw
move.l d1,d0
bsr hexa
subq.l #1,ptr(a4)
moveq #'.',d0
bsr putchar
move.l d2,d0
bsr hexa
bra newline
alert move.l excpttask(a4),d0
bne.s alert1
move.w #noguru,d0
bra putnamw
alert1 move.w #softfail,d0
bsr putstrw
move.l excpttask(a4),d0
bsr getaskname2
bsr newline
cmp.l #3,excpterror(a4)
bne.s 1$
move.w #addrserr,d0
bsr putstrw
move.l excptaddr(a4),d0
bsr hexa
bsr newline
1$ move.w #procount,d0
bsr putstrw
move.l excptpc(a4),d0
bsr hexa
bsr newline
move.w #gurutxt,d0
bsr putstrw
move.l excpterror(a4),d0
bsr hexa
lea out(a4),a0
move.l ptr(a4),d0
move.b #'.',-1(a0,d0.w)
move.l excpttask(a4),d0
bsr hexa
bra newline
showguru bsr stoptimer
bsr alert
move.w #_LVOScreenToFront,d0
move.l screenptr(a4),a0
tst.b ownscreen(a4)
bne.s 5$
move.w #_LVOWindowToFront,d0
move.l wnptr(a4),a0
5$ move.l intuibase(a4),a6
jsr 0(a6,d0.w) ; Window or Screen ToFront()
move.w #whatnow,d0
bsr putnamw
clr.l oldpageend(a4)
2$ bsr readline
cmp.b #'i',d0
beq.s 4$
cmp.b #'k',d0
bne.s 2$
move.l excpttask(a4),a1
tst.l 22(a1)
bne.s 3$
CALL RemTask,sysbase(a4)
bra.s 4$
3$ move.l a1,d0
bsr canok
4$ clr.l lastprinted(a4)
bsr starttimer
rts
coldreboot move.w #$4000,$dff09a
move.l sysbase(a4),a6
neg.w 82(a6) ; kill ChkSum
clr.l 4 ; kill ExecBase Ptr
reboot move.l sysbase(a4),a6
tst.b post_V34(a4)
beq.s 1$
jmp _LVOColdReboot(a6)
1$ lea $01000004,a2 ; reboot manually
suba.l -$18(a2),a2
movea.l (a2),a2
subq.l #2,a2
lea 2$(pc),a5
jsr _LVOSupervisor(a6)
cnop 0,4
2$ reset
jmp (a2)
;save the contents of the output buffer
;to a file, append the output if the file allready exists
saveoutput bsr nodenam2
tst.b 0(a5)
beq syntax
move.l a5,d1
move.l #1004,d2 ; mode_readwrite
CALL Open,dosbase(a4)
move.l d0,d5
beq.s 5$
move.l d5,d1
moveq #0,d2
moveq #1,d3
RECALL Seek
bra.s 1$
5$ move.l a5,d1
move.l #1006,d2 ; mode_newfile
RECALL Open
move.l d0,d5
bne.s 1$
move.w #openerr,d0
bsr putstrw
move.l a5,d0
bra putnam
1$ move.l outchain(a4),d0
beq.s 3$
2$ move.l d0,a5
move.w 12(a5),d3
beq.s 4$
ext.l d3
lea 14(a5),a0
move.l a0,d2
move.l d5,d1
RECALL Write
tst.l d0
ble.s 3$
4$ move.l d5,d1
lea cr(a4),a0
move.l a0,d2
moveq #1,d3
RECALL Write
tst.l d0
ble.s 3$
move.l 0(a5),d0
bne.s 2$
3$ move.l d5,d1
RECALL Close
rts
grabtimerio lea tiohead(a4),a0
bsr puthead
move.b timeout(a4),d4
st timeout(a4) ; 255 !
bsr starttimer
move.b d4,timeout(a4)
pea dummy(a4)
CALL Disable,sysbase(a4)
lea timerio(a4),a5
2$ move.l 0(a5),d2
beq.s 1$
move.l d2,a5
bra.s 2$
1$ subq.l #4,a5
RECALL Enable
bsr stoptimer
lea buffer(a4),a3
moveq #1,d4 ; VBlank
bsr gettrq
moveq #40,d0
lea timerio(a4),a0
move.l (sp),a1 ; dummy
RECALL CopyMem
moveq #0,d1
moveq #0,d0
lea timernam(a4),a0
move.l (sp),a1 ; dummy
RECALL OpenDevice
move.l (sp),a1 ; dummy
move.l #1<<30,32(a1)
RECALL SendIO
RECALL Disable
move.l (sp),a5 ; dummy
8$ move.l 0(a5),d2
beq.s 7$
move.l d2,a5
bra.s 8$
7$ subq.l #4,a5
RECALL Enable
move.l (sp),a1 ; dummy
bsr stoptimer2
moveq #0,d4 ; MicroHz
bsr gettrq
move.l (sp),a1 ; dummy
RECALL CloseDevice
clr.l (a3)+
lea -22(a3),a2
moveq #18,d2
bsr sortlist
move.l (sp)+,a5 ; dummy
lea buffer(a4),a5
5$ move.l (a5)+,d0
beq.s 6$
bsr hexa
move.w (a5)+,d0
ext.l d0
mulu #9,d0
add.w #timerunits,d0
bsr putstrw
move.l (a5)+,d0
bsr putstamp
moveq #'.',d0
bsr putchar
move.l (a5)+,d0
move.l #100000,d1
bsr div
or.b #'0',d0
bsr putchar
10$ bsr putblank
move.l (a5)+,d0
bsr getaskname2
bsr newline
bra.s 5$
6$ rts
gettrq RECALL Disable ; a6 - SysBase
3$ move.l 0(a5),a5
tst.l 0(a5)
beq.s 4$
move.l a5,(a3)+
move.w d4,(a3)+
move.l 32(a5),(a3)+
move.l 36(a5),(a3)+
move.l 14(a5),a1
move.l 16(a1),(a3)+
bra.s 3$
4$ RECALL Enable
rts
; check if the timer is runnig, start it if not
starttimer lea timerio(a4),a1
cmp.b #5,8(a1)
beq.s 1$
moveq #0,d0
move.b timeout(a4),d0
bne.s 2$
tst.l timeoutm(a4)
beq.s 1$
2$ move.l d0,32(a1)
move.l timeoutm(a4),36(a1)
move.w #9,28(a1)
CALL SendIO,sysbase(a4)
1$ rts
; Abort a timer request, if pending
stoptimer move.l sysbase(a4),a6
lea timerio(a4),a1
cmp.b #5,8(a1)
bne.s stptim
stoptimer2 move.l a1,-(sp)
RECALL AbortIO
move.l (sp)+,a1
RECALL WaitIO
stptim move.w timersig(a4),d0
moveq #0,d1
bset d0,d1
moveq #0,d0
jmp _LVOSetSignal(a6) ; clr signal
;install as commodity and/or a input-handler
installh move.l cxbase(a4),d0 ; commodity possible ?
beq 1$
lea broker(a4),a3
lea hotkeybuf(a4),a5
move.l d0,a6 ; cxbase
moveq #0,d0
suba.l a0,a0
bsr CreatePort
move.l d0,newbroker+20(a4)
move.l d0,a0
move.b 15(a0),cxsig+1(a4)
moveq #0,d0
lea newbroker(a4),a0
RECALL CxBroker
move.l d0,0(a3)
beq.s 1$ ; no broker !
moveq #1,d0 ; CX_Filter
move.l a5,a0
suba.l a1,a1
RECALL CreateCxObj
move.l d0,filter(a4)
beq.s 3$
move.l d0,a2
move.l d0,a0
RECALL CxObjError
tst.l d0
beq.s 4$ ; hotkey definition ok !
move.l a5,a1
lea defhotkey(a4),a0
5$ move.b (a0)+,(a5)+ ; copy string
bne.s 5$
move.l a2,a0
RECALL SetFilter ; try our default
4$ moveq #4,d0 ; CX_Signal
move.l mytask(a4),a0
move.w #mysigbit,a1
RECALL CreateCxObj
move.l d0,a1 ; Signal -> Filter
move.l a2,a0
RECALL AttachCxObj
moveq #5,d0 ; CX_Translate
suba.l a0,a0
suba.l a1,a1
RECALL CreateCxObj
move.l d0,a1 ; Translate -> Filter
move.l a2,a0
RECALL AttachCxObj
move.l a2,a1 ; Filter -> Broker
move.l 0(a3),a0
RECALL AttachCxObj
3$ move.l 0(a3),a0 ; broker
RECALL CxObjError
tst.l d0
beq.s 2$ ; no error
move.l 0(a3),a0
RECALL DeleteCxObjAll
clr.l 0(a3) ; clear ptr
2$ move.l 0(a3),d0
beq.s 1$
move.l d0,a0
moveq #1,d0
RECALL ActivateCxObj
1$ moveq #0,d0
suba.l a0,a0
bsr CreatePort
move.l d0,inputport(a4)
bsr CreateStdIO
move.l d0,inputio(a4)
move.l d0,a1
lea devicenam(a4),a0
moveq #0,d0
moveq #0,d1
CALL OpenDevice,sysbase(a4)
lea ininterrupt(a4),a0
move.l a4,14(a0)
movea.l inputio(a4),a1
move.w #9,28(a1)
move.l a0,40(a1)
jmp _LVODoIO(a6)
;change our commodity popkey
cxpopkey bsr nodenam2
lea hotkeybuf(a4),a3
move.l filter(a4),a2
move.l infile(a4),d7
bne.s 3$ ; script
tst.l broker(a4)
beq.s 1$ ; no broker - ignore
move.l a2,a0
move.l a5,a1
CALL SetFilter,cxbase(a4) ; set new popkey
move.l a2,a0
RECALL CxObjError
tst.l d0
beq.s 3$ ; no error
move.l a2,a0
move.l a3,a1
RECALL SetFilter ; set old popkey
move.l a3,a5
3$ moveq #39,d0
2$ move.b (a5)+,(a3)+
dbeq d0,2$
clr.b (a3)
tst.l d7 ; script ?
bne.s 1$
bsr setwintitle ; show popkey
1$ rts
;remove commodity and/or handler
removeh move.l broker(a4),d2
beq.s 3$ ; no commodity !
move.l d2,a0
moveq #0,d0 ; disable
CALL ActivateCxObj,cxbase(a4)
move.l d2,a0
RECALL DeleteCxObjAll
3$ move.l newbroker+20(a4),d0
beq.s 2$ ; no port to delete
bsr.s 1$
2$ movea.l inputio(a4),a1
move.w #10,28(a1)
lea ininterrupt(a4),a0
move.l a0,40(a1)
CALL DoIO,sysbase(a4)
movea.l inputio(a4),a1
RECALL CloseDevice
move.l inputio(a4),d0
bsr DeleteStdIO
move.l inputport(a4),d0
1$ bra DeletePort
;check broker port for messages from master control 'Exchange'
ChkBroker move.l a2,-(sp)
tst.l broker(a4)
beq.s 1$
5$ move.l newbroker+20(a4),a0
CALL GetMsg,sysbase(a4)
move.l d0,a2
move.l a2,d0
beq.s 1$
move.l a2,a0
CALL CxMsgType,cxbase(a4)
cmp.w #$40,d0 ; CXM_COMMAND
bne.s 2$
move.l a2,a0
RECALL CxMsgID
move.l mysignal(a4),d1
cmp.w #25,d0 ; CXCMD_UNIQUE
beq.s 3$
st wantexit(a4)
cmp.w #23,d0 ; CXCMD_KILL
beq.s 4$
clr.b wantexit(a4)
cmp.w #19,d0 ; CXCMD_APPEAR
beq.s 3$
moveq #0,d1
cmp.w #21,d0 ; CXCMD_DISAPPEAR
bne.s 3$
st wanthold(a4)
4$ st cbreak(a4) ; end snooping (if nessecary)
move.w nspubsig+6(a4),d0
bset d0,d1
3$ move.l d1,d0
CALL SetSignal,sysbase(a4) ; set new signals
2$ move.l a2,a1
CALL ReplyMsg,sysbase(a4)
bra.s 5$
1$ move.l (sp)+,a2
rts
;this is the handler, it checks if amiga-amiga-x
;has been pressed and signals it to our task
keyhandler move.l a0,-(sp)
tst.l broker(a1)
beq.s 2$ ; not running as commodity !
tst.b cxstate(a1)
bne.s 1$ ; handler is off
2$ cmp.b #1,4(a0)
bne.s 1$
move.w 8(a0),d0
andi.w #$c0,d0
cmpi.w #$c0,d0
bne.s 1$
cmp.w #$32,6(a0)
bne.s 1$
clr.b 4(a0) ; nop event
bsr.s wakeup
1$ move.l (sp)+,d0 ; return event
rts
;wakeup Xoper
wakeup move.l mysignal(a1),d0
move.l sysbase(a1),a6
movea.l mytask(a1),a1
jmp _LVOSignal(a6)
;vertb-handler
countio addq.l #1,iocount(a1)
tst.b pcheck(a1)
beq.s 1$ ; check not requested
bsr.s checkit
tst.b d1
beq.s 1$
clr.b pcheck(a1) ; disable checking ...
bsr.s wakeup
1$ moveq #0,d0
rts
checkit moveq #0,d1 ; check all patched functions
move.l sysbase(a1),a6 ; exec library
tst.b bool(a1)
beq.s 5$
lea myswitch(pc),a5
move.w #_LVOSwitch,d0
bsr.s 2$
lea myaddtask(pc),a5
move.w #_LVOAddTask,d0
bsr.s 2$
5$ tst.b msnoop(a1)
beq.s 4$
lea capmalloc(pc),a5
move.w #_LVOAllocMem,d0
bsr.s 2$
lea capmfree(pc),a5
move.w #_LVOFreeMem,d0
bsr.s 2$
4$ move.l dosbase(a1),a6 ; dos library
tst.b DosTable+05(a1)
beq.s 3$
move.l DosTable+16(a1),a5
move.w DosTable+00(a1),d0
bsr.s 2$
3$ tst.b DosTable+25(a1)
beq.s 1$
move.l DosTable+36(a1),a5
move.w DosTable+20(a1),d0
2$ cmp.l 2(a6,d0.w),a5 ; check library function
seq d1
1$ rts
;compare strings
; -> a0/a1 = pointers to string
; <- d0 = true(0) false(1), d1 = length
strcmp movem.l d2/a0/a1,-(sp)
moveq #0,d0
moveq #0,d1
src2 move.b (a0)+,d0
beq.s src1
cmp.b #10,d0
beq.s src1
addq.w #1,d1
bsr.s src4
move.b d0,d2
move.b (a1)+,d0
bsr.s src4
cmp.b d2,d0
beq.s src2
bra.s src3
src1 move.b 0(a1),d0
src3 movem.l (sp)+,d2/a0/a1
rts
src4 cmp.b #'z'+1,d0 ; convert to upper case
bcc.s 1$
cmp.b #'a',d0
bcs.s 1$
and.b #$df,d0
1$ rts
strbuf movem.l d0/a1-a2,-(sp)
move.l a0,a1
lea buffer(a4),a2
1$ move.b (a1)+,d0
cmp.b #10,d0
beq.s 2$
cmp.b #' ',d0
beq.s 2$
or.b #' ',d0
beq.s 2$
move.b d0,(a2)+
bra.s 1$
2$ clr.b (a2)+
movem.l (sp)+,d0/a1-a2
rts
tolower movem.l d0-d1/a0,-(sp)
subq.w #1,d0
bmi.s 3$
1$ move.b 0(a0),d1
cmp.b #'A',d1
blt.s 2$
cmp.b #'Z',d1
bgt.s 2$
or.b #' ',d1
2$ move.b d1,(a0)+
dbra d0,1$
3$ clr.b (a0)
movem.l (sp)+,d0-d1/a0
rts
; 32-bit division d0 / d1
; <- d0
div movem.l d2/d3,-(sp)
tst.l d1
beq.s 1$
swap d1
tst.w d1
bne.s 4$
swap d1
move.w d1,d3
move.w d0,d2
clr.w d0
swap d0
divu.w d3,d0
move.l d0,d1
swap d0
move.w d2,d1
divu.w d3,d1
move.w d1,d0
clr.w d1
swap d1
bra.s 1$
4$ swap d1
move.l d1,d3
move.l d0,d1
clr.w d1
swap d1
swap d0
clr.w d0
moveq #16-1,d2
3$ add.l d0,d0
addx.l d1,d1
cmp.l d1,d3
bhi.s 2$
sub.l d3,d1
addq.w #1,d0
2$ dbra d2,3$
1$ movem.l (sp)+,d2/d3
rts
;copy a string from input to 'buffer'
; -> a0 = pointer to string
getstr lea buffer(a4),a5
1$ cmp.b #' ',0(a0)
beq.s 2$
cmp.b #10,0(a0)
beq.s 2$
move.b (a0)+,(a5)+
bra.s 1$
2$ clr.b 0(a5)
;skip blanks
; -> a0 pointer to text
; <- a0 = new pointer position
kllblnks cmpi.b #' ',(a0)+
beq.s kllblnks
subq.w #1,a0
rts
;read in a nodename or a processname
nodenam bsr.s isdec
move.w d2,procnum(a4)
nodenam2 bsr.s kllblnks
move.l a0,a5
gno1 cmp.b #10,(a0)+
bne.s gno1
clr.b -1(a0)
rts
getfrac bsr.s isdec
moveq #0,d0
cmp.b #'.',(a0)
bne.s 1$
addq.w #1,a0
cmp.b #10,(a0)
beq.s 1$
move.b (a0)+,d0
and.b #$0f,d0
moveq #1,d7
1$ muls #10,d2
add.l d0,d2
rts
;convert ascii to byte
; -> a0 = pointer to text
; <- d0 = byte
getnum cmp.b #'$',0(a0)
bne.s isdec
bsr.s readhex
move.l d0,d2
rts
isdec moveq #0,d2
moveq #0,d3
moveq #0,d6
moveq #0,d7
cmp.b #'-',0(a0)
bne.s gn1
addq.w #1,a0
moveq #1,d6
gn1 move.b (a0)+,d3
cmp.b #'9',d3
bhi.s gn2
cmp.b #'0',d3
bcs.s gn2
moveq #1,d7
and.b #$f,d3
muls #10,d2
add.l d3,d2
bra.s gn1
gn2 tst.b d6
beq.s gn3
neg.l d2
gn3 subq.w #1,a0
rts
;convert hex to longword
; -> a0 = pointer to text
; <- d0=value, d7 = ok(1) error(0)
readhex movem.l d1-d6/a1-a5,-(sp)
moveq #1,d7
cmp.b #'$',0(a0)
bne.s rh3
addq.l #1,a0
rh3 moveq #0,d0
cmpi.b #10,0(a0)
beq.s rherr
lea hextab(a4),a1
rh0 move.b (a0)+,d3
moveq.l #15,d2
rh1 cmp.b 0(a1,d2.w),d3
beq.s rh2
dbra d2,rh1
bra.s rhend
rh2 lsl.l #4,d0
or.b d2,d0
bra.s rh0
rhend tst.b d3
beq.s rhok
cmpi.b #10,d3
beq.s rhok
cmpi.b #' ',d3
beq.s rhok
rherr moveq #0,d7
rhok movem.l (sp)+,d1-d6/a1-a5
rts
longdecn move.l d3,-(sp)
moveq #3,d3
bsr.s longdec
move.l (sp)+,d3
move.w #binarea+7,d0
sub.w d3,d0
bra putstrw
;convert long to decimal
; -> d0 = value
; d3 bit 0 = left/right justified
; bit 1 = write/leave
; returns string in 'buffer'
longdec movem.l d1-d2/a1-a2,-(sp)
tst.l d0
bmi.s 2$
cmp.l #9999999,d0
ble.s 1$
2$ move.w #smallnix,d0
bra.s ld1
1$ lea binarea(a4),a1
move.l #' ',(a1)+
move.l #' ',(a1)+
clr.b 0(a1)
subq.w #1,a1
cmp.w #2,d3
bne.s ld5
clr.b 0(a1)
ld5 moveq #1,d2
ld2 addq.w #1,d2
moveq #10,d1
bsr div
addi.b #'0',d1
move.b d1,-(a1)
tst.l d0
bne.s ld2
btst #0,d3
bne.s ld1
lea binarea(a4),a2
cmpa.l a2,a1
bne.s ld3
subq.l #1,ptr(a4)
bra.s ld1
ld3 move.b 0(a1),(a2)+
move.b #' ',(a1)+
dbra d2,ld3
ld1 btst #1,d3
bne.s ld4
move.w #binarea,d0
ld6 bsr putstrw
ld4 movem.l (sp)+,d1-d2/a1-a2
rts
putlongascii movem.l d1/d2,-(sp)
moveq #3,d2
move.l d0,d1
2$ rol.l #8,d1
move.b d1,d0
beq.s 1$
bsr putchar
1$ dbra d2,2$
movem.l (sp)+,d1/d2
rts
putstamp movem.l d0/d1,-(sp)
move.l #3600,d1
bsr div
moveq #3,d3
bsr longdec
move.l binarea+4(a4),d0
lsr.l #8,d0
bsr.s putlongascii
moveq #':',d0
bsr putchar
move.l d1,d0
moveq #60,d1
bsr div
bsr.s write2digs
moveq #':',d0
bsr putchar
move.l d1,d0
bsr.s write2digs
movem.l (sp)+,d0/d1
rts
write2digs movem.l d0/d1,-(sp)
divu #10,d0
move.l d0,d1
or.b #'0',d0
bsr putchar
swap d1
or.b #'0',d1
move.b d1,d0
bsr putchar
movem.l (sp)+,d0/d1
rts
;print a bcpl-string
; -> d0 = bcpl-pointer to bcpl-string
putbcpl movem.l d3/a0-a1,-(sp)
tst.l d0
beq.s 1$
lsl.l #2,d0
move.l d0,a1
moveq #0,d3
move.b (a1)+,d3
subq.w #1,d3
bmi.s 1$
2$ move.b (a1)+,d0
beq.s 1$
bsr putchar
dbra d3,2$
1$ move.l ptr(a4),d0
movem.l (sp)+,d3/a0-a1
rts
;write unsigned byte
; -> d3 = value
bytedec bsr.s dec
move.w #decimal,d0
bra putstrw
;write signed byte
; -> d3 = value
plusmins movem.l d5/a3,-(sp)
move.w #$2020,minus(a4)
move.b d3,d5
bpl.s 2$
neg.b d3
2$ bsr.s dec
tst.b d5
bpl.s 1$
move.l d0,a3
move.b #'-',-(a3)
1$ movem.l (sp)+,d5/a3
move.w #minus+1,d0
bra putstrw
dec movem.l d3/a2/a3,-(sp)
lea decimal(a4),a3
move.l #$20202020,(a3)+
subq.l #1,a3
move.l a3,a2
and.l #$ff,d3
moveq #'0',d0
3$ tst.b d3
beq.s 2$
divu #10,d3
swap d3
or.b d0,d3
move.b d3,-(a3)
clr.w d3
swap d3
bra.s 3$
2$ cmpa.l a2,a3
bcs.s 1$
move.b d0,-(a3)
1$ move.l a3,d0
movem.l (sp)+,d3/a2/a3
rts
prcent lsl.l #1,d3
move.l d3,d1
lsl.l #2,d3
add.l d1,d3
lsl.l #2,d3
move.l d3,d1
lsl.l #3,d3
move.l d3,d2
lsl.l #1,d3
add.l d2,d3
add.l d1,d3
move.l d0,d1
move.l d3,d0
bsr div
moveq #0,d5
bsr.s putfrac
move.w #infoh4,d0
bra putstrw
putfrac divu #10,d0
move d0,d3
swap d0
move d0,d1
tst.w d5
bne.s 1$
cmp.w #100,d3
ble.s 1$
move.w #whatsthis,d0
bra putstrw
1$ bsr bytedec
lea out(a4),a0
move.b #'.',-1(a0,d0)
or.b #'0',d1
move d1,d0
bra putchar
;Write pointer, display '-------' if empty
hexan tst.l d0
beq.s hexa2
;Write 8 byte hex value
; -> d0 = value
hexa bsr.s gthex
hexa2 bra putstr
gthex movem.l d1-d2/a1-a2,-(sp)
lea hexarea+9(a4),a2
move.b #' ',-(a2)
lea hextab(a4),a1
moveq #7,d2
hexloop moveq #$0f,d1
and.b d0,d1
move.b 0(a1,d1.w),-(a2)
lsr.l #4,d0
dbra d2,hexloop
move.l a2,d0
movem.l (sp)+,d1-d2/a1-a2
rts
;Convert/write byte into binary string
; -> d0 = value
bin movem.l d1-d7/a0-a6,-(sp)
lea binarea(a4),a0
move.w #$2020,8(a0)
moveq #7,d4
binloop moveq #'0'/2,d1
roxr.b #1,d0
roxl.b #1,d1
move.b d1,0(a0,d4.w)
dbra d4,binloop
move.l a0,d0
movem.l (sp)+,d1-d7/a0-a6
bra putstr
strlen move.l a0,-(sp)
moveq #-1,d0
strl2 addq.l #1,d0
tst.b (a0)+
bne.s strl2
move.l (sp)+,a0
rts
strlen2 move.l a0,-(sp)
moveq #-1,d0
strl22 addq.l #1,d0
cmp.b #10,(a0)+
bne.s strl22
move.l (sp)+,a0
rts
;write a title and underline
; -> a0 = pointer to text
puthead1 bsr.s strlen
move.l d0,d5
move.l a0,d0
bra putstr
puthead2 bsr.s strlen
add.l d0,d5
bra.s ph2
puthead bsr.s strlen
move.l d0,d5
ph2 move.l a0,d0
bsr.s putnam
lea out(a4),a0
move.l a0,d0
ph1 move.b #'-',(a0)+
dbra d5,ph1
move.b #10,(a0)+
clr.b 0(a0)
bra.s putstr
syntax move.w #synerr,d0 ; error
;write a string, move cursor into next line
; -> d0 = pointer to text
putnamw bsr.s putstrw
bra.s putnam1
putnam bsr.s putstr
putnam1 tst.b d0
beq.s 1$
bsr.s newline
1$ rts
newline move.w #cr,d0 ; linefeed
;write a string, strings are only put into the output buffer
;when a LF is detected
; -> d0 = pointer to string
; <- d0 = cursor position
putstrw ext.l d0
add.l a4,d0 ; dataarea
putstr movem.l d1-d7/a0-a6,-(sp)
st printed(a4)
move.l d0,a2
lea out(a4),a3
move.l ptr(a4),d0
move.l a2,d5
bne.s pst1
lea longnix(a4),a2
pst1 move.b (a2)+,d1
cmpi.b #13,d1
beq.s pst1
cmpi.b #10,d1
beq.s lineend
move.b d1,0(a3,d0.w)
beq prend
cmp.w #100,d0
bge.s pst1
addq.l #1,d0
bra.s pst1
lineend tst.l infile(a4)
beq.s 1$
moveq #0,d0
bra prend
1$ tst.l lastprinted(a4)
bne.s 2$
bsr killpage
2$ addq.w #1,d0
move.l d0,-(sp)
add.w #14,d0
moveq #0,d1
CALL AllocMem,sysbase(a4)
move.l (sp)+,d1
tst.l d0
beq prend
move.l d0,a0
move.w d1,12(a0)
cmp.w maxllength(a4),d1
ble.s 7$
move.w d1,maxllength(a4)
7$ move.l node(a4),8(a0)
clr.l node(a4)
clr.l 0(a0)
move.l lastprinted(a4),d0
move.l d0,4(a0)
bne.s 3$
move.l a0,outchain(a4)
bra.s 4$
3$ move.l d0,a1
move.l a0,0(a1)
4$ move.l a0,lastprinted(a4)
lea out(a4),a1
lea 14(a0),a0
move.b #' ',(a0)+
subq.w #2,d1
bmi.s 6$
5$ move.b (a1)+,(a0)+
dbra d1,5$
6$ move.l numlines(a4),d2
cmp.l maxlines(a4),d2
ble.s 8$
move.l outchain(a4),a1 ; maxlines reached !
move.l 0(a1),a0
move.l a0,outchain(a4)
clr.l 4(a0)
moveq #14,d0
add.w 12(a1),d0
CALL FreeMem,sysbase(a4)
bra.s 9$
8$ addq.l #1,numlines(a4)
9$ moveq #0,d0
tst.b addlines(a4)
beq.s 10$
bsr addline
10$ bra pst1
prend move.l d0,ptr(a4)
movem.l (sp)+,d1-d7/a0-a6
rts
putblank moveq #' ',d0 ; store one blank
;write one char
; -> d0 = char
putchar movem.l d1/a1,-(sp)
move.l ptr(a4),d1
lea out(a4),a1
move.b d0,0(a1,d1.w)
addq.l #1,ptr(a4)
movem.l (sp)+,d1/a1
rts
;move cursor to a column
; -> d0 = current position
; d1 = column
tab move.l a3,-(sp)
lea out(a4),a3
1$ cmp.b d1,d0
bcc.s 2$
move.b #' ',0(a3,d0.w)
addq.b #1,d0
bra.s 1$
2$ move.l d1,ptr(a4)
move.l (sp)+,a3
rts
; Xoper main loop, process all incoming messages
processmsgs moveq #0,d0
move.w cxsig(a4),d1
beq.s 3$
bset d1,d0
3$ move.w nspubsig+6(a4),d1
bset d1,d0
move.w intuisig(a4),d1
bset d1,d0
move.w timersig(a4),d1
bset d1,d0
or.w #4096,d0
or.l mysignal(a4),d0
or.l auxsig(a4),d0
tst.l auxsig(a4)
bne.s 2$
or.l trapsignal(a4),d0
2$ CALL Wait,sysbase(a4)
move.l d0,tasksigs(a4)
move.l trapsignal(a4),d1
and.l d0,d1
beq.s 1$
tst.b gotguru(a4)
bne.s 1$
st gotguru(a4)
bsr showguru
clr.b gotguru(a4)
1$ bsr ChkBroker ; check broker port
ctrl_c moveq #12,d1
bsr testsig
beq.s pubscreen
bsr exitall ; exit requested (break)
pubscreen move.w nspubsig+6(a4),d1
bsr testsig
beq.s hotkey
tst.b wantexit(a4)
beq.s 2$
bsr exitall ; exit requested
2$ tst.b wanthold(a4)
bne instback ; hold requested
tst.b wantwindow(a4)
beq.s 1$
bsr usewindow ; window requested
bra.s hotkey
1$ bsr setupscreen ; rebuild screen
hotkey moveq #mysigbit,d1
bsr testsig
beq.s timermsg
move.l intuibase(a4),a6 ; Screen & window to front
move.l wnptr(a4),a2
tst.b ownscreen(a4)
bne.s 1$ ; for scr window only activate !
move.l a2,a0
RECALL WindowToFront
1$ move.l a2,a0
RECALL ActivateWindow
move.l 46(a2),a0 ; Window->Screen frontmost ?
cmp.l 60(a6),a0
beq.s timermsg ; yes, so skip !
RECALL ScreenToFront
timermsg move.w timersig(a4),d1
bsr testsig
beq.s intuimsgs
btst.w #8,propinfo(a4)
bne.s 3$
tst.b repeat(a4)
bne.s 1$
bsr showwhat
bra.s intuimsgs
1$ move.w repeatlen(a4),d0
lea repeatbuffer(a4),a2
lea dummy(a4),a1
move.w d0,d1
2$ move.b (a2)+,(a1)+
dbra d1,2$
bsr cli
3$ bsr starttimer
intuimsgs move.w intuisig(a4),d1
bsr testsig
beq processnxtmsg
nextimsg move.l wnptr(a4),a0
move.l $56(a0),a0
CALL GetMsg,sysbase(a4)
move.l d0,intuimsg(a4)
beq processnxtmsg
move.l d0,a0
move.l 20(a0),d0
cmp.l #$200,d0 ; CloseWindow
bne.s 1$
tst.b addlines(a4)
beq instback ; iconify !
st cbreak(a4)
bra intuiend
1$ cmp.l #2,d0 ; ResizeWindow
bne.s 1010$
tst.b post_V34(a4)
beq.s 3443$
move.l wnptr(a4),a0
move.l minwsize(a4),d0
cmp.w 10(a0),d0
bne.s 3443$
swap d0
cmp.w 8(a0),d0
bne.s 3443$
bsr replyintui ; window was 'zipped'
bsr stoptimer
bra instback
3443$ bsr setupscreen
bra intuiend
1010$ cmp.l #$10,d0
bne.s 2$
btst.w #8,propinfo(a4)
bne.s 1004$
bra.s 1002$
2$ cmp.l #4,d0 ; refresh
bne.s 22$
bsr putiline
bsr blastout
bsr UpdateIArea
bra.s 1002$
22$ tst.b addlines(a4)
bne.s 3$
cmp.l #$20,d0 ; gadgetdown
bne.s 1000$
tst.b getanswer(a4)
bne.s 3$
move.l 28(a0),a1
cmp.w #3,38(a1) ; Slidebar
bne.s 1002$
tst.b propgadon(a4)
beq.s 1002$
1004$ bsr proppos
1002$ bra intuiend
1000$ cmp.l #$40,d0 ; gadgetup
bne.s 3$
move.l 28(a0),a1
cmp.w #3,38(a1) ; Slidebar ?
bne.s 1003$
bclr.w #8,propinfo(a4) ; clear 'knop hit' bit
bra.s 1002$
1003$ bsr replyintui ; iconify
bsr stoptimer
bra instback
3$ cmp.l #$400,d0 ; RawKey
bne intuiend
move.w #$80,d0
and.w 24(a0),d0
bne intuiend
and.w #$7f,24(a0)
lea ievent(a4),a1
move.b #1,4(a1)
move.l 24(a0),6(a1)
move.w 26(a0),qualifier(a4)
move.l a1,a0
lea outevent(a4),a1
moveq #20,d1
suba.l a2,a2
CALL RawKeyConvert,condev(a4)
tst.l d0
beq intuiend
lea inputbuffer(a4),a1
lea outevent(a4),a2
move.w curpos(a4),d4
moveq #0,d3
tst.b addlines(a4)
bne 197$
cmp.b #$9b,0(a2) ; SI code
bne 110$
cmp.b #'?',1(a2) ; help
bne.s 399$
tst.b getanswer(a4)
bne.s 399$
bsr stoptimer
tst.w bottomin(a4)
bne.s 398$
addq.w #1,bottomin(a4)
bsr getcurpos
clr.w ibufferlen(a4)
clr.w curpos(a4)
bsr UpdateIArea
398$ move.w #usetxt,d0
bsr putnamw
clr.l lastprinted(a4)
bsr blastout
bra.s 420$
399$ cmp.b #'C',1(a2) ; cursor right
bne.s 400$
cmp.w ibufferlen(a4),d4
bge.s 420$
addq.w #1,d4
421$ move.w d4,curpos(a4)
420$ bra 100$
400$ cmp.b #'D',1(a2) ; cursor left
bne.s 401$
subq.w #1,d4
bpl.s 421$
bra.s 420$
401$ cmp.b #' ',1(a2)
bne.s 402$
cmp.b #'@',2(a2) ; shift right
bne.s 403$
404$ cmp.w ibufferlen(a4),d4
bge.s 421$
addq.w #1,d4
cmp.b #' ',0(a1,d4.w)
bne.s 404$
405$ cmp.w ibufferlen(a4),d4
bge.s 421$
addq.w #1,d4
cmp.b #' ',0(a1,d4.w)
beq.s 405$
bra.s 421$
403$ cmp.b #'A',2(a2) ; shift left
bne.s 420$
406$ tst.w d4
beq.s 421$
subq.w #1,d4
cmp.b #' ',0(a1,d4.w)
beq.s 406$
407$ tst.w d4
beq.s 421$
subq.w #1,d4
cmp.b #' ',0(a1,d4.w)
bne.s 407$
addq.w #1,d4
bra.s 421$
402$ cmp.b #'A',1(a2) ; cursor up
bne.s 408$
tst.w bottomin(a4)
bne.s 480$
tst.w curpos(a4)
bne.s 480$
clr.w curpos(a4)
clr.w ibufferlen(a4)
bsr UpdateIArea
bsr clrcursor
move.w edline(a4),d3
ext.l d3
tst.w d3
beq.s 481$
subq.l #1,d3
cmp.l firstline(a4),d3
bge.s 481$
move.l d3,-(sp)
subq.l #1,firstline(a4)
bsr blastout
move.l (sp)+,d3
481$ move.w d3,edline(a4)
bsr getcurpos
bsr putcursor
bra intuiend
480$ move.l history(a4),a0
tst.l 0(a0)
beq.s 423$
move.l curhist(a4),a1
cmp.l a0,a1
beq.s 409$
move.l 4(a1),d0
move.l d0,curhist(a4)
409$ move.l a1,gothline(a4)
bsr copyhistory
423$ bra 100$
408$ cmp.b #'B',1(a2) ; cursor down
bne 410$
tst.w bottomin(a4)
bne.s 414$
tst.w curpos(a4)
bne.s 414$
clr.w curpos(a4)
clr.w ibufferlen(a4)
bsr UpdateIArea
bsr clrcursor
move.w edline(a4),d3
ext.l d3
move.l numlines(a4),d4
subq.l #1,d4
cmp.l d4,d3
beq.s 490$
move.l firstline(a4),d2
add.w rows(a4),d2
subq.w #1,d2
addq.w #1,d3
cmp.w d2,d3
ble.s 490$
move.l d3,-(sp)
addq.l #1,firstline(a4)
bsr blastout
move.l (sp)+,d3
490$ bra 481$
414$ move.l curhist(a4),d0
beq.s 423$
move.l d0,a1
move.l 0(a1),a1
tst.l 0(a1)
bne.s 411$
clr.l gothline(a4)
clr.w curpos(a4)
clr.w ibufferlen(a4)
bra 423$
411$ move.l a1,curhist(a4)
bra 409$
410$ cmp.b #'T',1(a2) ; shift up
bne.s 412$
tst.w hnum(a4)
beq 423$
move.l history(a4),a1
move.l a1,curhist(a4)
bra 409$
412$ cmp.b #'S',1(a2) ; shift down
bne.s 440$
tst.w hnum(a4)
beq 423$
move.l history+8(a4),curhist(a4)
bra.s 414$
440$ cmp.b #'0',1(a2) ; function keys
bmi 423$
cmp.b #'9',1(a2)
bgt 423$
lea 1(a2),a0
bsr getnum
lea fkeys(a4),a0
441$ move.l 0(a0),a0
tst.l 0(a0)
beq 100$
cmp.b 8(a0),d2
bne.s 441$
moveq #0,d3
move.w curpos(a4),d4
move.b 9(a0),d5
ext.w d5
subq.w #1,d5
lea 10(a0),a0
lea inputbuffer(a4),a2
lea 0(a2,d4.w),a2
445$ move.b (a0)+,d0
cmp.b #'^',d0
bne.s 442$
moveq #1,d3
bra.s 443$
442$ cmp.b #'_',d0
bne.s 444$
move.b #' ',d0
444$ move.b d0,(a2)+
addq.w #1,d4
443$ dbra d5,445$
move.w d4,curpos(a4)
cmp.w ibufferlen(a4),d4
ble.s 446$
move.w d4,ibufferlen(a4)
446$ tst.w d3
beq 100$
bra got_fkey
110$ moveq #0,d3
101$ move.w curpos(a4),d4
tst.w d0
beq 100$
cmp.b #13,0(a2,d3.w) ; return
beq got_enter
cmp.b #27,0(a2,d3.w) ; esc
bne 799$
tst.b getanswer(a4)
bne 100$
clr.b insmode(a4)
clr.w ibufferlen(a4)
move.w #200,curpos(a4)
bsr UpdateIArea
clr.w curpos(a4)
tst.w bottomin(a4)
bne.s 700$
addq.w #1,bottomin(a4)
bsr getcurpos
cmp.b #5,timerstate(a4)
bne.s 765$
bsr starttimer
765$ bra 100$
700$ move.b timerio+8(a4),timerstate(a4)
bsr stoptimer
moveq #0,d0
move.w edline(a4),d0
move.l firstline(a4),d4
cmp.w d4,d0
bmi.s 701$
move.w d4,d5
add.w rows(a4),d5
cmp.w d5,d0
bmi.s 702$
701$ move.w rows(a4),d0
lsr.w #1,d0
add.w d4,d0
702$ move.l numlines(a4),d3
subq.w #1,d3
cmp.w d3,d0
ble.s 703$
move.w d3,d0
703$ move.w d0,edline(a4)
sub.w d4,d0
mulu txheight(a4),d0
add.w firstpos(a4),d0 ; BarHeight+FontHeight !
move.w d0,cposy(a4)
clr.w bottomin(a4)
tst.w loffset(a4)
beq.s 704$
clr.w loffset(a4)
bsr blastout
704$ bra 100$
799$ cmp.b #8,0(a2,d3.w) ; Backspace
bne.s 114$
tst.w d4
beq.s 179$
bsr delchar
subq.w #1,d4
move.w d4,curpos(a4)
bra.s 179$
114$ cmp.b #127,0(a2,d3.w) ; Del
bne.s 150$
178$ cmp.w ibufferlen(a4),d4
bge.s 179$
addq.w #1,d4
bsr delchar
179$ bra 102$
150$ cmp.b #9,0(a2,d3.w) ; Tab
bne 197$
move.w oldpos(a4),d1
lea inputbuffer(a4),a2
move.b newtab(a4),oldtab(a4)
beq.s 152$ ; previous tab
clr.b newtab(a4)
move.w cmdcomplen(a4),d0
add.w d1,d0
lea 0(a2,d0.w),a0
move.w cmdcplen(a4),d0
lea 0(a0,d0.w),a1
151$ move.b (a1)+,(a0)+ ; restore old cmdline
bne.s 151$
sub.w d0,ibufferlen(a4)
tst.w curpos(a4)
beq.s 155$
move.w ibufferlen(a4),curpos(a4)
bra.s 155$ ; search next cmd
152$ move.w ibufferlen(a4),d0
move.l a2,a0
bsr tolower ; ibuffer to lower case
move.w curpos(a4),d0
move.w d0,d1
beq.s 1532$
153$ cmp.b #' ',-1(a2,d1.w) ; search down
beq.s 1531$
subq.w #1,d1
bne.s 153$
1531$ move.w d1,d0
1532$ cmp.b #' ',0(a2,d0.w) ; search up
beq.s 154$
addq.w #1,d0
cmp.w ibufferlen(a4),d0
bcs.s 1532$
154$ sub.w d1,d0
move.w d0,cmdcomplen(a4) ; chars to cmp
move.w d1,oldpos(a4) ; cmp pos (for next tab)
clr.w cmdcompnr(a4)
155$ lea 0(a2,d1.w),a2
156$ tst.b newtab(a4)
bne.s 169$ ; found a cmd
move.w cmdcompnr(a4),d0
bsr getcmdptr
move.l d0,a0
move.l a2,a1
move.w cmdcomplen(a4),d1
subq.w #1,d1
157$ move.b (a0)+,d0 ; comp cmd <-> ibuffer
beq.s 163$
cmp.b (a1)+,d0
bne.s 163$
dbra d1,157$
moveq #-1,d0
158$ addq.w #1,d0
tst.b 0(a0,d0.w)
bne.s 158$
tst.w d0
beq.s 162$ ; nothing to copy !
move.l a1,a2
159$ tst.b (a2)+
bne.s 159$
160$ move.b -(a2),0(a2,d0.w)
cmp.l a2,a1
bcs.s 160$
move.w d0,-(sp)
161$ move.b -1(a0,d0.w),-1(a1,d0.w)
subq.w #1,d0
bne.s 161$
move.w (sp)+,d0
tst.w curpos(a4)
beq.s 162$ ; was zero
add.w d0,curpos(a4)
162$ add.w d0,ibufferlen(a4)
move.w ibufferlen(a4),oldibuflen(a4)
move.w d0,cmdcplen(a4)
st newtab(a4)
163$ addq.w #1,cmdcompnr(a4) ; next cmd
moveq #cmdnum-1,d0
sub.w cmdcompnr(a4),d0
bcc.s 156$ ; not ready
clr.w cmdcompnr(a4)
tst.b oldtab(a4)
bne.s 156$ ; prev tab
169$ bra 100$ ; end it
197$ cmp.b #3,0(a2,d3.w) ; ctrl c
bne.s 104$
st cbreak(a4)
104$ tst.b addlines(a4)
bne processnxtmsg
cmp.b #$18,0(a2,d3.w) ; ctrl x
bne.s 300$
clr.w ibufferlen(a4)
clr.w curpos(a4)
bra.s 169$
300$ cmp.b #$19,0(a2,d3.w) ; ctrl y
bne.s 106$
move.w curpos(a4),ibufferlen(a4)
bra.s 169$
106$ move.w #$100,d5 ; NumPad
and.w qualifier(a4),d5
beq 105$
move.l firstline(a4),d5
cmp.b #'7',0(a2,d3.w) ; 'Home'
bne.s 200$
moveq #0,d5
199$ cmp.l firstline(a4),d5
beq.s 196$
move.l d5,firstline(a4)
bsr blastout
tst.w bottomin(a4)
bne.s 196$
move.w edline(a4),d0
move.l firstline(a4),d1
cmp.w d1,d0
bmi.s 190$
add.w rows(a4),d1
cmp.w d1,d0
bmi.s 192$
190$ clr.w curpos(a4)
clr.w ibufferlen(a4)
move.w rows(a4),d0
lsr.w #1,d0
ext.l d0
add.l firstline(a4),d0
cmp.l numlines(a4),d0
bmi.s 191$
move.l numlines(a4),d0
subq.w #1,d0
191$ move.w d0,edline(a4)
192$ bsr getcurpos
bsr UpdateIArea
196$ bra 100$
200$ cmp.b #'8',0(a2,d3.w) ; 'up arrow'
bne.s 201$
tst.w d5
beq 100$
subq.w #1,d5
1990$ bra.s 199$
201$ cmp.b #'9',0(a2,d3.w) ; 'PgUp'
bne.s 203$
sub.w rows(a4),d5
bpl.s 1990$
moveq #0,d5
bra.s 1990$
203$ cmp.b #'1',0(a2,d3.w) ; 'End'
bne.s 205$
222$ move.l numlines(a4),d5
sub.w rows(a4),d5
bpl 199$
moveq #0,d5
204$ bra 199$
205$ cmp.b #'2',0(a2,d3.w) ; 'down arrow'
bne.s 206$
move.l d5,d2
add.w rows(a4),d2
cmp.l numlines(a4),d2
bge 100$
addq.w #1,d5
bra 199$
206$ cmp.b #'3',0(a2,d3.w) ; 'PgDn'
bne.s 500$
add.w rows(a4),d5
move.l d5,d2
add.w rows(a4),d2
cmp.l numlines(a4),d2
bge.s 222$
bra 199$
500$ cmp.b #'4',0(a2,d3.w) ; left arrow
bne.s 501$
tst.w bottomin(a4)
beq 102$
move.w loffset(a4),d2
sub.w colms(a4),d2
bpl.s 502$
moveq #0,d2
502$ move.w d2,loffset(a4)
bsr blastout
bra 100$
501$ cmp.b #'6',0(a2,d3.w) ; right arrow
bne.s 170$
tst.w bottomin(a4)
beq.s 102$
move.w loffset(a4),d2
add.w colms(a4),d2
bra.s 502$
170$ cmp.b #'0',0(a2,d3.w) ; Ins
bne.s 177$
not.b insmode(a4)
bra.s 102$
177$ cmp.b #'.',0(a2,d3.w) ; Del
beq 178$
105$ tst.w bottomin(a4)
bne.s 777$
tst.w curpos(a4)
bne.s 777$
movem.l d0/d1,-(sp)
move.w edline(a4),d0
bsr findline
movem.l (sp)+,d0/d1
tst.l 8(a5)
beq intuiend
777$ move.w curpos(a4),d5
ext.l d5
moveq #79,d2
cmp.w d2,d5
bge.s 102$
tst.b insmode(a4)
beq.s 172$
cmp.w ibufferlen(a4),d5
bmi.s 171$
bra.s 173$
172$ sub.w d5,d2
lea 80(a1),a5
lea 79(a1),a3
103$ move.b -(a3),-(a5)
dbra d2,103$
173$ addq.w #1,ibufferlen(a4)
171$ move.b 0(a2,d3),0(a1,d5)
addq.w #1,curpos(a4)
102$ subq.w #1,d0
addq.w #1,d3
bra 101$
100$ bsr UpdateIArea
bra intuiend
got_enter bsr puthist
got_fkey bsr stoptimer
clr.b insmode(a4)
lea dummy(a4),a1
lea inputbuffer(a4),a2
move.w ibufferlen(a4),d2
beq.s 2$
tst.w bottomin(a4)
bne.s 5$
movem.l a1/a2,-(sp)
move.w edline(a4),d0
bsr findline
move.l 8(a5),d0
bsr gthex
lea hexarea(a4),a0
lea 0(a2,d2.w),a1
move.b #' ',(a1)+
move.b #'$',(a1)+
moveq #8,d0
CALL CopyMem,sysbase(a4)
moveq #10,d2
add.w ibufferlen(a4),d2
move.w d2,ibufferlen(a4)
movem.l (sp)+,a1/a2
5$ subq.w #1,d2
1$ move.b (a2)+,(a1)+
dbra d2,1$
2$ move.b #10,(a1)+
move.w ibufferlen(a4),d0
addq.w #1,d0
move.w d0,-(sp)
clr.w ibufferlen(a4)
tst.w bottomin(a4)
bne.s 4$
move.w #100,curpos(a4)
bsr UpdateIArea
4$ clr.w curpos(a4)
move.w #1,bottomin(a4)
bsr getcurpos
bsr UpdateIArea
move.w (sp)+,d0 ; needed for cli
move.w d0,repeatlen(a4)
clr.b repeat(a4)
clr.b printed(a4)
tst.b getanswer(a4)
bne.s rintui
6$ bsr cli
tst.b printed(a4)
bne.s intuiend
bsr starttimer
intuiend bsr.s replyintui
move.w ibufferlen(a4),d0
cmp.w oldibuflen(a4),d0
beq.s 1$ ; nothing changed
clr.b newtab(a4)
1$ bra nextimsg
processnxtmsg tst.b addlines(a4)
bne.s rintui
tst.b propupdate(a4)
beq.s 1$
clr.b propupdate(a4)
tst.b propgadon(a4)
beq.s 1$
bsr.s setprop
1$ bra processmsgs
replyintui move.l intuimsg(a4),d0
beq.s rintui
move.l d0,a1
CALL ReplyMsg,sysbase(a4)
clr.l intuimsg(a4)
rintui rts
; propgadget code
setprop btst.w #8,propinfo(a4) ; update slider position
bne.s 8$ ; and size
moveq #0,d0
CALL LockIBase,intuibase(a4)
move.l d0,-(sp)
moveq #0,d5
move.l wnptr(a4),a0 ; see if the user hit the
; scrollbar in the meantime
move.l 86(a0),a0 ; wn->UserPort
lea 20(a0),a0 ; Userport->MsgList
5$ move.l 0(a0),d0
beq.s 6$ ; no more pending messages
move.l d0,a0
cmp.l #$20,20(a0) ; gadgetdown ?
bne.s 5$
move.l 28(a0),a1
cmp.w #3,38(a1) ; scrollbar ?
bne.s 5$
moveq #1,d5
bra.s 5$
6$ move.l (sp)+,a0
CALL UnlockIBase,intuibase(a4)
tst.w d5
beq.s 7$
8$ rts
7$ moveq #0,d2 ; VertPot = firstline*MAXPOT/(numlines-rows)
move.l numlines(a4),d3
sub.w rows(a4),d3
ble.s 1$
move.l firstline(a4),d2
mulu #65535,d2
divu d3,d2
1$ moveq #-1,d4 ; VertBody = rows*MAXBODY/numlines
move.w rows(a4),d5
ext.l d5
cmp.l numlines(a4),d5
bge.s 2$
mulu #$ffff,d5
move.l numlines(a4),d0
divu d0,d5
move.l d5,d4
2$ cmp.w propinfo+8(a4),d4 ; did something change ?
bne.s 3$
cmp.w propinfo+4(a4),d2
beq.s 4$
3$ moveq #1|4,d0
moveq #0,d1
moveq #-1,d3
moveq #1,d5
lea sbgadget(a4),a0
move.l wnptr(a4),a1
suba.l a2,a2
CALL NewModifyProp,intuibase(a4)
4$ rts
proppos move.w propinfo+4(a4),d0 ; get slider position and
move.l numlines(a4),d1 ; update window if necessary
sub.w rows(a4),d1
ble.s 1$
move.l #$ffff,d3 ; firstline=VertPot/(MAXPOT/numlines-rows)
divu d1,d3
divu d3,d0
ext.l d0
cmp.l firstline(a4),d0
beq.s 1$
move.l d0,firstline(a4)
bsr blastout ; update screem
1$ rts
;put an input line into the history buffer
puthist move.w ibufferlen(a4),d5
move.l d5,d0
cmp.w minnumchars(a4),d0
bcs.s 1$
move.l gothline(a4),d1
beq.s 5$
move.l d1,a2
cmp.w 8(a2),d5
bne.s 5$
lea 10(a2),a2
lea inputbuffer(a4),a1
subq.w #1,d0
6$ cmp.b (a2)+,(a1)+
bne.s 5$
dbra d0,6$
move.l gothline(a4),curhist(a4)
bra.s 1$
5$ moveq #10,d0
add.w d5,d0
ext.l d0
moveq #1,d1
swap d1 ; MEMF_CLEAR
CALL AllocMem,sysbase(a4)
move.l d0,a0
move.l a0,d0
beq.s 1$
move.w d5,8(a0)
lea 10(a0),a2
subq.w #1,d5
lea inputbuffer(a4),a1
2$ move.b (a1)+,(a2)+
dbra d5,2$
move.w hnum(a4),d5
cmp.w maxhlines(a4),d5
bmi.s 3$
bsr remhistline
bra.s 4$
3$ addq.w #1,d5
move.w d5,hnum(a4)
4$ move.l d0,a1
move.l d0,curhist(a4)
lea history(a4),a0
CALL AddTail,sysbase(a4)
1$ clr.l gothline(a4)
rts
;copy a history line into the input buffer
copyhistory lea inputbuffer(a4),a0
move.w 8(a1),d3
ext.l d3
move.w d3,curpos(a4)
move.w d3,ibufferlen(a4)
subq.w #1,d3
lea 10(a1),a1
1$ move.b (a1)+,(a0)+
dbra d3,1$
rts
;remove one line from the history buffer
;pointer to the line in A1, returns pointer to the next line in d1
remhistline move.l d0,-(sp)
lea history(a4),a0
move.l 0(a0),a5
tst.l 0(a5)
beq.s 1$
CALL RemHead,sysbase(a4)
move.l a5,a1
moveq #10,d0
add.w 8(a1),d0
ext.l d0
RECALL FreeMem
1$ move.l (sp)+,d0
rts
;kill all history lines
killhistory bsr remhistline
move.l history(a4),a0
tst.l 0(a0)
bne.s killhistory
2$ clr.w hnum(a4)
clr.l curhist(a4)
rts
;delete one char from the input line
delchar lea inputbuffer(a4),a3
lea 0(a3,d4.w),a3
lea -1(a3),a5
move.w d4,d5
1$ cmp.w #78,d5
bge.s 2$
move.b (a3)+,(a5)+
addq.w #1,d5
bra.s 1$
2$ subq.w #1,ibufferlen(a4)
rts
testsig move.l tasksigs(a4),d0
btst d1,d0
rts
;Update the current position of the input line
getcurpos moveq #0,d3
move.w ipos(a4),d3
tst.w bottomin(a4)
bne.s 1$
move.w edline(a4),d3
sub.l firstline(a4),d3
mulu txheight(a4),d3
add.w firstpos(a4),d3 ; BarHeight+FontHeight !
1$ move.w d3,cposy(a4)
rts
;rebuild the window from scratch
setupscreen move.l rastport(a4),a1
moveq #0,d0
CALL SetRast,gfxbase(a4)
move.l intuibase(a4),a6
moveq #1,d0
bsr setnewprop ; does a RefreshWindowFrame()
bsr getwindowsize
tst.w bottomin(a4)
bne.s 1$
move.w edline(a4),d0
move.l firstline(a4),d1
move.w rows(a4),d2
move.w d2,d4
move.w numlines(a4),d3
add.w d1,d2
cmp.w d2,d0
bmi.s 2$
lsr.w #1,d4
sub.w d4,d0
ext.l d0
move.l d0,firstline(a4)
2$ bsr tstfirstlin
1$ bsr.s getcurpos
bsr putiline
bsr blastout
bsr.s UpdateIArea
move.w rows(a4),currenty(a4)
rts
;refresh the input area
UpdateIArea movem.l a2/a6,-(sp) ; to change !
move.l rastport(a4),a2
move.l gfxbase(a4),a6
moveq #1,d0
move.l a2,a1
RECALL SetDrMd
moveq #2,d0
add.b bleft(a4),d0
move.w cposy(a4),d1
move.l a2,a1
RECALL Move
lea inputbuffer(a4),a0
move.w ibufferlen(a4),d0
ext.l d0
move.w colms(a4),d1
sub.w bottomin(a4),d1
cmp.w d1,d0
bmi.s 1$
move.w d1,d0
1$ move.w d0,d2
move.l a2,a1
RECALL Text
tst.w bottomin(a4)
bne.s 3$
move.w edline(a4),d0
bsr findline
move.w 12(a5),d3
sub.w d2,d3
bmi.s 3$
move.w colms(a4),d1
sub.w d2,d1
bmi.s 2$
cmp.w d1,d3
ble.s 4$
move.w d1,d3
4$ move.w d3,d0
lea 14(a5,d2.w),a0
move.l a2,a1
RECALL Text
add.w ibufferlen(a4),d3
move.w d3,d2
3$ move.w colms(a4),d0
sub.w bottomin(a4),d0
move.l blanks(a4),a0
ext.l d0
sub.w d2,d0
bmi.s 2$
lea 0(a0,d2.w),a0
move.l a2,a1
RECALL Text
2$ bsr.s putcursor
movem.l (sp)+,a2/a6
rts
clrcursor moveq #1,d7
bra.s ptc1
putcursor moveq #6,d7
ptc1 move.w curpos(a4),d0
move.w colms(a4),d1
subq.w #1,d1
sub.w bottomin(a4),d1
cmp.w d0,d1
bmi.s 1$
move.l d7,d0
move.l rastport(a4),a1
CALL SetDrMd,gfxbase(a4)
moveq #0,d0
move.w curpos(a4),d0
mulu txwidth(a4),d0
moveq #2,d1
add.b bleft(a4),d1
add.w d1,d0
move.w cposy(a4),d1
move.l rastport(a4),a1
RECALL Move
moveq #1,d0
lea oneblank(a4),a0
move.l rastport(a4),a1
RECALL Text
1$ rts
putiline movem.l d2/d3/a2,-(sp)
move.l rastport(a4),a2
move.l wnptr(a4),a5
move.l gfxbase(a4),a6
move.w 10(a5),d2
move.w txheight(a4),d0
sub.w d0,d2
lsr.w #1,d0
sub.w d0,d2 ; -FontHeight*1.5
moveq #0,d0
move.b 57(a5),d0
sub.w d0,d2
moveq #1,d0
move.l a2,a1
RECALL SetDrMd
moveq #1,d0
moveq #0,d3 ; counter
tst.b ownscreen(a4)
bne.s 2$
tst.b post_V34(a4)
beq.s 2$
moveq #1,d3 ; counter
2$ move.l a2,a1
RECALL SetAPen
moveq #0,d0
add.b 54(a5),d0
move.w d2,d1
move.l a2,a1
RECALL Move
move.w 8(a5),d0
tst.b post_V34(a4)
beq.s 1$ ; to the end
moveq #0,d1
move.b 56(a5),d1
sub.w d1,d0
1$ move.w d2,d1
move.l a2,a1
RECALL Draw
subq.w #1,d2
moveq #2,d0
dbra d3,2$
movem.l (sp)+,d2/d3/a2
rts
readline moveq #'n',d0
tst.l infile(a4)
bne.s 1$
move.l #31000,firstline(a4)
bsr blastout
st getanswer(a4)
bsr replyintui
5$ bsr processmsgs
move.w d0,d5
bsr replyintui
subq.w #1,d5
beq.s 5$
clr.b getanswer(a4)
bsr.s RestoreOutput
moveq #$20,d0
or.b inputbuffer(a4),d0 ; lower case
1$ rts
ResumeOutput move.l outchain(a4),d0
move.l d0,a1
beq.s 2$
move.l numlines(a4),oldnumlines(a4)
move.l firstline(a4),oldfirstline(a4)
4$ tst.l 0(a1)
beq.s 3$
move.l 0(a1),a1
bra.s 4$
3$ move.l a1,lastprinted(a4)
2$ move.l a1,oldpageend(a4)
rts
RestoreOutput move.l oldpageend(a4),d3
beq.s 1$
move.l oldnumlines(a4),numlines(a4)
move.l oldfirstline(a4),firstline(a4)
move.l oldlastprinted(a4),lastprinted(a4)
move.l d3,a1
move.l 0(a1),a1
bsr killlines
move.l d3,a1
clr.l 0(a1)
bsr.s blastout
1$ rts
;kill the remainder of the output buffer
killlines move.l (a1),-(sp)
moveq #14,d0
add.w 12(a1),d0
CALL FreeMem,sysbase(a4)
move.l (sp)+,d1
move.l d1,a1
bne.s killlines
rts
;Kill output buffer
killpage movem.l d0-d7/a0-a6,-(sp)
tst.l outchain(a4)
beq.s 2$
move.l outchain(a4),a1
bsr.s killlines
clr.l outchain(a4)
clr.l lastprinted(a4)
clr.l numlines(a4)
clr.w maxllength(a4)
2$ movem.l (sp)+,d0-d7/a0-a6
rts
;write a portion of the output buffer to the screen
blastout move.l rastport(a4),a1
moveq #1,d0
CALL SetAPen,gfxbase(a4)
move.l rastport(a4),a1
moveq #1,d0
CALL SetDrMd,gfxbase(a4)
moveq #0,d7
move.w loffset(a4),d2
beq.s 7$
move.w colms(a4),d4
add.w d4,d2
move.w maxllength(a4),d3
cmp.w d3,d2
ble.s 7$
move.w d3,d2
sub.w d4,d2
bpl.s 8$
moveq #0,d2
8$ move.w d2,loffset(a4)
7$ bsr.s tstfirstlin
1$ tst.l outchain(a4)
beq.s 3$
bsr.s findline
2$ move.w colms(a4),d5
ext.l d5
move.w loffset(a4),d4
ext.l d4
move.w firstpos(a4),d6 ; BarHeight+FontHeight !
6$ lea 14(a5,d4.w),a0
move.w 12(a5),d3
ext.l d3
bsr.s blastline
blt.s 9$
move.w rows(a4),currenty(a4)
bra.s 5$
9$ tst.l 0(a5)
beq.s 5$
move.l 0(a5),a5
bra.s 6$
5$ cmp.w rows(a4),d7
bcc.s 3$
10$ moveq #0,d3
bsr.s blastline
bcs.s 10$
3$ st propupdate(a4)
rts
;get a pointer to a line (line # in d0)
findline move.l outchain(a4),d1
beq.s 2$
move.l d1,a5
1$ tst.w d0
beq.s 2$
tst.l 0(a5)
beq.s 2$
move.l 0(a5),a5
dbra d0,1$
2$ rts
;check if the display is as 'full' as possible
tstfirstlin move.l firstline(a4),d0
move.l d0,d2
add.w rows(a4),d2
cmp.l numlines(a4),d2
bmi.s 1$
move.l numlines(a4),d2
sub.w rows(a4),d2
bpl.s 4$
moveq #0,d2
4$ move.l d2,d0
move.l d2,firstline(a4)
1$ rts
;display one line, fill the gap between the end of the line and
;the end of the window with spaces.
;d6=ypos, d5=colms, d3=linelength, d7=line # in window, a0=text
blastline move.l gfxbase(a4),a6
moveq #2,d0
add.b bleft(a4),d0
move.w d6,d1
move.l rastport(a4),a1
RECALL Move
sub.w d4,d3
bpl.s 7$
moveq #0,d3
bra.s 6$
7$ cmp.w d5,d3
bmi.s 4$
move.w d5,d3
4$ move.l d3,d0
beq.s 6$
move.l rastport(a4),a1
RECALL Text
6$ move.l d5,d0
sub.l d3,d0
ble.s 5$
move.l blanks(a4),a0
move.l rastport(a4),a1
RECALL Text
5$ add.w txheight(a4),d6
addq.w #1,d7
cmp.w rows(a4),d7
rts
addline movem.l d0-d6/a0-a3,-(sp)
move.l gfxbase(a4),a6
move.l rastport(a4),a1
moveq #1,d0
RECALL SetAPen
move.l rastport(a4),a1
moveq #1,d0
RECALL SetDrMd
move.w currenty(a4),d6
cmp.w rows(a4),d6
bmi.s 1$
bsr.s cls
1$ moveq #0,d7
move.w currenty(a4),d7
move.l d7,d6
mulu txheight(a4),d6
add.w firstpos(a4),d6 ; BarHeight+FontHeight !
move.w colms(a4),d5
moveq #0,d4
move.l lastprinted(a4),a0
move.w 12(a0),d3
lea 14(a0),a0
bsr blastline
addq.w #1,currenty(a4)
move.l #31000,firstline(a4)
movem.l (sp)+,d0-d6/a0-a3
rts
cls movem.l d0-d6/a0-a3,-(sp)
move.l gfxbase(a4),a6
moveq #1,d0
move.l rastport(a4),a1
RECALL SetAPen
moveq #1,d0
move.l rastport(a4),a1
RECALL SetDrMd
move.w colms(a4),d5
moveq #0,d2
1$ move.w d5,d7
move.l d2,d6
mulu txheight(a4),d6
add.w firstpos(a4),d6 ; BarHeight+FontHeight !
moveq #0,d3
move.l blanks(a4),a0
bsr blastline
addq.w #1,d2
cmp.w rows(a4),d2
bcs.s 1$
clr.w currenty(a4)
movem.l (sp)+,d0-d6/a0-a3
rts
createscreen lea buffer(a4),a2
moveq #80,d0
moveq #1,d1
move.l a2,a0
sub.l a1,a1
RECALL GetScreenData
move.w 12(a2),nssize(a4) ; width
move.w 76(a2),nsviewmode(a4)
tst.b post_V34(a4)
beq.s 1$
suba.l a0,a0 ; examine default pubscreen
RECALL LockPubScreen
move.l d0,a2
move.l a2,d0
beq.s 1$
move.l a6,-(sp)
lea 44(a2),a0
CALL GetVPModeID,gfxbase(a4) ; for DisplayID !
move.l (sp)+,a6
move.l d0,nsdisplay+4(a4)
suba.l a0,a0
move.l a2,a1
RECALL UnlockPubScreen
1$ lea newscreen(a4),a0 ; Kick 2.0+ with ens_Extension
RECALL OpenScreen
move.l d0,screenptr(a4)
move.l d0,nwscreen(a4)
beq.s setupwindow
move.l d0,a0
clr.l newwindow(a4)
move.l 12(a0),newwindow+4(a4)
move.l wnscrflags(a4),nwflgs(a4)
move.l wnscrflags+4(a4),nwflgs+4(a4)
move.w #$f,nwtype(a4)
st ownscreen(a4)
tst.b post_V34(a4)
beq.s setupwindow
moveq #0,d0
RECALL PubScreenStatus ; make screen public
setupwindow tst.b ownscreen(a4)
bne.s 3$ ; don't setup wb window values
move.l window_l(a4),newwindow(a4)
move.l window_w(a4),newwindow+4(a4)
move.l wnnormflgs(a4),nwflgs(a4)
move.l wnnormflgs+4(a4),nwflgs+4(a4)
move.w #1,nwtype(a4)
3$ lea newwindow(a4),a0
RECALL OpenWindow ; Kick 2.0+ with enw_Extension
move.l d0,wnptr(a4)
beq stopall ; no window !!!
move.l d0,a0
move.l 50(a0),rastport(a4) ; wn->RPort
move.l 86(a0),a1 ; wn->UserPort
move.b 15(a1),d1 ; MsgPort->SigBit
ext.w d1
move.w d1,intuisig(a4)
tst.b ownscreen(a4)
bne.s 2$
tst.b iconifyon(a4)
beq.s 2$
tst.b post_V34(a4)
bne.s 2$
lea iconifgad(a4),a1 ; a0 - still wnptr !
moveq #0,d0
RECALL AddGadget
2$ bsr setwintitle
bsr.s setreqfont ; set requested font
moveq #0,d0
bsr.s setnewprop
move.l wnptr(a4),a0
move.l 46(a0),a0 ; our scr ptr
cmp.l 60(a6),a0 ; ib_FirstScreen
beq.s 1$ ; our screen is frontmost
RECALL ScreenToFront
1$ bsr getcurpos
bsr putiline
bsr UpdateIArea
bsr starttimer
bsr showwhat
rts
setnewprop tst.b propgadon(a4) ; resize propgadget !
beq.s 1$
move.l wnptr(a4),a0
lea sbgadget(a4),a1
tst.w d0
beq.s 2$
movem.l a0/a1,-(sp)
RECALL RemoveGadget ; remove gadget from window
movem.l (sp)+,a0/a1
2$ move.w txheight(a4),d0
move.w firstpos(a4),d1
sub.w d0,d1 ; barheight:=firstpos-txheight
addq.w #1,d1
move.w d1,6(a1) ; topedge
add.w d0,d1
lsr.w #1,d0
add.b 57(a0),d0
add.w d0,d1 ; +FontHeight*1.5
neg.w d1
move.w d1,10(a1) ; height
moveq #0,d0
RECALL AddGadget
1$ move.l wnptr(a4),a0
jmp _LVORefreshWindowFrame(a6)
setreqfont move.l a6,-(sp)
move.l gfxbase(a4),a6
move.l 154(a6),d0 ; GfxBase->DefaultFont
tst.b ownfont(a4)
beq.s 2$
move.l tfont(a4),d0
bne.s 2$ ; already one open !
lea tattr(a4),a0
RECALL OpenFont ; open topaz/8
move.l d0,tfont(a4)
beq.s 1$ ; no font ...
2$ move.l d0,a0
move.l rastport(a4),a1
RECALL SetFont
move.l wnptr(a4),a0
move.l 46(a0),a1 ; Window->Screen
move.b 30(a1),d1 ; Screen->BarHeight
ext.w d1
move.b 54(a0),bleft(a4)
move.l 50(a0),a1 ; Window->RastPort
move.w 58(a1),txheight(a4)
move.w 60(a1),txwidth(a4)
add.w txheight(a4),d1
move.w d1,firstpos(a4)
bsr.s getwindowsize
1$ move.l (sp)+,a6
rts
getwindowsize bsr.s freeblank
move.l wnptr(a4),a0
move.w 10(a0),d0
move.w txheight(a4),d1
lsr.w #1,d1 ; FontHeight*0.5
add.b 57(a0),d1
sub.w d1,d0
move.w d0,ipos(a4) ; input area position
moveq #0,d6
move.w 10(a0),d6
sub.w firstpos(a4),d6
sub.w txheight(a4),d6
divu txheight(a4),d6
move.w d6,rows(a4)
moveq #0,d6
move.w txwidth(a4),d6
move.w d6,d0
lsr.w #1,d0
add.w d0,d6
not.w d6 ; -FontWidth*1.5
add.w 8(a0),d6
moveq #0,d1
tst.b post_V34(a4) ; why ???
beq.s 4$
moveq #1,d1
4$ sub.w d1,d6
divu txwidth(a4),d6
tst.b propgadon(a4)
beq.s 3$
addq.w #1,d1
3$ sub.w d1,d6
move.w d6,colms(a4)
ext.l d6
move.l d6,d0
moveq #0,d1
CALL AllocMem,sysbase(a4)
move.l d0,blanks(a4)
move.l d0,a0
moveq #' ',d0
bra.s 1$
2$ move.b d0,(a0)+
1$ dbra d6,2$
rts
freeblank move.l blanks(a4),d0
beq.s 1$
move.l d0,a1
move.w colms(a4),d0
ext.l d0
CALL FreeMem,sysbase(a4)
clr.l blanks(a4)
1$ rts
setwintitle lea winkeybuf(a4),a3 ; show hotkey in window title
lea defhotkey(a4),a2
move.l broker(a4),d0
beq.s 2$ ; no commodity !
move.l d0,a0
moveq #0,d0
tst.b cxstate(a4)
beq.s 4$ ; commodity off
moveq #1,d0
lea hotkeybuf(a4),a2
4$ CALL ActivateCxObj,cxbase(a4)
3$ move.l (a2),d1
and.l #$dfdfdfdf,d1
cmp.l #'RAWK',d1
bne.s 2$ ; not rawkey as ieclass
addq.l #7,a2 ; skip ieclass (hopefully)
2$ move.l a2,-(sp)
pea windowname(a4)
move.l sp,a1
lea namefmt(a4),a0
lea sc_put(pc),a2
CALL RawDoFmt,sysbase(a4) ; fill buffer
addq.l #8,sp
move.l wnptr(a4),a0
move.l a3,a1
movea.w #-1,a2
tst.b ownscreen(a4)
beq.s 1$ ; don't change scr title
suba.l a1,a1
move.l a3,a2
1$ move.l intuibase(a4),a6
jmp _LVOSetWindowTitles(a6) ; leave with intuibase in a6 !
sc_put move.b d0,(a3)+ ; for RawDoFmt()
rts
usetopaz lea ownfont(a4),a2
bsr onoff
tst.l infile(a4)
bne.s usetopaz-2 ; hack !
usetopaz2 bsr setreqfont
bra setupscreen ; rebuild all
usescreen tst.b ownscreen(a4)
bne.s 1$
tst.l infile(a4)
bne.s 2$
moveq #0,d0
bsr.s CloseGUI ; close window
bra createscreen
2$ st ownscreen(a4)
1$ rts
usewindow tst.b ownscreen(a4)
beq.s 1$
tst.l infile(a4)
bne.s 2$
st wantwindow(a4)
moveq #0,d0
bsr.s CloseGUI ; close window & screen
beq.s 1$ ; pubscreen still used
clr.b wantwindow(a4)
2$ clr.b ownscreen(a4)
tst.l infile(a4)
bne.s 1$
bsr setupwindow ; open our window
1$ rts
CloseGUI move.l d0,d2
bsr replyintui ; answer msg
move.l intuibase(a4),a6
tst.b ownscreen(a4)
beq.s 5$
bsr.s SetPubStatus
beq.s 1$ ; pubscreen still used
5$ move.l wnptr(a4),d0
beq.s 3$
move.l d0,a0
tst.b ownscreen(a4)
bne.s 4$
move.l minwsize(a4),d0
cmp.w 10(a0),d0
bgt.s 4$
swap d0
cmp.w 8(a0),d0
beq.s 4$
move.l 4(a0),window_l(a4)
move.l 8(a0),window_w(a4)
4$ RECALL CloseWindow
clr.l wnptr(a4)
3$ move.l screenptr(a4),d0
beq.s 2$
move.l d0,a0
RECALL CloseScreen
clr.l screenptr(a4)
2$ tst.l d2
beq.s 6$ ; don't close font
move.l tfont(a4),d1
beq.s 6$ ; no own font opened !
move.l d1,a1
move.l a6,-(sp)
CALL CloseFont,gfxbase(a4)
move.l (sp)+,a6
clr.l tfont(a4)
6$ moveq #1,d0
1$ rts
SetPubStatus moveq #1,d0
tst.b post_V34(a4) ; no Kick 2.0+
beq.s 1$
move.l screenptr(a4),d1
beq.s 1$
move.l d1,a0 ; d0 - already one !!!
move.l intuibase(a4),a6
RECALL PubScreenStatus ; make screen private
tst.l d0
bne.s 1$
tst.b waitexit(a4)
beq.s 1$ ; don't wait
moveq #0,d0
move.w nspubsig+6(a4),d1
bset d1,d0
CALL Wait,sysbase(a4) ; wait until last win closed
bra.s SetPubStatus
1$ tst.l d0
rts
; support functions
CreatePort movem.l d2-d4/a2/a6,-(sp)
move.l d0,d2 ; port-pri
move.l a0,d3 ; portname
moveq #-1,d0
CALL AllocSignal,sysbase(a4)
move.l d0,d4
addq.l #1,d0
beq.s crp4
moveq #34,d0
moveq #1,d1
swap d1
RECALL AllocMem
movea.l d0,a2
move.l a2,d0
bne.s crp1
move.l d4,d0
RECALL FreeSignal
bra.s crp3
crp1 move.b #4,8(a2) ; mp_Node.ln_Type=NT_MSGPORT
move.b d2,9(a2) ; mp_Node.ln_Pri
move.l d3,10(a2) ; mp_Node.ln_Name
move.b d4,15(a2) ; mp_SigBit
move.l mytask(a4),16(a2) ; mp_SigTask
tst.l d3
beq.s crp2
movea.l a2,a1
RECALL AddPort
bra.s crp3
crp2 lea 20(a2),a0 ; mp_MsgList
move.l a0,(a0) ; mp_MsgList.Node.ln_Head
addq.l #4,(a0)
move.l a0,8(a0) ; mp_MsgList.Node.ln_Pred
crp3 move.l a2,d0 ; MsgPort
crp4 movem.l (sp)+,d2-d4/a2/a6
rts
DeletePort move.l a2,-(sp)
move.l sysbase(a4),a6
movea.l d0,a2 ; port
tst.l 10(a2)
beq.s dep1
movea.l a2,a1
RECALL RemPort
dep1 moveq #-1,d0 ; Port unbrauchbar
move.b d0,8(a2) ; machen
move.l d0,20(a2)
moveq #0,d0
move.b 15(a2),d0
RECALL FreeSignal
movea.l a2,a1
moveq #34,d0
RECALL FreeMem
move.l (sp)+,a2
rts
CreateStdIO move.l d2,-(sp)
move.l d0,d2 ; reply-port
beq.s csio1
moveq #48,d0
moveq #1,d1
swap d1
CALL AllocMem,sysbase(a4)
movea.l d0,a0
move.l a0,d0
beq.s csio1
move.b #5,8(a0) ; NT_MESSAGE
move.l d2,14(a0) ; ReplyPort
csio1 move.l (sp)+,d2
rts
DeleteStdIO movea.l d0,a1 ; io-block
moveq #48,d1
moveq #-1,d0
move.b d0,8(a1)
move.l d0,20(a1)
move.l d0,24(a1)
move.l d1,d0
CALL FreeMem,sysbase(a4)
rts
CreateTask movem.l d2-d5/a2/a3/a6,-(sp)
lea -32(sp),sp
addq.l #3,d0
moveq #-4,d2
and.l d0,d2 ; stack adjusted
move.l d1,d3 ; pri
move.l a0,d4 ; name
move.l a1,d5 ; code
lea MemList(pc),a0
move.l sp,a1
moveq #6,d0
crt1 move.l (a0)+,(a1)+ ; copy memlist
dbra d0,crt1
move.l d2,(a1)
move.l sp,a0
CALL AllocEntry,sysbase(a4) ; alloc memory
movea.l d0,a2
move.l a2,d0
beq.s crt2
movea.l 16(a2),a3
move.b #1,8(a3) ; ln_Type
move.b d3,9(a3) ; ln_Pri
move.l d4,10(a3) ; ln_Name
move.l 24(a2),d0
add.l d0,d2
move.l d2,54(a3) ; tc_SPReg
move.l d0,58(a3) ; tc_SPLower
move.l d2,62(a3) ; tc_SPUpper
lea 74(a3),a0 ; tc_MemList
move.l a0,(a0)
addq.l #4,(a0)
move.l a0,8(a0)
movea.l a2,a1
RECALL AddHead ; store memlist
movea.l a3,a1
move.l a1,d3
movea.l d5,a2
suba.l a3,a3
RECALL AddTask ; start task
move.l d3,d0
crt2 lea 32(sp),sp
movem.l (sp)+,d2-d5/a2/a3/a6
rts
MemList dc.l 0,0 ; Succ,Pred
dc.b 0,0 ; Pri,Type
dc.l 0 ; Name
dc.w 2 ; NumEntries
dc.l $10001 ; MemType
dc.l 92 ; Length
dc.l $10001 ; MemType
; dc.l 0 ; Length
killidle bra.s killidle
cnop 0,4
; data area
StpList dc.l *+4 ; frozen tasks list
dc.l 0
dc.l StpList
FKeys dc.l *+4 ; function keys list
dc.l 0
dc.l FKeys
History dc.l *+4 ; history lines list
dc.l 0
dc.l History
CurHist dc.l 0
NewBroker dc.b 5,0 ; nb_Version, pad
dc.l NewName ; nb_Name
dc.l WindowName ; nb_Title
dc.l Description ; nb_Descr
dc.w 1+2 ; nb_Unique = NBU_UNIQUE!NBU_NOTIFY
dc.w 4 ; nb_Flags = COF_SHOW_HIDE
dc.b 0,0 ; nb_Pri, pad
dc.l 0 ; nb_Port
dc.w 0 ; nb_ReservedChannel
InInterrupt dc.l 0 ; ln_Succ
dc.l 0 ; ln_Pred
dc.b 2 ; ln_Type
dc.b 60 ; ln_Pri
dc.l XopSleep ; ln_Name
dc.l 0 ; is_Data
dc.l keyhandler ; is_Code()
IoCounter dc.l 0 ; ln_Succ
dc.l 0 ; ln_Pred
dc.b 2 ; ln_Type
dc.b -1 ; ln_Pri
dc.l IOcntName ; ln_Name
dc.l 0 ; is_Data
dc.l countio ; is_Code()
TAttr dc.l FontName
dc.w 8
dc.b 0,0
Window_l dc.w 0
Window_t dc.w 0
Window_w dc.w 550
Window_h dc.w 200
WnNormFlgs dc.l $676
dc.l $5104f ; $4000 - WFLG_NW_EXTENDED
WnScrFlags dc.l $474
dc.l $31940
NewWindow dc.w 0,0,0,0
dc.b 0,1
NwFlgs dc.l 0
dc.l 0
dc.l 0
dc.l 0
dc.l 0 ; title
NwScreen dc.l 0
dc.l 0
MinWSize dc.w 110,50
dc.w -1,-1
NwType dc.w 0
dc.l NewWinTags ; APTR enw_Extension
NewWinTags dc.l $80000090,1 ; WA_AutoAdjust,TRUE
dc.l 0
NewScreen dc.w 0,0
NsSize dc.w 0,-1 ; ???,STDSCREENHEIGHT
dc.w 1
dc.b 0
dc.b 1
NsViewMode dc.w 0
dc.w $101f ; $1000 - NS_EXTENDED
dc.l 0
dc.l 0 ; title
dc.l 0,0
dc.l NewScrTags ; APTR ens_Extension
NewScrTags dc.l $80000023,$ffffffff ; SA_Width,STDSCREENWIDTH
NsAScroll dc.l $80000039,1 ; SA_AutoScroll,TRUE
NsDisplay dc.l $80000032,0 ; SA_DisplayID
NsPubName dc.l $8000002f,NewName ; SA_PubName
NsPubSig dc.l $80000030,0 ; SA_PubSig
NsPubTask dc.l $80000031,0 ; SA_PubTask
dc.l 0 ; TAG_DONE
IcnWindow dc.w 40,170,72,28 ; sleep window
dc.b 0,1
dc.l $20,$10800
dc.l Gadget,0,0,0,0
dc.w 72,28,72,28
dc.w 1
AppObj dc.w 0,0 ; contains gadget
Gadget dc.l 0
dc.w 0,0,72,28,4,2,$20
dc.l Image
dc.l 0,0,0,0
dc.w 0
dc.l 0
dc.w 0
dc.l 0,0
dc.l $80000000,$80000000
dc.l 0,0,0
Image dc.w 0,0,72,28
dc.w 2
dc.l ImageData
dc.b 3,0
dc.l 0
IconifGad dc.l 0 ; zip gadget for Kick 1.3
dc.w -83,0
dc.w 31,10
dc.w $14,$41,1
dc.l IconImg
dc.l 0,0,0,0
dc.w 0
dc.l 0
IconImg dc.w 0,0,31,10
dc.w 2
dc.l IconifData
dc.b 3,0
dc.l 0
SBGadget dc.l 0 ; prop gadget
dc.w -14,11
dc.w 14,-22
dc.w $10|$40
dc.w 1|2|8|16
dc.w 3
dc.l SBData,0,0,0,PropInfo
dc.w 3
dc.l 0
PropInfo dc.w 1|4
dc.w 0,0
dc.w -1,-1
dc.w 0,0,0,0,0,0
SBData dc.l 0,0,0,0
HexTab dc.b '0123456789abcdef'
Params dc.b 'tfdlrempiscua'
parmnum equ *-Params
.parmnum dc.b 0
cmdnum set 0
Commds ADDCMD 'time' ; all commands we know
ADDCMD 'taskpri'
ADDCMD 'info'
ADDCMD 'pri'
ADDCMD 'flush'
ADDCMD 'freeze'
ADDCMD 'warm'
ADDCMD 'signal'
ADDCMD 'break'
ADDCMD 'alert'
ADDCMD 'lastalert'
ADDCMD 'hold'
ADDCMD 'exit'
ADDCMD 'clear'
ADDCMD 'cancel'
ADDCMD 'taskports'
ADDCMD 'hunks'
ADDCMD 'devices'
ADDCMD 'openlib'
ADDCMD 'closelib'
ADDCMD 'currentdir'
ADDCMD 'cd'
ADDCMD 'mypri'
ADDCMD 'files'
ADDCMD 'locks'
ADDCMD 'unlock'
ADDCMD 'screens'
ADDCMD 'windows'
ADDCMD 'closescreen'
ADDCMD 'closewindow'
ADDCMD 'fonts'
ADDCMD 'windowfonts'
ADDCMD 'lockdrive'
ADDCMD 'freedrive'
ADDCMD 'capture'
ADDCMD 'clrcold'
ADDCMD 'clrcool'
ADDCMD 'clrwarm'
ADDCMD 'snoopmem'
ADDCMD 'usage'
ADDCMD 'inputhandler'
ADDCMD 'header'
ADDCMD 'sort'
ADDCMD 'hide'
ADDCMD 'hidden'
ADDCMD 'window'
ADDCMD 'kill'
ADDCMD 'iconify'
ADDCMD 'historylines'
ADDCMD 'minimumchars'
ADDCMD 'showhistory'
ADDCMD 'repeat'
ADDCMD 'remresident'
ADDCMD 'saveoutput'
ADDCMD 'killhistory'
ADDCMD 'backdropicon'
ADDCMD 'setfont'
ADDCMD 'trapguru'
ADDCMD 'outputlines'
ADDCMD 'usescreen'
ADDCMD 'usewindow'
ADDCMD 'usetopaz'
ADDCMD 'timerio'
ADDCMD 'diskchange'
ADDCMD 'alias'
ADDCMD 'remnode'
ADDCMD 'setfkey'
ADDCMD 'clicmd'
ADDCMD 'taskinfo'
ADDCMD 'coldreboot'
ADDCMD 'reboot'
ADDCMD 'zerotimer'
ADDCMD 'propgad'
ADDCMD 'iconpos'
ADDCMD 'remport'
ADDCMD 'remintserver'
ADDCMD 'frags'
ADDCMD 'traceopen'
ADDCMD 'tracelock'
ADDCMD 'cxhandler'
ADDCMD 'popkey'
ADDCMD 'pubscreens'
ADDCMD 'smartpatch'
IFNE ((tasktime-cmdaddr)/4)-cmdnum
ERROR !! COMMAND NAME OR JUMP VECTOR MISSING !!
ENDIF
NewName dc.b 'Xoper',0
XopCon dc.b 'XopPackets',0
XopSleep dc.b 'Xop-A-A-x',0
MemPortName dc.b 'SnoopPort',0
IOcntName dc.b 'Xop-I/O-Counter',0
KidleName dc.b 'Xop-Idle-Killer',0
NameFmt dc.b '%s - <PopKey=%s>',0
even ; important for mc68000 !
DefHotkey dc.b 'lcommand rcommand x',0
dc.b '$VER:'
WindowName dc.b 'Xoper 2.4 ',$a9,' 1991 by Werner G',$fc,'nther',0
Description dc.b 'A very powerful system monitor',0
T2Header dc.b ' ID STATE SIGALLOC SIGWAIT SIGRECVD PC FPU TASKNAME',0
T3Header dc.b ' ID STATE SIGALLOC SIGWAIT SIGRECVD PC TASKNAME',0
T4Header dc.b ' ID STATE RUNNING ACTIVE NUM TASKNAME',0
THeader dc.b ' ID TYPE STATE PRI CPUSE NUM TASKNAME',0
LHeader dc.b ' NODE CNT VER REV FLAGS ',0
LibNam dc.b 'LIBRARY NAME',0
DevNam dc.b 'DEVICE NAME',0
ResNam dc.b 'RESOURCE NAME',0
MHeader dc.b ' LOWER UPPER FREE ATTR PRI HUNK NAME',0
IHeader dc.b ' NODE DATA CODE PRI T S TYPE INTERRUPT NAME',0
InHeader dc.b ' NODE DATA CODE PRI NAME',0
RHeader dc.b ' ADDR PRI FLAGS VER TYPE RESIDENT NAME',0
PHeader dc.b ' NODE PORTNAME FLAGS SIGBT NUM SIGTASK',0
HunkHeader dc.b ' NUM BCPL DATA LENGTH',0
DDHeader dc.b 'DEVICE HDS SECTORS TRACKS BUFFERS STATE HANDLER',0
CDHeader dc.b 'PROCESSNAME CURRENT DIRECTORY',0
OFHeader dc.b ' LOCK ACCESS SIZE PATH/FILENAME',0
ScrHeader dc.b 'NUM ADDR SIZE DPTH TITLE',0
MonitorID dc.b ' MonitorID: $',0
PScrHeader dc.b ' NODE SCREENNAME STATE CNT SBT SIGTASK',0
WnHeader dc.b ' ADDR OWNERTASK X Y SIZE TITLE',0
FoHead dc.b ' NODE CNT Y X TYPE LO HI NAME',0
KickHead dc.b 'START END LENGTH',0
SnoopHead dc.b 'ACTION REQUIREMENTS LENGTH FROM TO CALLER',0
StackHead dc.b 'SPLower SIZE USED TASKNAME',0
CliComHead dc.b ' ID STATE TYPE MODE NUM PROCESSNAME COMMAND',0
TioHead dc.b 'IORQUEST UNIT SECS REQUESTING TASK',0
DCHead dc.b ' NODE DATA CODE UNIT TASK',0
ALHead dc.b 'ALIAS NAME COMMAND',0
SemHead dc.b ' NODE OWNER QUEUE NEST NAME',0
FragHead dc.b 'HEX SIZE DEC COUNT LARGEST',0
FKHead dc.b 'KEY STRING',0
FilesHead dc.b ' TASK HANDLE MODE FILENAME',0
TDDrives dc.b 'DF : ',0
UnitMsg dc.b ' (Unit # )',0
TimerUnits dc.b 'MicroHz ',0
dc.b 'VBlank ',0
FMode dc.b ' R/W ',0
Access dc.b ' Read ',0
dc.b ' Write ',0
RomFnt dc.b 'Rom ',0
DiskFnt dc.b 'Disk ',0
FFixed dc.b 'Fixed ',0
FProp dc.b 'Propl ',0
Status dc.b 'Added ',0
dc.b 'Running ',0
dc.b 'Ready ',0
dc.b 'Waiting ',0
dc.b 'Exeption',0
dc.b 'Removed ',0
dc.b 'Frozen ',0
dc.b 'Frozen ',0
Type dc.b 'Unknown ',0
TaskType dc.b 'Task ',0
dc.b 'Interrupt ',0
dc.b 'Device ',0
dc.b 'Msgport ',0
dc.b 'Message ',0
dc.b 'Freemsg ',0
dc.b 'Replymsg ',0
dc.b 'Resource ',0
dc.b 'Library ',0
dc.b 'Memory ',0
SoftIntType dc.b 'Softint ',0
dc.b 'Font ',0
ProcType dc.b 'Process ',0
dc.b 'Semaphore ',0
Mp_Flags dc.b 'Signal ',0
dc.b 'Softint ',0
dc.b 'Ignore ',0
PScr_State dc.b ' Public ',0
dc.b ' Private ',0
Infoh2 dc.b 'Dispat/Sec:',0
Infoh1 dc.b 'CPU:',0
Infoh3 dc.b 'CPU activity: ',0
Infoh6 dc.b 'Total:',0
Infoh4 dc.b '% ',0
Infoh7 dc.b 'I/O Ints/Sec: ',0
CPU0 dc.b '68000',0
CPU1 dc.b '68010',0
CPU2 dc.b '68020',0
CPU3 dc.b '68030',0
CPU4 dc.b '68040',0
CPU5 dc.b '/68881',0
CPU6 dc.b '/68882',0
NoFPU dc.b '---- ',0
NullState dc.b 'NULL ',0
Idle dc.b 'IDLE ',0
Busy dc.b 'BUSY ',0
WeissNicht dc.b '???? ',0
DevLoad dc.b 'loaded ',0
DevnLoad dc.b 'unloaded ',0
IntEn dc.b 'E ',0
IntDis dc.b 'D ',0
IntServ dc.b 'S ',0
IntHand dc.b 'H ',0
NotFile dc.b '--- ------- ------- ------- ',0
LongNix dc.b '-'
SmallNix dc.b '----'
Nix dc.b '--- ',0
NoInfo dc.b 'No Info on'
OneBlank dc.b ' ',0
Equal dc.b '= ',0
OpenBrak dc.b '[ ',0
CloseBrak dc.b ' ]',0
NamErr dc.b 'Unable to find ',0
FontErr dc.b "Can't open ",0
AdrErr dc.b 'Address Error!',0
AliasErr dc.b 'Single character alias names using "',0
AliasErr2 dc.b '"',10,'are not allowed.',0
NoWorkbench dc.b "Workbench isn't active !",0
OpenErr dc.b 'Could not open file ',0
ListErr dc.b 'Unable to find ListHeader. Sort aborted.',0
WiwErr dc.b 'Script file only',0
GuruTxt dc.b 'Guru Meditation #',0
ClrTxt dc.b 'Memory Hunks cleared.',0
CanErr0 dc.b 'Process is not a CLI-task',10
dc.b 'Has it been started from Workbench ? (Y/N)',10,0
CanErr1 dc.b 'Process was created by CreateProc()',10
dc.b 'Shall I UnLoad() ? (Y/N)',10,0
UnloadErr dc.b "Arrrgh.. can't find segments, aborting",0
NoProcs dc.b 'Not a Process.',0
NotLoad dc.b 'No program loaded.',0
CliProcs dc.b 'CLI-Process',0
ProcLoaded dc.b 'Loaded as a command: ',0
SegLoaded dc.b 'Created by CreateProc()',0
ColdTxt dc.b 'Cold Capture: ',0
CoolTxt dc.b 'Cool Capture: ',0
WarmTxt dc.b 'Warm Capture: ',0
KickTxt dc.b 'KickMem : ',0
Unset dc.b 'unset',0
IntNames dc.b 'Serial Out ',0
dc.b 'Disk Block ',0
dc.b 'SoftInt ',0
dc.b 'Ports ',0
dc.b 'Coper ',0
dc.b 'Vert.Blank ',0
dc.b 'Blitter ',0
dc.b 'Audio Ch.0 ',0
dc.b 'Audio Ch.1 ',0
dc.b 'Audio Ch.2 ',0
dc.b 'Audio Ch.3 ',0
dc.b 'Serial In ',0
dc.b 'Disk Sync ',0
dc.b 'External ',0
dc.b 'SoftInt ',0
dc.b 'NMI ',0
IntTyp dc.b 0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1
MemNoExp dc.b 'NOEXP ',0
MemRev dc.b 'REV ',0
MemLarg dc.b 'LARGEST ',0
MemClr dc.b 'CLEAR ',0
MemKick dc.b 'KICK ',0
MemDMA dc.b '24BIT ',0
MemLoc dc.b 'LOCAL ',0
MemFast dc.b 'FAST ',0
MemChip dc.b 'CHIP ',0
MemPubl dc.b 'PUBLIC ',0
Failed dc.b 'Failed !',0
AllOk dc.b 'ALLOC: ',0
Free dc.b 'FREE: ',0
Backg dc.b 'Bckg ',0
Foreg dc.b 'Frgr ',0
Script dc.b 'Batch ',0
Interact dc.b 'Intct ',0
NameErr dc.b 'Name or address is missing.',10
SynErr dc.b 'Syntax Error, type "?" for help'
CR dc.b 10,0
Dnotf dc.b 'Directory not found',0
NotDir dc.b 'Not a directory',0
NoMount dc.b ' not mounted.',0
DisHelp dc.b 10,'Names are case sensitive and followed by a ":"',0
UnlErr dc.b 'Lock not found',0
Unl1 dc.b 'Lock is on ',0
UnlTxt dc.b 'Old lock was: ',0
UnlTxt2 dc.b 'Unlock ? (Y/N)',10,0
ScNoFound dc.b 'Screen not found.',0
WinNoFound dc.b 'Window not found.',0
StpErr dc.b 'Task must be "READY" or "WAITING"',10,0
WaErr dc.b 'Task must be "FROZEN"',10,0
WhatsThis dc.b '???.?',0
TooMuch dc.b '??? ',0
TimeNotSet dc.b ' disabled.',0
WhatTime dc.b 'Refresh time in secs:',0
Stopped dc.b '<Break>',0
CapExited dc.b 'Task ended',0
CapWait dc.b 'Waiting for startup...',0
OnScr dc.b 'On Screen: ',0
WhatNow dc.b 'Kill, ignore (K/I)?',0
NoGuru dc.b 'None found.',0
SoftFail dc.b 'Software failure!',10,'Task: ',0
AddrsErr dc.b 'Bad aligned address was: ',0
ProCount dc.b 'PC: ',0
MemTyp dc.b 'Memory type: ',0
NintrServ dc.b "Not a server. Can't restore vectors",0
OnStr dc.b 'on',0
OffStr dc.b 'off',0
UseTxt dc.b 'DISPLAY:',10
dc.b '[T]asks task[F]lags [L]ibraries [D]evices [R]esources',10
dc.b 'r[E]sident [M]emory [P]orts [I]nterrupts [S]tack',10
dc.b '[C]litasks task[U]sage sem[A]phores [Q]uit',10,10
dc.b 'OTHER SYSTEM LISTS:',10
dc.b 'Windows Screens PubScreens WindowFonts Fonts',10
dc.b 'Capture TimerIO DiskChange InputHandler Frags',10
dc.b 'Devices Files Locks CurrentDir TraceOpen',10
dc.b 'TraceLock',10,10
dc.b 'COMMANDS:',10
dc.b 'Time <secs>',10
dc.b 'Mypri <priority>',10
dc.b 'Taskpri <priority> [processnum] <taskname>',10
dc.b 'Signal <mask(hex)> [processnum] <taskname>',10
dc.b 'Break [processnum] <taskname>',10
dc.b 'Freeze|Warm [processnum] <taskname>',10
dc.b 'Kill/Cancel [processnum] <taskname>',10
dc.b 'SnoopMem [processnum] <taskname>',10
dc.b 'ZeroTimer [processnum] <taskname>',10
dc.b 'Hide <taskname>',10
dc.b 'Pri <priority> <nodename>',10
dc.b 'Info <name>',10
dc.b 'RemNode <node address>',10
dc.b 'RemPort <port address>',10
dc.b 'RemResident <resident module name>',10
dc.b 'RemIntServer <interrupt address>',10
dc.b 'Clear <longword(hex)>',10
dc.b 'Hunks [processnum] <procname>',10
dc.b 'CD <directory> [processnum] <procname>',10
dc.b 'UnLock <lock>',10
dc.b 'OpenLib | Closelib <libraryname>',10
dc.b 'CloseWindow| Closescreen <title>',10
dc.b 'SetFont [size] <fontname> <windowtitle>',10
dc.b 'LockDrive | Freedrive <drivename:>',10
dc.b 'Window <leftedge topedge width height> (scriptfile only) ',10
dc.b 'IconPos <leftedge topedge>',10
dc.b 'OutputLines <maximum # of lines>',10
dc.b 'HistoryLines <maximum # of lines>',10
dc.b 'MinimumChars <minimum # of characters>',10
dc.b 'SaveOutput <filename>',10
dc.b 'PopKey <description>',10
dc.b 'Repeat <Command line>',10
dc.b 'SetFKey <number> <string>',10
dc.b 'Alias [<aliasname> <commandname>]',10,10
dc.b 'COMMANDS WITHOUT PARAMETERS:',10
dc.b 'Alert LastAlert ClrCool ClrCold ClrWarm',10
dc.b 'TrapGuru Flush ColdReboot Reboot',10,10
dc.b 'OPTIONS:',10
dc.b 'Sort CLICmd TaskInfo TaskPorts Hidden',10
dc.b 'Usage Header UseScreen UseWindow UseTopaz',10
dc.b 'PropGad Iconify BackDropIcon ShowHistory KillHistory',10
dc.b 'SmartPatch CxHandler Hold Exit',0
GfxName dc.b 'graphics.library',0
IntName dc.b 'intuition.library',0
CxName dc.b 'commodities.library',0
WbName dc.b 'workbench.library',0
DiskFont dc.b 'diskfont.library',0
TdName dc.b 'trackdisk.device',0
ConName dc.b 'console.device',0
DeviceNam dc.b 'input.device',0
TimerNam dc.b 'timer.device',0
FontName dc.b 'topaz.font',0
WbPortNam dc.b 'Workbench',0
IFND DEBUG
StartupName dc.b 'ENV:Xoper.Startup',0
ENDC
IFD DEBUG
StartupName dc.b 'ENV:Test.Startup',0
ENDC
cnop 0,4
dataarea
DosTable equ _DosTable-dataarea
StrCmp equ strcmp-dataarea
GetNum equ getnum-dataarea
stplist equ StpList-dataarea
fkeys equ FKeys-dataarea
history equ History-dataarea
curhist equ CurHist-dataarea
newbroker equ NewBroker-dataarea
ininterrupt equ InInterrupt-dataarea
iocounter equ IoCounter-dataarea
tattr equ TAttr-dataarea
window_l equ Window_l-dataarea
window_t equ Window_t-dataarea
window_w equ Window_w-dataarea
window_h equ Window_h-dataarea
wnnormflgs equ WnNormFlgs-dataarea
wnscrflags equ WnScrFlags-dataarea
newwindow equ NewWindow-dataarea
nwflgs equ NwFlgs-dataarea
nwscreen equ NwScreen-dataarea
minwsize equ MinWSize-dataarea
nwtype equ NwType-dataarea
newscreen equ NewScreen-dataarea
nssize equ NsSize-dataarea
nsviewmode equ NsViewMode-dataarea
newscrtags equ NewScrTags-dataarea
nsdisplay equ NsDisplay-dataarea
nspubname equ NsPubName-dataarea
nspubsig equ NsPubSig-dataarea
nspubtask equ NsPubTask-dataarea
icnwindow equ IcnWindow-dataarea
appobj equ AppObj-dataarea
gadget equ Gadget-dataarea
image equ Image-dataarea
iconifgad equ IconifGad-dataarea
iconimg equ IconImg-dataarea
sbgadget equ SBGadget-dataarea
propinfo equ PropInfo-dataarea
sbdata equ SBData-dataarea
hextab equ HexTab-dataarea
params equ Params-dataarea
commds equ Commds-dataarea
newname equ NewName-dataarea
xopcon equ XopCon-dataarea
xopsleep equ XopSleep-dataarea
memportname equ MemPortName-dataarea
IOcntname equ IOcntName-dataarea
kidlename equ KidleName-dataarea
namefmt equ NameFmt-dataarea
defhotkey equ DefHotkey-dataarea
windowname equ WindowName-dataarea
description equ Description-dataarea
t2header equ T2Header-dataarea
t3header equ T3Header-dataarea
t4header equ T4Header-dataarea
theader equ THeader-dataarea
lheader equ LHeader-dataarea
libnam equ LibNam-dataarea
devnam equ DevNam-dataarea
resnam equ ResNam-dataarea
mheader equ MHeader-dataarea
iheader equ IHeader-dataarea
inheader equ InHeader-dataarea
rheader equ RHeader-dataarea
pheader equ PHeader-dataarea
hunkheader equ HunkHeader-dataarea
ddheader equ DDHeader-dataarea
cdheader equ CDHeader-dataarea
ofheader equ OFHeader-dataarea
scrheader equ ScrHeader-dataarea
monitorid equ MonitorID-dataarea
pscrheader equ PScrHeader-dataarea
wnheader equ WnHeader-dataarea
fohead equ FoHead-dataarea
kickhead equ KickHead-dataarea
snoophead equ SnoopHead-dataarea
stackhead equ StackHead-dataarea
clicomhead equ CliComHead-dataarea
tiohead equ TioHead-dataarea
dchead equ DCHead-dataarea
alhead equ ALHead-dataarea
semhead equ SemHead-dataarea
fraghead equ FragHead-dataarea
fkhead equ FKHead-dataarea
fileshead equ FilesHead-dataarea
tddrives equ TDDrives-dataarea
unitmsg equ UnitMsg-dataarea
timerunits equ TimerUnits-dataarea
fmode equ FMode-dataarea
access equ Access-dataarea
romfnt equ RomFnt-dataarea
diskfnt equ DiskFnt-dataarea
ffixed equ FFixed-dataarea
fprop equ FProp-dataarea
status equ Status-dataarea
type equ Type-dataarea
tasktype equ TaskType-dataarea
softinttype equ SoftIntType-dataarea
proctype equ ProcType-dataarea
mp_flags equ Mp_Flags-dataarea
pscr_state equ PScr_State-dataarea
infoh2 equ Infoh2-dataarea
infoh1 equ Infoh1-dataarea
infoh3 equ Infoh3-dataarea
infoh6 equ Infoh6-dataarea
infoh4 equ Infoh4-dataarea
infoh7 equ Infoh7-dataarea
cpu0 equ CPU0-dataarea
cpu1 equ CPU1-dataarea
cpu2 equ CPU2-dataarea
cpu3 equ CPU3-dataarea
cpu4 equ CPU4-dataarea
cpu5 equ CPU5-dataarea
cpu6 equ CPU6-dataarea
nofpu equ NoFPU-dataarea
nullstate equ NullState-dataarea
idle equ Idle-dataarea
busy equ Busy-dataarea
weissnicht equ WeissNicht-dataarea
devload equ DevLoad-dataarea
devnload equ DevnLoad-dataarea
inten equ IntEn-dataarea
intdis equ IntDis-dataarea
intserv equ IntServ-dataarea
inthand equ IntHand-dataarea
notfile equ NotFile-dataarea
longnix equ LongNix-dataarea
smallnix equ SmallNix-dataarea
nix equ Nix-dataarea
noinfo equ NoInfo-dataarea
oneblank equ OneBlank-dataarea
equal equ Equal-dataarea
openbrak equ OpenBrak-dataarea
closebrak equ CloseBrak-dataarea
namerr equ NameErr-dataarea
fonterr equ FontErr-dataarea
adrerr equ AdrErr-dataarea
aliaserr equ AliasErr-dataarea
aliaserr2 equ AliasErr2-dataarea
noworkbench equ NoWorkbench-dataarea
openerr equ OpenErr-dataarea
listerr equ ListErr-dataarea
wiwerr equ WiwErr-dataarea
gurutxt equ GuruTxt-dataarea
clrtxt equ ClrTxt-dataarea
canerr0 equ CanErr0-dataarea
canerr1 equ CanErr1-dataarea
unloaderr equ UnloadErr-dataarea
noprocs equ NoProcs-dataarea
notload equ NotLoad-dataarea
cliprocs equ CliProcs-dataarea
procloaded equ ProcLoaded-dataarea
segloaded equ SegLoaded-dataarea
coldtxt equ ColdTxt-dataarea
cooltxt equ CoolTxt-dataarea
warmtxt equ WarmTxt-dataarea
kicktxt equ KickTxt-dataarea
unset equ Unset-dataarea
intnames equ IntNames-dataarea
inttyp equ IntTyp-dataarea
memnoexp equ MemNoExp-dataarea
memrev equ MemRev-dataarea
memlarg equ MemLarg-dataarea
memclr equ MemClr-dataarea
memkick equ MemKick-dataarea
memdma equ MemDMA-dataarea
memloc equ MemLoc-dataarea
memfast equ MemFast-dataarea
memchip equ MemChip-dataarea
mempubl equ MemPubl-dataarea
failed equ Failed-dataarea
allok equ AllOk-dataarea
free equ Free-dataarea
backg equ Backg-dataarea
foreg equ Foreg-dataarea
script equ Script-dataarea
interact equ Interact-dataarea
nameerr equ NameErr-dataarea
synerr equ SynErr-dataarea
cr equ CR-dataarea
dnotf equ Dnotf-dataarea
notdir equ NotDir-dataarea
nomount equ NoMount-dataarea
dishelp equ DisHelp-dataarea
unlerr equ UnlErr-dataarea
unl1 equ Unl1-dataarea
unltxt equ UnlTxt-dataarea
unltxt2 equ UnlTxt2-dataarea
scnofound equ ScNoFound-dataarea
winnofound equ WinNoFound-dataarea
stperr equ StpErr-dataarea
waerr equ WaErr-dataarea
whatsthis equ WhatsThis-dataarea
toomuch equ TooMuch-dataarea
timenotset equ TimeNotSet-dataarea
whattime equ WhatTime-dataarea
stopped equ Stopped-dataarea
capexited equ CapExited-dataarea
capwait equ CapWait-dataarea
onscr equ OnScr-dataarea
whatnow equ WhatNow-dataarea
noguru equ NoGuru-dataarea
softfail equ SoftFail-dataarea
addrserr equ AddrsErr-dataarea
procount equ ProCount-dataarea
memtyp equ MemTyp-dataarea
nintrserv equ NintrServ-dataarea
onstr equ OnStr-dataarea
offstr equ OffStr-dataarea
usetxt equ UseTxt-dataarea
gfxname equ GfxName-dataarea
intname equ IntName-dataarea
cxname equ CxName-dataarea
wbname equ WbName-dataarea
diskfont equ DiskFont-dataarea
tdname equ TdName-dataarea
conname equ ConName-dataarea
devicenam equ DeviceNam-dataarea
timernam equ TimerNam-dataarea
fontname equ FontName-dataarea
wbportnam equ WbPortNam-dataarea
startupname equ StartupName-dataarea
IFD DEBUG
ds.b gb_SIZEOF
ENDC
SECTION Images,DATA,CHIP
IconifData dc.w $7FFF,$FFFC,$601F,$FFFC,$6000,$000C,$607F,$FFCC
dc.w $6060,$00CC,$6067,$FCCC,$7E60,$00CC,$7E7F,$FFCC
dc.w $7E00,$000C,$7FFF,$FFFC,$0000,$0000,$1FE0,$0000
dc.w $1FFF,$FFF0,$1F80,$0030,$1F9F,$FF30,$1F98,$0330
dc.w $019F,$FF30,$0180,$0030,$01FF,$FFF0,$0000,$0000
ImageData dc.w $000F,$FFFF,$FFFF,$FFF8,$0000,$001F,$FFFF,$FFFF
dc.w $FFFC,$0000,$001F,$0000,$0000,$007C,$0000,$001F
dc.w $7FFF,$FFFF,$FF7C,$0000,$001F,$4A46,$0244,$557C
dc.w $0000,$001F,$5108,$D411,$817C,$0000,$001F,$7FFF
dc.w $FFFF,$FF7C,$0000,$001F,$0000,$0000,$007C,$0000
dc.w $001F,$30C0,$0000,$007C,$0000,$001F,$1980,$0000
dc.w $007C,$0000,$001F,$0F0F,$1F0F,$1F7C,$0000,$001F
dc.w $0619,$9999,$997C,$0000,$001F,$0F19,$999F,$987C
dc.w $0000,$001F,$1999,$9F18,$187C,$0000,$001F,$30CF
dc.w $180F,$187C,$0000,$001F,$0000,$1800,$007C,$0000
dc.w $001F,$0000,$0000,$007C,$0000,$001F,$FFFF,$FFFF
dc.w $FFFC,$0000,$000F,$FFFF,$FFFF,$FF18,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$3FFF,$FFFF,$FFFF,$FFFF
dc.w $FC00,$FDFF,$FFFF,$FFFF,$FFFF,$FF00,$EBFF,$FFFF
dc.w $FFFF,$FFFF,$FF00,$F7FF,$FFFF,$FFFF,$F800,$0700
dc.w $FFFF,$FFFF,$FFFF,$FFFF,$FF00,$FFFF,$FFFF,$FFFF
dc.w $FFFF,$FF00,$FFFF,$FFFF,$FFFF,$FFFF,$FF00,$3FFF
dc.w $FFFF,$FFFF,$FFFF,$FC00,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$FFFF
dc.w $FFFF,$FF80,$0000,$0000,$FFFF,$FFFF,$FF80,$0000
dc.w $0000,$FFFF,$FFFF,$FF80,$0000,$0000,$FFFF,$FFFF
dc.w $FF80,$0000,$0000,$FFFF,$FFFF,$FF80,$0000,$0000
dc.w $FFFF,$FFFF,$FF80,$0000,$0000,$8000,$0000,$0080
dc.w $0000,$0000,$8000,$0000,$0080,$0000,$0000,$8000
dc.w $0000,$0080,$0000,$0000,$8000,$0000,$0080,$0000
dc.w $0000,$8000,$0000,$0080,$0000,$0000,$8000,$0000
dc.w $0080,$0000,$0000,$8000,$0000,$0080,$0000,$0000
dc.w $8000,$0000,$0080,$0000,$0000,$FFFF,$FFFF,$FF80
dc.w $0000,$0000,$0000,$0000,$00E0,$0000,$0000,$0000
dc.w $0000,$00E0,$0000,$0000,$1FFF,$FFFF,$F800,$0000
dc.w $0000,$0080,$0040,$0000,$0000,$0200,$0080,$0040
dc.w $0000,$0000,$1400,$0080,$0040,$003F,$0000,$0800
dc.w $0080,$0040,$07FF,$F800,$0000,$0080,$0040,$003F
dc.w $0000,$0000,$0080,$0040,$0000,$3800,$FFFF,$FFFF
dc.w $FFFF,$FFFF,$FE00,$0000,$0080,$0040,$0000,$0000
imagesize equ (((*-ImageData)>>2)-1)
END