BBC keyscan routine

reminisce about bbc micro & electron games like chuckie egg, repton, elite & exile

Related forum: adventures


User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

BBC keyscan routine

Postby oss003 » Wed May 31, 2017 5:47 pm

Hi guys,

can somebody please explain what the keycodes are in this keyscan routine because I can't find any documentation about this:

Code: Select all

;--------------------------------------------
; Key check routine
;
; A = keycode to check, on return A= #80 is pressed
;--------------------------------------------

L0C83:      sei

            ldx #$03               ; Stop autoscan
            stx LFE40
            ldx #$7F               ; PA0-6 output
            stx LFE43

            sta LFE4F              ; Key to read
            lda LFE4F              ; #80 if key pressed

            php
            ldx #$0B
            stx LFE40
            plp

            cli           
            rts       

Thanks.....

Greetings
Kees

User avatar
hoglet
Posts: 6372
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: BBC keyscan routine

Postby hoglet » Wed May 31, 2017 5:53 pm

Probably internal key numbers:
http://stardot.org.uk/mirrors/www.bbcdo ... f#page=142

That just a guess....

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: BBC keyscan routine

Postby oss003 » Wed May 31, 2017 6:01 pm

In the game these keycodes are checked: #B7, #C2, #C7, #C8, #C9, #E1, #E8 but they don't correspont with the User Guide.

Greetings
Kees

User avatar
hoglet
Posts: 6372
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: BBC keyscan routine

Postby hoglet » Wed May 31, 2017 6:07 pm

OK, I've engaged my brain now.

The code is directly driving the BBC keyboard matrix:
http://mdfs.net/Info/Comp/BBC/Circuits/BBC/bbckbd.gif

So #B7 (1-011-0111) is checking row 3, column 7 which looks like "P" to me.

This is actually the internal key number, but with bit 7 set to '1'.

#B7 = #80 + #37 = P
#C2 = #80 + #42 = X
#C7 = #80 + #47 = @
#C8 = #80 + #48 = :
#C9 = #80 + #49 = Return
#E1 = #80 + #61 = Z
#E8 = #80 + #68 = /

Do those match?

Dave

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: BBC keyscan routine

Postby oss003 » Wed May 31, 2017 6:11 pm

Yep, found it also:

#B7 = P
#C2 = X
#C7 = @
#C8 = *
#C9 = RET
#E1 = Z
#E8 = ?

Damn ... you're fast ........ :shock:

Thanks .... =D>

Greetings
Kees

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: BBC keyscan routine

Postby tricky » Wed May 31, 2017 8:32 pm

Since DDR is set to rwwwwwww, the top bit is not used, also, seems to be a bit of a slow way to also return the result in N.

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: BBC keyscan routine

Postby oss003 » Wed May 31, 2017 8:53 pm

The top bit is used as checkbit, &FE4F reads &80 back if the key is pressed.

Greetings
Kees

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: BBC keyscan routine

Postby tricky » Wed May 31, 2017 9:44 pm

I meant the top bits that are written.


Return to “software: classic games”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests