English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 17 March 2011, 20:21   #1
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 744
Devpac and assembling for absolute addresses

I'm using DevPac to write pretty much all my code. I've managed to crack the whole absolute address / non-system kinda stuff now, however I have one question..

Is it possible to get Devpac to assemble to an absolute address without adding all the hunks and shit at the start of the file.

The end result I need is just a data file with everything in it, the hunk at the start is REALLY annoying.
h0ffman is offline  
Old 17 March 2011, 20:24   #2
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
To be loaded with a trackloader or something...?

You could use asmone to assemble and then wb (write binary) to the floppy. That way you just get the data of your file and no hunks. For your code to work like this when you jump into it though you'll probably need it all to be pc relative.
pmc is offline  
Old 17 March 2011, 20:37   #3
hitchhikr
Registered User
 
Join Date: Jun 2008
Location: somewhere else
Posts: 515
It don't remember it being possible with devpac (absolute addressing wasn't considered a good practice back then) better use vasm, it can generate absolute/relocated binary output and is generally very handy (& can even generate chip located hunks to use with gcc).
hitchhikr is offline  
Old 17 March 2011, 22:29   #4
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
don't know how it works in devpac, but you could use tools like reloc to convert them afterwards
Wepl is offline  
Old 17 March 2011, 22:33   #5
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,997
Quote:
Originally Posted by h0ffman View Post
I'm using DevPac to write pretty much all my code. I've managed to crack the whole absolute address / non-system kinda stuff now, however I have one question..

Is it possible to get Devpac to assemble to an absolute address without adding all the hunks and shit at the start of the file.

The end result I need is just a data file with everything in it, the hunk at the start is REALLY annoying.
The easiest and quickest way I did it 'back in the day' is to compress the file with an absolute capable cruncher (Crunchmania etc), set it to the start address you want, let it pack the file, then once its packed, depack it again, and all reloc headers and stuff is removed and your file is now absolute addressed to what you specified in the cruncher.

I'm sure theres a specific tool to do the job (I had my own routines for PM3 Deluxe!), but its what I did in lieu of the tools.
Galahad/FLT is offline  
Old 20 March 2011, 17:02   #6
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
If your code can't be assembled without modification in ASM-One or if you insist on using DevPac, then one alternative is to insert some code in the beginning of your program which writes the rest of the code to disk for you.

EDIT: this works and can just be copy-pasted right in

Code:
             org $40000-76-14

savebinary   move.l  4.w, a6
             lea     _doslib(pc), a1
             jsr     -408(a6)
             move.l  d0, a6

             lea     _file(pc), a0
             move.l  a0, d1
             move.l  #1006, d2
             jsr     -30(a6)
             move.l  d0, d4
             beq.b   _exit

             move.l  d0, d1
             lea     progstart(pc), a0
             move.l  a0, d2
             move.l  _length(pc), d3
             jsr     -48(a6)

             move.l  d4, d1
             jsr     -36(a6)

_exit        moveq   #0, d0
             rts

_length      dc.l    proglength
_doslib      dc.b    "dos.library", 0
_file        dc.b    "ram:code.bin", 0, 0


progstart

             code goes in here

proglength   = *-progstart

Last edited by Leffmann; 20 March 2011 at 17:16.
Leffmann is offline  
Old 21 March 2011, 10:31   #7
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 744
Hi Guys

Thanks for the tips. I found a way to manage this now. I specify the ORG address in the code and put a string at the end of the code and data. Assemble, Debug, search for string then I can save the binary out of memory. Works wells, just a bit fiddly.
h0ffman is offline  
Old 21 March 2011, 11:00   #8
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
If you don't want to use an assembler supporting raw-binary output there is still another option for you: use a linker, like vlink.

1. Create an object file with your assembler.
2. Convert it into a raw binary file with vlink:
Code:
$ vlink -brawbin1 -o filename filename.o
phx is offline  
Old 21 March 2011, 18:41   #9
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by Leffmann View Post

Code:
progstart

             code goes in here

proglength   = *-progstart

Does the asterisk do something special, or should it be replaced with a progend marker?


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 21 March 2011, 18:50   #10
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Lonewolf10 View Post
Does the asterisk do something special, or should it be replaced with a progend marker?
* = current PC so it does not need to be replaced with anything, it's just used to calculate the length without any additional label.
StingRay is offline  
Old 21 March 2011, 19:12   #11
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by StingRay View Post
* = current PC so it does not need to be replaced with anything, it's just used to calculate the length without any additional label.
Thanks for that StingRay. That's another thing I'll add to my ASM notes


Regards,
Lonewolf10
Lonewolf10 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
Assembling Gravity Force 2 source code absence Coders. General 5 13 May 2012 11:44
[REQ:ASM] Assembling and running jman Coders. Tutorials 9 07 May 2011 18:39
DevPac and Absolute Address h0ffman Coders. General 2 14 January 2011 15:32
Free Amiga Life.com email addresses ami_junkie Amiga scene 0 17 April 2008 04:03

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 01:18.

Top

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