Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just want to say how much I value your site. I hope the good work keeps up there. It's really helped me..."

Geography

Where in the world do Tek-Tips members come from?

Assembly language programming

Berlisen (Programmer)
23 Feb 12 17:58
Hi Guys


I am fairly new at assembly languages and I need to learn how to do a simple program

what it would do is take 3 stacks, one with three characters and one with  numbers 1-3(in random order) and the third one would be empty.

Basically I want to make a program that takes the letter from the first stack and check its number on the second stack and essentially put it in that order on the third stack

So for example if the character was B and the number was 2 then B would be BETWEEN the two other characters at the end of the script.

so assume the stacks were like this (before the program)

Stack 1   Stack 2    Stack 3(empty)
  B         1        -
  A         3        -
  D         4        -
  E         5        -
  L         2        -  

After the program stack 3 would look like this

Stack 3
  B
  L
  A
  D
  E

It would be nice if stacks A and B were not effected

And it does not necessarily have to be a letter as long as all the data in stack A is the same size.

I know this might be much but it would really help me a lot.


thanks.
telesimke (IS/IT--Management)
24 Feb 12 9:55
I hope it works!

iterate trough stack and find a match ex. for number 1
        la r4,1
        la r5,stack2
        la r6,0
        la r7,stack1
        sr r5,r7
        lr r7,r5
        la r5,stack2
loop    c  r4,0(r6,r5)
        be tost3
        la r6,1(r6)
        b  loop
tost3   la r9,stack3
        ar r9,r6
        ar r6,r5
        sr r6,r7
        mvc 0(0,r9),0(r6)
        la  r6,0
        la  r4,1(r4)
        c   r4,stklen
        bnh loop
        l  r13,save+3
        return (14,12)
stack1 dc  al1(c'b',c'a'....)
stack2 dc  a(x'000001',x'00000003'...)
stack  ds  Xal1        x is the number of elements in stacks
stklen dc  x'XY'    xy=num of elemetts in hex
       yregs
       end       
      
       
 

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!

Back To Forum

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