home *** CD-ROM | disk | FTP | other *** search
- ******************************************
- * *
- * Xoper 2.0 Copyright (C) Werner Gunther *
- * *
- ******************************************
- * Written for the A68K Assembler *
- * (Fish 110) by Charlie Gibbs and *
- * Brian R. Anderson *
- * *
- * Do not use Smallcode/Smalldata when *
- * linking *
- ******************************************
- ;DEBUG SET 1
- XREF _LVOSwitch
- XREF _LVOAddTask
- XDEF _SysBase
- sysbase equ 4
-
- CALL MACRO
- xref _LVO\1
- move.l \2,a6
- jsr _LVO\1(a6)
- ENDM
- LIBCALL MACRO
- xref _\1
- jsr _\1
- ENDM
-
- ADDCMD MACRO
- cmdnum set cmdnum+1
- dc.b \1,0
- ENDM
-
- ;Program startup. If called from DOS we
- ;use segment splitting to detach
- ;from our DOS-task.
- start moveq #3,d0
- lea dummyinput,a1
- getparm move.b (a0)+,(a1)+
- dbf d0,getparm
- move.b #10,in
- lea conname(PC),a1
- move.l sysbase,a0
- lea 350(a0),a0
- CALL FindName,sysbase
- move.l d0,condev
- lea dosname(PC),a1
- move.l sysbase,a0
- lea 378(a0),a0
- move.l a0,-(a7)
- CALL FindName,sysbase
- move.l d0,dosbase
- move.l 0(a7),a0
- lea gfxname(PC),a1
- CALL FindName,sysbase
- move.l d0,gfxbase
- move.l (a7)+,a0
- lea intuiname(PC),a1
- CALL FindName,sysbase
- move.l d0,intuibase
- move.l d0,a0
- move.l $38(a0),a0
- move.w 12(a0),d0
- sub.w #550,d0
- move.w d0,window_l
-
- move.l sysbase,a4
- move.l 276(a4),a4
- tst.l $ac(a4)
- bne.s notwb
- lea $5c(a4),a0
- CALL WaitPort,sysbase
- lea $5c(a4),a0
- CALL GetMsg,sysbase
- move.l d0,wbmsg
- move.w #$740a,in
- notwb:
- IFND DEBUG
- lea xopcon,a1
- CALL FindPort,sysbase
- tst.l d0
- bne oops
- ENDC
- tst.l wbmsg
- beq.s fromdos
- jmp mainprg
-
- fromdos:
-
- starttask:
-
- IFND DEBUG
- cmp.w #'-b',dummyinput
- bne.s stt1
- CALL Output,dosbase
- move.l d0,-(a7)
- move.l #windowname,d2
- move.l d0,d1
- moveq.l #newname-windowname-1,d3
- CALL Write,dosbase
- move.l #cr,d2
- move.l (a7)+,d1
- moveq.l #1,d3
- CALL Write,dosbase
- stt1 lea start(PC),a1
- move.l -4(a1),d3
- move.l d3,myseg
-
- move.l #mainprg,d3
- subq #4,d3
- lsr.l #2,d3
-
- clr.l -4(a1)
- CALL Forbid,sysbase
- move.l #newname,d1
- clr.l d2
- move.l #3500,d4
- CALL CreateProc,dosbase
- CALL Permit,sysbase
- moveq #0,d0
- rts
- oops suba.l a0,a0
- CALL DisplayBeep,intuibase
- CALL Forbid,sysbase
- move.l wbmsg,d0
- beq.s leave
- move.l d0,a1
- CALL ReplyMsg,sysbase
- moveq #0,d0
- leave rts
-
- dosname dc.b 'dos.library',0
- intuiname dc.b 'intuition.library',0
- gfxname dc.b 'graphics.library',0
- conname dc.b 'console.device',0
- EVEN
-
- main CODE xoper
- ENDC
- mainprg move.l sysbase,a0
- move.l a0,_SysBase
- move.l a7,realstack
- move.l 276(a0),a0 ;ExecBase->ThisTask
- move.l a0,mytask
- move.l 50(a0),oldproctrap ;original AmigaDos Trap-Handler
- move.l #newname,10(a0)
- pea 0
- pea xopcon
- LIBCALL CreatePort
- addq #8,a7
- move.l d0,replyport
- pea 0
- pea 0
- LIBCALL CreatePort
- addq #8,a7
- move.l d0,timerport
- lea timerio,a1
- move.l d0,14(a1)
- move.l d0,a2
- move.b 15(a2),d0
- ext.w d0
- move.w d0,timersig
- lea timernam(PC),a0
- moveq #0,d1
- moveq #1,d0
- CALL OpenDevice,_SysBase(PC) ;open 'timer.device'
-
- ;install a counter to determine the amount of CPU-time each
- ;Task uses.
- move.l _SysBase(PC),a1
- move.l #_LVOSwitch,a0
- move.l 2(a1,a0),oldswitch
- move.l #myswitch,d0
- CALL SetFunction,_SysBase(PC)
- ;install a counter for PORT-Interrupts
- lea IOCounter(PC),a1
- moveq #3,d0
- CALL AddIntServer,_SysBase(PC)
-
- ;Attempt to open a startup script
- move.l mytask(PC),a4 ;disable the 'please insert'
- move.l 184(a4),-(a7)
- move.l #-1,184(a4) ;requester
- move.l #startupname+2,d1 ;'Xoper.Startup'
- move.l #1005,d2
- CALL Open,dosbase(PC)
- tst.l d0
- bne.s 7$
- move.l #startupname,d1 ;'S:Xoper.Startup'
- move.l #1005,d2
- CALL Open,dosbase(PC)
-
- 7$ move.l (a7)+,184(a4) ;reenable the requester
- move.l d0,infile
- beq.s nostartup
-
- 6$ move.b #1,fromfile
-
- 8$ lea dummy,a5
- moveq #-1,d5
- 5$ addq.l #1,d5
- move.l infile(PC),d1
- move.l a5,d2
- add.l d5,d2
- moveq.l #1,d3
- CALL Read,dosbase(PC)
- tst.l d0
- bgt.s 10$
-
- move.l infile(PC),d1
- CALL Close,dosbase(PC)
- clr.l infile
- tst d5
- beq.s endstartup
- bra.s 9$
-
- 10$ cmp.b #10,0(a5,d5)
- beq.s 9$
- cmp.b #13,0(a5,d5)
- bne.s 5$
-
- 9$ move.l d5,d0
- addq #1,d0
- bsr cli ;execute the script as if typed in
- tst.l infile
- bne.s 8$
-
- endstartup clr.b fromfile
-
- nostartup tst.l wbmsg
- bne.s noin
- cmp.b #10,dummyinput
- beq.s noin
- cmp.w #'-b',dummyinput ;requested as a background task ?
- beq.s noin
- move.l dummyinput,in
- move.b #10,in+4
- bra.s nostartup2
- noin cmp.b #10,in
- beq.s default
- tst.b in
- bne.s nostartup2
-
- default move.w #$740a,in ;couldn't find defaults, defaults to
- ;tasks
-
- nostartup2 cmp.w #'-b',dummyinput
- beq instback
-
- ;This code just opens a Window. Position
- ;and size are taken from window_l,window_t,
- ;window_w,window_h.
- restart tst.b ownscreen
- beq.s 1$
- bsr createscreen
- bra.s 2$
- 1$ bsr setupwindow
-
- 2$ move.l mytask(PC),a0
- clr.l 26(a0) ;clear 'spurious' signals
-
- clr.l ptr
- tst.b gotguru
-
- beq.s 3$
- bsr showguru
- clr.b gotguru
- 3$ bra processmsgs
-
- ;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.b fromfile
- bne endshow
- move.w cmdptr(PC),d7
-
- input lea in,a0
- move.b 0(a0,d7.w),d0
- beq endshow
- addq.b #1,d7
- cmpi.b #' ',d0
- bne.s 1$
-
- bsr testifend
- beq endshow
- move.w d2,cmdptr
- bra notfinished
-
- 1$ cmpi.b #10,d0
- beq endshow
- or.b #32,d0
- cmpi.b #'q',d0
- beq exit
- lea params(PC),a0
- moveq #0,d1
- i1 cmp.b 0(a0,d1),d0
- beq.s foundp
- addq.b #1,d1
- cmpi.b #parmnum,d1
- bne.s i1
-
- move.l #usetxt,d0
- move.b #1,mnflag
- bsr putnam
- clr.b mnflag
- bra endshow
-
- foundp lsl.b #2,d1
- lea subs(PC),a0
- move.b #1,mnflag
- jsr 0(a0,d1)
- clr.b mnflag
- bsr testifend
- beq input
- bsr newline
- bra input
-
- testifend lea in,a0
- lea 0(a0,d7),a0
- move.w d7,d2
- 2$ move.b (a0)+,d0
- beq.s 1$
- cmpi.b #' ',d0
- bne.s 3$
- addq #1,d2
- bra.s 2$
- 3$ cmpi.b #10,d0
- 1$ rts
-
-
- endshow tst.b fromfile
- bne.s nomore
- clr.w cmdptr
- notfinished bsr starttimer
- nomore tst.b fromfile
- bne.s 1$
- clr.l lastprinted
- bsr blastout
- 1$ rts
-
- ;get the string from inputbuffer; search and execute
- ;the command, if any.
-
- cli lea dummy,a0
- subq #1,d0
- cl2 subq #1,d0
- bmi.s cl1
- cmp.b #' ',0(a0,d0)
- beq.s cl2
- cl1 addq #1,d0
- move.b #10,0(a0,d0)
- bsr kllblnks
- cmpi.b #10,0(a0)
- beq showwhat
- cmpi.b #';',0(a0)
- beq nomore
-
- bsr findcmd
- tst.l d2
- bpl.s okcmd
- bsr findalias
- tst.l d2
- bmi.s nm1
-
- okcmd clr.b procnum
- adda.w d1,a0
- bsr kllblnks
- lsl #2,d2
- lea cmdaddr(PC),a1
- jsr 0(a1,d2)
- bra nomore
-
- nm1 lea in,a1
- lea buffer,a2
- nm2 move.b (a1)+,(a2)+
- cmp.b #10,-1(a1)
- bne.s nm2
- lea in,a1
- nm0 move.b (a0)+,(a1)+
- cmp.b #10,-1(a1)
- bne.s nm0
- lea dummy,a2
- lea buffer,a1
- nm3 move.b (a1)+,(a2)+
- cmp.b #10,-1(a1)
- bne.s nm3
- clr.w cmdptr
- bra showwhat
-
- findcmd bsr strbuf
- move.l a0,a5
- lea commds(PC),a2
- moveq #0,d2
- 1$ lea buffer,a0
- move.l a2,a1
- bsr strcmp
- beq 3$
- 2$ tst.b (a2)+
- bne.s 2$
- addq #1,d2
- cmp.w #cmdnum,d2
- bne.s 1$
- moveq #-1,d2
- 3$ move.l a5,a0
- rts
-
- findalias move.l a0,a5
- move.l aliaslist(PC),d4
- 1$ beq.s 3$
- move.l d4,a4
- lea buffer,a0
- lea 5(a4),a1
- move.b 4(a4),d2
- ext.w d2
- ext.l d2
- bsr strcmp
- beq 4$
- move.l 0(a4),d4
- bra.s 1$
- 3$ moveq #-1,d2
- 4$ move.l a5,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
- cmdaddr bra settime
- bra taskpri
- bra info
- bra pri
- bra flush
- bra freeze
- bra warm
- bra signal
- bra break
- bra alert
- bra lastalert
- bra hold
- bra stopall
- 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 inphand
- bra nohead
- bra sort
- bra hide
- bra hidden
- bra setwindow
- bra cancel
- bra iconifyoff
- 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 grabtimerio
- bra dchange
- bra alias
- bra remnode
-
- ;------ Task-Structures-----
-
- showaddr clr.b tasktyp
- bra.s startask
- showtask move.b #1,tasktyp
- startask tst.b headon
- beq noheader1
- move.l #infoh1,d0
- bsr putstr
- move.l _SysBase(PC),a6
- move.l #cpu2,d0
- btst #1,297(a6) ;SysBase->AttnFlags
- bne.s cpupr
- move.l #cpu1,d0
- btst #0,297(a6)
- bne.s cpupr
- move.l #cpu0,d0
- cpupr bsr putstr
- move.l _SysBase(PC),a6
- btst #2,297(a6)
- beq.s no881
- move.l #cpu3,d0
- bsr putstr
- no881 moveq #20,d1
- bsr tab
- move.l #infoh3,d0
- bsr putstr
-
- noheader1 move.l _SysBase(PC),a6
- move.w #$4000,$dff09a
- move.l 280(a6),d0
- move.l 284(a6),d1
- move.l oldidl,d3
- move.l d0,oldidl
- sub.l d3,d0
- move.l olddisp,d3
- move.l d1,olddisp
- sub.l d1,d3
- move.l d0,d1
- sub.l d3,d1
- move.l d1,maxdisp
- move.l d3,-(a7)
- movem.l d0-d3,-(a7)
- moveq #1,d5
- bsr getaskdat
- move.l a5,savedat
- movem.l (a7)+,d0-d3
- sub.l d3,d0
- neg.l d3
- tst.b headon
- beq.s noheader2
- bsr prcent
- bsr newline
- move.l #infoh2,d0
- bsr putstr
- noheader2 move.l (a7)+,d0
- neg.l d0
- move.l d0,dispatches
- tst.b headon
- beq noheader3
- mulu #100,d0
- move.l d0,-(a7)
-
- lea secs(PC),a0
- lea mics(PC),a1
- CALL CurrentTime,intuibase(PC)
- move.l secs(PC),d3
- lsl.l #1,d3
- move.l d3,d1
- lsl.l #2,d3
- add.l d1,d3
- move.l mics(PC),d0
- move.l #100000,d1
- bsr div
- add.l d0,d3
- move.l time10(PC),d1
- move.l d3,time10
- sub.l d1,d3
- move.l (a7)+,d0
- move.l d3,-(a7)
- move.l d3,d1
- bsr div
- moveq #1,d5
- bsr putfrac
-
- moveq #20,d1
- bsr tab
- move.l #infoh7,d0
- bsr putstr
- move.l iocount(PC),d0
- clr.l iocount
- mulu #100,d0
- move.l (a7)+,d3
- move.l d3,d1
- bsr div
- moveq #1,d5
- bsr putfrac
-
- bsr newline
- bsr newline
- noheader3 lea theader(PC),a0
- tst.b tasktyp
- bne.s phedder
- lea t2header(PC),a0
- phedder bsr puthead
- move.l savedat(PC),a5
-
- pt1 tst.b entries
- beq pt2
- lea -16(a5),a5
- bsr hideit
- tst d0
- beq ptend
- move.l 0(a5),a4
- move.l a4,d0
- move.l d0,node
- bsr hexa
- tst.b tasktyp
- beq.s pt12
- moveq #0,d0
- move.b 8(a4),d0
- bsr gettype
-
- pt12 moveq #0,d0
- move.b 9(a5),d0
- subq.b #1,d0
- mulu #10,d0
- move.l #status,d1
- add.l d1,d0
- bsr putstr
- tst.b tasktyp
- bne.s pt13
-
- move.l 18(a4),d0
- bsr hexa
- move.l #longnix,d0
- cmp.b #4,9(a5)
- beq.s pt14
- bsr putstr
- bra.s pt15
- pt14 move.l 22(a4),d0
- bsr hexa
- pt15 move.l 26(a4),d0
- bsr hexa
- move.l 54(a4),a1
- move.l 0(a1),d0
- cmp.b #2,9(a5)
- bne.s pt16
- move.l #*,d0
- pt16 bsr hexa
- bra pt4
-
- pt13 move.b 10(a5),d3
- bsr plusmins
-
- move.l dispatches(PC),d0
- tst.b usageflag
- beq.s pt37
- move.l maxdisp(PC),d0
- pt37 move.l 12(a5),d3
- bsr prcent
-
- clr.b d3
- cmpi.b #13,8(a5)
- bne.s noproc
- tst.l 172(a4)
- beq.s noproc
- move.b 11(a5),d3
- bsr bytedec
- bra.s pt4
- noproc move.l #nix,d0
- bsr putstr
- pt4 move.l 4(a5),d0
- bsr putnam
- ptend subq.b #1,entries
- bra pt1
- pt2 rts
-
- putlist move.l 0(a4),a4
- tst.l 0(a4)
- beq.s endlist
- bsr putdata
- bra.s putlist
- endlist rts
-
- putdata move.l a4,0(a5)
- move.l 10(a4),4(a5) ;task->ln_Name
- move.b 8(a4),8(a5) ;task->ln_Type
- move.b 15(a4),9(a5) ;task->tc_State
- move.b 9(a4),10(a5) ;task->ln_Pri
- move.b 143(a4),11(a5) ;Process->pr_Tasknum
- clr.l 12(a5)
- lea cputime,a0
- move.l tasksnum(PC),d1
- subq #1,d1
- bmi.s pua1
- pua3 cmp.l (a0)+,a4
- dbeq d1,pua3
- tst d1
- bmi.s pua1
- pua2 move.l 508(a0),12(a5)
- pua1 lea 16(a5),a5
- addq.b #1,entries
- rts
-
- gettype and.l #$f,d0
- mulu #11,d0
- add.l #type,d0
- bra putstr
-
- getaskdat move.l d5,-(a7)
- lea buffer,a5
- clr.b entries
- lea stplist(PC),a4
- bsr putlist
- move.l _SysBase(PC),a4
- lea 420(a4),a4 ;SysBase->TaskWait
- bsr putlist
- move.l _SysBase(PC),a4
- lea 406(a4),a4 ;SysBase->TaskReady
- bsr putlist
- move.l _SysBase(PC),a4
- move.l 276(a4),a4 ;SysBase->ThisTask
- bsr putdata
- move.l (a7)+,d5
- beq.s 1$
- clr.l tasksnum
- 1$ move.w #-$4000,$dff09a
- moveq #16,d2
- lea -32(a5),a2
- bsr.s sortlist
- rts
-
- sortlist tst.b sorton
- beq.s sort5
- lea buffer,a3
- sort1 lea 0(a3,d2),a4
- sort2 move.l 0(a3),d1
- cmp.l 0(a4),d1
- bge.s sort3
- move.l d2,d1
- subq #1,d1
- sort4 move.b 0(a4,d1),d0
- move.b 0(a3,d1),0(a4,d1)
- move.b d0,0(a3,d1)
- dbf d1,sort4
- sort3 lea 0(a4,d2),a4
- cmp.l a2,a4
- ble.s sort2
- lea 0(a3,d2),a3
- cmp.l a2,a3
- bne.s sort1
- sort5 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 putfrac
- move.l #infoh4,d0
- bra putstr
-
- putfrac divu #10,d0
- move d0,d3
- swap d0
- move d0,d1
- tst d5
- bne.s 1$
- cmp.w #100,d3
- ble.s 1$
- move.l #whatsthis,d0
- bra putstr
- 1$ bsr bytedec
- lea out,a0
- move.b #'.',-1(a0,d0)
- or.b #'0',d1
- move d1,d0
- bra putchar
-
- hideit tst.b hideon
- bne.s pt73
- pt75 moveq #1,d0
- rts
- pt73 lea hidestart(PC),a4
- move.l 4(a5),a0
- pt74 tst.l 0(a4)
- beq.s pt75
- move.l 0(a4),a4
- lea 4(a4),a1
- bsr strcmp
- tst d0
- beq hideend
- bra.s pt74
- hideend rts
- *-------- mem-hunks ------------
-
- showmem lea mheader(PC),a0
- bsr puthead
- move.l _SysBase(PC),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.b 15(a5),d3 ;MemHeader->mh_Attributes
- bsr bytedec
- move.b 9(a5),d3 ;MemHeader->ln_pri
- bsr plusmins
- move.l 10(a5),d0 ;MemHeader->ln_Name
- move.l a5,node
- bsr putnam
- bra.s mem1
- mem2 move.l #infoh6,d0
- bsr putstr
- moveq #19,d1
- bsr tab
- moveq #0,d3
- move.l d5,d0
- bsr longdec
- newline move.l #cr,d0
- bra putstr
-
- *-------- Task-Stack ------------
-
- stack lea stackhead(pc),a0
- bsr puthead
- moveq #0,d5
- bsr getaskdat
- sta1 tst.b entries
- beq sta8
- lea -16(a5),a5
- bsr hideit
- tst d0
- beq sta9
- move.l 0(a5),a1
- cmp.b #13,8(a1) ;task->ln_Type
- bne.s sta6
- move.l 172(a1),d0
- beq.s sta6
- lsl.l #2,d0
- move.l d0,a0
- tst.l 60(a0)
- beq.s sta6
- moveq #1,d3
- move.l 52(a0),d4
- lsl.l #2,d4
- move.l 176(a1),d0
- sub.l d4,d0
- bsr hexa
- move.l d4,d0
- bsr longdec
- move.l 176(a1),d0
- sub.l 54(a1),d0
- bra.s sta7
-
- sta6 move.l 58(a1),d0
- bsr hexa
- moveq #1,d3
- move.l 62(a1),d0
- sub.l 58(a1),d0
- bsr longdec
- move.l 62(a1),d0
- sub.l 54(a1),d0
- sta7 bsr longdec
- move.l 4(a5),d0
- bsr putnam
- sta9 subq.b #1,entries
- bra sta1
- sta8 rts
-
- clicomm lea clicomhead(pc),a0
- bsr puthead
- moveq #0,d5
- bsr getaskdat
- clic1 tst.b entries
- beq clic8
- lea -16(a5),a5
- bsr hideit
- tst d0
- beq clic0
- move.l 0(a5),a4
- cmpi.b #13,8(a4)
- bne clic0
- tst.l 172(a4)
- beq clic0
- move.l 140(a4),d3
- beq clic0
- move.l a4,d0
- move.l d0,node
- bsr hexa
- moveq #0,d0
- move.b 9(a5),d0
- subq #1,d0
- mulu #10,d0
- move.l #status,d1
- add.l d1,d0
- bsr putstr
- move.l 172(a4),a3
- adda.l a3,a3
- adda.l a3,a3
- move.l #script,d0
- tst.l 40(a3)
- beq.s clic5
- move.l #interact,d0
- clic5 bsr putstr
- move.l #backg,d0
- tst.l 44(a3)
- bne.s clic6
- move.l #foreg,d0
- clic6 bsr putstr
- bsr bytedec
- move.l 4(a5),d0
- bsr putstr
- moveq #49,d1
- bsr tab
- move.b #' ',d0
- bsr putchar
- move.l 128(a4),d0
- beq.s noprogloadc
- clic3 move.l 172(a4),d1
- bne.s clic4
- noprogloadc move.l #longnix,d0
- bsr putnam
- bra.s clic0
- clic4 lsl.l #2,d1
- move.l d1,a4
- move.l 60(a4),d1
- beq.s noprogloadc
- move.l 16(a4),d0
- bsr putbcpl
- bsr newline
-
- clic0 subq.b #1,entries
- bne clic1
- clic8 rts
-
- *--------- interrupts ------------
- showint lea iheader(PC),a0
- bsr puthead
- lea intnames(PC),a5
- lea inttyp(PC),a4
- moveq #0,d1
- moveq #15,d5
- move.l _SysBase(PC),a3
- lea 84(a3),a3 ;SysBase->IntVects[16]
-
- si0 tst.b 0(a4,d1)
- bne.s si4
- move.l 8(a3),a2 ;IntVector->iv_Node
- bra.s si5
- si4 move.l 0(a3),a2 ;Interrupt->is_Node
- si5 cmp.l #0,a2
- beq nxtint
- tst.b 0(a4,d1)
- beq.s si1
- si2 move.l 0(a2),a2 ;is_Node->ln_Next
- tst.l 0(a2)
- beq.s nxtint
- si1 move.l a2,d0
- move.l d0,node
- 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
- move.l a3,-(a7)
- bsr plusmins
- move.l #intserv,d0
- tst.b 0(a4,d1)
- bne.s 1$
- move.l #inthand,d0
- 1$ bsr putstr
- move.l #intdis,d0
- move.w $dff01c,d3
- btst.w d1,d3
- beq.s 2$
- move.l #inten,d0
- 2$ bsr putstr
- move.l (a7)+,a3
- move.l a5,d0
- bsr putstr
- move.l 10(a2),d0 ;Interrupt->ln_Name
- bsr putnam
- tst.b 0(a4,d1)
- bne.s si2
- tst.l 0(a2)
- beq.s nxtint
- move.l 0(a2),a2
- bra si1
- nxtint addq #1,d1
- lea 12(a5),a5
- lea 12(a3),a3
- dbf d5,si0
- rts
-
- *--------- resident ------------
-
- showresi lea rheader(PC),a0
- bsr puthead
- move.l _SysBase(PC),a5
- move.l 300(a5),a5 ;SysBase->ResModules
-
- r1 tst.l 0(a5)
- beq r2
- move.l 0(a5),d0 ;Resident->ln_Next
- tst.l d0
- bpl.s r3
- bclr #31,d0
- movea.l d0,a5
- bra.s r1
- r3 movea.l d0,a4
- move.l d0,node
- bsr hexa
- move.b 13(a4),d3 ;rt_Pri
- bsr plusmins
- move.b 10(a4),d0 ;rt_Flags
- bsr bin
- move.b 11(a4),d3 ;rt_Version
- bsr bytedec
- move.b 12(a4),d0 ;rt_Type
- bsr gettype
- move.l 14(a4),d0 ;rt_Name
- bsr putnam
- r4 addq #4,a5
- bra r1
- r2 rts
-
- *--------- ports -------------
-
- showprt lea pheader(PC),a0
- bsr puthead
- move.l _SysBase(PC),a4
- lea 392(a4),a4 ;SysBase->PortList
- lea buffer,a5
- moveq #0,d5
- CALL Forbid,_SysBase(PC)
- move.w #$4000,$dff09a
- sp2 move.l 0(a4),a4 ;mp_Node.ln_Next
- tst.l 0(a4)
- beq.s sp20
- bsr getpdata
- bra.s sp2
- sp20 tst.b tports
- bne.s sp15
- move.l _SysBase(PC),a4
- move.l 276(a4),a4 ;sysbase->ThisTask
- lea 92(a4),a4 ;process->pr_MsgPort
- bsr getpdata
- move.l _SysBase(PC),a2
- lea 406(a2),a2
- sp11 move.l 0(a2),a2
- tst.l 0(a2)
- beq.s sp14
- lea 92(a2),a4
- cmp.b #13,8(a2)
- bne.s sp11
- bsr getpdata
- bra sp11
- sp14 move.l _SysBase(PC),a2
- lea 420(a2),a2
- sp12 move.l 0(a2),a2
- tst.l 0(a2)
- beq.s sp15
- lea 92(a2),a4
- cmp.b #13,8(a2)
- bne.s sp12
- bsr getpdata
- bra sp12
- sp15 move.w #-$4000,$dff09a
- CALL Permit,_SysBase(PC)
- lea buffer,a5
- sp3 tst.b d5
- beq sp6
- move.l 0(a5),d0
- move.l d0,node
- bsr hexa
- move.l 4(a5),d0
- bsr putstr
- moveq #25,d1
- bsr tab
- move.b 8(a5),d0
- and.l #3,d0
- mulu #9,d0
- add.l #mp_flags,d0
- bsr putstr
- move.b 9(a5),d3
- bsr bytedec
- move.b 14(a5),d3
- cmp.b #255,d3
- bne.s 1$
- move.l #toomuch,d0
- bsr putstr
- bra.s 2$
- 1$ bsr bytedec
- 2$ move.l #longnix,d0
- move.l 10(a5),d1
- beq.s sp8
- move.l d1,a3
- move.l 10(a3),d0
- sp8 bsr putnam
- lea 16(a5),a5
- subq.b #1,d5
- bra sp3
- sp6 rts
-
- getpdata move.l a4,0(a5)
- move.l 10(a4),4(a5) ;ln_Name
- move.b 14(a4),8(a5) ;mp_Flags
- move.b 15(a4),9(a5) ;mp_SigBit
- move.l 16(a4),10(a5) ;mp_SigTask
- moveq #0,d0
- movea.l 20(a4),a3 ;mp_MsgList
- sp10 movea.l 0(a3),a3
- cmpa.l #0,a3
- beq.s sp9
- addq.b #1,d0
- cmp.b #255,d0
- bne.s sp10
- sp9 move.b d0,14(a5)
- lea 16(a5),a5
- addq.b #1,d5
- rts
- *-------- resources ------------
-
- showres lea lheader(PC),a0
- bsr puthead1
- lea resnam(PC),a0
- bsr puthead2
- move.l _SysBase(PC),d5
- add.l #336,d5 ;SysBase->ResourceList
- bsr show
- rts
-
- *--------- devices -------------
-
- showdevs lea lheader(PC),a0
- bsr puthead1
- lea devnam(PC),a0
- bsr puthead2
- move.l _SysBase(PC),d5
- add.l #350,d5 ;SysBase->DeviceList
- bsr show
- rts
-
- *-------- libraries -------------
-
- showlibs lea lheader(PC),a0
- bsr puthead1
- lea libnam(PC),a0
- bsr puthead2
- move.l _SysBase(PC),d5
- add.l #378,d5 ;SysBase->LibList
-
- show lea buffer,a5
- clr.b entries
- CALL Forbid,_SysBase(PC)
- move.l d5,a4
- sl1 move.l 0(a4),a4 ;lib_Node.ln_Next
- tst.l 0(a4)
- beq.s sl2
- addq.b #1,entries
- move.l a4,0(a5)
- move.l 10(a4),4(a5) ;ln_Name
- move.b 33(a4),8(a5) ;lib_OpenCnt
- move.b 21(a4),9(a5) ;lib_Version
- move.b 23(a4),10(a5) ;lib_Revision
- move.b 14(a4),11(a5) ;lib_Flags
- lea 12(a5),a5
- bra.s sl1
- sl2 CALL Permit,_SysBase(PC)
-
- lea buffer,a5
- dl3 tst.b entries
- beq.s sl4
- move.l 0(a5),d0
- move.l d0,node
- bsr hexa
- move.b 8(a5),d3
- bsr bytedec
- move.b 9(a5),d3
- bsr bytedec
- move.b 10(a5),d3
- bsr bytedec
- move.b 11(a5),d0
- bsr bin
- move.l 4(a5),d0
- bsr putnam
- lea 12(a5),a5
- subq.b #1,entries
- bra.s dl3
- sl4 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
- tst.b d7
- bne.s 2$
- 1$ move.l a5,a1
- CALL FindResident,_SysBase(PC)
- tst.l d0
- beq fn5
-
- 2$ move.l _SysBase(PC),a3
- move.l 300(a3),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,a4
- 5$ tst.l (a4)+
- bgt.s 5$
-
- 6$ move.l d0,a1
- clr.w 0(a1) ;rt_MatchTag
- move.l a4,d0
- sub.l a3,d0
- lsr #2,d0
- subq #1,d0
- lea -4(a3),a1
- 7$ move.l (a3)+,(a1)+
- dbf d0,7$
- rts
-
- ;find the first entry in the device-list
- ;returns a1 = pointer to first entry
-
- devinfo move.l dosbase(PC),a1
- move.l 34(a1),a1
- move.l 24(a1),a1
- adda.l a1,a1
- adda.l a1,a1
- move.l 4(a1),a1
- rts
-
- ;unlock a file
- unlock tst.b fromfile
- bne ul6
- bsr readhex
- tst.b d7
- beq syntax
- move.l d0,remembr
- move.l d0,-(a7)
- moveq #-1,d6
- bsr of44
- tst.l remembr
- beq.s ul1
- move.l #unlerr,d0
- bsr putnam
- bra ul4
- ul1 bsr ResumeOutput
- move.l #unl1,d0
- bsr putstr
- move.l 0(a7),d0
- bsr getpath
- move.l #unltxt2,d0
- bsr putstr
- bsr readline
- ori.b #$20,inputbuffer
- cmp.b #'y',inputbuffer
- bne.s ul5
- move.l 0(a7),d1
- CALL UnLock,dosbase
- ul5 bsr freefinfo
- ul4 addq #4,a7
- ul6 rts
- ;---------- Show all Locks------------
- locks moveq #0,d6
- bra.s of33
-
- ;---------- Open Files-----------
- openfiles moveq #1,d6
- of33 move.l mytask(PC),a4
- move.l 184(a4),inputbuffer
- move.l #-1,184(a4)
- lea ofheader(PC),a0
- bsr puthead
- of44 bsr allocfinfo
- bsr devinfo
- move.l a1,a3
- of1 adda.l a3,a3
- adda.l a3,a3
- cmp.l #2,4(a3)
- bne of2
- move.l 40(a3),d0
- lsl.l #2,d0
- move.l d0,a4
- moveq #0,d3
- move.b (a4)+,d3
- subq #1,d3
- lea buffer,a5
- of22 move.b (a4)+,(a5)+
- dbf d3,of22
- move.b #':',(a5)+
- clr.b 0(a5)
- cmp.l #'RAM ',buffer
- bne.s of5
- cmp.l #'Disk',buffer+4
- bne.s of5
- move.l #$4d3a0000,buffer+2
- of5 move.l #buffer,d1
- move.l #-2,d2
- CALL Lock,dosbase(PC)
- tst.l d0
- bne.s of6
- move.l #buffer,d0
- bsr putstr
- move.l #nomount,d0
- bsr putnam
- bra of2
-
- of6 move.l d0,-(a7)
- lsl.l #2,d0
- move.l d0,a5
- of4 move.l 0(a5),d0
- cmp.l #50,d0
- ble of3
- move.l d0,d5
- lsl.l #2,d5
- move.l d5,a5
- move.l d0,d5
- tst d6
- bpl.s of45
-
- cmp.l remembr(PC),d0
- bne.s of4
- clr.l remembr
- move.l (a7)+,d1
- CALL UnLock,dosbase(PC)
- bra quitof
-
- of45 move.l 8(a5),d4
- bsr getfinfo
- move.l finfoptr,a4
-
- tst.l d6
- beq.s of8
- bmi.s of8
- tst.l 4(a4)
- bpl of4
- of8 move.l d5,d0
- move.l d0,node
- bsr hexa
- move.l #access,d0
- cmp #-2,d4
- beq.s of7
- addq #8,d0
- of7 bsr putstr
- tst.l 4(a4)
- bmi.s of9
- move.l #longnix,d0
- bsr putstr
- bra of10
- of9 move.l 124(a4),d0
- bsr longdec
- of10 move.l d5,d0
- bsr getpath
- bra of4
-
- bsr newline
- of3 move.l (a7)+,d1
- CALL UnLock,dosbase(PC)
- of2 move.l 0(a3),a3
- cmpa.l #0,a3
- bne of1
- bsr freefinfo
- quitof move.l mytask(PC),a4
- move.l inputbuffer,184(a4)
- rts
-
- ;---------- Dos Devices ----------
-
- devices lea ddheader(PC),a0
- bsr puthead
- bsr devinfo
- dev1 adda.l a1,a1
- adda.l a1,a1
- clr.b d6
- tst.l 4(a1)
- bne dev2
- move.l 40(a1),d0
- bsr putbcpl
- moveq #10,d1
- bsr tab
- cmp.l #20,28(a1)
- ble dev9
- moveq #1,d6
- move.l 28(a1),a3
- adda.l a3,a3
- adda.l a3,a3
- cmp.l #20,8(a3)
- ble dev9
- move.l 8(a3),a2
- adda.l a2,a2
- adda.l a2,a2
- move.l 12(a2),d3
- movem.l a1-a3,-(a7)
- bsr bytedec
- movem.l (a7)+,a1-a3
- moveq #1,d3
- move.l 20(a2),d0
- bsr longdec
- move.l 40(a2),d0
- beq.s devs20
- addq #1,d0
- sub.l 36(a2),d0
- devs20 bsr longdec
- move.l 44(a2),d0
- bsr longdec
- bra.s dev8
- dev9 move.l #notfile,d0
- bsr putstr
- dev8 tst.l 8(a1)
- beq.s dev6
- move.l #devload,d0
- bra.s dev5
- dev6 move.l #devnload,d0
- dev5 bsr putstr
- tst.b d6
- beq.s dev7
- move.l 4(a3),d0
- bne.s dev4
- dev7 move.l 16(a1),d0
- bne.s dev4
- tst.l 8(a1)
- beq.s dev11
- move.l 8(a1),a3
- move.l -82(a3),d0
- bsr putstr
- bra dev11
- dev4 bsr putbcpl
- dev11 bsr newline
- dev2 move.l 0(a1),a1
- cmpa.l #0,a1
- bne dev1
- rts
-
- ; Check if a named dos-device is mounted
- ; name in 'buffer'.
- ; Result: d0 = 0(false) anything else(true).
-
- finddev bsr devinfo
- fdev1 adda.l a1,a1
- adda.l a1,a1
- clr.b d6
- tst.l 4(a1)
- bne.s fdev2
- move.l 40(a1),a2
- lea buffer,a0
- bsr strbcmp
- tst d0
- bne.s fdev3
- fdev2 move.l 0(a1),a1
- cmpa.l #0,a1
- bne.s fdev1
- fdev3 rts
-
- ; Re-assign a drive to dos
-
- freedrive clr.l dp_Arg1
- bra ldr3
-
- ; Inhibit a disk drive
-
- lockdrive move.l #1,dp_Arg1
- ldr3 bsr getstr
- bsr finddev
- bne.s ldr1
- ldr2 move.l #buffer,d0
- bsr putstr
- move.l #nomount,d0
- bsr putstr
- move.l #dishelp,d0
- bra putnam
- ldr1 move.l #buffer,d1
- CALL DeviceProc,dosbase(PC)
- tst.l d0
- beq.s ldr2
- move.l d0,a0
- move.l #31,dp_Type
- bra cons1
-
- ;display the current directory of all processes,
- ;except Workbench.(Worbench pr_CurrentDir is not a lock)
-
- currentdir lea wbname(PC),a1
- CALL FindTask,_SysBase(PC)
- move.l d0,wbaddr
- lea cdheader(PC),a0
- bsr puthead
- bsr allocfinfo
- moveq #0,d5
- bsr getaskdat
- lea buffer,a5
- cd2 tst.b entries
- beq.s cd6
- cmp.b #13,8(a5)
- bne.s cd5
- move.l wbaddr(PC),d0
- cmp.l 0(a5),d0
- beq.s cd5
- move.l 4(a5),d0
- bsr putstr
- moveq #15,d1
- bsr tab
- move.l 0(a5),a4
- move.l 152(a4),d0
- cd1 bsr getpath
- cd5 subq.b #1,entries
- lea 16(a5),a5
- bra.s cd2
- cd6 bsr freefinfo
- rts
-
- ;Change the current directory setting of a process
-
- cd tst.b fromfile
- bne cd10
- move.l a0,-(a7)
- lea wbname(PC),a1
- CALL FindTask,_SysBase(PC)
- move.l d0,wbaddr
- move.l (a7)+,a0
- bsr getstr
- move.l a0,-(a7)
- move.l #buffer,d1
- move.l #-2,d2
- CALL Lock,dosbase(PC)
- move.l (a7)+,a0
- tst.l d0
- bne cd16
- move.l #dnotf,d0
- bra putnam
- cd16 move.l d0,remembr
- move.l a0,-(a7)
- bsr allocfinfo
- move.l remembr(PC),d0
- bsr getfinfo
- move.l finfoptr,a5
- move.l (a7)+,a0
- tst.l 4(a5)
- bpl.s cd11
- move.l #notdir,d0
- bsr putnam
- bra cd18
- cd11 bsr nodenam
- moveq.l #2,d7
- lea TRuNode(PC),a4
- bsr findnam
- tst.b d7
- beq.s cd15
- move.l d0,a5
- cmp.b #13,8(a5)
- beq.s cd15
- bsr syntax
- bra cd18
- cd15 cmp.l wbaddr,d0
- bne.s cd13
- move.l #wberr,d0
- bsr putnam
- bra cd12
- cd13 move.l 152(a5),d1
- move.l remembr,152(a5)
- move.l d1,remembr
- cd12 tst.l remembr
- beq.s cd14
- bsr ResumeOutput
- move.l #unltxt,d0
- bsr putstr
- move.l remembr(PC),d0
- bsr getpath
- move.l #unltxt2,d0
- bsr putstr
- bsr readline
- ori.b #$20,inputbuffer
- cmp.b #'y',inputbuffer
- bne.s cd14
- cd18 move.l remembr(PC),d1
- beq.s cd14
- CALL UnLock,dosbase(PC)
- cd14 bsr freefinfo
- cd10 rts
-
- ;Display the list of inputhandlers. It adds a dummy
- ;input handler, grabs the list header, and removes it
-
- inphand tst.b background
- bne.s inph1
- bsr installh
- inph1 move.l #500,d4
- lea InInterrupt(PC),a0
- inph2 tst.l 4(a0)
- beq.s inph3
- move.l 4(a0),a0
- dbf d4,inph2
- inph3 tst.b background
- bne.s inph4
- movem.l d4/a0,-(a7)
- bsr removeh
- movem.l (a7)+,d4/a0
- inph4 cmp.w #-1,d4
- bne.s inph5
- move.l #failed,d0
- bra putnam
- inph5 move.l a0,-(a7)
- lea inheader(PC),a0
- bsr puthead
- move.l (a7)+,a5
- inph6 move.l 0(a5),a5
- tst.l 0(a5)
- beq.s inph7
- move.l a5,d0
- move.l d0,node
- 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
-
- ;get all screen pointers.
- ;result: d5=number of screens
- ; buffer+100 holds pointers.
-
- getscr lea scrheader(PC),a0
- bsr puthead
- getscr2 move.l intuibase(PC),a2
- move.l 60(a2),a2
- lea buffer+100,a1
- move.w #$4000,$dff09a
- moveq #0,d5
- sr1 move.l a2,(a1)+
- move.l 0(a2),a2
- addq.l #1,d5
- cmpa.l #0,a2
- bne.s sr1
- subq #1,d5
- move.w #-$4000,$dff09a
- rts
-
- ;display screen addresses and titles
-
- screens bsr getscr
- moveq #1,d6
- lea buffer+100,a1
- sr2 move d6,d3
- bsr bytedec
- move.l 0(a1),d0
- move.l d0,node
- bsr hexa
- move.l (a1)+,a2
- move.l 22(a2),d0
- bsr putnam
- addq #1,d6
- dbf d5,sr2
- rts
-
- ;display window addresses and titles
-
- windows clr.b bool
- windows1 bsr getscr
- tst.b bool
- beq.s wn20
- move.l d5,-(a7)
- lea fohead(PC),a0
- bsr puthead
- move.l (a7)+,d5
- wn20 lea buffer+100,a4
- wn2 move.l #onscr,d0
- bsr putstr
- move.l (a4)+,a2
- move.l 22(a2),d0
- bsr putnam
- move.l 4(a2),a1
- moveq #0,d6
- wn1 cmpa.l #0,a1
- beq.s wn3
- addq #1,d6
- move.l d6,d3
- bsr bytedec
- move.l a1,d0
- move.l d0,node
- bsr hexa
- move.l 32(a1),d0
- bsr putnam
-
- tst.b bool
- beq.s wn21
- move.l a1,-(a7)
- move.l 50(a1),a1
- move.l 52(a1),a1
- bsr fontdata
- move.l (a7)+,a1
-
- wn21 move.l 0(a1),a1
- bra.s wn1
- wn3 dbf d5,wn2
- rts
-
- ;close a specified screen
-
- closescreen bsr getscr2
- moveq #1,d6
- cmp.b #'$',0(a0)
- bne.s cs1
- bsr readhex
- tst d7
- beq syntax
- move.l d0,d4
- csin moveq #0,d6
- cs1 lea buffer+100,a2
- cs5 tst 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
- tst d0
- beq.s cs3
- cs4 dbf d5,cs5
- move.l #scnofound,d0
- bra putnam
- cs3 move.l -4(a2),a0
- CALL CloseScreen,intuibase(PC)
- rts
-
- ;close a specified window
- closewindow bsr getwnptr
- clw move.l a4,d0
- beq.s cwend
- cw3 tst.l 36(a4)
- beq.s cw8
- move.l 36(a4),a0
- move.w 28(a0),d0
- and.w #$4000,d0
- beq.s cw9
- move.l a4,a0
- CALL FreeSysRequest,intuibase(PC)
- rts
- cw9 move.l a4,a1
- CALL EndRequest,intuibase(PC)
- bra.s cw3
- cw8 move.l a4,a0
- moveq #0,d0
- CALL ModifyIDCMP,intuibase(PC)
- move.l a4,a0
- CALL CloseWindow,intuibase(PC)
- cwend rts
-
-
- getwnptr bsr getscr2
- moveq #1,d6
- cmp.b #'$',0(a0)
- bne.s cw1
- bsr readhex
- tst d7
- bne.s cwin
- bsr syntax
- bra.s cwerr
- cwin move.l d0,d4
- moveq #0,d6
- cw1 lea buffer+100,a2
- cw5 move.l (a2)+,a4
- move.l 4(a4),a4
- cw6 cmpa.l #0,a4
- beq.s cw4
- tst d6
- bne.s cw2
- cmp.l a4,d4
- beq.s cw10
- bra.s cw7
- cw2 move.l 32(a4),a1
- bsr strcmp
- tst d0
- beq.s cw10
- cw7 move.l 0(a4),a4
- bra.s cw6
- cw4 dbf d5,cw5
- move.l #winnofound,d0
- bsr putnam
- cwerr suba.l a4,a4
- cw10 rts
-
- windowoff movem.l d1-d7/a0-a6,-(a7)
- bsr getscr2
- bsr cwin
- move.l a4,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 (a7)+,d1-d7/a0-a6
- rts
-
- closetskwin movem.l d1-d7/a0-a6,-(a7)
- ctw0 bsr getscr2
- lea buffer+100,a2
- ctw1 move.l (a2)+,a4
- move.l 4(a4),a4
- ctw6 cmpa.l #0,a4
- beq.s ctw4
- move.l 86(a4),a0
- move.l 16(a0),d1
- cmp.l d0,d1
- bne.s ctw7
- move.l d0,d1
- move.l a4,d0
- bsr windowoff
- move.l d1,d0
- bra ctw0
- ctw7 move.l 0(a4),a4
- bra.s ctw6
- ctw4 dbf d5,ctw1
- movem.l (a7)+,d1-d7/a0-a6
- rts
-
- ;Change the font from a specified Window
-
- setfont bsr nodenam
- tst.b 0(a5)
- beq syntax
- move.l a5,a4
- 1$ cmp.b #33,(a4)+
- bge.s 1$
- tst.b -1(a4)
- beq syntax
- clr.b -1(a4)
-
- lea dummy,a0
- move.l a5,0(a0)
- move.b procnum(PC),d0
- ext.w d0
- move.w d0,4(a0)
- clr.w 6(a0)
- CALL OpenFont,gfxbase(PC)
- tst.l d0
- bne.s 2$
- lea diskfont(PC),a1
- CALL OpenLibrary,_SysBase(PC)
- move.l d0,d5
- beq.s 4$
- move.l d0,a6
- lea dummy,a0
- XREF _LVOOpenDiskFont
- jsr _LVOOpenDiskFont(a6)
- move.l d0,d4
- move.l d5,a1
- CALL CloseLibrary,_SysBase(PC)
- move.l d4,d0
- bne.s 2$
- 4$ move.l #fonterr,d0
- bsr putstr
- move.l dummy,d0
- bra putnam
- 2$ move.l d0,-(a7)
- move.l a4,a0
- bsr kllblnks
- bsr getwnptr
- move.l (a7)+,a0
- move.l a4,d1
- bne.s 5$
- move.l a0,a1
- CALL CloseFont,gfxbase(PC)
- bra.s 3$
- 5$ move.l 50(a4),a1
- CALL SetFont,gfxbase(PC)
- move.l a4,a0
- CALL RefreshWindowFrame,intuibase(PC)
- 3$ rts
-
-
- ;display windows and associated fonts
-
- windowfonts move.b #1,bool
- bra windows1
-
- ;display loaded font names and definitions
-
- fonts lea fohead(PC),a0
- bsr puthead
- move.l gfxbase(PC),a1
- move.l $8c(a1),a1
- fo1 tst.l 0(a1)
- beq.s fo3
- bsr fontdata
- move.l 0(a1),a1
- bra fo1
- fo3 rts
-
- fontdata move.l a1,d0
- move.l d0,node
- bsr hexa
- move.w 30(a1),d3
- bsr bytedec
- move.w 20(a1),d3
- bsr bytedec
- move.w 24(a1),d3
- bsr bytedec
- move.l #romfnt,d0
- btst #1,23(a1)
- beq.s fod1
- move.l #diskfnt,d0
- fod1 bsr putstr
- 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 getnum
- tst.b d7
- bne.s st1
- move.b timeout(PC),d3
- bne.s 1$
- move.l #timenotset,d0
- bra.s sy1
- 1$ move.l #whattime,d0
- bsr putstr
- bsr bytedec
- bra newline
- st1 move.b d2,timeout
- rts
- syntax move.l #synerr,d0
- sy1 bra putnam
-
- ;copy a string from input to 'buffer'
- ;a0 = pointer to string
-
- getstr lea buffer,a5
- gst2 cmp.b #' ',0(a0)
- beq.s gst1
- cmp.b #10,0(a0)
- beq.s gst1
- move.b (a0)+,(a5)+
- bra.s gst2
- gst1 clr.b 0(a5)
- bra kllblnks
-
- ;read in a nodename or a processname
-
- nodenam bsr isdec
- move.b d2,procnum
- nodenam2 bsr kllblnks
- move.l a0,a5
- gno1 cmp.b #10,(a0)+
- bne.s gno1
- move.b #0,-1(a0)
- rts
-
- ;modify a task's priority
-
- taskpri bsr getnum
- tst.b d7
- beq syntax
- move.b d2,newpri
- bsr nodenam
- moveq.l #2,d7
- lea TRuNode(PC),a4
- bsr findnam
- tst.b d7
- beq.s tp1
- move.l d0,a1
- move.b newpri,d0
- CALL SetTaskPri,_SysBase(PC)
- tp1 rts
-
- ;set the priority of our task
-
- mypri bsr getnum
- tst.b d7
- beq syntax
- move.l _SysBase(PC),a1
- move.l 276(a1),a1
- move.l d2,d0
- CALL SetTaskPri,_SysBase(PC)
- 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.b fromfile
- beq.s cancel1
- rts
- cancel1 clr.l remembr ;used for CLI stdio
- clr.l remembr2
- clr.b bool
- bsr nodenam
- testagain moveq.l #1,d7
- lea TReNode(PC),a4
- bsr findnam
- tst.b d7
- bne.s canok
- cnerr move.l #stperr,d0
- bra putnam
-
- canok move.l d0,a1 ;d0=task
- move.l d0,pointer
- cmp.b #1,8(a1) ;TASK ?
- bne.s isproc
- CALL RemTask,_SysBase(PC)
- move.l pointer(PC),d0
- bra closetskwin
-
- isproc movem.l d0-d7/a0-a6,-(a7)
- move.l #-1,d0 ;needed for recursive killing tasks
- CALL AllocSignal,_SysBase(PC)
- moveq #0,d1
- bset d0,d1
- move.l d1,cancelbit
- move.l d0,cancelbnum
- movem.l (a7)+,d0-d7/a0-a6
-
- moveq #0,d5
- tst.l $ac(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 $ac(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 ;yes,get Cli-Window locks
- move.l 56(a2),remembr2
- bra dosreturn
- wascreproc tst.b bool ;it is not a CLI, ask what to do
- bne unload
- move.b #3,bool
- bsr ResumeOutput
- move.l #canerr0,d0 ;ask for Workbench
- bsr putstr
- bsr readline
- cmp.b #'y',inputbuffer
- beq.s andagain
- move.b #2,bool
- bsr ResumeOutput
- move.l #canerr1,d0 ;ask for unload
- bsr putstr
- bsr readline
- cmp.b #'y',inputbuffer
- bne.s andagain
- move.b #1,bool
- andagain move.l pointer(PC),d0
- moveq.l #1,d7
- lea TReNode(PC),a4
- bsr tstnode
- tst d5
- beq cnerr
- bra canok
-
- unload move.l 128(a1),d4 ;get Segmentlist
- beq.s unl3
- lsl.l #2,d4
- move.l d4,a3
- move.l 12(a3),d4
- unl3 tst.l d4
- bne.s unl4
- move.l #unloaderr,d0 ;no Segments !?
- bra putnam
-
- unl4 cmp.b #3,bool ;Workbench Task
- bne.s unl2
- move.l a1,-(a7)
- moveq #40,d0 ;build a copy of the
- move.l #$10000,d1 ;Workbench startup-message
- CALL AllocMem,_SysBase(PC)
- move.l d0,startmess
- move.l (a7)+,a1
- move.l d0,a0
- move.b #5,8(a0)
- move.w #20,18(a0)
- move.l d4,24(a0)
- move.l a1,d0
- add.l #92,d0
- move.l d0,20(a0)
- movem.l a0-a1,-(a7)
- lea wbname(PC),a1
- CALL FindPort,_SysBase(PC)
- movem.l (a7)+,a0-a1
- move.l d0,14(a0)
-
- unl2 cmp.b #1,bool
- bne.s dosreturn
- move.l a1,-(a7) ;unload process manualy
- move.l d4,d1
- CALL UnLoadSeg,dosbase(PC)
- move.l (a7)+,a1
-
- dosreturn move.l 140(a1),savedat ;Processnumber
- dosret1 move.w #$4000,$dff09a
- move.l 54(a1),a3
- move.l #endtask,0(a3)
- move.l #2,106(a1)
- move.l mytask(PC),108(a1)
- cmp.b #4,15(a1) ;if waiting
- bne.s doswait
- move.l a1,d4
- CALL Remove,_SysBase(PC)
- move.l d4,a1
- lea 406(a6),a0 ; activate the task
- CALL AddHead,_SysBase(PC)
- move.l d4,a1
- doswait move.w #-$4000,$dff09a
- tst.b bool
- bne.s endnodos
- tst.l d5
- beq endcanc
- move.l $ac(a1),a2
- adda.l a2,a2
- adda.l a2,a2
- dwa1 movem.l d0-d7/a0-a6,-(a7)
- move.l cancelbit(PC),d0
- CALL Wait,_SysBase(PC)
- movem.l (a7)+,d0-d7/a0-a6
- moveq #0,d5
- bra dosret1
-
- endcanc move.l a1,-(a7)
- move.l remembr(PC),d1 ;close CLI-Window
- beq.s ecan1 ;if any
- CALL Close,dosbase(PC)
- ecan1 move.l remembr2(PC),d1
- beq.s ecan2
- CALL Close,dosbase(PC)
- ecan2 move.l (a7)+,a1
-
- move.l savedat(PC),d0 ;remove Task from
- move.l dosbase(PC),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 cancelbnum(PC),d0 ;remove our Signal
- CALL FreeSignal,_SysBase(PC)
- rts
-
- ;This Code is (hopefully) excuted by the Process we want
- ;to kill
-
- endtask CALL Forbid,_SysBase(PC)
- CALL Disable,_SysBase(PC)
- move.l _SysBase(PC),a1
- move.l 276(a1),a1
- move.l 176(a1),a1 ;Process_ReturnAddr
- lea -4(a1),a7 ;reset Process Stackptr
- tst.b bool
- bne.s et0
- movea.l mytask(PC),a1
- move.l cancelbit(PC),d0 ;signal Xoper it
- CALL Signal,_SysBase(PC) ;died
- et0 cmp.b #3,bool ;Workbench Process ?
- bne.s et1
- move.l startmess(PC),a1
- CALL ReplyMsg,_SysBase(PC) ;reply startup message
- et1 rts
-
- ;Stop a task (just queue it on a special list)
-
- freeze bsr nodenam
- moveq.l #1,d7
- lea TReNode(PC),a4
- bsr findnam
- tst.b d7
- bne.s frok
- move.l #stperr,d0
- bra putstr
- frok move.w #$4000,$dff09a
- move.l d0,a1
- CALL Remove,_SysBase(PC)
- move.w #-$4000,$dff09a
- move.l d0,a1
- move.l d0,a5
- lea stplist(PC),a0
- CALL AddHead,_SysBase(PC)
- 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(PC),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(PC),a0
- movea.l a5,a1
- moveq #0,d7
- bsr fn4
- tst.b d7
- bne.s waok
- 2$ move.l #waerr,d0
- bra putstr
- waok move.w #$4000,$dff09a
- move.l d0,a1
- CALL Remove,_SysBase(PC)
- move.l d0,a1
- move.l d0,a5
- move.l TReNode,a0
- cmp.b #8,15(a1)
- bne.s wa1
- move.l TWaNode,a0
- wa1 adda.l _SysBase(PC),a0
- CALL AddTail,_SysBase(PC)
- move.l d0,a1
- subq.b #4,15(a5)
- move.w #-$4000,$dff09a
- move.l 18(a5),d0
- and.l 26(a5),d0
- beq.s wa2
- movea.l a5,a1
- CALL Signal,_SysBase(PC)
- wa2 rts
- ;show the hunks of a process
- hunks bsr nodenam
- moveq.l #2,d7
- lea TRuNode(PC),a4
- bsr findnam
- tst.b d7
- bne.s hu1
- rts
- hu1 move.l d0,a4
- cmp.b #13,8(a4)
- beq.s hu2
- move.l #noprocs,d0
- bra putnam
- hu2 move.l 128(a4),d0
- beq.s noprogload
- lsl.l #2,d0
- move.l d0,a3
- move.l 12(a3),d1
- beq.s hu3
- move.l #segloaded,d0
- bsr putnam
- bra hu5
- hu3 move.l 172(a4),d1
- bne.s hu4
- noprogload move.l #notload,d0
- bra putnam
- hu4 move.l #cliprocs,d0
- bsr putnam
- lsl.l #2,d1
- move.l d1,a4
- move.l 60(a4),d1
- beq.s noprogload
- move.l #procloaded,d0
- bsr putstr
- move.l 16(a4),d0
- bsr putbcpl
- bsr newline
- hu5 lea hunkheader(PC),a0
- bsr puthead
- moveq #0,d5
- hu6 move.l d5,d3
- bsr bytedec
- addq #1,d5
- move.l d1,d0
- bsr hexa
- lsl.l #2,d1
- move.l d1,a4
- move.l d1,d0
- addq.l #4,d0
- bsr hexa
- move.l -4(a4),d0
- bsr hexa
- bsr newline
- move.l 0(a4),d1
- bne.s hu6
- rts
- ;change the priority of a node
- pri bsr getnum
- tst.b d7
- beq syntax
- move.b d2,newpri
- bsr nodenam2
- moveq.l #5,d7
- lea DevNode(PC),a4
- bsr findnam
- tst.b d7
- beq.s pi1
- move.l d0,a1
- move.b newpri,9(a1)
- cmp.l #SemNode,a4
- ble.s pi2
- move.l #listerr,d0
- bra putnam
- pi2 CALL Forbid,_SysBase(PC)
- CALL Remove,_SysBase(PC)
- move.l d0,a1
- move.l a4,a0
- move.l 0(a0),d6
- lea 0(a6,d6),a0
- CALL Enqueue,_SysBase(PC)
- CALL Permit,_SysBase(PC)
- pi1 rts
- ;set all break signals of a task
- break move.l #$f000,d0
- bra setthem
-
- signal bsr readhex
- tst.b d7
- beq syntax
- setthem move.l d0,savedat
- bsr nodenam
- moveq.l #2,d7
- lea TReNode(PC),a4
- bsr findnam
- tst.b d7
- beq.s pi1
- move.l d0,a1
- move.l savedat,d0
- and.l 18(a1),d0
- CALL Signal,_SysBase(PC)
- 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(PC),a2
- move.l a2,d3
- hid0 tst.l 0(a2)
- beq.s hid1
- move.l 0(a2),a2
- lea 4(a2),a1
- bsr strcmp
- tst d0
- beq.s hid2
- move.l a2,d3
- bra.s hid0
- hid1 move.l a0,a4
- bsr strlen2
- addq #5,d0
- move.l #65536,d1
- CALL AllocMem,_SysBase(PC)
- tst.l d0
- beq.s hid4
- move.l d0,a1
- move.l d0,0(a2)
- addq #4,a1
- hid3 cmp.b #10,0(a4)
- beq.s hid4
- move.b (a4)+,(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 #5,d0
- move.l a2,a1
- CALL FreeMem,_SysBase(PC)
- rts
-
- freehidmem move.l hidestart(PC),a4
- fhm0 move.l a4,d0
- beq.s fhm1
- move.l a4,a2
- move.l 0(a2),a4
- bsr freehidden
- bra fhm0
- fhm1 rts
-
- ;set up an ALIAS list
- alias cmp.b #10,0(a0)
- beq showalias
- bsr strbuf
- move.l a0,a5
- lea buffer,a0
- bsr strlen
- tst.l d0
- beq syntax
-
- moveq #1,d1
- cmp d1,d0
- bne.s 5$
- lea params(PC),a0
- moveq #parmnum-1,d1
- move.b buffer,d2
- 6$ cmp.b (a0)+,d2
- dbeq d1,6$
- tst.w d1
- bmi.s 5$
- move.l #aliaserr,d0
- bsr putstr
- move.l #params,d0
- bsr putstr
- move.l #aliaserr2,d0
- bra putnam
-
- 5$ move.l d0,d5
- move.l a5,a0
- adda.l d0,a0
- bsr kllblnks
- move.l a5,-(a7)
- bsr findcmd
- move.l (a7)+,a5
- tst.l d2
- bmi syntax
- move.l a5,a0
- bsr strbuf
-
- addq #6,d5
- move.l d5,d0
- move.l #65536,d1
- CALL AllocMem,_SysBase(PC)
- tst.l d0
- beq.s 1$
-
- move.l aliaslist(PC),d1
- bne.s 2$
- move.l d0,aliaslist
- bra.s 3$
- 2$ move.l d1,a0
- move.l 0(a0),d1
- bne.s 2$
- move.l d0,0(a0)
-
- 3$ move.l d0,a0
- move.b d2,4(a0)
-
- lea 5(a0),a0
- lea buffer,a1
- 4$ move.b (a1)+,(a0)+
- bne.s 4$
- 1$ rts
-
- showalias lea alhead(PC),a0
- bsr puthead
- move.l aliaslist(PC),d0
- beq.s 1$
- 2$ move.l d0,a5
- addq #5,d0
- bsr putstr
- move.w #15,d1
- bsr tab
- move.l #equal,d0
- bsr putstr
- move.b 4(a5),d0
- ext.w d0
- bsr getcmdptr
- bsr putnam
- move.l 0(a5),d0
- bne.s 2$
- 1$ rts
-
- freealias move.l aliaslist(PC),a4
- 1$ move.l a4,d0
- beq.s 2$
- move.l a4,a2
- move.l 0(a2),a4
- lea 5(a2),a0
- bsr strlen
- addq #6,d0
- move.l a2,a1
- CALL FreeMem,_SysBase(PC)
- bra 1$
- 2$ rts
-
- getcmdptr move.l a0,-(a7)
- lea commds(PC),a0
- 2$ tst d0
- beq.s 1$
- 3$ tst.b (a0)+
- bne.s 3$
- subq #1,d0
- bra.s 2$
- 1$ move.l a0,d0
- move.l (a7)+,a0
- rts
-
-
- ;'flushlibs'
- flush move.l #$ffffff,d0
- moveq #0,d1
- CALL AllocMem,_SysBase(PC)
- flsh1 rts
-
- ;display library->lib_IDString
- info bsr nodenam2
- moveq.l #2,d7
- lea DevNode(PC),a4
- bsr findnam
- tst.b d7
- beq.s flsh1
- move.l d0,a0
- move.l 24(a0),d0
- beq.s if1
- move.l d0,d1
- andi.l #1,d1
- bne.s if1
- bra putnam
- if1 move.l #noinfo,d0
- bsr putstr
- move.l a5,d0
- bra putnam
-
- capture move.l _SysBase(PC),a1
- lea 42(a1),a0
- moveq #2,d6
- lea coldtxt,a4
- cap0 move.l a4,d0
- bsr putstr
- move.l 0(a0),d0
- bne.s cap1
- move.l #unset,d0
- bsr putstr
- bra cap2
- cap1 bsr hexa
- cap2 bsr newline
- lea 15(a4),a4
- addq #4,a0
- dbf d6,cap0
-
- move.l #kicktxt,d0
- bsr putstr
- move.l 546(a1),a0
- cmpa.l #0,a0
- bne.s kickm3
- move.l #unset,d0
- bra putnam
- kickm3 move.l a0,-(a7)
- bsr newline
- lea kickhead(PC),a0
- bsr puthead
- move.l (a7)+,a0
- kickm0 move.l a0,d0
- beq kickm4
- bpl.s kickm1
- bclr #31,d0
- move.l d0,a0
- bra.s kickm0
- kickm1 move.w 14(a0),d6
- subq #1,d6
- lea 16(a0),a2
- kickm2 move.l 0(a2),d0
- bsr hexa
- move.l 0(a2),d0
- move.l 4(a2),d4
- add.l d4,d0
- bsr hexa
- move.l d4,d0
- clr.b d3
- bsr longdec
- bsr newline
- addq #8,a2
- dbf d6,kickm2
- move.l 0(a0),a0
- bra kickm0
- kickm4 rts
-
- clrcold move.l _SysBase,a0
- clr.l 42(a0)
- bra.s chksum
- clrcool move.l _SysBase,a0
- clr.l 46(a0)
- bra.s chksum
- clrwarm move.l _SysBase,a0
- clr.l 50(a0)
-
- chksum lea 34(a0),a1
- move #22,d0
- addchk add (a1)+,d1
- dbf d0,addchk
- not 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 tst.w repeat
- bne.s 2$
- move.w repeatlen(PC),d0
- subq #7,d0
- move.w d0,repeatlen
- lea repeatbuffer,a1
- lea dummy,a2
- move.w d0,d1
- ext.l d1
- 1$ move.b 0(a0),(a1)+
- move.b (a0)+,(a2)+
- dbf d1,1$
-
- clr.l lastprinted
- clr.b printed
- move.w #1,repeat
- bsr cli
- tst.b printed
- beq.s 2$
- bsr starttimer
- rts
- 2$ clr.w repeat
- rts
-
- ;save the parameters from a 'window x y width height' call
- setwindow tst.b fromfile
- bne.s wiw1
- wiw3 move.l #wiwerr,d0
- bra putnam
- wiw1 lea window_l(PC),a3
- moveq #3,d5
- wiw0 bsr getnum
- tst d7
- beq.s wiw2
- move.w d2,0(a3)
- addq #2,a3
- dbf d5,wiw0
- wiw2 rts
-
- ;display ExecBase->LastAlert
- lastalert movem.l $100,d1-d2
- tst.l d1
- bne.s al1
- move.l _SysBase(PC),a0
- movem.l 514(a0),d1-d2
- al1 move.l #gurutxt,d0
- bsr putstr
- move.l d1,d0
- bsr hexa
- lea out,a0
- move.l ptr(PC),d0
- move.b #'.',-1(a0,d0)
- move.l d2,d0
- bsr hexa
- bra newline
-
- ;toggle CPUSE task list
- usage bchg #0,usageflag
- rts
-
- ;toggle task-header display on/off
- nohead bchg #0,headon
- rts
-
- ;toggle hide entries on/off
- hidden bchg #0,hideon
- rts
-
- ;toggle sort on/off
- sort bchg #0,sorton
- rts
-
- ;toggle task-ports display on/off
- taskports bchg #0,tports
- clo1 rts
-
- ;Open a library
- openlib bsr nodenam2
- move.l a5,a1
- moveq #0,d0
- CALL OpenLibrary,_SysBase(PC)
- tst.l d0
- beq fn5
- opli1 rts
-
-
- ;close it
- closelib bsr nodenam2
- moveq #0,d7
- lea LibNode(PC),a4
- bsr findnam
- tst.b d7
- beq.s clo1
- move.l d0,a1
- CALL CloseLibrary,_SysBase(PC)
- rts
-
- remnode bsr nodenam2
- moveq #7,d7
- lea TReNode(PC),a4
- bsr findnam
- tst.b d7
- beq.s 1$
- CALL Disable,_SysBase(PC)
- move.l d0,a1
- CALL Remove,_SysBase(PC)
- CALL Enable,_SysBase(PC)
- 1$ rts
-
- ;end Xoper but stay in background
- hold addq #4,a7
- bra.s instback
- quithold lea in,a0
- lea dummy,a1
- qh1 move.b (a1)+,d0
- move.b d0,(a0)+
- cmp.b #10,d0
- bne.s qh1
-
- instback tst.b background
- bne.s cleanit
- move.b #1,background
- bsr installh
- cleanit move.l fileptr(PC),d1
- beq.s ib1
- CALL Close,dosbase(PC)
- clr.l fileptr
- ib1 clr.b running
- bsr killpage
- bsr freeblank
- tst.l wnptr
- beq.s 5$
- tst.b ownscreen
- bne.s 6$
- move.l wnptr(PC),a0
- move.l 4(a0),window_l
- move.l 8(a0),window_w
- 6$ move.l wnptr(PC),a0
- CALL CloseWindow,intuibase(PC)
- clr.l intuimsg
- clr.l wnptr
- 5$ tst.b ownscreen
- beq.s 4$
- move.l screenptr(PC),a0
- CALL CloseScreen,intuibase(PC)
- clr.l screenptr
-
- 4$ tst.b iconifyon
- beq.s 1$
- jsr iconify
- bra.s 2$
-
- 1$ move.l mysignal(PC),d0
- or.l trapsignal(PC),d0
- CALL Wait,_SysBase(PC)
- 2$ move.b #1,running
- and.l trapsignal(PC),d0
- beq.s 3$
- move.b #1,gotguru
- 3$ bra restart
-
- ;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(PC),a0
- clr.l parmtxt
- lea 322(a0),a0
- move.w #$4000,$dff09a
- clr1 move.l 0(a0),a0
- tst.l 0(a0)
- beq.s clr4
- move.l 16(a0),a1
- clr2 tst.l 0(a1)
- beq.s clr1
- addq.l #1,parmtxt
- move.l 4(a1),d1
- subq.l #8,d1
- beq.s clr31
- lsr.l #2,d1
- subq.l #1,d1
- lea 8(a1),a2
- clr3 move.l d0,(a2)+
- dbf d1,clr3
- clr31 move.l 0(a1),a1
- bra.s clr2
- clr4 move.w #-$4000,$dff09a
- move.l parmtxt(PC),d0
- bsr bytedec
- move.l #clrtxt,d0
- bra putnam
-
- ;change the number of maximum lines in the history buffer
- historylines
- bsr getnum
- tst.b d7
- beq syntax
- move.w d2,maxhlines
- move.w hnum(PC),d0
- 1$ cmp.w maxhlines(PC),d0
- ble.s 2$
- bsr remhistline
- subq #1,d0
- bra.s 1$
- 2$ move.l history+8,curhist
- move.w d0,hnum
- 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 #1,d2
- 1$ move.w d2,minnumchars
- rts
- ;display all lines in the history buffer
- showhistory move.l history(PC),a5
- moveq #1,d5
- 1$ tst.l 0(a5)
- beq.s 2$
- move.l d5,d3
- bsr bytedec
- move.w 8(a5),d0
- ext.l d0
- lea 10(a5),a0
- lea inputbuffer,a1
- CALL CopyMem,_SysBase(PC)
- move.w 8(a5),d0
- lea inputbuffer,a1
- clr.b 0(a1,d0.w)
- move.l a1,d0
- bsr putnam
- addq #1,d5
- move.l 0(a5),a5
- 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
- rts
-
- ;find a named node
- ;d7 = number of lists to search through
- ;a4 = pointer to the first entry in the
- ; list-offset-table
- ;a5 = pointer to name
- ;returns:
- ;d7 = TRUE/FALSE 1/0
- ;d0 = node
-
- findnam tst.b 0(a5)
- bne.s 1$
- move.l #nameerr,d0
- bsr putnam
- 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 tstnode
- tst.l d5
- bne.s fn3
- bra fn5
- fn6 move.l d2,d7
- fn2 move.l _SysBase(PC),a0
- adda.l 0(a4),a0
- move.l a5,a1
- fn4 CALL FindName,_SysBase(PC)
- tst.l d0
- bne.s fn1
- addq #4,a4
- dbf d7,fn2
- fn5 move.l #namerr,d0
- bsr putstr
- move.l a5,d0
- bsr putnam
- fnerr clr.b d7
- rts
- fn1 move.b procnum(PC),d2
- beq.s fn3
- move.l d0,a0
- cmp.b 143(a0),d2
- bne.s fn4
- fn3 moveq.l #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.b fromfile
- bne.s illegalhex
- move.l d0,d1
- btst #0,d1
- beq.s inrange
- move.l #adrerr,d0
- bsr putnam
- illegalhex moveq #0,d5
- rts
- inrange movem.l d7/a4,-(a7)
- cmp.l #TRuNode,a4
- bne.s inrange1
- move.l _SysBase(PC),a0
- cmp.l 276(a0),d0
- beq.s nodefound
- subq #1,d7
- addq #4,a4
- inrange1 move.w #$4000,$dff09a
- getlist move.l _SysBase(PC),a0
- add.l 0(a4),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 #4,a4
- dbf d7,getlist
- move.w #-$4000,$dff09a
- movem.l d0/d7/a4,-(a7)
- bsr ResumeOutput
- move.l #noderr,d0
- bsr putnam
- bsr readline
- movem.l (a7)+,d0/d7/a4
- cmp.b #'y',inputbuffer
- beq.s nodefound1
- moveq #0,d5
- movem.l (a7)+,d7/a4
- rts
- nodefound move.w #-$4000,$dff09a
- nodefound1 move.b #1,d5
- etst movem.l (a7)+,d7/a0
- rts
-
- ;allocate FileInfoBlock
- allocfinfo move.l #260,d0
- moveq #0,d1
- CALL AllocMem,_SysBase(PC)
- move.l d0,finfoptr
- rts
-
- ;free FileInfoBlock
- freefinfo move.l #260,d0
- move.l finfoptr(PC),d1
- beq.s 1$
- move.l d1,a1
- CALL FreeMem,_SysBase(PC)
- 1$ rts
-
- ;Examine ,d0=Lock
- getfinfo move.l d0,d1
- move.l finfoptr,d2
- CALL Examine,dosbase(PC)
- rts
-
- ;construct a Pathname from a lock
- ;d0=Lock ,resulting string is written to window
- getpath movem.l d1-d7/a0-a6,-(a7)
- move.l d0,d1
- beq.s 1$
- CALL DupLock,dosbase(PC)
- 1$ lea out,a4
- clr.b -(a4)
- gp0 move.l d0,-(a7)
- bsr getfinfo
- move.l finfoptr,a0
- move.l 4(a0),d4
- addq #8,a0
- bsr strlen
- lea -1(a4),a5
- tst.l d4
- bmi.s nodir
- move.b #'/',-(a4)
- nodir subq #1,d0
- bmi.s nofnam
- gp1 move.b 0(a0,d0),-(a4)
- dbf d0,gp1
- nofnam move.l 0(a7),d1
- CALL ParentDir,dosbase(PC)
- move.l d0,d4
- move.l (a7)+,d1
- beq.s 2$
- CALL UnLock,dosbase(PC)
- 2$ move.l d4,d0
- bne gp0
- putall cmp.b #'/',0(a5)
- bne.s gp2
- move.b #':',0(a5)
- gp2 move.l a4,d0
- bsr putnam
- movem.l (a7)+,d1-d7/a0-a6
- rts
- strlen move.l a0,-(a7)
- move.l #-1,d0
- strl2 addq.l #1,d0
- tst.b (a0)+
- bne.s strl2
- move.l (a7)+,a0
- rts
- strlen2 move.l a0,-(a7)
- move.l #-1,d0
- strl22 addq.l #1,d0
- cmp.b #10,(a0)+
- bne.s strl22
- move.l (a7)+,a0
- rts
-
- ;write a title and underline
- ;a0 = pointer to text
- puthead1 bsr strlen
- move.l d0,d5
- move.l a0,d0
- bra putstr
-
- puthead2 bsr strlen
- add.l d0,d5
- bra.s ph2
-
- puthead bsr strlen
- move.l d0,d5
- ph2 move.l a0,d0
- bsr putnam
- lea out,a0
- move.l a0,d0
- ph1 move.b #'-',(a0)+
- dbf d5,ph1
- move.b #$0a,(a0)+
- clr.b 0(a0)
- bra putstr
-
- ;move cursor to a column
- ;d0 = current position
- ;d1 = column
- tab move.l a3,-(a7)
- lea out,a3
- sp5 cmp.b d1,d0
- bcc.s sp4
- move.b #' ',0(a3,d0)
- addq.b #1,d0
- bra.s sp5
- sp4 move.l d1,ptr
- move.l (a7)+,a3
- rts
-
- ;convert ascii to byte
- ;a0 = pointer to text
- ;d0 = byte
- getnum cmp.b #'$',0(a0)
- bne.s isdec
- bsr readhex
- move.l d0,d2
- rts
- isdec moveq #0,d2
- move.l d2,d3
- move.l d2,d6
- move.l d2,d7
- cmp.b #'-',0(a0)
- bne.s gn1
- addq #1,a0
- moveq.l #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 tst.b d7
- bne.s gn4
- subq #1,a0
- gn4 rts
-
- ;convert hex to longword
- ;a0 = pointer to text
- ;returns d0=value
- ;d7 = ok/error 1/0
- readhex movem.l d1-d6/a1-a5,-(a7)
- moveq #1,d7
- cmp.b #'$',0(a0)
- bne.s rh3
- addq #1,a0
- rh3 moveq #0,d0
- cmpi.b #10,0(a0)
- beq.s rherr
- lea hextab(pc),a1
- rh0 move.b (a0)+,d3
- moveq.l #15,d2
- rh1 cmp.b 0(a1,d2),d3
- beq.s rh2
- dbf d2,rh1
- bra 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 (a7)+,d1-d6/a1-a5
- rts
-
- ;skip blanks
- ;a0 pointer to text
- ; returns a0 = new pointer position
- kllblnks cmpi.b #' ',0(a0)
- bne.s gn4
- addq #1,a0
- bra.s kllblnks
-
- ; exit program. If background flag is set, wait for
- ; amiga-amiga-x
-
- stopall addq #4,a7
- bra exitall
-
- exit tst.b background
- bne quithold
- exitall bsr killpage
- bsr freeblank
- bsr killhistory
- move.l stplist(PC),a3
- tst.l 0(a3)
- beq.s ex0
- move.l a3,d0
- bsr waok
- bra.s exitall
-
- ex0 tst.b background
- beq.s ex1
- bsr removeh
-
- ex1 move.l _SysBase(PC),a1
- move.l #_LVOSwitch,a0
- move.l oldswitch,d0
- CALL SetFunction,_SysBase(PC)
- moveq #3,d0
- lea IOCounter(PC),a1
- CALL RemIntServer,_SysBase(PC)
-
- move.l replyport(PC),-(a7)
- LIBCALL DeletePort
- addq #4,a7
- bsr stoptimer
- lea timerio,a1
- CALL CloseDevice,_SysBase(PC)
- move.l timerport(PC),-(a7)
- LIBCALL DeletePort
- addq #4,a7
-
- bsr restoretrap
-
- tst.l wnptr
- beq.s 5$
- move.l wnptr(PC),a0
- CALL CloseWindow,intuibase(PC)
- 5$ tst.b ownscreen
- beq.s 6$
- move.l screenptr(PC),a0
- CALL CloseScreen,intuibase(PC)
- clr.l screenptr
-
- 6$ move.l fileptr(PC),d1
- beq.s ex11
- CALL Close,dosbase(PC)
- ex11 bsr freehidmem
- bsr freealias
- move.l realstack(PC),a7
- IFND DEBUG
- CALL Forbid,_SysBase(PC)
- move.l wbmsg(PC),d0
- beq.s todos
- move.l d0,a1
- CALL ReplyMsg,_SysBase(PC)
- moveq #0,d0
- rts
-
- todos move.l myseg(PC),d1
- CALL UnLoadSeg,dosbase(PC)
- ENDC
- moveq #0,d0
- rts
-
- ;print a bcpl-string
- ;d0 = bcpl-pointer to bcpl-string
- putbcpl movem.l d3/a0-a1,-(a7)
- tst.l d0
- beq.s pb1
- lsl.l #2,d0
- move.l d0,a1
- moveq #0,d3
- move.b (a1)+,d3
- subq #1,d3
- move.l ptr(PC),d0
- lea out,a0
- pb2 move.b (a1)+,0(a0,d0)
- beq.s 1$
- addq.b #1,d0
- dbf d3,pb2
- 1$ move.l d0,ptr
- pb1 movem.l (a7)+,d3/a0-a1
- rts
-
- ;compare strings
- ;a0/a1 = pointers to string
- ;returns d0 = true(0) false(1), d1 = length
- strcmp movem.l a0-a1,-(a7)
- moveq #0,d0
- move.l d0,d1
- src2 move.b (a0)+,d0
- beq.s src1
- cmp.b #10,d0
- beq.s src1
- addq #1,d1
- cmp.b (a1)+,d0
- beq.s src2
- bra.s src3
- src1 move.b 0(a1),d0
- src3 movem.l (a7)+,a0-a1
- rts
-
- strbuf movem.l d0/a1-a2,-(a7)
- move.l a0,a1
- lea buffer,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 (a7)+,d0/a1-a2
- 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,-(a7)
- moveq #0,d0
- moveq #0,d1
- adda.l a2,a2
- adda.l a2,a2
- move.b (a2)+,d1
- beq.s stb1
- subq #1,d1
- stb2 cmp.b (a2)+,(a0)+
- bne.s stb1
- dbf d1,stb2
- moveq #1,d0
- stb1 movem.l (a7)+,d1/a0/a2
- rts
-
- ;convert long to decimal
- ;d0 = value
- ;d3 bit 0 = left/right justified
- ;d3 bit 1 = write/leave
- ;returns string in 'buffer'
- longdec movem.l d1-d2/a1-a2,-(a7)
- lea binarea+8(PC),a1
- move.l #' ',-8(a1)
- move.l #' ',-4(a1)
- clr.b 0(a1)
- subq #1,a1
- cmp #2,d3
- bne.s ld5
- clr.b 0(a1)
- ld5 moveq #1,d2
- ld2 addq #1,d2
- moveq #$a,d1
- bsr div
- addi.l #$30,d1
- move.b d1,-(a1)
- tst.l d0
- bne.s ld2
-
- btst #0,d3
- bne.s ld1
- lea binarea(PC),a2
- cmpa.l a2,a1
- bne.s ld3
- subq.l #1,ptr
- bra.s ld1
- ld3 move.b 0(a1),(a2)+
- move.b #' ',(a1)+
- dbf d2,ld3
- ld1 cmp #2,d3
- beq.s ld4
- move.l #binarea,d0
- bsr putstr
- ld4 movem.l (a7)+,d1-d2/a1-a2
- rts
-
- ;write UBYTE
- ;d3 = value
- bytedec bsr dec
- move.l #decimal,d0
- bra.s pm1
-
- ;write signed byte
- ;d3 = value
- plusmins movem.l d5/a3,-(a7)
- move.w #$2020,minus
- 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 (a7)+,d5/a3
- move.l #minus+1,d0
- pm1 bra putstr
-
- dec movem.l d3/a3,-(a7)
- move.l #$20202020,decimal
- and.l #$ff,d3
- lea decimal+3(PC),a3
- bloop tst.b d3
- beq.s bend
- divu #10,d3
- swap d3
- ori.b #'0',d3
- move.b d3,-(a3)
- clr.w d3
- swap d3
- bra.s bloop
- bend cmpa.l #decimal+3,a3
- bne 1$
- move.b #'0',-(a3)
- 1$ move.l a3,d0
- movem.l (a7)+,d3/a3
- rts
-
- ;write a string, move cursor into next line
- ;d0 = pointer to text
- putnam bsr putstr
- putnam1 tst.b d0
- beq.s ncr
- bsr newline
- ncr rts
-
- ;write one char
- ;d0 = char
- putchar movem.l d1/a0,-(a7)
- move.l ptr(PC),d1
- lea out,a0
- move.b d0,0(a0,d1)
- addq.l #1,ptr
- movem.l (a7)+,d1/a0
- rts
-
- ;write a string, strings are only put into the output buffer when
- ;a LF is detected
- ;d0 = pointer to string
- ;returns d0 = cursor position
- putstr movem.l d1-d7/a0-a6,-(a7)
- move.b #1,printed
- move.l d0,a2
- lea out,a3
- move.l ptr(PC),d0
- move.l a2,d5
- bne pst1
- lea longnix(PC),a2
-
- pst1 move.b (a2)+,d1
- cmpi.b #13,d1
- beq pst1
- cmpi.b #10,d1
- beq.s lineend
- move.b d1,0(a3,d0)
- beq prend
- cmp #100,d0
- bge.s pst1
- addq #1,d0
- bra.s pst1
-
- lineend tst.b fromfile
- beq.s 1$
- moveq #0,d0
- bra prend
-
- 1$ tst.l lastprinted
- bne.s 2$
- bsr killpage
-
- 2$ addq #1,d0
- move.l d0,-(a7)
- add #14,d0
- moveq #0,d1
- CALL AllocMem,_SysBase(PC)
- move.l (a7)+,d1
- tst.l d0
- beq prend
- move.l d0,a0
- move.w d1,12(a0)
- cmp.w maxllength(PC),d1
- ble.s 7$
- move.w d1,maxllength
- 7$ move.l node,8(a0)
- clr.l node
- clr.l 0(a0)
-
- move.l lastprinted(PC),d0
- move.l d0,4(a0)
- bne.s 3$
- move.l a0,outchain
- bra.s 4$
- 3$ move.l d0,a1
- move.l a0,0(a1)
- 4$ move.l a0,lastprinted
- move.b #' ',14(a0)
- subq #1,d1
- lea 15(a0),a0
- lea out,a1
- subq #1,d1
- bmi.s 6$
- 5$ move.b (a1)+,(a0)+
- dbf d1,5$
- 6$ move.l numlines(PC),d2
- cmp.l maxlines(PC),d2
- ble.s 8$
-
- move.l outchain(PC),a1
- move.l 0(a1),a2
- move.l a2,outchain
- clr.l 4(a2)
- move.w 12(a1),d0
- add.w #14,d0
- ext.l d0
- CALL FreeMem,_SysBase(PC)
- bra.s 9$
-
- 8$ addq.l #1,d2
- move.l d2,numlines
-
- 9$ moveq #0,d0
- move.l d0,d5
- tst.b addlines
- beq pst1
- bsr addline
- bra pst1
- prend move.l d0,ptr
- movem.l (a7)+,d1-d7/a0-a6
- rts
-
- ;Kill output buffer
- killpage movem.l d0-d7/a0-a6,-(a7)
- tst.l outchain
- beq.s 2$
- move.l outchain(PC),a1
- bsr killlines
- clr.l outchain
- clr.l lastprinted
- clr.l numlines
- clr.w maxllength
- 2$ movem.l (a7)+,d0-d7/a0-a6
- rts
-
- ;kill the remainder of the output buffer
- killlines move.l 0(a1),-(a7)
- move.w 12(a1),d0
- ext.l d0
- add #14,d0
- CALL FreeMem,_SysBase(PC)
- move.l (a7)+,a1
- move.l a1,d7
- bne.s killlines
- rts
-
- freeblank move.l blanks(PC),d0
- beq.s 1$
- move.l d0,a1
- move.w colms(PC),d0
- ext.l d0
- CALL FreeMem,_SysBase(PC)
- clr.l blanks
- 1$ rts
-
- ;write a portion of the output buffer to the screen
- blastout move.l rastport(PC),a1
- moveq #1,d0
- CALL SetAPen,gfxbase(PC)
- move.l rastport(PC),a1
- moveq #1,d0
- CALL SetDrMd,gfxbase(PC)
- moveq #0,d7
-
- move.w loffset(PC),d2
- beq.s 7$
- move.w colms(PC),d4
- add.w d4,d2
- move.w maxllength(PC),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
-
- 7$ bsr tstfirstlin
-
- 1$ tst.l outchain
- beq.s 3$
- bsr findline
-
- 2$ move.w colms(PC),d5
- ext.l d5
- move.w loffset(PC),d4
- ext.l d4
- moveq #18,d6
- 6$ lea 14(a5,d4),a0
- move.w 12(a5),d3
- ext.l d3
- bsr blastline
- bge.s 3$
- tst.l 0(a5)
- beq.s 5$
- move.l 0(a5),a5
- bra 6$
- 5$ moveq #0,d3
- bsr blastline
- bcs.s 5$
- 3$ rts
-
- ;get a pointer to a line (line # in d0)
- findline move.l outchain(PC),d1
- beq 2$
- move.l d1,a5
- 1$ tst d0
- beq.s 2$
- tst.l 0(a5)
- beq.s 2$
- move.l 0(a5),a5
- dbf d0,1$
- 2$ rts
-
- ;check if the display is as 'full' as possible
- tstfirstlin move.l firstline(PC),d0
- move.l d0,d2
- add.w rows(PC),d2
- cmp.l numlines(PC),d2
- bmi.s 1$
- move.l numlines(PC),d2
- sub.w rows(PC),d2
- bpl.s 4$
- moveq #0,d2
- 4$ move.l d2,d0
- move.l d2,firstline
- 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 d6,d1
- moveq #6,d0
- move.l rastport(PC),a1
- CALL Move,gfxbase(PC)
- 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$
- CALL Text,gfxbase(PC)
- 6$ move.l d5,d0
- sub.l d3,d0
- ble.s 5$
- move.l blanks(PC),a0
- move.l rastport(PC),a1
- CALL Text,gfxbase(PC)
- 5$ addq #8,d6
- addq #1,d7
- cmp.w rows(PC),d7
- rts
-
- ;Write pointer, display '-------' if empty
- hexan tst.l d0
- bne.s hexa
- bra putstr
-
- ;Write 8 byte hex value
- ;d0 = value
- hexa bsr gthex
- bra putstr
-
- gthex movem.l d1-d7/a0-a6,-(a7)
- moveq.l #7,d5
- lea hexarea(PC),a1
- lea hextab(PC),a0
- moveq #0,d2
- hexloop move.b d0,d2
- and.b #15,d2
- move.b 0(a0,d2),0(a1,d5)
- lsr.l #4,d0
- dbf d5,hexloop
- move.l a1,d0
- movem.l (a7)+,d1-d7/a0-a6
- rts
-
- ;Convert/write byte into binary string
- ;d0 = value
- bin movem.l d1-d7/a0-a6,-(a7)
- lea binarea(PC),a0
- move.w #$2020,8(a0)
- moveq.l #7,d4
- binloop moveq.l #'0'/2,d1
- roxr.b #1,d0
- roxl.b #1,d1
- move.b d1,0(a0,d4)
- dbf d4,binloop
- move.l a0,d0
- movem.l (a7)+,d1-d7/a0-a6
- bra putstr
-
- ;send a packet
- ;a0 = msgport
- ;dp_Type and dp_Arg1 have to be inizialized
- cons1 movem.l d0-d7/a0-a6,-(a7)
- move.l #dp_Link,LN_NAME
- move.l #mypacket,dp_Link
- move.l replyport(PC),dp_Port
- lea mypacket,a1
- CALL PutMsg,_SysBase(PC)
- move.l replyport,a0
- CALL WaitPort,_SysBase(PC)
- move.l replyport(PC),a0
- CALL GetMsg,_SysBase(PC)
- movem.l (a7)+,d0-d7/a0-a6
- rts
-
- ;32-bit division
- ;d0 / d1
- ;returns d0
- div movem.l d2-d3,-(a7)
- tst.l d1
- beq div8
- swap d1
- move.w d1,d2
- bne.s div1
- swap d0
- swap d1
- swap d2
- move.w d0,d2
- beq.s div2
- divu d1,d2
- move.w d2,d0
- div2 swap d0
- move.w d0,d2
- divu d1,d2
- move.w d2,d0
- swap d2
- move.w d2,d1
- bra div8
- div1 moveq #$10,d3
- cmpi.w #$80,d1
- bcc.s div3
- rol.l #8,d1
- subq.w #8,d3
- div3 cmpi.w #$800,d1
- bcc.s div4
- rol.l #4,d1
- subq.w #4,d3
- div4 cmpi.w #$2000,d1
- bcc.s div5
- rol.l #2,d1
- subq.w #2,d3
- div5 tst.w d1
- bmi.s div6
- rol.l #1,d1
- subq.w #1,d3
- div6 move.w d0,d2
- lsr.l d3,d0
- swap d2
- clr.w d2
- lsr.l d3,d2
- swap d3
- divu d1,d0
- move.w d0,d3
- move.w d2,d0
- move.w d3,d2
- swap d1
- mulu d1,d2
- sub.l d2,d0
- bcc.s div7
- subq.w #1,d3
- add.l d1,d0
- div7 moveq #0,d1
- move.w d3,d1
- swap d3
- rol.l d3,d0
- swap d0
- exg d1,d0
- div8 movem.l (a7)+,d2-d3
- rts
-
- ;install a input-handler
- installh pea 0
- pea xopsleep
- LIBCALL CreatePort
- addq #8,a7
- move.l d0,InputMsg
- move.l d0,-(a7)
- LIBCALL CreateStdIO
- addq #4,a7
- move.l d0,InRequest
- move.l d0,a1
- lea devicenam(PC),a0
- moveq #0,d0
- moveq #0,d1
- CALL OpenDevice,_SysBase(PC)
- move.l d0,devstatus
- movea.l InRequest(PC),a1
- move.l #InInterrupt,40(a1)
- move.w #9,28(a1)
- CALL DoIO,_SysBase(PC)
- move.l d0,iostatus
- move.l #-1,d0
- CALL AllocSignal,_SysBase(PC)
- moveq #0,d1
- bset d0,d1
- move.l d1,mysignal
- rts
-
- ;remove handler
- removeh movea.l InRequest(PC),a1
- move.l #InInterrupt,40(a1)
- move.w #10,28(a1)
- CALL DoIO,_SysBase(PC)
- movea.l InRequest(PC),a1
- CALL CloseDevice,_SysBase(PC)
- move.l InRequest,-(a7)
- LIBCALL DeleteStdIO
- addq #4,a7
- move.l InputMsg,-(a7)
- LIBCALL DeletePort
- addq #4,a7
- rts
-
- ;this is the handler, it checks if amiga-amiga-x
- ;has been pressed and signals it to our task
- Keyhandler tst.b running
- bne.s endhandler
- cmp.b #1,4(a0)
- bne.s endhandler
- move.w 8(a0),d0
- andi.w #$c0,d0
- cmpi.w #$c0,d0
- bne.s endhandler
- cmp.w #$32,6(a0)
- bne.s endhandler
- wakeup move.l a0,-(a7)
- movea.l mytask(PC),a1
- move.l mysignal(PC),d0
- CALL Signal,_SysBase(PC)
- move.l (a7)+,a0
- clr.b 4(a0)
- endhandler move.l a0,d0
- rts
-
- snoop bsr cls
- bsr nodenam
- moveq #1,d7
- lea TReNode(PC),a4
- bsr findnam
- tst.b d7
- bne.s 1$
- move.l #stperr,d0
- bra putnam
- 1$ move.l d0,captask
- pea 0
- pea memportname
- LIBCALL CreatePort
- addq #8,a7
- move.l d0,snoopport
- beq tm6
-
- bsr replyintui
- move.b #1,addlines
- lea snoophead(PC),a0
- bsr puthead
- move.l _SysBase(PC),a1
- move.l -196(a1),oldalloc
- move.l -208(a1),oldfree
- move.l #capmalloc,d0
- move.l #-198,a0
- CALL SetFunction,_SysBase(PC)
- move.l _SysBase(PC),a1
- move.l #capmfree,d0
- move.l #-210,a0
- CALL SetFunction,_SysBase(PC)
- clr.b bool
- clr.b cbreak
-
- waitmem move.l snoopport(PC),a0
- moveq #0,d1
- move.b 15(a0),d1
- bset d1,d0
- move.l d0,auxsig
- bsr processmsgs
-
- tm7 move.l mytask(PC),a0
- move.l snoopport(PC),a0
- CALL GetMsg,_SysBase(PC)
- tst.l d0
- bne tm8
- tst.b cbreak
- bne snoopend
- bra waitmem
- tm8 move.l d0,a3
- move.l 20(a3),d3
- btst #31,d3
- beq freed
- move.l #allok,d0
- bsr putstr
- lea memname(PC),a2
- lea membit(PC),a4
- moveq #4,d5
- tm2 move.l 0(a4),d4
- btst d4,d3
- beq.s tm1
- move.l 0(a2),d0
- bsr putstr
- tm1 addq #4,a2
- addq #4,a4
- dbf d5,tm2
- moveq #26,d1
- bsr tab
- move.l 24(a3),d0
- move.l d0,d3
- bsr hexa
- move.l 28(a3),d0
- bne.s tm3
- move.l #failed,d0
- bsr putstr
- moveq #53,d1
- bsr tab
- bra tm4
- tm3 bsr hexa
- move.l 28(a3),d0
- add.l d3,d0
- bsr hexa
- bra tm4
-
- freed move.l #free,d0
- bsr putstr
- move.b #'-',d0
- moveq #18,d1
- tm9 bsr putchar
- dbf d1,tm9
- move.b #' ',d0
- bsr putchar
- 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
- move.w 18(a3),d0
- ext.l d0
- move.l a3,a1
- CALL FreeMem,_SysBase(PC)
- bra tm7
-
- snoopend move.l _SysBase(PC),a1
- move.l oldalloc(PC),d0
- move.l #-198,a0
- CALL SetFunction,_SysBase(PC)
- move.l _SysBase(PC),a1
- move.l oldfree,d0
- move.l #-210,a0
- CALL SetFunction,_SysBase(PC)
- move.l snoopport,-(a7)
- LIBCALL DeletePort
- addq #4,a7
- move.l #stoped,d0
- bsr putnam
- clr.b addlines
- clr.l auxsig
- tm6 rts
-
- memname dc.l memlarg,memclr,memfast,memchip,mempubl
- membit dc.l 17,16,2,1,0
-
- capmalloc movem.l d0-d7/a0-a6,-(a7)
- move.l _SysBase(PC),a6
- move.l 276(a6),d4
- cmp.l captask(PC),d4
- bne.s capm1
- tst.b bool
- bne capm1
- move.b #1,bool
- moveq #36,d6
- bsr allocmsg
- beq capm2
- bset #31,d1
- move.l d1,20(a5)
- move.l d0,24(a5)
- move.l 60(a7),32(a5)
- move.l a5,remembr
- movem.l (a7)+,d0-d7/a0-a6
- bsr memalloc
- movem.l d0-d7/a0-a6,-(a7)
- move.l remembr(PC),a1
- move.l d0,28(a1)
- move.l snoopport,a0
- move.b #5,8(a1)
- CALL PutMsg,_SysBase(PC)
- clr.b bool
- movem.l (a7)+,d0-d7/a0-a6
- rts
- capm2 clr.b bool
- capm1 movem.l (a7)+,d0-d7/a0-a6
- memalloc dc.w $4ef9
- oldalloc dc.l 0
-
- capmfree movem.l d0-d7/a0-a6,-(a7)
- move.l _SysBase(PC),a6
- move.l 276(a6),d4
- cmp.l captask(PC),d4
- bne.s capf1
- tst.b bool
- bne.s capf1
- move.b #1,bool
- moveq #36,d6
- bsr allocmsg
- beq.s capf2
- move.l d0,20(a5)
- move.l a1,24(a5)
- move.l 60(a7),32(a5)
- move.l snoopport,a0
- move.b #5,8(a5)
- move.l a5,a1
- CALL PutMsg,_SysBase(PC)
- capf2 clr.b bool
- capf1 movem.l (a7)+,d0-d7/a0-a6
- dc.w $4ef9
- oldfree dc.l 0
-
- allocmsg movem.l d0-d1/a0-a1,-(a7)
- move.l d6,d0
- move.l #65536,d1
- bsr memalloc
- tst.l d0
- beq.s alm1
- move.l d0,a5
- move.w d6,18(a5)
- alm1 movem.l (a7)+,d0-d1/a0-a1
- move.l a5,d6
- rts
-
- myswitch movem.l d0-d1/a0-a1,-(a7)
- move.l _SysBase(PC),a0
- move.l 276(a0),d0
- move.l tasksnum(PC),d1
- lea cputime,a0
- subq.l #1,d1
- bmi.s swadd
- sw0 cmp.l (a0)+,d0
- dbeq d1,sw0
- tst d1
- bmi.s swadd
- swi1 add.l #1,508(a0)
- swgo movem.l (a7)+,d0-d1/a0-a1
- dc.w $4ef9
- oldswitch dc.l 0
- swadd cmp.l #125,tasksnum
- bge.s swgo
- addq.l #1,tasksnum
- move.l d0,0(a0)
- move.l #1,512(a0)
- bra.s swgo
-
- countio addq.l #1,iocount
- moveq #0,d0
- cio1 rts
-
- iconbackdrp tst.b iconifyon
- beq.s 1$
- lea icnwindow,a0
- eor.l #$100,14(a0) ;wn_Flags
- 1$ rts
-
- iconifyoff tst.b iconifyon
- beq.s cio1
- clr.b iconifyon
- tst.b fromfile
- bne.s 1$
- move.l wnptr(PC),d0
- beq.s 1$
- move.l d0,a0
- lea iconifgad,a1
- CALL RemoveGadget,intuibase(PC)
- move.l wnptr(PC),a0
- CALL RefreshWindowFrame,intuibase(PC)
- 1$ move.l #iconify,d0
-
- killseg movem.l d1-d2/a0-a4,-(a7)
- subq #4,d0
- move.l 4,a6
- move.l 276(a6),a4
- move.l 128(a4),d1
- lsl.l #2,d1
- move.l d1,a3
- move.l 12(a3),d1
- bne.s 2$
- move.l 172(a4),d1
- lsl.l #2,d1
- move.l d1,a4
- move.l 60(a4),d1
-
- 2$ lsl.l #2,d1
- cmp.l d0,d1
- beq.s 4$
- move.l d1,a4
- move.l 0(a4),d1
- beq.s 5$
- bra.s 2$
-
- 4$ move.l d1,a0
- move.l 0(a0),0(a4)
- clr.l 0(a0)
- lsr.l #2,d1
- CALL UnLoadSeg,dosbase(PC)
- movem.l (a7)+,d1-d2/a0-a4
- 5$ rts
-
- alert bsr stoptimer
- move.l excpttask(PC),d0
- bne.s alert1
- move.l #noguru,d0
- bra putnam
- alert1 move.l #softfail,d0
- bsr putstr
- move.l excpttask(PC),a0
- move.l 10(a0),d0
- bsr putnam
- cmp.l #3,excpterror
- bne.s 1$
- move.l #addrserr,d0
- bsr putstr
- move.l excptaddr(PC),d0
- bsr hexa
- bsr newline
- 1$ move.l #procount,d0
- bsr putstr
- move.l excptpc(PC),d0
- bsr hexa
- bsr newline
- move.l #gurutxt,d0
- bsr putstr
- move.l excpterror(PC),d0
- bsr hexa
- lea out,a0
- move.l ptr(PC),d0
- move.b #'.',-1(a0,d0)
- move.l excpttask(PC),d0
- bsr hexa
- bra newline
-
- showguru bsr alert
- tst.b ownscreen
- bne.s 5$
- move.l wnptr(PC),a0
- CALL WindowToFront,intuibase(PC)
- bra.s 2$
- 5$ move.l screenptr,a0
- CALL ScreenToFront,intuibase(PC)
- 2$ move.l #whatnow,d0
- bsr putnam
- clr.l oldpageend
- bsr readline
-
- cmp.b #'i',inputbuffer
- beq.s 4$
- 1$ cmp.b #'k',inputbuffer
- bne.s 2$
- move.l excpttask(PC),a1
- tst.l 22(a1)
- bne.s 3$
- CALL RemTask,_SysBase(PC)
- bra.s 4$
- 3$ move.l a1,d0
- bsr canok
- 4$ clr.l lastprinted
- rts
-
- myaddtask move.l a3,-(a7)
- lea mytrap(PC),a3
- move.l 50(a1),d0
- beq.s 1$
- cmp.l oldtrap(PC),d0
- beq.s 1$
- lea myproctrap(PC),a3
- cmp.l oldproctrap(PC),d0
- bne.s 2$
- 1$ move.l a3,50(a1)
- 2$ move.l (a7)+,a3
- dc.w $4ef9
- OldAddTask dc.l 0
-
- myproctrap bsr traphandle
- dc.w $4ef9
- oldproctrap dc.l 0
-
- mytrap bsr traphandle
- moveq #0,d0
- CALL Wait,_SysBase(PC)
- dc.w $4ef9
- oldtrap dc.l 0
-
- traphandle movem.l d0-d7/a0-a6,$180
- move.l 4,a6
- move.l 276(a6),excpttask
- move.l 4(a7),d0
- cmp.l #9,d0
- beq.s 2$
- move.l d0,excpterror
- moveq #10,d1
- cmp.l #3,d0
- bne.s 1$
- move.l 0(a7,d1.w),excptaddr
- moveq #18,d1
- 1$ move.l 0(a7,d1.w),excptpc
- move.l mytask(PC),a1
- move.l trapsignal(PC),d0
- jsr _LVOSignal(a6)
- 2$ movem.l $180,d0-d7/a0-a6
- rts
-
- trapguru tst.b wanttraps
- bne restoretrap
- move.b #1,wanttraps
-
- addtraps tst.b wanttraps
- beq 5$
- move.l 304(a6),oldtrap ;Original EXEC trap handler
- moveq #-1,d0
- CALL AllocSignal,_SysBase(PC)
- moveq #0,d1
- bset d0,d1
- move.l d1,trapsignal
- move.l #_LVOAddTask,a0 ;need a new AddTask() to change
- move.l 2(a6,a0),OldAddTask ;AmigaDos's default trap handler
- move.l a6,a1
- move.l #myaddtask,d0
- CALL SetFunction,_SysBase(PC)
- CALL Forbid,_SysBase(PC) ;change the trap handler of
- moveq #0,d5 ;aleady running tasks
- bsr getaskdat ;get task stucture pointers
- 1$ tst.b entries
- beq.s 2$
- lea -16(a5),a5
- move.l 0(a5),a4 ;pointer to a task structure
- lea myproctrap(PC),a0
- move.l 50(a4),d0 ;Task->tc_TrapCode
- cmp.l oldproctrap(PC),d0 ;AmigaDos Handler ?
- beq.s 3$
- lea mytrap(PC),a0 ;EXEC Handler ?
- cmp.l oldtrap(PC),d0
- bne.s 4$ ;must be a custom one, skip it
- 3$ move.l a0,50(a4) ;replace it
- 4$ subq.b #1,entries
- bra.s 1$
- 2$ CALL Permit,_SysBase(PC)
- 5$ rts
-
- restoretrap tst.b wanttraps
- beq.s 6$
- tst.b fromfile
- bne.s 5$
- move.l #_LVOAddTask,a0
- move.l OldAddTask(PC),d0
- move.l _SysBase(PC),a1
- CALL SetFunction,_SysBase(PC)
- CALL Forbid,_SysBase(PC)
- bsr getaskdat
- 1$ tst.b entries
- beq.s 2$
- lea -16(a5),a5
- move.l 0(a5),a4
- move.l oldproctrap(PC),a0
- move.l 50(a4),d0
- cmp.l #myproctrap,d0
- beq.s 3$
- move.l oldtrap(PC),a0
- cmp.l #mytrap,d0
- bne.s 4$
- 3$ move.l a0,50(a4)
- 4$ subq.b #1,entries
- bra.s 1$
- 2$ CALL Permit,_SysBase(PC)
- clr.l trapsignal
- 5$ clr.b wanttraps
- 6$ rts
-
- ;save the contents of the output buffer
- ;to a file
- saveoutput bsr nodenam2
- tst.b 0(a5)
- beq syntax
- move.l a5,d1
- move.l #1006,d2
- CALL Open,dosbase(PC)
- move.l d0,d5
- bne.s 1$
- move.l #openerr,d0
- bsr putstr
- move.l a5,d0
- bra putnam
- 1$ move.l outchain(PC),d0
- beq.s 3$
- 2$ move.l d0,a5
- move.w 12(a5),d3
- beq.s 4$
- ext.l d3
- lea 14(a5),a1
- move.l a1,d2
- move.l d5,d1
- CALL Write,dosbase(PC)
- tst.l d0
- ble.s 3$
- 4$ moveq #1,d3
- move.l d5,d1
- move.l #cr,d2
- CALL Write,dosbase(PC)
- tst.l d0
- ble.s 3$
- move.l 0(a5),d0
- bne.s 2$
- 3$ move.l d5,d1
- CALL Close,dosbase(PC)
- rts
-
- grabtimerio lea tiohead(PC),a0
- bsr puthead
- move.b timeout(PC),d4
- move.b #255,timeout
- bsr starttimer
- move.b d4,timeout
- lea timerio,a1
- CALL Disable,_SysBase(PC)
- 2$ move.l 0(a1),d2
- beq.s 1$
- move.l d2,a1
- bra.s 2$
- 1$ CALL Enable,_SysBase(PC)
- lea -4(a1),a5
- bsr stoptimer
- lea buffer,a4
- moveq #1,d4
- bsr gettrq
-
- lea timerio,a0
- lea dummy,a1
- moveq #40,d0
- CALL CopyMem,_SysBase(PC)
-
- lea dummy,a1
- lea timernam(PC),a0
- moveq #0,d1
- moveq #0,d0
- CALL OpenDevice,_SysBase(PC)
-
- lea dummy,a1
- move.l #1<<30,32(a1)
- CALL SendIO,_SysBase(PC)
-
- lea dummy,a5
- CALL Disable,_SysBase(PC)
- 8$ move.l 0(a5),d2
- beq.s 7$
- move.l d2,a5
- bra.s 8$
- 7$ CALL Enable,_SysBase(PC)
- lea -4(a5),a5
-
- lea dummy,a1
- CALL AbortIO,_SysBase(PC)
- lea timerio,a1
- CALL WaitIO,_SysBase(PC)
- move.w timersig,d0
- moveq #0,d1
- bset d0,d1
- moveq #0,d0
- CALL SetSignal,_SysBase(PC)
-
- moveq #0,d4
- bsr gettrq
-
- lea dummy,a1
- CALL CloseDevice,_SysBase(PC)
-
- clr.l (a4)+
- lea -22(a4),a2
- moveq #18,d2
- bsr sortlist
-
- lea buffer,a5
- 5$ move.l (a5)+,d0
- beq.s 6$
- bsr hexa
- move.w (a5)+,d0
- ext.l d0
- mulu #9,d0
- add.l #timerunits,d0
- bsr putstr
- move.l (a5)+,d3
- mulu #10,d3
- move.l (a5)+,d0
- move.l #100000,d1
- bsr div
- add.l d3,d0
- cmp.l #2559,d0
- ble.s 9$
- move.l #whatsthis,d0
- bsr putstr
- bra.s 10$
- 9$ moveq #1,d6
- bsr putfrac
- 10$ move.b #' ',d0
- bsr putchar
- move.l (a5)+,a1
- move.l 10(a1),d0
- bsr putnam
- bra.s 5$
- 6$ rts
-
- gettrq CALL Disable,_SysBase(PC)
- 3$ move.l 0(a5),a5
- tst.l 0(a5)
- beq.s 4$
- move.l a5,(a4)+
- move.w d4,(a4)+
- move.l 32(a5),(a4)+
- move.l 36(a5),(a4)+
- move.l 14(a5),a1
- move.l 16(a1),(a4)+
- bra.s 3$
- 4$ CALL Enable,_SysBase(PC)
- rts
-
-
- ;check if the timer is runnig, start it if not
- starttimer lea timerio,a1
- cmp.b #5,8(a1)
- beq.s 1$
- moveq #0,d0
- move.l d0,36(a1)
- move.b timeout(PC),d0
- beq.s 1$
- move.l d0,32(a1)
- move.w #9,28(a1)
- CALL SendIO,_SysBase(PC)
- 1$ rts
- ;Abort a timer request, if pending
- stoptimer lea timerio,a1
- cmp.b #5,8(a1)
- bne.s 1$
- CALL AbortIO,_SysBase(PC)
- lea timerio,a1
- CALL WaitIO,_SysBase(PC)
- 1$ move.w timersig,d0
- moveq #0,d1
- bset d0,d1
- moveq #0,d0
- CALL SetSignal,_SysBase(PC)
- rts
- ;Xoper main loop, process all incoming messages
- processmsgs move.l wnptr(PC),a0
- moveq #0,d0
- move.w intuisig(PC),d1
- bset d1,d0
- move.w timersig(PC),d1
- bset d1,d0
- or.w #4096,d0
- or.l auxsig(PC),d0
- tst.l auxsig
- bne.s 1$
- or.l trapsignal(PC),d0
- 1$ CALL Wait,_SysBase(PC)
-
- move.l d0,tasksigs
-
- move.l trapsignal(PC),d1
- and.l d0,d1
- beq.s ctrl_c
- tst.b gotguru
- bne.s ctrl_c
- move.b #1,gotguru
- bsr showguru
- clr.b gotguru
-
- ctrl_c move.q #12,d1
- bsr testsig
- bne exit
-
-
- timermsg move.w timersig(PC),d1
- bsr testsig
- beq intuimsgs
- tst.w repeat
- bne.s 1$
- bsr showwhat
- bra.s intuimsgs
- 1$ move.w repeatlen,d0
- lea repeatbuffer,a2
- lea dummy,a1
- move.w d0,d1
- 2$ move.b (a2)+,(a1)+
- dbf d1,2$
- bsr cli
- bsr starttimer
-
- intuimsgs move.w intuisig(PC),d1
- bsr testsig
- beq processnxtmsg
- nextimsg move.l wnptr(PC),a0
- move.l $56(a0),a0
- CALL GetMsg,_SysBase(PC)
- tst.l d0
- beq processnxtmsg
- move.l d0,intuimsg
-
- move.l d0,a0
- move.l 20(a0),d0
-
- cmp.l #$200,d0 ;CloseWindow
- bne.s 1$
- tst.b addlines
- beq exitall
- move.b #1,cbreak
- bra intuiend
-
- 1$ cmp.l #2,d0 ;ResizeWindow
- bne.s 2$
- bsr setupscreen
- bra intuiend
-
- 2$ cmp.l #4,d0 ;refresh
- bne.s 22$
- bsr putiline
- bsr blastout
- bsr UpdateIArea
- bra intuiend
-
- 22$ tst.b addlines
- bne 3$
- cmp.l #$40,d0 ;gadgetup
- bne.s 3$
- tst.w getanswer
- bne.s 3$
- bsr replyintui
- bra instback
-
- 3$ cmp.l #$400,d0 ;RawKey
- bne notarawkey
- move.w #$80,d0
- and.w 24(a0),d0
- bne intuiend
- and.w #$7f,24(a0)
- lea ievent,a1
- move.b #1,4(a1)
- move.l 24(a0),6(a1)
- move.w 26(a0),qualifier
- move.l a1,a0
- lea outevent,a1
- moveq #20,d1
- suba.l a2,a2
- CALL RawKeyConvert,condev(PC)
- tst.l d0
- beq intuiend
- lea inputbuffer,a1
- lea outevent,a2
- move.w curpos(PC),d4
- moveq #0,d3
- tst.b addlines
- bne 197$
-
- cmp.b #$9b,0(a2) ;CSI
- bne 110$
-
- cmp.b #'?',1(a2) ;help
- bne.s 399$
- tst.w getanswer
- bne.s 399$
- bsr stoptimer
- tst.w bottomin
- bne.s 398$
- move.w #1,bottomin
- clr.w ibufferlen
- clr.w curpos
- bsr UpdateIArea
- 398$ move.l #usetxt,d0
- bsr putnam
- clr.l lastprinted
- bsr blastout
- bra.s 420$
-
- 399$ cmp.b #'C',1(a2) ;cursor right
- bne.s 400$
- cmp.w ibufferlen(PC),d4
- bge.s 420$
- addq #1,d4
- 421$ move.w d4,curpos
- 420$ bra 100$
-
- 400$ cmp.b #'D',1(a2) ;cursor left
- bne.s 401$
- subq #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(PC),d4
- bge.s 421$
- addq #1,d4
- cmp.b #' ',0(a1,d4)
- bne.s 404$
- 405$ cmp.w ibufferlen(PC),d4
- bge.s 421$
- addq #1,d4
- cmp.b #' ',0(a1,d4)
- 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 #1,d4
- cmp.b #' ',0(a1,d4)
- beq.s 406$
- 407$ tst.w d4
- beq.s 421$
- subq #1,d4
- cmp.b #' ',0(a1,d4)
- bne.s 407$
- addq #1,d4
- bra.s 421$
-
- 402$ cmp.b #'A',1(a2) ;cursor up
- bne.s 408$
- tst.w bottomin
- bne.s 480$
- tst.w curpos
- bne.s 480$
-
- clr.w curpos
- clr.w ibufferlen
- bsr UpdateIArea
- bsr clrcursor
- move.w edline(PC),d3
- ext.l d3
- tst.w d3
- beq.s 481$
- subq #1,d3
- cmp.l firstline(PC),d3
- bge.s 481$
- move.l d3,-(a7)
- subq.l #1,firstline
- bsr blastout
- move.l (a7)+,d3
- 481$ move.w d3,edline
- bsr getcurpos
- bsr putcursor
- bra intuiend
- 480$ move.l history(PC),a0
- tst.l 0(a0)
- beq.s 423$
- move.l curhist(PC),a1
- cmp.l a0,a1
- beq.s 409$
- move.l 4(a1),d0
- move.l d0,curhist
- 409$ move.l a1,gothline
- bsr copyhistory
- 423$ bra 100$
-
- 408$ cmp.b #'B',1(a2) ;cursor down
- bne 410$
- tst.w bottomin
- bne.s 414$
- tst.w curpos
- bne.s 414$
-
- clr.w curpos
- clr.w ibufferlen
- bsr UpdateIArea
- bsr clrcursor
- move.w edline(PC),d3
- ext.l d3
- move.l numlines(PC),d4
- subq #1,d4
- cmp.l d4,d3
- beq.s 490$
- move.l firstline(PC),d2
- add.w rows(PC),d2
- subq #1,d2
- addq #1,d3
- cmp.w d2,d3
- ble.s 490$
- move.l d3,-(a7)
- addq.l #1,firstline
- bsr blastout
- move.l (a7)+,d3
- 490$ bra 481$
- 414$ move.l curhist(PC),d0
- beq.s 423$
- move.l d0,a1
- move.l 0(a1),a1
- tst.l 0(a1)
- bne.s 411$
- clr.l gothline
- clr.w curpos
- clr.w ibufferlen
- bra 423$
- 411$ move.l a1,curhist
- bra 409$
-
- 410$ cmp.b #'T',1(a2) ;shift up
- bne.s 412$
- tst.w hnum
- beq 423$
- move.l history(PC),a1
- move.l a1,curhist
- bra 409$
-
- 412$ cmp.b #'S',1(a2) ;shift down
- bne 423$
- tst.w hnum
- beq 423$
- move.l history+8,curhist
- bra.s 414$
-
- 110$ moveq #0,d3
- 101$ move.w curpos(PC),d4
- tst d0
- beq 100$
- cmp.b #13,0(a2,d3) ;return
- beq got_enter
-
- cmp.b #27,0(a2,d3) ;esc
- bne 799$
- tst.w getanswer
- bne 100$
- clr.b insmode
- clr.w ibufferlen
- move.w #200,curpos
- bsr UpdateIArea
- clr.w curpos
- tst.w bottomin
- bne.s 700$
- move.w #1,bottomin
- bsr getcurpos
- cmp.b #5,timerstate
- bne.s 765$
- bsr starttimer
- 765$ bra 100$
-
- 700$ move.b timerio+8,timerstate
- bsr stoptimer
- move.w edline(PC),d0
- move.l firstline(PC),d4
- cmp.w d4,d0
- bmi.s 701$
- move.w d4,d5
- add.w rows(PC),d5
- cmp.w d5,d0
- bmi.s 702$
- 701$ move.w rows(PC),d0
- lsr.w #1,d0
- add.w d4,d0
- 702$ move.l numlines(PC),d3
- subq #1,d3
- cmp.w d3,d0
- ble.s 703$
- move.w d3,d0
- 703$ move.w d0,edline
- sub.w d4,d0
- lsl.w #3,d0
- add.w #18,d0
- move.w d0,cposy
- clr.w bottomin
- tst.w loffset
- beq.s 704$
- clr.w loffset
- bsr blastout
- 704$ bra 100$
-
- 799$ cmp.b #8,0(a2,d3) ;Backspace
- bne.s 114$
- tst.w d4
- beq 102$
- bsr delchar
- subq #1,d4
- move.w d4,curpos
- bra 102$
-
- 114$ cmp.b #127,0(a2,d3) ;del
- bne.s 197$
- 178$ cmp.w ibufferlen(PC),d4
- bge 102$
- addq #1,d4
- bsr delchar
- bra 102$
-
- 197$ cmp.b #3,0(a2,d3) ;ctrl c
- bne.s 104$
- move.b #1,cbreak
-
- 104$ tst.b addlines
- bne processnxtmsg
- cmp.b #$18,0(a2,d3) ;ctrl x
- bne.s 300$
- clr.w ibufferlen
- clr.w curpos
- bra 100$
-
- 300$ cmp.b #$19,0(a2,d3) ;ctrl y
- bne.s 106$
- move.w curpos,ibufferlen
- bra 100$
-
- 106$ move.w #$100,d5 ;NumPad
- and.w qualifier(PC),d5
- beq 105$
- move.l firstline(PC),d5
-
- cmp.b #'7',0(a2,d3) ;'Home'
- bne.s 200$
- moveq #0,d5
- 199$ move.l d5,firstline
- bsr blastout
- tst.w bottomin
- bne.s 196$
- move.w edline(PC),d0
- move.l firstline(PC),d1
- cmp.w d1,d0
- bmi.s 190$
- add.w rows(PC),d1
- cmp.w d1,d0
- bmi.s 192$
- 190$ clr.w curpos
- clr.w ibufferlen
- move.w rows(PC),d0
- lsr.w #1,d0
- ext.l d0
- add.l firstline(PC),d0
- cmp.l numlines(PC),d0
- bmi.s 191$
- move.l numlines(PC),d0
- subq #1,d0
- 191$ move.w d0,edline
- 192$ bsr getcurpos
- bsr UpdateIArea
- 196$ bra 100$
-
- 200$ cmp.b #'8',0(a2,d3) ;'up arrow'
- bne.s 201$
- tst d5
- beq 100$
- subq #1,d5
- bra.s 199$
-
- 201$ cmp.b #'9',0(a2,d3) ;'PgUp'
- bne.s 203$
- sub.w rows(PC),d5
- bpl.s 199$
- moveq #0,d5
- bra.s 199$
-
- 203$ cmp.b #'1',0(a2,d3) ;'End'
- bne.s 205$
- 222$ move.l numlines(PC),d5
- sub.w rows(PC),d5
- bpl 199$
- moveq #0,d5
- 204$ bra 199$
-
- 205$ cmp.b #'2',0(a2,d3) ;'down arrow'
- bne.s 206$
- move.l d5,d2
- add.w rows(PC),d2
- cmp.l numlines(PC),d2
- bge 100$
- addq #1,d5
- bra 199$
-
- 206$ cmp.b #'3',0(a2,d3) ;'PgDn'
- bne.s 500$
- add.w rows(PC),d5
- move.l d5,d2
- add.w rows(PC),d2
- cmp.l numlines(PC),d2
- bge.s 222$
- bra 199$
-
- 500$ cmp.b #'4',0(a2,d3) ;left arrow
- bne.s 501$
- tst.w bottomin
- beq 102$
- move.w loffset(PC),d2
- sub.w colms(PC),d2
- bpl.s 502$
- moveq #0,d2
- 502$ move.w d2,loffset
- bsr blastout
- bra 100$
-
- 501$ cmp.b #'6',0(a2,d3) ;right arrow
- bne.s 170$
- tst.w bottomin
- beq 102$
- move.w loffset(PC),d2
- add.w colms(PC),d2
- bra.s 502$
-
- 170$ cmp.b #'0',0(a2,d3) ;Ins
- bne.s 177$
- eor.b #1,insmode
- bra.s 102$
-
- 177$ cmp.b #'.',0(a2,d3) ;Del
- beq 178$
-
- 105$ tst.w bottomin
- bne.s 777$
- tst.w curpos
- bne.s 777$
- movem.l d0-d1,-(a7)
- move.w edline(PC),d0
- bsr findline
- movem.l (a7)+,d0-d1
- tst.l 8(a5)
- beq intuiend
- 777$ move.w curpos(PC),d5
- ext.l d5
- moveq #79,d2
- cmp.w d2,d5
- bge 102$
- tst.b insmode
- beq.s 172$
- cmp.w ibufferlen(PC),d5
- bmi.s 171$
- bra.s 173$
- 172$ sub d5,d2
- lea 80(a1),a4
- lea 79(a1),a3
- 103$ move.b -(a3),-(a4)
- dbf d2,103$
- 173$ addq.w #1,ibufferlen
- 171$ move.b 0(a2,d3),0(a1,d5)
- addq.w #1,curpos
- 102$ subq #1,d0
- addq #1,d3
- bra 101$
-
- 100$ bsr UpdateIArea
- bra intuiend
-
- got_enter bsr stoptimer
- bsr puthist
- clr.b insmode
- lea dummy,a1
- lea inputbuffer,a2
- move.w ibufferlen(PC),d2
- beq.s 2$
- tst.w bottomin
- bne.s 5$
- movem.l a1-a2,-(a7)
- move.w edline(PC),d0
- bsr findline
- move.l 8(a5),d0
- bsr gthex
- lea hexarea(PC),a0
- lea 0(a2,d2),a1
- move.b #' ',(a1)+
- move.b #'$',(a1)+
- moveq #8,d0
- CALL CopyMem,_SysBase(PC)
- move.w ibufferlen(PC),d2
- add.w #10,d2
- move.w d2,ibufferlen
- movem.l (a7)+,a1-a2
- 5$ subq #1,d2
- 1$ move.b (a2)+,(a1)+
- dbf d2,1$
- 2$ move.b #10,(a1)+
- move.w ibufferlen(PC),d0
- ext.l d0
- addq #1,d0
- move.l d0,-(a7)
- clr.w ibufferlen
- tst.w bottomin
- bne.s 4$
- move.w #100,curpos
- bsr UpdateIArea
- 4$ clr.w curpos
- move.w #1,bottomin
- bsr getcurpos
- bsr UpdateIArea
- move.l (a7)+,d0
- move.w d0,repeatlen
- clr.w repeat
- clr.b printed
- tst.w getanswer
- beq.s 6$
- rts
- 6$ bsr cli
- tst.b printed
- bne.s 3$
- bsr starttimer
- 3$ bra intuiend
-
- notarawkey
-
- intuiend bsr.s replyintui
- bra nextimsg
- processnxtmsg
- tst.b addlines
- beq.s 1$
- rts
- 1$ bra processmsgs
-
- replyintui move.l intuimsg(PC),d0
- beq.s 1$
- move.l d0,a1
- CALL ReplyMsg,_SysBase
- 1$ clr.l intuimsg
- rts
-
- ;put an input line into the history buffer
- puthist move.w ibufferlen(PC),d5
- move.l d5,d0
- cmp.w minnumchars(PC),d0
- bcs 1$
-
- move.l gothline(PC),d1
- beq.s 5$
- move.l d1,a2
- cmp.w 8(a2),d5
- bne.s 5$
- lea 10(a2),a2
- lea inputbuffer,a1
- subq #1,d0
- 6$ cmp.b (a2)+,(a1)+
- bne.s 5$
- dbf d0,6$
- move.l gothline,curhist
- bra.s 1$
-
- 5$ move.w d5,d0
- ext.l d0
- add #10,d0
- move.l #$10000,d1 ;MEMF_CLEAR
- CALL AllocMem,_SysBase(PC)
- tst.l d0
- beq.s 1$
- move.l d0,a0
- move.w d5,8(a0)
- lea 10(a0),a2
- subq #1,d5
- lea inputbuffer,a1
- 2$ move.b (a1)+,(a2)+
- dbf d5,2$
- move.w hnum(PC),d5
- cmp.w maxhlines(PC),d5
- bmi.s 3$
- bsr remhistline
- bra.s 4$
- 3$ addq #1,d5
- move.w d5,hnum
- 4$ move.l d0,a1
- move.l d0,curhist
- lea history(PC),a0
- CALL AddTail,_SysBase(PC)
- 1$ clr.l gothline
- rts
-
- ;copy a history line into the input buffer
- copyhistory lea inputbuffer,a0
- move.w 8(a1),d3
- ext.l d3
- move.w d3,curpos
- move.w d3,ibufferlen
- subq #1,d3
- lea 10(a1),a1
- 1$ move.b (a1)+,(a0)+
- dbf 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,-(a7)
- lea history(PC),a0
- move.l 0(a0),a5
- tst.l 0(a5)
- beq.s 1$
- CALL RemHead,_SysBase(PC)
- move.l a5,a1
- move.w 8(a1),d0
- add #10,d0
- ext.l d0
- CALL FreeMem,_SysBase(PC)
- 1$ move.l (a7)+,d0
- rts
-
- ;kill all history lines
- killhistory bsr remhistline
- move.l history(PC),a0
- tst.l 0(a0)
- bne.s killhistory
- 2$ clr.w hnum
- clr.l curhist
- rts
- ;delete one char from the input line
- delchar lea inputbuffer,a3
- lea 0(a3,d4.w),a3
- lea -1(a3),a4
- move d4,d5
- 1$ cmp.w #78,d5
- bge.s 2$
- move.b (a3)+,(a4)+
- addq #1,d5
- bra.s 1$
- 2$ subq.w #1,ibufferlen
- rts
-
- testsig move.l tasksigs(PC),d0
- btst d1,d0
- rts
-
- ;get the position of the input area
- iareapos move.l wnptr(PC),a0
- move.w 10(a0),d0
- subq #4,d0
- move.w d0,ipos
- rts
-
- ;Update the current position of the input line
- getcurpos tst.w bottomin
- beq.s 1$
- move.w ipos,cposy
- rts
- 1$ move.w edline(PC),d3
- sub.l firstline(PC),d3
- lsl #3,d3
- add.w #18,d3
- move.w d3,cposy
- rts
- ;refresh the input area
- UpdateIArea move.l rastport(PC),a1
- move.l #1,d0
- CALL SetDrMd,gfxbase(PC)
- moveq #6,d0
- move.w cposy(PC),d1
- CALL Move,gfxbase(PC)
- lea inputbuffer,a0
- move.w ibufferlen(PC),d0
- ext.l d0
- move.w colms(PC),d1
- sub.w bottomin(PC),d1
- cmp.w d1,d0
- bmi.s 1$
- move.w d1,d0
- 1$ move.w d0,d2
- CALL Text,gfxbase(PC)
-
- tst.w bottomin
- bne.s 3$
- move.w edline(PC),d0
- bsr findline
- move.w 12(a5),d3
- sub.w d2,d3
- bmi.s 3$
- move.w colms(PC),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 rastport(PC),a1
- CALL Text,gfxbase(PC)
- add.w ibufferlen(PC),d3
- move.w d3,d2
-
- 3$ move.w colms(PC),d0
- sub.w bottomin(PC),d0
- move.l blanks(PC),a0
- ext.l d0
- sub.w d2,d0
- bmi.s 2$
- lea 0(a0,d2.w),a0
- move.l rastport(PC),a1
- CALL Text,gfxbase(PC)
- 2$ bsr putcursor
- rts
-
- clrcursor moveq #1,d7
- bra.s ptc1
- putcursor moveq #6,d7
- ptc1 move.w curpos(PC),d0
- move.w colms(PC),d1
- subq #1,d1
- sub.w bottomin(PC),d1
- cmp.w d0,d1
- bmi.s 1$
- move.l rastport(PC),a1
- move.l d7,d0
- CALL SetDrMd,gfxbase(PC)
- move.w cposy(PC),d1
- move.w curpos(PC),d0
- lsl.w #3,d0
- addq #6,d0
- CALL Move,gfxbase(PC)
- lea oneblank(PC),a0
- moveq #1,d0
- CALL Text,gfxbase(PC)
- 1$ rts
- ;rebuild the window from scratch
- setupscreen move.l rastport(PC),a1
- moveq #0,d0
- CALL SetRast,gfxbase(PC)
- move.l wnptr,a0
- CALL RefreshWindowFrame,intuibase(PC)
- bsr getwindowsize
- tst.w bottomin
- bne.s 1$
- move.w edline(PC),d0
- move.l firstline(PC),d1
- move.w rows(PC),d2
- move.w d2,d4
- move.w numlines(PC),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
- 2$ bsr tstfirstlin
- 1$ bsr getcurpos
- bsr putiline
- bsr blastout
- bsr UpdateIArea
- move.w rows,currenty
- rts
-
- putiline move.l rastport(PC),a1
- moveq #1,d0
- CALL SetAPen,gfxbase(PC)
- move.l rastport(PC),a1
- moveq #1,d0
- CALL SetDrMd,gfxbase(PC)
- move.l wnptr(PC),a5
- move.w 10(a5),d1
- sub.w #12,d1
- moveq #0,d0
- CALL Move,gfxbase(PC)
- move.w 8(a5),d0
- move.w d1,-(a7)
- CALL Draw,gfxbase(PC)
- move.w (a7)+,d1
- tst.b ownscreen
- bne.s 1$
- move.w 8(a5),d0
- addq #1,d1
- CALL Move,gfxbase(PC)
- sub.w #16,d0
- move.w d1,-(a7)
- CALL Draw,gfxbase(PC)
- move.w (a7)+,d1
- move.w 8(a5),d0
- addq #1,d1
- CALL Move,gfxbase(PC)
- sub.w #16,d0
- CALL Draw,gfxbase(PC)
- 1$ rts
-
- getwindowsize
- bsr freeblank
- move.l wnptr(PC),a0
- move.w 10(a0),d0
- sub.w #26,d0
- lsr.w #3,d0
- move.w d0,rows
- move.w 8(a0),d0
- sub.w #12,d0
- lsr.w #3,d0
- move.w d0,colms
- ext.l d0
- moveq #0,d1
- move.l d0,d6
- CALL AllocMem,_SysBase(PC)
- move.l d0,blanks
- move.l d0,a0
- subq #1,d6
- 1$ move.b #' ',(a0)+
- dbf d6,1$
- bsr iareapos
- rts
-
- readline move.b #'n',inputbuffer
- tst.b fromfile
- bne.s 1$
- move.l #31000,firstline
- bsr blastout
- move.w #1,getanswer
- bsr replyintui
- 5$ bsr processmsgs
- move.w d0,d5
- bsr replyintui
- subq #1,d5
- beq.s 5$
- ori.b #$20,inputbuffer
- clr.w getanswer
- bsr RestoreOutput
- 1$ rts
-
- ResumeOutput
- move.l outchain(PC),d0
- move.l d0,a1
- beq.s 2$
- move.l numlines,oldnumlines
- move.l firstline,oldfirstline
- 4$ tst.l 0(a1)
- beq.s 3$
- move.l 0(a1),a1
- bra.s 4$
- 3$ move.l a1,lastprinted
- 2$ move.l a1,oldpageend
- rts
-
- RestoreOutput
- move.l oldpageend(PC),d3
- beq.s 1$
- move.l oldnumlines(PC),numlines
- move.l oldfirstline(PC),firstline
- move.l oldlastprinted(PC),lastprinted
- move.l d3,a1
- move.l 0(a1),a1
- bsr killlines
- move.l d3,a1
- clr.l 0(a1)
- bsr blastout
- 1$ rts
-
- addline movem.l d0-d6/a0-a3,-(a7)
- move.l rastport(PC),a1
- moveq #1,d0
- CALL SetAPen,gfxbase(PC)
- move.l rastport(PC),a1
- moveq #1,d0
- CALL SetDrMd,gfxbase(PC)
- move.w currenty(PC),d6
- cmp.w rows(PC),d6
- bmi.s 1$
- bsr cls
- 1$ move.l lastprinted(PC),a0
- move.w colms(PC),d5
- move.w 12(a0),d3
- lea 14(a0),a0
- move.w currenty(PC),d6
- move d6,d7
- lsl #3,d6
- add.w #18,d6
- moveq #0,d4
- bsr blastline
- addq.w #1,currenty
- move.l #31000,firstline
- movem.l (a7)+,d0-d6/a0-a3
- rts
-
- cls movem.l d0-d6/a0-a3,-(a7)
- move.l rastport(PC),a1
- moveq #1,d0
- CALL SetAPen,gfxbase(PC)
- move.l rastport(PC),a1
- moveq #1,d0
- CALL SetDrMd,gfxbase(PC)
- move.w colms(PC),d5
- clr.w d2
- 1$ move.w d2,d6
- move d5,d7
- lsl #3,d6
- add.w #18,d6
- moveq #0,d3
- move.l blanks(PC),a0
- bsr blastline
- addq #1,d2
- cmp.w rows(PC),d2
- bmi.s 1$
- clr.w currenty
- movem.l (a7)+,d0-d6/a0-a3
- rts
-
- createscreen moveq #1,d1
- moveq #80,d0
- lea buffer,a0
- sub.l a1,a1
- CALL GetScreenData,intuibase(PC)
- move.w buffer+76,nsviewmode
- move.l buffer+12,nssize
- lea newscreen(PC),a0
- CALL OpenScreen,intuibase(PC)
- move.l d0,screenptr
- move.l d0,nwscreen
- move.w #$f,nwtype
- beq.s setupwindow
- tst.l wnptr
- beq.s 1$
- move.l wnptr(PC),a0
- move.l 4(a0),window_l
- move.l 8(a0),window_w
- CALL CloseWindow,intuibase(PC)
- clr.l intuimsg
- clr.l wnptr
- 1$ clr.l newwindow
- move.l buffer+12,newwindow+4
- move.l wnscrflags(PC),nwflgs
- move.l wnscrflags+4(PC),nwflgs+4
- move.b #1,ownscreen
-
- setupwindow tst.b ownscreen
- bne.s 3$
- move.l window_l(PC),newwindow
- move.l window_w(PC),newwindow+4
- move.w #1,nwtype
- move.l wnnormflgs(PC),nwflgs
- move.l wnnormflgs+4(PC),nwflgs+4
- 3$ lea newwindow(PC),a0
- CALL OpenWindow,intuibase(PC)
- move.l d0,wnptr
- beq exit
- move.l d0,a0
- move.l 50(a0),rastport ;wn->RPort
- move.l 86(a0),a1 ;wn->UserPort
- move.b 15(a1),d1 ;MsgPort->SigBit
- ext.w d1
- move.w d1,intuisig
-
- tst.b iconifyon
- beq.s 1$
- tst.b ownscreen
- bne.s 1$
- lea iconifgad,a1
- moveq #0,d0
- CALL AddGadget,intuibase(PC)
- move.l wnptr(PC),a0
- CALL RefreshWindowFrame,intuibase(PC)
-
- 1$ lea tattr(PC),a0
- CALL OpenFont,gfxbase(PC)
- tst.l d0
- beq.s 2$
- move.l d0,a0
- move.l rastport(PC),a1
- CALL SetFont,gfxbase(PC)
- 2$ bsr getwindowsize
- bsr getcurpos
-
- bsr putiline
- bsr UpdateIArea
- bsr starttimer
- bsr showwhat
- rts
-
- usescreen tst.b fromfile
- bne.s 1$
- tst.b ownscreen
- bne.s 1$
- bsr createscreen
- 1$ move.b #1,ownscreen
- rts
-
- usewindow tst.b fromfile
- beq.s 1$
- clr.b ownscreen
- rts
- 1$ tst.b ownscreen
- beq.s 2$
- move.l wnptr(PC),d0
- beq.s 3$
- move.l d0,a0
- CALL CloseWindow,intuibase(PC)
- clr.l wnptr
- clr.l intuimsg
- 3$ move.l screenptr(PC),d0
- beq.s 4$
- move.l d0,a0
- CALL CloseScreen,intuibase(PC)
- clr.l screenptr
- clr.b ownscreen
- 4$ bra setupwindow
- 2$ rts
-
- dchange lea dchead(PC),a0
- bsr puthead
- lea tdd(PC),a1
- move.l _SysBase(PC),a0
- lea 350(a0),a0
- CALL FindName,_SysBase(PC)
- tst.l d0
- beq R_T_S
- move.l d0,a2
- lea 32(a2),a2
- moveq #0,d5
- 2$ lea 4(a2),a2
- move.l 0(a2),d0
- beq 3$
- move.l d0,a0
- lea $18e(a0),a0
- CALL Disable,_SysBase(PC)
- 5$ tst.l 0(a0)
- beq.s 6$
- move.l 0(a0),a0
- bra.s 5$
- 6$ lea -4(a0),a5
- lea buffer+100,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)+
- CALL Enable,_SysBase(PC)
- lea buffer+100,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),a4
- move.l a4,d0
- move.l d0,node
- bsr hexan
- move.l a4,d0
- beq.s 10$
- move.l 14(a4),d0
- bsr hexan
- move.l 18(a4),d0
- bsr hexan
- 10$ move.l d5,d3
- or.b #48,d3
- move.b d3,tddrives+2
- move.l #tddrives,d0
- bsr putstr
- move.l 14(a5),d0
- beq.s 8$
- move.l d0,a0
- move.l 16(a0),d0
- beq.s 8$
- move.l d0,a0
- move.l 10(a0),d0
- 8$ bsr putnam
- bra.s 7$
- 3$ addq #1,d5
- cmp.w #4,d5
- bmi 2$
- R_T_S rts
-
- dosbase dc.l 0
- intuibase dc.l 0
- gfxbase dc.l 0
- condev dc.l 0
- parmtxt dc.l 0
- fileptr dc.l 0
- infile dc.l 0
- ptr dc.l 0
- oldidl dc.l 0
- olddisp dc.l 0
- mysignal dc.l 0
- auxsig dc.l 0
- trapsignal dc.l 0
- iostatus dc.l -1
- devstatus dc.l -1
- tasksigs dc.l 0
- cancelbit dc.l 0
- cancelbnum dc.l 0
- _SysBase dc.l 0
- InputMsg dc.l 0
- InRequest dc.l 0
- startmess dc.l 0
- savedat dc.l 0
- wnptr dc.l 0
- aliaslist dc.l 0
- screenptr dc.l 0
- intuimsg dc.l 0
- mytask dc.l 0
- wbmsg dc.l 0
- pointer dc.l 0
- replyport dc.l 0
- timerport dc.l 0
- finfoptr dc.l 0
- myseg dc.l 0
- dispatches dc.l 0
- maxdisp dc.l 0
- deltadisp dc.l 0
- wbaddr dc.l 0
- node dc.l 0
- remembr dc.l 0
- remembr2 dc.l 0
- captask dc.l 0
- snoopport dc.l 0
- tasksnum dc.l 0
- blanks dc.l 0
- hidestart dc.l 0
- dispnum dc.l 0
- iocount dc.l 0
- dummyinput dc.l 0
- rastport dc.l 0
- outchain dc.l 0
- firstline dc.l 0
- oldfirstline dc.l 0
- numlines dc.l 0
- oldnumlines dc.l 0
- gothline dc.l 0
- lastprinted dc.l 0
- oldlastprinted dc.l 0
- oldpageend dc.l 0
- maxlines dc.l 500
- realstack dc.l 0
-
-
- wnnormflgs dc.l $646
- dc.l $1104f
-
- wnscrflags dc.l $600
- dc.l $31948
-
- history dc.l *+4
- dc.l 0
- dc.l history
- curhist dc.l 0
-
-
- secs dc.l 0
- mics dc.l 0
- time10 dc.l 0
-
- tattr dc.l fontname
- dc.w 8
- dc.w 0
-
- stplist dc.l lh_tail
- lh_tail dc.l 0
- dc.l stplist
- dc.b 1
- dc.b 0
-
- 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()
-
- newwindow dc.w 0,0
- dc.w 500,100
- dc.b 0,1
- nwflgs dc.l $646
- dc.l $1104f
- wn_firstgad dc.l 0
- dc.l 0
- dc.l windowname
- nwscreen dc.l 0
- dc.l 0
- dc.w 110,50
- dc.w 808,-1
- nwtype dc.w 1
-
- newscreen dc.w 0,0
- nssize dc.w 0,0
- dc.w 1
- dc.b 0
- dc.b 1
- nsviewmode dc.w 0
- dc.w $1f
- dc.l 0
- dc.l windowname
- dc.l 0,0
-
- excpterror dc.l 0
- excpttask dc.l 0
- excptaddr dc.l 0
- excptpc dc.l 0
-
- window_l dc.w 0
- window_t dc.w 0
- window_w dc.w 550
- window_h dc.w 200
-
- colms dc.w 0
- timersig dc.w 0
- intuisig dc.w 0
- ibufferlen dc.w 0
- cposy dc.w 0
- curpos dc.w 0
- bottomin dc.w 1
- ipos dc.w 0
- hnum dc.w 0
- minnumchars dc.w 2
- maxhlines dc.w 10
- qualifier dc.w 0
- rows dc.w 0
- maxllength dc.w 0
- loffset dc.w 0
- repeat dc.w 0
- repeatlen dc.w 0
- edline dc.w 999
- cmdptr dc.w 0
- getanswer dc.w 0
- currenty dc.w 0
-
- binarea dc.b ' ',0
- EVEN
- minus dc.b ' '
- decimal dc.b ' ',0
- entries dc.b 0
- timeout dc.b 5
- procnum dc.b 0
- timerstate dc.b 0
- running dc.b 0
- newpri dc.b 0
- tasktyp dc.b 0
- background dc.b 0
- bool dc.b 0
- printed dc.b 0
- cbreak dc.b 0
- usageflag dc.b 0
- mnflag dc.b 1
- tports dc.b 1
- headon dc.b 1
- hideon dc.b 1
- sorton dc.b 1
- wanttraps dc.b 0
- addlines dc.b 0
- eof dc.b 0
- fromfile dc.b 0
- iconifyon dc.b 1
- gotguru dc.b 0
- ownscreen dc.b 0
- insmode dc.b 0
- params dc.b 'tfdlrempisc'
- parmnum equ *-params
- dc.b 0
- t2header dc.b ' ID STATE SIGALLOC SIGWAIT SIGRECVD PC 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
- cr dc.b 10,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 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
- tdd dc.b 'trackdisk.device',0
- tddrives dc.b 'DF : ',0
- timerunits dc.b 'MicroHz ',0
- dc.b 'VBlank ',0
- access dc.b ' Read ',0
- dc.b ' Write ',0
- romfnt dc.b 'Rom ',0
- diskfnt dc.b 'Disk ',0
- wbname dc.b 'Workbench',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
- windowname dc.b 'Xoper V2.0 ) 1989 Werner G',$fc,'nther',0
- newname dc.b 'Xoper',0
- memportname dc.b 'MemSnoop',0
- xopcon dc.b 'XopPackets',0
- xopsleep dc.b 'Xop-A-A-x',0
- IOcntname dc.b 'Xop-I/O-counter',0
-
- cmdnum set 0
- commds ADDCMD 'time'
- 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 'snoop'
- ADDCMD 'usage'
- ADDCMD 'inputhandler'
- ADDCMD 'header'
- ADDCMD 'sort'
- ADDCMD 'hide'
- ADDCMD 'hidden'
- ADDCMD 'window'
- ADDCMD 'kill'
- ADDCMD 'iconifyoff'
- 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 'timerio'
- ADDCMD 'diskchange'
- ADDCMD 'alias'
- ADDCMD 'remnode'
- hexarea dc.b ' ',0
- hextab dc.b '0123456789abcdef'
- 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 '/68881',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 '-----'
- nix dc.b '--- ',0
- noinfo dc.b 'No Info on'
- oneblank dc.b ' ',0
- equal 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
- openerr dc.b 'Could not open file ',0
- noderr dc.b "Can't find this Node. Continue anyway ? (Y/N)",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
- fontname dc.b 'topaz.font',0
- devicenam dc.b 'input.device',0
- timernam dc.b 'timer.device',0
- memlarg dc.b 'LARGEST ',0
- memclr dc.b 'CLEAR ',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
- startupname dc.b 'S:Xoper.Startup',0
- nameerr dc.b 'Name or address is missing.',10
- synerr dc.b 'Syntax Error, type "?" for help',10,0
- wberr dc.b "Can't examine Workbench locks",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 'Refresh disabled.',0
- whattime dc.b 'Refresh time in secs:',0
- stoped dc.b '<Break>',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 alligned address was: ',0
- procount dc.b 'PC: ',0
- diskfont dc.b 'diskfont.library',0
- usetxt dc.b 'USAGE: Xoper [T] [F] [L] [D] [R] [E] [M] [P] [I] [S] [C]',10
- dc.b 'OR Xoper -b',10
- dc.b 'DISPLAY:',10
- dc.b '[T]asks [F]=taskflags [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 [Q]uit',10,10
- dc.b 'OTHER SYSTEM LISTS:',10
- dc.b 'Windows Screens Fonts WindowFonts CurrentDir',10
- dc.b 'Files Locks Devices InputHandler Capture',10
- dc.b 'TimerIO DiskChange',10,10
- dc.b 'COMMANDS:',10
- dc.b 'Time <secs>',10
- dc.b 'Taskpri <priority> [processnum] <taskname>',10
- dc.b 'Mypri <priority>',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 [processnum] <taskname>',10
- dc.b 'Snoop [processnum] <taskname>',10
- dc.b 'Hide <taskname>',10
- dc.b 'Pri <priority> <nodename>',10
- dc.b 'Info <name>',10
- dc.b 'RemResident <resident module name>',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 '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 'Repeat <Command line>',10
- dc.b 'Alias [<aliasname> <commandname>]',10,10
- dc.b 'COMMADS WITHOUT PARAMETERS:',10
- dc.b 'Flush LastAlert ClrCool ClrCold ClrWarm',10
- dc.b 'TrapGuru',10,10
- dc.b 'OPTIONS:',10
- dc.b 'Sort TaskPorts Hidden Usage Header',10
- dc.b 'IconifyOff BackDropIcon ShowHistory KillHistory UseScreen',10
- dc.b 'UseWindow',10
- dc.b 'Hold Exit'
- null dc.b 0
-
- IFD DEBUG
- dosname dc.b 'dos.library',0
- intuiname dc.b 'intuition.library',0
- gfxname dc.b 'graphics.library',0
- conname dc.b 'console.device',0
- EVEN
- ENDC
-
- BSS blabla
- buffer ds.b 2200
- out ds.b 100
- dummy ds.b 80
- in ds.b 80
- cputime ds.b 1000
- ievent ds.b 32
- outevent ds.b 20
- inputbuffer ds.b 88
- repeatbuffer ds.b 81
-
- mypacket BSS standardpacket
-
- LN_SUCC ds.l 1
- LN_PRED ds.l 1
- LN_TYPE ds.b 1
- LN_PRI ds.b 1
- LN_NAME ds.l 1
- MP_FLAGS ds.b 1
- MP_SIGBIT ds.b 1
- MP_SIGTASK ds.l 1
- MN_SIZE ds.w 1
- LH_HEAD ds.l 1
- LH_TAIL ds.l 1
- LH_TAILPRED ds.l 1
- LH_TYPE ds.b 1
- LH_pad ds.b 1
- dp_Link ds.l 1
- dp_Port ds.l 1
- dp_Type ds.l 1
- dp_Res1 ds.l 1
- dp_Res2 ds.l 1
- dp_Arg1 ds.l 1
- dp_Arg2 ds.l 1
- dp_Arg3 ds.l 1
- dp_Arg4 ds.l 1
- dp_Arg5 ds.l 1
- dp_Arg6 ds.l 1
- dp_Arg7 ds.l 1
-
- timerio ds.b 40
-
- CODE ICONIFY,CHIP
-
- iconify lea icnwindow,a0
- CALL OpenWindow,intuibase
- move.l d0,iconwindow
-
- waitforcall move.l iconwindow,a0
- move.l $56(a0),a0 ;wn->UserPort
-
- moveq #0,d1
- move.b 15(a0),d1 ;UserPort->SigBit
- bset d1,d0
- move.l d0,d6
- or.l mysignal,d0
- or.l trapsignal,d0
- CALL Wait,_SysBase
- and.l d0,d6
- bne.s fromwindow
- move.l mysignal,d1
- and.l d0,d1
- bne.s icondone
- and.l trapsignal,d0
- beq.s waitforcall
- move.b #1,gotguru
- bra.s icondone
-
- fromwindow move.l iconwindow,a0
- move.l $56(a0),a0 ;wn->UserPort
- CALL GetMsg,_SysBase
- tst.l d0
- beq.s waitforcall
- move.l d0,a1
- CALL ReplyMsg,_SysBase
-
- lea nsecs(PC),a0
- lea nmics(PC),a1
- CALL CurrentTime,intuibase
- movem.l osecs,d0-d3
- CALL DoubleClick,intuibase
- tst.l d0
- bne.s icondone
- move.l nsecs(PC),osecs
- move.l nmics(PC),omics
- bra waitforcall
-
- icondone move.l iconwindow,a0
- move.l 4(a0),icnwindow ;LeftEdge+TopEdge
- CALL CloseWindow,intuibase
- rts
-
- osecs dc.l 0
- omics dc.l 0
- nsecs dc.l 0
- nmics dc.l 0
-
- iconwindow dc.l 0
- icnwindow dc.w 40,170,72,28
- dc.b 0,1
- dc.l $20,$800
- dc.l gadget,0,0,0,0
- dc.w 72,28,72,28
- dc.w 1
-
- 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
-
- image dc.w 0,0,72,28,2
- dc.l imagedata
- dc.b 3,0
- dc.l 0
-
- 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
-
- iconifgad dc.l 0
- dc.w -83,0
- dc.w 31,10
- dc.w $14
- dc.w $41
- dc.w 1
- dc.l iconifimg
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.w 0
- dc.l 0
-
- iconifimg dc.w 0,0
- dc.w 31,10
- dc.w 2
- dc.l iconifdata
- dc.b $0003,$0000
- dc.l 0
-
- 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
-
-
- END
-
-