Menu

[solved]-Write Program 8088 Assembly Language Accepts Integer Operator Integer Standard Output Disp Q39063827

Write a program in 8088 assembly language that accepts aninteger an operator and an integer from standard output anddisplays the calculation of the expression using standard output.Use the operators +, -, *, and / for addition, subtraction,multiplication, and division.

The program below already reads from standard input so only thecalculation part must be done.

_PRINTF = 127 ! 1

_GETCHAR = 117 ! 2

_EXIT = 1 ! 3

asciinl = 10 ! 4

EOF = -1 ! 5

.SECT .TEXT ! 6

start: ! 7

MOV DI,STR ! 8

PUSH _GETCHAR ! 9

1: SYS ! 10

CMP AX,EOF ! 11

JE 9f ! 12

STOSB ! 13

CMPB AL,asciinl ! 14

JNE 1b ! 15

MOVB (DI),0 ! 16

PUSH STR ! 17

PUSH _PRINTF ! 18

SYS ! 19

ADD SP,4 ! 20

MOV DI,STR ! 21

JMP 1b ! 22

9: PUSH 0 ! 23

PUSH _EXIT ! 24

SYS ! 25

.SECT .DATA ! 26

.SECT .BSS ! 27

STR: .SPACE 80 ! 28

List of what each mnemonic means.

Mnemonic Status flags Description Operands Z C MOV (B) XCHG(B) LEA Move word, byte Exchange word re, e r, e # r e Load effect

When to jump Description Instruction CF 1 or ZF 1 CF 0 Below or equal JNA, JBE JNB, JAE, JNC Not below Zero, equal ZF=1 JE, J

Description Nr Name Arguments Return value Open file Create file file descriptor file descriptor #bytes #bytes OPEN name, 0/1

Mnemonic Status flags Description Operands Z C MOV (B) XCHG(B) LEA Move word, byte Exchange word re, e r, e # r e Load effective address r#e PUSH Push onto stack e, # POP Pop from stack Push flags Pop flags Translate AL e PUSHF POPF XLAT ADD(B) ADC(B) SUB(B) SBB(B) Add word # re, e r, e Add word with carry re, e e # Subtract word # re, er, e Subtract word with borrow # re, er, e Multiply signed Multiply unsigned Divide signed Divide unsigned IMUL(B) MUL(B) IDIV(B) DIV(B) e U U U U U U U U U CBW Sign extend byte-word Sign extend word-double Negate binary Logical complement Increment destination CWD NEG(B) NOT(B) INC(B) DEC(B) AND(B) OR(B) XOR(B) E Decrement destination Logical and Logical or Logical exclusive or # e r, re, e er,r e, e # e r, re, e# 0 e1, e CL e1, e CL e1, e CL e 1, e CL e 1, e CL SHR(B) SAR(B) SAL(B) (SHL(B) ROL(B) ROR(B) RCL(B) RCR(B) Logical shift right Arithmetic shift right shift left Rotate left Rotate right Rotate left with carry Rotate right with carry e 1, e CL e 1, e CL TEST(B) CMP(B) STD Test operands Compare operands Set direction flag (J) Clear direction flag (T) Set carry flag Clear carry flag Complement carry C e r, e # er, e # CLD STC 1 CLC C CMC LOOP Jump back if decremented CX 20 Back if Z-1 and DEC(CX)20 Back if Z-0 and DEC(CX)20 Repeat string instruction Move word string Load word string Store word string Scan word string Compare word string Jump according conditions Jump to label Jump to subroutine Return from subroutine System call trap label LOOPZ LOOPE LOOPNZ LOOPNE label label REP REPZ REPNZ string instruction MOVS(B) LODS(B) STOS(B) SCAS(B) CMPS(B) JCC label JMP e, label e. label CALL RET -, # SYS …. *.> oo 0… . When to jump Description Instruction CF 1 or ZF 1 CF 0 Below or equal JNA, JBE JNB, JAE, JNC Not below Zero, equal ZF=1 JE, JZ JNLE, JG Greater than SF-OF and ZF=0 Greater equal JGE, JNL SF-OF OF 1 JO Overflow JS Sign negative SF=1 JCXZ CX is zero CX 0 CF 1 JB, JNAE, JC Below Above CF-0&ZF-0 JNBE, JA Nonzero, nonequal ZF=0 JNE, JNZ SF OF JL, JNGE Less than SF OF or ZF=1 OF 0 Less or equal JLE, JNG Nonoverflow JNO JNS SF-0 Nonnegative Description Nr Name Arguments Return value Open file Create file file descriptor file descriptor #bytes #bytes OPEN name, 0/1/2 name, *mode fd, buf, nbytes fd, buf, nbytes CREAT 8 READ 3 Read nbytes in buffer buf Write nbytes from buffer buf WRITE 4 CLOSE fd Close file with fd 0 on success fd, offset(long), 0/1/2position (long) Move file pointer Close files Stop process LSEEK 19 1 LEXIT status Read character from std input Write character to std output Print formatted on std output GETCHAR read character 117 write byte 122 PUTCHAR char *format, arg PRINTF 127 buf, *format, arg buf, “format, arg SPRINTF Print formatted in buffer buf 121 SSCANF Read arguments from buffer buf 125 Ln CO C d O * Show transcribed image text Mnemonic Status flags Description Operands Z C MOV (B) XCHG(B) LEA Move word, byte Exchange word re, e r, e # r e Load effective address r#e PUSH Push onto stack e, # POP Pop from stack Push flags Pop flags Translate AL e PUSHF POPF XLAT ADD(B) ADC(B) SUB(B) SBB(B) Add word # re, e r, e Add word with carry re, e e # Subtract word # re, er, e Subtract word with borrow # re, er, e Multiply signed Multiply unsigned Divide signed Divide unsigned IMUL(B) MUL(B) IDIV(B) DIV(B) e U U U U U U U U U CBW Sign extend byte-word Sign extend word-double Negate binary Logical complement Increment destination CWD NEG(B) NOT(B) INC(B) DEC(B) AND(B) OR(B) XOR(B) E Decrement destination Logical and Logical or Logical exclusive or # e r, re, e er,r e, e # e r, re, e# 0 e1, e CL e1, e CL e1, e CL e 1, e CL e 1, e CL SHR(B) SAR(B) SAL(B) (SHL(B) ROL(B) ROR(B) RCL(B) RCR(B) Logical shift right Arithmetic shift right shift left Rotate left Rotate right Rotate left with carry Rotate right with carry e 1, e CL e 1, e CL TEST(B) CMP(B) STD Test operands Compare operands Set direction flag (J) Clear direction flag (T) Set carry flag Clear carry flag Complement carry C e r, e # er, e # CLD STC 1 CLC C CMC LOOP Jump back if decremented CX 20 Back if Z-1 and DEC(CX)20 Back if Z-0 and DEC(CX)20 Repeat string instruction Move word string Load word string Store word string Scan word string Compare word string Jump according conditions Jump to label Jump to subroutine Return from subroutine System call trap label LOOPZ LOOPE LOOPNZ LOOPNE label label REP REPZ REPNZ string instruction MOVS(B) LODS(B) STOS(B) SCAS(B) CMPS(B) JCC label JMP e, label e. label CALL RET -, # SYS …. *.> oo 0… .
When to jump Description Instruction CF 1 or ZF 1 CF 0 Below or equal JNA, JBE JNB, JAE, JNC Not below Zero, equal ZF=1 JE, JZ JNLE, JG Greater than SF-OF and ZF=0 Greater equal JGE, JNL SF-OF OF 1 JO Overflow JS Sign negative SF=1 JCXZ CX is zero CX 0 CF 1 JB, JNAE, JC Below Above CF-0&ZF-0 JNBE, JA Nonzero, nonequal ZF=0 JNE, JNZ SF OF JL, JNGE Less than SF OF or ZF=1 OF 0 Less or equal JLE, JNG Nonoverflow JNO JNS SF-0 Nonnegative
Description Nr Name Arguments Return value Open file Create file file descriptor file descriptor #bytes #bytes OPEN name, 0/1/2 name, *mode fd, buf, nbytes fd, buf, nbytes CREAT 8 READ 3 Read nbytes in buffer buf Write nbytes from buffer buf WRITE 4 CLOSE fd Close file with fd 0 on success fd, offset(long), 0/1/2position (long) Move file pointer Close files Stop process LSEEK 19 1 LEXIT status Read character from std input Write character to std output Print formatted on std output GETCHAR read character 117 write byte 122 PUTCHAR char *format, arg PRINTF 127 buf, *format, arg buf, “format, arg SPRINTF Print formatted in buffer buf 121 SSCANF Read arguments from buffer buf 125 Ln CO C d O *

Expert Answer


Answer to Write a program in 8088 assembly language that accepts an integer an operator and an integer from standard output and di… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *