Operating Systems/OS_Assg2_pipes-main/myexpos/xsm/machine.c
xsm_word *machine_stack_pointer(int write)
{
    int stack_top;
    xsm_word *sp_reg = machine_get_spreg();

    stack_top = word_get_integer(sp_reg);
    stack_top = machine_translate_address(stack_top, write, OPER_FETCH, machine_get_mode());

    if (write)
        _thecpu.mem_left = stack_top;

    return machine_memory_get_word(stack_top);
}
/* Retrieve the word pointed by SP */
Retrieve the word pointed by SP
Retrieve the word pointed by SP
xsm_word *machine_stack_pointer(int write)
{
    int stack_top;
    xsm_word *sp_reg = machine_get_spreg();
    stack_top = word_get_integer(sp_reg);
    stack_top = machine_translate_address(stack_top, write, OPER_FETCH, machine_get_mode());
    if (write)
        _thecpu.mem_left = stack_top;
    return machine_memory_get_word(stack_top);
}
xsm_word * machine_stack_pointer ( int write ) { int stack_top ; xsm_word * sp_reg = machine_get_spreg ( ) ; stack_top = word_get_integer ( sp_reg ) ; stack_top = machine_translate_address ( stack_top , write , OPER_FETCH , machine_get_mode ( ) ) ; if ( write ) _thecpu . mem_left = stack_top ; return machine_memory_get_word ( stack_top ) ; }
Retrieve the word pointed by SP
Retrieve the word pointed by SP