computer architrcture 1) We have data stored in memory location 0x3aa, 0x3bb and
ID: 3796268 • Letter: C
Question
computer architrcture
1) We have data stored in memory location 0x3aa, 0x3bb and 0x3cc. How do we perform the following operation multiply 0x3aa by 0x3bb and store into 0x3cc
a) (3,3) GPU only using register indirect
b) (3,3) GPU only using memory indirect (will need to have additional memory locations)
2) Write out how to solve the following code using any addressing mode for (0,3) GPR. Write comments besides each line of code. Similar to how it was done in class.
Short a[50];
Int y,z;
for( x=0; x<20; x++)
{
y = a[x + 3];
z = y + a[x%10];
}
Explanation / Answer
1.(a) Go here....
DATA SEGMENT
NUM1 DB ?
NUM2 DB ?
RESULT DB ?
MSG1 DB 10,13,"ENTER FIRST NUMBER TO MULTIPLY : $"
MSG2 DB 10,13,"ENTER SECOND NUMBER TO MULTIPLY : $"
MSG3 DB 10,13,"RESULT OF MULTIPLICATION IS : $"
ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV NUM1, 0x3aa
MOV NUM2, 0x3bb
MOV AX,DATA
MOV DS,AX
LEA DX,MSG1
MOV AH,9
INT 21H
MOV AH,1
INT 21H
SUB AL,30H
MOV NUM1,AL
LEA DX,MSG2
MOV AH,9
INT 21H
MOV AH,1
INT 21H
SUB AL,30H
MOV NUM2,AL
MUL NUM1
MOV RESULT,AL
MOV [0x3cc],RESULT
AAM
ADD AH,30H
ADD AL,30H
MOV BX,AX
LEA DX,MSG3
MOV AH,9
INT 21H
MOV AH,2
MOV DL,BH
INT 21H
MOV AH,2
MOV DL,BL
INT 21H
MOV AH,4CH
INT 21H
ENDS
END START
1.(b) Go here.....
_start: ;tell linker entry point
mov al,[0x3aa]
sub al, '0'
mov bl, [0x3bb]
sub bl, '0'
mul bl
add al, '0'
mov 0x3cc, al
mov [res], [0x3cc]
mov ecx,msg
mov edx, len
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov ecx,res
mov edx, 1
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
msg db "The result is:", 0xA,0xD
len equ $- msg
segment .bss
res resb 1
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.