Tcl for Embedded Applications

Home

Docs

Project Download Participate Tcl Conference Proc Place SourceForge Logo
Open Source Thanks Acterna

TinyTcl - DOS Interface Commands

Keyboard Functions

kbhit - returns 1 if a key has been hit, else 0

getkey - returns a key as an integer keycode. waits until a key has been pressed. (So use kbhit to see if one is there first, if you don't want to wait.)

Sound Function

sound frequency - start the sound playing a square wave at the specified frequency in hertz. If 0, stops the sound from playing.

Time, Date, Clock and Timer Functions

getdate - returns the current date as a list containing month, day, year.

setdate month day year -- set the current date to the specified month, day and year.

gettime - returns the current time as a list containing hours, minutes, and seconds.

settime hour minute second - Set the current time to the specified hour, minute and second.

rawclock - returns the raw clock value in ticks since the time the program started.

wait milliseconds - invokes the DOS delay call to delay (at least) the specified number of milliseconds.

Drive Functions

getverify - returns the operating system verify flag. If 0, writes are not being verified. If 1, they are.

drive [letter] -- set the drive to the specified drive letter.

Example: drive A

If the drive letter is not specified, the current drive is returned.

diskfree driveletter - returns a list containing the free kilobytes and the total kilobytes on the specified drive letter. This works OK in a DOS window but not on the handheld.

getfat driveletter - returns a list containing the FAT ID byte, sectors per cluster, number of clusters, and bytes per sector. Maximum size reportable is 2 GB. Disks over that (Windows) will report as 2 GB.

mkdir dir - create a directory.

unlink filename - Delete the specified file.

Memory Functions

memfree - returns the amount of RAM left on the system.

stackfree - returns the amount of stack left on the system

heapcheck - check the heap for corruption. If corruption is detected, the program panics, printing an error message and then exiting immediately.

DOS Screen Functions

cls - clear the screen

gotoxy x y - Address the cursor to the specified x and y location.

Execute Program Function

execvp command ?args? - Terminate the current process (Tcl) and run a new program in its place.

See also DOS video interface commands and BIOS interface commands.