LISTINGS!

Discuss the reverse engineering and emulation (as opposed to simulation) of any sort of Prevue hardware, including Atari-based and Amiga-based EPG channels and the Amiga-based Prevue/TV Guide channels.
curtjr4
Posts: 32
Joined: Wed Nov 25, 2009 12:23 am

Re: LISTINGS!

Post by curtjr4 »

Ah, ok. I was also wondering... how can I get that "This is a test from United Video" thing working? I've been trying for quite a while... but I am having no luck.
nwgatwcfan
Posts: 115
Joined: Mon Jul 05, 2010 5:52 pm

Re: LISTINGS!

Post by nwgatwcfan »

I am having some trouble with setting the checksums correctly. Where are the checksums located in the data lines specifically. Do they change pending on how much data is used or what day they are set up for? I read the instructions you have provided on finding the checksums and I have them written down for use. But I wasn't sure where to go from there.

Thanks.

Steven
AriX
Site Admin
Posts: 826
Joined: Tue Nov 24, 2009 11:32 pm
Contact:

Re: LISTINGS!

Post by AriX »

curtjr4 wrote:Ah, ok. I was also wondering... how can I get that "This is a test from United Video" thing working? I've been trying for quite a while... but I am having no luck.
I don't understand what you're asking? We've been able to generate our own custom titles for a while now. Can you clarify your question a bit? What are you having trouble with exactly?
nwgatwcfan wrote:I am having some trouble with setting the checksums correctly. Where are the checksums located in the data lines specifically. Do they change pending on how much data is used or what day they are set up for? I read the instructions you have provided on finding the checksums and I have them written down for use. But I wasn't sure where to go from there.
The instructions I wrote were about how to find the start byte for the checksum, not how to calculate the checksum itself. To calculate the checksum for a UVSG data message, you need to XOR the start byte with the first byte of the message you want to send. Then, you take the resulting byte, and XOR it by the next byte. Then, take that byte, and XOR it by the next byte, on and on. Include the 00 that you find at the end of a message in your checksum. The final message will look like this:

Code: Select all

55 AA <MODEBYTE> <MESSAGE> 00 <CHECKSUM>
Where modebyte is the hexadecimal equivalent of the ASCII message mode (like 50 for P, 43 for C, or 54 for T), message is the content of the message itself, 00 is always at the end of the message, and the checksum is as I described earlier. More information (albeit some of it outdated) can be found here and here (Note that in tin's post there is an error - he says that mode C is adverts, but it's really channels. Mode L is adverts.)

In most programming languages, an XOR is calculated with the ^ symbol, so in C, it would look something like this:

Code: Select all

int i;
int checksum = startbyte; // startbyte could be 0xAF for mode P, 0xBC for mode C, etc.
char *buffer;
for (i=0;i<strlen(buffer);i++) {
    checksum = checksum ^ (int)buffer[i];
}
char *checksumString = calloc(2, sizeof *checksumString);
sprintf(checksumString, "%x", checksum);
In that code, as long as startbyte is defined and buffer is set to your message, checksumString will be the resulting checksum. If I wrote that horribly incorrectly, please someone let me know :p

Also, take a look at tin's sample perl scripts for generating messages over here. Let me know if you still have questions, I can walk you through it a bit better over instant messaging if you need it.

Thanks to tin for figuring all of this out, of course.
hen7713
Posts: 34
Joined: Thu May 20, 2010 3:59 am
Contact:

Re: LISTINGS!

Post by hen7713 »

Ari, he was wondering how to imput the data into the atari emulator, I wanted to do it over serial since using the monitor thingy didn't work, but couldn't find the place to select the port in Atari800Win
PearGuide - mms://hen7713.com:8081/ (Open in something such as Windows Media Player, VLC, etc)
curtjr4
Posts: 32
Joined: Wed Nov 25, 2009 12:23 am

Re: LISTINGS!

Post by curtjr4 »

I am having trouble getting those listings that you shown in that picture. What exactly do you mean by "write to the serial". Do you mean send "55AA412A0094000000000D0A000055AA542020202054484953204953204120544553542046524F4D20554E4954454420564944454F20202000800D0A55AA430F120158595A3111320158595A3100820D0A55AA50120F58595A31120150524F4752414D2031205453203138204A4441544520313500DA0D0A" to it over a serial connection? I am completely lost with this now :P
AriX
Site Admin
Posts: 826
Joined: Tue Nov 24, 2009 11:32 pm
Contact:

Re: LISTINGS!

Post by AriX »

hen7713 wrote:Ari, he was wondering how to imput the data into the atari emulator, I wanted to do it over serial since using the monitor thingy didn't work, but couldn't find the place to select the port in Atari800Win
curtjr4 wrote:I am having trouble getting those listings that you shown in that picture. What exactly do you mean by "write to the serial". Do you mean send "55AA412A0094000000000D0A000055AA542020202054484953204953204120544553542046524F4D20554E4954454420564944454F20202000800D0A55AA430F120158595A3111320158595A3100820D0A55AA50120F58595A31120150524F4752414D2031205453203138204A4441544520313500DA0D0A" to it over a serial connection? I am completely lost with this now :P
Unfortunately I don't believe any current Atari emulators support sending stuff directly to serial the way we want to. What I meant was that you could send that string to the serial port of a real Atari if you have one... You could also input the message (or part of it) to the monitor of Atari800 by typing, for example,

Code: Select all

c 3800 55AA412A009455AA542020202054484953204953204120544553542046524F4D20554E4954454420564944454F2020200080
c 00c8 64 38
if the monitor supports strings that long. If you have a Mac or can access one, I'd be happy to give you a copy of my custom modded Atari800MacX that emulates real serial input reasonably well by receiving UDP packets, but if not, you'll have to wait until someone writes something like it for Windows. I could port my code to Atari800Win or whatever, but this would be a bit hard for me right now, since I don't have a PC lying around nor the patience to install Windows onto my Mac. My goal is to eventually port my complete sender/listener code to all platforms, but I don't have time to do it right now.
hen7713
Posts: 34
Joined: Thu May 20, 2010 3:59 am
Contact:

Re: LISTINGS!

Post by hen7713 »

I have a Mac, so I may be able to use it
PearGuide - mms://hen7713.com:8081/ (Open in something such as Windows Media Player, VLC, etc)
nwgatwcfan
Posts: 115
Joined: Mon Jul 05, 2010 5:52 pm

Re: LISTINGS!

Post by nwgatwcfan »

Code: Select all

c 3800 55AA412A009455AA542020202054484953204953204120544553542046524F4D20554E4954454420564944454F2020200080
c 00c8 64 38
if the monitor supports strings that long. If you have a Mac or can access one, I'd be happy to give you a copy of my custom modded Atari800MacX that emulates real serial input reasonably well by receiving UDP packets, but if not, you'll have to wait until someone writes something like it for Windows. I could port my code to Atari800Win or whatever, but this would be a bit hard for me right now, since I don't have a PC lying around nor the patience to install Windows onto my Mac. My goal is to eventually port my complete sender/listener code to all platforms, but I don't have time to do it right now.[/quote]

Okay. I got the checksums figured out. By the way for windows users, Your Windows Calculator has a Hex feature and has a button Xor available. I was able to figure the checksums on the main data line very easily by keying the hex data and then Xor each time. So that might be a tip for you Win users out there. But I have one more question regarding the last instructon on the code above. "C 00c8 64 38". I have noticed that everytime it will end with the 38 to close the command, but I wasn't sure where the 64 came from. Is this another checksum that would need to be calculated and if so where will this information come from.

Thanks once again,
Steven
usotsuki
Posts: 21
Joined: Tue Oct 26, 2010 1:15 pm

Re: LISTINGS!

Post by usotsuki »

It would seem that it's punching an address, $3864, into zero page, for whatever that's worth.
AriX
Site Admin
Posts: 826
Joined: Tue Nov 24, 2009 11:32 pm
Contact:

Re: LISTINGS!

Post by AriX »

usotsuki wrote:It would seem that it's punching an address, $3864, into zero page, for whatever that's worth.
Yes, that's exactly what's happening. Once a command (or byte) is inputted to the ring buffer at $3800, $00C8 needs to be set to the address of the next free byte. If you're entering your first command, this will end up being $38 and then the length of the command in hexadecimal. So if your command is 55AA412A009455AA542020202054484953204953204120544553542046524F4D20554E4954454420564944454F2020200080, $00C8 needs to be set to $38 and $00C9 needs to be set to $32, because the length of the command is 100 hexadecimal characters, representing 50 bytes, which in hexadecimal is 32 (see http://www.mathsisfun.com/binary-decima ... erter.html for an easy converter). So $00C8 will be pointing to the memory address $3832. My previous command was a bit wrong because of maximum command length and stuff, try this one instead (generated with tin's scripts):

Code: Select all

c 3800 55 AA 41 2A 00 94 55 AA 54 20 20 20 20 54 48 49 53 20 49 53 20 41 20 54 45 53 54 20 46 52 4f 4d
c 3820 20 55 4e 49 54 45 44 20 56 49 44 45 4f 20 20 20 00 80
c 00c8 32 38 
Post Reply