Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > HELP with two inputs, please
2013-10-02 16:41
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....
 
2013-10-02 19:34
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
2013-10-02 19:35
JackAsser

Registered: Jun 2002
Posts: 2014
Guess i misunderstood what u were asking... ;)
2013-10-02 19:51
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 :-)
2013-10-04 05:49
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.
2013-10-04 16:15
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
2013-10-04 16:42
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
2013-10-04 16:48
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
2013-10-09 08:14
Urban Space Cowboy

Registered: Nov 2004
Posts: 45
Quoting Ejner
And 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.
2013-10-09 09:58
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)
2013-10-09 18:19
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
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
csabanw
goto80/HT
DanPhillips
Peacemaker/CENSOR/Hi..
Holy Moses/Role
Guests online: 101
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.073 sec.