CPSC 355 Lecture Notes - Lecture 21: Specific Impulse, Subroutine, Machine Code

196 views5 pages

Document Summary

Cpsc 355 - lecture 21 oct 31st. Int main( ){ structure employee joe; joe. id = 4001; joe. start. day = 1; joe. start. month = 6; joe. start. year = 1999; //calculate struct base address mov x29, sp main: stp add mov w20, 4001 str w20, [joe_base_r, employee_id] mov w20, 1 strb w20, [joe_base_r, employee_start + date_day mov w20, 6 strb w20, [joe_base_r, employee_start + date_month // joe. start. month = 6. // joe. id = 4001 mov w20, 1999 strh w20, [joe_base_r, employee_start + date_year (assembler evaluates the expression, producing a constant) Subroutines allow you to repeat a calculation using varying argument values. Code is inserted inline wherever the subroutine is invoked. Efficient, since overhead of branching and returning is avoided. Suitable only for fairly short routines: closed. Machine code for the routine appears only cone in ram. Leads to more compact machine code than with open routines. Whe(cid:374) i(cid:374)(cid:448)oked, (cid:272)o(cid:374)trol (cid:862)ju(cid:373)ps(cid:863) to the first i(cid:374)stru(cid:272)tio(cid:374) of the routine.

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