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 > cursor-control.
2003-04-04 07:16
Testicle
Account closed

Registered: Sep 2002
Posts: 131
cursor-control.

well, for a diskmag-system i want the user to be able to use both joystick and/or cursor-keys to choose chapters.

joystick is no problem, but then i tried to implement the cursor-function:

.keyboard lda $c5
cmp #7
beq .leftright
cmp #2
beq .updown
cmp #1
beq .jfire
rts
.leftright lda $028d
and #1
bne .jleft
jmp .jright
.updown lda $028d
and #1
bne .jup
jmp .jdown


first i used this function during the irq, but it didn't work. now i use this function beside my irq-routines, but nothing happens.

do i have to set special registers to get access to the cursor-keys or something like that?!?
2003-04-04 07:34
Oswald

Registered: Apr 2002
Posts: 5126
I always used the kernal to read the keyboard for such stuff.. there are 2 routines for that

- scnkey: you must call this one from your irq routine, this one scans the keyboard for pressed keys

- getin: and this one gives you the petscii codes of the pressed keys

so it will look like this

irq:
blah
...
jsr scnkey
...
blah

main prog:

jsr getin
cmp #"<crsr left>"
beq left
cmp #"<crsr up>"
beq up
...
etc

its the same as in basic :) you dont have to check for shift seperately.
2003-04-04 10:27
yago

Registered: May 2002
Posts: 333
The getin method is new to me (and a good Idea).

If you want to use the commodore keyboard read,
you need to end one of your irqs with
JMP $EA31

The other irqs should be ended with
JMP $EA81

Please note that the kernel must be switched in, so you need to change irq-vector at $314 instead of $fffe.

Have Fun,
Zed Yago
PS: Please correct me, if sth is wrong, written out of my head!
2003-04-04 11:12
Krill

Registered: Apr 2002
Posts: 3083
If i have to only check some keys for cursor control, i never use the kernel. Direct access of the key matrix is faster and it doesnt interfere with joy 1 input like the kernel input routine does due to poor coding. There is a way to have keyboard, joy 1 and joy 2 input simultaneously, if you use the data direction registers wisely (basically, put the negated $dc00 value to $dc02) to prevent joy 1 from interfering with the keyboard input.
2003-04-04 15:20
Testicle
Account closed

Registered: Sep 2002
Posts: 131
ah, jmp $ea31 solves my problem! :-)


usually i use either $ea7e or $ea81 to end my raster-irq, but i actually never knew the differences.

can somebody tell me?


and: when is it useful to use $fffe/$ffff as irq-vectors?
2003-04-04 15:37
cadaver

Registered: Feb 2002
Posts: 1163
When you want to use RAM behind Kernal, or want to save CPU cycles.
2003-04-04 16:11
Krill

Registered: Apr 2002
Posts: 3083
Quote: ah, jmp $ea31 solves my problem! :-)


usually i use either $ea7e or $ea81 to end my raster-irq, but i actually never knew the differences.

can somebody tell me?


and: when is it useful to use $fffe/$ffff as irq-vectors?


A look into the kernel using a monitor usually helps answering those questions... :b and the kernel is for weenies... *states* ;)
2003-04-05 15:21
yago

Registered: May 2002
Posts: 333
Quote: A look into the kernel using a monitor usually helps answering those questions... :b and the kernel is for weenies... *states* ;)

There are also some excellent Books about the cbm-kernel, which explain the routines and zp-addresses.
I agree, IMHO nowaday PC-Demos are not "real" Demos, because they use DirectX etc.
2003-04-07 06:00
Seven

Registered: Jan 2002
Posts: 202
yeah! and they use C instead of assembly! damn them!
2003-04-07 07:58
Oswald

Registered: Apr 2002
Posts: 5126
krill: oh well, then Im a weenie :)) but why would I sit down and code a keyboard scan routine, if its just about 2 jsr ? :)

$ea31 will call several kernal routines, cursor blinking, scnkey and the likes..

$ea81 is just: pla tay pla tax pla rti
$ea7e is a bit better with lda $dc0d in front of the earlier :)
2003-04-07 08:17
Testicle
Account closed

Registered: Sep 2002
Posts: 131
@Oswald: yes, i looked at the kernel and saw the differences. now i've got another question: is it necessary to end a raster-irq-routine with jmp $ea7e (or whatever) or can i directly use "rti" instead? i'm not sure, if the three missing pla's (from jmp $ea7e/81) would do any harm?

well, ofcourse i could give it (the "rti" i mean) a try, but then i would probably not know, if it really works or if it was just pure chance that nothing went wrong...
 
... 18 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - 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
iAN CooG/HVSC
Scrap/Genesis Project
JEZ
Enforcer/Deers
Didi/Laxity
master_hacker
Guests online: 219
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.6)
5 Coma Light 13  (9.6)
6 Edge of Disgrace  (9.6)
7 Signal Carnival  (9.6)
8 Uncensored  (9.5)
9 Wonderland XIV  (9.5)
10 No Bounds  (9.5)
Top onefile Demos
1 Nine  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Artline Designs  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Performers  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Serato  (9.9)
2 Axis  (9.8)
3 Sailor  (9.8)
4 Graham  (9.8)
5 Lft  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.06 sec.