Exercises-Subroutines

Exercises-Subroutines - i. byte sub () j. int sub (byte a)...

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

View Full Document Right Arrow Icon
SYSC-3006 Computer Organisation Study Exercises : Subroutines & Parameter Passing. 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. void sub (word a, int b) f. void sub (boolean &a) g. void sub (word &b) h. void sub (byte a, word &b)
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: 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

Page1 / 2

Exercises-Subroutines - i. byte sub () j. int sub (byte a)...

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