Chapter 10. Import and Export

In this chapter we will look at other ways to get data in and out of Kick Assembler.

10.1. Passing Command Line Arguments to the Script

From the command line you can assign string values to variables, which can be read from the script. This is done with the ‘:’ notation like this:

java –jar KickAss.jar mySource.asm :x=27 :sound=true :title=”Beta 2” 

The three variables x, sound and beta2 and their string values will now be placed in a hashtable that can be accessed by the global variable cmdLineVars:

.print “version =” + cmdLineVars.get(“version”)
.var x= cmdLineVars.get(“x”).asNumber()
.var y= 2*x
.var sound = cmdLineVars.get(”sound”).asBoolean()
.if (sound) jsr $1000