[comp.sys.handhelds] Questions about hp48 machine language

hoford@sequoia.circ.upenn.edu (John Hoford) (04/30/91)

I have been trying to get a handle on writing asmbly
code to for the hp48 and I have a few questions.

Q2
When I convert an object to asm using "->asc" I get the object
plus a checksum appended to the end. How do I calculate the checksum
To hand code my own objects (using "asc->")?


Q2
I have been using "MLDL 1.01" by Jan Brittenson to look at
machine language code in the hp rom. This is the most useful
program for learning asm, great work!

My problem is it does not have a simple way of getting the
starting address of a program in a variable. For Ml programs
the only way I can do this now use "asm->" and then hand 
dissemble the code. So the question: Does anyone have a 
program That returns the address of the  start of a stored
program ?
 ie.
 1: label ->addr   1: #213FF 
Would the address change to quickly to be useful?
This would also help me check my code after I write it.

I would be great to have a library that had 
		all of the MLDL code
		"asc->"  "->asc"
		"peek" @ some sort peek function
		"->addr" @as described above

Q3

The STAR (thanks again Jan Brittenson) assemblers
seem to produce raw ml.
Is their a progam which will put them into a
 "asc->" or a "hp/kermit file" format?
Optionally put a #02DCC (code object) in front of
it


			Thanks 
			John D. Hoford

bson@rice-chex.ai.mit.edu (Jan Brittenson) (04/30/91)

In a posting of [29 Apr 91 22:05:09 GMT]
   hoford@sequoia.circ.upenn.edu (John Hoford) writes:

 > Q2
 > I have been using "MLDL 1.01" ... My problem is it does not have a
 > simple way of getting the starting address of a program in a variable.

   Recall the variable and pass the CODE object as an argument on
level 1.

 > So the question: Does anyone have a program That returns the address
 > of the start of a stored program ?'

   In MLDL 1.02 the XLIB 1092 7 takes a code object and returns its
address plus 10 in both level 1 and 2. So, to get the address of a
CODE object in level 1 the following program can be used:

  \<< 1092 # 18CEAh SYSEVAL # 4035h SYSEVAL # 7E50h SYSEVAL 
      EVAL DROP # 59CCh SYSEVAL 10 -
  \>>

   Notice that MLDL 1.02 must be attached, and it will *not* work with
1.01.

 > ie.
 > label ->addr   1: #213FF 
 > Would the address change to quickly to be useful?

   It's a ROM address. It won't change. If it were a RAM address, then
generally, the answer is no. Programs and directories move around much
less than other objects.


 > The STAR assemblers seem to produce raw ml.  Is their a progam which
 > will put them into a "asc->" or a "hp/kermit file" format?

   You can use the HEADER macro defined in hp48.star, it will create a
kermit header. If you want a code object, you can use the
CODE...ENDCODE macro. Just make sure to assemble with hp48.star.
You can use the following skeleton:


	;;+
	;; HP-48 ML Skeleton Program
	;;
	;; Assemble with hp48.star:
	;;
	;;	% star listing binary hp48 skeleton
	;;
	;;-

	; This is the kermit header.

		header

	; This is a CODE...ENDCODE macro invocation.
	; Don't break the code object into several files.

		code

		; the code goes here

		move.a	@d0, a		; Continue RPL thread
		add	5, d0		;	-- "" --
		jump	@a		;	-- "" --

		endcode


;;---
						-- Jan Brittenson
						   bson@ai.mit.edu

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (05/01/91)

Jan, for those of us who don't have STAR, could you please also post  you
your machine-code routines in a format which can be simply d/l'd and
ASC-> ed?  Hmm, I was thinking along the lines of putting the ML code
alongside your documentation, but it would prob.  be easier to just ASC->
the CODE and attach that at the end of the program.  How about it, I
would appreciate and I'm sure others would also.
  Thanks in advance,
        --Falco

bson@rice-chex.ai.mit.edu (Jan Brittenson) (05/01/91)

In a posting of [30 Apr 91 22:40:19 GMT]
   akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) writes:

 > Jan, for those of us who don't have STAR, could you please also post
 > you your machine-code routines in a format which can be simply d/l'd
 > and ASC-> ed?

   Hmm... it took me a while, but I finally think I know what you are
refering to. Some guy at U Penn asked how to create kermit headers and
code objects with STAR. What I provided was a skeleton to be filled in
with the actual code. The skeleton doesn't do anything by itself, and
was intended only as an example. I apologize for not making this clear
in the message.

						-- Jan Brittenson
						   bson@ai.mit.edu

herman@corpane.uucp (Harry Herman) (05/02/91)

In <15465@life.ai.mit.edu> bson@rice-chex.ai.mit.edu (Jan Brittenson) writes:

>In a posting of [30 Apr 91 22:40:19 GMT]
>   akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) writes:

> > Jan, for those of us who don't have STAR, could you please also post
> > you your machine-code routines in a format which can be simply d/l'd
> > and ASC-> ed?

>   Hmm... it took me a while, but I finally think I know what you are
>refering to. Some guy at U Penn asked how to create kermit headers and
>code objects with STAR. What I provided was a skeleton to be filled in
>with the actual code. The skeleton doesn't do anything by itself, and
>was intended only as an example. I apologize for not making this clear
>in the message.

>						-- Jan Brittenson
>						   bson@ai.mit.edu

Jan,

I suspect he may have been talking about your machine code examples
for things like the keyboard buffer routines you posted a couple
of weeks ago.  They are apparantly written in STAR and for those of
us who do not have STAR and don't want to hand assemble the routines,
having ASC-> files available would be nice.


				Harry Herman
				herman@corpane

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (05/03/91)

Jan, sorry I didn't make it clear , but Harry Herman was right, I meant
that for those of us who don't have STAR, we can't use your examples of
machine code like the keyboard buffer, or the sample for i/o, or any of
the other ML code that you post.  If you could post the machine code
instruction alongside for hand assembly, or better yet, just post your
machine code programs in ASC format, I would be very grateful.
        --Falco