Question

In: Computer Science

Write a code in arm 8086 keil software version 5 for signed input and perform addition...

Write a code in arm 8086 keil software version 5 for signed input and perform addition and subtraction using both direct and indirect addressing mode.

Solutions

Expert Solution

Answer.

Using indirect addressing mode.

ADDITION.... CODE..

1 2
3 0000
4 0000
5 0002
6 0004
7 0006
8
9 0000
10
11 0000
12 0000
13 0003
14
15 0005
16 0008
17 000B 8B 04
18 000D 8B 1D


assume cs:code,ds:data
data segment n1 dw 0444h n2 dw 4545h n3 dw ?
data ends code segment
start:
mov ax,data mov ds,ax
lea si,n1 lea di,n2 mov ax,[si] mov bx,[di] add ax,bx
lea bp,n3 mov [bp],ax
int 3
code ends end start
19 000F 20
21 0011
22 0014
23
24
25
26 0017 27
28 0028 29
03 C3
BD 0004r 89 46 00
CC
0444 4545 ????
B8 0000s 8E D8
BE 0000r BF 0002r

RESULT -- AX= 4989 , SI=0000 , DI=0002, BP=0004 D 0004 0005 89 49

SUBTRACTION..USING INDIRECT ADDRESSING MODE..

1 2
3 0000
4 0000
5 0002
6 0004
7 0006
8
9 0000
10
11 0000
12 0000
13 0003
14
15 0005
16 0008
17 000B 8B 04
18 000D 8B 1D


assume cs:code,ds:data
data segment n1 dw 0aaaah n2 dw 4545h n3 dw ?
data ends
code segment
start:
mov ax,data mov ds,ax
lea si,n1 lea di,n2 mov ax,[si] mov bx,[di] sub ax,bx
lea bp,n3 mov [bp],ax
int 3
code ends end start
19 000F 20
21 0011
22 0014
23
24
25
26 0017 27
28 0018 29
RESULT:
2B C3
BD 0004r 89 46 00
CC
AAAA 4545 ????
B8 0000s 8E D8
BE 0000r BF 0002r

RESULT -- AX= 65 65 , SI=0000 , DI=0002, BP=0004 D 0004 0005
65 65

USING DIRECT ADDRESSING MODE....

ADDITION..CODE

1 2
3 0000
4 0000
5 0002
6 0004
7 0006
8
9 0000
10
11 0000
12 0000
13 0003
14
15 0005
16 0008
17 000C A3 0004r
18 000F BE 0004r
19
20 0012 CC 21
22 0013
23


assume cs:code,ds:data
data segment n1 dw 5aaah n2 dw 4545h n3 dw ?
data ends code segment
start:
mov ax,data mov ds,ax
mov ax,n1 add ax,n2 mov n3,ax lea si,n3
int 3
code ends end start
5AAA 4545 ????
B8 0000s 8E D8
A1 0000r 03 06 0002r

RESULT -- AX= 9FEF , SI=0004 ; D 0004 0005 EF 9F

SUBTRACTION -- CODE

1 2
3 0000
4 0000
5 0002
6 0004
7 0006
8
9 0000
10
11 0000
12 0000
13 0003
14
15 0005
16 0008
17 000C A3 0004r


assume cs:code,ds:data
data segment n1 dw 5aaah n2 dw 4545h n3 dw ?
data ends code segment
start:
mov ax,data mov ds,ax
mov ax,n1 sub ax,n2 mov n3,ax
5AAA 4545 ????
B8 0000s 8E D8
A1 0000r 2B 06 0002r
6
18 000F BE 0004r 19
20 0012 CC
21
22 0013 23
lea si,n3 int 3
code ends end start

RESULT... AX= 6565 , SI=0004 ; D 0004 0005

So, Here are the codes so please go through very carefully and try to understand properly and if any doubt ask in comment section.I'll be happy to solve problem regarding this code.


Related Solutions

Write a Behavioral model VHDL code that implements an ALU that can perform addition, subtraction, multiplication,...
Write a Behavioral model VHDL code that implements an ALU that can perform addition, subtraction, multiplication, shift right, shift left, logical NAND, and logical NOR. Write a VHDL test bench to test the ALU with at least one test vector per operation.
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed...
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed to use other libraries. Only this libraries are allowed to use: use library ieee; use ieee.std_logic_1164.all; Please do it correctly and include the comments for me to fully understand. Thank you.
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed...
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed to use other libraries only this is allowed to use library ieee; use ieee.std_logic_1164.all; Please write the comments for me to fully understand. Thank you.
Write in assembly 8086. Write a program to input nine numbers in 4*4 array and prints...
Write in assembly 8086. Write a program to input nine numbers in 4*4 array and prints the maximum value of each row and then prints the minimum of each column.
Write an 8086 assembler program (using the emulator) that will perform the following calculations. All values...
Write an 8086 assembler program (using the emulator) that will perform the following calculations. All values below are decimals. You must attach Screenshot of emu8086 showing the different register values at the end of the execution A printed copy of your code (screenshot is OK) a) (6 -4) * 20 - (9 + 1)            Place the answer in the AX register b) 1000 - 4 * (3 *32)             Place the answer in the AX register
Write the following code in ARM assembly code g=12, h=8, i=2, j=5; f = (g +...
Write the following code in ARM assembly code g=12, h=8, i=2, j=5; f = (g + h) - (i + j); Your program displays the message: f = (g + h) – (i + j) = 13 Note that 13 should be calculated, not hardcoded
**Add comments to existing ARM code to explain steps** Write an ARM assembly program to convert...
**Add comments to existing ARM code to explain steps** Write an ARM assembly program to convert temperatures from Celsius to Fahrenheit or from Fahrenheit to Celsius. Here are the two formulas for your reference. Use variable to read and store values. C= 5* (F - 32) / 9 F = (9 * C / 5 ) + 32 My code below: TempConvert.s LDR R8,=temperature LDR R1,[R8] LDR R8,=unit LDRB R2,[R8] LDR R8,=celsius LDRB R3,[R8] LDR R8,=fahrenheit LDRB R4,[R8] MOV R6,#9...
**Add comments to ARM code to explain steps** Write an ARM assembly program to convert temperatures...
**Add comments to ARM code to explain steps** Write an ARM assembly program to convert temperatures from Celsius to Fahrenheit or from Fahrenheit to Celsius. Here are the two formulas for your reference. Use variable to read and store values. C= 5* (F - 32) / 9 F = (9 * C / 5 ) + 32 TempConvert.s LDR R8,=temperature LDR R1,[R8] LDR R8,=unit LDRB R2,[R8] LDR R8,=celsius LDRB R3,[R8] LDR R8,=fahrenheit LDRB R4,[R8] MOV R6,#9 MOV R7,#5 ;----C =...
THIS IS FOR DEVC++. I use the 5.11 version Write a program to take input of...
THIS IS FOR DEVC++. I use the 5.11 version Write a program to take input of scores for Chemistry, Biology and English for a student and display the average with 2 decimal places if all of the three scores are in the range between 1 and 100 inclusive. Program should also display the course name for which scores are entered out of range telling Average couldn't be calculated. Following is a sample run: Enter scores for Chemistry, Biology and English...
**Add comments to existing ARM code to explain steps** Question that my code answers: Write an...
**Add comments to existing ARM code to explain steps** Question that my code answers: Write an ARM assembly program to calculate the value of the following function: f(y) = 3y^2 – 2y + 10 when y = 3. My Code below, that needs comments added: FunSolve.s LDR R6,=y LDR R1,[R6] MOV R2,#5 MOV R3,#6 MUL R4,R1,R1 MUL R4,R4,R2 MUL R5,R1,R3 SUB R4,R4,R5 ADD R4,R4,#8 st B st y DCD 3
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT