[A83] Re: ARGH! Problems with my getcsc prog


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

[A83] Re: ARGH! Problems with my getcsc prog




For the hell of it, here's a working program.  (requires Dwedit.inc)

#include "dwedit.inc"
tTitle: .db "Getcsc Test!"
lblStart:

  ld hl,0           ;Set cursor to 0,0  (you can also use homeup)
  ld (currow),hl
  ld hl,tPressAKey  ;hl = pointer to "Press a key!"
  bcall(_puts)      ;Display the string located at hl
  bcall(_newline)   ;Next line

  call Waitkey      ;Get a key

  cp g2nd           ;Check if key is 2nd (g means it's from getcsc and
                    ;not the other ways to get keys)
  jr nz,Not2nd      ;If not 2nd then skip ahead.

  ld hl,tPressed2nd ;hl = pointer to "You pressed 2nd."
  bcall(_puts)      ;Display it.

Not2nd:             ;If the key was not 2nd, it jumps here

  cp gAlpha         ;Check if alpha
  jr nz,NotAlpha    ;If not alpha, skip ahead

  ld hl,tPressedAlpha  ;hl = pointer to "You pressed Alpha"
  bcall(_puts)      ;you know

NotAlpha:           ;Jumps here if not alpha
  bcall(_newline)   ;This next code will display OK.
  ld hl,tOK
  bcall(_puts)
  call Waitkey
  ret        ;END OF PROGRAM!!!


Waitkey:
  ei
WKA_loop:
  HALT
  bcall(_getcsc)   ;if you are making this for the TI82 make this icall(
  or a
  jr z, WKA_loop
  ret


tPressAKey: .db "Press a key!",0
tPressed2nd: .db "You pressed 2nd.",0
tPressedAlpha: .db "You hit Alpha.",0
tOK: .db "OK.",0

>From: "Steve Watson" <fif_freak00@hotmail.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: Assembly-83@lists.ticalc.org
>Subject: [A83] ARGH!  Problems with my getcsc prog
>Date: Thu, 15 Mar 2001 17:02:33 -0700
>
>
>Well, TASM keeps reporting that there is "unused data in MS byte of
>argument" in lines 19 and 21, which is where I jr to either k2nd or kAlpha
>(labels, not things in the include file).  I had to make them those labels
>because if they weren't those labels, TASM would say that there were no
>labels of those names.  Anyways, if anyone finds any problems (someone else
>on this list gave me this code), tell me.
>
>	.nolist
>	#include "ion.inc"
>	.list
>
>#ifdef	TI83P
>	.org progstart-2
>	.db $BB,$6D
>#else
>	.org progstart
>#endif
>	ret
>	jr nc,begin
>	.db "Getcsc.inc Test!",0
>begin:
>	bcall(_clrlcdf)
>	bcall(_homeup)
>	call 	waitkey ; Call our 'waitkey' subroutine
>	cp	k2nd
>	jr	z,k2nd 	; Handle the 2nd key
>	cp	kAlpha
>	jr	z,kAlpha ; Handle the Alpha key
>back:
>	call 	waitkey ; Call our 'waitkey' subroutine
>	ret   	 	; Last 'ret' in program -> return to shell
>;---
>; Subroutine
>waitkey:
>	ei
>WKA_loop:
>	HALT
>	bcall(_getcsc)
>	or	a
>	jr	z, WKA_loop
>	ret 	 	; return were we came from
>;---
>; Subroutine (not a real one)
>k2nd:
>	ld 	hl,txt
>	bcall(_puts)
>	jr back 	; Jump to the end of our program
>;---
>; Subroutine (not a real one)
>kAlpha:
>	ld 	hl,txt2
>	bcall(_puts)
>	jr back 	; Jump to the end of our program
>;---
>; Data
>txt:
>	.db "You hit 2nd",0
>txt2:
>	.db "You hit Alpha",
>.end
>end
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com