******************************************************************************** * Debugger for CoreEye by MC68 * * If you find any bugs in the program please let me know. * * Write to the following address: * * Andrzej Fien Finished: 14.09.1990 * * ul.Turkienicza 17/26 * * 35-010 Rzeszow * * POLAND * ******************************************************************************** OpenLibrary EQU -552 ;(libName,version)(A1,D0) CloseLibrary EQU -414 ;(library)(A1) AllocMem EQU -198 ;(byteSize,requirements)(D0-D1) FreeMem EQU -210 ;(memoryBlock,byteSize)(A1,D0) FindTask EQU -294 ;(name)(A1) GetMsg EQU -372 ;(port)(A0) ReplyMsg EQU -378 ;(message)(A1) WaitPort EQU -384 ;(port)(A0) Open EQU -30 ;(name,accessMode)(D1-D2) Close EQU -36 ;(file)(D1) Read EQU -42 ;(file,buffer,length)(D1-D3) Write EQU -48 ;(file,buffer,length)(D1-D3) Output EQU -60 ;() Lock EQU -84 ;(name,type)(D1-D2) UnLock EQU -90 ;(lock)(D1) Examine EQU -102 ;(lock,fileInfoBlock)(D1-D2) Execute EQU -222 ;(string,file,file)(D1-D3) * stack frame map Flags EQU -60 WhichFile EQU -59 NumberFiles EQU -58 FromFile EQU -57 ClickCounter EQU -56 ByteMode EQU -55 SaveLock EQU -52 SaveLength EQU -48 WBMessage EQU -44 PublicMem EQU -40 ChipMem EQU -36 RP2 EQU -32 WW2 EQU -28 RP1 EQU -24 WW1 EQU -20 IntBase EQU -16 GfxBase EQU -12 DosBase EQU -8 Pointer EQU -4 ******************** Code ****************************************************** MOVE.L 4.W,A6 MOVE.L #20000,D0 MOVEQ #1,D1 JSR AllocMem(A6) MOVE.L D0,MemPtr BEQ.W ProgramReady LEA DosName(PC),A1 MOVEQ #0,D0 JSR OpenLibrary(A6) MOVE.L D0,A6 MOVE.L #XFile,D1 MOVE.L #1005,D2 JSR Open(A6) MOVE.L D0,D1 MOVE.L D0,-(A7) MOVE.L MemPtr(PC),D2 MOVE.L #20000,D3 JSR Read(A6) MOVE.L (A7)+,D1 JSR Close(A6) MOVE.L MemPtr(PC),A0 SearchHunkCode CMPI.L #$3E9,(A0)+ BNE.S SearchHunkCode MOVE.L (A0)+,D0 LSL.L #2,D0 MOVE.W D0,CodeOnly LEA 0(A0,D0.W),A1 MOVE.L A1,A2 MOVE.L A0,CodePtr SearchHunkReloc CMPI.L #$3EC,(A1)+ BNE.S SearchHunkReloc MOVE.L (A1)+,D1 ADDQ.W #4,A1 SUBQ.W #1,D1 MOVE.W D1,Counter+2 RebuiltReloc MOVE.L (A1)+,D2 MOVE.W D2,(A2)+ DBF D1,RebuiltReloc SUBA.L A0,A2 MOVE.W A2,Decrunched MOVE.L #WorkFile,D1 MOVE.L #1006,D2 JSR Open(A6) MOVE.L D0,D1 MOVE.L D0,-(A7) MOVE.L CodePtr(PC),D2 MOVE.W Decrunched(PC),D3 EXT.L D3 JSR Write(A6) MOVE.L (A7)+,D1 JSR Close(A6) MOVE.L #PowerPacker,D1 MOVEQ #0,D2 MOVEQ #0,D3 JSR Execute(A6) MOVE.L #WorkFile,D1 MOVEQ #-2,D2 JSR Lock(A6) MOVE.L D0,D1 MOVE.L D0,-(A7) MOVE.L MemPtr(PC),D2 JSR Examine(A6) MOVE.L (A7)+,D1 JSR UnLock(A6) MOVE.L MemPtr(PC),A3 MOVE.L 124(A3),D0 SUBI.W #12,D0 MOVE.W D0,Crunched MOVE.L #WorkFile,D1 MOVE.L #1005,D2 JSR Open(A6) MOVE.L D0,D1 MOVE.L D0,-(A7) MOVE.L MemPtr(PC),D2 MOVE.L #20000,D3 JSR Read(A6) MOVE.L (A7)+,D1 JSR Close(A6) MOVE.L MemPtr(PC),A0 ADDQ.W #4,A0 MOVE.W Crunched(PC),D0 ADDQ.W #3,D0 LEA Place(PC),A1 MoveProgram MOVE.B (A0)+,(A1)+ DBF D0,MoveProgram MOVE.B 3(A0),Corect3+1 SUBA.L #Code,A1 MOVE.L A1,D0 BTST #1,D0 BEQ.S LWAlign ADDQ.W #2,D0 LWAlign LEA Code(PC),A0 LEA 0(A0,D0.W),A1 MOVE.L #$3F2,(A1)+ SUBA.L #Program,A1 MOVE.W A1,AllLength LSR.L #2,D0 MOVE.L D0,Length1 MOVE.L D0,Length2 LSL.L #2,D0 SUBI.W #16,D0 LSR.W #1,D0 SUBQ.W #1,D0 MOVE.W D0,Code+2 MOVE.W CodeOnly(PC),D0 ADDI.W #732,D0 BTST #2,D0 BEQ.S DLWAlign ADDQ.W #4,D0 DLWAlign MOVE.L D0,Begin+6 MOVE.L D0,FreeChipMem+2 MOVE.W Decrunched(PC),Corect1+2 MOVE.W Crunched(PC),D0 ADD.W D0,Corect1+6 MOVE.W CodeOnly(PC),Corect2+2 BSR.W Code MOVE.L #EyeFile,D1 MOVE.L #1006,D2 JSR Open(A6) MOVE.L D0,D1 MOVE.L D0,-(A7) MOVE.L #Program,D2 MOVE.W AllLength(PC),D3 EXT.L D3 JSR Write(A6) MOVE.L (A7)+,D1 JSR Close(A6) MOVE.L A6,A1 MOVE.L 4.W,A6 JSR CloseLibrary(A6) MOVE.L MemPtr(PC),A1 MOVE.L #20000,D0 JSR FreeMem(A6) ProgramReady MOVEQ #0,D0 RTS MemPtr DC.L 0 CodePtr DC.L 0 CodeOnly DC.W 0 Decrunched DC.W 0 Crunched DC.W 0 AllLength DC.W 0 XFile DC.B 'x',0 WorkFile DC.B 'x.work',0 EyeFile DC.B 'Eye',0 PowerPacker DC.B 'sys:tools/pp',0 EVEN Program DC.L $3F3,0,1,0,0 Length1 DC.L 0,$3E9 Length2 DC.L 0 Code MOVE.W #0,D0 LEA Begin(PC),A0 Decode EORI.W #$620D,(A0)+ DBF D0,Decode Begin MOVE.L 4.W,A6 MOVE.L #0,D0 MOVEQ #2,D1 JSR AllocMem(A6) LINK A4,#-60 MOVE.L D0,ChipMem(A4) BEQ.W Quit CLR.L WBMessage(A4) LEA DosName(PC),A1 MOVEQ #0,D0 JSR OpenLibrary(A6) MOVE.L D0,DosBase(A4) BEQ.W FreeChipMem SUBA.L A1,A1 JSR FindTask(A6) MOVE.L D0,A3 TST.L 172(A3) BEQ.S FromWB MOVE.L DosBase(A4),A6 JSR Output(A6) MOVE.L D0,D1 LEA Copyright(PC),A0 MOVE.L A0,D2 MOVEQ #TextLength,D3 JSR Write(A6) MOVE.L 4.W,A6 BRA.S AfterGetMsg FromWB LEA 92(A3),A0 JSR WaitPort(A6) LEA 92(A3),A0 JSR GetMsg(A6) MOVE.L D0,WBMessage(A4) AfterGetMsg MOVE.L ChipMem(A4),A2 Corect1 LEA 0(A2),A1 LEA Place+4(PC),A0 BSR.S Decrunch Corect2 LEA 0(A2),A0 MOVE.L A0,A3 MOVE.L A2,D0 Counter MOVE.W #0,D1 Reloc32 MOVE.W (A0)+,D2 ADD.L D0,0(A2,D2.W) DBF D1,Reloc32 MOVE.W #732/2-1,D1 ClearBuffers CLR.W (A3)+ DBF D1,ClearBuffers JSR (A2) MOVE.L DosBase(A4),A1 JSR CloseLibrary(A6) FreeChipMem MOVE.L #0,D0 MOVE.L ChipMem(A4),A1 JSR FreeMem(A6) MOVE.L WBMessage(A4),D5 BEQ.S Quit MOVE.L D5,A1 JSR ReplyMsg(A6) Quit UNLK A4 MOVEQ #0,D0 RTS Decrunch LEA Place(PC),A5 Corect3 MOVEQ #0,D1 MOVE.L -(A0),D5 LSR.L D1,D5 MOVEQ #32,D7 SUB.B D1,D7 Dec1 BSR.S Dec9 TST.B D1 BNE.S Dec4 MOVEQ #0,D2 Dec2 MOVEQ #2,D0 BSR.S Dec10 ADD.W D1,D2 CMPI.W #3,D1 BEQ.S Dec2 Dec3 MOVEQ #8,D0 BSR.S Dec10 MOVE.B D1,-(A1) DBF D2,Dec3 CMPA.L A1,A2 BCS.S Dec4 RTS Dec4 MOVEQ #2,D0 BSR.S Dec10 MOVEQ #0,D0 MOVE.B 0(A5,D1.W),D0 MOVE.L D0,D4 MOVE.W D1,D2 ADDQ.W #1,D2 CMPI.W #4,D2 BNE.S Dec7 BSR.S Dec9 MOVE.L D4,D0 TST.B D1 BNE.S Dec5 MOVEQ #7,D0 Dec5 BSR.S Dec10 MOVE.W D1,D4 Dec6 MOVEQ #3,D0 BSR.S Dec10 ADD.W D1,D2 CMPI.W #7,D1 BEQ.S Dec6 BRA.S Dec8 Dec7 BSR.S Dec10 MOVE.W D1,D4 Dec8 MOVE.B 0(A1,D4.W),-(A1) DBF D2,Dec8 CMPA.L A1,A2 BCS.S Dec1 RTS Dec9 MOVEQ #1,D0 Dec10 MOVEQ #0,D1 SUBQ.W #1,D0 Dec11 LSR.L #1,D5 ROXL.L #1,D1 SUBQ.B #1,D7 BNE.S Dec12 MOVEQ #32,D7 MOVE.L -(A0),D5 Dec12 DBF D0,Dec11 RTS Copyright DC.B $9B,'1;33;3430mCoreEye',$9B,'0;31;40m ' DC.B 'Version 1.00 Copyright ',$A9,' 14.09.1990 by MC68',10 TextLength EQU *-Copyright DosName DC.B 'dos.library',0 EVEN Place DCB.B 10000,0