smithj@jacobs.CS.ORST.EDU (Jeremy Smith) (05/28/90)
In article <53591@microsoft.UUCP> alonzo@microsoft.UUCP (Alonzo GARIEPY) writes: > > I noticed that you only looked for strings at even addresses. Because > the HP 48 (and HP 28) are nibble based, strings can also start at odd > addresses. My memory scanner for the 28 prints out each segment of > memory twice, the second offset by a nibble, for just this reason. > and In article <9789@sdcc6.ucsd.edu> pa1409@sdcc13.ucsd.edu (Steven Haehnichen) writes: > > Anyway, since the whole machine is nibble-based, I couldn't think of > any reason why ASCII strings couldn't be shifted one nibble, so to > speak. The resulting code did the same thing than the previous ASCII > translator, but started one nibble further. > I rewrote the c program so that you can convert the HP 48 coredump to addressed ascii strings starting from even or odd nybble addresses. The following code, asci0hex.c, is the even address version. Simply change the d=0; to d=1; and recompile for the odd address version. I have examined the outputs and extracted lines containing recognizable strings. This is posted separately (Title: HP 48 ASCII strings (662 lines)) so that if you are not interested in viewing 662 lines of internal 48 strings you can skip the article. /* ZDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD? 3File: asci0hex.c Version 0.0 Jeremy |-) Smith3 3Run History: 3/17/90 3 3Usage: asci0hex < input_file > output_file 3 3Description: This program takes HP 48 coredump output and produces the ASCII representation. 72B60:000449627563647F 72B70:6279702E4F647021 72B80:4C6C6F6775646B20 72B90:00E4F6E6D254D607 72BA0:4797024496275636 72BB0:47F627979200094E 72BC0:66716C6964602445 72BD0:66696E6964796F6E _|\ 72BE0:632000D496373796 |_ > 72BF0:E67602C496262716 |/ 72C00:2797D100094E6671 72C10:6C69646020505142 72C20:532000E4F6E6D225 72C30:5616C60225563757 72C40:C6477200055E6162 72C50:6C6560247F602943 72C60:7F6C6164756F2000 72C70:E4F60225F6F6D602 Even addresses: 72b60: @ &W6F & F vWF Non-Empty Directory) f F BTf F 6 Missi 72bf0: ng Library f F $5 Non-Real Result' P & V B 4 FW No Room Odd addresses: 72b5f: Directory Not Allowed+ R G B &W6F & Invalid Definition# 67 72bef: v && & Invalid PPAR# "U "U6W Fw Unable to Isolate/ " 3 Note that characters less than 32 (space) and greater 3 than 127 (DEL) have been converted to spaces. @DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDY */ #include <stdio.h> #include <stdlib.h> #include <math.h> main() { int c, d, f, g, i, j, n; /* d is a toggle switch with value 0|1 */ long k, m; /* m is the current address, k is a copy */ char b[80]; d=0; f=0; g=0; k=0; m=0; n=0; /* change to d=1; for starting on odd addresses */ while ((c=getchar()) != 58) { /* get the starting address */ if (c<60) c=c-48; else c=c-55; m=m*16+c; } ungetc(c, stdin); k=m; /* Assuming we are right at the first valid hex string */ while ((c=getchar()) != EOF) { if (c == 58) { for (i=0; i<16; i++) { if ((c=getchar())<60) c=c-48; else c=c-55; m++; /* increment the address by one nybble */ if (d==1) { c=c*16+f; if ((c<32)|(c>126)) c=32; b[g++]=c; n++; } else f=c; if (n > 71) { b[g]='\0'; printf("%05lx: %s\n", k, b); g=0; n=0; k=m; /* save this address */ } d= (d) ? 0:1; } } } b[g]='\0'; printf("%05lx: %s\n", k, b); } Since ASCII strings are probably only initially interesting to anyone studying the 48's internals this is not so useful. I offer another program that translates the coredump directly into binary, which can then be examined with existing editors. For PC users, Norton's Utility is useful since not only can you search a file by hex sequences or string patterns but also it gives the offset from the beginning of the file so that you can calculate the 48 internal address for the found string. Since most computers are byte based you still need an even and odd string version of the file so that you can effectively search for a sequence starting with any nybble. The program has one bug: when it writes 0A (line feed) it inserts a 0D (carriage return). This means that the resultant file instead of being 262144 bytes (256k) is 262689 bytes (There happens to be 545 occurrences of 0A starting on even addresses). I don't know if this is a putchar(c) (where c==10 in decimal, 0a in hex) side effect, my compiler (Turbo c 1.0), DOS, my code? In the meantime, replacing all 0D 0A with 0A in a program editor solves the problem. /* ZDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD? 3File: asci4hex.c Version 0.0 Jeremy |-) Smith3 3Run History: 5/21/90 3 3Execution time: 3 3Usage: asci4hex < input_file > output_file 3 3Description: This program takes HP 48 coredump output (as the input file) and translates it back into actual hex characters (in the output file). 72B60:000449627563647F 72B70:6279702E4F647021 72B80:4C6C6F6775646B20 72B90:00E4F6E6D254D607 72BA0:4797024496275636 72BB0:47F627979200094E 72BC0:66716C6964602445 72BD0:66696E6964796F6E _|\ 72BE0:632000D496373796 |_ > 72BF0:E67602C496262716 |/ 72C00:2797D100094E6671 72C10:6C69646020505142 72C20:532000E4F6E6D225 72C30:5616C60225563757 72C40:C6477200055E6162 72C50:6C6560247F602943 72C60:7F6C6164756F2000 72C70:E4F60225F6F6D602 Even addresses: @&W6Fw&btFDFvvWF6Non-Empty Directory)dfFFBTffFvf6Missing LibrarydfFF$5Non-Real Result'Pe&FVBw4wFFWvNo Room Odd addresses: Directory Not Allowed+`tfVRTGB&W6Fw&Invalid Definition#P67fvB&&&WInvalid PPAR#`tfV"UF"U6WGFwUnable to Isolate/`t"uvV @DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDY */ #include <stdio.h> main() { int c, d, f, i; /* d is a toggle switch with value 0|1 */ d=0; f=0; /* change to d=1; for starting on odd addresses */ while ((c=getchar()) != 58) { /* get the starting address */ if (c<60) c=c-48; else c=c-55; } ungetc(c, stdin); while ((c=getchar()) != EOF) { if (c == 58) { for (i=0; i<16; i++) { if ((c=getchar())<60) c=c-48; else c=c-55; if (d==1) { c=c*16+f; putchar(c); } else f=c; d= (d) ? 0:1; } } } }