English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 28 April 2020, 17:56   #1
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 44
Posts: 9,083
Library offsets

Hi Guys,


I am looking at some code (nothing important) and am wondering where I should look to investigate execbase offsets.. So


Code:
movea.l (4),a6
jsr ($3c,a6)

I know about offsets such as openlibrary etc, just unsure of these


Cheers
BippyM is offline  
Old 28 April 2020, 18:04   #2
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,029
If you don't have list it might need quite some effort. I don't think there is a file in the developer docs which has all the offsets as readable text.

One working way to calculate the offset for a function is to look at the .fd file of the library. At the beginning there is an OFFSET statement which tells you at which offset to start for the first function (usually -30), then you add -6 for each line in the file until you reach the function of interest.
thomas is offline  
Old 28 April 2020, 18:12   #3
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 44
Posts: 9,083
This is right at the beginning of the file, and i'm sure absexecbase is stored in a6, hence this looks like an exec offset, however I know most library cales are negative (-$228 for openlibrary etc). I'm messing with resource and disassembing some code, and wanted to get the right symbols
BippyM is offline  
Old 28 April 2020, 18:24   #4
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 2,584
I usually use ReSource for offsets (positive or negative) in libraries.
And I've a file with all the _LVO offsets to include in my ASM projects.

For -$3C:
_LVODispatch equ -60

You sure ExecBase is not tampered? A positive value for a jsr in exec is strange..
ross is offline  
Old 28 April 2020, 18:33   #5
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,163
https://github.com/jotd666/amiga68kt...r/tools/LVOs.i
kamelito is offline  
Old 28 April 2020, 18:46   #6
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 44
Posts: 9,083
Quote:
Originally Posted by ross View Post
I usually use ReSource for offsets (positive or negative) in libraries.
And I've a file with all the _LVO offsets to include in my ASM projects.

For -$3C:
_LVODispatch equ -60

You sure ExecBase is not tampered? A positive value for a jsr in exec is strange..

Indeed this is odd.. Attached is a part of the code directly from resource:
Attached Thumbnails
Click image for larger version

Name:	Untitled-2.png
Views:	66
Size:	6.7 KB
ID:	67063  
BippyM is offline  
Old 28 April 2020, 18:53   #7
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 2,584
Maybe a binary loaded with LoadSeg() and then modified?

More info needed
ross is offline  
Old 28 April 2020, 18:54   #8
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 2,745
I use Scout for that purpose. It needs the FD files from the NDK and an assign to FD: and you can also install the disassembler.library (I think its from ThoR) and then just click onto the "Function" button to see the actual code of that function, which could also be the code of a patch.

If you need to know positive offsets you can use the structure.guide:
http://aminet.net/package/dev/asm/StructureGuide

In your example ($60,A6) seems to be an interrupt vector in the execbase structure, but I've never used things like that.

Edit: And if I remember it correctly, XOpa 1.96 has also excellent support for the execbase structure at real-time built-in.

Last edited by PeterK; 28 April 2020 at 19:15.
PeterK is offline  
Old 28 April 2020, 19:00   #9
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 44
Posts: 9,083
Quote:
Originally Posted by ross View Post
Maybe a binary loaded with LoadSeg() and then modified?

More info needed

Essentially I am resourcing the captive map-generator (just for the hell of it).. I am doing it to try and understand how to use resource etc.. mapgen is attached
Attached Files
File Type: rar fed_MapGen.rar (10.7 KB, 18 views)
BippyM is offline  
Old 28 April 2020, 19:06   #10
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,479
I doubt this runs on its own, some other binary must have modified $4.w before. Looking at the plain ReSource screenshot you've posted I'd guess this would crash if run. The complete package would be required.
StingRay is offline  
Old 28 April 2020, 19:12   #11
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 44
Posts: 9,083
Quote:
Originally Posted by StingRay View Post
I doubt this runs on its own, some other binary must have modified $4.w before. Looking at the plain ReSource screenshot you've posted I'd guess this would crash if run. The complete package would be required.

Now you have said this, I guess it makes sense. I never considered that someone might overwrite $4.


It's Captive, maybe I should resource the bootloader, and then the file loader.


Cheers guys
BippyM is offline  
Old 28 April 2020, 19:12   #12
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 2,584
Yep, this can't work on its own.
Inside there is also some encrypted code...

Not the best example to learn how to use ReSource
ross is offline  
Old 28 April 2020, 19:12   #13
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 44
Posts: 9,083
Quote:
Originally Posted by ross View Post
Yep, this can't work on its own.
Inside there is also some encrypted code...

Not the best example to learn how to use ReSource

I don't do easy.. I recently started C++ and dove striaght in with a full gui application
BippyM is offline  
Old 28 April 2020, 19:15   #14
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 47
Posts: 3,846
IIRC Captive uses own mini-OS called Ratt-Dos. The code has nothing to do with exec library.
To know what it is doing, disassembly of the loader is definitely needed.
meynaf is offline  
Old 28 April 2020, 19:51   #15
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 49
Posts: 541
$60,ExecBase should be:

Code:
   WORD	ChkSum		; for all of the above (minus 2)


******* Interrupt Related ********************************************
LABEL	IntVects
	    STRUCT	IVTBE,IV_SIZE
	    STRUCT	IVDSKBLK,IV_SIZE
	    STRUCT	IVSOFTINT,IV_SIZE
	    STRUCT	IVPORTS,IV_SIZE
	    STRUCT	IVCOPER,IV_SIZE
	    STRUCT	IVVERTB,IV_SIZE
	    STRUCT	IVBLIT,IV_SIZE
	    STRUCT	IVAUD0,IV_SIZE
	    STRUCT	IVAUD1,IV_SIZE
	    STRUCT	IVAUD2,IV_SIZE
	    STRUCT	IVAUD3,IV_SIZE
	    STRUCT	IVRBF,IV_SIZE
	    STRUCT	IVDSKSYNC,IV_SIZE
	    STRUCT	IVEXTER,IV_SIZE
	    STRUCT	IVINTEN,IV_SIZE
	    STRUCT	IVNMI,IV_SIZE
The IV struct is
Code:
 STRUCTURE  IV,0
    APTR    IV_DATA
    APTR    IV_CODE
    APTR    IV_NODE
    LABEL   IV_SIZ
Soooo, if I haven't messed up anything should be a call to IVDSKBLK.IV_DATA if that makes any sense
alkis is offline  
Old 28 April 2020, 20:12   #16
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,479
Quote:
Soooo, if I haven't messed up anything should be a call to IVDSKBLK.IV_DATA if that makes any sense
It doesn't. It is not an ExecBase call at all.

Last edited by StingRay; 28 April 2020 at 21:34. Reason: typo
StingRay is offline  
Old 28 April 2020, 21:19   #17
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 49
Posts: 541
Quote:
Originally Posted by StingRay View Post
It doesn't. It is not an ExeBase call at all.
Yeah, that makes more sense.
alkis is offline  
Old 29 April 2020, 03:32   #18
Lyverbe
Registered User
 
Join Date: Sep 2007
Location: Montreal, Canada
Age: 51
Posts: 58
Quote:
Originally Posted by BippyM View Post
Essentially I am resourcing the captive map-generator (just for the hell of it).. I am doing it to try and understand how to use resource etc.. mapgen is attached

To create the Ultimate Captive Guide webpage, I reverse engineered about 95% of Captive including the map generator completely in order to create the dedicated section of the webpage. I also converted it to C++ to have it work with the SuperCC tool. It was a lot of fun and I learned SO much.

Last edited by Lyverbe; 29 April 2020 at 13:37.
Lyverbe is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Being Screwed around over icon.library and workbench.library. rcrook9190 support.Hardware 8 07 January 2020 07:19
HELP: Opus5, KingCON, SysInfo.library (Sysmon.library) triangle Michael support.Apps 6 10 March 2014 14:08
Mediator - openpci.library and pci.library mardn78 support.Hardware 1 01 February 2014 11:11
Dat File Offsets? Brakus Coders. General 2 29 June 2008 00:51
Making a shared library from a gcc .a library JoJo Coders. General 1 10 March 2003 19:06

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.09288 seconds with 14 queries