[comp.sys.handhelds] Chip question

byu@csri.toronto.edu (Benjamin Yu) (12/07/90)

I don't know if anyone of you who used CHIP (ver 225) experienced this or it
is just me.  When I run, say BRIX, I put BRIX on level 1 and hit CHIP to
"interpret" it.  Now, I don't have my clock on display, but sometimes, I need
to repeat the whole process about 6 times before I can actually play the game!

What do I mean by repeat the whole process 6 times??  Well I had to hit BRIX
CHIP BRIX CHIP BRIX CHIP BRIX CHIP BRIX CHIP BRIX CHIP before I can play!!
The unsuccessful times when I hit CHIP put me back into the usual menu with
the 4 levels as if nothing happens.  Do I have a corrupted CHIP or this is
normal??

Benjamin Yu

vaps0pb@prism.gatech.edu (12/07/90)

I have the same problem with CHIP sometimes, plus some programs obscurely set
user flag 1 and wipe away the clock.

...........Phil

mike@DRD.Com (Mike Rovak) (12/08/90)

byu@csri.toronto.edu (Benjamin Yu) wrote:
} I don't know if anyone of you who used CHIP (ver 225) experienced this or it
} is just me.  When I run, say BRIX, I put BRIX on level 1 and hit CHIP to
} "interpret" it.  Now, I don't have my clock on display, but sometimes, I need
} to repeat the whole process about 6 times before I can actually play the game!
}...

It's not just you.

Background:

I have a version E rom, and have been using CHIP/225 with BRIX and SYZYGY.
I also have been using the RPL TETRIS (fast enough for *me*!).
I recently downloaded AS48, the RPL CHIP8 Assembler, posted by G. Kohl,
(which IMHO is the slickest [most elegant] and most intellectually stimulating
piece of RPL code I have ever seen) and several things occurred in the
same day:

  1. I installed my freebie EQ LIB card, and a purchased 128K card into
     the calculator and merged all the system memory.

  2. I loaded AS48 into my calculator and ran it on the supplied demo.
     I had a typo in one of the routines, and it did not run successfully
     on the first attempt.  I fixed the problem, and then it ran 
     correctly.

  3. I downloaded the HP-supplied utilities into the calculator (stop watch
     library, USAG, appointment book front end) and tried to attach the
     stop watch library to a subdirectory, not realizing that it attempts
     to automatically attach to the HOME directory on power-up.

  4. At one point, I had the stop watch library apparently attached both
     to the HOME directory and the subdirectory.  I realized my error
     and then detached the one on the subdirectory.

  5. I didn't like the fact that SW-A appears first in the LIBRARY menu,
     I preferred to see the EQ LIB menu selections fill up the first six
     slots, so I [stupidly] turned off the calculator, removed the EQ LIB
     card, turned on the calculator, verified that the only library in the
     LIBRARY menu was SW-A, then turned the calculator off, installed the
     EQ LIB card, turned the machine on, and gave up when I saw that the
     machine was going to insist that PORT 0 library objects list first
     in the menu.

I should point out here that I appreciate the value of a backup. 
I make frequent ARCHIVEs to my PC and am glad of it.  It paid off.

Imagine my surprise the next day when TETRIS ran and accumulated score
without displaying any falling pieces.  Likewise, PUZZLE24, which I thought
was an RPL program, failed to run and required a system halt (ON-C) to return
to the stack display.  I looked at the INIT subroutine, and it had some
intersting and rather large binary integers and Externals in it, which I
could have sworn were not in the original code.  I immediately and without
question nor further debate executed the three-fingered salute (ON-A-F) and
cleared memory.  Reloaded from a good backup, downloaded what was missing,
didn't do anything questionable or anomalous, and voila, everything works
and memory is intact (then I made yet another backup).

I think that the bottom line is that what we have here is a piece of
computing machinery which is complex in its hardware AND its firmware.
Disclaimers on low-level machine language code are not published in vain.
A word to the wise should be sufficient.

I have no idea which operation actually corrupted my memory.  All I am
saying is that there was ample opportunity for doing so in the course of
normal operation, and this time it happened.  Fortunately for me, it
only cost me a few extra minutes of my time.

The user should be aware that some RAM addresses control some hardware
functions in the HP48SX (e.g., display), and there are apparently no
hardware interlocks (cost constraints) to prevent a user from physically
damaging the machine, or so I gather from readings on this newsgroup.
My humble advice would be to stay out of the memory scanner and the 
ON-D stuff unless you have a reason for being there and know what you 
are doing with it, unless potentially losing your investment makes 
no impression on you.

I would also advise clearing memory at the first sign of trouble, and
frequent archiving if you modify memory contents a lot.

Just trying to help.

-- Mike

------------------------------------------------------------------------
Disclaimer: My opinions do not necessarily reflect those of my employer.
========================================================================
------------------------------------------------------------------------
     mike@DRD.Com  
     uunet!apctrc!drd!mike
========================================================================

degen@bnlux0.bnl.gov (christopher degen) (12/08/90)

In article <1990Dec6.231427.28844@jarvis.csri.toronto.edu> byu@csri.toronto.edu (Benjamin Yu) writes:
>"interpret" it.  Now, I don't have my clock on display, but sometimes, I need
>to repeat the whole process about 6 times before I can actually play the game!
>
>What do I mean by repeat the whole process 6 times??  Well I had to hit BRIX
>CHIP BRIX CHIP BRIX CHIP BRIX CHIP BRIX CHIP BRIX CHIP before I can play!!

  I have noticed this also, but it usualy only takes _only_ 2 or 3
tries. I find that if I pause a second or two between pressing BRIX and
CHIP, it seems to work the first time (or is this just coincidence?)

  -Chris

    *******************************************************************
    *                                                                 *
    *   Christopher M. Degen             Phone:(516) 282-2492         *
    *   Brookhaven National Laboratory   FTS: 666-2492                *
    *   Building 923  Room 42            E-Mail:degen@bnlux0.bnl.gov  *
    *   Upton NY 11973                                                *
    *                                                                 *
    *******************************************************************

TNA32@CCVAX.IASTATE.EDU (FRINGE) (12/08/90)

Well, gee, we've now got all sorts of examples of CHIP not working properly
(I won't include mine here).....HOW ABOUT A SOLUTION.

byu@csri.toronto.edu (Benjamin Yu) (12/08/90)

Hmm, now I know it is not just me who had this CHIP problem.  But thanks to
some who give me a hint as to how to fix it,... I still don't know why it
fixes the problem.  The solution is after you hit BRIX, wait for a little
while and then hit CHIP.  I did this several times, and I always get any
program to be interpreted by CHIP everytime.  If I hit BRIX and CHIP really
fast together, one after another, it will just give me back the menu
screen.  I guess in my original post, the reason why I need to hit BRIX
CHIP 6 times to get it working is because, after  6 times, my fingers get
tired and there is enough delay between BRIX and CHIP to get the 48SX
working :-)!  Interesting machine....


-- 
Benjamin Yu
University of Toronto                CSNET, UUCP, BITNET: 
Department of Computer Science         byu@csri.toronto.edu
Toronto, Ontario   Canada M5S 1A4      byu@csri.utoronto.ca
(o)(416)978 - 4299 (h)(416)470 - 8206  {uunet,watmath}!csri.utoronto.edu!byu

sburke@jarthur.Claremont.EDU (Scott Burke) (12/09/90)

In article <1990Dec8.101737.19776@jarvis.csri.toronto.edu> byu@csri.toronto.edu (Benjamin Yu) writes:
>Hmm, now I know it is not just me who had this CHIP problem.  But thanks to
>some who give me a hint as to how to fix it,... I still don't know why it
>fixes the problem.  The solution is after you hit BRIX, wait for a little
>while and then hit CHIP.  I did this several times, and I always get any
>program to be interpreted by CHIP everytime.  If I hit BRIX and CHIP really
>fast together, one after another, it will just give me back the menu
>screen.  I guess in my original post, the reason why I need to hit BRIX
>CHIP 6 times to get it working is because, after  6 times, my fingers get
>tired and there is enough delay between BRIX and CHIP to get the 48SX
>working :-)!  Interesting machine....
>

I'm almost positive this isn't really what's happening.  I have written a 
shell program using one if Jim Donnelly's browsers to provide a menu of
games when I press GAME in my CST menu.  Then, if I choose a CHIP game, my
program turns off the clock, recalls the game string to the stack and 
executes CHIP.  Presuming the game runs, when I quit it, I reset my flags
and return to the main menu to see if another game is desired.

My shell program seems to run on Tuesdays, Wednesdays, and Thursdays only.
No, just kidding--it's weirder than that!  Sometimes it works and sometimes
it doesn't.  Pressing ON-C to supposedly reset my machine to some default
configuration doesn't always yield the same behavior.  Single-stepping thru
my code ALWAYS works, and despite MANY different kinds of tests, I have 
never noticed a correlation between the time between (say) BLINKY and CHIP
and whether or not CHIP really runs.  THe problem is, I can't FIND any
correlation between the apparent state of my machine and whether or not
CHIP decides to work.  Oops, just ran another test.  Five minutes ago, 
single stepping through my code worked.  Now it doesn't, and I haven't even
changed any of the code.  I was thinking that for some reason Jim's browser
left some weird status bit changed, but I get the same unpredictable resulls
whether or not I use a call to TBR (his title browser).

I give up.  Sometimes I just don't get to play a game.  :-(

Scott.
sburke@jarthur.claremont.edu

davisp@skybridge.SCL.CWRU.Edu (Palmer Davis) (12/09/90)

In article <1990Dec6.231427.28844@jarvis.csri.toronto.edu> byu@csri.toronto.edu (Benjamin Yu) writes:
>
>sometimes, I need
>to repeat the whole process about 6 times before I can actually play the game!
>
>What do I mean by repeat the whole process 6 times??  Well I had to hit BRIX
>CHIP BRIX CHIP BRIX CHIP BRIX CHIP BRIX CHIP BRIX CHIP before I can play!!
>The unsuccessful times when I hit CHIP put me back into the usual menu with
>the 4 levels as if nothing happens.  Do I have a corrupted CHIP or this is
>normal??
>

I run into the same problem.  A workaround that seems to be effective is to
wait for a second or two before pressing CHIP.  I haven't had enough time to
go digging through sources or play with SAD to look at the ROM to figure out
why this happens, but if you hit <name of program> and CHIP in rapid 
succession, it dumps you back to the RPL interpreter.  Why the speed with
which you press the buttons matters is a mystery....

-- PTD --



--
Palmer T. Davis                 |  davisp@scl.cwru.edu  -OR-  ptd2@po.cwru.edu
Case Western Reserve University | {att,sun,decvax,uunet}!cwjcc!skybridge!davisp
------------------------------------------------------+------------------------
Wake up and smell the cat food in your bank account.  |     Life is short.

bson@rice-chex.ai.mit.edu (Jan Brittenson) (12/09/90)

In article <10031@jarthur.Claremont.EDU> sburke@jarthur.Claremont.EDU (Scott Burke) writes:

 > THe problem is, I can't FIND any correlation between the apparent
 > state of my machine and whether or not CHIP decides to work.

   I have written several programs that exhibit the same behaviour.
The problem, as far as I can tell, occurs in all programs that use a
certain scheme to allocate strings. My (very poorly founded) guess is
that the problem arises when a GC is performed. Call MEM DROP before
calling CHIP (or at some other tactic point) - this will make it less
likely for a GC to occur while CHIP allocates its data.

   Also try disabling LAST STACK when using CHIP. I'm not exactly sure
how the LAST STACK and GC interact, but LAST STACK has given me funny
results with CHIP and other programs that use similar allocation
schemes. To be more specific, the sequence

	FOOGAME CHIP [LAST STACK] CHIP

will sometimes yield unexpected results.

TDSTRONG%MTUS5.BITNET@CUNYVM.CUNY.EDU (Tim Strong) (12/10/90)

>...
>Imagine my surprise the next day when TETRIS ran and accumulated score
>without displaying any falling pieces.  Likewise, PUZZLE24, which I thought
>was an RPL program, failed to run and required a system halt (ON-C) to return
>to the stack display.  I looked at the INIT subroutine, and it had some
>intersting and rather large binary integers and Externals in it, which I
>could have sworn were not in the original code.  I immediately and without
>question nor further debate executed the three-fingered salute (ON-A-F) and
>cleared memory.  Reloaded from a good backup, downloaded what was missing,
>didn't do anything questionable or anomalous, and voila, everything works
>and memory is intact (then I made yet another backup).

I think I know why the RPL TETRIS sometimes corrupts memory.  I have found
that TETRIS needs a binary wordsize of 64 (to be safe).  If the binary wordsize
is not 64 the game acts as you descirbe corrupting itself and heaven knows
what else.

The moral is if you want TETRIS on your machine and you play with the
wordsize on your calculator alot add the following program to your TETRIS
directory and run it instead of TETRIS:

<< 64 STWS TETRIS >>

'RUNTET'

STO

Hope this helps!

TNAN0@CCVAX.IASTATE.EDU (12/11/90)

Howdy All!

   I do not have the source for CHIP, but I have noticed that typing MEM before
executing CHIP solves the problem (it works every time for me).  Is it possible
that the people having the problem are running relatively low on memory (6K is
pretty low if you are going to run CHIP)?  If so, perhaps CHIP doesn't perform
a garbage collection before it allocates the necessary 4K for the game string.
This is pure conjecture, of course, but perhaps automatic garbage collection
occurs when the calculator has been left alone for a few seconds and that is
why the problem doesn't occur if you wait before entering CHIP...  I never use
the on-screen clock, so I can't believe that this causes it...

  By the way, although I have not yet made it with 48 mines on MINEHUNT, I
would like to share my syzygy scores with you:

With borders:   630
Without borders: 963

I did not cheat or pause while earning these scores...  Lemme know if you beat
either...  (by the way, the score is only 3 digits...  Wonder what happens at
1000...?)


---Xeno

P.S.  I've been trying to write some stand alone (non-RPL-stack dependent)
programs...  What's the best way to locate and access relative memory
addresses?  For example, if I have a data area at the beginning of my code, it
seems to me the best way to access it would be to use a "thisone move.a pc,a"
followed by a "move.p5 thisone-dataarea,c" "sub.a c,a" thus leaving the address
of the data area in register A... is there a cleaner method?  And if not, what
assembler will handle this "distance between relative labels" function --
SASS sure won't!

mike@DRD.Com (Mike Rovak) (12/11/90)

TDSTRONG%MTUS5.BITNET@CUNYVM.CUNY.EDU (Tim Strong) wrote:
} >...
} >Imagine my surprise the next day when TETRIS ran and accumulated score
} >without displaying any falling pieces.  Likewise, PUZZLE24, which I thought
} >was an RPL program, failed to run and required a system halt (ON-C) to return
} >to the stack display.  I looked at the INIT subroutine, and it had some
} >intersting and rather large binary integers and Externals in it, which I
} >could have sworn were not in the original code.  I immediately and without
} >question nor further debate executed the three-fingered salute (ON-A-F) and
} >cleared memory.  Reloaded from a good backup, downloaded what was missing,
} >didn't do anything questionable or anomalous, and voila, everything works
} >and memory is intact (then I made yet another backup).
} 
} I think I know why the RPL TETRIS sometimes corrupts memory.  I have found
} that TETRIS needs a binary wordsize of 64 (to be safe).  If the binary wordsize
} is not 64 the game acts as you descirbe corrupting itself and heaven knows
} what else.
} 
} The moral is if you want TETRIS on your machine and you play with the
} wordsize on your calculator alot add the following program to your TETRIS
} directory and run it instead of TETRIS:
} 
} << 64 STWS TETRIS >>
} 
} 'RUNTET'
} 
} STO
} 
} Hope this helps!

Thanks, Tim.  Your theory matches the observed facts.  When AS48 aborted,
the word size was left as 16 since the locals saved at the beginning of the
program got killed and never were recalled and reinstated.

I find it comforting somehow to know that in this particular case, there
was a logical explanation.

------------------------------------------------------------------------
Disclaimer: My opinions do not necessarily reflect those of my employer.
========================================================================
------------------------------------------------------------------------
     mike@DRD.Com  
     uunet!apctrc!drd!mike
========================================================================

c37189h@saha.hut.fi (Harri "Haba" Suomalainen) (12/12/90)

In article <F002EC16567F006FAC@ISUVAX.BITNET> TNAN0@CCVAX.IASTATE.EDU writes:
>   I do not have the source for CHIP, but I have noticed that typing MEM before
>executing CHIP solves the problem (it works every time for me).  Is it possible
>that the people having the problem are running relatively low on memory (6K is
>pretty low if you are going to run CHIP)?  If so, perhaps CHIP doesn't perform
>a garbage collection before it allocates the necessary 4K for the game string.

I think CHIP does no garbage collection. (Ver 2.25) Instead it disables 
garbage collection to make it safe to run. So that shouldn't be the
problem!

-hs


--
Harri Suomalainen         c37189h@saha.hut.fi         haba@otax.tky.hut.fi

bson@rice-chex.ai.mit.edu (Jan Brittenson) (12/13/90)

In article <F002EC16567F006FAC@ISUVAX.BITNET> TNAN0@CCVAX.IASTATE.EDU writes:

 > I've been trying to write some stand alone (non-RPL-stack dependent)
 > programs...  What's the best way to locate and access relative memory
 > addresses?  For example, if I have a data area at the beginning of my
 > code, it seems to me the best way to access it would be to use a
 > thisone move.a pc,a" followed by a "move.p5 thisone-dataarea,c"
 > sub.a c,a" thus leaving the address

   STAR 1.02.3 and later comes with a macro ADDR in hp48.star. The
macro is used as follows:


	ADDR	location, dest


Where `location' is any expression and `dest' is either C, A, D0, or D1.
An example:

	; ...

	addr	foo, c

	; ...

foo:	ascii	`Hello world!'


   The code generated is much what you describe, although ADD is used
instead of SUB. A.a is used for temporary storage, unless the
destination is A, in which case C.a is used as a temporary register.
The macro can easily be modified to take an optional third argument to
specify which register to use for temporary storage.

For the insanely curious, I'll include the macro definition.

						-- Jan Brittenson
						   bson@ai.mit.edu

	macro	addr  operand, dest

	save	sym
	sym  = gensym

	save	tmp
	save	ntmp

	dest = uc^`$dest'

	if `$dest' == `A'
	  tmp = `C'
	  ntmp= `A'
	else
	  tmp = `A'
	  ntmp= `C'
	endif

	move    pc, $tmp
	$sym = .

	if (`$dest' == `D0') || (`$dest' == `D1')
	  move.5 ($operand)-$sym, $dest
	  swap    $ntmp, $dest
	  add.a   $tmp, $ntmp
	  swap    $ntmp, $dest
	else
	  move.p5 ($operand)-$sym, $dest
	  add.a   $tmp, $dest
	endif
	
	restore	tmp
	restore	ntmp
	restore sym

	endmacro

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (12/29/90)

Maybe it's just me, but my thining light on the HP goes on when I press a
chip string, I just wait a sec, and run the chip interp, and it works
fine.