[comp.sys.handhelds] HP28S: PIG, BAG, machine code, assembler

alonzo@microsoft.UUCP (Alonzo GARIEPY) (01/16/90)

This is an answer to two recently posted questions regarding machine
language on the HP28.

I have written a set of processor notes for the 28.  These describe
the CPU registers and instruction set and how they can be used for
writing inline machine language routines.  My example program scrolls
screen memory.  These notes contain all the information you need to
write fast routines for turning pixels on and off, line drawing, etc.

I am just putting the finishing touches on an assembler/disassembler
called Babelog.  The program is written in Turbo Prolog for the IBM
PC, but could probably be ported without too much trouble.  It uses
the instruction mnemonics from my processor notes.

BABELOG.EXE is more than 100k bytes long (mostly Turbo Prolog libraries.)
I will post the source to this newsgroup (700 lines), but I don't know 
how to distribute a binary of that size.  Any suggestions?

Anyone who wants a copy of the processor notes can email me at:
	uunet.uu.net!microsoft!alonzo

If there are many requests, I will post to comp.sys.handhelds instead
of emailing individually.

-----------------------------------

Here is a repost of programs for making BAG and PIG, my versions of
POKE and PEEK.  These programs work exactly like POKE and PEEK, except
that BAG will only poke as many nibbles as correspond to the currently
set binary word length.  These programs are *considerably* faster than
previously available version of PEEK and POKE, hence the name change.

Here are listings of MBAG and MPIG, including checksums.  They will
create BAG and PIG.  You can rename PIG to PEEK, and BAG to POKE for
use in other programs so that the checksum of those programs does not
change.

MBAG [34AB]
<<
  << SWAP OVER # 0h AND OR SWAP
    # D6471341301231h
    # D6461431471741h
    # D6631581631641h
    # C67E16514610D08h
    # D6031241961031h
    # C62412313111451h
    # CFF4AC808461027Eh
  >>
  HOME 'BAG' DUP PURGE STO
  # 301231000B102C96h
  # CFF40h #CFFF1h SYSEVAL
>>


MPIG [4DA]
<<
  << RCWS SWAP 64 STWS # 0h OR SWAP STWS
     "ABCDEFGHIJKLMNOPQRSTUVWXYZ1"
  >>
  HOME 'PIG' DUP PURGE STO
  # 3012310003B02C96h  # CFFB6h  BAG
  # 1631641961031341h  # CFFC6h  BAG
  # 3117451961031765h  # CFFD6h  BAG
  # C808461241231h     # CFFE6h  BAG
>>

---------------------------

Remember, use of machine code can corrupt your calculator's memory if
it is not careful, resulting in "Memory Lost".  Please checksum these 
programs before running them.  Any program that uses BAG is a potential 
danger, since it will modify whatever part of memory you specify.

Machine language programs that manipulate screen memory must be extra
careful, as there are sensitive registers in this area of memory that 
can disable the display, corrupt memory, and (gasp) even permanently 
damage your calculator.  This is as much a warning to those who use
programs as to those who write them. 

regards,

Alonzo Gariepy
alonzo@microsoft