# openMSX TCL Scripting Corner

Execute this TLC script from within the console. Next start the basic program This will allow you to control openMSX with Basic.

TCL code

```proc openmsxcontrol {} {
#scaler factor
if {[peek 0xc000]==1} {set ::scale_factor 1}
if {[peek 0xc000]==2} {set ::scale_factor 2}
if {[peek 0xc000]==3} {set ::scale_factor 3}
#Scaler Algotithm
if {[peek 0xc001]==1} {set ::scale_algorithm simple}
if {[peek 0xc001]==2} {set ::scale_algorithm Sai}
if {[peek 0xc001]==3} {set ::scale_algorithm ScaleNx}
if {[peek 0xc001]==4} {set ::scale_algorithm hq}
if {[peek 0xc001]==5} {set ::scale_algorithm hqlite}
#scanline
set ::scanline [peek 0xc002]

after time 1 openmsxcontrol
}```

Basic Code

```10 screen0:width80:keyoff:cls
11 s=0
15 ?"Scaler Factor     "
20 ?"[1] Scale Factor 1"
30 ?"[2] Scale Factor 2"
40 ?"[3] Scale Factor 3"
50 ?"------------------"
55 ?"Scaler Algorithm  "
60 ?"[Q] Simple        "
70 ?"[W] Sai	       "
80 ?"[E] ScaleNx       "
90 ?"[R] HQ	       "
95 ?"[T] HQLite        "
96 ?"------------------"
97 ?"[+] More Scanlines"
98 ?"[-] Less Scanlines"
100 a\$=inkey\$
101 if a\$="1" then poke &hc000,1
102 if a\$="2" then poke &hc000,2
103 if a\$="3" then poke &hc000,3
104 rem renderers
105 if a\$="q" then poke &hc001,1
106 if a\$="w" then poke &hc001,2
107 if a\$="e" then poke &hc001,3
108 if a\$="r" then poke &hc001,4
109 if a\$="t" then poke &hc001,5
110 if a\$="+" then s=s+1
111 if a\$="-" then s=s-1
112 if s>100 then s=100
113 if s<0 then s=0
114 poke &hc002,s
210 if a\$=chr\$(32) then end
211 goto 100
```