?
Solved

Programming HP 50g calculator in ARM assembly

Posted on 2009-02-21
2
Medium Priority
?
4,292 Views
Last Modified: 2012-05-06
I have to create a commercial program for the HP50g calculator as part of a datalogging system.

As HPGCC is not meant to develop commerical applicatios, I was planning to do it in ARM assembly, but information to program the HP50g in assembly seems to be real scarce.

Does anybody know of a site or book where such information is available?

Examples would be heaven.

Thanks

0
Comment
Question by:gato-san
2 Comments
 

Accepted Solution

by:
codelab earned 1500 total points
ID: 23704741
Hi Gato-san
try out the googlegroup comp.sys.hp48, i posted some arm stuff some time ago,
i got an answer from the author of the masd program, Cyrille de Brébisson which is active at the board.
however, is your appliction to time critical for RPL ?
otherwise remember to back up frequently!
heres some comparing RPL,SYSRPL,ARM samples to kick you off !

Sincerely, Codelab
                     In the following samples the flag 92 is set (MASD SYSRPL MODE):
 
-92 SF
 
   built in libary 256 is also attached: 
 
256 attach
 
   furthermore the extable libary found at http://www.hpcalc.org/details.php?id=3245 helps 
 
   writing assembler programs, but requires quite a lot of memory. (its not needed after assembling)
 
   copy it to port 2 and do:
 
258 attach
 
                                         First two small RPL programs to measure time:
 
<< TIME HMS-> 'timer'
STO 1000 .02 BEEP
>> 
 
'TON' STO 
 
 
 
 
<< TIME HMS-> timer -
3600 * 2. RND 800
.02 BEEP 'timer'
PURGE
>> 'TOFF' STO
 
 
 
 
 
                                      Now test the loop speed of RPL: (just 1000 loops)
 
<< 1000 TON 1 1000
  START
  NEXT TOFF /
 LOOPS / SEC. +
>> EVAL
                                      Answer: 806.45 LOOPS / SEC. (filesize: 22.5 bytes)
 
 
 
            Same construction in SYSRPL: ( increased to 100000 loops )
 
<< 100000 TON
"
::
 100000 BINT1
 DO
 LOOP
;
@"
ASM EVAL TOFF /
 LOOPS / SEC. +
>> EVAL
                                    Answer : 26455.02 LOOPS / SEC. (filesize: 17.5 bytes)
 
 
 
 
 
                   In saturn assembler which is still an emulated 
 
                   mode on g49+ & g50 ( loops = 1000000)
 
<< 1000000 TON
"
CODE 
SAVE  
LC F4240 
*LP 
C-1 A 
GONC LP 
LOADRPL
ENDCODE
@"
ASM EVAL TOFF /
LOOPS / SEC. +
>> EVAL
 
 
                                     Answer: 416666.66 LOOPS / SEC (filesize : 18 bytes)
 
 
 
Now the loop constructon in ARM
 
 code ( 100000000 loops ) 
 
<< 100000000 TON
"!NO CODE !RPL
::
CODE
 
SAVE
INTOFF
 
GOSUB relocate
 *start
 
 !ARM
 STMDB sp! {R4 LP}
 
 MOV R4 100
 MUL R4 R4 R4           % LOOP COUNTER
 MUL R4 R4 R4           % LOOP COUNTER
 
 *L1
  SUBS R4 R4 1       % DECREMENT LOOP COUNTER
  BNE L1             % goto L1 if not 0
  LDMIA sp! {R4 PC} % restore regs and return
 }
 
 !ASM
 *relocate
C=RSTK D0=C         % D0 points on arm instr
D1=80100            % D1 points where to copy program
LC(5) relocate-start 
MOVEDN              % copy n nibbles
LC 80100 ARMSAT     % evaluate the arm code (leave emulator)
 
                    
INTON             % restore the hardware interrupt
LOADRPL           % return to RPL
ENDCODE
;
@"
ASM EVAL TOFF /
LOOPS / SEC. +
>> EVAL
                    Answer: 15873015.87 LOOPS / SEC. (filesize: 69 bytes / Arm part: 28 bytes)
 
 
 
 
 
 
            Using the hpgcc which is able to generate native ARM the following loop were tested:
 
int main(void){
 int n=10000000;
 
 while (n--); 
 }
 
                             Answer: 3508771 LOOPS / SEC. ( file size: 4526 bytes )

Open in new window

0
 

Author Comment

by:gato-san
ID: 23705685
Speed will indeed be important as the program will have to scan a large database which will be stored in the SD card.

Looks like it will be a real pain in the ass but I think that I've put together all I need thanks to your post.

Maybe I'll be posting more questions later.

Thanks!

0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let me explain this picture a little bit.  First, in case you haven't already guessed, you are looking at my 2 phones, an Android Samsung Galaxy S5 on the left and an iPhone 5 on the right.  They are on their respective cradles on my desk.  But, you…
By this time the large percentage of day-to-day transactions have shifted to mobile banking; here are some overriding areas QAs must investigate while testing mobile banking apps.  
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question