After calling _getKey, you need to subtract kA from A (sub kA) so the base index for your LUT (lookup table) is 0, rather than kA.
What?

Code:

#include "begin.inc"
#define length $8270
.org $9327
 ld a,1
 ld (length),a
 call _runindicoff
 call _clrlcdfull
 set shiftalock,(iy+shiftflags)
 ld hl,0*256+0
 ld (pencol),hl
input:
 call _getkey
 sub kA                ;<----- look at me
 ld e,a
 ld d,0
 ld hl,jumptable
 add hl,de
 ld a,(hl)
 call _putc
 ld a,(length)
 inc a
 cp 4
 jp z,done
 ld (length),a
 jp input
jumptable:
 .db 'A','B','C','D','E','F','G','H','I','J','K','L','M'
 .db 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
done:
 ret
.end
END

Unless the key code returned by getKey when you press A (kA) is 0, you're always getting a screwy offset from jumptable. For example, if kA is equal to 27, then in your previous code, you're actually printing the value of (jumptable+27), which in this case is the opcode for ret, C9h.
i got a compile error that said:


Code:

TASM Z80 Assembler.       Version 3.2 September, 2001.
 Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
input.z80 line 0013: Label not found: (kA)
input.z80 line 0013: Unused data in MS byte of argument. (200)
tasm: pass 2 complete.
tasm: Number of errors = 2


you have to remember that i am doing this on a regular 83
Oh, uh.. anyone know what 'A' equates to?
asmguru says math is equ .191 is that the same thing since they are on the same key?
I don't think so, but you may as well try it.
nope it doesnt. i guess i will have to browse ticalc for a key include file
The Tari wrote:
After calling _getKey, you need to subtract kA from A (sub kA) so the base index for your LUT (lookup table) is 0, rather than kA.


Isn't it tA, not kA? (or is tA something different?)
alright i got it all working now. here is the code i used:


Code:

#include "begin.inc"
#define length $8270
kA .equ $9a
.org $9327
 ld a,1
 ld (length),a
 call _runindicoff
 call _clrlcdfull
 ld hl,0*256+0
 ld (pencol),hl
 set shiftalpha,(iy+shiftflags)
 set shiftalock,(iy+shiftflags)
input:
 call _getkey
 sub kA
 ld h,0
 ld l,a
 ld de,jumptable
 add hl,de
 ld a,(hl)
 call _putc
 ld a,(length)
 inc a
 cp 4
 jp z,done
 ld (length),a
 jp input
jumptable:
 .db 'A','B','C','D','E','F','G','H','I','J','K','L','M'
 .db 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
done:
 ret
.end
END


how would i get the A to not be in the upper corner. and also what is the best way for me to save what is entered. I do not want the code just the process that way i can try to get it done myself first.
You can save the coordinates to display the next things at in curRow and curCol, and for long-term storage, you're probably best off doing writeback. If the program runs in a shell, just make a label with some blank space in it that you can write to, or if this is nostub, see what 83pa28d says (I'm too lazy to describe it).
i have it working somewhat. Here is a screen shot of what it does.



and here is the code i am using


Code:

#include "begin.inc"
#define length $8270
kA .equ $9a
buffer .equ textshadow
.org $9327
 ld a,1
 ld (length),a
 call _runindicoff
 call _clrlcdfull
 ld hl,0*256+0
 ld (pencol),hl
 set shiftalpha,(iy+shiftflags)
 set shiftalock,(iy+shiftflags)
input:
 call _getkey
 sub kA
 ld h,0
 ld l,a
 ld de,jumptable
 add hl,de
 ld a,(hl)
 call _putc
 ld (de),a
 ld de,buffer
 ld (buf_ptr),de
 inc de
 ld a,(length)
 inc a
 cp 4
 jp z,done
 ld (length),a
 jp input
jumptable:
 .db 'A','B','C','D','E','F','G','H','I','J','K','L','M'
 .db 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
done:
 call _clrlcdfull
 ld hl,0*256+0
 ld (pencol),hl
 ld hl,(buf_ptr)
 call _puts
 ret
buf_ptr:
 .db 0



.end
END


how would i make it not do what it is doing?
You need to pad buf_ptr out to the maximum allowed length of what the user may enter +1. (so if you can enter up to 20 letters, make buf_ptr 21 bytes.
so change buf_ptr to

buf_ptr:
.db 0,0,0

since the length is three
You missed where he said "...+1":


Code:
buf_ptr:
     .db 0,0,0,0
I changed it and i still got the same error in my above post's screen shot.
You aren't keeping track of which register is pointing where. For example:


Code:
 ld de,jumptable
 add hl,de
 ld a,(hl)
 call _putc
 ld (de),a
 ld de,buffer
 ld (buf_ptr),de


The 'ld (de),a' is writing to the jumptable, which you definitely don't want to be doing (and is redundant, as you are overwriting the jumptable's value with what was already there). Then, after that, you are writing the value of textshadow to your buf_ptr - againt, I don't think this is what you want to be doing (just store a to buf_ptr) You then proceed to 'inc de' for as far as I can see absolutely no reason whatsoever, as you just destroy DE later on down the line without saving its value (which is pointing to textshadow at the moment, not buf_ptr)
i recently upgraded to an 84+ SE and was wondering if asm on it is the same as 83+ asm.
Yes, it is. There are a few extra ports as compared to 83+, but all 83+ programs should work on the 84+
if its z80, I would believe all the commands are the same. But I get stumped as to why TIcalc.org would have multiple categories for ASM programs on z80 calcs. This is what I think, more than likely wrong. =P
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
» View previous topic :: View next topic  
Page 6 of 8
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement