Post Reply 
Programming, couple questions
02-06-2014, 01:55 PM
Post: #1
Programming, couple questions
Hi!

It's my first post in here Smile

1)How I can print char at X,Y position? In TI-Basic was command Output(X,Y,"Blabla"
I know how print in graphics mode, but I need it in a text mode.


2) If I understood right, inside we have Windows CE + ARM. What about C/C++ compilers for it?
Find all posts by this user
Quote this message in a reply
02-06-2014, 03:18 PM
Post: #2
RE: Programming, couple questions
Hi,

To my knowledge there is no distinction between a graphics mode and a text mode on the Prime.
Everything you see on the screen is just a bunch of pixels which are accessible via the G0 grob. You may read it or overwrite it as you want.

So to put a text at x,y you just do a TEXTOUT_P("blah",x,y) [look at in-device-help for further formatting options]. Since the Prime will refresh (i.e. overdraw) your screen at the end of your program, you may do a FREEZE or WAIT or something similiar to halt program execution before finishing.

Where did you hear about Win CE running in Prime?
That would be a huge (and disappointing) surprise to me...
Find all posts by this user
Quote this message in a reply
02-06-2014, 03:24 PM
Post: #3
RE: Programming, couple questions
1) In the "text mode" there is no way to set the position, is just an output terminal. You can use:
Code:
Syntax: TEXTOUT_P(text, [G], x, y, [font], [textColor], [width], [backgroundColor])
http://www.hpmuseum.org/forum/thread-494.html

2) Not confirmed and not yet.

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
02-06-2014, 04:29 PM (This post was last modified: 02-06-2014 04:29 PM by Tim Wessman.)
Post: #4
RE: Programming, couple questions
(02-06-2014 03:24 PM)eried Wrote:  2) Not confirmed

Never will be. I beleive this strange idea came from someone who mounted the filesystem and saw some files they thought belonged to a wince install. You know, files like filesystem.dll and similar which could only exist on windows...

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
02-06-2014, 04:59 PM
Post: #5
RE: Programming, couple questions
But you know, it is not only the filename, but the untouched PE structure:
http://cl.ly/TmA1

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
02-07-2014, 08:25 AM
Post: #6
RE: Programming, couple questions
Yup, that's the cause of a number of people (among which myself, clearly) thinking that the Prime was based on WinCE, even if we saw at the same time that the user-visible part of the Prime firmware is an ELF file, while ELF is not WinCE's favorite format.

Out of the box, the Prime provides no access to native code. critor and I scratched an itch and showed months ago that modified firmware upgrades (and as such, certainly, arbitrary firmware upgrades) were possible on the Prime, see some sub-pages of http://tiplanet.org/hpwiki/index.php?title=HP_Prime Smile
If someone finds enough time, the Prime would become the second calculator, after the TI-Nspire, for which a Linux port is available (and for best results, based on Device Tree and integrated into mainline Linux, like the Nspire port).
Find all posts by this user
Quote this message in a reply
02-07-2014, 02:26 PM
Post: #7
RE: Programming, couple questions
Thanks for replies.

I just little bit analyzed FW files, and can say: Inside is Besta RTOS, based on WinCE. Later I'll explain all things.
Find all posts by this user
Quote this message in a reply
02-07-2014, 06:54 PM
Post: #8
RE: Programming, couple questions
(02-07-2014 02:26 PM)MrKalach Wrote:  Thanks for replies.

I just little bit analyzed FW files, and can say: Inside is Besta RTOS, based on WinCE. Later I'll explain all things.

It makes sense, but there is no much info in Besta/Inventek website (no much info at all in that website)

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
02-07-2014, 08:58 PM
Post: #9
RE: Programming, couple questions
(02-07-2014 06:54 PM)eried Wrote:  
(02-07-2014 02:26 PM)MrKalach Wrote:  Thanks for replies.

I just little bit analyzed FW files, and can say: Inside is Besta RTOS, based on WinCE. Later I'll explain all things.

It makes sense, but there is no much info in Besta/Inventek website (no much info at all in that website)

Code contains some debug info and addresses in the web. One address keep to admin panel. I think inside all what we need Smile

And I assume that FW was compiled in Keil MDK-ARM

"calculation" code is in amrif.elf(inside u can see references to SDKLIB.DLL and CORE.DLL, sounds unbelievable but it's real ELF, which use DLL libs). Also this code have some opensource libs for math.
Find all posts by this user
Quote this message in a reply
02-07-2014, 09:10 PM
Post: #10
RE: Programming, couple questions
I will be so nice if it really runs that. Anyone knows what happens if the firmware is uploaded wrongly (by mistake/purpose), there is a recovery mode able to recover the device without jtag/etc ?

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
02-07-2014, 09:27 PM
Post: #11
RE: Programming, couple questions
Quote:I just little bit analyzed FW files, and can say: Inside is Besta RTOS, based on WinCE. Later I'll explain all things.
Quote:"calculation" code is in amrif.elf(inside u can see references to SDKLIB.DLL and CORE.DLL, sounds unbelievable but it's real ELF, which use DLL libs). Also this code have some opensource libs for math.
So far, you've discovered nothing that we didn't already know (and is documented on the TI-Planet hpwiki, or is common knowledge, such as HP using some version of xcas).

But be sure to go on: it's pretty good to see someone else interested, and who has some time on his hands Smile

As already outlined elsewhere, the first step towards Linux would be to replace armfir.elf with another ELF file, loaded at the same address (we know that it works), and drawing something onto the screen until the calculator is unplugged from a USB host and a battery is removed.
Find all posts by this user
Quote this message in a reply
02-07-2014, 10:11 PM
Post: #12
RE: Programming, couple questions
(02-07-2014 09:27 PM)debrouxl Wrote:  
Quote:I just little bit analyzed FW files, and can say: Inside is Besta RTOS, based on WinCE. Later I'll explain all things.
Quote:"calculation" code is in amrif.elf(inside u can see references to SDKLIB.DLL and CORE.DLL, sounds unbelievable but it's real ELF, which use DLL libs). Also this code have some opensource libs for math.
So far, you've discovered nothing that we didn't already know (and is documented on the TI-Planet hpwiki, or is common knowledge, such as HP using some version of xcas).

But be sure to go on: it's pretty good to see someone else interested, and who has some time on his hands Smile

As already outlined elsewhere, the first step towards Linux would be to replace armfir.elf with another ELF file, loaded at the same address (we know that it works), and drawing something onto the screen until the calculator is unplugged from a USB host and a battery is removed.


Ups Smile I didn't see. What about hardware? How start bootloader?
Find all posts by this user
Quote this message in a reply
02-08-2014, 07:40 AM
Post: #13
RE: Programming, couple questions
The hardware is described on the TI-Planet hpwiki as well, see http://tiplanet.org/hpwiki/index.php?tit...e/Hardware Wink
As described at the sibling http://tiplanet.org/hpwiki/index.php?tit.../Emulation page, Linux has good support for the S3C2416 chip in itself, and some old out-of-tree QEMU forks support it as well. The specific MMIO / hardware connections used in the Prime are currently undocumented, AFAICT.

The ARM processor always starts execution at address 0, so the bootloader is loaded at address 0. Someone did a one-off posting of a commented disassembly, suitable for IDA, of the first 4 KB of BXCBOOT0.BIN: the relevant page is linked from the Special:ListUsers page of the TI-Planet hpwiki.
The text of that page shows that BXCBOOT0.BIN is 0x40000 bytes, and among other things, the first 4 KB of code copy and relocate the last 0x3C000 of those 0x40000 bytes to 0x30C00000 before executing them.
Find all posts by this user
Quote this message in a reply
02-10-2014, 12:56 PM
Post: #14
RE: Programming, couple questions
Ok. Can u explain me why BXCBOOT0.BIN and BESTAARM.ROM has same addres in usbtool.exe? In bxcboot0 we have vectors table. But bestaarm has very different structure. It's made by armlink with lzma compression. I'm trying decompress it, but my ida doesn't have arm decompiller(hexrays).



ps. sorry for my english Smile
Find all posts by this user
Quote this message in a reply
02-11-2014, 07:09 AM
Post: #15
RE: Programming, couple questions
I've never had a serious look at BESTAARM.ROM (that is, beyond reading the list of strings produced by `strings`).

On the TI-Nspire platform, historically, before an emulator was made, there have been two methods for decrypting the OS:
* a standalone decrypter using the standard implementation of the Blowfish cipher, which is the most scriptable way, provided someone can find the key;
* manual use of GDB's sim target: http://www.yaronet.com/posts.php?sl=0&s=...&h=116#116 .
If there's LZMA-compressed data in BESTAARM.ROM, both methods may be usable: extracting the input data and passing it to a generic LZMA decompressor, or running the calculator-side decompressor function in GDB's sim target.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)