INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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.

RE: Understanding a few lines of older code

Hopefully you've found your answer by now, but.......

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

(OP)
Thank you very much for your reply! I actually figured out a few days later about the "#" being not equals. As for the PRINT USING and IMAGE lines, your reply is actually very helpful. I feel like I can probably understand how they work now. The format masks I might be able to figure out through trial and error and analyzing how the game works. Again, thank you very much!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close