6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 8:23 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Dec 10, 2010 2:01 pm 
Offline

Joined: Thu Dec 09, 2010 3:37 pm
Posts: 12
Location: France
Hello everyone,

I'm now looking for a correct assembler able of outputing a s-19 file. I use the wikipedia page and the linux man page to understand how this format file works.

I tried this very simple code
Code:
   org   $4000

   lda   source
   sta   dest
   sec
   rts

source      db    $77
dest        db    $00


I tried thoses assemblers :
  • FASM
    FASM wrote:
    S10D4000AD08408D094038607700D8
    SA DEST 4009 0 17 2 0
    SA SOURCE 4008 0 17 2 0
    S9030000FC

    The problem here is at the last line : a S9 command should contain the starting execution address, fasm is always giving 0000.
    srec man wrote:
    The address field contains the starting execution address and is interpreted as a 2-byte address.

  • AS65
    AS65 wrote:
    S10D4000AD08408D094038607700D8
    S5030001FB

    The problem here is on the first line. If you look at the "count bytes" it's 0D, but it have to be 0E, no ?
    srec man wrote:
    These characters when paired and interpreted as a hexadecimal value, display the count of remaining character pairs in the record.


_________________
Mindiell
-----------------------
French coder of a new 6502 simulator


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 10, 2010 5:54 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8506
Location: Midwestern USA
Mindiell wrote:
FASM wrote:
S10D4000AD08408D094038607700D8
SA DEST 4009 0 17 2 0
SA SOURCE 4008 0 17 2 0
S9030000FC

The problem here is at the last line : a S9 command should contain the starting execution address, fasm is always giving 0000.
srec man wrote:
The address field contains the starting execution address and is interpreted as a 2-byte address.

Not necessarily. Motorola made that address optional (also true of S8 and S7 records), since S-records could be used for any kind of data transfer, not just transfer of an executable binary. It's up to the program that generates the S-records to decide whether or not to populate the execution address field. It's also up to the program that reads and interprets the S-records to decide if the address field in an S7, S8 or S9 record is meaningful. In your case, each S1 record implicitly states the load address.

Quote:
AS65 wrote:
S10D4000AD08408D094038607700D8
S5030001FB

The problem here is on the first line. If you look at the "count bytes" it's 0D, but it have to be 0E, no ?
srec man wrote:
These characters when paired and interpreted as a hexadecimal value, display the count of remaining character pairs in the record.

I counted 13 pairs, so $0D is correct. The byte count encompasses everything after the byte count. Hence the count includes the record load address (4000), the data (AD08408D094038607700) and the record checksum D8.

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Dec 11, 2010 8:05 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 411
Location: Minnesota
Here's a link to part of the documentation of another assembler which purports to output Motorola S-Record files:


http://home.earthlink.net/~hxa/docs/hxa_mhex.htm

For that one a non-zero start address is generated by placing an expression representing it after an 'END' pseudo op. No 'END' pseudo op or no expression following it gets the default '0000' value in an S9 record.

I haven't read its documentation but FASM may also want the programmer to explicitly state somewhere what the start address value should be if it's supposed to be non-zero.

I notice that both FASM and AS65 generate the same first line, the S1 record, for your sample code. AS65's second output line is a correct S5 record (data record count), not an S9 (start address), which doesn't appear.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 12, 2010 1:54 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8506
Location: Midwestern USA
teamtempest wrote:
I notice that both FASM and AS65 generate the same first line, the S1 record, for your sample code. AS65's second output line is a correct S5 record (data record count), not an S9 (start address), which doesn't appear.

The S5 or S6 record, according to the official Motorola standard, is optional but recommended to help detect corruption issues (i.e., missing records). The only mandatory records are 1 (as many as required) and 9. While required, the S9 record is usually ignored by most loaders. Its presence in the data stream merely signifies the end of data.

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 12, 2010 4:47 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 411
Location: Minnesota
Quote:
The S5 or S6 record, according to the official Motorola standard, is optional but recommended to help detect corruption issues


Sorry, I didn't mean to imply these were required records. I simply meant that there is nothing wrong with the S5 record itself in AS65's output. The OP's concern seems to be about correct S1 records and S9 records that contain start addresses. I'm just pointing out that the S1 records are identical in both cases and that AS65 did not output any S9 record that was shown to us.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 12, 2010 7:56 pm 
Offline

Joined: Thu Dec 09, 2010 3:37 pm
Posts: 12
Location: France
Well, it seems I may did an error or two :)
FASM and AS65 are good for their first S1 line, I was wrong (I was not sure, as I said in the first post). For the start address, I will have another look in the FASM doc in order to be sure that I can ask for a correct address.

Thanks to everyone for your help !

_________________
Mindiell
-----------------------
French coder of a new 6502 simulator


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 13, 2010 8:56 am 
Offline

Joined: Thu Dec 09, 2010 3:37 pm
Posts: 12
Location: France
Finally, with a little modification in the code :
Code:
   org   $4000

   lda   source
   sta   dest
   sec
   rts

source      db    $77
dest        db    $00
   end   $4000

The as65 is giving me the S9 line with the correct value $4000.

Thanks again,

_________________
Mindiell
-----------------------
French coder of a new 6502 simulator


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: No registered users and 15 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: