Structured programming Flashcards
How is a program started
pc starts at 0 and mem[0 contains a jump instuction to start of program in memory
what is stored between 0 and the start of a program
constants globals and strinsg
what does the stack store
local variables and support subroutine calls
what si the stack pointer
stores the memory location to the top of the stack
how are subroutine calls performed using the stack
caller local variables and subroutine parameters pushed to the stack
(caller -> function which makes the call)
push the return address -> the address to go to after the subroutine
(ldap 1)
update the stack pointer
once returnvalue is calculated add it to the stack frame
How does a subroutine end using the stack
stack pointer is updated (often incremented because the stack is often from high to low)
return address is oppped and used for a jump instruction
rest of the data is popped off