[comp.sys.handhelds] Chip48 & Clock

fseipel@hpuxa.ircc.ohio-state.edu (Frank E. Seipel) (11/17/90)

 
 I like Chip8 but every time it is run it turns the clock off and
must be run a second time to run your chip program (the first time
it merely turns the clock off and returns to the command line). This
program simply calls Chip, first noting whether the clock display
is enabled and saving this information on the stack, next disabling
the clock (so that chip can run the program), then invoking chip, and
finally restoring the clock flag to its previous value upon returning
from Chip.

<< -40 FS? DUP
   IF 1 ==
   THEN -40 CF
   END SWAP Chip8
   IF 1 ==
   THEN -40 SF
   END
>>

(This assumes Chip is called Chip8). I had to type this in manually
as there seems to be a problem with uploading, the '<<' and '>>' do
not come out right.
 
P.S. I have a program I wrote about a month ago which generates a
random maze on the 64 x 131 graphics screen. It takes a few hours
to run (it is in RPL), but generates an intricate little maze. It
would be nice to see a 'maze' game converted over to Chip. I did
write a second program to convert the PICT image of the maze into a
string (8K long), and then a program to move through the maze with a
3 x 3 window (it is relatively quick but the maze text string is way
too long). In ml or Chip, the maze could be compressed so that only
the PICT image, a mere 1100 bytes, would be required.
 
Here is a short graphic demo. It draws a polygon, of 10 sides,
and connects each vertice to every other vertice, then inverts the
display and pauses until a key is pressed:

<< Grinit -17 -18 CF
CF PICT (0,63)
"Lace" 2 ->GROB REPL
36 32 32 -> inc xr
yr
 << 0 360
    FOR i 'xr*COS(i
    )+64' EVAL 'yr*SIN(
    i)+32' EVAL R->C i
    360
       FOR j DUP 'xr
       *COS(j)+64' EVAL '
       yr*SIN(j)+32' EVAL
       R->C LINE inc
       STEP DROP inc
       STEP Invrt
 >>

Save this one as 'Lace'

<< PICT PURGE { #0h #0h } PVIEW 0 130 XRNG 0 63 YRNG >>

Save that one as 'Grinit'

<< PPAR DUP 1 GET
SWAP 2 GET C->R -> xm
ym
 << C->R 0 -> xc ys y
    << ys ym
       FOR y xs y
       R->C xm y R->C TLINE
       NEXT 7 FREEZE
    >>
 >>
>>

I wonder if somebody could write a high level language for the 48 that
compiles to HP ml. Especially one that handles an integer variable
type so things would be quicker. Graphics could go a lot faster if
you could just put a byte on the stack, a single 8 bit byte that is.