Ski IA-64 Simulator Reference Manual 1.0L

#Compute and print Fibonacci numbers from 1 to 50.

#Initialize variables

= r10

1

# Hold n-2’th value

= r11

1

# Hold n-1’th value

=

r12

0

# Temporary holding place for n-1’th value

=

r13

0

# Loop counter

#Print out first two Fibonacci numbers (initial values of r10 & r11) eval r10

eval r11

#Calculate and print the rest of the numbers. The last line has the

#stopping value of the loop index. (This is a simple counting loop.) loop:

eval +r11

# “+” makes an expression: decimal and hex printing

= r12

r11

# Compute n’th Fibonacci term

= r11

r11+r10

 

= r10

r12

 

= r13

r13+1

# Increment loop counter

if r13<0d50 goto loop

# Loop again?

Figure 9-1. An Example Command File to Compute Fibonacci Numbers

9.5Summary of Command File Commands

. filename

Executes commands in the given command file. The file is opened and its contents are executed as if they were entered from the keyboard. When the contents of a non-nested command file are exhausted, xski and ski resume keyboard input and bski executes a run command followed by a quit command. When a nested command file is exhausted, control returns to the next-higher-level command file.

if expression-without-spaces true-command

if expression-without-spaces true-command :false-command

In the first form, causes the rest of the line to be ignored if expression-without-spacesevaluates to zero. Otherwise, true-commandis executed. In the second form, if expression-without-spacesevaluates to nonzero, the true-commandis executed. Otherwise, the false-commandis executed.

The if command may be executed from the keyboard. In combination with xski’s Command History (see Section 3.7.1, “The xski Main Window”) or ski’s command repetition mechanism (see Section 3.7.2, “The ski Command Window”), this can be quite powerful.

goto label

In a command file (only), causes execution to continue following the first line in the file which contains the label. Goto’s may be forward or backward.

#comment

The “ #” and all characters following it until the next newline are ignored.

label:

The colon (“ :”) command marks a goto label. All characters following the “ :” and preceding the next newline are ignored.

Copyright © 2000 Hewlett-Packard Co.

Command Files 9-3