A89: what can possibly be wrong?


[Prev][Next][Index][Thread]

A89: what can possibly be wrong?



This is my keylib.asm library:

    include "doorsos.h"
    xdef    _ti89
    xdef    _ti92plus
    xdef    _library
    xdef    keylib@0000
keylib@0000:
    tst.w   (doorsos::kb_vars+$1C)      ; has a key been pressed?
    beq \put_zero           ; if not, go to put_zero
    move.w  (doorsos::MaxHandles+$1E),d0    ; puts the value of the keypress 
into d0
    clr.w   (doorsos::kb_vars+$1C)      ; clear key buffer
    bra \done               ; exits out
\put_zero
        move.w  #0,d0
\done
    rts
    end

However, when l try to call this library from an program, l either get the 
message "function did not return a value" or "Illegal instruction" appears on 
the status line and the program exits.  lt seems to me that whether or not a 
key is pressed that a value is moved into d0, but yet the messages say no.  
What is happening?
The C program is calling the library, and in doing so it stores whatever 
keylib@0000 returns in d0 into another variable.

--TurboSoft

Visit the TURBOSOFT HOMEPAGE:  The most current Basic and C programs created 
by TurboSoft for the 89, and the most 89 web links.
<A HREF="http://turbosoft.ticalc.org/">http://turbosoft.ticalc.org/</A>
	include "doorsos.h"
	xdef    _ti89
	xdef    _ti92plus
	xdef	_library
	xdef	keylib@0000
keylib@0000:
	tst.w	(doorsos::kb_vars+$1C)		; has a key been pressed?
	beq	\put_zero			; if not, go to put_zero
	move.w	(doorsos::MaxHandles+$1E),d0	; puts the value of the keypress into d0
	clr.w	(doorsos::kb_vars+$1C)		; clear key buffer
	bra	\done				; exits out
\put_zero
        move.w	#0,d0
\done
	rts

	end

Follow-Ups: