Page 4 of 7

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 11:25 am
by tin
Metalguy66 wrote:I can test this on real hardware..

When I send serial data from tm PC through an SIO2PC interface into my 130xe's SIO port, with the Prevue cart running, you can see the little DATA cursor flash.. And.. I have my 130xe hooked up to a video capture card on my PC..

So I can send strings of data into the thing, and then capture it's output as Mpeg or AVI.. and send it to you guys..
Wow, amazing ;) I really want to lay my hands on one, but I guess it's going to be near impossible.

Next thing is to figure out what software to send the data with on the PC end? I presume so far you just tried random data, or have you tried the strings posted by AriX, or some of your own generated with the cgi scripts?

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 12:09 pm
by AriX
tin wrote:For mode "K" (clock), the data is 9 bytes:-
1: day of week (0 = sun)
2: month (0 = jan)
3: day (0 = 1st, 1 = 2nd)
4: year (presume in hex)
5: hours (in hex)
6: mins (hex)
7: secs (hex)
8: (don't know)
9: (don't know)
Is it possible that the two values you don't know represent time zone and daylight savings time? I ask that because they seem to be two parameters that are displayed by the settings screen of the EPG Jr.

By the way, the CGI scripts actually aren't working and default to Altirra no matter what. The if ($emumode == "altirra") is literally returning true even though print $emumode returns atari800. I don't understand.

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 12:48 pm
by Metalguy66
It frakin WORKS!

I just used Hyperterminal at 2400 baud..
First I took the two hex strings that Arix posted on Atariage and copied them into HexWorkshop, and saved them as raw binaries..

Then, I loaded up hyperterminal.. set it to 2400 bps, 8n1, no flow control.. and just did a raw "text-send" of those two binaries..

The first one caused the clock to set to Monday, May 10, 10:40 pm....

The second one caused the title to change to "ELECTRONIC PROGRAM GUIDE"..

Hardware considerations:

You need a small interface called an SIO2PC to convert the atari's serial port signals into something the PC can communicate with..

Heres the one I have installed in all my Ataris: costs about 5 bucks to build:

Image

And of course, you need the prevue guide Cart.. Its a standard ATARI cart (the variety that uses two 8k roms).. Just get the ROm images (the 8k split ones) that I posted on ATARI age a while back (or I can send them to you).. and burn them to two 2764 EPROMS and stick them in the cart..

As far as the machine goes, I dont know whether you actually NEED a 130xe or not.. IF the prevue program doesnt make use of extended ram, then you could certainly use any XL or XE machine(800XL, 1200XL, 65XE, XEGS, 800XE, 130XE, etc.).. They are all 100% compatable.. See if there is any access to PORTB ($D301) going on in that cart program.. If there is alot of it going on during data manipulation routines, then it is switching extended ram banks.. If it only sets PORTB during initialization routines, and doesnt change it dunring any of the rotuines that actually move data, then its not using extended ram..

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 12:59 pm
by tin
AriX wrote:Is it possible that the two values you don't know represent time zone and daylight savings time? I ask that because they seem to be two parameters that are displayed by the settings screen of the EPG Jr.
I know they definitely aren't timezone or DST, as the clock bytes are stored in the atari memory at $0428 to $0430 when they are recieved, and the timezone is stored in $041D. I also think would make sense to send the timezone in an addressed command (so each box has an individual timezone) and the clock in a unaddressed command (so all clocks are set at once with only one command).

I also know a routine at $BA0E, which is starting to look like it's something to do with storing schedule information quits immediately if the 9th byte of the clock is not zero. I'm not sure what that's all about!

There's another routine at $BB54, that I have no clue yet what it does, that uses the timezone value if the 8th byte of the clock is zero.

The code also has a routine that when the clock is updated via the K command, it copies the values, applying the timezone to another clock located at $0434 to $043C - which is the one that is displayed at the top. I'll check again if I can see the DST being applied.

The timezone, and possbily the DST is sent with the F command, which is similar to the K command, but with $15 values instead of $09. However only the first $14 make it into memory. These are:-

1: number of half hour blocks away to start at (default 0) sent as ASCII letter, where "A" ($41) = 0 hours
2: number of half hour blocks away to end at (default 6) send as ASCII letter
3: transmitted scroll speed, sent as ASCII number, where "4" $34 = 4 (scroll speed is actually the number of times the main code loops before it updates the display)
4: maximum advert number 10's digit. Defaults to 0. sent as ASCII number ($30 = 0)
5: maximum advert number 1's digit. Defaults to 6. sent as ASCII number ($36 = 6)
6: appears unused
7: appears unused
8: possible lo byte of a memory address to reset something to, should it get to zero
9: possible hi byte of the above
A: timezone, could quite possibly be offset from GMT, with default -6. sent as ascii number ($36 = 6) not entirely sure yet
B: something to do with timezone, value of $59 (ascii Y) could be DST, but the code that processes this is not clear to me.
C:appears unused
D: keyboard active (ascii Y ($59) or ascii N ($4E))
E:appears unused
F:appears unused
10:appears unused
11:appears unused
12:appears unused
13:appears unused
14:appears unused
15: appears unused, and not stored in memory either

the code for the command is F ($46) and the initial checksum is $B9 if you want to have a play with your K script to do this as well.

in case it's not clear, the first and second bytes select how many half hour blocks are shown, the EPG defaults to 6 (so on boot it shows you programs at 12:00, 12:30, 1:00, 1:30, 2:00, 2:30, 3:00). It's nice to change this down by setting the second byte to, say 3, but I can't see the value in the first one!! :)
AriX wrote:By the way, the CGI scripts actually aren't working and default to Altirra no matter what. The if ($emumode == "altirra") is literally returning true even though print $emumode returns atari800. I don't understand.
oops my bad, should be ($emumode eq "altirra") cos it's a string not a number. I made this mistake a number of times in the code and thought I'd sorted them all.

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 1:06 pm
by tin
Metalguy66 wrote:It frakin WORKS!
WOW MAN that is quality!! would love to see video of it coming from a real atari!!!
Metalguy66 wrote:And of course, you need the prevue guide Cart.. Its a standard ATARI cart (the variety that uses two 8k roms).. Just get the ROm images (the 8k split ones) that I posted on ATARI age a while back (or I can send them to you).. and burn them to two 2764 EPROMS and stick them in the cart..
Of course!! That was the bit I thought would be hardest to acheive, but buring EPROMS might be the way to go!
Metalguy66 wrote:As far as the machine goes, I dont know whether you actually NEED a 130xe or not.. IF the prevue program doesnt make use of extended ram, then you could certainly use any XL or XE machine(800XL, 1200XL, 65XE, XEGS, 800XE, 130XE, etc.).. They are all 100% compatable.. See if there is any access to PORTB ($D301) going on in that cart program.. If there is alot of it going on during data manipulation routines, then it is switching extended ram banks.. If it only sets PORTB during initialization routines, and doesnt change it dunring any of the rotuines that actually move data, then its not using extended ram..
A shame, the code DOES make extended use of bankswitching, I'm only just getting to the bottom of it, but I think all schedule data is stored in banked memory, Although swest77's updaing of the wiki article says it also used the 600XL, so perhaps there's another version for non bankswitch. I think that unlikely though. I have an 800xl in a box waiting for it's destiny :)

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 1:18 pm
by AriX
tin wrote:The timezone, and possbily the DST is sent with the F command, which is similar to the K command, but with $15 values instead of $09. However only the first $14 make it into memory.
Ah, cool. Seems the F command is the command that just generally sets the system settings. Very cool stuff.

I have a friend who I am going to buy a 130XE from in the next few days if I am not able to find an original Prevue model by then, which will be really cool. He says he has 4, so I wonder if maybe he'd be willing to sell one to you?
Metalguy66 wrote:It frakin WORKS!
Quite exciting! Congrats! Wanna send us a pic or something?

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 1:37 pm
by AriX
tin wrote:
AriX wrote:By the way, the CGI scripts actually aren't working and default to Altirra no matter what. The if ($emumode == "altirra") is literally returning true even though print $emumode returns atari800. I don't understand.
oops my bad, should be ($emumode eq "altirra") cos it's a string not a number. I made this mistake a number of times in the code and thought I'd sorted them all.
Ah, OK, makes sense. I'll fix that... I have barely ever used Perl, so I wouldn't really know about how to use strings in it :p
Also, I wrote an example settings message (mode F) thanks to your last post:

c 3800 55 AA 41 2A 00 94 55 AA 46 41 44 32 30 38 00 00 00 00 35 59 00 59 00 00 00 00 00 00 00 00 b3
c 00c8 1f 38

This will set DST to yes, set keyboard to enabled, set speed to two, set timezone to 5, allow up to 8 ads instead of 6, and limit the amount of time blocks into the future shown to 3 (and maybe some other things, I forget :p)

Interestingly, after inputting ads, it now skips every other and only prints ads on every other block. I don't know why this changed after I sent the mode F message.

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 1:43 pm
by Metalguy66
Here's the video capture:


http://www.megavideo.com/?v=L2IQ0B83

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 2:32 pm
by tin
Metalguy66 wrote:Here's the video capture:

http://www.megavideo.com/?v=L2IQ0B83
ABSOLUTE QUALITY!! :) funky colours tho ;)
Some code that lets you put in arbitary stuff is needed I think :)

Re: Atari EPG jr reverse engineer

Posted: Sun May 16, 2010 2:34 pm
by tin
AriX wrote:c 3800 55 AA 41 2A 00 94 55 AA 46 41 44 32 30 38 00 00 00 00 35 59 00 59 00 00 00 00 00 00 00 00 b3
c 00c8 1f 38

This will set DST to yes, set keyboard to enabled, set speed to two, set timezone to 5, allow up to 8 ads instead of 6, and limit the amount of time blocks into the future shown to 3 (and maybe some other things, I forget :p)

Interestingly, after inputting ads, it now skips every other and only prints ads on every other block. I don't know why this changed after I sent the mode F message.
I wonder if byte 8 and 9 are some kind of when to show ads/how often to show ads kind of setting. 8 is defaulted to $00 and 9 is defaulted to $02 (in the code, those are the values it uses until it gets a F command). Might be worth a play?