Dr_Acula
Experienced Member
Peter Schorn has kindly given two code examples for running the SIMH simulator. The first (above) talks to the SIMH from within vb.net via Telnet. The second method opens the SIMH in a dos window and runs a batch file which can include instructions such as change a drive or run a file. This is even faster and is particularly useful for debugging code.
Speed tests on compiling a 228 line program with one keypress from within vb.net:
Copy to a real CP/M board at 4Mhz and compile = 4 seconds for xmodem transfer and 60 seconds to compile.
On the SIMH via Telnet then sending to a real board and running = 8 seconds.
On the SIMH using the code below as a batch file = 3 seconds.
The trick is to create some small text files first and then shell the SIMH to run those files. This is the code in vb.net
Speed tests on compiling a 228 line program with one keypress from within vb.net:
Copy to a real CP/M board at 4Mhz and compile = 4 seconds for xmodem transfer and 60 seconds to compile.
On the SIMH via Telnet then sending to a real board and running = 8 seconds.
On the SIMH using the code below as a batch file = 3 seconds.
The trick is to create some small text files first and then shell the SIMH to run those files. This is the code in vb.net
Code:
' compile using SIMH but leave the SIMH window open, and don't send to N8VEM
Dim Location As New Process
Dim Filename1 As String 'eg MYFILE.BAS
FileOpen(1, "C:\N8VEM\AltairSIMH\SIM.BAT", OpenMode.Output) ' open a file
PrintLine(1, "altairZ80 sim_cmd")
FileClose(1)
' create the large simulation file
FileOpen(1, "C:\N8VEM\AltairSIMH\sim_cmd", OpenMode.Output) ' open a file
PrintLine(1, "d tracks[0-7] 254")
PrintLine(1, "attach dsk cpm2.dsk")
PrintLine(1, "attach dsk1 basic.dsk")
PrintLine(1, "attach dsk2 games.dsk")
PrintLine(1, "attach dsk3 sbasic.dsk")
PrintLine(1, "attach dsk4 supercalc.dsk")
PrintLine(1, "attach dsk5 tools.dsk")
PrintLine(1, "attach dsk6 wordstar.dsk")
PrintLine(1, "attach hdsk i.dsk")
PrintLine(1, "set cpu 64k")
PrintLine(1, "set cpu noitrap")
PrintLine(1, "set cpu z80")
PrintLine(1, "set cpu altairrom")
PrintLine(1, "set cpu nonbanked")
PrintLine(1, "Reset cpu ")
PrintLine(1, "set sio ansi")
PrintLine(1, "set sio nosleep")
PrintLine(1, "attach sio cpm_cmd") ' attach the little file below to run a batch
PrintLine(1, "boot dsk") ' will run till type HALT which runs HALT.COM
PrintLine(1, "bye")
FileClose(1)
' now create the file to compile
Filename1 = Strings.Left(SbasicFile, Len(SbasicFile) - 4) 'trim the .bas
FileCopy("C:\N8VEM\" + Filename1 + ".BAS", "C:\N8VEM\AltairSIMH\" + Filename1 + ".BAS")
FileOpen(1, "C:\N8VEM\AltairSIMH\cpm_cmd", OpenMode.Output) ' open a file
PrintLine(1, "D:") ' sbasic is on the D drive
PrintLine(1, "R " + Filename1 + ".BAS") ' read the file into the SIMH
PrintLine(1, "SBASIC " + Filename1) 'compile it
FileClose(1)
' shell the altair SIMH
Location.StartInfo.FileName = "SIM.BAT"
Location.StartInfo.WorkingDirectory = "C:\n8vem\AltairSIMH"
Location.Start() ' shell the batch file
Sleep(2000)
Kill("C:\N8VEM\AltairSIMH\" + Filename1 + ".BAS") ' clean up
Last edited: