gson@niksula.hut.fi (08/14/90)
I am writing a machine code program for the HP48SX using my own
assembler. I keep having problems with the program crashing about
half the times I try to run it. I put together a small test program
that demonstrates the problem. The test program runs in an infinite
loop, reading the keys "0 . SPC +" in the bottom row of the keyboard
and writing the data input from the keyboard in the top left corner of
the LCD display buffer. When one or more of the keys is pressed, the
corresponding bit(s) is turned on in the display.
I have tested this program by doing a complete reset (ON-A-F),
downloading the CODE object enclosed below from a Kermit server (CRASH
I/O KGET), and running the object by pressing VAR CRASH. Voila, it
works (at least until the keyboard buffer fills up and the calculator
starts beeping). However, if I add a string object to the home
directory (e.g., by saying "" S STO), the program crashes after a few
key presses. After purging the new object the program works again.
It seems like the program is sensitive to its position within the home
directory, what other objects happen to exist in the calculator, and
perhaps the phase of the moon.
Obviously I must be doing something wrong, but what? Any clues will
be greatly appreciated.
If you are going to try the program yourself, remember that if you
don't wipe out the memory of your calculator yourself before
downloading, the program probably will.
Here is the CODE object in uuencoded form:
begin 644 crash
>2%!(4#0X+4',+7 " @HQ)=P,3 4 (@3!1_!;^
end
And here is the assembly listing:
00000 ; crash.asap - demonstrate HP48SX machine code problem
00000 ;
00000 ; standard preamble for Kermit download
00000 84 data.b 'H'
00002 05 data.b 'P'
00004 84 data.b 'H'
00006 05 data.b 'P'
00008 43 data.b '4'
0000a 83 data.b '8'
0000c d2 data.b '-'
0000e 14 data.b 'A'
00010 ccd20 data.a #02dcc ; machine code object
00015 72000 begin: data.a end-begin ; length of object
0001a ; end of preamble
0001a
0001a loop:
0001a 80824c7907 move.p5 #7097C,a ; beginning of display
00024 130 move.a a,d0
00027 3410000 move.p5 #00001,c ; bottom row
0002e 801 out.x c ; output to keyboard
00031 803 in.4 c ; input from keyboard
00034 15cf move.16 c,@d0 ; move to display
00038 61ef jump.3 loop ; ..over and over again
0003c
0003c even
0003c end:
--
Andreas Gustafsson
Internet: gson@niksula.hut.fi
Voice: +358 0 563 5592