6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 29, 2024 5:32 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: File formats survey
PostPosted: Thu Jan 02, 2014 10:28 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 674
As I build up my tools, I'd like to support a range of file formats in common use. However, my 6502 background is almost exclusively Commodore 64, so the only binary files I end up working with are generally .d64 disk images and .prg files (2 byte loading address, then bytes).

What file formats do the rest of you (especially those working with raw & homemade boards) use for, and to generate, ROM images, bootable images, and loadable programs?

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 10:53 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
I use Intel Hex (.hex) for my 6502 SBC emulator. http://en.wikipedia.org/wiki/Intel_HEX

Internally to the serial EEPROM on the SBC those hex files are stored in binary form stripped of all non Hex, checksum and function. Count 0 record determines program start address and end of file.

I have been asked to provide raw binary files (.bin) for other emulators. They are like .prg without the load address.

edit: corrected internal SBC format.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Last edited by Klaus2m5 on Thu Jan 02, 2014 3:34 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 11:15 am 
Offline

Joined: Wed Sep 11, 2013 8:43 pm
Posts: 207
Location: The Netherlands
The file formats I’ve been using are:

-plain text (ascii) files (.txt)
-plain binary files (.bin)
-binary files with leading start address in Little Endian. e.g. (.prg)
-and a special file format using Enso’s CHOCHI:

Excerpt:
Code:
CHOCHI loader expects a 4-byte header preceding the binary file. The header is:
 ADDR LOW
 ADDR HIGH
 SIZE LOW (not including the header)
 SIZE HIGH

_________________
Marco


Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 12:02 pm 
Offline
User avatar

Joined: Mon Apr 23, 2012 12:28 am
Posts: 760
Location: Huntsville, AL
I was going to suggest some of the formats that lordbubsy suggested as well. In addition, i would suggest the ascii hex MEM file format. It is useful for loading programs into FPGA block RAMs without requiring any monitor/loader on the target.

MEM files consist of ascii hex address records followed by ascii hex data records. Address records are preceded by "@", and data records are not. The address records and data records are separated by spaces or newlines. The following is an 8-bit memory example:
Quote:
@aaaa dd dd dd dd dd dd dd dd
@aaaa dd dd dd dd dd dd dd dd

Like most binary formats, the MEM file format can simply consist of a single address record, i.e. the load address, followed by the data bytes or words. Usually, no special formatting is applied to the data records, and they can simply be output as ascii hex in natural print order. However, the MEM file can be implemented in a manner similar to that of the intel/motorola ascii hex file formats (without the extended address records).

If you were to include the MEM file format, it would simplify the process of loading your output into an existing FPGA project.

_________________
Michael A.


Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 5:06 pm 
Offline

Joined: Wed Jan 03, 2007 3:53 pm
Posts: 62
Location: Sunny So Cal
I almost exclusively work in .prg, mostly since my typical target is the C64, but also because nearly anything can be made to understand it with a trivial loader. Rarely, .bin.

Otherwise, Intel Hex, especially for printed output.


Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 5:23 pm 
Offline

Joined: Wed Sep 11, 2013 8:43 pm
Posts: 207
Location: The Netherlands
MichaelM wrote:
i would suggest the ascii hex MEM file format
That looks very much like described here.

A little bit O.T.,

MichaelM wrote:
It is useful for loading programs into FPGA block RAMs without requiring any monitor/loader on the target.
Would that also be the way to go for including binaries into the program flash of an AVR? If not, or can be done easier, I’ll ask this at a later time in a separate thread as I need in a ROM less system.

_________________
Marco


Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 6:26 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8405
Location: Midwestern USA
I use raw binary for loading the EPROM burner. If I want to transfer a binary to the POC unit I use Motorola S-record format, since it has some error-checking capability.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 11:11 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
I use San's AP1 format more than anything else, because it works for copy-and-paste into an emulator monitor prompt (sometimes with minor pre-editing). It's a bit inefficient, but I assume that it could be used in a similar fashion on real hardware, via a serial tty-style connection. Error checking is non-existent, however.

Mike


Top
 Profile  
Reply with quote  
 Post subject: Re: File formats survey
PostPosted: Thu Jan 02, 2014 11:26 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1041
Location: near Heidelberg, Germany
I use the o65 file format, because it's relocatable, for my operating system, and it's optimized for fast loading and small storage reqs and 6502 code.
http://www.6502.org/users/andre/o65/index.html

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 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: