anyone know ASM?

Discussion in 'Homework Help' started by ABoul, Dec 25, 2009.

  1. ABoul

    Thread Starter Member

    Mar 30, 2009
    15
    0
    the question is attached. i honestly have no clue how to do any of it; i would appreciate it if someone could briefly walk me through what they know.

    EDIT: the only thing i could manage to work out is that in part (i), after the first 3 lines the stack pointer is now at 9998 with the top position (9999) being Y.
     
    • Q1.png
      Q1.png
      File size:
      59.2 KB
      Views:
      43
  2. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    This is obviously homework.

    I can get you started. When you call a subroutine the two byte values that is the return address is put on the stack. The stack is a temporary storage location for addresses, when you run the return command these values are pulled from the stack and used to take the program back where the subroutine was called.

    Like I said, the stack stores addresses on a temporary basis, it uses Last In First Out. Basically the last address stored there is the first to pop out (BTW, this directly relates to the POP command).

    There is a lot of variation between assy languages, though they have certain basics in common. You might specify what CPU you are using.

    I may have repeated what you already knew. If so you need to get more specific with your question(s).
     
  3. ABoul

    Thread Starter Member

    Mar 30, 2009
    15
    0
    for part (i) is this the answer?

    line number | SP | content of stack
    -----------------------------------
    100 | 9999 | <nothing>
    102 | 9999 | <nothing >
    104 | 9998 | Y
    106 | 9997 | <?>*

    *don't know what to put here

    ?
     
    Last edited: Dec 25, 2009
  4. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    PUSH is a stack operation

    PULL is a stack operation

    JSR stores something on the stack
     
  5. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,884
    1,005
    BeenThere,

    I take it that "something" is a hint? ;)
     
  6. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    It certainly is.
     
  7. ABoul

    Thread Starter Member

    Mar 30, 2009
    15
    0
    the next line?
     
  8. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,884
    1,005
    To be more correct, the next address.
     
Loading...