Direct Access Mode: How to generate the checksum?

General discussion forum - for all that doesn't fit in any other category.
Post Reply
prodatron
Posts: 4
Joined: Tue Oct 14, 2014 5:37 pm
Location: Moers, Germany
Contact:

Direct Access Mode: How to generate the checksum?

Post by prodatron »

Hi guys,

I am currently working on a direct access implementation for the Amstrad CPC.
When looking at this structure...

typedef struct direct_access_cmd_sector_
{
char DAHEADERSIGNATURE[8]; // Must be set to “HxCFEDA\0”
unsigned char cmd_code; // Command code
unsigned char parameter_0; // Parameter 0
unsigned char parameter_1; // Parameter 1
unsigned char parameter_2; // Parameter 2
unsigned char parameter_3; // Parameter 3
unsigned char parameter_4; // Parameter 4
unsigned char parameter_5; // Parameter 5
unsigned char parameter_6; // Parameter 6
unsigned char parameter_7; // Parameter 7
unsigned char cmd_checksum; // Parameters checksum
}direct_access_cmd_sector;

...I wonder how "Parameters checksum" is generated.
Is it just a sum of all 8 parameters cut down into 1 byte? With or without the command byte?
I would appreciate any help...

CU,
Prodatron
http://www.symbos.de
EVERYTHING WE KNOW IS WRONG

Jeff
Site Admin
Posts: 8093
Joined: Fri Oct 20, 2006 12:12 am
Location: Paris
Contact:

Re: Direct Access Mode: How to generate the checksum?

Post by Jeff »

>Is it just a sum of all 8 parameters cut down into 1 byte? With or without the command byte?
Yes, with the command byte. but anyway the checksum checking is not implemented into the device ;)

Some examples here :
http://sourceforge.net/p/hxcfloppyemu/c ... _selector/

prodatron
Posts: 4
Joined: Tue Oct 14, 2014 5:37 pm
Location: Moers, Germany
Contact:

Re: Direct Access Mode: How to generate the checksum?

Post by prodatron »

Jeff, Thanks a lot for the infos! :)
I got it working on the Amstrad CPC in SymbOS:
SymbOSCPC_HxC_DirectSDCardAccess1.jpg
SymbOSCPC_HxC_DirectSDCardAccess1.jpg (110.14 KiB) Viewed 3171 times
Now you can access the whole content of the SD card inside the HxC, as it is added as another mass storage device.
Some bug fixing and optimization has to be done now...

CU,
Prodatron
http://www.symbos.de
EVERYTHING WE KNOW IS WRONG

Post Reply