Exercises-Subroutines

Exercises-Subroutines - void sub (word a, int b) f. void...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
SYSC-3006 Computer Organisation References in the Text : Section 5.4 and 5.5 Chapter 9 (Beyond the course, but great stuff) Selected Exercises from the Text Section Review, page 158 Questions 1-8 Section Review, page 168 Questions 1-3, 5-7 Additional Exercises 1. For each of the following C-prototypes, write the code for calling and implementing the subroutine. For the implementation, we don’t know (nor care) what it is supposed to do. Simply show you would access and manipulate each of the parameters and return type. a. void sub () b. void sub (byte a) c. void sub (byte a, byte b) d. void sub (word a) e.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: void sub (word a, int b) f. void sub (boolean &a) g. void sub (word &b) h. void sub (byte a, word &b) i. byte sub () j. int sub (byte a) k. boolean sub (char a, byte b) l. long int sub (char a, int b, int &c) 2. For each of the following code fragments, reverse-engineer the C-like prototype for the subroutine. a. sub PROC MOV AL, xxx RET sub ENDP b. sub PROC PUSH BP MOV BP, SP PUSH AX PUSH DX MOV BX, [BP+6] MOV [BX], DX MOV AL, [BP+4] POP DX POP AX POP BP RET sub ENDP c. sub PROC PUSH BP MOV BP, SP PUSH BX PUSH DX MOV BX, [BP+8] MOV BX, xxx MOV AX, [BP+4] MOV DX, [BP+6] MOV AL, xxx POP DX POP BX POP BP RET sub ENDP...
View Full Document

This note was uploaded on 01/18/2012 for the course SYSC SYSC3006 taught by Professor G.wainer during the Fall '11 term at Carleton CA.

Page1 / 2

Exercises-Subroutines - void sub (word a, int b) f. void...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online