View Full Version: Matamagicians gather round for a game of guess that function

camerahacks >>Camera Discussions >>Matamagicians gather round for a game of guess that function


<< Prev | Next >>

zapped- 01-28-2007
Matamagicians gather round for a game of guess that function
Some of you may spot a pattern sooner than I and you will win the prestige that goes with having discovered what one of the functions in the pv2 firmware does. Your contribution will eventually also make it easier to do more cool things with the pv2 still cameras. Here is a snippet of input and output to and from the function R0 R1 INPUT FB 00 OUTPUT 00 00 INPUT FC 00 OUTPUT 00 00 INPUT FD 00 OUTPUT 00 00 INPUT FE 00 OUTPUT 00 00 INPUT FF 00 OUTPUT 00 00 INPUT 00 01 OUTPUT 00 02 INPUT 01 01 OUTPUT 01 02 INPUT 02 01 OUTPUT 02 04 INPUT 03 01 OUTPUT 03 04 INPUT 04 01 OUTPUT 04 08 INPUT 05 01 OUTPUT 05 08 INPUT 06 01 OUTPUT 06 08 INPUT 07 01 OUTPUT 07 08 INPUT 08 01 OUTPUT 08 10 INPUT 09 01 OUTPUT 09 10 INPUT 0A 01 OUTPUT 0A 10 INPUT 0B 01 OUTPUT 0B 10 INPUT 0C 01 OUTPUT 0C 10 INPUT 0D 01 OUTPUT 0D 10 INPUT 0E 01 OUTPUT 0E 10 anyone wanting the entire input/output file PM me your email address and I'll send it along....once it finishes running in the v8 simulator that is.

BillW- 01-28-2007

The OUTPUT_R0:R1=0 when the input R0=0, but when R0=1 then OUTPUT_R0:R1 ~= INPUT_R0:R1. I'm guessing that the output is actually 8-bit, just in R0, with R1 being filled from incidental work in the function. It could be a division function, but there's not enough sample data to say anything for sure. Care to post more data, preferably with input R1>1?

zapped- 01-28-2007

sure, here is some from the end INPUT F8 FF OUTPUT 08 00 INPUT F9 FF OUTPUT 07 00 INPUT FA FF OUTPUT 06 00 INPUT FB FF OUTPUT 05 00 INPUT FC FF OUTPUT 04 00 INPUT FD FF OUTPUT 03 00 INPUT FE FF OUTPUT 02 00 INPUT FF FF OUTPUT 01 0 and a middle section INPUT 01 F7 OUTPUT F7 EE INPUT 02 F7 OUTPUT EE DC INPUT 03 F7 OUTPUT E5 DC INPUT 04 F7 OUTPUT DC B8 INPUT 05 F7 OUTPUT D3 B8 INPUT 06 F7 OUTPUT CA B and another INPUT 03 6C OUTPUT 44 B0 INPUT 04 6C OUTPUT B0 60 INPUT 05 6C OUTPUT 1C 60 INPUT 06 6C OUTPUT 88 60 INPUT 07 6C OUTPUT F4 60 INPUT 08 6C OUTPUT 60 C0 I'd gladly post the entire 2,177k file, but it is probably too long for a post :)

zapped- 01-28-2007

The function is only 14 lines of assembly code and you could call it 10 if you remove a push and T0X from the beginning and a pop and RTS from the end.

zapped- 01-31-2007

Is it not strange that the function does an INC R4 followed by a DEC R4?

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.