Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ut-dillo.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!gatech!ut-sally!ut-ngp!ut-dillo!darin From: darin@ut-dillo.UUCP (Darin Adler) Newsgroups: net.sources.mac Subject: Source code for TMON Extended User Area (part 1 of 7) Message-ID: <231@ut-dillo.UUCP> Date: Sun, 8-Dec-85 14:33:13 EST Article-I.D.: ut-dillo.231 Posted: Sun Dec 8 14:33:13 1985 Date-Received: Tue, 10-Dec-85 05:46:32 EST Distribution: net Organization: UTexas Computation Center, Austin, Texas Lines: 1228 <> Here is the source code for the Extended User Area (which was going to be part 1 of 3 in a previous posting). It is in the form of 7 separate shell archives. # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. -----cut here-----cut here-----cut here-----cut here----- #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # EUA.Asm.1 # This archive created: Sun Dec 8 13:27:51 1985 # By: Darin Adler () echo shar: extracting EUA.Asm.1 '(29950 characters)' cat << \SHAR_EOF > EUA.Asm.1 ;Extended Monitor User Area (Public Domain - Not For Sale) ; ;Written by Darin Adler ; ;Based upon the original user area by Waldemar Horwat ; ;Portions of this code are Copyright (c) 1985 ICOM Simulations ;The rest of the code is Copyright (c) 1985 Darin Adler ; ;Created: August 14, 1984 ;Last modified: December 1, 1985 ; ;This is for use with Monitor version 2.585, Macintosh ROM version $69. ; ;This is an MDS (Consulair) assembler source file. ;It may have to be modified in order to be used with other assemblers. ; ;If you have difficulties with any portion of this code (particularly ;the "discipline"), send comments or a description of your problem to: ; ; Darin Adler ; 2765 Marl Oak Dr. ; Highland Park, IL 60035 ; ;Questions, comments or orders for TMON should be directed to: ; ; ICOM Simulations ; 626 Wheeling Rd. ; Wheeling, IL 60090 ; (312) 520-4440 ; ;I give many thanks to Waldemar Horwat for writing TMON; to Todd Squires, ;Jay Zipnick, Craig Erickson, Terry Schulenburg for using and testing the ;early versions; to Andrew Donoho and the others from Austin who continue ;to test and make wonderful suggestions; to Steve Capps for the great idea ;(and code) for "discipline"; and to all the owners of TMON, who know a ;good thing when they see it! ; AreaSize EQU $5500 Version EQU 652 ;These are the trap files, etc. for MDS. INCLUDE MacTraps.D INCLUDE SysEquX.D JHideCursor EQU $800 ;vectors for Hide and Show Cursor (from old SysEqu) JShowCursor EQU $804 INCLUDE FSEqu.D FSFCBLen EQU $3F6 ;length of the FCBs INCLUDE ToolEquX.D nextMap EQU 16 ;offset from one resource map to the next resFileID EQU 20 ;offset to the resource file ID INCLUDE QuickEqu.D INCLUDE PackMacs.Txt ;The following macro is for word aligned, long word values. MACRO LONG value = DC {value}>>16,{value}&$FFFF | ;The next macro is for user area relative word addresses MACRO ADDR address = IF '{address}'='0' DC 0 ELSE IF '{address}'='.0' DC 0 ELSE DC {address}-A ENDIF ENDIF | ;The following macro is for traps into the monitor. MACRO TRAPMon string = TRAP #$F TRAPMon. SET * DC.B {string} IF *-TRAPMon. <> 16 DC.B 0 ENDIF .ALIGN 2 | ;The next 3 macros are for user area functions. MACRO UAFunc name,next = .{name} ADDR .{next} ADDR {name} DC.B .{name}.1-*-1 | MACRO UAParam name,parms = .{name}.1 .ALIGN 2 DC.B {parms} DC.B .{name}.2-*-1 | MACRO UACode name = .{name}.2 .ALIGN 2 {name} | ;These are the equates for the extended ASCII used in names. End.If EQU $00 If.Else EQU $01 If.Pos EQU $02 If.Neg EQU $03 Colon EQU $04 Skip EQU $04 ;+1 to +10 PrHex EQU $0E ;+1 to +8 PrASCII EQU $16 ;+1 to +8 NoOp EQU $1F DisAsm0 EQU $80 DisAsm1 EQU $81 Recognize EQU $82 ;These are some useful Monitor routines. _Print1 EQU -8(A5) _ExiTMON EQU -12(A5) _Print2 EQU -20(A5) _PutASCII EQU -24(A5) _Put1Dig EQU -28(A5) _Put2Dig EQU -32(A5) _Put4Dig EQU -36(A5) _Put6Dig EQU -40(A5) _Put8Dig EQU -44(A5) _NextCResFile EQU -48(A5) _FindRes EQU -52(A5) _Recognize EQU -56(A5) ;These are some of the monitor's variables MonExecuting.A5 EQU $15(A5) PC.A5 EQU $4E(A5) D0.A5 EQU $60(A5) A0.A5 EQU $80(A5) SP.A5 EQU $94(A5) N.A5 EQU $98(A5) V.A5 EQU $9C(A5) V.A2 EQU $9C(A2) A5.TMON EQU *-$500 ;Monitor globals relative to the user area. MonExecuting EQU $15+A5.TMON ;This is the monitor status byte. UserInform EQU $207+A5.TMON TMONStart EQU $FC ;The contents of this point to the bottom of TMON. ;################# ;## ## ;## User Area ## ;## ## ;################# A ;This is the start of the user area. See the TMON manual for details on the first 32 bytes. _AreaSize DC AreaSize ;The size of the user area. _Version DC Version ;The current version number. _FlagWord DC.B %10010000 ;Refresh and screen size. (Auto-Quit and no Vector Refresh) _Inhibits DC.B %00000000 ;Heap, label, and screen inhibit flags. _PortConfig DC %0000000000000010 ;Printer port, DTR handshake. _PortRate DC %1100110000001010 ;9600 baud, 8 data bits, 2 stop, no parity. _A000Hook ADDR A000Hook ;The A000 hook. _PrintError ADDR PrintError ;The error location. _FirstUAFunc ADDR .Toggle ;The first user routine. _HeapHook ADDR HeapHook ;The heap window hook. _InitHook ADDR InitHook ;User initialization routine. _EnterHook ADDR EnterHook ;User enter routine. _ExitHook ADDR ExitHook ;User exit routine. _LabelScan ADDR LabelScan ;User label table scanning routine. _CodeLabelScan ADDR CodeLabelScan ;User label-in-code scanning routine. _LabelFind ADDR LabelFind ;User routine to find label in table. _CodeLabelFind ADDR CodeLabelFind ;User routine to find label in code. _Reserved DC 0,0,0,0,0,0,0,0 ;Reserved for future use. nasty0 LONG 'NIL!' ;Something nasty for location 0. val10000 LONG $10000 ;A useful constant. updating LONG 0 ;A record of the last window that called BeginUpdate. InitHook TST.L D0 ;Is this the first call to InitHook? BNE.S EveryInit FirstInit BSR GetTrapAddressPatch ;Patch fo fix incompatibility with HyperDrive 20 BSR AppleTalkPatch ;Patch to fix incompatibility with AppleTalk interface code. BSR DebuggerInit ;Redefine the _Debugger trap. BSR DebuggerPatch ;Fix up TMON's detection of the _Debugger opcode. BSR SeeThroughPatch ;Fix up the fancy screen. EveryInit BSR A000OnOff ;Check if we need to wire in A000 traps. BSR ChecksumInit ;Calculate an initial value for the checksum. BSR FreeFormPatch ;Patch to fix a bug in Free Form sound. BSR SaveMemTop ;Get the "real" MemTop. BSR DisciplineInit ;Initialize the discipline code. MOVE.L nasty0,0 ;Trash location zero. RTS EnterHook BSR CursorEnter ;Play games with the cursor. BSR RecordEnter ;Make 'Trap Record' seem continuous. RTS ExitHook BSR CursorExit ;Play games with the cursor. BSR RecordExit ;Make 'Trap Record' seem continuous. MOVE.L nasty0,0 ;Trash location zero. RTS HeapHook BSR HeapIdentify RTS ;################################# ;## ## ;## User Area Built-In Labels ## ;## ## ;################################# ; ;This is the label table built into the user area. ; UALabelTable MACRO Label first,last,name = LONG {first} LONG {last} Label. SET * DC.B '{name|0:8}' DCB.B Label.+8-*,$20 | ;To add labels to this table simply add blocks of 16 bytes ;(labels as described in the manual) between the UALabelTable ;label and the UALabelTableEnd label. Label $8, $C,BusError Label $C, $10,AddrErr Label $10, $14,Illegal Label $14, $18,ZeroDiv Label $18, $1C,ChkError Label $1C, $20,TrapVErr Label $20, $24,Privileg Label $24, $28,Trace Label $28, $2C,Line1010 Label $2C, $30,Line1111 Label $34, $38,Coproces Label $38, $3C,FormatEr Label $3C, $40,Uninited Label $60, $64,Spurious Label $64, $68,AutoInt1 Label $68, $6C,AutoInt2 Label $6C, $70,AutoInt3 Label $70, $74,AutoInt4 Label $74, $78,AutoInt5 Label $78, $7C,AutoInt6 Label $7C, $80,AutoInt7 Label $80, $C0,TRAPtble Label $100,$102,MonkeyLives Label $102,$104,ScrVRes Label $104,$106,ScrHRes Label $106,$108,ScreenRow Label $108,$10C,MemTop Label $10C,$110,BufPtr Label $110,$114,StkLowPt Label $114,$118,HeapEnd Label $118,$11C,TheZone Label $11C,$120,UTableBase Label $120,$124,MacJmp Label $124,$128,DskRtnAdr Label $128,$12C,PollRtnAddr Label $12C,$12D,DskVerify Label $12D,$12E,LoadTrap Label $12E,$12F,MmInOK Label $12F,$130,DiskWr11 Label $130,$134,ApplLimit Label $134,$138,SonyVars Label $138,$13A,PWMValue Label $13A,$13E,PollStack Label $13E,$142,PollProc Label $142,$144,DskErr Label $144,$146,SysEvtMask Label $146,$14A,SysEvtBuf Label $14A,$154,EventQueue Label $154,$156,EvtBufCnt Label $156,$15A,RndSeed Label $15A,$15C,SysVersion Label $15C,$15D,SEvtEnb Label $15D,$15E,DSWndUpdate Label $15E,$15F,FontFlag Label $15F,$160,IntFlag Label $160,$16A,VBLQueue Label $16A,$16E,Ticks Label $16E,$172,MBTicks Label $172,$173,MBState Label $173,$174,Tocks Label $174,$17C,KeyMap Label $17C,$184,KeypadMap Label $184,$186,KeyLast Label $186,$18A,KeyTime Label $18A,$18E,KeyRepTime Label $18E,$190,KeyThresh Label $190,$192,KeyRepThresh Label $192,$1B2,Lvl1DT Label $1B2,$1D2,Lvl2DT Label $1D2,$1D4,UnitNtryCnt Label $1D4,$1D8,VIA Label $1D8,$1DC,SCCRd Label $1DC,$1E0,SCCWr Label $1E0,$1E4,IWM Label $1E4,$1F8,scratch20 Label $1F8,$1F9,SPValid Label $1F9,$1FA,SPATalkA Label $1FA,$1FB,SPATalkB Label $1FB,$200,SPConfig Label $200,$204,SPAlarm Label $204,$206,SPFont Label $206,$207,SPKbd Label $207,$208,SPPrint Label $208,$209,SPVolCtl Label $209,$20A,SPClikCaret Label $20A,$20B,SPMisc1 Label $20B,$20C,SPMisc2 Label $1F8,$20C,SysParam Label $20C,$210,Time Label $210,$212,BootDrive Label $212,$214,JShell Label $214,$216,SFSaveDisk Label $216,$21A,KbdVars Label $21A,$21E,JKybdTask Label $21E,$21F,KbdType Label $21F,$220,AlarmState Label $220,$222,MemError Label $222,$226,JFlgTrkSpd Label $226,$22A,JDiskPrime Label $22A,$22E,JRdAddr Label $22E,$232,JRdData Label $232,$236,JWrData Label $236,$23A,JSeek Label $23A,$23E,JSetUpPoll Label $23E,$242,JRecal Label $242,$246,JControl Label $246,$24A,JWakeUp Label $24A,$24E,JReSeek Label $24E,$252,JMakeSpdTbl Label $252,$256,JAdrDisk Label $256,$25A,JSetSpeed Label $25A,$25E,NiblTbl Label $222,$260,DiskVars Label $260,$261,SdVolume Label $261,$262,Finder Label $262,$266,SoundPtr Label $266,$26A,SoundBase Label $26A,$27A,SoundVBL Label $27A,$27E,SoundDCE Label $27E,$27F,SoundActive Label $27F,$280,SoundLevel Label $280,$282,CurPitch Label $282,$28A,Switcher Label $28A,$28E,RSDHndl Label $28E,$290,ROM85 Label $290,$291,PortAUse Label $291,$292,PortBUse Label $292,$29A,ScreenVars Label $29A,$29E,JGNEFilter Label $29E,$2A2,Key1Trans Label $2A2,$2A6,Key2Trans Label $2A6,$2AA,SysZone Label $2AA,$2AE,ApplZone Label $2AE,$2B2,ROMBase Label $2B2,$2B6,RAMBase Label $2B6,$2BA,BasicGlob Label $2BA,$2BE,DSAlertTab Label $2BE,$2CE,ExtStsDT Label $2CE,$2CF,SCCASts Label $2CF,$2D0,SCCBSts Label $2D0,$2D8,SerialVars Label $2DC,$2E0,ABusDCE Label $2D8,$2E0,ABusVars Label $2E0,$2F0,FinderName Label $2F0,$2F4,DoubleTime Label $2F4,$2F8,CaretTime Label $2F8,$2F9,ScrDmpEnb Label $2F9,$2FA,ScrDmpType Label $2FA,$2FC,TagData Label $2FC,$300,BufTgFNum Label $300,$302,BufTgFFlg Label $302,$304,BufTgFBkNum Label $304,$308,BufTgDate Label $308,$312,DrvQHdr Label $312,$316,PWMBuf2 Label $316,$31A,MacPgm Label $31A,$31E,Lo3Bytes Label $31E,$322,MinStack Label $322,$326,DefltStack Label $326,$328,MMDefFlags Label $328,$32C,GZRootHnd Label $32C,$330,GZRootPtr Label $330,$334,GZMoveHnd Label $334,$338,DSDrawProc Label $338,$33C,EjectNotify Label $33C,$340,IAZNotify Label $340,$342,CkdDB Label $342,$344,NxtDB Label $344,$346,MaxDB Label $346,$347,FlushOnly Label $347,$348,RegRsrc Label $348,$349,FLckUnlck Label $349,$34A,FrcSync Label $34A,$34C,NewMount Label $34C,$34E,DrMstrBlk Label $34E,$352,FCBSPtr Label $352,$356,DefVCBPtr Label $356,$360,VCBQHdr Label $360,$362,FSBusy Label $362,$366,FSQHead Label $366,$36A,FSQTail Label $360,$36A,FSQHdr Label $36A,$3A2,RgSvArea Label $3A2,$3A4,ErCode Label $3A4,$3D6,Params Label $3D6,$3DE,FSTemp8 Label $3DE,$3E2,FSTemp4 Label $3E2,$3E6,FSQueueHook Label $3E6,$3EA,ExtFSHook Label $3EA,$3EE,DskSwtchHook Label $3EE,$3F2,ReqstVol Label $3F2,$3F6,ToExtFS Label $3F6,$3F8,FSFCBLen Label $3F8,$400,DSAlertRect Label $400,$800,DispatchTab Label $800,$804,JHideCursor Label $804,$808,JShowCursor Label $808,$80C,JShieldCursor Label $80C,$810,JScrnAddr Label $810,$814,JScrnSize Label $814,$818,JInitCrsr Label $818,$81C,JSetCrsr Label $81C,$820,JCrsrObscure Label $820,$824,JUpdateProc Label $824,$828,ScrnBase Label $828,$82C,MTemp Label $82C,$830,RawMouse Label $830,$834,Mouse Label $834,$83C,CrsrPin Label $83C,$844,CrsrRect Label $844,$888,TheCrsr Label $888,$88C,CrsrAddr Label $88C,$8CC,CrsrSave Label $8CC,$8CD,CrsrVis Label $8CD,$8CE,CrsrBusy Label $8CE,$8CF,CrsrNew Label $8CF,$8D0,CrsrCouple Label $8D0,$8D2,CrsrState Label $8D2,$8D3,CrsrObscure Label $8D3,$8D4,CrsrScale Label $8D6,$8DA,MouseMask Label $8DA,$8DE,MouseOffset Label $8DE,$8E0,JournalFlag Label $8E0,$8E4,JSwapFont Label $8E4,$8E8,JFontInfo Label $8E8,$8EC,JournalRef Label $8EC,$8EE,CrsrThresh Label $8EE,$8F2,JCrsrTask Label $8F2,$8F3,WWExist Label $8F3,$8F4,QDExist Label $8F4,$8F8,JFetch Label $8F8,$8FC,JStash Label $8FC,$900,JIODone Label $900,$902,CurApRefnum Label $902,$903,LaunchFlag Label $904,$908,CurrentA5 Label $908,$90C,CurStack Label $910,$930,CurApName Label $930,$934,SaveSegHandle Label $934,$936,CurJTOffset Label $936,$938,CurPageOption Label $93A,$944,LoaderPBlock Label $900,$944,LoadVars Label $944,$946,PrintErr Label $946,$947,ChooserBits Label $944,$954,PrintVars Label $954,$960,CoreEdit Label $960,$964,scrapSize Label $964,$968,scrapHandle Label $968,$96A,scrapCount Label $96A,$96C,scrapState Label $96C,$970,scrapName Label $970,$980,ScrapTag Label $960,$980,ScrapVars Label $980,$984,RomFont0 Label $984,$986,ApFontID Label $986,$987,GotStrike Label $987,$988,FMDefaultSize Label $988,$98A,CurFMFamily Label $98A,$98C,CurFMSize Label $98C,$98D,CurFMFace Label $98D,$98E,CurFMNeedBits Label $98E,$990,CurFMDevice Label $990,$994,CurFMNumer Label $994,$998,CurFMDenom Label $988,$998,CurFMInput Label $998,$99A,FOutError Label $99A,$99E,FOutFontHandle Label $99E,$99F,FOutBold Label $99F,$9A0,FOutItalic Label $9A0,$9A1,FOutULOffset Label $9A1,$9A2,FOutULShadow Label $9A2,$9A3,FOutULThick Label $9A3,$9A4,FOutShadow Label $9A4,$9A5,FOutExtra Label $9A5,$9A6,FOutAscent Label $9A6,$9A7,FOutDescent Label $9A7,$9A8,FOutWidMax Label $9A8,$9A9,FOutLeading Label $9A9,$9AA,FOutUnused Label $9AA,$9AE,FOutNumeer Label $9AE,$9B2,FOutDenom Label $998,$9B2,FOutRec Label $9B2,$9B6,FMDotsPerInch Label $9B6,$9CE,FMStyleTab Label $9CE,$9D6,ToolScratch Label $9D6,$9DA,WindowList Label $9DA,$9DC,SaveUpdate Label $9DC,$9DE,PaintWhite Label $9DE,$9E2,WMgrPort Label $9E2,$9E6,DeskPort Label $9E6,$9EA,OldStructure Label $9EA,$9EE,OldContent Label $9EE,$9F2,GrayRgn Label $9F2,$9F6,SaveVisRgn Label $9F6,$9FA,DragHook Label $9FA,$A02,scratch8 Label $A02,$A06,OneOne Label $A06,$A0A,MinusOne Label $A0E,$A1C,IconBitmap Label $A1C,$A20,MenuList Label $A20,$A22,MBarEnable Label $A22,$A24,CurDeKind Label $A24,$A26,MenuFlash Label $A26,$A28,TheMenu Label $A28,$A2C,SavedHandle Label $A2C,$A30,MBarHook Label $A30,$A34,MenuHook Label $A34,$A3C,DragPattern Label $A3C,$A44,DeskPattern Label $A44,$A46,DragFlag Label $A46,$A4A,CurDragAction Label $A4A,$A50,FPState Label $A50,$A54,TopMapHndl Label $A54,$A58,SysMapHndl Label $A58,$A5A,SysMap Label $A5A,$A5C,CurMap Label $A5C,$A5E,ResReadOnly Label $A5E,$A60,ResLoad Label $A60,$A62,ResErr Label $A62,$A63,TaskLock Label $A63,$A64,FScaleDisable Label $A64,$A68,CurActivate Label $A68,$A6C,CurDeactive Label $A6C,$A70,DeskHook Label $A70,$A74,TEDoText Label $A74,$A78,TERecal Label $A78,$A84,ApplScratch Label $A84,$A88,GhostWindow Label $A88,$A8C,CloseOrnHook Label $A8C,$A90,ResumeProc Label $A90,$A94,SaveProc Label $A94,$A98,SaveSP Label $A98,$A9A,ANumber Label $A9A,$A9C,ACount Label $A9C,$AA0,DABeeper Label $AA0,$AB0,DAStrings Label $AB0,$AB2,TEScrpLength Label $AB4,$AB8,TEScrpHandle Label $AB8,$AD8,AppPacks Label $AD8,$AE8,SysResName Label $AEC,$AF0,AppParmHandle Label $AF0,$AF2,DSErrCode Label $AF2,$AF6,ResErrProc Label $AF6,$AFA,TEWdBreak Label $AFA,$AFC,DlgFont UALabelTableEnd NumUALabels EQU (UALabelTableEnd-UALabelTable)/16 ;########################### ;## ## ;## User Area functions ## ;## ## ;########################### ; ;The following is the first function in the user area. ;It is used to link between two different sets of UA functions. ; UAFunc Toggle,BlockMove DC.B 'Toggle screens {' DC.B If.Pos DC.B 'generic' DC.B If.Else DC.B 'heap, label and A000 trap' DC.B End.If DC.B ' functions}' UAParam Toggle,%00001 DC.B 0 UACode Toggle NOT.B (A0) BEQ.S @1 MOVE.W #.LabelTableSet-A,.Toggle-A(A2) RTS @1 MOVE.W #.BlockMove-A,.Toggle-A(A2) RTS ;The 1st user area screen starts here UAFunc BlockMove,BlockCompare DC.B 'Block move (src dst len)' UAParam BlockMove,%01000 UACode BlockMove MOVE.L D0,A0 ;Call the ROM _BlockMove routine. MOVE.L D1,A1 MOVE.L D2,D0 _BlockMove RTS UAFunc BlockCompare,BlockFill DC.B 'Block compare {' DC.B If.Neg DC.B Skip+9 DC.B If.Else DC.B If.Neg DC.B 'Match',Skip+8 DC.B If.Else DC.B 'Mismatch at ',Skip+1,PrHex+6,'/',Skip+1,PrHex+6 DC.B End.If DC.B End.If DC.B '} (adr1 adr2 len)',Colon DC.B If.Pos DC.B PrHex+6,' ',Skip+1,PrHex+6,' ',Skip+1,PrHex+6 UAParam BlockCompare,%01001 DC $FF00 LONG -1 LONG -1 LONG -1 LONG -1 LONG -1 UACode BlockCompare TST.B D7 ;No parameters? BEQ.S @2 ;It's a "match" TST.L D2 ;Is the length zero or negative? BLE.S @2 ;YES. All zero-length areas "match". BSR AddressCheck MOVEM.L D0/D1/D2,10(A0) ;Save the current values. MOVE.L D0,A1 MOVE.L D1,A2 SUBQ.L #1,D2 @1 CMPM.B (A1)+,(A2)+ ;Compare one byte. DBNE D2,@1 BNE.S Mismatch ;A mismatch. SUB.L val10000,D2 ;This is the compare outer loop. BCC.S @1 @2 SCC 10(A0) ;Flag whether a comparison is going. SCC (A0)+ ST (A0) ;The blocks match. RTS Mismatch CLR.W (A0)+ ;Flag a mismatch. SUBQ.W #1,A1 ;Pass back the address of the mismatch. MOVE.L A1,(A0)+ BSR StoreV SUBQ.W #1,A2 MOVE.L A2,(A0)+ @1 CMPM.B (A1)+,(A2)+ ;Now search for another match. DBEQ D2,@1 BEQ.S @2 ;A match. SUB.L val10000,D2 ;This is the compare outer loop. BCC.S @1 BRA.S @3 @2 SUBQ.W #1,A1 ;Move the pointers back one byte. SUBQ.W #1,A2 @3 ADDQ.L #1,D2 MOVE.L A1,(A0)+ ;Save the pointers and the new count for the user's MOVE.L A2,(A0)+ ;convenience. MOVE.L D2,(A0) RTS UAFunc BlockFill,Search DC.B 'Fill (bgn end val [vLen])' UAParam BlockFill,%11000 UACode BlockFill LSR.B #1,D7 BCC.S @1 BSR.S Measure ;Find the size of the item. @1 MOVEQ #%10110,D6 BSR.S MeasureCheck MOVE.L D2,D4 SUBQ.B #2,D3 BEQ.S @2 ;Do a word fill. BCC.S @3 ;Do a longword fill. LSL.W #8,D4 ;Do a byte fill. Copy the byte into both the low MOVE.B D2,D4 ;and high order bytes of the low word in D2. MOVE.W D4,D2 @2 SWAP D2 ;Copy the word into both the low and high order MOVE.W D4,D2 ;words in D2. @3 SUB.L D0,D1 ;If the ending address is lower than the beginning BLT.S @5 ;address, exit. MOVE.L D0,A0 @4 ROL.L #8,D2 ;Shift the next byte into position, and put it into MOVE.B D2,(A0)+ ;the destination. DBRA D1,@4 SUB.L val10000,D1 ;This is a continuation of the loop. BCC.S @4 @5 RTS Measure MOVEQ #1,D4 MOVEQ #0,D3 @1 ADDQ.W #1,D3 ;Compare the value against $100, $10000, and ROL.L #8,D4 ;$1000000. Estimate the length based on the CMP.L D4,D2 ;results. BCS.S @2 CMP.W #4,D3 BCS.S @1 @2 RTS MeasureCheck MOVEQ #4,D4 ;D4 contains the constant 4. CMP.L D4,D3 ;The length can't be greater than four. BLS.S @1 MOVE.L D5,D3 @1 BTST D3,D6 ;The length has to be within the requested range. BNE.S AddressCheck ADDQ.B #1,D3 BRA.S @1 AddressCheck AND.L Lo3Bytes,D0 ;Strip the high bytes from the addresses. AND.L Lo3Bytes,D1 RTS UAFunc Search,RegisterBuffer DC.B 'Find {' DC.B If.Neg DC.B 'byte' DC.B If.Else DC.B 'word' DC.B End.If DC.B ' aligned} {' DC.B If.Neg DC.B Skip+4 DC.B If.Else DC.B Skip+1,PrHex+6 DC.B End.If DC.B '} (val [vLen [bgn [end]]])',Colon DC.B If.Pos DC.B Skip+1,PrHex+8,' ' DC.B If.Pos DC.B PrHex+1,' ' DC.B If.Pos DC.B PrHex+6,' ',Skip+1,PrHex+6 UAParam Search,%11111 DC $FFFF LONG 0 DC $FF00 LONG 0 DC $FF00 LONG -1 LONG -1 UACode Search TST.B D7 ;If just a RETURN was pressed, toggle between byte BNE.S @1 ;and word aligned search. NOT.B (A0) RTS @1 EXG D0,D2 EXG D1,D3 SUBQ.B #1,D7 ;If vLen wasn't given, calculate it. BNE.S @2 BSR Measure @2 MOVEQ #%11110,D6 ;vLen can be 1..4 for byte-aligned searches and 2 TST.B (A0)+ ;or 4 for word-aligned searches. BNE.S @3 MOVEQ #%10100,D6 @3 BSR MeasureCheck SUBQ.B #3,D7 ;If the ending address wasn't given, set it to the BEQ.S @4 ;end of memory. MOVE.L RealMemTop,D1 ;Use the "real" MemTop. SUBQ.L #1,D1 @4 ST (A0)+ ;Assume that nothing was found. CLR.L (A0)+ ;Clear the "found" address. CLR.W (A0)+ ;Make everything appear. CLR.L (A0)+ ;Prevent the value itself from being found. MOVE.W D3,(A0)+ ;Save the search size. MOVE.L D0,(A0)+ ;Save the beginning address. MOVE.L D1,(A0) ;Save the ending address. MOVE.L D2,D6 ;Save the value that is being searched, but not in SUBQ.W #1,D3 ;memory, because it would be found there. MOVE.W D3,D4 ASL.W #3,D4 ;Shift the high-order byte of the value into the ROR.L D4,D2 ;least significant byte of D2. TST.B -18(A0) BMI.S @5 BCLR D5,D0 ;Align addresses to word boundaries for word-aligned BSET D5,D1 ;search. D5 should be zero. @5 MOVE.L D0,A1 SUB.L D3,D1 ;Subtract the length from the ending address. SUB.L D0,D1 ;Get the length of the area to be searched. BLT.S @50 ;It is less than zero. TST.B -18(A0) BPL.S @30 @10 CMP.B (A1)+,D2 ;Does this byte match? @11 DBEQ D1,@10 BEQ.S @12 ;YES. SUB.L val10000,D1 ;NO. This is a high-order loop. BCC.S @10 @50 MOVE.L D6,-10(A0) RTS ;Pass back failure code. @12 MOVE.W D3,D4 ;Create private copies of the address, value, and MOVE.L D2,D5 ;length of value. MOVE.L A1,A3 BRA.S @21 @20 ROL.L #8,D5 ;Compare the next byte in the value. CMP.B (A3)+,D5 BNE.S @11 @21 DBRA D4,@20 ;Were all bytes present in the value compared? CMP.L A5,A1 ;YES. Don't report a match if it is in the BCS.S @40 ;Monitor's variables area to prevent spurious finds. CMP.L A2,A1 BCS.S @11 @40 MOVEQ #1,D0 BRA.S @42 ;Go report a find. @30 ROL.L #8,D2 ;D1 contains the number of words, not bytes, for LSR.L #1,D1 ;word-aligned search. @31 CMP.W (A1)+,D2 @32 DBEQ D1,@31 BEQ.S @33 SUB.L val10000,D1 BCC.S @31 BRA.S @50 @33 CMP.W #1,D3 BEQ.S @34 MOVE.L D2,D5 SWAP D5 CMP.W (A1),D5 BNE.S @32 @34 CMP.L A5,A1 ;YES. Don't report a match if it is in the BCS.S @41 ;Monitor's variables area to prevent spurious finds. CMP.L A2,A1 BCS.S @32 @41 MOVEQ #2,D0 @42 MOVE.L A1,-(A0) ;Save the address of the match plus one. SUBQ.W #2,A0 MOVE.L D6,-(A0) ;Save the value being searched. SUBQ.W #2,A0 SUB.W D0,A1 MOVE.L A1,-(A0) ;Pass back the address of the match. CLR.B -(A0) ;Indicate that the search was successful. StoreV MOVE.L A1,V.A5 ;Store this value in the V variable. RTS UAFunc RegisterBuffer,Print DC.B 'Registers {' DC.B If.Pos DC.B Skip+1,'PC=',PrHex+8,'} (0=save, 1=load, 2=swap)' DC.B If.Else DC.B '} (0=save)' UAParam RegisterBuffer,%00011 DC $FF00 DCB.W 37,0 ;37 words for the registers UACode RegisterBuffer TST.W D7 BNE.S BufferFunctions ST (A0) RTS BufferFunctions TST.B (A0) ;Are there stored registers? BEQ.S @10 TST.L D0 BEQ.S @10 RTS @10 CLR.W (A0)+ LEA PC.A5,A5 ;Get the PC. MOVEQ #37-1,D1 ;Use 37 words. TST.L D0 ;Get the function code. BEQ.S @1 ;SaveRegs. SUBQ.L #2,D0 BEQ.S @2 ;SwapRegs. BCC.S @3 ;Exit if the number wasn't between 0 and 2. EXG A0,A5 ;LoadRegs. Do a reverse SaveRegs. @1 MOVE.W (A5)+,(A0)+ DBRA D1,@1 RTS @2 MOVE.W (A5),D2 ;Exchange the register sets. MOVE.W (A0),(A5)+ MOVE.W D2,(A0)+ DBRA D1,@2 @3 RTS ;Pick one of three routines to follow this one. UAFunc Print,Template DC.B 'Print {' DC.B If.Pos DC.B If.Pos,'dump' DC.B If.Else,'disassembly' DC.B End.If DC.B If.Else DC.B If.Pos,'file' DC.B If.Else,'heap' DC.B End.If DC.B End.If DC.B '} {error=',PrHex+4,'} (' DC.B If.Pos,'bgn end' DC.B If.Else DC.B If.Pos,'file' DC.B If.Else,'zone' DC.B End.If DC.B '#' DC.B End.If DC.B ')' UAParam Print,%00101 DC 0 PrintError DC 0 DC 0 UACode Print TST.W D7 ;Were any arguments supplied? BNE.S @2 ;YES. Go to the printing section. NOT.B 1(A0) ;NO. Go to the next state in the state machine. BNE.S @1 NOT.B (A0) EOR.B #%00110,-2(A0) ;Adjust the number of parameters allowed. @1 MOVE.W (A0),4(A0) RTS @2 MOVE.B 1(A0),D5 ;Prepare dump vs. disassembly or file vs. heap flag. SUBQ.W #2,D7 ;Is this a dump/disassembly print? BCS.S @3 ;NO. MOVE.L D0,A1 ;YES. MOVE.L D1,A4 ;Prepare the registers and go to the print routine. JMP _Print1 @3 MOVE.W D0,D6 ;Prepare the file number. TST.B D5 BEQ.S @4 TST.L D0 ;If the heap number is requested instead, prepare SEQ D6 ;that. ASL.W #8,D6 @4 JMP _Print2 ;Go to the print routine. UAFunc Template,StackLook DC.B 'Template {' DC.B If.Pos DC.B If.Pos,'WindowRecord' DC.B If.Else,'ControlRecord' DC.B End.If DC.B If.Else DC.B If.Pos,'TERec' DC.B If.Else,'ParamBlock' DC.B End.If DC.B End.If DC.B If.Pos DC.B ' @' DC.B PrHex+6 DC.B End.If DC.B '} (addr)',Colon DC.B If.Pos DC.B PrHex+6 DC.B If.Else DC.B If.Pos DC.B 'RA0' UAParam Template,%00011 DC 0 LONG -1 FutureTemplate LONG -1 UACode Template TST.B D7 BNE.S ChoseTemplate TST.L 2(A0) BPL.S CanceledTemplate NOT.B 1(A0) BNE.S @1 NOT.B (A0) @1 RTS CanceledTemplate MOVE.W #.StackLook-A,.Template-A(A2) MOVEQ #-1,D0 MOVE.L D0,2(A0) MOVE.L D0,6(A0) Template.RTS RTS ChoseTemplate MOVE.L A0,A5 MOVE.L D0,A0 BSR CheckA0 ;If A0 is odd or NIL then don't accept it. BCS.S Template.RTS MOVE.W #.Template1-A,.Template-A(A2) MOVE.W (A5)+,D0 ;Get the signatures. MOVE.L A0,(A5) ;Put the address in the template indicator. MOVE.L A0,A5 ;And into a handy register. LEA Part1,A1 ;Point the registers to the templates. LEA Part2,A2 LEA Part3,A3 LEA Part4,A4 MOVE.W D0,(A1)+ ;Inform each piece what kind it is. MOVE.W D0,(A2)+ MOVE.W D0,(A3)+ MOVE.W D0,(A4)+ PEA FinishTemplate TST.W D0 BPL.S @1 TST.B D0 BMI ParamTemplate BRA TETemplate @1 TST.B D0 BMI ControlTemplate WindowTemplate LEA portBits(A5),A0 MOVE.L (A0)+,(A1)+ ;baseAddr MOVE.W (A0)+,(A1)+ ;rowBytes MOVE.L (A0)+,(A1)+ ;bounds MOVE.L (A0)+,(A1)+ MOVE.L (A0)+,(A1)+ ;portRect MOVE.L (A0)+,(A1)+ MOVE.L (A0)+,(A2)+ ;visRgn MOVE.L (A0)+,(A2)+ ;clipRgn LEA windowKind(A5),A0 MOVE.W (A0)+,(A2)+ TST.B (A0)+ ;visible SNE (A2)+ TST.B (A0)+ ;hilited SNE (A2)+ TST.B (A0)+ ;goAway SNE (A2)+ ADDQ #1,A0 ;skip "spareFlag" MOVE.L (A0)+,(A3)+ ;strucRgn MOVE.L (A0)+,(A3)+ ;contRgn MOVE.L (A0)+,(A3)+ ;updateRgn MOVE.L (A0)+,(A3)+ ;defProc MOVE.L (A0)+,(A3)+ ;dataHandle MOVE.L wControlList(A5),(A4)+ MOVE.L nextWindow(A5),D2 MOVE.L D2,(A4)+ MOVE.L wRefCon(A5),(A4)+ MOVE.L wTitleHandle(A5),A0 BSR IndirectA0 BCC.S @1 MOVEQ #0,D0 MOVE.L D0,A0 @1 ST (A4)+ RTS ControlTemplate MOVE.L (A0)+,D2 ;nextControl MOVE.L D2,(A1)+ MOVE.L (A0)+,(A1)+ ;owner MOVE.L (A0)+,(A1)+ ;rect MOVE.L (A0)+,(A1)+ TST.B (A0)+ ;visible SNE (A1)+ MOVE.B (A0)+,(A1)+ ;hilited MOVE.W (A0)+,(A2)+ ;value MOVE.L (A0)+,(A2)+ ;min, max MOVE.L (A0)+,(A2)+ ;defProc MOVE.L (A0)+,(A2)+ ;dataHandle MOVE.L (A0)+,(A2)+ ;actionProc MOVE.L (A0)+,(A3)+ ;refCon ST (A4)+ AND.L Lo3Bytes,D2 BTST #0,D2 ;Check for odd address. BNE.S D2.NIL TST.L D2 BEQ.S D2.NIL EXG D2,A1 MOVE.L (A1),D2 RTS D2.NIL MOVEQ #0,D2 RTS TETemplate MOVE.L (A0)+,(A1)+ ;destRect MOVE.L (A0)+,(A1)+ MOVE.L (A0)+,(A1)+ ;viewRect MOVE.L (A0)+,(A1)+ MOVE.W teLineHite(A5),(A1)+ MOVE.W teNLines(A5),(A1)+ LEA teSelPoint(A5),A0 MOVE.L (A0)+,(A2)+ MOVE.L (A0)+,(A2)+ ;selStart, selEnd ADDQ #2,A0 ;skip "active" MOVE.L (A0)+,(A2)+ ;wordBreak MOVE.L (A0)+,(A2)+ ;clikLoop MOVE.L (A0)+,(A3)+ ;clickTime MOVE.W (A0)+,(A3)+ ;clickLoc MOVE.L (A0)+,(A3)+ ;caretTime MOVE.W (A0)+,(A3)+ ;caretState MOVE.W (A0)+,D0 ;justification BEQ.S @1 ;left? CMP.W MinusOne,D0 BEQ.S @1 ;right? CMP.W #1,D0 BNE.S @2 ;center? MOVE.W #$FF,D0 ;center BRA.S @1 @2 MOVE.W #$FF00,D0 ;INVALID @1 MOVE.W D0,(A3)+ MOVE.W (A0)+,(A4)+ ;length MOVE.L (A0)+,(A4)+ ;textH MOVE.W teFont(A5),(A4)+ LEA teSize(A5),A0 MOVE.W (A0)+,(A4)+ MOVE.L (A0)+,(A4)+ ;port MOVE.L (A0)+,(A4)+ ;hiHook MOVE.L (A0)+,(A4)+ ;carHook MOVEQ #-1,D2 MOVE.L D2,A0 ;A0 is for the name. MOVE.L A5,D2 ;do the same one over again CLR.B (A4)+ RTS ParamTemplate MOVE.L (A0)+,(A1)+ ;qLink ADDQ #2,A0 ;skip qType MOVE.W (A0)+,(A1)+ ;trap MOVE.L (A0)+,(A1)+ ;cmdAddr MOVE.L (A0)+,(A1)+ ;completion MOVE.W (A0)+,(A1)+ ;ioResult ADDQ #4,A0 ;skip namePtr MOVE.L (A0)+,(A2)+ ;vRefNum and refNum MOVE.W (A0)+,(A2)+ ;version and permission MOVE.L (A0)+,(A2)+ ;misc MOVE.L (A0)+,(A2)+ ;buffer MOVE.L (A0)+,(A3)+ ;reqCount MOVE.L (A0)+,(A3)+ ;actCount MOVE.W (A0)+,(A3)+ ;mode MOVE.L (A0)+,(A3)+ ;offset MOVE.L ioFileName(A5),A0 MOVE.L #$FF000000,D2 ST (A4)+ RTS SHAR_EOF if test 29950 -ne "`wc -c EUA.Asm.1`" then echo shar: error transmitting EUA.Asm.1 '(should have been 29950 characters)' fi # End of shell archive exit 0 -- Darin Adler {gatech,harvard,ihnp4,seismo}!ut-sally!ut-dillo!darin