User Tools

Site Tools


inserting_20characters_20into_20the_20keyboard_20buffer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
inserting_20characters_20into_20the_20keyboard_20buffer [2018/04/16 14:18] – Added syntax highlighting richardrussellinserting_20characters_20into_20the_20keyboard_20buffer [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 3: Line 3:
 //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: //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+<code> 
 +      *FX138,0,82 
 +</code>
  
 //BBC BASIC for Windows// doesn't have a directly equivalent command, but you can achieve the same effect using the following procedure: //BBC BASIC for Windows// doesn't have a directly equivalent command, but you can achieve the same effect using the following procedure:
  
 <code bb4w> <code bb4w>
-        DEF PROCfx138(C%) +      DEF PROCfx138(C%) 
-        WM_CHAR = 258 +      WM_CHAR = 258 
-        SYS "PostMessage", @hwnd%, WM_CHAR, C%, 0 +      SYS "PostMessage", @hwnd%, WM_CHAR, C%, 0 
-        ENDPROC+      ENDPROC 
 +</code> 
 + 
 +The equivalent procedure for //BBC BASIC for SDL 2.0// is as follows: 
 + 
 +<code bb4w> 
 +      DEF PROCfx138(C%) 
 +      LOCAL ev{} : DIM ev{type%,stamp%,winid%,text&(1)} 
 +      ev.type% = &303 : ev.text&(0) = C% : SYS "SDL_PushEvent", ev{} 
 +      ENDPROC
 </code>         </code>        
                  
Line 17: Line 28:
  
 <code bb4w> <code bb4w>
-        PROCfx138(82)+      PROCfx138(82)
 </code> </code>
  
Line 23: Line 34:
  
 <code bb4w> <code bb4w>
-        PROCfx138(ASC("R"))+      PROCfx138(ASC("R"))
 </code> </code>
inserting_20characters_20into_20the_20keyboard_20buffer.1523888331.txt.gz · Last modified: 2024/01/05 00:17 (external edit)