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 4 of 7) Message-ID: <234@ut-dillo.UUCP> Date: Sun, 8-Dec-85 14:36:34 EST Article-I.D.: ut-dillo.234 Posted: Sun Dec 8 14:36:34 1985 Date-Received: Tue, 10-Dec-85 05:48:53 EST Distribution: net Organization: UTexas Computation Center, Austin, Texas Lines: 1425 This is part 4 of the source code for the Extended User Area. # 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.4 # This archive created: Sun Dec 8 13:28:18 1985 # By: Darin Adler () echo shar: extracting EUA.Asm.4 '(29228 characters)' cat << \SHAR_EOF > EUA.Asm.4 ;| ;|OUT: D0.L'=0 D2 could not be identified. ;| D2.L' D2.L:. ;| D0.L'<>0 D2 was identified. ;| D0.L' first four letters of name. ;| D1.L' last four letters of name. ;| D2.L' offset from the label to D2.L. ;| ;|Destroys D1,D3,A0,A1. ;| LabelScan MOVE.B LabelEnabled,D3 ;If there is no table of labels, do nothing. MOVEM.L D4/D5,-(SP) ;Save registers. BMI.S @20 MOVE.L LabelTable,A0 MOVE.W NumLabels,D3 MOVEQ #-1,D5 ;Assume that the best fit was 4294967295 bytes off. BRA.S @10 @1 MOVE.L A0,A1 ;Which type of a label is this? TST.B (A1) BEQ.S @2 CMP.L (A1)+,D6 ;Resource-type. The resource type and ID must BNE.S @5 ;match exactly. CMP.W (A1)+,D7 BNE.S @5 MOVEQ #0,D4 ;Get the address pointed by this label into D4. MOVE.W (A1)+,D4 ADD.L A4,D4 BRA.S @3 @2 MOVE.L (A1)+,D4 ;Absolute-type. The given location must be below CMP.L (A1)+,D2 ;the maximum address given. If it is, get the BCC.S @5 ;address pointed by this label into D4. @3 SUB.L D4,D2 BCS.S @4 ;Calculate the difference between D4 and the CMP.L D5,D2 ;location given, and check if this is a closest BCC.S @4 ;match. MOVE.L D2,D5 MOVE.L (A1)+,D0 ;If so, copy the name into D0 and D1 and the MOVE.L (A1),D1 ;difference into D5. @4 ADD.L D4,D2 @5 ADD.W #16,A0 @10 DBRA D3,@1 LEA UALabelTableEnd,A1 ;Check if we were scanning the built in table. CMP.L A0,A1 BEQ.S @21 ;If so, we are done @20 LEA UALabelTable,A0 MOVE.W #NumUALabels,D3 BRA.S @10 @21 TST.L D0 ;If a good label has been found, put the difference BEQ.S @11 ;into D2. MOVE.L D5,D2 @11 MOVEM.L (SP)+,D4/D5 ;Restore registers. @12 RTS ;#################################### ;## ## ;## Heap identification routines ## ;## ## ;#################################### STRING_FORMAT 2 ;Precede strings with length byte. Heap.V1 DC GrayRgn ;Locations of some low memory locations that DC MenuList ;contain handles. DC TEScrpHandle ;To add more, instert additional addresses here and DC ScrapHandle ;put their names into Heap.L1. DC SaveVisRgn Heap.V1End Heap.V2 DC.B visRgn,clipRgn,picSave,rgnSave,polySave DC.B structRgn,contRgn,updateRgn DC.B wDataHandle,wTitleHandle,windowPic DC.B items,teHandle ;Only in dialog windows. Heap.FInfo DC.B 'FinderInfo' Heap.Control DC.B 'Control' Heap.DI DC.B 'Item #$' Heap.DI2 DC.B ' Type $' Heap.W2 DC.B '(Window @$' Heap.ParamText DC.B 'ParamText' Heap.Window DC.B 'Window #$' Heap.Kind DC.B ', Kind $' Heap.Map DC.B 'Resource map $' Heap.WMgrPort DC.B 'WMgrPort' Heap.RPSpace DC.B ') ' Heap.RP8Spaces DC.B ') ' Heap.. Heap.L1 DC.B 'GrayRgn' ;See Heap.V1 on how to add more names here. DC.B 'MenuList' DC.B 'TEScrap' DC.B 'Scrap' DC.B 'SaveVisRgn' Heap.L2 DC.B 'VisRgn','ClipRgn','PicSave','RgnSave','PolySave' DC.B 'StructRgn','ContRgn','UpdateRgn' DC.B 'WData','WTitle','WPic' DC.B 'Items','TEHandle' .ALIGN 2 STRING_FORMAT 0 ;Normal strings ;+--------------------------------+ ;| Identify the heap block at A3. | ;+--------------------------------+ ;| ;|ENTRY: HeapIdentify ;| ;|IN: D3.W: 0 if nonrelocatable block, 1 if relocatable block, 2 if resource relocatable block. ;| A1: ^heap zone containing the block. ;| A2: ^text area for the information about the block. ;| A3: ^block. ;| A4: another pointer into the text area. See the manual. ;| A5: ^Monitor's variables. ;| A6: ^handle if this is a relocatable block. ;| ;|OUT: A2' A2: moved past the text stored. ;| ;|Destroys D0-D7,A0,A1,A3,A4,A6. ;| HeapIdentify SUBQ.W #1,D3 ;Look only at unidentified relocatable blocks and BEQ.S Heap.Relocatable ;nonrelocatable blocks. BCC.S Heap.RTS MOVEQ #18,D1 ;This is a nonrelocatable block. Print 19 spaces. MOVEQ #' ',D0 @1 MOVE.B D0,(A2)+ DBRA D1,@1 CMP.L WMgrPort,A3 ;Is this the Window Manager BNE.S @2 ;port? MOVEQ #Heap.WMgrPort-Heap..,D7 BRA.S Heap.PString @2 LEA WindowList-nextWindow,A0;Scan the window list to check if this block is in MOVEQ #-1,D0 ;it. @3 MOVE.L nextWindow(A0),A0 ADDQ.B #1,D0 BSR CheckA0 BCS.S Heap.RTS ;The list is over; quit. CMP.L A0,A3 BNE.S @3 MOVEQ #Heap.Window-Heap..,D7 ;This block is in the list. BSR.S Heap.PString JSR _Put2Dig ;Display both the window number and kind. MOVEQ #Heap.Kind-Heap..,D7 MOVE.W windowKind(A0),D0 Heap.S.D BSR.S Heap.PString ;Print a string and then a number. JMP _Put4Dig ;+----------------------------------------------------+ ;| Transfer a string from the string list onto (A2)+. | ;+----------------------------------------------------+ ;| ;|ENTRY: Heap.IString ;| ;|IN: A2: ^destination text. ;| D1.W: string number (0=first, 1=second, etc.) ;| D7.W: offset to the first string from Heap.. ;| ;|OUT: A2' A2: moved past the copied string. ;| ;|Destroys D1,D7. ;| ;|ENTRY: Heap.PString ;| ;|Same as above, except that D1.W: is set to zero. ;| Heap.PString MOVEQ #0,D1 ;Get the first string encountered in list. Heap.IString MOVE.L A0,-(SP) ;Get the D1th string after the one at Heap..+D7. LEA Heap..,A0 ;A0 was saved. ADD.W D7,A0 MOVEQ #0,D7 BRA.S @1 @2 ADD.W D7,A0 @1 MOVE.B (A0)+,D7 ;Get the length of a string. DBRA D1,@2 ;If indexing, skip past that string. BRA.S @3 @4 MOVE.B (A0)+,(A2)+ ;Copy the string into the destination. @3 DBRA D7,@4 MOVE.L (SP)+,A0 ;Restore A0 and exit. Heap.RTS RTS Heap.Relocatable MOVE.W #' ',(A2)+ ;Print two spaces. MOVE.L CurrentA5,A0 BSR.S @49 ;Check if this block is the Finder information BCS.S @1 ;handle. MOVEQ #Heap.FInfo-Heap..,D7 CMP.L 16(A0),A6 BEQ.S Heap.PString ;Yes. Print the appriopriate information. @1 MOVEQ #(Heap.V1End-Heap.V1)/2-1,D1 LEA Heap.V1End,A0 MOVEQ #0,D7 ;Check if the low memory locations have @2 MOVE.W -(A0),A4 ;handles to this block. CMP.L (A4),A6 BEQ.S Heap.IString DBRA D1,@2 MOVEQ #'0',D2 ;Check the four ParamText locations. LEA DAStrings,A0 @3 CMP.L (A0)+,A6 BNE.S @4 MOVEQ #Heap.ParamText-Heap..,D7 BSR.S Heap.PString MOVE.B D2,(A2)+ @9 RTS @4 ADDQ.B #1,D2 CMP.B #'4',D2 BNE.S @3 LEA TopMapHndl-nextMap,A0 ;Scan the resource file list. @10 MOVE.L nextMap(A0),A0 BSR IndirectA0 ;If there is a problem indirecting, abandon scan. BCS.S @11 CMP.L A0,A3 ;Is this the desired block? BNE.S @10 ;NO. Scan more. MOVEQ #Heap.Map-Heap..,D7 ;YES. Give information. MOVE.W resFileID(A0),D0 BRA Heap.S.D ;Exit. @49 BRA CheckA0 @30 BSR Heap.WString ;Print the type of handle found. MOVEQ #Heap.L2-Heap..,D7 BRA Heap.IString @11 MOVEQ #0,D3 MOVE.L WMgrPort,A0 BRA.S @50 @51 NOT.B D3 ;Switch from scanning WMgrPort to the window list. BEQ.S @9 LEA WindowList-nextWindow,A4;Scan the window list. @12 MOVE.L nextWindow(A4),A0 @50 BSR.S @49 BCS.S @51 ;The list is over; quit. MOVE.L A0,A4 ;(A4 also points to the current window.) MOVEQ #4,D2 TST.B D3 ;If this is WMgrPort, check only the port variables. BEQ.S @13 MOVEQ #10,D2 CMP.W #dialogKind,windowKind(A0) ;Is this a dialog window? BNE.S @13 ;NO. MOVEQ #12,D2 ;YES. There is one more handle to be checked. @13 LEA Heap.V2,A1 ;Check each handle in turn. MOVEQ #0,D0 MOVEQ #-1,D1 @14 ADDQ.W #1,D1 MOVE.B (A1)+,D0 CMP.L 0(A0,D0),A6 BEQ.S @30 ;There is a match. DBRA D2,@14 TST.B D3 ;If this is WMgrPort, begin scanning the window BEQ.S @51 ;list. CMP.W #dialogKind,windowKind(A4) ;Is this a dialog window? BNE.S @21 ;NO. MOVE.L items(A4),A0 BSR IndirectA0 ;Get the item list. BCS.S @21 TST.B (A0) ;Don't bother checking if there are more than 256 BNE.S @21 ;items. MOVE.W (A0)+,D0 MOVEQ #0,D2 @20 CMP.L (A0)+,A6 BEQ.S @31 ;There is a match. ADD.W #9,A0 ;Skip past the other items and the string to the MOVEQ #0,D1 ;next handle. MOVE.B (A0),D1 ADDQ.W #1,D1 BSET #0,D1 ADD.W D1,A0 ADDQ.W #1,D2 DBRA D0,@20 @21 LEA wControlList(A4),A0 ;Prepare to scan the control list. @22 MOVE.L (A0),A0 CMP.L A0,A6 ;Does this control match the handle? BEQ.S @33 BSR.S IndirectA0 ;NO. Go check the next one. BCC.S @22 BRA.S @12 @31 BSR.S Heap.WString ;Identify the current window. MOVEQ #Heap.DI-Heap..,D7 BSR.S Heap.toPString MOVE.W D2,D0 BSR.S @32 ;Print the item number. MOVEQ #Heap.DI2-Heap..,D7 BSR.S Heap.toPString MOVE.B 8(A0),D0 @32 JMP _Put2Dig @33 BSR.S Heap.WString ;Identify the current window and just print that MOVEQ #Heap.Control-Heap..,D7 ;this control belongs to that window. Heap.toPString BRA Heap.PString Heap.WString MOVE.W D1,-(SP) ;Identify the current window. TST.B D3 BNE.S @1 MOVE.B #'(',(A2)+ ;This is the WMgrPort. MOVEQ #Heap.WMgrPort-Heap..,D7 BSR.S Heap.toPString MOVEQ #Heap.RP8Spaces-Heap..,D7 BSR.S Heap.toPString BRA.S @2 @1 MOVEQ #Heap.W2-Heap..,D7 ;Print the address of the current window. BSR.S Heap.toPString MOVE.L A4,D0 JSR _Put6Dig ;Give the address of the window. MOVEQ #Heap.RPSpace-Heap..,D7 BSR.S Heap.toPString @2 MOVE.W (SP)+,D1 RTS ;+-----------------------------------------------------+ ;| Dereference A0, checking it to make sure it is even | ;| and non-NIL both before and after dereferencing. | ;+-----------------------------------------------------+ ;| ;|ENTRY: IndirectA0 ;| ;|IN: A0: pointer ;| ;|OUT: Carry set A0: or (A0:) was NIL or odd. ;| A0' unpredictable. ;| Carry clear otherwise ;| A0' (A0:) ;| ;|Destroys D7. ;| ;| ;+----------------------------------------+ ;| Make sure that A0 is even and non-NIL. | ;+----------------------------------------+ ;| ;|ENTRY: CheckA0 ;| ;|IN: A0: pointer ;| ;|OUT: Carry set A0: was NIL or odd. ;| Carry clear otherwise ;| ;|Destroys D7. ;| IndirectA0 BSR.S CheckA0 ;Check A0 before dereferencing. BCS.S CheckA0.RTS ;If error do nothing. MOVE.L (A0),A0 ;Dereference it and check again. CheckA0 MOVE.L A0,D7 ;Make sure that A0 is both non-NIL and even. BEQ.S @1 LSR.B #1,D7 RTS @1 SUBQ.L #1,D7 ;Set the carry flag if it isn't. CheckA0.RTS RTS ;########################## ;## ## ;## Discipline section ## ;## ## ;########################## DisciplineInit LEA updating,A0 CLR.L (A0) ;Initialize the Begin/EndUpdate. RTS retOK MOVEQ #0,D7 RTS retErr MOVE #%01000,CCR ;Set the N bit to 1. RTS MACRO ErrText code,string = err{code} TRAPMon '? {string}' retErr{code} MOVE.W #err{code}-A,D7 BRA retErr | CheckRAM ;Given an address in D0, this checks to see if it is even. ;It also checks that it is between 0 and MemTop. ;It returns D0 with the high byte masked off. BTST #0,D0 ;odd address BNE.S retErrOdd CheckOddRAM AND.L Lo3Bytes,D0 ;mask off high byte BEQ.S retErrZero CheckRAM. CMP.L RealMemTop,D0 BHS.S retErrAddress ;too high BRA.S retOK ErrText Zero,NIL address ErrText Odd,odd address ErrText Address,address CheckROM ;Given an address in D0, this checks to see if it is even. ;It also checks that it is between $400000 and $40FFFF. ;It returns D0 with the high byte masked off. BTST #0,D0 ;odd address BNE.S retErrOdd CheckOddROM AND.L Lo3Bytes,D0 ;mask off high byte BEQ.S retErrZero CheckROM. CMP.L #$400000,D0 BLO.S retErrAddress ;too low CMP.L #$410000,D0 BHS.S retErrAddress ;too high BRA retOK CheckAddress BSR CheckRAM BPL.S @1 BSR.S CheckROM. @1 RTS CheckOddAddress BSR CheckOddRAM BPL.S @1 BSR CheckROM. @1 RTS CheckString BSR.S CheckOddAddress BMI retErrString MOVE.L D0,A0 ADD.B (A0),D0 BSR.S CheckOddAddress BMI retErrStringLength RTS ErrText String,string ErrText StringLength,string length CheckJT BSR CheckRAM BMI.S retErrJT CMP.L BufPtr,D0 BHS.S retErrJT SUB.L CurrentA5,D0 BLO.S retErrJT MOVEQ #0,D1 MOVE.W CurJTOffset,D1 SUB.L D1,D0 BLO.S retErrJT AND.B #3,D0 SUBQ.B #2,D0 BNE.S retErrJT BRA retOK ErrTExt JT,jump table CheckZone ;Given a heap zone address in D0, this checks to see that D0 is a valid ;heap zone pointer. ;It trashes register D0. A1 is set to point to the zone header. BSR CheckRAM BMI.S retErrZonePtr MOVE.L D0,A1 ;check fields of this heap ADD.L #heapData,D0 ;point to the first byte of the heap CMP.L bkLim(A1),D0 ;get the top of the heap BHS.S retErrZone ;if the header is too high, it is screwed up MOVE.L bkLim(A1),D0 BSR CheckRAM BMI.S retErrZone RTS ErrText ZonePtr,THz ErrText Zone,Zone CheckBlock ;Given a heap zone address in D0 and a block pointer in A0, this checks ;to see that D0 is a valid heap zone pointer and that A0 falls within ;the zone. ;It trashes registers A1 and D0. CMP.L D0,A0 ;compare with the header BLO retErr BSR.S CheckZone BMI retErr CMP.L bkLim(A1),A0 ;compare with the top of the heap BHS retErr BRA retOK CheckPtr ;Given an address in D0, this checks to see if it is a valid pointer. ;It trashes registers D0, A0 and A1. BSR CheckRAM BMI.S retErrPtr ;check if pointer is good at all MOVE.L D0,A0 ;look at block more closely MOVE.B tagBC-blkData(A0),D0 AND.B #tybkMask<<6,D0 ;get the block type CMP.B #tybkNRel<<6,D0 ;is is a non-relocatable? BNE.S retErrPtr MOVE.L handle-blkData(A0),D0 BSR.S CheckBlock ;get a pointer to the heap zone BMI.S retErrPtr RTS ErrText Ptr,Ptr CheckHandle ;Given an address in D0, this checks to see if it is a valid handle. ;It trashes registers D0, A0 and A1. BSR CheckRAM BMI.S retErrHandle MOVE.L D0,A1 ;save the master pointer address for later MOVE.L D0,A0 MOVE.L (A0),D0 ;deref handle BEQ retOK ;purged handle is OK (master pointer=0) BSR CheckRAM BMI.S retErrHandle ;check if master pointer is valid MOVE.L D0,A0 ;look at block more closely MOVE.B tagBC-blkData(A0),D0 AND.B #tybkMask<<6,D0 ;get the block type CMP.B #tybkRel<<6,D0 ;is is a relocatable? BNE.S retErrHandle MOVE.L A1,D0 ;get a pointer to the heap zone SUB.L handle-blkData(A0),D0 BSR.S CheckBlock ;by subtracting the relative handle BMI.S retErrHandle ;from the absolute handle and check it RTS ErrText Handle,Handle CheckFakeHandle ;This is just like CheckHandle except the handle can be a "fake" one. BSR CheckAddress BMI.S retErrHandle MOVE.L D0,A0 MOVE.L (A0),D0 BEQ retOK BSR CheckAddress BMI.S retErrHandle RTS CheckFullHandle ;This is just like CheckHandle except the handle cannot be empty. MOVE.L D0,-(SP) BSR.S CheckHandle MOVEA.L (SP)+,A0 BMI.S retErrHandle MOVE.L (A0),D0 AND.L Lo3Bytes,D0 BEQ.S retErrEmptyHandle BRA retOK ErrText EmptyHandle,empty Handle CheckFakeFullHandle ;This is just like CheckFullHandle except the handle can be a "fake" one. BSR CheckAddress BMI retErrHandle MOVE.L D0,A0 MOVE.L (A0),D0 BSR CheckAddress BMI retErrHandle RTS CheckRect ;Given a pointer to a rectangle in D0, it checks that it is sensible. ;It trashes A0 and returns the right-left value in D0 if it is successful. BSR CheckAddress BMI.S retErrRectPtr CheckRect. MOVE.L D0,A0 MOVE.W bottom(A0),D0 SUB.W top(A0),D0 BLT.S retErrRect MOVE.W right(A0),D0 SUB.W left(A0),D0 BLT.S retErrRect BRA retOK ErrText RectPtr,^Rect ErrText Rect,Rect CheckBitMap ;Given a bit map pointer in D0, this checks that it is a valid bit map. BSR CheckAddress BMI.S retErrBitMapPtr CheckBitMap. MOVE.L D0,A1 MOVE.L baseAddr(A1),D0 BSR CheckAddress BMI.S retErrBaseAddr MOVE.L A1,D0 ADD.L #bounds,D0 BSR CheckRect. BMI.S retErrBounds MOVE.W rowBytes(A1),D1 BTST #0,D1 BNE retErrRowBytes MOVE.W bounds+bottom(A1),D0 SUB.W bounds+top(A1),D0 MULU D1,D0 ;calculate the size of this bitmap AND.L #$FFFF,D0 ;mask off the low word ADD.L baseAddr(A1),D0 ;calculate the last address of this bitmap BSR CheckAddress BMI.S retErrBitMap RTS ErrText BitMapPtr,^BitMap ErrText BitMap,BitMap ErrText BaseAddr,baseAddr ErrText Bounds,bounds ErrText RowBytes,rowBytes CheckCursor ;Given a cursor pointer in D0, this checks the hot spot. BSR CheckAddress BMI.S retErrCursorPtr CheckCursor. MOVE.L D0,A0 ;point to that hot spot MOVE.W hotSpot+h(A0),D0 CMP.W #16,D0 BHI.S retErrHotSpot MOVE.W hotSpot+v(A0),D0 CMP.W #16,D0 BHI.S retErrHotSpot BRA retOK ErrText CursorPtr,^Cursor ErrText HotSpot,hotSpot CheckPPR ;Given an address in D0, this checks if it is a good Region or Picture ;or Polygon. ;It trashes A0, A1, D0 and D1. MOVE.L D0,D1 BSR CheckFullHandle BMI.S @1 MOVE.L D1,A0 MOVE.L (A0),A0 MOVE.W (A0)+,D0 ;get the PPR length CMP.W #10,D0 BLT retErr ;good lengths are >= 10 MOVE.L A0,D0 ;get the PPR pointer BSR CheckRect. @1 RTS CheckPict BSR.S CheckPPR BMI.S retErrPict RTS ErrText Pict,PicHandle CheckPoly BSR.S CheckPPR BMI.S retErrPoly RTS ErrText Poly,PolyHandle CheckRgn BSR.S CheckPPR BMI.S retErrRgn RTS ErrText Rgn,RgnHandle CheckPort ;Given a grafPort in D0, this checks just about every thing that you ;can check. BSR CheckRAM BMI.S retErrPort CheckPort. MOVE.L D0,A2 ;point to the port ADD.L #portBits,D0 ;point to the bitMap BSR CheckBitMap. BMI @3 MOVE.L A2,D0 ADD.L #portRect,D0 ;point to the rectangle BSR CheckRect. BMI.S retErrPortRect MOVE.L visRgn(A2),D0 ;check this region BSR CheckRgn BMI.S retErrVisRgn MOVE.L clipRgn(A2),D0 ;check this region BSR CheckRgn BMI.S retErrClipRgn MOVE.L grafProcs(A2),D0 BEQ.S @2 BSR CheckAddress BMI.S retErrGrafProcs MOVE.L D0,A0 MOVEQ #13-1,D1 @1 MOVE.L (A0)+,D0 BSR CheckAddress BMI.S retErrGrafProcs DBRA D1,@1 @2 BRA retOK @3 RTS ErrText Port,GrafPtr ErrText PortRect,portRect ErrText VisRgn,visRgn ErrText ClipRgn,clipRgn ErrText GrafProcs,grafProcs CheckWindow BSR CheckAddress BMI retErrWindow CheckWindow. BSR CheckPort. BMI @4 MOVE.L structRgn(A2),D0 ;check this region BSR CheckRgn BMI retErrStructRgn MOVE.L contRgn(A2),D0 ;check this region BSR CheckRgn BMI retErrContRgn MOVE.L updateRgn(A2),D0 ;check this region BSR CheckRgn BMI retErrUpdateRgn MOVE.L windowDef(A2),D0 ;check the defProc BSR CheckFakeHandle BMI retErrDefProc MOVE.L wTitleHandle(A2),D0 ;check the title BEQ.S @1 BSR CheckFullHandle BMI retErrWTitle @1 MOVE.L wControlList(A2),D0 ;check the control list BEQ.S @2 BSR CheckFullHandle BMI retErrControlList @2 MOVE.L nextWindow(A2),D0 ;check the next window BEQ.S @3 BSR CheckRAM BMI retErrNextWindow @3 MOVE.L windowPic(A2),D0 ;check the picture handle BEQ.S @4 BSR CheckFullHandle BMI retErrWindowPic @4 RTS ErrText Window,WindowPtr ErrText StructRgn,strucRgn ErrText ContRgn,contRgn ErrText UpdateRgn,updateRgn ErrText WTitle,titleHandle ErrText ControlList,controlList ErrText NextWindow,nextWindow ErrText WindowPic,windowPic CheckBehind TST.L D0 BEQ retOK CMP.L MinusOne,D0 ;-1 is also OK BEQ retOK BSR CheckWindow RTS CheckControl MOVE.L D0,A2 BSR CheckFullHandle BMI retErrControl CheckControl. MOVE.L (A2),D0 ADD.L #contrlRect,D0 ;point to the rectangle BSR CheckRect. BMI retErrContrlRect MOVE.L (A2),A2 MOVE.L nextControl(A2),D0 ;check the nextControl BEQ.S @1 BSR CheckFullHandle BMI retErrNextControl @1 MOVE.L contrlDefHandle(A2),D0 ;check the defProc BSR CheckFakeHandle BMI retErrDefProc MOVE.L contrlAction(A2),D0 ;check the actionProc BEQ.S @2 CMP.L MinusOne,D0 ;-1 is ok, too BEQ.S @2 BSR CheckAddress BMI.S retErrAction @2 MOVE.L contrlOwner(A2),D0 ;check the owner BSR CheckRAM BMI.S retErrContrlOwner RTS ErrText Control,ControlHandle ErrText ContrlRect,contrlRect ErrText NextControl,nextControl ErrText Action,actionProc ErrText ContrlOwner,contrlOwner CheckMenu MOVE.L D0,A2 BSR CheckFullHandle BMI.S retErrMenu MOVE.L (A2),A2 MOVE.L menuDefHandle(A2),D0 ;check the menu defProc BSR CheckFakeHandle BMI.S retErrDefProc RTS ErrText Menu,MenuHandle ErrText DefProc,defProc handle CheckTERec MOVE.L D0,A2 BSR CheckFullHandle BMI.S retErrTE MOVE.L (A2),D0 ADD.L #teDestRect,D0 ;point to the rectangle BSR CheckRect. BMI retErrDestRect MOVE.L (A2),D0 ADD.L #teViewRect,D0 ;point to the rectangle BSR CheckRect. BMI retErrViewRect MOVE.L (A2),A2 MOVE.L teTextH(A2),D0 ;check the text BSR CheckFullHandle BMI retErrTextH MOVE.L teWordBreak(A2),D0 BEQ.S @1 BSR CheckAddress BMI retErrWordBreak @1 MOVE.L teClikProc(A2),D0 BEQ.S @2 BSR CheckAddress BMI retErrClikProc @2 MOVE.L teHiHook(A2),D0 BEQ.S @3 BSR CheckAddress BMI retErrHiHook @3 MOVE.L teCarHook(A2),D0 BEQ.S @4 BSR CheckAddress BMI retErrCarHook @4 MOVE.L teGrafPort(A2),D0 BSR CheckRAM BMI retErrInPort RTS ErrText TE,TEHandle ErrText DestRect,destRect ErrText ViewRect,viewRect ErrText TextH,text handle ErrText WordBreak,wordBreak ErrText ClikProc,clikLoop ErrText HiHook,highHook ErrText CarHook,caretHook ErrText InPort,TE GrafPtr CheckDialog BSR CheckAddress BMI.S retErrDialog CheckDialog. BSR CheckWindow. BMI @1 MOVE.L items(A2),D0 BSR CheckFullHandle BMI.S retErrItemList MOVE.L teHandle(A2),D0 BEQ.S @1 BSR CheckFullHandle BMI.S retErrEditText @1 RTS ErrText Dialog,DialogPtr ErrText ItemList,item list ErrText EditText,editText item ;+------------------------------------------------------------------+ ;| The following code is for actual use of the Check... code above. | ;+------------------------------------------------------------------+ ROMA0 MOVE.L RegA0,D0 ;get ROM location in register .CheckROM BRA CheckROM RAMA0 MOVE.L RegA0,D0 ;get RAM location in register .CheckRAM BRA CheckRAM RAMA1 MOVE.L RegA1,D0 ;get RAM location in register BRA.S .CheckRAM RAM0 MOVE.L Stack0,D0 ;get RAM location in register BRA.S .CheckRAM RAM2 MOVE.L Stack2,D0 ;get RAM location in register BRA.S .CheckRAM RAM4 MOVE.L Stack4,D0 ;get RAM location in register BRA.S .CheckRAM RAM6 MOVE.L Stack6,D0 ;get RAM location in register BRA.S .CheckRAM RAM8 MOVE.L Stack8,D0 ;get RAM location in register BRA.S .CheckRAM RAM22 MOVE.L Stack22,D0 ;get RAM location in register BRA.S .CheckRAM OddRAMA0 MOVE.L RegA0,D0 ;get RAM location in register .CheckOddRAM BRA CheckOddRAM OddRAM4 MOVE.L Stack4,D0 ;get RAM location in register BRA.S .CheckOddRAM AddressA0 MOVE.L RegA0,D0 ;get address in register .CheckAddress BRA CheckAddress AddressA1 MOVE.L RegA1,D0 ;get address in register BRA.S .CheckAddress Address0 MOVE.L Stack0,D0 ;get address in register BRA.S .CheckAddress Address4 MOVE.L Stack4,D0 ;get address in register BRA.S .CheckAddress Address8 MOVE.L Stack8,D0 ;get address in register BRA.S .CheckAddress Address10 MOVE.L Stack10,D0 ;get address in register BRA.S .CheckAddress Address16 MOVE.L Stack16,D0 ;get address in register BRA.S .CheckAddress OddAddressA0 MOVE.L RegA0,D0 ;get address in register .CheckOddAddress BRA CheckOddAddress OddAddress0 MOVE.L Stack0,D0 ;get address in register BRA.S .CheckOddAddress OddAddress4 MOVE.L Stack4,D0 ;get address in register BRA.S .CheckOddAddress OddAddress8 MOVE.L Stack8,D0 ;get address in register BRA.S .CheckOddAddress OddAddress12 MOVE.L Stack12,D0 ;get address in register BRA.S .CheckOddAddress StringA0 MOVE.L RegA0,D0 ;get string in register .CheckString BRA CheckString String0 MOVE.L Stack0,D0 ;get string in register BRA.S .CheckString String2 MOVE.L Stack2,D0 ;get string in register BRA.S .CheckString String4 MOVE.L Stack4,D0 ;get string in register BRA.S .CheckString String10 MOVE.L Stack10,D0 ;get string in register BRA.S .CheckString String14 MOVE.L Stack14,D0 ;get string in register BRA.S .CheckString String16 MOVE.L Stack16,D0 ;get string in register BRA.S .CheckString String18 MOVE.L Stack18,D0 ;get string in register BRA.S .CheckString String20 MOVE.L Stack20,D0 ;get string in register BRA.S .CheckString String26 MOVE.L Stack26,D0 ;get string in register BRA.S .CheckString JTPC MOVE.L RegPC,D0 .CheckJT BRA CheckJT JT0 MOVE.L Stack0,D0 BRA.S .CheckJT ZoneA0 MOVE.L RegA0,D0 .CheckZone BRA CheckZone PtrA0 MOVE.L RegA0,D0 ;get handle in register .CheckPtr BRA CheckPtr Ptr0 MOVE.L Stack0,D0 ;get handle in register BRA.S .CheckPtr HandleA0 MOVE.L RegA0,D0 ;get handle in register .CheckHandle BRA CheckHandle Handle0 MOVE.L Stack0,D0 ;get handle in register BRA.S .CheckHandle Handle4 MOVE.L Stack4,D0 ;get handle in register BRA.S .CheckHandle FullHandleA0 MOVE.L RegA0,D0 ;get handle in register .CheckFullHandle BRA CheckFullHandle FullHandleA1 MOVE.L RegA1,D0 ;get handle in register BRA.S .CheckFullHandle FullHandle0 MOVE.L Stack0,D0 ;get handle in register BRA.S .CheckFullHandle FullHandle2 MOVE.L Stack2,D0 ;get handle in register BRA.S .CheckFullHandle FullHandle4 MOVE.L Stack4,D0 ;get handle in register BRA.S .CheckFullHandle FullHandle8 MOVE.L Stack8,D0 ;get handle in register BRA.S .CheckFullHandle FullHandle10 MOVE.L Stack10,D0 ;get handle in register BRA.S .CheckFullHandle FakeFullHandle0 MOVE.L Stack0,D0 ;get handle in register .CheckFakeFullHandle BRA CheckFakeFullHandle Cursor0 MOVE.L Stack0,D0 ;get cursor location in register .CheckCursor BRA CheckCursor Rect0 MOVE.L Stack0,D0 ;get rectangle in register .CheckRect BRA CheckRect RTS Rect2 MOVE.L Stack2,D0 ;get rectangle in register BRA.S .CheckRect Rect4 MOVE.L Stack4,D0 ;get rectangle in register BRA.S .CheckRect Rect6 MOVE.L Stack6,D0 ;get rectangle in register BRA.S .CheckRect Rect8 MOVE.L Stack8,D0 ;get rectangle in register BRA.S .CheckRect Rect10 MOVE.L Stack10,D0 ;get rectangle in register BRA.S .CheckRect Rect18 MOVE.L Stack18,D0 ;get rectangle in register BRA.S .CheckRect Rect22 MOVE.L Stack22,D0 ;get rectangle in register BRA.S .CheckRect Rgn0 MOVE.L Stack0,D0 ;get region in register .CheckRgn BRA CheckRgn Rgn4 MOVE.L Stack4,D0 ;get region in register BRA.S .CheckRgn Rgn8 MOVE.L Stack8,D0 ;get region in register BRA.S .CheckRgn Rgn18 MOVE.L Stack18,D0 ;get region in register BRA.S .CheckRgn Poly0 MOVE.L Stack0,D0 ;get polygon in register .CheckPoly BRA CheckPoly Poly4 MOVE.L Stack4,D0 ;get polygon in register BRA.S .CheckPoly Poly8 MOVE.L Stack8,D0 ;get polygon in register BRA.S .CheckPoly Pict0 MOVE.L Stack0,D0 ;get picture in register .CheckPict BRA CheckPict Pict4 MOVE.L Stack4,D0 ;get picture in register BRA.S .CheckPict Port0 MOVE.L Stack0,D0 ;get port in register .CheckPort BRA CheckPort Window0 MOVE.L Stack0,D0 ;get window in register .CheckWindow BRA CheckWindow Window2 MOVE.L Stack2,D0 ;get window in register BRA.S .CheckWindow Window4 MOVE.L Stack4,D0 ;get window in register BRA.S .CheckWindow Window6 MOVE.L Stack6,D0 ;get window in register BRA.S .CheckWindow Window8 MOVE.L Stack8,D0 ;get window in register BRA.S .CheckWindow Window22 MOVE.L Stack22,D0 ;get window in register BRA.S .CheckWindow Behind0 MOVE.L Stack0,D0 ;check the behind field .CheckBehind BRA CheckBehind Behind6 MOVE.L Stack6,D0 ;check the behind field BRA.S .CheckBehind Behind10 MOVE.L Stack10,D0 ;check the behind field BRA.S .CheckBehind Dialog0 MOVE.L Stack0,D0 ;check the dialog .CheckDialog BRA CheckDialog Dialog6 MOVE.L Stack6,D0 ;check the dialog BRA.S .CheckDialog Dialog12 MOVE.L Stack12,D0 ;check the dialog BRA.S .CheckDialog Dialog14 MOVE.L Stack14,D0 ;check the dialog BRA.S .CheckDialog Menu0 MOVE.L Stack0,D0 ;get menu handle in register .CheckMenu BRA CheckMenu Menu2 MOVE.L Stack2,D0 ;get menu handle in register BRA.S .CheckMenu Menu4 MOVE.L Stack4,D0 ;get menu handle in register BRA.S .CheckMenu Menu6 MOVE.L Stack6,D0 ;get menu handle in register BRA.S .CheckMenu Control0 MOVE.L Stack0,D0 ;get control handle in register .CheckControl BRA CheckControl Control2 MOVE.L Stack2,D0 ;get control handle in register BRA.S .CheckControl Control4 MOVE.L Stack4,D0 ;get control handle in register BRA.S .CheckControl Control8 MOVE.L Stack8,D0 ;get control handle in register BRA.S .CheckControl Control14 MOVE.L Stack14,D0 ;get control handle in register BRA.S .CheckControl ProcA0 MOVE.L RegA0,D0 ;get the proc into a register .CheckProc BEQ retOK BRA CheckAddress Proc0 MOVE.L Stack0,D0 ;get the proc into a register BRA.S .CheckProc Proc4 MOVE.L Stack4,D0 ;get the proc into a register BRA.S .CheckProc TERec0 MOVE.L Stack0,D0 ;get TERec handle in register .CheckTERec BRA CheckTERec BitMap0 MOVE.L Stack0,D0 ;get bitmap pointer in register .CheckBitMap BRA CheckBitMap BitMap14 SHAR_EOF if test 29228 -ne "`wc -c EUA.Asm.4`" then echo shar: error transmitting EUA.Asm.4 '(should have been 29228 characters)' fi # End of shell archive exit 0 -- Darin Adler {gatech,harvard,ihnp4,seismo}!ut-sally!ut-dillo!darin