| |
Ejner
Registered: Oct 2012 Posts: 43 |
HELP with two inputs, please
Hey, this is really lame, but....
I need to make two "Input"s after each other, but the first one cancels the other one out...
jsr $ffcf
jsr $ffcf
rts
I tried making a pause-loop between the two inputs, so I'm sure I'm not touching any keys during the second input.
I also tried erasing the keyboard buffer in $c6.
What am I missing / doing wrong? |
|
... 1 post hidden. Click here to view all posts.... |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Well, the inputted char will be stored in the A-reg after a call to ffcf. You need to store that away from a otherwize the next jsr will overwrite it:
Read2chars:
Jsr $ffcf
Sta input+0
Jsr $ffcf
Sta input+1
Rts
input: .byte 0,0 |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Guess i misunderstood what u were asking... ;) |
| |
Ejner
Registered: Oct 2012 Posts: 43 |
Yeah, well...
My example is taken completely out of it's context, leaving only the bug... So quite impossible to see what is intended :-)
But thanks anyway :-) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
at this point someone should say: make sure to test it on the real thing - keyboard input works considerably different on emulators. |
| |
Ejner
Registered: Oct 2012 Posts: 43 |
Note taken :-)
And I'm using TurboAssembler on real Hardware. :-)
But for future projects it's good to know that real hardware and emulators may work differently around keybd input.
However, in this case, the "BASIC input"-jsr's will not be used in the final product anyway, since I only need the stored data from my inputs (not just two, but around 100+, actually) :-)
/ejner |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Those are not "basic" inputs. Those are single char inputs using the screen editor (as default).
Normal usage for your case would be:
jsr input
input:
lp: jsr $ffcf
cmp #13
bne lp
rts |
| |
Ejner
Registered: Oct 2012 Posts: 43 |
Yes, I think that is correct... And I think you can set $d0 to specify either single-char-input or a full screen-edit-input ??
I need full screen-edit-inputs. I think that's what went wrong at my first attempts, the $d0 changed from full screen-edit-input to single-char-input after my first $ffcf call... So I need to set it back to full screen-edit each time...
/ejner |
| |
Urban Space Cowboy
Registered: Nov 2004 Posts: 45 |
Quoting EjnerAnd I think you can set $d0 to specify either single-char-input or a full screen-edit-input ?? You can, but that's really abusing system internals to accomplish whatever you're on about. It's better to call GETIN ($ffe4) to get individual keypresses. If you want to read an input line and your program isn't worth putting in your own input routines, try calling INLIN ($a560), which reads an input line into the buffer starting at $0200. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
for GETIN to work, the kernal IRQ has to be running tho, as it needs SCNKEY - which the kernal irq calls - to read the keyboard.
if you have replaced the kernal irq, you can call scnkey for yourself, but make sure to not destray any ram it might need to work correctly (zp, or other lowmem kernal stuff) |
| |
goerp
Registered: Feb 2006 Posts: 21 |
I stumbled upon this question by accident, but it will help with my problem as well. Thank you all. |
Previous - 1 | 2 - Next |