6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Mar 29, 2024 12:05 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Executable format specs
PostPosted: Fri Oct 31, 2014 10:43 am 
Offline

Joined: Fri Oct 31, 2014 10:31 am
Posts: 7
As a side project of mine, I am writing an in depth tutorial about programming an assembler and disassembler. One of the features of the assembler is multiple output formats and I would really like the output to be useable. So what I need is the specification of an executable file format. It doesn’t matter if the format is strictly for NES, C64 or a completely different machine. The important thing is that the format is “real”.


Top
 Profile  
Reply with quote  
PostPosted: Fri Oct 31, 2014 1:23 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10760
Location: England
For the Beeb (Acorn systems, including the Electron) the file contains just the bytes that should be loaded (in one contiguous lump) and it's the file system metadata which contains the load address and the execution address. A machine code program might have the load and execution addresses the same, although it need not. A BASIC program would have an execution address pointing into ROM.

For the C64, the first two bytes give the load address (or a suggested load address) - I don't know what the C64 does about execution. Possibly it jumps to the first byte. See
http://fileformats.archiveteam.org/wiki ... executable

Oh, and welcome!


Top
 Profile  
Reply with quote  
PostPosted: Fri Oct 31, 2014 6:31 pm 
Offline

Joined: Wed May 20, 2009 1:06 pm
Posts: 491
pawwkm wrote:
As a side project of mine, I am writing an in depth tutorial about programming an assembler and disassembler. One of the features of the assembler is multiple output formats and I would really like the output to be useable. So what I need is the specification of an executable file format. It doesn’t matter if the format is strictly for NES, C64 or a completely different machine. The important thing is that the format is “real”.


I think you have to know where there is a free block of memory and its memory location on each system.
You also have to know how big that block is on each system.

You need a memory map.
There are books like "Mapping the Commodore 64".
The other issue would be using the Kernal or specific hardware which would be different on each system. I've heard people having problems and their answer was "Use the Kernal" or you are not using the Kernal.

http://www.amazon.com/Mapping-Commodore ... mmodore+64


Top
 Profile  
Reply with quote  
PostPosted: Fri Oct 31, 2014 7:47 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8114
Location: Midwestern USA
Also, please take a look at André Fachat's O65 relocatable binary format for another approach. Although André designed O65 with his projects in mind it should be adaptable to other 65xx systems.

BigEd wrote:
I don't know what the C64 does about execution.

It is up to whatever loads the file to jump to the start address. There wasn't anything in the C-64's kernel that was an analog of UNIX's exec... system calls. However, upon completion of the load, locations $AC and $AD (LSB/MSB) hold the load address (also true for the C-128). So a JMP ($AC) instruction should start execution of the program, assuming the load address actually points to executable instructions.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 01, 2014 3:46 am 
Offline

Joined: Wed May 20, 2009 1:06 pm
Posts: 491
http://www.commodore.ca/manuals/pdfs/co ... ry_map.pdf

This is a Commodore 64 and Vic 20 memory map.


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 01, 2014 11:41 am 
Offline

Joined: Fri Oct 31, 2014 10:31 am
Posts: 7
Thank you for the information, I will check it out in a few days when I'm finished moving in to my new apartment.


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 01, 2014 12:46 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10760
Location: England
(Thanks for the info about $AC, BDD)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: Druzyek and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: