83Plus:RAM:8442

From WikiTI
Revision as of 07:42, 28 April 2011 by Zeda (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Synopsis

Unofficial Name: KeyDelay

Memory Address: 8442h

Length: 1 byte

This byte of RAM handles the delay between key presses. It is at 50 (or 32h) until you press a key. It then counts down to 0 while you hold the key. If the key is a repeating key (del or the arrows), it resets to 10 and then counts back down.

If used in a hook, you can modify the repeating speeds of keys as well as make all keys repeat.

Examples

Change Delay Speed

The following code will change the delay and repeat speed of keys. 'Delay' and 'Repeat' need to be defined.

 SetKeyHook:
        in a,(6)                   ;To obtain the page the hook is on (if it is on the same page)
        ld hl,KeyHook
        B_CALL _EnableRawKeyHook
        ret
KeyHook:
        .db 83h
        ld b,a
        ld hl,8442h
        ld a,(hl)
        cp 32h
        jr c,NotDelay
          ld a,Delay        ;Change this to a number less than 50 to change the initial delay
          ld (hl),a
          ld a,b
          ret
NotDelay:
        cp 0Ah
        jr nz,NotRepeat
          ld a,Repeat      ;Change this to a number less than 10 to change the repeat speed
          ld (hl),a
NotRepeat
        ld a,b
        ret

Comments

There are several bytes following and preceding this that are similar.