## Understanding a few lines of older code

## Understanding a few lines of older code

(OP)

Hello, I've been working on updating an old game programmed in HP standard Basic to a more modern language, but I'm having difficulty understand and finding reference to a few of the commands used by the language. After a bit of research, I hope I've come to the right place. I'm having trouble with the following lines of code, broken up into two sections:

First Set:

1100 PRINT USING 1110;T[11,T1],T[1,T1],T[2,T1],T[3,T1],T[4,T1],T[5,T1],T[6,T1],T[7,T1]

1110 IMAGE DDXDDDXDDD,7(4X,2D)

3560 PRINT USING "#,4A,2X";S$[S[8,S1],S[8,S1]+3]

3570 PRINT USING "5A,6(S5D)";D$,P[1],P[2],P[3],P[4],P[5],P[6]

3820 PRINT USING 3830;P1,M1,B[1,P1],M2,M3

3830 IMAGE 2X,2D,2X,4(2X,DDXDDDXDDD)

Second Set:

1310 IF K1#K9 MAX 2 THEN 1340

2162 IF G0#5 AND G0#10 AND G0#15 THEN 2220

2880 IF I#S1 THEN 2910

In the first set of lines, though I researched the 'PRINT USING' command, I wasn't able to find anything about how these particular PRINT USING's work, as the format is different then what I found online. So far as I can tell, the IMAGE command is just a sort of short cut that links to the PRINT USING. For example, in line 3560, what does "#,4A,2X" accomplish?

For the second set, I'm unfamiliar with what the # means or what it does.

Any help of the subject will be greatly appreciated. Thanks.

First Set:

1100 PRINT USING 1110;T[11,T1],T[1,T1],T[2,T1],T[3,T1],T[4,T1],T[5,T1],T[6,T1],T[7,T1]

1110 IMAGE DDXDDDXDDD,7(4X,2D)

3560 PRINT USING "#,4A,2X";S$[S[8,S1],S[8,S1]+3]

3570 PRINT USING "5A,6(S5D)";D$,P[1],P[2],P[3],P[4],P[5],P[6]

3820 PRINT USING 3830;P1,M1,B[1,P1],M2,M3

3830 IMAGE 2X,2D,2X,4(2X,DDXDDDXDDD)

Second Set:

1310 IF K1#K9 MAX 2 THEN 1340

2162 IF G0#5 AND G0#10 AND G0#15 THEN 2220

2880 IF I#S1 THEN 2910

In the first set of lines, though I researched the 'PRINT USING' command, I wasn't able to find anything about how these particular PRINT USING's work, as the format is different then what I found online. So far as I can tell, the IMAGE command is just a sort of short cut that links to the PRINT USING. For example, in line 3560, what does "#,4A,2X" accomplish?

For the second set, I'm unfamiliar with what the # means or what it does.

Any help of the subject will be greatly appreciated. Thanks.

## RE: Understanding a few lines of older code

OK, it's been like 15 years since I saw VAX Basic, but here's a stab at part of the answer.

Note that in

1100 PRINT USING 1110;T[11,T1],T[1,T1],T[2,T1],T[3,T1],T[4,T1],T[5,T1],T[6,T1],T[7,T1]

means print the variables/fields T(11,T1),..... using the format mask defined in line 1110, where the mask "DDXDDDXDDD" is applied to the T(11,T1) and 7(4X,2D) applies "4X,2D" to the next 7 variables T[1,T1],..,T[7,T1)

3560 and 3570 use the other form of USING to combine the variable/field list with the format mask in one line.

I do not remember the format mask definitions, sorry.

I believe the "#" is the logical operator "not equals". Does that make sense in the context you're seeing?

## RE: Understanding a few lines of older code