Metropoli BBS
VIEWER: srplgrob.doc MODE: TEXT (ASCII)
(Comp.sys.hp48)
Item: 2346 by stvlin04@uctvax.uct.ac.za [Richard Steventon]
Subj: Include a GROB in SYS-RPL & ML (DOC)
Date: 24 Oct 1993

Well, since there have been several queries in this newsgroup about how to
include a grob in SYS-RPL source for RPLCOMP, I thought that I would post
the following doc that has resulted from help that I received.

Thanks to Detlef and Fatri.

There are two source files included below.  They APPEAR to work fine on
my (and have only been tested on) Revision E 48sx.  Use them however you
see fit.

BEGIN SYS-RPL_EXAMPLE
*****************************************************************************
* Modulname:     Include_Grob
* Modultype:     User level secondary
* Dest.Comp.:    HP48
* Language:      System RPL                         ____ 
* Author:        Richard Steventon, Cape Town  /\_/      \_/\
* Interface:     (-->)
* Description:   
* Edition History : First included with Lemming (by DM) and later both with
*                  : TETRIS (also by Detlef)
*****************************************************************************

         TITLE   Include Grob v 1.0

ASSEMBLE
         NIBASC  /HPHP48-E/      Binary download header

RPL
ASSEMBLE
******************************************************
** Macro to show grob on screen **
MKGROB   MACRO           * x,y
         CON(5)  =DOGROB                 * prolog
         CON(5)  15+(($1+7)/8)*$2*2      * compute size
         CON(5)  $2                      * height
         CON(5)  $1                      * length
MKGROB   ENDM
******************************************************

RPL
::
CK0NOLASTWD                      ( * Zero Arguments * )
ClrDA1IsStat                     ( * Suspend clock  * )
TURNMENUOFF
CLEARVDISP                       ( * Clear the display * )
ASSEMBLE
         MKGROB  128,25          * grob 128 x 25 
         NIBHEX  0CFFFDEFFFF10C06CF9168910EFEFDF30EFF7C0CFFF30C06EF9168910
         NIBHEX  FFEFDF30EFF1E00FFF30C0660816891030030600EFF0600EFF30C0660
         NIBHEX  83FC91030030600EF70600CFF30CF7EF03FC810F7030600EF307008FF
         NIBHEX  30CF7EF0FFF810F7030600EF303008FF30C06600E9781030030600EF1
         NIBHEX  03000FF30C06600E9781030030600EF18F3F3FF30C06EF1C038F3FF03
         NIBHEX  0600EF08F3F7EF30C06CF1C030F3EF030600EF081336EF30000000000
         NIBHEX  00000000000EF0C9B37EF3000000000000000000000EF0C8913EF3000
         NIBHEX  000000000000000000EF0C8913EF3000000000000000000000EF0ECD9
         NIBHEX  3EF3000000000000000000000EF16CC81FF30CF1810F3683818F3CF10
         NIBHEX  EF16CCF1FF30CF3818F76C1818F7CF30EF37EEF0FF30C03C38166E0C3
         NIBHEX  816C030EF300608FF30C03C3810670C3816C030EF700608FF30C03668
         NIBHEX  10E3066816C030EFF0070CFF30CF366810E30668F3C030EFF1030EFF3
         NIBHEX  0CF1FF810670FF8F3C030EFF3030FFF30C00FF8166E0FF816C030EFFF
         NIBHEX  81CFFF30C003C8F76C13C816CF30CFFFBDFFFF10C003C0F36833C816CF1
RPL
ABUFF ZERO TWENTY GROB!          ( * copy grob over screen at 0,20 * )
SetDA123NoCh                     ( * Freeze display until keypress * )
;
*****************************************************************************
END SYS-RPL_EXAMPLE


BEGIN ML_EXAMPLE
*****************************************************************************
* Modulname:     grob
* Modultype:     User level secondary
* Dest.Comp.:    HP48
* Language:      SASM                                  ____
* Author:        Richard Steventon , Cape Town    /\_/      \_/\
* Interface:     (-->)
* Description:   writes to the screen a grob object whose data is in the
code
*                body
* Edition History : 13-08-93 asked Fatri Mohammed how to do it
*                  : 17-08-93 wrote this file as an eg
*****************************************************************************

         TITLE   ML Display Grob v1.0

ASSEMBLE
         NIBASC  /HPHP48-E/      Binary download header
RPL
CODE
         GOSBVL  =SAVPTR         * save registers
         D0=(5)  =VDISP          * pointer to address of stack grob
         C=DAT0  A               * get address
         LA(5)   20+34*21+11     * add prolog(20) + lines down(21) + offset(11)
         C=C+A   A               * add them
         CD0EX                   * put resulting address in D0

* The next instruction is a GOSUB and the return address is stored 
* in RSTK ie the adddress of the following instruction (in this case
* it is the grob data)
         GOSUB   next            
         NIBHEX  EFFF6FFFFF00FFF360EFFF10FFF0708FFF10FF70300FFF10FF30300EFF10
         NIBHEX  FF18300CFF10FF18100CFF10FF081008FF10FF0CF9F9FF10F70CF9F3FF10
         NIBHEX  F70C8913FF10F70ECD93FF10F706CC81FF10F706CC81FF10F707EEC1FF10
         NIBHEX  FF0366C8FF10FF036EF8FF10FF937F78FF10FF10030CFF10FF30030CFF10
         NIBHEX  FF70830EFF10FFF0810FFF10FFF1818FFF10FFF7C0EFFF10EFFFDEFFFF00

next     C=RSTK                  * get address of grob data from RSTK
         CD1EX                   * put address in D1
* D1 is address of grob data
* D0 is address of offset in screen      
         LA(2)   25-1            * counter (grob has 25 rows to write in loop)
loop     C=DAT1  12              * grob is 12 nibs wide so get first row
         DAT0=C  12              * write first row
         D1=D1+  12              * point to next 12 nibs of data
         D0=D0+  16              * \ 
         D0=D0+  16              *  > point to next line on screen
         D0=D0+  2               * /
         A=A-1   B               * decrement loop counter
         GONC    loop            * do until carry, then continue (exit)
         GOVLNG  =GETPTRLOOP     * restore registers
ENDCODE
******************************************************************************
END ML_EXAMPLE


Hopefully there are no mistakes.  Please notice that the ML one is only a
single Code object with the grob data included in it.

Any questions?  Feel free to Email me and I will help you as much as I can.

-Bye
-Richard
[ RETURN TO DIRECTORY ]