(Comp.sys.hp48) Item: 2543 by sourada@iastate.edu [Steven D Ourada] Subj: Tricorder simulator Date: 31 Dec 1992 [Note: This goofy program isn't really a tune or sound effect, but try it anyway. This can be used to test the gullibility of the natives. Make up some outrageous story about what it's doing, and I'll bet you a nickle that most people will believe it! -jkh-] Copyright 1992 Steven Ourada Freeware TRICORDR ======== What it is ---------- This is a silly little program to simulate the 'Tricorder' devices used on Star Trek. How to use it ------------- To use TRICORDR, download it into a convenient directory, take off the plastic cover over the infra-red pair on your 48, and execute TRICORDR. When you bring the front of the 48 close to some object, the speaker will repeatedly beep. Wow, lot's of fun, eh? When the excitement dulls, press a key to get out of the program. How it works ------------ Nothing too complicated: a small assembly language code segment pulses the IR emitter, and checks the detector to see if there is a reflection. It reports this back to the user-RPL code that beeps if there was a reflection. Don't be worried that this will drain your batteries; the IR LED is only on for about 20 microseconds for each 10 milliseconds. I disclaim it ------------- This is Freeware, copy it freely as long as you give credit where it's due. There is NO WARRANTY with this software as it is provided to you with no charge. That's it --------- Keep in mind that this is my first attempt at using Saturn assembly and my first HP48 program to be posted to Usenet. :-) If you have any comments, please mail me. --------------- Cut here. Assembly source follows. ------------------ ; Copyright 1992 Steven Ourada Freeware ; Embedded assembly code to do "proximity check" ; Turn the IR on, check to see if it reflected, turn it off include class.mac rpl $02dcc ; DOCODE pgmbeg rpl pgmend-pgmbeg ; length of code jsr save_regs move.a #$11a,d1 move.1 (d1),a bclr #0,a move.1 a,(d1) ; clear IR detector bit move.a #$11c,d0 move.1 (d0),a bset #3,a move.b a,c bclr #3,c move.1 a,(d0) ; turn IR emitter on move.1 (d1),a ; read IR detector move.1 c,(d0) ; turn IR emitter off (it's only on for ~20us) bbs #0,a,reflec noreflec move.a #"0",d1 ; return a "0" in the string exg.a d1,c bra.3 stostat reflec move.a #"1",d1 ; return a "1" in the string exg.a d1,c stostat push jsr restore_regs pop move.a (d1),a ; assuming a string on the top of the stack move.a a,d1 add.a #$a,d1 move.b c,(d1) exit jsr restore_regs move.a (d0),a add.a #5,d0 jmp (a) pgmend rpl $0312b ; SEMI include class.sym -------------------- Cut here. User RPL source follows. --------------- @ Copyright 1992 Steven Ourada Freeware @ 'Tricorder' simulator @ Note that the assembly code must be inserted where shown for this program @ to work properly. \<< "0" DO @ Assembly code inserted here IF DUP "1" SAME THEN 200 .03 BEEP END UNTIL KEY END DROP DROP \>> -- ------- Steven Ourada -- sourada@iastate.edu