Skip to content

Commit

Permalink
Add tidump command for TI-83+ Series rom dumping
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 7060226
Author: Jon Sturm <jonimoose@gmail.com>
Date:   Wed May 8 23:45:28 2013 -0500

    tidump: remove calc_73.c as it is no longer needed

    Missed in the last cleanup commit.

    Signed-off-by: Jon Sturm <jonimoose@gmail.com>

commit 806c3d8
Author: Jon Sturm <jonimoose@gmail.com>
Date:   Thu Apr 4 02:15:29 2013 -0500

    tidump: Clean up formatting and move to using the newly exported cmd73.h

    Also adds TI-84 Plus CSE support and makes things a bit more robust by actually
    checking return codes of functions for failure. Doesn't yet attempt to
    retry failed pages, it seems the silverlink gets confused when you do so.

    Will need further cleanup before merging with master.

    TODO: Either remove or allow toggling of ram dumps and perhaps add a parameter
    to only dump single pages for debugging or testing.

commit f7b12b6
Author: Jon Sturm <jonimoose@gmail.com>
Date:   Tue Apr 10 21:04:45 2012 -0500

    Hack in direct memory dumping.

    Will need to clean up and patch libticalcs so that I don't need to
    duplicate its internal functions here just for it to work. As well
    as remove the files taken from libticalcs once those functions are
    exported.

commit de4d3bf
Author: Jon Sturm <jonimoose@gmail.com>
Date:   Tue Apr 10 20:14:59 2012 -0500

    Add missing part of the 89 case in ascii_to_key in tikey

    This fixes sending keypresses to the TI89T via cables other than
    the USB DirectLink.

    Reported on IRC by chronomex.

    Signed-off-by: Jon Sturm <jonimoose@gmail.com>

Signed-off-by: Jon Sturm <jonimoose@gmail.com>
  • Loading branch information
Jonimoose committed May 9, 2013
1 parent 0b8ed0a commit 262f0f4
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ programs = tiget@EXEEXT@ \
tils@EXEEXT@ \
tiput@EXEEXT@ \
tirm@EXEEXT@ \
tiscr@EXEEXT@
tiscr@EXEEXT@ \
tidump@EXEEXT@

all: $(programs)

Expand Down Expand Up @@ -75,6 +76,11 @@ tiput@EXEEXT@: tiput.@OBJEXT@ common.@OBJEXT@
tiput.@OBJEXT@: tiput.c titools.h
$(compile) -c $(srcdir)/tiput.c

tidump@EXEEXT@: tidump.@OBJEXT@ common.@OBJEXT@
$(link) -o tidump@EXEEXT@ tidump.@OBJEXT@ common.@OBJEXT@ $(libs)
tidump.@OBJEXT@: tidump.c titools.h
$(compile) -c $(srcdir)/tidump.c

tirm@EXEEXT@: tirm.@OBJEXT@ common.@OBJEXT@ glob.@OBJEXT@
$(link) -o tirm@EXEEXT@ tirm.@OBJEXT@ common.@OBJEXT@ glob.@OBJEXT@ $(libs)
tirm.@OBJEXT@: tirm.c titools.h
Expand Down
114 changes: 114 additions & 0 deletions src/tidump.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* TITools
*
* Copyright (c) 2010 Benjamin Moody
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "titools.h"
#include <cmd73.h>

#define PKTSIZE 0x400

int main(int argc, char **argv)
{
int rampage,numpages;

tt_init(argc, argv, NULL, 0, 0, 1);

uint16_t page = 0;
uint8_t *buffer;
uint16_t length;
FILE *f;
char *filename;

if (calc_handle->model == CALC_TI84P || calc_handle->model == CALC_TI83P)
{
CalcInfos info;
ticalcs_calc_get_version(calc_handle, &info);
switch(info.hw_version) {
case 1:
case 3:
numpages = 0x74;
rampage = 0x80;
break;
case 0:
numpages = 0x1F;
rampage = 0x40;
break;
case 2:
numpages = 0x3F;
rampage = 0x80;
break;
case 4:
case 5:
numpages = 0xFF;
rampage = 0x80;
break;
default:
goto exit2; // if this happens the world might be ending
}

buffer = (uint8_t *)malloc(0x5000);

filename = g_strconcat(tifiles_model_to_string(calc_handle->model), ".", "rom", NULL);
f = fopen(filename, "wb");

if (f == NULL)
goto exit;
for(page = 0; page <= numpages; page++ ) {

printf("Receiving page %X out of %X\n", page, numpages);

int failed = ti73_send_DUMP(calc_handle, page) + ti73_recv_ACK(calc_handle, NULL) +
ti73_recv_XDP(calc_handle, &length, buffer) + ti73_send_ACK(calc_handle);
if (failed) {
printf("Rom Dump Failed\n");
goto exit;
}

if (fwrite(buffer, length, 1, f) < 1)
goto exit;
}
//fclose(f);
//filename = g_strconcat(tifiles_model_to_string(calc_handle->model), ".", "ram", NULL);
//f = fopen(filename, "wb");
//if (f == NULL)
//goto exit;
//for(data[0]=rampage; data[0]<=rampage+1; data[0]++){
//printf("Receiving page %X out of %X\n", data[0], rampage+1);
//printf(" PC->TI: MEM REQ\n");
//dbus_send(calc_handle, PC_TI83p, 0x6F, 8, (uint8_t *)&data);
//ti73_recv_ACK_h(calc_handle, NULL);
//ti73_recv_XDP_h(calc_handle, &length, buffer);
//ti73_send_ACK_h(calc_handle);
//if (fwrite(buffer, length, 1, f) < 1)
//goto exit;
//}

exit:
fclose(f);
}
exit2:
tt_exit();
return 0;
}

0 comments on commit 262f0f4

Please sign in to comment.