User Tools

Site Tools


inserting_20characters_20into_20the_20keyboard_20buffer

Inserting characters into the keyboard buffer

by Richard Russell, July 2006

On the BBC Microcomputer and some other Acorn computers you could insert a character into the keyboard buffer using the *FX 138 command. For example the following code would insert the character “R” (CHR$82) into the keyboard buffer:

      *FX138,0,82

BBC BASIC for Windows doesn't have a directly equivalent command, but you can achieve the same effect using the following procedure:

      DEF PROCfx138(C%)
      WM_CHAR = 258
      SYS "PostMessage", @hwnd%, WM_CHAR, C%, 0
      ENDPROC

The equivalent procedure for BBC BASIC for SDL 2.0 is as follows:

      DEF PROCfx138(C%)
      LOCAL ev{} : DIM ev{type%,stamp%,winid%,text&(1)}
      ev.type% = &303 : ev.text&(0) = C% : SYS "SDL_PushEvent", ev{}
      ENDPROC

So to insert the character “R” into the keyboard buffer you would do:

      PROCfx138(82)

or, equivalently,

      PROCfx138(ASC("R"))
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
inserting_20characters_20into_20the_20keyboard_20buffer.txt · Last modified: 2024/01/05 00:22 by 127.0.0.1