[comp.sys.amiga] KeyMap problems

AXTBF%ALASKA.BITNET@cunyvm.cuny.edu (Tim Friest - programmer at large) (02/03/89)

I have been writing a Key Map Editor program and have had a problem with
guru visits saying corrupted memory list or memory trap.  I suspected that
the problem was with the actual keymap files so I added a check to display
the values for the undefined or reserved keycodes.

Though the memory addresses are meaningless on their own, I printed them out
because they should be close to eachother since a keymap is a single hunk
which is loadseged into memory.  Anyway, here is the output I got for
USA1 from the AmigaDOS 1.3 enhancer release

>KeyCode 78 should be undefined but is an illegal type
>KeyCode 79 should be undefined but is an illegal type
>KeyCode 7a should be undefined but is an illegal type
>KeyCode 7b should be undefined but is an illegal type
>KeyCode 7c should be undefined but is KCF_DEAD at address 670047
>KeyCode 7d should be undefined but is an illegal type
>KeyCode 7e should be undefined but is KCF_DEAD at address 70007
>KeyCode 7f should be undefined but is KCF_DEAD at address 870087

The types are from
  KeyMap->KeyMapType[KeyCode] & (KCF_STRING|KCF_DEAD|KCF_NOP)

My question: Aren't the undefined keycodes supposed to be KCF_NOP??  They are
everywhere except 78-7F....  If these values really aren't undefined, then
why are they KCF_DEAD (cdn had a KCF_STRING on keycode 7b) which point to
bogus memory locations?  Using a normal keymapping, 7c would map to roughly
alone (G), shift (NULL), alt (g), and shift+alt (NULL) which doesn't make
any sense either...

By the way, I hope to be posting this editor to the Net soon (it will be
shareware or freeware or maybe even PD), but I need to iron out the bugs.

The plug: If you are developing any software which uses a default
keyboard layout and you are not using keymaps, PLEASE do it right and use
the keymaps.  Honestly they are easier then typing in the matrix of values.
Even if you're not using default keymaps, you might consider creating one
and loading it in with a loadseg (really, that's all you do):

        bptr = LoadSeg("devs:keymaps/usa1");
        KeyMapNode = (struct KeyMapNode *)BADDR((bptr+1));

In my opinion, keymaps are one of the features that make the Amiga great...
I can use a dvorak keyboard if I want, or a french, german, british, etc.
Don't force me to use usa1 or usa0 unless I want to.

p.s. What does KCF_DOWNUP mean?

send replies to: AXTBF@ALASKA.BITNET

Disclaimer: My employer has been disclaiming me for years.  They certainly
            don't have any responsibility for what I do on my free time.

All opinions expressed are my own (and they should be yours too).

ditto@cbmvax.UUCP (Michael "Ford" Ditto) (02/03/89)

In article <7867@louie.udel.EDU> AXTBF%ALASKA.BITNET@cunyvm.cuny.edu (Tim Friest - programmer at large) writes:
>My question: Aren't the undefined keycodes supposed to be KCF_NOP??  They are
>everywhere except 78-7F....

The High Keymap is only 0x38 entries long; there are no entries for codes
78-7F.  The RKM is far from clear on this point, in fact it says
"The high keytype table covers the raw keycodes from hex 40-67, and
contains 38 (decimal) bytes."  It actually covers hex 40-77, and contains
38 (hex) bytes.

The HiCapsable and HiRepeatable arrays also cover only 0x40 through x077,
so they are 7 bytes long each.
-- 
					-=] Ford [=-

"The number of Unix installations	(In Real Life:  Mike Ditto)
has grown to 10, with more expected."	ford@kenobi.cts.com
- The Unix Programmer's Manual,		...!sdcsvax!crash!elgar!ford
  2nd Edition, June, 1972.		ditto@cbmvax.commodore.com

eric@cbmvax.UUCP (Eric Cotton) (02/03/89)

In article <7867@louie.udel.EDU> AXTBF%ALASKA.BITNET@cunyvm.cuny.edu (Tim Friest - programmer at large) writes:
>I have been writing a Key Map Editor program and have had a problem with
>guru visits saying corrupted memory list or memory trap.  I suspected that
>the problem was with the actual keymap files so I added a check to display
>the values for the undefined or reserved keycodes.
>
>Though the memory addresses are meaningless on their own, I printed them out
>because they should be close to eachother since a keymap is a single hunk
>which is loadseged into memory.  Anyway, here is the output I got for
>USA1 from the AmigaDOS 1.3 enhancer release
>
>>KeyCode 78 should be undefined but is an illegal type
>>KeyCode 79 should be undefined but is an illegal type
>>KeyCode 7a should be undefined but is an illegal type
>>KeyCode 7b should be undefined but is an illegal type
>>KeyCode 7c should be undefined but is KCF_DEAD at address 670047
>>KeyCode 7d should be undefined but is an illegal type
>>KeyCode 7e should be undefined but is KCF_DEAD at address 70007
>>KeyCode 7f should be undefined but is KCF_DEAD at address 870087
>
>The types are from
>  KeyMap->KeyMapType[KeyCode] & (KCF_STRING|KCF_DEAD|KCF_NOP)
           ^^^^^^^^^^
I assume you mean km_LoKeyMapTypes and km_HiKeyMapTypes (two separate
pointers for the the low map, and high map, respectively.

>My question: Aren't the undefined keycodes supposed to be KCF_NOP??  They are
>everywhere except 78-7F....  If these values really aren't undefined, then
>why are they KCF_DEAD (cdn had a KCF_STRING on keycode 7b) which point to
>bogus memory locations?  Using a normal keymapping, 7c would map to roughly
>alone (G), shift (NULL), alt (g), and shift+alt (NULL) which doesn't make
>any sense either...

The keycodes are only defined for $00 to $77, inclusive.  There are no
codes $78 to $7F.  The values you found for $78 to $7F were probably either
the start of the LoKeyMap or maybe the start of the dead-key data.
-- 
Eric Cotton
Commodore-Amiga                                               (215) 431-9100
1200 Wilson Drive                        {uunet|pyramid|rutgers}!cbmvax!eric
West Chester, PA 19380            "I don't find this stuff amusing anymore."

ruslan@ecsvax.uncecs.edu (Robin C. LaPasha) (02/04/89)

In article <7867@louie.udel.EDU>, AXTBF%ALASKA.BITNET@cunyvm.cuny.edu (Tim Friest - programmer at large) writes:
> I have been writing a Key Map Editor program and have had a problem with
> guru visits saying corrupted memory list or memory trap.  I suspected that
[...]
> 
> By the way, I hope to be posting this editor to the Net soon (it will be
> shareware or freeware or maybe even PD), but I need to iron out the bugs.
> 
Not to deter you in the least, but you might want to take a look at
2 keymap editors already out:
	Setkey, released to PD by Charles Carter.  Easy to use
once you figure stuff out (like, uh, remembering to enter stuff
with a return ;^)).  No dead key support.  Reported to be buggy
or otherwise with problems on A500s and A2000s.
	Edimap (I forget the author), posted on the net a few
months back.  Commands in French, but obvious enough.  Dead keys
are supported (although I crashed consistently if I clicked on
the "dead" button without selecting a key first.  Maybe a sick
joke? ;^))
	(There's also Keybird, in Basic, on some Amicus disk
or whatever, but I've never gotten it to run and don't know what
it's like.)
> The plug: If you are developing any software which uses a default
> keyboard layout and you are not using keymaps, PLEASE do it right and use
> the keymaps.  Honestly they are easier then typing in the matrix of values.
[...]
> In my opinion, keymaps are one of the features that make the Amiga great...
> I can use a dvorak keyboard if I want, or a french, german, british, etc.
> Don't force me to use usa1 or usa0 unless I want to.
> 
Hear, hear! I second that.  What's more, I'll flame whatever
WP products I see that don't let me use them properly (excellence!
being a prime example of such idiocy.)  Remember to support ALL
of the keyboard, too - there are high bits in them thar maps that
some of us need.
> 

-- 
=-=-=-=-=-=-=-
Robin LaPasha               |Deep-Six your
ruslan@ecsvax.uncecs.edu    |files with VI! ;^) ;^) ;^)

kodiak@amiga.UUCP (Robert R. Burns) (02/04/89)

In article ditto@cbmvax.UUCP (Michael "Ford" Ditto) writes:
)The High Keymap is only 0x38 entries long; there are no entries for codes
)78-7F.  The RKM is far from clear on this point, in fact it says
)"The high keytype table covers the raw keycodes from hex 40-67, and
)contains 38 (decimal) bytes."  It actually covers hex 40-77, and contains
)38 (hex) bytes.

The confusion in the RKM probably stems from the fact that:
    1.  the keyboard device keeps a bit array of the up/down state of all
	keys in an array big enough to hold all the codes actually
	generated by the keyboard: i.e. 0x00-0x67.
    2.  the input device and keymap resource deal with keymaps which, in
	two sets of tables, cover the range 0x00-0x77.

Hopefully, y'all have been un-confused by Ford & Cotton.
-- 
Bob Burns, amiga!kodiak                   _
| /_  _|. _ |      Commodore __          |_) _ |_  _ )'
|<(_)(_)|(_\|<      /\ |  ||| _` /\      |_)(_\| )(_\ |
| \ Software    ___/..\|\/|||__|/..\___           Faith