A86: Re: _getkey


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

A86: Re: _getkey




I think the problem may (NOTE: may) be that you do not have spaces before
your ASM directives. e.g.:

.org _asm_exec_ram
 call _clrLCD ;clear the LCD
ASK_FOR_KEY:
 call _getkey ;waits for key
;etc.

ASM Studio might work for you, but TASM will screw up if you don't do that.
Otherwise, should work, though I recommend putting a HALT instruction in the
key loop to save battery power.

----- Original Message -----
From: Brian Deuel <bdeuel@pathwaynet.com>
To: <assembly-86@lists.ticalc.org>
Sent: Sunday, February 06, 2000 7:22 PM
Subject: A86: _getkey


> Hello. I am new to this list, and to Z80 assembly programming. My
> programming experience is limited to TRS-80 Model III BASIC from 1982(!),
so
> please bear with me. I have gone through the various tutorials and have
> gotten somewhat of a grasp on assembly language programming, but I have a
> ways to go yet.
>
> I have written a program using one of Trent Lillehaugen's examples
> (http://www.calpoly.edu/~tllilleh/a86/examples.html the KEY INPUT
example).
> The example on the page is obviously incomplete and even incorrect in a
> couple of places. I filled in some of the holes where the labels are and
> even added a function to initialize the screen to print the text. Here is
my
> code:
>
> #include "asm86.h"
> #include "ti86asm.inc"
>
> .org _asm_exec_ram
> call _clrLCD ;clear the LCD
> ASK_FOR_KEY:
> call _getkey ;waits for key
> cp K_ENTER ;is it ENTER?
> jp Z,ENTER ;if so, jump to ENTER
> cp K_2ND ;is it the SECOND key?
> jp Z,SECOND ;if so, jump to SECOND
> cp K_EXIT ;is it exit?
> jp Z,EXIT ;if so, jump to EXIT
> jp ASK_FOR_KEY ;if it's none get another key
> ENTER:
> call INIT_SCRN ;initialize the screen
> ld hl,entertext ;point hl to entertext
> call _puts ;put entertext on screen
> ret
> SECOND:
> call INIT_SCRN ;initialize the screen
> ld hl,scndtext ;point hl to scndtext
> call _puts ;put scndtext on screen
> ret
> EXIT:
> call INIT_SCRN ;initialize the screen
> ld hl,exittext ;point hl to exittext
> call _puts ;put exittext on screen
> ret
> INIT_SCRN:
> ld hl,$0000
> ld (_curRow),hl ;set cursor to 0,0
> ret
>
> entertext:
> .db "You pressed ENTER",0
> scndtext:
> .db "You pressed SECOND",0
> exittext:
> .db "You pressed EXIT",0
> .end
>
>
> When I assemble this, this is the error list I get:
>
> key.asm line 0008: Label not found: (K_ENTER)
> key.asm line 0008: Unused data in MS byte of argument. (200)
> key.asm line 0010: Label not found: (K_2ND)
> key.asm line 0010: Unused data in MS byte of argument. (200)
> key.asm line 0012: Label not found: (K_EXIT)
> key.asm line 0012: Unused data in MS byte of argument. (200)
> tasm: pass 2 complete.
> tasm: Number of errors = 6
>
>
> This tells me that _getkey does not return anything using these labels.
Does
> _getkey return any values that I can use as a comparison, or do I need to
> learn interrupts first?
>
> Sorry for the length of this post. If this is too long, please enlighten
me
> on how to post code examples.
>
> Thanks,
>
> Brian Deuel
> Brian's Coinop History Archive
> http://coinop.vintagegaming.com
>
>



Follow-Ups: References: