0

Hi I am trying to compute the modulus of two numbers in assembly code. As I am more fluent in C++ it is hard for me to understand the concept of modulus as all I use is the symbol % to compute. The problem I am doing is computing the exponent of X to the Y power and then the modulus of this answer with Z. Where X, Y, and Z are one digit numbers input from the keyboard. This is what I have so far.

```
mov ah,1
int 21h ;input X
mov bl,al ;move X to register bl
mov ah,1
int 21h ;input Y
mov cl,al ;move Y to register cl
mov ah,1
int 21h ;input Z
mov dl,al ;move Z to register dl
mov al,bl ;move X back to al for multiplication
loop:
mul al ;multiply X to itself
sub cl,1 ;decrement Y
cmp cl,1 ;compare to see if Y is 1
jne loop ;if Y is greater than 1 jump to loop
mod al,dl ;???MODULUS??? I know this isn't
;right, it is the part i need help with
mov dl,al ;move answer to dl
mov ah,2
int 21h ;ouput answer
```