83Plus:RAM:8442

From WikiTI
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 a key is pressed. It then counts down to 0 while the key is being pressed. 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         ;keyDelay
        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.