Post or discuss your openMSX TCL scripts here
by Vampier » 12-Apr-2008 21:31
- Code: Select all
catch { plug joyporta joystick1 }
catch { plug joyportb joystick2 }
set scanline 0
set blur 0
set scale_algorithm simple
set limitsprites off
#Read Keyboard Matrix in MSX basic
#
#10 DEFINT A-Z:K=&HFBE5:CLS
#11 print " 76543210"
#20 FOR I=0 TO 10:PRINT hex$(I)+" - " RIGHT$("0000000"+BIN$(PEEK(K+I)),8)+" - "+hex$(peek(k+i) xor 255):NEXT
#30 PRINT CHR$(11):GOTO 20
#
#Key Mapping base
#
#Buttons #Keys
#A = 0 #up = 8
#B = 1 #right = 9
#X = 2 #down = 10
#Y = 3 #left = 11
#Z = 4
#L = 5
#R = 6
#
#start = 7
#
#X (mapped to a cheat)
bind "joy1 button2 down" "trainer Space\ Manbow all"
#bind "joy1 button2 up" "trainer Space\ Manbow all"
#B (mapped to M Konami's 2nd button)
bind "joy1 button3 down" "keymatrixdown 4 0x04"
bind "joy1 button3 up" "keymatrixup 4 0x04"
#B (mapped to M Konami's 2nd button)
bind "joy1 button4 down" "next"
#L (mapped to F5)
bind "joy1 button5 down" "keymatrixdown 7 0x02"
bind "joy1 button5 up" "keymatrixup 7 0x02"
#R (mapped to Speed up)
bind "joy1 button6 down" "set throttle off"
bind "joy1 button6 up" "set throttle on"
#Start (mapped fo toggle pause)
bind "joy1 button7 down" "toggle pause"
#Start (mapped fo f1)
#bind "joy1 button7 down" "keymatrixdown 6 0x20"
#bind "joy1 button7 up" "keymatrixup 6 0x20"
#Up
bind "joy1 button8 down" "keymatrixdown 8 0x20"
bind "joy1 button8 up" "keymatrixup 8 0x20"
#Right
bind "joy1 button9 down" "keymatrixdown 8 0x80"
bind "joy1 button9 up" "keymatrixup 8 0x80"
#Down
bind "joy1 button10 down" "keymatrixdown 8 0x40"
bind "joy1 button10 up" "keymatrixup 8 0x40"
#Left
bind "joy1 button11 down" "keymatrixdown 8 0x10"
bind "joy1 button11 up" "keymatrixup 8 0x10"
#Get Files with 'Pattern' in the name
proc ls {pattern} {
return [glob -nocomplain $pattern]
}
#Loop Thourgh roms and display information (remove the path name)
proc next {} {
incr ::__rom
if {$::__rom>=$::__romlistElementes} {set ::__rom 0}
reset
carta eject
set file [lindex $::__romlist $::__rom]
carta insert $file
displayOSDText "Now running ROM ([expr $::__rom+1]/$::__romlistElementes): [string range $file [string length $::__path] end-4]"
}
#Display OSD information
proc displayOSDText {DisplayString} {
if {![info exists ::__osd_OSD_bg]} {
set ::__osd_OSD_bg [osd create rectangle bg -x 5 -y 23 -z 5 -w 630 -h 18 -rgb 0x002090]
set ::__osd_OSD_txt [osd create text OSDText -x 5 -y 25 -z 6 -size 10 -font skins/Vera.ttf.gz -rgb 0xffffff]
}
osd configure $::__osd_OSD_bg -alpha 190 -fadeTarget 0 -fadePeriod 5.0
osd configure $::__osd_OSD_txt -text $DisplayString -alpha 255 -fadeTarget 0 -fadePeriod 5.0
}
#global vars
set ::__path "C:/openMSX/GOODMSX2_0.999.2/"
set ::__rom 0
set ::__romlist [ls "$::__path*.rom"]
set ::__romlistElementes [llength $::__romlist]
#Insert the first rom
carta eject
carta [lindex $::__romlist $::__rom]
set file [lindex $::__romlist $::__rom]
displayOSDText "Now running ROM ([expr $::__rom+1]/$::__romlistElementes): [string range $file [string length $::__path] [expr [string length [lindex $::__romlist $::__rom]]-5] ]"
-
Vampier
- Site Admin
-
- Posts: 133
- Joined: 05-Feb-2005 23:26
- Location: Anaheim CA
-
Return to TCL script corner
Who is online
Users browsing this forum: No registered users and 1 guest