COS10004 Lecture Notes - Lecture 11: Goto, Javacc, Subroutine

146 views15 pages
17 Mar 2018
Department
Course
Professor

Document Summary

- execute instructions starting at label xyz i. e. subprograms. - jump back to the next instruction after the call. In fact this return statement is optional (in these languages) Like goto, the call and return instructions take 2 cpu cycles. The pc is incremented during first cycle to point to next address in memory. The pc is modified in the 2nd cycle. Like goto, call gets 11 address bits from the instruction, the other 2 from the pclath register (not shown here) If the subroutine is in a different page of code then need to set up. The microchip stack is 8 deep, so. Maximum depth of nested calls is 8. Maybe more if nested interrupts are programmed. (and less one for on-chip debugger if used) Already full a fatal error: program stops. Easy if it is a byte: var =xyz(); // some code to calculate r return r;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents