O AX=10; BX=2
O AX=20; BX=2
12) If AL=17H, CL=34H, SS=3000H and SP=FF45H. Analyse the following assembly code snippet What is the value of SP after the following code executes? 1 p
PUSHAL
PUSH CL
POP WORDPTR[ECX]
Answers
Answer:
CF
carry flag
ZF
zero flag
SF
sign flag
OF
overflow flag
IF
interrupt enable flag
DF
direction flag
The PUSHF/POPF instructions
format:
PUSHF
POPF
These instructions save and restore all the flags to/from the stack. This preserves the flags when the code about to be executed is going to modify crucial flags.
example:
pushf
call bigadd ; call procedure
popf
External/Public assembler directives
In order to incorporate procedures written in separate files, the programmer needs to include PUBLIC directives in the procedure file and EXTRN directives in the main program file. The secondary procedure file need not have a program entry point since it cannot be used on its own. Assuming that a procedure called readsint has been defined to read an integer into the AX register. This procedure is then exported by including the following line at the top of the code in the secondary file:
PUBLIC readsint
Similarly, the program that is going to use this procedure must include a statement telling the assembler that it is going to use a procedure from an external file. To do this, the following line must be included at the top of the main program source file:
EXTRN readsint:proc
Multiple declarations can be separated by commas
eg. EXTRN readsint:proc,writesint:proc
After both files are assembled separately, the files must be linked together with a command such as:
TLINK MAIN.OBJ SECOND.OBJ
The IOASM library provides the following two procedures that can be incorporated into your programs to make input and output simpler:
readsint - reads an integer into the AX register
writesint - writes the value of the AX register to standard output
To link your programs with IOASM, you need to include the following line at the top of your program:
EXTRN readsint:proc, writesint:proc
and then link the program with the command TLINK YOURFILE IOASM.LIB
Sample Program #4
; simple numerical output program
DOSSEG
.MODEL SMALL
.STACK 4096
.DATA
Number1 dw 12
Number2 dw 24
Number3 dw 36
.CODE
EXTRN writesint:proc
; use procedure from IOASM to output number to sc
Make me brainliest