[comp.sys.handhelds] HP48 machine language

bgribble@jarthur.Claremont.EDU (Bill Gribble) (09/14/90)

Let me preface this by saying that my only machine language programming
  experience prior to the 48 was a 2-week segment on ml in a cs class.
  While I feel like I'm learning pretty fast, these questions might seem 
  kind of moronic to anyone with any real experience in ml.

1.) What is the procedure for allocating and using large chunks of memory?
  Say, f'rinstance, that I wanted to rewrite DUP.  I know how to fiddle
  the stack pointers to tell the system that another object is on the 
  stack; I know enough about object representation to find and deal with
  the object in level 1, and even how big it is; but how do I find a free
  memory chunk large enough for a copy of the object?  I assume the system
  maintains a list of free segments; how do I find it and alter it, if
  that's what I need to do?

2.) I think this was asked before, but how do I read the keyboard from ml?
  'nuff said.

Enough for now.  Just by way of a progress report (in case anyone cares)
  I've passed all the major technical/conceptual hurdles (I think) to
  rewriting my terminal emulator in machine language.  It might be out by 
  the end of the semester, if we're lucky (and Systems doesn't kill me).

=============================================================================  
=====   Bill Gribble           Internet: bgribble@jarthur.claremont.edu =====
=====   Harvey Mudd College              wgribble@hmcvax.claremont.edu  =====
=====   Claremont, CA 91711    Bitnet:   wgribble@hmcvax.bitnet         =====
=====   (714) 621-8000 x2045   UUCP:     ..!uunet!jarthur!bgribble      =====
=============================================================================

jmunkki@hila.hut.fi (Juri Munkki) (09/16/90)

bgribble@jarthur.Claremont.EDU (Bill Gribble) writes:
>1.) What is the procedure for allocating and using large chunks of memory?
>  Say, f'rinstance, that I wanted to rewrite DUP.  I know how to fiddle
>  the stack pointers to tell the system that another object is on the 
>  stack; I know enough about object representation to find and deal with
>  the object in level 1, and even how big it is; but how do I find a free
>  memory chunk large enough for a copy of the object?  I assume the system
>  maintains a list of free segments; how do I find it and alter it, if
>  that's what I need to do?

This isn't my idea originally (credit goes to Antti Louko alo@hut.fi):

	Switch back to RPL and use BLANK to create a new GROB. You
	can't get exact nibble allocation (bytes are ok), but it's
	compatible with anything that HP might come up with.

   ____________________________________________________________________________
  / Juri Munkki	    /  Helsinki University of Technology   /  Wind  / Project /
 / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  /  STORM  /
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bgribble@jarthur.Claremont.EDU (Bill Gribble) (09/17/90)

In article <1990Sep16.164904.4675@santra.uucp> jmunkki@hila.hut.fi (Juri Munkki) writes:
>bgribble@jarthur.Claremont.EDU (Bill Gribble) writes:
>>1.) What is the procedure for allocating and using large chunks of memory?

>	Switch back to RPL and use BLANK to create a new GROB. You
>	can't get exact nibble allocation (bytes are ok), but it's
>	compatible with anything that HP might come up with.
>
>   Juri Munkki

OK, this is a valid answer to my question.  Not exactly what I was expecting, 
  but it works.  Now a few followups:  1.) has anyone doing disassembly work
  found the 'real' way to do this (strictly in machine language)? 
  2.) jumping back and forth between ml and rpl isn't exactly elegant.  Is 
  there a way to execute the BLANK (or any other) command from ml?

My biggest problem with this method is speed: GROB operations are pretty slow
  in my (unsupported) opinion, and I'm looking for speed above all else.

Thanks for the answer, though; I'll probably end up using it.

=============================================================================  
=====   Bill Gribble           Internet: bgribble@jarthur.claremont.edu =====
=====   Harvey Mudd College              wgribble@hmcvax.claremont.edu  =====
=====   Claremont, CA 91711    Bitnet:   wgribble@hmcvax.bitnet         =====
=====   (714) 621-8000 x2045   UUCP:     ..!uunet!jarthur!bgribble      =====
=============================================================================

alonzo@microsoft.UUCP (Alonzo GARIEPY) (09/17/90)

bgribble@jarthur.Claremont.EDU (Bill Gribble) writes:
>   While I feel like I'm learning pretty fast, these questions might seem 
>   kind of moronic to anyone with any real experience in ml.

Not at all...  These are tough questions.

> 1.) What is the procedure for allocating and using large chunks of memory?

First, I will assume that you have seen two recent postings to this group:
CHIP48 by Andreas Gustafsson, and the disassembly of stralloc by Jan Brittenson.

Andreas gives an FTP site where the source to CHIP48 is available.  This is
the best example around of HP48 assembly programming.  Andreas makes use of
that same stralloc routine for allocating a large chunk of memory.

I expect Andreas will post the source of the next version (if he doesn't,
I will ;-) for those of you who, like myself, do not have FTP access.

>   Say, f'rinstance, that I wanted to rewrite DUP.  

Jan's disassembler will be available soon.  You will then be able to look 
at DUP directly to see how it performs its magic.

> 2.) I think this was asked before, but how do I read the keyboard from ml?

Once again, the CHIP48 source is your reference on this.  Andreas has done
a good job.  If anyone has my postings on the HP28S keyboard buffer, can you
send me a copy?

Alonzo Gariepy
alonzo@microsoft

kaufman@delta.eecs.nwu.edu (Michael L. Kaufman) (09/17/90)

In a related question, has anyone come up with a way to turn off the clock, or
to turn it on, in the middle of an assembler program?  Just setting the flag
doesn't seem to work.

Thanks,  Michael

berg@cip-s01.informatik.rwth-aachen.de (AKA Solitair) (09/20/90)

Alonzo GARIEPY writes:
>Once again, the CHIP48 source is your reference on this.  Andreas has done
>a good job.  If anyone has my postings on the HP28S keyboard buffer, can you
>send me a copy?

How about a repost?  I think there are quite a few new readers that would
like to see it (like me :-)
--
Sincerely,                 berg%cip-s01.informatik.rwth-aachen.de@unido.bitnet
           Stephen R. van den Berg.
"I code it in 5 min, optimize it in 90 min, because it's so well optimized:
it runs in only 5 min.  Actually, most of the time I optimize programs."