home *** CD-ROM | disk | FTP | other *** search
-
- set Program(Name) "UAE"
- set Program(Version) "0.4"
-
- wm title . "$Program(Name)"
- wm iconname . $Program(Name)
- wm grid . 1 1 1 1
-
- proc Bye {} {
- global outpipe
- puts $outpipe "bye"
- flush $outpipe
- close $outpipe
- exit
- }
-
- proc Eject {num} {
- global outpipe
- puts $outpipe "eject"
- puts $outpipe "$num"
- flush $outpipe
- }
-
- proc Nuke {} {
- global outpipe
- puts $outpipe "reset"
- flush $outpipe
- }
-
- proc Dbug {} {
- global outpipe
- puts $outpipe "debug"
- flush $outpipe
- }
-
- proc FilenameDialog {w title label} {
- global win
- global oldFocus
- global ReturnValue
-
- set win $w
- catch {destroy $win}
- toplevel $win -class Dialog
- wm title $win $title
- frame $win.top -relief raised -bd 1
- pack $win.top -side top -fill both
- frame $win.bot -relief raised -bd 1
- pack $win.bot -side bottom -fill both
-
- message $win.top.message -text $label \
- -width 3i -justify left
-
- entry $win.top.entry -width 20 -relief sunken
- $win.top.entry icursor 0
- bind $win.top.entry <Return> {
- set ReturnValue [$win.top.entry get]
- catch {focus $oldFocus}
- destroy $win
- }
-
- ## Create the OK and Cancel button field
- frame $win.bot.buttons
- button $win.bot.buttons.ok -text "Okay" \
- -command { set ReturnValue [$win.top.entry get]
- catch {focus $oldFocus}
- destroy $win
- }
- button $win.bot.buttons.cancel -text "Cancel" \
- -command { set ReturnValue "";
- catch {focus $oldFocus}
- destroy $win
- }
- pack $win.bot.buttons.ok -side left -expand 1 -padx 3m -pady 2m
- pack $win.bot.buttons.cancel -side right -expand 1 -padx 3m -pady 2m
-
- pack $win.top.message -side top -fill x -pady 4 -padx 4
- pack $win.top.entry -side top -fill x -pady 4 -padx 4
- pack $win.bot.buttons -side top -fill x -pady 4
-
- set oldFocus [focus]
- grab $w
- tkwait visibility $win
- focus $win.top.entry
- tkwait window $win
- return $ReturnValue
- }
-
-
- proc Insert {num} {
- global outpipe
- global inpipe
- puts $outpipe "insert"
- puts $outpipe "$num"
- flush $outpipe
- set isok [gets $inpipe]
- if {[string compare $isok "ok"] == 0} {
- set filename [FilenameDialog .foo "Select file" "Select a diskfile for drive $num"]
- puts $outpipe $filename
- flush $outpipe
- } else {
- tk_dialog .foo {Error} {Drive is not empty. Use Eject first.} {} 0 OK
- }
-
- }
-
- proc readdata {} {
- global inpipe
- global file0
- global file1
- global file2
- global file3
-
- set command [gets $inpipe]
- if {[string compare $command "power 0"] == 0} {
- .brs.powerled config -bg #000000000000
- } elseif {[string compare $command "power 1"] == 0} {
- .brs.powerled config -bg #ffff00000000
- } elseif {[string compare $command "driveled 1"] == 0} {
- set command [gets $inpipe]
- .drives.x$command.led config -bg #ffffffff0000
- } elseif {[string compare $command "driveled 0"] == 0} {
- set command [gets $inpipe]
- .drives.x$command.led config -bg #000000000000
- } elseif {[string compare $command "drivename"] == 0} {
- set number [gets $inpipe]
- set file$number [gets $inpipe]
- }
- }
-
- proc OpenPipes {} {
- global env
- global outpipe
- global inpipe
- set args $env(ARGS)
-
- if {[llength $args] != 2} {
- exit
- }
- set outpipe [open [lindex $args 0] "w"]
- set inpipe [open [lindex $args 1] "r"]
- puts $outpipe "Startup"
- flush $outpipe
- }
-
- frame .drives -relief raised -borderwidth 2
- label .drives.title -text "Floppy drives"
- frame .drives.x3 -relief sunken -borderwidth 2
- label .drives.x3.name -text "DF3:"
- frame .drives.x3.f
- label .drives.x3.f.file -width 30 -textvariable file3
- button .drives.x3.eject -text "Eject" -command {Eject 3}
- button .drives.x3.insert -text "Insert" -command {Insert 3}
- frame .drives.x3.led -width 1c -height .3c -relief groove -borderwidth 2 -background #000000000000
- pack .drives.x3 -side bottom -expand yes -fill both
- pack .drives.x3.name -side left
- pack .drives.x3.f -side left
- pack .drives.x3.f.file -side left
- pack .drives.x3.eject -side left
- pack .drives.x3.insert -side left
- pack .drives.x3.led -side left
-
- frame .drives.x2 -relief sunken -borderwidth 2
- label .drives.x2.name -text "DF2:"
- frame .drives.x2.f
- label .drives.x2.f.file -width 30 -textvariable file2
- button .drives.x2.eject -text "Eject" -command {Eject 2}
- button .drives.x2.insert -text "Insert" -command {Insert 2}
- frame .drives.x2.led -width 1c -height .3c -relief groove -borderwidth 2 -background #000000000000
- pack .drives.x2 -side bottom -expand yes -fill both
- pack .drives.x2.name -side left
- pack .drives.x2.f -side left
- pack .drives.x2.f.file -side left
- pack .drives.x2.eject -side left
- pack .drives.x2.insert -side left
- pack .drives.x2.led -side left
-
- frame .drives.x1 -relief sunken -borderwidth 2
- label .drives.x1.name -text "DF1:"
- frame .drives.x1.f
- label .drives.x1.f.file -width 30 -textvariable file1
- button .drives.x1.eject -text "Eject" -command {Eject 1}
- button .drives.x1.insert -text "Insert" -command {Insert 1}
- frame .drives.x1.led -width 1c -height .3c -relief groove -borderwidth 2 -background #000000000000
- pack .drives.x1 -side bottom -expand yes -fill both
- pack .drives.x1.name -side left
- pack .drives.x1.f -side left
- pack .drives.x1.f.file -side left
- pack .drives.x1.eject -side left
- pack .drives.x1.insert -side left
- pack .drives.x1.led -side left
-
- frame .drives.x0 -relief sunken -borderwidth 2
- label .drives.x0.name -text "DF0:"
- frame .drives.x0.f
- label .drives.x0.f.file -width 30 -textvariable file0
- button .drives.x0.eject -text "Eject" -command {Eject 0}
- button .drives.x0.insert -text "Insert" -command {Insert 0}
- frame .drives.x0.led -width 1c -height .3c -relief groove -borderwidth 2 -background #000000000000
- pack .drives.x0 -side bottom -expand yes -fill both
- pack .drives.x0.name -side left
- pack .drives.x0.f -side left
- pack .drives.x0.f.file -side left
- pack .drives.x0.eject -side left
- pack .drives.x0.insert -side left
- pack .drives.x0.led -side left
-
- pack .drives.title -side top
-
- frame .brs -relief raised -borderwidth 2
- label .brs.title -text "Emulator control"
- frame .brs.powerled -width 1c -height .3c -relief groove -borderwidth 2 -background #ffff00000000
- button .brs.reset -text "Hard reset" -command { Nuke }
- button .brs.debug -text "Debug" -command { Dbug }
- button .brs.quit -text "Exit" -command { Bye }
- pack .brs.title -side top
- pack .brs.reset -side left
- pack .brs.debug -side left
- pack .brs.quit -side left
- pack .brs.powerled -side right
-
- pack .drives -side bottom -fill x
- pack .brs -side bottom -fill x
- .brs.powerled config -bg #000000000000
- OpenPipes
- fileevent $inpipe readable {readdata}
-