Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra CRC Bytes on each tape block #51

Open
PeterBBCUser opened this issue Sep 4, 2019 · 5 comments
Open

Extra CRC Bytes on each tape block #51

PeterBBCUser opened this issue Sep 4, 2019 · 5 comments

Comments

@PeterBBCUser
Copy link

When saving a tape uef from BeebEm it adds 2 extra bytes on the block CRC i.e. Frak loader program end 1st block should be 74 (F4 95) 10 but BeebEm has 74 (F4 95 95 95) 10.
This is not a new bug but a long standing one in BeebEm.

@chrisn
Copy link
Collaborator

chrisn commented Jun 19, 2022

I'm not sure that BeebEm is doing anything wrong. Looking at the OS1.2 disassembly, the .saveABlockToTape routine does this:

    JSR .saveChecksumToTape                             save checksum to TAPE

.saveFinalTwoBytes = $f855
    JSR .waitForByteToReadOrWrite                       save byte
    JSR .waitForByteToReadOrWrite                       save byte
    JSR .resetACIA

The checksum is a 16-bit CRC (see BeebWiki for more on the tape block format). This suggests that the OS sends the second byte of the CRC three times, which is what I see happening in practice n BeebEm, and BeebEm simply writes those bytes to the UEF file.

@PeterBBCUser
Copy link
Author

What happens to the extra 2 bytes on real hardware then as they never appear in a tape file.
UEF archive files created from real tapes don't have these extra bytes in them it only appears if you save something to a UEF from beebem, its the only emulator that supports write to tape UEF so cant test it on any other Emulator.
also wrote about it here https://stardot.org.uk/forums/viewtopic.php?p=246952#p246952 with screen shots but never got a single comment reaction.

@chrisn
Copy link
Collaborator

chrisn commented Jun 20, 2022

I'd like to check what appears on a real tape file. I'm not familiar with the tools, so what's the best way to create one? I did try one CSW file that I found on StarDot, and this did not include the extra bytes. But it's possible that this file was converted from UEF using MakeUEF, which may discard the extra bytes. I'd like also to confirm whether MakeUEF actually does this.

@PeterBBCUser
Copy link
Author

A uef created via csw and make uef does not have the extra bytes in because if you look at a UEF file (Unpack it) and view it with a hex editor you will see it only has the two crc bytes at the end of each data block, if you look at a file saved with beebem it has the extra bytes in the CRC. you can see a screen shot that I posted in my last comment about this problem. showing the contents of an original uef compared to the same files saved out from BeemEm.

chrisn added a commit that referenced this issue Jun 26, 2022
Writing a master reset to the ACIA control register
should stop transmitting data

See #51
@PeterBBCUser
Copy link
Author

will test it when a windows exe comes out for this version. and makeuef does not filter out the extra bytes after the CRC as some commercial titles have extra bytes after the CRC as pointed out on the STH forum about this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants