Jump to content
IGNORED

Outputting header bytes with DASM


SmileyDude

Recommended Posts

This is kinda off topic, since it's not for the Atari 2600, but I figured I would ask it here since I'm using DASM for this. I need to be able to output a small header at the front of a binary generated with DASM -- 2 bytes for the start address and 2 bytes for the length of the assembled file. Does anyone know how I can go about this easily with DASM? I would rather not do this with a separate script of some sort in my Makefile. Since DASM should already know both of these values, it would be ideal to do it inside there.

 

Thanks!

Link to comment
Share on other sites

-f# controls the output format, 2 might do what you need.

 

FORMAT OPTIONS:

    1  (DEFAULT)

	The output file contains a two byte origin in LSB,MSB order, then
	data until the end of the file.

	Restrictions:	Any instructions which generate output (within an
	initialized segment) must do so with an ascending PC.  Initialized
	segments must occur in ascending order.

    2  RAS (Random Access Segment)

	The output file contains one or more hunks.  Each hunk consists
	of a 2 byte origin (LSB,MSB), 2 byte length (LSB,MSB), and that
	number of data bytes.  The hunks occur in the same order as
	initialized segments in the assembly.  There are no restrictions
	to segment ordering (i.e. reverse indexed ORG statements are
	allowed).  The next hunk begins after the previous hunk's data,
	until the end of the file.

    3  RAW (Raw)

	The output file contains data only (format #1 without the 2 byte
	header).  Restrictions are the same as for format #1.

	Format 3    RAW (Raw format)
	    Same as format 1, but NO header origin is generated.  You get
	    nothing but data.
Link to comment
Share on other sites

-f# controls the output format, 2 might do what you need.

 

This was exactly what I needed.

 

You can define a couple of labels 'start' and 'end' at start and end of your program.

 

Then you would do this:

.byte start,start>>8,(end-start),(end-start)>>8
start:
...your code...
end:

 

I was initially trying something like this, but was running into problems with multiple .orgs. I didn't want dasm to pad my output file. I guess I could've gone with one .org, just 4 bytes ahead of my real origin. But that didn't really feel right. Maybe that's just something I need to get over myself, though :D

 

For now, SpiceWare's answer works for me.

 

Thanks!

Edited by SmileyDude
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...