<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 18 May 2014 09:12:30 -0500
From   : matt@... (Matt Godbolt)
Subject: JSBeeb

Hey all,

Coming in late to this discuss via the flyby CC, so apologies if I'm
not quite answering the questions posed!

Firstly, the keyboard handling in Javascript is a total mess! There's
no way to detect the keyboard layout of the computer and the codes
received are not quite physical keys but are something in-between.
For most keys it's a straight ASCII value, but then some keys have
random weird numbers (like the key 0xbd).  As I'm on a US laptop
keyboard, the keys are tailored for that.  I'm working on some
primitive locale-detection and then some different maps for UK and US
keyboards.

To the original point anyway, the BBC -/= key ought to be the _/-
laptop key (directly next to the zero key).  If that's not working for
you, it seems like I need even more complex mappings :) (it seems my
comment's wrong too, will fix that).

As Mark says, it's pretty easy to debug these things. If you want to
run a local development version of jsbeeb, download and unpack it,
then run a local webserver. I use Python's built-in webserver, simply
typing "python -mSimpleHTTPServer" from the jsbeeb directory and then
visiting localhost:8000.

Alternatively if you just want the keycodes, bring up a new web
browser, hit ctrl-shift J to get the javascript console up and type:

   window.onkeydown = function(e){ console.log(e.keyCode.toString(16)); };

Then click back into the main window and start pressing keys. That'll
give you what I see. For reference I see "bd" for the underscore key
on my US keyboard.

At the moment I'm working on adding Dropbox and Google Drive support
so you can save your disc images in the cloud, but I also have a
half-written "help" page about the keyboard mappings. Sounds like I
need to rethink that if other keyboards have different values (some
kind of reconfigurable setup?)

Cheers, Matt :)

- matt

On Sun, May 18, 2014@... AM, Mark Ashley <mark@...> wrote:
> Since the key mapping appears to be physical, it should be the same on all
> laptop/usb keyboards. All the Beeb emulators would be using the same
> keycodes.
>
> The image here:
> http://wallmobi.net/uploads/pictures/technology/36678-bbc-micro-model-b.jpg
> has the '-' and the '=' key being the same key. Just next to the 'zero'.
>
> The mapping from the BeebEm program in userkybd.cpp (full table is at the
> bottom) has that -/= key being '1,7', in jsbeeb the notation is the reverse
> of that so we're looking for 7,1 in the
> https://github.com/mattgodbolt/jsbeeb/blob/master/via.js file:
>
>   Line 391:      map('\xbd', 7, 1); // '_' / '=' mapped to underscore
>
> so that underscore mapping appears to be wrong? It should be minus and
> equals. It's a moot point anyway as it's (apparently) not triggering an
> event and inserting a key, nothing happens on screen when you press it!
>
> To debug it you'd need to download the git code and run it on a port per the
> instructions. Then do mapping debug prints to show what row/col/assumed key
> was pressed. I'm tired and drunk right now so better to CC Matt himself on
> this and ask what's happening :) All yours, Matt.
>
> Whilst on the topic, the mapping for the \ and | key is always giving a @,
> for unshifted and shifted.
>
> ta,
> Mark.
>
>
>
> Beebem keymapping table:
>
> Download at: http://beebem-unix.bbcmicro.com/download.html
> File beebem-0.0.13.tar.gz --> userkybd.cpp
>
> // Row,Col  Default values set to transTable1
> //--int UserKeymap[256][2]={
> //--    0,0,    0,0,    0,0,    0,0,   // 0
> //--    0,0,    0,0,    0,0,    0,0,   // 4
> //--    5,9,    6,0,    0,0,    0,0,   // 8 [BS][TAB]..
> //--    0,0,    4,9,    0,0,    0,0,   // 12 .RET..
> //--    0,0,    0,1,    0,0,    -2,-2, // 16 .CTRL.BREAK
> //--    4,0,    0,0,    0,0,    0,0,   // 20 CAPS...
> //--    0,0,    0,0,    0,0,    7,0,   // 24 ...ESC
> //--    0,0,    0,0,    0,0,    0,0,   // 28
> //--    6,2,    0,0,    0,0,    6,9,   // 32 SPACE..[End]
> //--    0,0,    1,9,    3,9,    7,9,   // 36 .[Left][Up][Right]
> //--    2,9,    0,0,    0,0,    -3,-3,   // 40 [Down]...
> //--    0,0,    0,0,    5,9,    0,0,   // 44 ..[DEL].
> //--    2,7,    3,0,    3,1,    1,1,   // 48 0123
> //--    1,2,    1,3,    3,4,    2,4,   // 52 4567
> //--    1,5,    2,6,    0,0,    0,0,   // 56 89
> //--    0,0,    0,0,    0,0,    0,0,   // 60
> //--    0,0,    4,1,    6,4,    5,2,   // 64.. ABC
> //--    3,2,    2,2,    4,3,    5,3,   // 68  DEFG
> //--    5,4,    2,5,    4,5,    4,6,   // 72  HIJK
> //--    5,6,    6,5,    5,5,    3,6,   // 76  LMNO
> //--    3,7,    1,0,    3,3,    5,1,   // 80  PQRS
> //--    2,3,    3,5,    6,3,    2,1,   // 84  TUVW
> //--    4,2,    4,4,    6,1,    0,0,   // 88  XYZ
> //--    0,0,    6,2,    0,0,    0,0,   // 92  . SPACE ..
> //--    0,0,    0,0,    0,0,    0,0,   // 96
> //--    0,0,    0,0,    0,0,    0,0,   // 100
> //--    0,0,    0,0,    0,0,    -4,0,  // 104 Keypad+
> //--    0,0,    -4,1,    0,0,    0,0,   // 108 Keypad-
> //--    7,1,    7,2,    7,3,    1,4,   // 112 F1 F2 F3 F4
> //--    7,4,    7,5,    1,6,    7,6,   // 116 F5 F6 F7 F8
> //--    7,7,    2,0,    2,0,    -2,-2, // 120 F9 F10 F11 F12
> //--    0,0,    0,0,    0,0,    0,0,   // 124
> //--    0,0,    0,0,    0,0,    0,0,   // 128
> //--    0,0,    0,0,    0,0,    0,0,   // 132
> //--    0,0,    0,0,    0,0,    0,0,   // 136
> //--    0,0,    0,0,    0,0,    0,0,   // 140
> //--    0,0,    0,0,    0,0,    0,0,   // 144
> //--    0,0,    0,0,    0,0,    0,0,   // 148
> //--    0,0,    0,0,    0,0,    0,0,   // 152
> //--    0,0,    0,0,    0,0,    0,0,   // 156
> //--    0,0,    0,0,    0,0,    0,0,   // 160
> //--    0,0,    0,0,    0,0,    0,0,   // 164
> //--    0,0,    0,0,    0,0,    0,0,   // 168
> //--    0,0,    0,0,    0,0,    0,0,   // 172
> //--    0,0,    0,0,    0,0,    0,0,   // 176
> //--    0,0,    0,0,    0,0,    0,0,   // 180
> //--    0,0,    0,0,    5,7,    1,8,   // 184  ..;
> //--    6,6,    1,7,    6,7,    6,8,   // 188  ,-./
> //--    4,8,    0,0,    0,0,    0,0,   // 192  @ ...
> //--    0,0,    0,0,    0,0,    0,0,   // 196
> //--    0,0,    0,0,    0,0,    0,0,   // 200
> //--    0,0,    0,0,    0,0,    0,0,   // 204
> //--    0,0,    0,0,    0,0,    0,0,   // 208
> //--    0,0,    0,0,    0,0,    0,0,   // 212
> //--    0,0,    0,0,    0,0,    3,8,   // 216 ...[
> //--    7,8,    5,8,    2,8,    4,7,   // 220 \]#`
> //--    0,0,    0,0,    0,0,    0,0,   // 224
> //--    0,0,    0,0,    0,0,    0,0,   // 228
> //--    0,0,    0,0,    0,0,    0,0,   // 232
> //--    0,0,    0,0,    0,0,    0,0,
> //--    0,0,    0,0,    0,0,    0,0,
> //--    0,0,    0,0,    0,0,    0,0,
> //--    0,0,    0,0,    0,0,    0,0,
> //--    0,0,    0,0,    0,0,    0,0
> //--};
>
>
> On Sun, May 18, 2014@... PM, Alan Williams <ajw@...> wrote:
>>
>> Has anybody found the minus key on a US ascii keyboard?
>> Alan
>>
>>
>> -----Original Message-----
>> From: bbc-micro-bounces+ajw=bigblue.net.au@...
>> [mailto:bbc-micro-bounces+ajw=bigblue.net.au@...] On Behalf
>> Of John Kortink
>> Sent: Friday, 16 May 2014 6:34 AM
>> To: bbc-micro@...
>> Subject: Re: [BBC-Micro] JSBeeb
>>
>>
>> On Thu, 15 May 2014 20:36:01 +0100, Jason Flynn G7OCD <flynnjs@...>
>> wrote:
>>
>> >On 15/05/2014 14:31, John Kortink wrote:
>> >> I stumbled on this a while back. It's quite amazing how you can do
>> >> this nowadays in a mere script language, and still get the required
>> >> speed.
>> >
>> >What amazes me more is:
>> >http://s-macke.github.io/jor1k/
>>
>> Yikes.
>>
>> As a machine, it's a little short on memory and clock speed though. ;-)
>>
>>
>> John Kortink
>>
>> --
>>
>> Email    : kortink@...
>> Homepage : http://www.inter.nl.net/users/J.Kortink
>>
>> GoSDC, the ultimate BBC B/Master/Electron storage system :
>> http://web.inter.nl.net/users/J.Kortink/home/hardware/gosdc
>>


-- 
Matt
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>