test of command "C"
Posted: Tue Dec 14, 2010 9:17 am
I've done a bit more reverse engineering of Atari command "C" in line with what we now know about the data format for the command.
==
Just to recap as I don't think it's documented yet, the format for "C" is.
55 AA (normal training bytes)
43 (ASCII "C")
[jdate] (the julian date for the date the channel list applies - routine will check it corresponds with either CURDAY or NXTDAY and discard if it does not correspond)
....start of channel definition....
12 (start of entry marker?)
[flags] channel flags (as listed here viewtopic.php?f=5&t=67#p459)
[source] up to 6 ascii chars - unique identifier for the channel, i.e. where there are different versions for affiliates etc, these uniquely identify them, e.g. CBS006
11 (start of channel number marker?)
[channel no] unsure how many digits, but possibly up to 4 ascii chars - channel number on the local cable system
01 (start of callltrs marker?)
[callltrs] up to 6 ascii chars - channel name on the local cable system that will be displayed in the guide, e.g. CBS
....then to begin another record, start again from "start of channel definition" above, or to end.....
00 (end of data)
[cksum] calculated checksum - XOR of $BC followed by all chars from [jdate] onwards
==
In the Atari disassembly, I've got to the part where it basically reads the string as sent into memory at $3000 onwards, then compares the length of the data and the checksum with stored versions of each that were stored after the last reception of the C command. It stores/compares length and checksum separately for CURDAY and NXTDAY. i.e. if it receives the same channel list for either day as it already has, it discards the received data. obviously then it must go onto storing the list in the correct place, which is what I will check out next. Hopefully this will also show if there is any significance to the $12, $11 and $01 markers, and if there are any other values. This may lead me onto the data structures for command P.
However I've noted in the code, that there is a special handling of a channel definition that begins with $14 rather than $12 as listed above. If it does start with $14, it expects exactly 6 bytes of data and handles it differently. AriX or others with working Atari setups, I wonder if you could maybe do a test with $14 in place, or even in the middle of a longer command C somewhere, just to establish what it does.
I'll update this thread with findings.
AriX please edit anything you see wrong here as I am sure you know a couple of bits better than me, anyone else please comment. Once we're sure this is right I'll add to Wiki. I think maybe source and callltrs are the wrong way around, and after going back through our known curday.dat I can see they are definitely 6 chars long - "METMRK" for example.
==
Just to recap as I don't think it's documented yet, the format for "C" is.
55 AA (normal training bytes)
43 (ASCII "C")
[jdate] (the julian date for the date the channel list applies - routine will check it corresponds with either CURDAY or NXTDAY and discard if it does not correspond)
....start of channel definition....
12 (start of entry marker?)
[flags] channel flags (as listed here viewtopic.php?f=5&t=67#p459)
[source] up to 6 ascii chars - unique identifier for the channel, i.e. where there are different versions for affiliates etc, these uniquely identify them, e.g. CBS006
11 (start of channel number marker?)
[channel no] unsure how many digits, but possibly up to 4 ascii chars - channel number on the local cable system
01 (start of callltrs marker?)
[callltrs] up to 6 ascii chars - channel name on the local cable system that will be displayed in the guide, e.g. CBS
....then to begin another record, start again from "start of channel definition" above, or to end.....
00 (end of data)
[cksum] calculated checksum - XOR of $BC followed by all chars from [jdate] onwards
==
In the Atari disassembly, I've got to the part where it basically reads the string as sent into memory at $3000 onwards, then compares the length of the data and the checksum with stored versions of each that were stored after the last reception of the C command. It stores/compares length and checksum separately for CURDAY and NXTDAY. i.e. if it receives the same channel list for either day as it already has, it discards the received data. obviously then it must go onto storing the list in the correct place, which is what I will check out next. Hopefully this will also show if there is any significance to the $12, $11 and $01 markers, and if there are any other values. This may lead me onto the data structures for command P.
However I've noted in the code, that there is a special handling of a channel definition that begins with $14 rather than $12 as listed above. If it does start with $14, it expects exactly 6 bytes of data and handles it differently. AriX or others with working Atari setups, I wonder if you could maybe do a test with $14 in place, or even in the middle of a longer command C somewhere, just to establish what it does.
I'll update this thread with findings.
AriX please edit anything you see wrong here as I am sure you know a couple of bits better than me, anyone else please comment. Once we're sure this is right I'll add to Wiki. I think maybe source and callltrs are the wrong way around, and after going back through our known curday.dat I can see they are definitely 6 chars long - "METMRK" for example.