Login
Back to forumReply to this topicGo to last reply

Posted By

Fraser
on 2022-07-25
09:26:58
 endianness of tape file bits

I have seen the page here on TAP files but I can't find out the endianness of bytes recorded by the ROM saver/loader. I think it is big endian (bit 7 to bit 0).

Posted By

Fraser
on 2022-07-25
10:10:24
 Re: endianness of tape file bits

I have found a couple of sources saying its using the little-endian system.

Posted By

Csabo
on 2022-07-25
16:26:35
 Re: endianness of tape file bits

Welcome back after 15 years? happy

I'm not very well versed in this topic, but I figured your question might be easily answered by saving some files (using the KERNAL save) and taking a look a the TAP file... But just by looking at that saved data - I have no idea how that corresponds to the actual bits saved.

Someone might know, perhaps Gaia?

Posted By

gerliczer
on 2022-07-26
01:51:11
 Re: endianness of tape file bits

The definitive answer is in the KERNAL source. A few years ago it leaked to the Internet, IIRC. Fraser should find them and look up the answer.

Posted By

Fraser
on 2022-07-26
04:31:03
 Re: endianness of tape file bits

Both of the sources say the first byte is $89 which I have found with CSW Viewer and it is little-endian. I have not had much interest in CSW Viewer from the Commodore community. It is not obvious that a TAP file can be looked at in the same way as a CSW file.

Posted By

Krill
on 2022-07-26
05:28:25
 Re: endianness of tape file bits

In files and memory, bytes are almost always stored with the bit order 7..0.
Endianness almost always refers to the order of multi-byte integers, not the bits in individual bytes

The .TAP file data size field (4 bytes) is stored in little-endian order, with the bits in each byte in the usual 7..0 order.

It is extremely likely that the file data pulse-length bytes are stored in the 7..0 order, too.

KERNAL stores bytes in LSB->MSB order, bit 0 appears first on tape.

Posted By

Gaia
on 2022-07-26
06:52:14
 Re: endianness of tape file bits

There is an ancient C2N format that I recall was also storing the pulses and perhaps can be better observed than a TAP:

http://www.zimmers.net/anonftp/pub/cbm/crossplatform/transfer/datassette/index.html

If you convert a TAP to C2N with it I think you'll have the answer right away.

Posted By

Fraser
on 2022-07-26
06:55:13
 Re: endianness of tape file bits

I should have said bits not bytes with my initial post. Here are the two sources that claim the bits are recorded little-endian:

https://eden.mose.org.uk/download/Commodore%20Tape%20Format.pdf
https://www.pagetable.com/?p=964

Posted By

Krill
on 2022-07-26
07:38:59
 Re: endianness of tape file bits

How many more do you need? happy

There's also $FA04 and $FC0C in the C-64's KERNAL.

Posted By

Fraser
on 2022-07-26
07:51:58
 Re: endianness of tape file bits

It is confirmed that the bits on tape in the standard formats are little-endian. Sorry to have confused you with my mistake in the original post.

Posted By

gerliczer
on 2022-07-26
09:55:38
 Re: endianness of tape file bits

If you asked whether written bit order on tape is MSB first or LSB first people would have understood your question better. Endianness is a whole different thing as Krill wrote.

Asking the right question is always the fastest route to get the information. How I wish I would ever be able to get my questions right from the start.

Posted By

Csabo
on 2022-07-26
10:20:33
 Re: endianness of tape file bits

Actually I got his question right away (and replied that I didn't know which order the bits were saved), I dunno how the TAP format works. Nevertheless we got to the bottom of it, yay! grin



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon