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.
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:
you have to remember that i am doing this on a regular 83
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
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:
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.
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:
how would i make it not do what it is doing?
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.
You aren't keeping track of which register is pointing where. For example:
Code:
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)
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)
Yes, it is. There are a few extra ports as compared to 83+, but all 83+ programs should work on the 84+
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
» Go to Registration page
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
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