English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 19 May 2009, 00:43   #1
kipper2k
Registered User
 
Join Date: Sep 2006
Location: Thunder Bay, Canada
Posts: 4,323
Need help coding small routine

Hi All,

I want to create a small program that will run as a background task until it finds a specific string... modifies a few bytes, and then exits.

The program i want to modify is absolute addressing so it won't change in memory. The code i want to run is as follows...

(it needs to sit at mem location $40000)


loop;
move.w 1c7a0,d0
cmp.w #1388,d0
bne loop
move.w #2710,1c7a0
move.l #6000026e,c1c0be
move.l #600000da,c1f344
move.l #d1a8002c,c1ee2c
end

Its been too long for me to remember how to do it. Can someone help by creating the executable code for me and give me a bit of basic help so i can understand the process and start doing it for myself

Many thanks!
kipper2k is offline  
Old 19 May 2009, 09:47   #2
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
What exactly do you want to do? Is this for some kind of trainer or smth? To make your program run at $40000 you could just copy it to that very location and run it:
Code:
	pea	$40000
	move.l	(a7),a1
	lea	code(pc),a0
	move.w	#size/2-1,d7
.copy	move.w	(a0)+,(a1)+
	dbf	d7,.copy
	rts

code
loop
	move.w 1c7a0,d0
	cmp.w #1388,d0
	bne loop
	move.w #2710,1c7a0
	move.l #6000026e,c1c0be
	move.l #600000da,c1f344
	move.l #d1a8002c,c1ee2c
	rts
	
size = *-loop
I don't see why you need this though as it will use 100% of the CPU due to the loop. Why not do it like this:

1. load/copy the file you want to modify to the destination address
2. patch it
3. run it

Last edited by StingRay; 19 May 2009 at 10:47. Reason: typo
StingRay is offline  
Old 19 May 2009, 11:38   #3
clenched
Registered User
 
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
Quote:
Originally Posted by kipper2k View Post
Can someone help by creating the executable code for me and give me a bit of basic help so i can understand the process and start doing it for myself

Many thanks!
I think providing source code for you to assemble yourself is more beneficial than simply making executable. The only thing I would change is put $ sign in front of all numbers after loop in case base 16 isn't default for your assembler.
clenched is offline  
Old 19 May 2009, 14:27   #4
kipper2k
Registered User
 
Join Date: Sep 2006
Location: Thunder Bay, Canada
Posts: 4,323
Thanks guys,

it is a trainer i am trying to create. its actually for Ports of call. it loads from the workbench and i'd like to run the trainer just prior to running the ports of call executable (poc). I did find out where the code was on the disk so it could be modified permanently but i don't really want to touch the disk so as to maintain its 100% structure. The only other ways i can think of is to physically use Action replay to manually patch it or run a small trainer prog that wil do it once its in memory. (i prefer the patch idea)
I know the code has a cpu hungry loop, i'm just not too sure of any other options available.

I like your process to do it Stingray, how would that be achieved, ? by a script which loads the poc exe and then runs the patch returning to the start point of the poc exe once the code has been modified ?

Thanks for your help
kipper2k is offline  
Old 19 May 2009, 14:40   #5
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
First, if that's for a trainer you can't use these absolute $cxxxxx addresses as I think you want your trainer running on all machines, not just A500's with fake fast. Also, as Ports of Call is a systemfriendly game (that's at least what I remember from playing it some 20 years ago) you shouldn't use any absolute address patches. The game can be loaded anywhere in mem depending on the amount of Chip/Fast ram available etc. What you will have to do is:

1. load the executable using LoadSeg()
2. find the offsets/hunks you need to patch
3. patch
4. run
5. profit. ;D

If you don't want to modify the disk at all you'd obviously have to use a full filename including the diskname (e.g. POC:main) so AmigaDOS would request the disk then. As I don't want to spoon-feed you (and because I'm at work) I suggest you try to load and start the executable using LoadSeg. Once you managed that you shouldn't have any problems to patch the game. Feel free to ask if you get stuck.
StingRay is offline  
Old 19 May 2009, 16:02   #6
kipper2k
Registered User
 
Join Date: Sep 2006
Location: Thunder Bay, Canada
Posts: 4,323
Quote:
Originally Posted by StingRay View Post
First, if that's for a trainer you can't use these absolute $cxxxxx addresses as I think you want your trainer running on all machines, not just A500's with fake fast. Also, as Ports of Call is a systemfriendly game (that's at least what I remember from playing it some 20 years ago) you shouldn't use any absolute address patches. The game can be loaded anywhere in mem depending on the amount of Chip/Fast ram available etc. What you will have to do is:

1. load the executable using LoadSeg()
2. find the offsets/hunks you need to patch
3. patch
4. run
5. profit. ;D

If you don't want to modify the disk at all you'd obviously have to use a full filename including the diskname (e.g. POC:main) so AmigaDOS would request the disk then. As I don't want to spoon-feed you (and because I'm at work) I suggest you try to load and start the executable using LoadSeg. Once you managed that you shouldn't have any problems to patch the game. Feel free to ask if you get stuck.

Great,

Thanks for the help, i'll give it a go. there are a couple of versions out there that i looked at which do reside in slightly different areas of mem. the one i am using i know always sits at this location. Once i get this working then my next step will be to try modifying code so it will be portable to other configs (still taking baby steps)

thanks Stingray
kipper2k 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
Keyboard routine BippyM Coders. General 2 15 July 2007 12:15
SetPoint routine MidJasper request.Other 2 03 February 2007 20:10
Understanding ASM Routine Crackersixx Coders. Tutorials 13 10 February 2006 02:58
A nice quick small random numbers routine? Photon Coders. General 2 20 December 2004 21:56
Looking for some routine code Amiga1992 Coders. General 4 17 December 2003 23:51

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 03:56.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07331 seconds with 13 queries