Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can some one please help me with assembly language problem?? Thank you very much

ID: 642980 • Letter: C

Question

Can some one please help me with assembly language problem?? Thank you very much

Write a procedure that performs the following:

If AH is F1H: set the carry flag if BX >= (DX-CX), clear the carry flag if BX< (DX-CX).

If AH is not F1H: clear the carry flag.

To set the carry flag, use STC instruction; to clear it, use CLC.

Make sure calling this procedure does not result in the changing of any register after the call returns; i.e., calling this procedure only changes the flags.

Use the following program as a starting point. The procedure should be called from this program.

org 100h

.DATA

var1       DW    2307H

.CODE

                                                  

start:

        MOV AX,[0124H]

        MOV BX,var1

        MOV CX,1234H

        MOV DX,4321H

        SUB AX,BX

       

Explanation / Answer

org 100h start: ; set up some interrupt vector 5Fh mov ax,0 mov es,ax mov ax,cs mov bx,WORD [es:05Fh*4] ; save old one mov cx,WORD [es:(05Fh*4)+2] mov [old_5f],bx mov [old_5f+2],cx mov WORD [es:05Fh*4],my_interrupt mov WORD [es:(05Fh*4)+2],ax ; try it int 5Fh ; restore mov ax,0 mov es,ax mov bx,[old_5f] mov cx,[old_5f+2] mov WORD [es:05Fh*4],bx mov WORD [es:(05Fh*4)+2],cx ret my_interrupt: mov ax,1234h mov bx,5678h mov cx,8765h mov dx,4321h iret old_5f dd 0