Re: A86: _getkey


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

Re: A86: _getkey




oops, did i just reply the wrong answer, i think i sorta did... i think
your include files don't line up with the aliases (K_ENTER, etc) in your
program.  Or tasm isn't set up right.

On Sun, 6 Feb 2000, Brian Deuel wrote:

> 
> 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
> 
> 
> 



References: